[edk2] Problem ACPI problem

Subject: [edk2] Problem ACPI problem

From: Rafael Machado <rafaelrodrigues.machado@gmail.com>

To: edk2-devel <edk2-devel@lists.sourceforge.net>

Date: 2012-09-08 00:59:23

Hi everyone

I have a question.
On my project I need to check all PCIe functions on each bus, so I have a loop from bus 0 to the max bus number.
This max bus number I get from acpi table.

This is done here:

EFI_STATUS
PciGetNextBusRange (
IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
OUT UINT16 *MinBus,
OUT UINT16 *MaxBus,
OUT BOOLEAN *IsEnd
)
{
*IsEnd = FALSE;

//
// When *Descriptors is NULL, Configuration() is not implemented, so assume
// range is 0~PCI_MAX_BUS
//
if ((*Descriptors) == NULL) {
*MinBus = 0;
*MaxBus = PCI_MAX_BUS;
return EFI_SUCCESS;
}
//
// *Descriptors points to one or more address space descriptors, which
// ends with a end tagged descriptor. Examine each of the descriptors,
// if a bus typed one is found and its bus range covers bus, this handle
// is the handle we are looking for.
//

while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
*MinBus = (UINT16) (*Descriptors)->AddrRangeMin;
*MaxBus = (UINT16) (*Descriptors)->AddrRangeMax;
(*Descriptors)++;
return (EFI_SUCCESS);
}

(*Descriptors)++;
}

if ((*Descriptors)->Desc == ACPI_END_TAG_DESCRIPTOR) {
*IsEnd = TRUE;
}

return EFI_SUCCESS;
}

The problem is that on a nootbook, that has devices and functions up to bus 0x7f, this function returns just 0x0A,
so I dont check everything I need.

Do I need to change something at this code, so I can get the correct max bus number ? (0x7f instead of 0xA)

Thanks and Regards
Rafael R. Machado