[SeaBIOS] [PATCH] Don't overallocate mptable

Kevin O'Connor kevin at koconnor.net
Sun Dec 27 16:36:54 CET 2009


On Sun, Dec 27, 2009 at 01:43:14PM +0200, Gleb Natapov wrote:
> On Thu, Dec 24, 2009 at 02:41:48PM -0500, Kevin O'Connor wrote:
> > That said, I don't see any reason why they couldn't be listed.
> > However, the code right now would produce incorrect results for bus >
> > 0.
> > 
> Unfortunately yes. We need to have one more loop to find all PCI buses
> and create bus entry for each. May be something like patch below?

Okay.  It would help if you can base the patch on top of my memory
allocation mptable patch.

> +    unsigned long busmask = 0;
> +    int bdf, max;
> +    foreachpci(bdf, max) {
> +    	int curbus = pci_bdf_to_bus(bdf);
> +	if (busmask & (1 << curbus))
> +		continue;
> +	busmask |= (1 << curbus);

foreachpci will iterate in bus order - it's better to use a "lastbus"
variable than busmask as it's possible to have a PCI bus greater than
32.

-Kevin



More information about the SeaBIOS mailing list