[SeaBIOS] [PATCH 05/20] simplify chipset detection

Gerd Hoffmann kraxel at redhat.com
Wed Nov 28 07:52:27 CET 2012


On 11/28/12 01:35, Kevin O'Connor wrote:
> On Tue, Nov 27, 2012 at 10:20:56AM +0100, Gerd Hoffmann wrote:
>> Just set a global variable in the first chipset detection
>> function (pci_bios_init_platform) and use them later on.
> [...]
>>  static void *
>> -build_fadt(struct pci_device *pci)
>> +build_fadt(void)
>>  {
>>      struct fadt_descriptor_rev1 *fadt = malloc_high(sizeof(*fadt));
>>      struct facs_descriptor_rev1 *facs = memalign_high(64, sizeof(*facs));
>> @@ -327,7 +314,10 @@ build_fadt(struct pci_device *pci)
>>      fadt->firmware_ctrl = cpu_to_le32((u32)facs);
>>      fadt->dsdt = 0;  /* dsdt will be filled later in acpi_bios_init()
>>                          by fill_dsdt() */
>> -    pci_init_device(fadt_init_tbl, pci, fadt);
>> +    if (have_piix4)
>> +        piix4_fadt_init(fadt);
>> +    if (have_ich9)
>> +        ich9_lpc_fadt_init(fadt);
> 
> I liked the original way better.  The pci_init_device() function is
> pretty cheap (it just walks a linked list).  The code is slightly more
> verbose, but I think it's more clear what's occurring.

On its own the patch doesn't make that much sense indeed, but see also
patch #6 (add mcfg table, for q35 only) which will become a bit more
complicated without the global variable.

cheers,
  Gerd



More information about the SeaBIOS mailing list