[SeaBIOS] [PATCH v2 3/3] pci: recognize RH PCI legacy bridge resource

Liu, Jing2 jing2.liu at linux.intel.com
Tue Aug 14 07:58:18 CEST 2018



On 8/13/2018 7:54 PM, Zihan Yang wrote:
>> Enable the firmware recognizing RedHat legacy PCI bridge device ID,
>> so QEMU can reserve additional PCI bridge resource capability.
>>
>> Signed-off-by: Jing Liu <jing2.liu at linux.intel.com>
>> ---
>>   src/fw/pciinit.c | 50 +++++++++++++++++++++++++++++---------------------
>>   src/hw/pci_ids.h |  1 +
>>   2 files changed, 30 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
>> index 62a32f1..795d84a 100644
>> --- a/src/fw/pciinit.c
>> +++ b/src/fw/pciinit.c
>> @@ -525,30 +525,38 @@ static void pci_bios_init_platform(void)
>>
>>   static u8 pci_find_resource_reserve_capability(u16 bdf)
>>   {
>> -    if (pci_config_readw(bdf, PCI_VENDOR_ID) == PCI_VENDOR_ID_REDHAT &&
>> -        pci_config_readw(bdf, PCI_DEVICE_ID) ==
>> -                PCI_DEVICE_ID_REDHAT_ROOT_PORT) {
>> -        u8 cap = 0;
>> -        do {
>> -            cap = pci_find_capability(bdf, PCI_CAP_ID_VNDR, cap);
>> -        } while (cap &&
>> -                 pci_config_readb(bdf, cap + PCI_CAP_REDHAT_TYPE_OFFSET) !=
>> -                        REDHAT_CAP_RESOURCE_RESERVE);
>> -        if (cap) {
>> -            u8 cap_len = pci_config_readb(bdf, cap + PCI_CAP_FLAGS);
>> -            if (cap_len < RES_RESERVE_CAP_SIZE) {
>> -                dprintf(1, "PCI: QEMU resource reserve cap length %d is invalid\n",
>> -                        cap_len);
>> -                return 0;
>> -            }
>> -        } else {
>> -            dprintf(1, "PCI: QEMU resource reserve cap not found\n");
>> +    u16 device_id;
>> +
>> +    if (pci_config_readw(bdf, PCI_VENDOR_ID) != PCI_VENDOR_ID_REDHAT) {
>> +        dprintf(1, "PCI: QEMU resource reserve cap vendor ID doesn't match.\n");
>> +        return 0;
>> +    }
>> +
>> +    device_id = pci_config_readw(bdf, PCI_DEVICE_ID);
>> +
>> +    if (device_id != PCI_DEVICE_ID_REDHAT_ROOT_PORT &&
>> +        device_id != PCI_DEVICE_ID_REDHAT_BRIDGE) {
> 
> I think PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE shoud be added too, in case we put
> a pcie_pci_bridge at the host bus.

In theory all the pci bridge need add this capability but I'm not sure 
if we really need that? Would like to hear some more suggestion!

Thanks for the comments!
Jing

> 
>> +        dprintf(1, "PCI: QEMU resource reserve cap device ID doesn't match.\n");
>> +        return 0;
>> +    }
>> +    u8 cap = 0;
>> +
[...]



More information about the SeaBIOS mailing list