aboutsummaryrefslogtreecommitdiff
path: root/src/pirtable.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-06-12 22:16:35 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-06-12 22:16:35 -0400
commitd25810a024ef7f790686c09ec3178be64b95e072 (patch)
tree7b4bbbd835d7adb9db23b219cc6729e43f8d5519 /src/pirtable.c
parentd8a1811d26589f03c01d169dadc1967c59625f8d (diff)
downloadseabios-hppa-d25810a024ef7f790686c09ec3178be64b95e072.zip
seabios-hppa-d25810a024ef7f790686c09ec3178be64b95e072.tar.gz
seabios-hppa-d25810a024ef7f790686c09ec3178be64b95e072.tar.bz2
Generate PIR table at post time.
Move the predefined PIR table (only useful on emulators) to its own file - pirtable.c. Have the pcibios code inspect the pre-built PIR table on 1ab10e calls.
Diffstat (limited to 'src/pirtable.c')
-rw-r--r--src/pirtable.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/pirtable.c b/src/pirtable.c
new file mode 100644
index 0000000..c20a169
--- /dev/null
+++ b/src/pirtable.c
@@ -0,0 +1,98 @@
+// PIR table generation (for emulators)
+//
+// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2002 MandrakeSoft S.A.
+//
+// This file may be distributed under the terms of the GNU GPLv3 license.
+
+#include "pci.h" // struct pir_header
+#include "util.h" // checksum
+
+struct pir_table {
+ struct pir_header pir;
+ struct pir_slot slots[6];
+} PACKED PIR_TABLE VISIBLE16 __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 = {
+ {
+ // first slot entry PCI-to-ISA (embedded)
+ .dev = 1<<3,
+ .links = {
+ {.link = 0x60, .bitmap = 0xdef8}, // INTA#
+ {.link = 0x61, .bitmap = 0xdef8}, // INTB#
+ {.link = 0x62, .bitmap = 0xdef8}, // INTC#
+ {.link = 0x63, .bitmap = 0xdef8}, // INTD#
+ },
+ .slot_nr = 0, // embedded
+ }, {
+ // second slot entry: 1st PCI slot
+ .dev = 2<<3,
+ .links = {
+ {.link = 0x61, .bitmap = 0xdef8}, // INTA#
+ {.link = 0x62, .bitmap = 0xdef8}, // INTB#
+ {.link = 0x63, .bitmap = 0xdef8}, // INTC#
+ {.link = 0x60, .bitmap = 0xdef8}, // INTD#
+ },
+ .slot_nr = 1,
+ }, {
+ // third slot entry: 2nd PCI slot
+ .dev = 3<<3,
+ .links = {
+ {.link = 0x62, .bitmap = 0xdef8}, // INTA#
+ {.link = 0x63, .bitmap = 0xdef8}, // INTB#
+ {.link = 0x60, .bitmap = 0xdef8}, // INTC#
+ {.link = 0x61, .bitmap = 0xdef8}, // INTD#
+ },
+ .slot_nr = 2,
+ }, {
+ // 4th slot entry: 3rd PCI slot
+ .dev = 4<<3,
+ .links = {
+ {.link = 0x63, .bitmap = 0xdef8}, // INTA#
+ {.link = 0x60, .bitmap = 0xdef8}, // INTB#
+ {.link = 0x61, .bitmap = 0xdef8}, // INTC#
+ {.link = 0x62, .bitmap = 0xdef8}, // INTD#
+ },
+ .slot_nr = 3,
+ }, {
+ // 5th slot entry: 4rd PCI slot
+ .dev = 5<<3,
+ .links = {
+ {.link = 0x60, .bitmap = 0xdef8}, // INTA#
+ {.link = 0x61, .bitmap = 0xdef8}, // INTB#
+ {.link = 0x62, .bitmap = 0xdef8}, // INTC#
+ {.link = 0x63, .bitmap = 0xdef8}, // INTD#
+ },
+ .slot_nr = 4,
+ }, {
+ // 6th slot entry: 5rd PCI slot
+ .dev = 6<<3,
+ .links = {
+ {.link = 0x61, .bitmap = 0xdef8}, // INTA#
+ {.link = 0x62, .bitmap = 0xdef8}, // INTB#
+ {.link = 0x63, .bitmap = 0xdef8}, // INTC#
+ {.link = 0x60, .bitmap = 0xdef8}, // INTD#
+ },
+ .slot_nr = 5,
+ },
+ }
+#endif // CONFIG_PIRTABLE
+};
+
+void
+create_pirtable()
+{
+ if (! CONFIG_PIRTABLE)
+ return;
+
+ PIR_TABLE.pir.checksum = -checksum((u8*)&PIR_TABLE, sizeof(PIR_TABLE));
+ SET_EBDA(pir_loc, (u32)&PIR_TABLE);
+}