From 7c994b7f6bda56308e5f1d50651d5951de92198f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 3 Oct 2018 08:05:58 +0200 Subject: New upstream version 3.2 --- biosdecode.c | 67 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 33 deletions(-) (limited to 'biosdecode.c') diff --git a/biosdecode.c b/biosdecode.c index ad3d4bc..99a27fe 100644 --- a/biosdecode.c +++ b/biosdecode.c @@ -73,12 +73,16 @@ struct opt { const char *devmem; unsigned int flags; + unsigned char pir; }; static struct opt opt; #define FLAG_VERSION (1 << 0) #define FLAG_HELP (1 << 1) +#define PIR_SHORT 0 +#define PIR_FULL 1 + struct bios_entry { const char *anchor; size_t anchor_len; /* computed */ @@ -351,7 +355,7 @@ static void pir_slot_number(u8 code) if (code == 0) printf(" on-board"); else - printf(" slot number %u", code); + printf(" slot %u", code); } static size_t pir_length(const u8 *p) @@ -359,16 +363,26 @@ static size_t pir_length(const u8 *p) return WORD(p + 6); } +static void pir_link_bitmap(char letter, const u8 *p) +{ + if (p[0] == 0) /* Not connected */ + return; + + printf("\t\tINT%c#: Link 0x%02x, IRQ Bitmap", letter, p[0]); + pir_irqs(WORD(p + 1)); + printf("\n"); +} + static int pir_decode(const u8 *p, size_t len) { - int i; + int i, n; if (len < 32 || !checksum(p, WORD(p + 6))) return 0; printf("PCI Interrupt Routing %u.%u present.\n", p[5], p[4]); - printf("\tRouter ID: %02x:%02x.%1x\n", + printf("\tRouter Device: %02x:%02x.%1x\n", p[8], p[9]>>3, p[9] & 0x07); printf("\tExclusive IRQs:"); pir_irqs(WORD(p + 10)); @@ -380,38 +394,19 @@ static int pir_decode(const u8 *p, size_t len) printf("\tMiniport Data: 0x%08X\n", DWORD(p + 16)); - for (i = 1; i <= (WORD(p + 6) - 32) / 16; i++) + n = (len - 32) / 16; + for (i = 1, p += 32; i <= n; i++, p += 16) { - printf("\tSlot Entry %u: ID %02x:%02x,", - i, p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3); - pir_slot_number(p[(i + 1) * 16 + 14]); + printf("\tDevice: %02x:%02x,", p[0], p[1] >> 3); + pir_slot_number(p[14]); printf("\n"); -/* printf("\tSlot Entry %u\n", i); - printf("\t\tID: %02x:%02x\n", - p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3); - printf("\t\tLink Value for INTA#: %u\n", - p[(i + 1) * 16 + 2]); - printf("\t\tIRQ Bitmap for INTA#:"); - pir_irqs(WORD(p + (i + 1) * 16 + 3)); - printf("\n"); - printf("\t\tLink Value for INTB#: %u\n", - p[(i + 1) * 16 + 5]); - printf("\t\tIRQ Bitmap for INTB#:"); - pir_irqs(WORD(p + (i + 1) * 16 + 6)); - printf("\n"); - printf("\t\tLink Value for INTC#: %u\n", - p[(i + 1) * 16 + 8]); - printf("\t\tIRQ Bitmap for INTC#:"); - pir_irqs(WORD(p + (i + 1) * 16 + 9)); - printf("\n"); - printf("\t\tLink Value for INTD#: %u\n", - p[(i + 1) * 16 + 11]); - printf("\t\tIRQ Bitmap for INTD#:"); - pir_irqs(WORD(p + (i + 1) * 16 + 12)); - printf("\n"); - printf("\t\tSlot Number:"); - pir_slot_number(p[(i + 1) * 16 + 14]); - printf("\n");*/ + if (opt.pir == PIR_FULL) + { + pir_link_bitmap('A', p + 2); + pir_link_bitmap('B', p + 5); + pir_link_bitmap('C', p + 8); + pir_link_bitmap('D', p + 11); + } } return 1; @@ -616,6 +611,7 @@ static int parse_command_line(int argc, char * const argv[]) const char *optstring = "d:hV"; struct option longopts[] = { { "dev-mem", required_argument, NULL, 'd' }, + { "pir", required_argument, NULL, 'P' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } @@ -627,6 +623,10 @@ static int parse_command_line(int argc, char * const argv[]) case 'd': opt.devmem = optarg; break; + case 'P': + if (strcmp(optarg, "full") == 0) + opt.pir = PIR_FULL; + break; case 'h': opt.flags |= FLAG_HELP; break; @@ -646,6 +646,7 @@ static void print_help(void) "Usage: biosdecode [OPTIONS]\n" "Options are:\n" " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n" + " --pir full Decode the details of the PCI IRQ routing table\n" " -h, --help Display this help text and exit\n" " -V, --version Display the version and exit\n"; -- cgit v1.2.3