PCI fixes

Only set the PIR table signature and checksum in the init function -
    that way, if it is disabled at runtime (eg, due to coreboot) then
    it wont be found by the OS.
Fix parameter swap bug in handle_1ab102.
Add support for more than one bus in pci scanning code (but only have
    1 bus for now).
diff --git a/src/pci.c b/src/pci.c
index c688dac..e704444 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -7,6 +7,9 @@
 
 #include "pci.h" // PCIDevice
 #include "ioport.h" // outl
+#include "util.h" // dprintf
+
+#define MAX_BUS 1
 
 void pci_config_writel(PCIDevice d, u32 addr, u32 val)
 {
@@ -53,20 +56,22 @@
 int
 pci_find_device(u16 vendid, u16 devid, int index, PCIDevice *dev)
 {
-    int devfn;
+    int devfn, bus;
     u32 id = (devid << 16) | vendid;
-    for (devfn=0; devfn<0x100; devfn++) {
-        PCIDevice d = pci_bd(0, devfn);
-        u32 v = pci_config_readl(d, 0x00);
-        if (v != id)
-            continue;
-        if (index) {
-            index--;
-            continue;
+    for (bus=0; bus < MAX_BUS; bus++) {
+        for (devfn=0; devfn<0x100; devfn++) {
+            PCIDevice d = pci_bd(bus, devfn);
+            u32 v = pci_config_readl(d, 0x00);
+            if (v != id)
+                continue;
+            if (index) {
+                index--;
+                continue;
+            }
+            // Found it.
+            *dev = d;
+            return 0;
         }
-        // Found it.
-        *dev = d;
-        return 0;
     }
     return -1;
 }
@@ -74,20 +79,22 @@
 int
 pci_find_class(u32 classid, int index, PCIDevice *dev)
 {
-    int devfn;
+    int devfn, bus;
     u32 id = classid << 8;
-    for (devfn=0; devfn<0x100; devfn++) {
-        PCIDevice d = pci_bd(0, devfn);
-        u32 v = pci_config_readl(d, 0x08);
-        if (v != id)
-            continue;
-        if (index) {
-            index--;
-            continue;
+    for (bus=0; bus < MAX_BUS; bus++) {
+        for (devfn=0; devfn<0x100; devfn++) {
+            PCIDevice d = pci_bd(bus, devfn);
+            u32 v = pci_config_readl(d, 0x08);
+            if (v != id)
+                continue;
+            if (index) {
+                index--;
+                continue;
+            }
+            // Found it.
+            *dev = d;
+            return 0;
         }
-        // Found it.
-        *dev = d;
-        return 0;
     }
     return -1;
 }
diff --git a/src/pcibios.c b/src/pcibios.c
index 1ab72f4..436c106 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -32,7 +32,7 @@
 handle_1ab102(struct bregs *regs)
 {
     PCIDevice d;
-    int ret = pci_find_device(regs->cx, regs->dx, regs->si, &d);
+    int ret = pci_find_device(regs->dx, regs->cx, regs->si, &d);
     if (ret) {
         set_code_fail(regs, RET_DEVICE_NOT_FOUND);
         return;
diff --git a/src/pirtable.c b/src/pirtable.c
index c20a169..433b889 100644
--- a/src/pirtable.c
+++ b/src/pirtable.c
@@ -11,15 +11,13 @@
 struct pir_table {
     struct pir_header pir;
     struct pir_slot slots[6];
-} PACKED PIR_TABLE VISIBLE16 __attribute__((aligned(16))) = {
+} PACKED PIR_TABLE __attribute__((aligned(16))) = {
 #if CONFIG_PIRTABLE
     .pir = {
-        .signature = PIR_SIGNATURE,
         .version = 0x0100,
         .size = sizeof(struct pir_table),
         .router_devfunc = 0x08,
         .compatible_devid = 0x122e8086,
-        .checksum = 0x37, // XXX - should auto calculate
     },
     .slots = {
         {
@@ -93,6 +91,7 @@
     if (! CONFIG_PIRTABLE)
         return;
 
+    PIR_TABLE.pir.signature = PIR_SIGNATURE;
     PIR_TABLE.pir.checksum = -checksum((u8*)&PIR_TABLE, sizeof(PIR_TABLE));
     SET_EBDA(pir_loc, (u32)&PIR_TABLE);
 }