]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
pci: recognize RH PCI legacy bridge resource reservation capability
authorJing Liu <jing2.liu@linux.intel.com>
Fri, 24 Aug 2018 08:53:01 +0000 (16:53 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 5 Sep 2018 06:37:18 +0000 (08:37 +0200)
Enable the firmware recognizing RedHat legacy PCI bridge device ID,
so QEMU can reserve additional PCI bridge resource capability.
Change the debug level lower to 3 when it is non-QEMU bridge.

Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>
Message-id: 1535100781-3910-4-git-send-email-jing2.liu@linux.intel.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
src/fw/pciinit.c
src/hw/pci_ids.h

index 62a32f1ea12f4b8ef44a76a80313fd2fc48a4892..c0634bcb36ed0213851ffbd2839b364ca866c93e 100644 (file)
@@ -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(3, "PCI: This is non-QEMU bridge.\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) {
+        dprintf(1, "PCI: QEMU resource reserve cap device ID doesn't match.\n");
+        return 0;
+    }
+    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;
         }
-        return cap;
     } else {
-        dprintf(1, "PCI: QEMU resource reserve cap VID or DID doesn't match.\n");
-        return 0;
+        dprintf(1, "PCI: QEMU resource reserve cap not found\n");
     }
+    return cap;
 }
 
 /****************************************************************
index 38fa2ca42bd1a350ccac3e133a578b8fe51bbc4b..109646161c7b408c89f7fbffe9d6d4275a0ea51a 100644 (file)
 
 #define PCI_VENDOR_ID_REDHAT           0x1b36
 #define PCI_DEVICE_ID_REDHAT_ROOT_PORT 0x000C
+#define PCI_DEVICE_ID_REDHAT_BRIDGE    0x0001
 
 #define PCI_VENDOR_ID_TEKRAM           0x1de1
 #define PCI_DEVICE_ID_TEKRAM_DC290     0xdc29