[SeaBIOS] [PATCH] Ignore AHCI NPORTS

Gerd Hoffmann kraxel at redhat.com
Wed Mar 12 08:06:22 CET 2014


On Di, 2014-03-11 at 10:55 -0400, Kevin O'Connor wrote:
> On Tue, Mar 04, 2014 at 12:35:00AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> > On Easynote LM85 under both coreboot and vendor BIOS NPORTS is 3, yet
> > port 4 is used for CD-ROM. NPORTS is RO on this chipset and has same
> > value on vendor BIOS as well, so it's not a coreboot bug.
> > Linux does essentially the same, by increasing nports variable if bits
> > in PI are set above nports-1. GRUB ignores PI since this problem was
> > detected.
> > 
> > diff --git a/src/hw/ahci.c b/src/hw/ahci.c
> > index ff5d5f9..3193d81 100644
> > --- a/src/hw/ahci.c
> > +++ b/src/hw/ahci.c
> > @@ -601,7 +601,7 @@ ahci_controller_setup(struct pci_device *pci)
> >      dprintf(2, "AHCI: cap 0x%x, ports_impl 0x%x\n",
> >              ctrl->caps, ctrl->ports);
> > 
> > -    max = ctrl->caps & 0x1f;
> > +    max = 0x1f;
> >      for (pnr = 0; pnr <= max; pnr++) {
> >          if (!(ctrl->ports & (1 << pnr)))
> >              continue;
> 
> Gerd, any thoughts on this?

Fine.  Checking nports isn't needed, it's just a minor optimization to
not walk all 32 port bits if only 4 of them are (supposed to be) used.
If existing hardware gets it wrong and the workaround is that easy lets
do it.

cheers,
  Gerd






More information about the SeaBIOS mailing list