aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-12-28 11:04:46 +0200
committerKevin O'Connor <kevin@koconnor.net>2009-12-30 12:24:11 -0500
commit4c94b7ea43393d6a5058a30f52680579e7085894 (patch)
tree393704e3b6fd3dabd6f04b4bfc6928f6a57bc55f
parent871e0a0c142f7b2fcaa93600c5958d4ae4fa1394 (diff)
downloadseabios-hppa-4c94b7ea43393d6a5058a30f52680579e7085894.zip
seabios-hppa-4c94b7ea43393d6a5058a30f52680579e7085894.tar.gz
seabios-hppa-4c94b7ea43393d6a5058a30f52680579e7085894.tar.bz2
enumerate all PCI buses in mptable
Signed-off-by: Gleb Natapov <gleb@redhat.com>
-rw-r--r--src/mptable.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/mptable.c b/src/mptable.c
index 6e02524..206e131 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -65,19 +65,27 @@ mptable_init(void)
}
int entrycount = cpu - cpus;
- /* isa bus */
struct mpt_bus *bus = (void*)cpu;
- memset(bus, 0, sizeof(*bus));
- bus->type = MPT_TYPE_BUS;
- bus->busid = 1;
- memcpy(bus->bustype, "ISA ", sizeof(bus->bustype));
- entrycount++;
+ int bdf, max, lastbus = -1;
+ foreachpci(bdf, max) {
+ int curbus = pci_bdf_to_bus(bdf);
+ if (curbus == lastbus)
+ continue;
+ lastbus = curbus;
+ memset(bus, 0, sizeof(*bus));
+ bus->type = MPT_TYPE_BUS;
+ bus->busid = curbus;
+ memcpy(bus->bustype, "PCI ", sizeof(bus->bustype));
+ bus++;
+ entrycount++;
+ }
- bus++;
+ /* isa bus */
+ int isabusid;
memset(bus, 0, sizeof(*bus));
bus->type = MPT_TYPE_BUS;
- bus->busid = 0;
- memcpy(bus->bustype, "PCI ", sizeof(bus->bustype));
+ isabusid = bus->busid = lastbus + 1;
+ memcpy(bus->bustype, "ISA ", sizeof(bus->bustype));
entrycount++;
/* ioapic */
@@ -93,7 +101,7 @@ mptable_init(void)
/* irqs */
struct mpt_intsrc *intsrcs = (void*)&ioapic[1], *intsrc = intsrcs;
- int bdf, max, dev = -1;
+ int dev = -1;
unsigned short mask = 0, pinmask;
foreachpci(bdf, max) {
@@ -113,7 +121,7 @@ mptable_init(void)
intsrc->type = MPT_TYPE_INTSRC;
intsrc->irqtype = 0; /* INT */
intsrc->irqflag = 1; /* active high */
- intsrc->srcbus = 0; /* PCI bus */
+ intsrc->srcbus = pci_bdf_to_bus(bdf); /* PCI bus */
intsrc->srcbusirq = (dev << 2) | (pin - 1);
intsrc->dstapic = ioapic_id;
intsrc->dstirq = irq;
@@ -127,7 +135,7 @@ mptable_init(void)
intsrc->type = MPT_TYPE_INTSRC;
intsrc->irqtype = 0; /* INT */
intsrc->irqflag = 0; /* conform to bus spec */
- intsrc->srcbus = 1; /* ISA bus */
+ intsrc->srcbus = isabusid; /* ISA bus */
intsrc->srcbusirq = i;
intsrc->dstapic = ioapic_id;
intsrc->dstirq = i;
@@ -147,7 +155,7 @@ mptable_init(void)
intsrc->type = MPT_TYPE_LOCAL_INT;
intsrc->irqtype = 3; /* ExtINT */
intsrc->irqflag = 0; /* PO, EL default */
- intsrc->srcbus = 1; /* ISA */
+ intsrc->srcbus = isabusid; /* ISA */
intsrc->srcbusirq = 0;
intsrc->dstapic = 0; /* BSP == APIC #0 */
intsrc->dstirq = 0; /* LINTIN0 */
@@ -157,7 +165,7 @@ mptable_init(void)
intsrc->type = MPT_TYPE_LOCAL_INT;
intsrc->irqtype = 1; /* NMI */
intsrc->irqflag = 0; /* PO, EL default */
- intsrc->srcbus = 1; /* ISA */
+ intsrc->srcbus = isabusid; /* ISA */
intsrc->srcbusirq = 0;
intsrc->dstapic = 0; /* BSP == APIC #0 */
intsrc->dstirq = 1; /* LINTIN1 */