[SeaBIOS] [PATCH] Seabios: allow mapping of multiple PCI option ROMs to one

Kevin O'Connor kevin at koconnor.net
Fri May 31 03:45:13 CEST 2013


On Thu, May 30, 2013 at 07:49:36AM -0500, Dave Frodin wrote:
> > From: "Kevin O'Connor" <kevin at koconnor.net>
> > --- a/src/optionroms.c
> > +++ b/src/optionroms.c
> > @@ -178,10 +178,19 @@ deploy_romfile(struct romfile_s *file)
> >  static struct rom_header *
> >  lookup_hardcode(struct pci_device *pci)
> >  {
> > -    char fname[17];
> > -    snprintf(fname, sizeof(fname), "pci%04x,%04x.rom"
> > +    struct romfile_s *file;
> > +    char fname[19];
> > +    snprintf(fname, sizeof(fname), "alias%04x,%04x.rom"
> >               , pci->vendor, pci->device);
> > -    struct romfile_s *file = romfile_find(fname);
> > +    char *alias = romfile_loadfile(fname, NULL);
> > +    if (alias) {
> > +        file = romfile_find(alias);
> > +        free(alias);
> > +    } else {
> > +        snprintf(fname, sizeof(fname), "pci%04x,%04x.rom"
> > +                 , pci->vendor, pci->device);
> > +        file = romfile_find(fname);
> > +    }
> >      if (file)
> >          return deploy_romfile(file);
> >      return NULL;
> >
> 
> In your sample code above, I don't see where any pci ID translation
> (mapping) occurs.
> As an example we could have a family14 mainboard with a coreboot
> .config that generates a vga option rom with the name
> "pci1002,9802.rom". The actual mainboard could have a graphics chip
> with the id of 1002,9804 (which is 1 of 8 possible IDs). So there
> needs to be some sort of mapping function (in SeaBIOS) that maps the
> ID of 1002,9804 to 1002,9802.

With the above patch (assuming it works) one should be able to create
a CBFS file named "alias1002,9804.rom" that contains the text
"pci1002,9802.rom".

-Kevin



More information about the SeaBIOS mailing list