[SeaBIOS] [PATCH 10/12] Calculate pci region stats on demand

Kevin O'Connor kevin at koconnor.net
Wed Apr 25 03:14:25 CEST 2012


On Tue, Apr 24, 2012 at 06:24:27PM +1200, Alexey Korolev wrote:
> Do not store pci region stats - instead calulate the
> sum and alignment on demand.
[...]
> @@ -446,9 +459,9 @@ static int pci_bios_check_devices(struct pci_bus *busses)
>          for (type = 0; type < PCI_REGION_TYPE_COUNT; type++) {
>              u64 align = (type == PCI_REGION_TYPE_IO) ?
>                  PCI_BRIDGE_IO_MIN : PCI_BRIDGE_MEM_MIN;
> -            if (s->r[type].align > align)
> -                align = s->r[type].align;
> -            u64 size = ALIGN(s->r[type].sum, align);
> +            if (pci_region_align(&s->r[type]) > align)
> +                 align = pci_region_align(&s->r[type]);
> +            u64 size = ALIGN(pci_region_sum(&s->r[type]), align);
[...]
> +    r_end->base = ALIGN_DOWN((BUILD_PCIMEM_END - pci_region_sum(r_end)),
> +                                pci_region_align(r_end));
> +    r_start->base = ALIGN_DOWN((r_end->base - pci_region_sum(r_start)),
> +                                pci_region_align(r_start));

I'd avoid making function calls in the parameter of a macro (it can be
executed multiple times and it's non-obvious).

-Kevin



More information about the SeaBIOS mailing list