]> git.proxmox.com Git - grub2.git/commitdiff
2008-04-05 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Sat, 5 Apr 2008 07:20:29 +0000 (07:20 +0000)
committerproski <proski@localhost>
Sat, 5 Apr 2008 07:20:29 +0000 (07:20 +0000)
* bus/pci.c (grub_pci_iterate): For multifunction devices, probe
all 8 functions.  Otherwise, probe function 0 only.

ChangeLog
bus/pci.c

index 52e728f3da2984ce92fa7eb9fef90fc912c0566e..eb8bd7a4499491ddaa16bfe149fbdcd82d0e6e72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-05  Pavel Roskin  <proski@gnu.org>
+
+       * bus/pci.c (grub_pci_iterate): For multifunction devices, probe
+       all 8 functions.  Otherwise, probe function 0 only.
+
 2008-04-04  Pavel Roskin  <proski@gnu.org>
 
        * commands/lspci.c (grub_lspci_iter): Print the bus number
index a091f4982bd072d6cd5bdf0709c2d2885846600c..2c29c03ab22d4855337fd19e2c32f1bc932b7ac6 100644 (file)
--- a/bus/pci.c
+++ b/bus/pci.c
@@ -34,12 +34,13 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
   int func;
   grub_pci_address_t addr;
   grub_pci_id_t id;
+  grub_uint32_t hdr;
 
   for (bus = 0; bus < 256; bus++)
     {
       for (dev = 0; dev < 32; dev++)
        {
-         for (func = 0; func < 3; func++)
+         for (func = 0; func < 8; func++)
            {
              addr = grub_pci_make_address (bus, dev, func, 0);
              id = grub_pci_read (addr);
@@ -50,6 +51,15 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
 
              if (hook (bus, dev, func, id))
                return;
+
+             /* Probe only func = 0 if the device if not multifunction */
+             if (func == 0)
+               {
+                 addr = grub_pci_make_address (bus, dev, func, 3);
+                 hdr = grub_pci_read (addr);
+                 if (!(hdr & 0x800000))
+                   break;
+               }
            }
        }
     }