[SeaBIOS] [PATCH v3 1/6] pci: add two-pass pci initialization code

Gerd Hoffmann kraxel at redhat.com
Fri Jul 8 09:35:39 CEST 2011


   Hi,

>> +#define ROOT_BASE(top, sum, align) ALIGN_DOWN((top)-(sum),(align))
>> +
>> +static int pci_bios_init_root_regions(u32 start, u32 end)
>> +{
>> +    struct pci_bus *bus =&busses[0];
>> +
>> +    bus->r[PCI_REGION_TYPE_IO].base = 0xc000;
>> +
>> +    if (bus->r[PCI_REGION_TYPE_MEM].sum<  bus->r[PCI_REGION_TYPE_PREFMEM].sum) {
>> +        bus->r[PCI_REGION_TYPE_MEM].base =
>> +            ROOT_BASE(end,
>> +                      bus->r[PCI_REGION_TYPE_MEM].sum,
>> +                      bus->r[PCI_REGION_TYPE_MEM].max);
>
> This aligns down which looks strange to me.
> Shouldn't we align up to avoid overlap?

Depends on how you allocate.  This starts from the top of the pci 
address space, so we actually have to align down to avoid overlaps.

cheers,
   Gerd



More information about the SeaBIOS mailing list