diff options
author | marcel <marcel@FreeBSD.org> | 2002-12-18 08:13:03 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2002-12-18 08:13:03 +0000 |
commit | 61e39e41d0d8f8ab8241ef19d0498df3b9ca7069 (patch) | |
tree | 83f218e4c8d14ea01800218c1f7c948d4a096a62 /sys/boot/efi/loader | |
parent | 923d0189b0e66fd8d78e58097548ede123fa0bd4 (diff) | |
download | FreeBSD-src-61e39e41d0d8f8ab8241ef19d0498df3b9ca7069.zip FreeBSD-src-61e39e41d0d8f8ab8241ef19d0498df3b9ca7069.tar.gz |
Add command `hcdp'. This command dumps the DIG64 HCDP table if one
exists.
Diffstat (limited to 'sys/boot/efi/loader')
-rw-r--r-- | sys/boot/efi/loader/main.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c index 82979e2..7d138a1 100644 --- a/sys/boot/efi/loader/main.c +++ b/sys/boot/efi/loader/main.c @@ -36,6 +36,7 @@ static const char rcsid[] = #include <machine/sal.h> #include <machine/pal.h> #include <machine/pte.h> +#include <machine/dig64.h> #include <efi.h> #include <efilib.h> @@ -495,3 +496,77 @@ command_dtr(int argc, char *argv[]) return print_trs(1); } +COMMAND_SET(hcdp, "hcdp", "Dump HCDP info", command_hcdp); + +static char * +hcdp_string(char *s, u_int len) +{ + static char buffer[256]; + + memcpy(buffer, s, len); + buffer[len] = 0; + return (buffer); +} + +static int +command_hcdp(int argc, char *argv[]) +{ + struct dig64_hcdp_table *tbl; + struct dig64_hcdp_entry *ent; + struct dig64_gas *gas; + int i; + + tbl = efi_get_table(&hcdp); + if (tbl == NULL) { + printf("No HCDP table present\n"); + return (CMD_OK); + } + if (memcmp(tbl->signature, HCDP_SIGNATURE, sizeof(tbl->signature))) { + printf("HCDP table has invalid signature\n"); + return (CMD_OK); + } + if (tbl->length < sizeof(*tbl) - sizeof(*tbl->entry)) { + printf("HCDP table too short\n"); + return (CMD_OK); + } + printf("HCDP table at 0x%016lx\n", (u_long)tbl); + printf("Signature = %s\n", hcdp_string(tbl->signature, 4)); + printf("Length = %u\n", tbl->length); + printf("Revision = %u\n", tbl->revision); + printf("Checksum = %u\n", tbl->checksum); + printf("OEM Id = %s\n", hcdp_string(tbl->oem_id, 6)); + printf("Table Id = %s\n", hcdp_string(tbl->oem_tbl_id, 8)); + printf("OEM rev = %u\n", tbl->oem_rev); + printf("Creator Id = %s\n", hcdp_string(tbl->creator_id, 4)); + printf("Creator rev= %u\n", tbl->creator_rev); + printf("Entries = %u\n", tbl->entries); + for (i = 0; i < tbl->entries; i++) { + ent = tbl->entry + i; + printf("Entry #%d:\n", i + 1); + printf(" Type = %u\n", ent->type); + printf(" Databits = %u\n", ent->databits); + printf(" Parity = %u\n", ent->parity); + printf(" Stopbits = %u\n", ent->stopbits); + printf(" PCI seg = %u\n", ent->pci_segment); + printf(" PCI bus = %u\n", ent->pci_bus); + printf(" PCI dev = %u\n", ent->pci_device); + printf(" PCI func = %u\n", ent->pci_function); + printf(" Interrupt = %u\n", ent->interrupt); + printf(" PCI flag = %u\n", ent->pci_flag); + printf(" Baudrate = %lu\n", + ((u_long)ent->baud_high << 32) + (u_long)ent->baud_low); + gas = &ent->address; + printf(" Addr space= %u\n", gas->addr_space); + printf(" Bit width = %u\n", gas->bit_width); + printf(" Bit offset= %u\n", gas->bit_offset); + printf(" Address = 0x%016lx\n", + ((u_long)gas->addr_high << 32) + (u_long)gas->addr_low); + printf(" PCI type = %u\n", ent->pci_devid); + printf(" PCI vndr = %u\n", ent->pci_vendor); + printf(" IRQ = %u\n", ent->irq); + printf(" PClock = %u\n", ent->pclock); + printf(" PCI iface = %u\n", ent->pci_interface); + } + printf("<EOT>\n"); + return (CMD_OK); +} |