Kevin O'Connor | d25810a | 2008-06-12 22:16:35 -0400 | [diff] [blame] | 1 | // PIR table generation (for emulators) |
| 2 | // |
| 3 | // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> |
| 4 | // Copyright (C) 2002 MandrakeSoft S.A. |
| 5 | // |
| 6 | // This file may be distributed under the terms of the GNU GPLv3 license. |
| 7 | |
| 8 | #include "pci.h" // struct pir_header |
| 9 | #include "util.h" // checksum |
Kevin O'Connor | 9521e26 | 2008-07-04 13:04:29 -0400 | [diff] [blame] | 10 | #include "biosvar.h" // SET_EBDA |
Kevin O'Connor | d25810a | 2008-06-12 22:16:35 -0400 | [diff] [blame] | 11 | |
| 12 | struct pir_table { |
| 13 | struct pir_header pir; |
| 14 | struct pir_slot slots[6]; |
Kevin O'Connor | db03d5d | 2008-06-21 11:55:29 -0400 | [diff] [blame] | 15 | } PACKED PIR_TABLE __attribute__((aligned(16))) = { |
Kevin O'Connor | d25810a | 2008-06-12 22:16:35 -0400 | [diff] [blame] | 16 | #if CONFIG_PIRTABLE |
| 17 | .pir = { |
Kevin O'Connor | d25810a | 2008-06-12 22:16:35 -0400 | [diff] [blame] | 18 | .version = 0x0100, |
| 19 | .size = sizeof(struct pir_table), |
| 20 | .router_devfunc = 0x08, |
| 21 | .compatible_devid = 0x122e8086, |
Kevin O'Connor | d25810a | 2008-06-12 22:16:35 -0400 | [diff] [blame] | 22 | }, |
| 23 | .slots = { |
| 24 | { |
| 25 | // first slot entry PCI-to-ISA (embedded) |
| 26 | .dev = 1<<3, |
| 27 | .links = { |
| 28 | {.link = 0x60, .bitmap = 0xdef8}, // INTA# |
| 29 | {.link = 0x61, .bitmap = 0xdef8}, // INTB# |
| 30 | {.link = 0x62, .bitmap = 0xdef8}, // INTC# |
| 31 | {.link = 0x63, .bitmap = 0xdef8}, // INTD# |
| 32 | }, |
| 33 | .slot_nr = 0, // embedded |
| 34 | }, { |
| 35 | // second slot entry: 1st PCI slot |
| 36 | .dev = 2<<3, |
| 37 | .links = { |
| 38 | {.link = 0x61, .bitmap = 0xdef8}, // INTA# |
| 39 | {.link = 0x62, .bitmap = 0xdef8}, // INTB# |
| 40 | {.link = 0x63, .bitmap = 0xdef8}, // INTC# |
| 41 | {.link = 0x60, .bitmap = 0xdef8}, // INTD# |
| 42 | }, |
| 43 | .slot_nr = 1, |
| 44 | }, { |
| 45 | // third slot entry: 2nd PCI slot |
| 46 | .dev = 3<<3, |
| 47 | .links = { |
| 48 | {.link = 0x62, .bitmap = 0xdef8}, // INTA# |
| 49 | {.link = 0x63, .bitmap = 0xdef8}, // INTB# |
| 50 | {.link = 0x60, .bitmap = 0xdef8}, // INTC# |
| 51 | {.link = 0x61, .bitmap = 0xdef8}, // INTD# |
| 52 | }, |
| 53 | .slot_nr = 2, |
| 54 | }, { |
| 55 | // 4th slot entry: 3rd PCI slot |
| 56 | .dev = 4<<3, |
| 57 | .links = { |
| 58 | {.link = 0x63, .bitmap = 0xdef8}, // INTA# |
| 59 | {.link = 0x60, .bitmap = 0xdef8}, // INTB# |
| 60 | {.link = 0x61, .bitmap = 0xdef8}, // INTC# |
| 61 | {.link = 0x62, .bitmap = 0xdef8}, // INTD# |
| 62 | }, |
| 63 | .slot_nr = 3, |
| 64 | }, { |
| 65 | // 5th slot entry: 4rd PCI slot |
| 66 | .dev = 5<<3, |
| 67 | .links = { |
| 68 | {.link = 0x60, .bitmap = 0xdef8}, // INTA# |
| 69 | {.link = 0x61, .bitmap = 0xdef8}, // INTB# |
| 70 | {.link = 0x62, .bitmap = 0xdef8}, // INTC# |
| 71 | {.link = 0x63, .bitmap = 0xdef8}, // INTD# |
| 72 | }, |
| 73 | .slot_nr = 4, |
| 74 | }, { |
| 75 | // 6th slot entry: 5rd PCI slot |
| 76 | .dev = 6<<3, |
| 77 | .links = { |
| 78 | {.link = 0x61, .bitmap = 0xdef8}, // INTA# |
| 79 | {.link = 0x62, .bitmap = 0xdef8}, // INTB# |
| 80 | {.link = 0x63, .bitmap = 0xdef8}, // INTC# |
| 81 | {.link = 0x60, .bitmap = 0xdef8}, // INTD# |
| 82 | }, |
| 83 | .slot_nr = 5, |
| 84 | }, |
| 85 | } |
| 86 | #endif // CONFIG_PIRTABLE |
| 87 | }; |
| 88 | |
| 89 | void |
| 90 | create_pirtable() |
| 91 | { |
| 92 | if (! CONFIG_PIRTABLE) |
| 93 | return; |
| 94 | |
Kevin O'Connor | 7b49cd9 | 2008-11-08 10:35:26 -0500 | [diff] [blame^] | 95 | dprintf(3, "init PIR table\n"); |
| 96 | |
Kevin O'Connor | db03d5d | 2008-06-21 11:55:29 -0400 | [diff] [blame] | 97 | PIR_TABLE.pir.signature = PIR_SIGNATURE; |
Kevin O'Connor | d25810a | 2008-06-12 22:16:35 -0400 | [diff] [blame] | 98 | PIR_TABLE.pir.checksum = -checksum((u8*)&PIR_TABLE, sizeof(PIR_TABLE)); |
| 99 | SET_EBDA(pir_loc, (u32)&PIR_TABLE); |
| 100 | } |