[SeaBIOS] [PATCH 4/4] pci: runtime i/o window sizing
Kevin O'Connor
kevin at koconnor.net
Sat Jun 9 14:57:45 CEST 2012
On Thu, Jun 07, 2012 at 10:34:34AM +0200, Gerd Hoffmann wrote:
> Update the pci i/o windows at runtime, depending on the amount memory
> the machine has. The 32bit window starts above low memory and ends at
> the ioapic map address, the 64bit window is placed above high memory.
[...]
> - r64_mem.base = pcimem64_start;
> - u64 sum = pci_region_sum(&r64_mem);
> - u64 align = pci_region_align(&r64_pref);
> - r64_pref.base = ALIGN(r64_mem.base + sum, align);
> + for (i = 0; i < ARRAY_SIZE(sizes); i++) {
> + pcimem64_size = sizes[i];
> + pcimem64_start = ALIGN(0x100000000LL + RamSizeOver4G, pcimem64_size);
Why align to 64GB (or 1TB)? How about just starting at 4GB past ram
aligned to 4GB.
> + pcimem64_end = pcimem64_start + pcimem64_size;
> +
> + r64_mem.base = pcimem64_start;
> + u64 sum = pci_region_sum(&r64_mem);
> + u64 align = pci_region_align(&r64_pref);
> + r64_pref.base = ALIGN(r64_mem.base + sum, align);
> + if (r64_pref.base + pci_region_sum(&r64_pref) <= pcimem64_end)
> + break;
Why not just assign "pcimem64_end = r64_pref.base +
pci_region_sum(&r64_pref)" instead? That is, instead of looping to
try certain sizes, why not just set the range according to how much
space is found to be needed?
-Kevin
More information about the SeaBIOS
mailing list