]> xenbits.xensource.com Git - seabios.git/commitdiff
Rename foreachpci macro to foreachbdf.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 19 Jun 2011 14:46:28 +0000 (10:46 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 19 Jun 2011 14:46:28 +0000 (10:46 -0400)
src/ahci.c
src/ata.c
src/mptable.c
src/optionroms.c
src/pci.c
src/pci.h
src/pcibios.c
src/pciinit.c
src/usb.c
src/virtio-blk.c

index b820e288e64e3ffd26de9ead76ca33352ff4775c..b28597a4a7f4e2746289d5c589c87dc8bcb8e9cc 100644 (file)
@@ -8,7 +8,7 @@
 #include "ioport.h" // inb
 #include "util.h" // dprintf
 #include "biosvar.h" // GET_EBDA
-#include "pci.h" // foreachpci
+#include "pci.h" // foreachbdf
 #include "pci_ids.h" // PCI_CLASS_STORAGE_OTHER
 #include "pci_regs.h" // PCI_INTERRUPT_LINE
 #include "boot.h" // add_bcv_hd
@@ -463,7 +463,7 @@ ahci_init(void)
 {
     // Scan PCI bus for ATA adapters
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         if (pci_config_readw(bdf, PCI_CLASS_DEVICE) != PCI_CLASS_STORAGE_SATA)
             continue;
         if (pci_config_readb(bdf, PCI_CLASS_PROG) != 1 /* AHCI rev 1 */)
index 95e1352f8b3bc1ee9c549bad31f84125ae019fbf..2630431c83f546cb93cd03b4e464b2491fa2504c 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -11,7 +11,7 @@
 #include "cmos.h" // inb_cmos
 #include "pic.h" // enable_hwirq
 #include "biosvar.h" // GET_EBDA
-#include "pci.h" // foreachpci
+#include "pci.h" // foreachbdf
 #include "pci_ids.h" // PCI_CLASS_STORAGE_OTHER
 #include "pci_regs.h" // PCI_INTERRUPT_LINE
 #include "boot.h" // boot_add_hd
@@ -1035,7 +1035,7 @@ ata_init(void)
     // Scan PCI bus for ATA adapters
     int pcicount=0;
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         pcicount++;
         pci_init_device(pci_ata_tbl, bdf, NULL);
     }
index e5952c3ad706a2e6867dcf749338ca809e71fe8e..d7cab03fa3833b0f84ca7620d07953105f1a3a18 100644 (file)
@@ -69,7 +69,7 @@ mptable_init(void)
     // PCI buses
     struct mpt_bus *buses = (void*)cpu, *bus = buses;
     int bdf, max, lastbus = -1;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         int curbus = pci_bdf_to_bus(bdf);
         if (curbus == lastbus)
             continue;
@@ -106,7 +106,7 @@ mptable_init(void)
     int dev = -1;
     unsigned short mask = 0, pinmask = 0;
 
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
         int irq = pci_config_readb(bdf, PCI_INTERRUPT_LINE);
         if (pin == 0)
index 37a4e6c512091c77d6fbc64098a9dbd8e3df24d7..ff74c4fdc54dfbfb84419409d5a2fcd9580174f0 100644 (file)
@@ -9,7 +9,7 @@
 #include "farptr.h" // FLATPTR_TO_SEG
 #include "config.h" // CONFIG_*
 #include "util.h" // dprintf
-#include "pci.h" // foreachpci
+#include "pci.h" // foreachbdf
 #include "pci_regs.h" // PCI_ROM_ADDRESS
 #include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA
 #include "boot.h" // IPL
@@ -398,7 +398,7 @@ optionrom_setup(void)
     } else {
         // Find and deploy PCI roms.
         int bdf, max;
-        foreachpci(bdf, max) {
+        foreachbdf(bdf, max) {
             u16 v = pci_config_readw(bdf, PCI_CLASS_DEVICE);
             if (v == 0x0000 || v == 0xffff || v == PCI_CLASS_DISPLAY_VGA
                 || (CONFIG_ATA && v == PCI_CLASS_STORAGE_IDE))
index 944a39309d493abaae95d7c34d15c832a53c6da6..c95baca1c05123cee3fca151daa6b872f2d43c47 100644 (file)
--- a/src/pci.c
+++ b/src/pci.c
@@ -57,7 +57,7 @@ pci_config_maskw(u16 bdf, u32 addr, u16 off, u16 on)
     pci_config_writew(bdf, addr, val);
 }
 
-// Helper function for foreachpci() macro - return next device
+// Helper function for foreachbdf() macro - return next device
 int
 pci_next(int bdf, int *pmax)
 {
@@ -164,7 +164,7 @@ pci_find_device(u16 vendid, u16 devid)
 {
     u32 id = (devid << 16) | vendid;
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         u32 v = pci_config_readl(bdf, PCI_VENDOR_ID);
         if (v == id)
             return bdf;
@@ -177,7 +177,7 @@ int
 pci_find_class(u16 classid)
 {
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         u16 v = pci_config_readw(bdf, PCI_CLASS_DEVICE);
         if (v == classid)
             return bdf;
@@ -198,7 +198,7 @@ pci_path_setup(void)
 
     int roots = 0;
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         int bus = pci_bdf_to_bus(bdf);
         if (! PCIpaths[bus])
             PCIpaths[bus] = (roots++) | PP_ROOT;
@@ -239,7 +239,7 @@ int pci_find_init_device(const struct pci_device_id *ids, void *arg)
 {
     int bdf, max;
 
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         if (pci_init_device(ids, bdf, arg) == 0) {
             return bdf;
         }
index 9869a26d32d77a801429c98ec6f91d1d2c9315af..6e9cbf0fddb6f86029e274839925eec5b028c362 100644 (file)
--- a/src/pci.h
+++ b/src/pci.h
@@ -53,12 +53,12 @@ extern int *PCIpaths;
 void pci_path_setup(void);
 
 int pci_next(int bdf, int *pmax);
-#define foreachpci(BDF, MAX)                    \
+#define foreachbdf(BDF, MAX)                    \
     for (MAX=0x0100, BDF=pci_next(0, &MAX)      \
          ; BDF >= 0                             \
          ; BDF=pci_next(BDF+1, &MAX))
 
-#define foreachpci_in_bus(BDF, MAX, BUS)                                \
+#define foreachbdf_in_bus(BDF, MAX, BUS)                                \
     for (MAX = pci_bus_devfn_to_bdf(BUS, 0) + 0x0100,                   \
          BDF = pci_next(pci_bus_devfn_to_bdf(BUS, 0), &MAX)             \
          ; BDF >= 0 && BDF < pci_bus_devfn_to_bdf(BUS, 0) + 0x0100      \
index a23248b4965a95ba398027059fca63c20cf91fb5..4fdfd5e58003d16a0e814e7f3a4be4941715e0ff 100644 (file)
@@ -27,7 +27,7 @@ handle_1ab101(struct bregs *regs)
 {
     // Find max bus.
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
     }
 
     regs->al = 0x01; // Flags - "Config Mechanism #1" supported.
@@ -45,7 +45,7 @@ handle_1ab102(struct bregs *regs)
     u32 id = (regs->cx << 16) | regs->dx;
     int count = regs->si;
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         u32 v = pci_config_readl(bdf, PCI_VENDOR_ID);
         if (v != id)
             continue;
@@ -65,7 +65,7 @@ handle_1ab103(struct bregs *regs)
     int count = regs->si;
     u32 classprog = regs->ecx;
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         u32 v = pci_config_readl(bdf, PCI_CLASS_REVISION);
         if ((v>>8) != classprog)
             continue;
index ca0d182c888339d352c99ef52ea3875bb7bb3980..6bd8390954500c00256739fc65368a2dbf435db4 100644 (file)
@@ -360,7 +360,7 @@ static void pci_bios_init_device(u16 bdf)
 static void pci_bios_init_device_in_bus(int bus)
 {
     int bdf, max;
-    foreachpci_in_bus(bdf, max, bus) {
+    foreachbdf_in_bus(bdf, max, bus) {
         pci_bios_init_device(bdf);
     }
 }
@@ -374,7 +374,7 @@ pci_bios_init_bus_rec(int bus, u8 *pci_bus)
     dprintf(1, "PCI: %s bus = 0x%x\n", __func__, bus);
 
     /* prevent accidental access to unintended devices */
-    foreachpci_in_bus(bdf, max, bus) {
+    foreachbdf_in_bus(bdf, max, bus) {
         class = pci_config_readw(bdf, PCI_CLASS_DEVICE);
         if (class == PCI_CLASS_BRIDGE_PCI) {
             pci_config_writeb(bdf, PCI_SECONDARY_BUS, 255);
@@ -382,7 +382,7 @@ pci_bios_init_bus_rec(int bus, u8 *pci_bus)
         }
     }
 
-    foreachpci_in_bus(bdf, max, bus) {
+    foreachbdf_in_bus(bdf, max, bus) {
         class = pci_config_readw(bdf, PCI_CLASS_DEVICE);
         if (class != PCI_CLASS_BRIDGE_PCI) {
             continue;
@@ -451,7 +451,7 @@ pci_setup(void)
     pci_bios_init_bus();
 
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         pci_init_device(pci_isa_bridge_tbl, bdf, NULL);
     }
     pci_bios_init_device_in_bus(0 /* host bus */);
index a07bc1f3e39630ea1d27293d03e4995753514516..454e2d45d47727411bbcf127a525df8d8803e3ab 100644 (file)
--- a/src/usb.c
+++ b/src/usb.c
@@ -5,7 +5,7 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "util.h" // dprintf
-#include "pci.h" // foreachpci
+#include "pci.h" // foreachbdf
 #include "config.h" // CONFIG_*
 #include "pci_regs.h" // PCI_CLASS_REVISION
 #include "pci_ids.h" // PCI_CLASS_SERIAL_USB_UHCI
@@ -431,7 +431,7 @@ usb_setup(void)
     int ehcibdf = -1;
     int count = 0;
     int bdf, max;
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         u32 code = pci_config_readl(bdf, PCI_CLASS_REVISION) >> 8;
 
         if (code >> 8 != PCI_CLASS_SERIAL_USB)
index bd9e2ad701ef4f094407ef89fb3d6c5831de8937..ad80c24af01dabd151c1c2649955aec39bec2c05 100644 (file)
@@ -8,7 +8,7 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "util.h" // dprintf
-#include "pci.h" // foreachpci
+#include "pci.h" // foreachbdf
 #include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
 #include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK
@@ -175,7 +175,7 @@ virtio_blk_setup(void)
 
     int bdf, max;
     u32 id = PCI_VENDOR_ID_REDHAT_QUMRANET | (PCI_DEVICE_ID_VIRTIO_BLK << 16);
-    foreachpci(bdf, max) {
+    foreachbdf(bdf, max) {
         u32 v = pci_config_readl(bdf, PCI_VENDOR_ID);
         if (v != id)
             continue;