From owner-p4-projects Thu May 2 23:14:31 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CDD5E37B419; Thu, 2 May 2002 23:14:14 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0051B37B417 for ; Thu, 2 May 2002 23:14:14 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g436EDo01174 for perforce@freebsd.org; Thu, 2 May 2002 23:14:13 -0700 (PDT) (envelope-from marcel@freebsd.org) Date: Thu, 2 May 2002 23:14:13 -0700 (PDT) Message-Id: <200205030614.g436EDo01174@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 10728 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=10728 Change 10728 by marcel@marcel_nfs on 2002/05/02 23:14:08 o Add the currently defined GUIDs to mca.h, o Move the mca_guid struct to mca.h and define guid fields as such, o Recognize the GUIDs and select the appropriate dumper, o Mostly implement the CPU dumper. Affected files ... ... //depot/projects/ia64/sbin/mca/mca.c#2 edit ... //depot/projects/ia64/sys/ia64/include/mca.h#2 edit Differences ... ==== //depot/projects/ia64/sbin/mca/mca.c#2 (text+ko) ==== @@ -48,13 +48,6 @@ #include #include -struct mca_guid { - uint32_t data1; - uint16_t data2; - uint16_t data3; - uint8_t data4[8]; -}; - #define BCD(x) ((x >> 4) * 10 + (x & 15)) static char hw_mca_count[] = "hw.mca.count"; @@ -116,18 +109,138 @@ BCD(rh->rh_time[MCA_RH_TIME_MIN]), BCD(rh->rh_time[MCA_RH_TIME_SEC])); if (rh->rh_flags & MCA_RH_FLAGS_PLATFORM_ID) - printf(" platform=%s\n", guid((void*)rh->rh_platform)); + printf(" platform=%s\n", guid(&rh->rh_platform)); printf(" \n"); return (rh->rh_length); } +static void +show_cpu_mod(const char *what, int idx, struct mca_cpu_mod *cpu_mod) +{ + printf(" <%s-%d>\n", what, idx); + if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_INFO) + printf(" info=%016llx\n", cpu_mod->cpu_mod_info); + if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_REQID) + printf(" requester=%016llx\n", cpu_mod->cpu_mod_reqid); + if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_RSPID) + printf(" responder=%016llx\n", cpu_mod->cpu_mod_rspid); + if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_TGTID) + printf(" target=%016llx\n", cpu_mod->cpu_mod_tgtid); + if (cpu_mod->cpu_mod_flags & MCA_CPU_MOD_FLAGS_IP) + printf(" ip=%016llx\n", cpu_mod->cpu_mod_ip); + printf(" \n", what, idx); +} + +static void +show_cpu(struct mca_cpu_record *cpu) +{ + struct mca_cpu_mod *mod; + struct mca_cpu_cpuid *cpuid; + struct mca_cpu_psi *psi; + int i, n; + + printf(" \n"); + + if (cpu->cpu_flags & MCA_CPU_FLAGS_ERRMAP) + printf(" errmap=%016llx\n", (long long)cpu->cpu_errmap); + if (cpu->cpu_flags & MCA_CPU_FLAGS_STATE) + printf(" state=%016llx\n", (long long)cpu->cpu_state); + if (cpu->cpu_flags & MCA_CPU_FLAGS_CR_LID) + printf(" cr_lid=%016llx\n", (long long)cpu->cpu_cr_lid); + + mod = (struct mca_cpu_mod*)(cpu + 1); + n = MCA_CPU_FLAGS_CACHE(cpu->cpu_flags); + for (i = 0; i < n; i++) + show_cpu_mod("cache", i, mod++); + n = MCA_CPU_FLAGS_TLB(cpu->cpu_flags); + for (i = 0; i < n; i++) + show_cpu_mod("tlb", i, mod++); + n = MCA_CPU_FLAGS_BUS(cpu->cpu_flags); + for (i = 0; i < n; i++) + show_cpu_mod("bus", i, mod++); + n = MCA_CPU_FLAGS_REG(cpu->cpu_flags); + for (i = 0; i < n; i++) + show_cpu_mod("reg", i, mod++); + n = MCA_CPU_FLAGS_MS(cpu->cpu_flags); + for (i = 0; i < n; i++) + show_cpu_mod("ms", i, mod++); + + cpuid = (struct mca_cpu_cpuid*)mod; + for (i = 0; i < 6; i++) + printf(" cpuid%d=%016llx\n", i, cpuid->cpuid[i]); + + psi = (struct mca_cpu_psi*)(cpuid + 1); + /* TODO: Dump PSI */ + + printf(" \n"); +} + +static void +show_memory(void) +{ + printf(" # MEMORY\n"); +} + +static void +show_sel(void) +{ + printf(" # SEL\n"); +} + +static void +show_pci_bus(void) +{ + printf(" # PCI BUS\n"); +} + +static void +show_smbios(void) +{ + printf(" # SMBIOS\n"); +} + +static void +show_pci_dev(void) +{ + printf(" # PCI DEV\n"); +} + +static void +show_generic(void) +{ + printf(" # GENERIC\n"); +} + static size_t show_section(struct mca_section_header *sh) { + static struct mca_guid guid_cpu = MCA_GUID_CPU; + static struct mca_guid guid_memory = MCA_GUID_MEMORY; + static struct mca_guid guid_sel = MCA_GUID_SEL; + static struct mca_guid guid_pci_bus = MCA_GUID_PCI_BUS; + static struct mca_guid guid_smbios = MCA_GUID_SMBIOS; + static struct mca_guid guid_pci_dev = MCA_GUID_PCI_DEV; + static struct mca_guid guid_generic = MCA_GUID_GENERIC; printf("
\n"); - printf(" guid=%s\n", guid((void*)sh->sh_guid)); + printf(" guid=%s\n", guid(&sh->sh_guid)); printf(" revision=%d.%d\n", BCD(sh->sh_major), BCD(sh->sh_minor)); + + if (!memcmp(&sh->sh_guid, &guid_cpu, sizeof(guid_cpu))) + show_cpu((struct mca_cpu_record*)(sh + 1)); + else if (!memcmp(&sh->sh_guid, &guid_memory, sizeof(guid_memory))) + show_memory(); + else if (!memcmp(&sh->sh_guid, &guid_sel, sizeof(guid_sel))) + show_sel(); + else if (!memcmp(&sh->sh_guid, &guid_pci_bus, sizeof(guid_pci_bus))) + show_pci_bus(); + else if (!memcmp(&sh->sh_guid, &guid_smbios, sizeof(guid_smbios))) + show_smbios(); + else if (!memcmp(&sh->sh_guid, &guid_pci_dev, sizeof(guid_pci_dev))) + show_pci_dev(); + else if (!memcmp(&sh->sh_guid, &guid_generic, sizeof(guid_generic))) + show_generic(); + printf("
\n"); return (sh->sh_length); } ==== //depot/projects/ia64/sys/ia64/include/mca.h#2 (text+ko) ==== @@ -29,6 +29,13 @@ #ifndef _MACHINE_MCA_H_ #define _MACHINE_MCA_H_ +struct mca_guid { + uint32_t data1; + uint16_t data2; + uint16_t data3; + uint8_t data4[8]; +}; + struct mca_record_header { uint64_t rh_seqnr; /* Record id. */ uint8_t rh_major; /* BCD (=02). */ @@ -48,11 +55,11 @@ #define MCA_RH_TIME_MON 5 #define MCA_RH_TIME_YEAR 6 #define MCA_RH_TIME_CENT 7 - uint8_t rh_platform[16]; /* Platform id. */ + struct mca_guid rh_platform; /* XXX not really a GUID. */ }; struct mca_section_header { - uint8_t sh_guid[16]; + struct mca_guid sh_guid; uint8_t sh_major; /* BCD (=02). */ uint8_t sh_minor; /* BCD (=00). */ uint8_t sh_flags; @@ -66,14 +73,14 @@ struct mca_cpu_record { uint64_t cpu_flags; -#define MCA_CPU_FLAGS_ERROR_MAP (1ULL << 0) -#define MCA_CPU_FLAGS_STATE_PARM (1ULL << 1) +#define MCA_CPU_FLAGS_ERRMAP (1ULL << 0) +#define MCA_CPU_FLAGS_STATE (1ULL << 1) #define MCA_CPU_FLAGS_CR_LID (1ULL << 2) #define MCA_CPU_FLAGS_PSI_STRUCT (1ULL << 3) #define MCA_CPU_FLAGS_CACHE(x) (((x) >> 4) & 15) #define MCA_CPU_FLAGS_TLB(x) (((x) >> 8) & 15) #define MCA_CPU_FLAGS_BUS(x) (((x) >> 12) & 15) -#define MCA_CPU_FLAGS_REGF(x) (((x) >> 16) & 15) +#define MCA_CPU_FLAGS_REG(x) (((x) >> 16) & 15) #define MCA_CPU_FLAGS_MS(x) (((x) >> 20) & 15) #define MCA_CPU_FLAGS_CPUID (1ULL << 24) uint64_t cpu_errmap; @@ -82,7 +89,7 @@ /* Nx cpu_mod (cache) */ /* Nx cpu_mod (TLB) */ /* Nx cpu_mod (bus) */ - /* Nx cpu_mod (regf) */ + /* Nx cpu_mod (reg) */ /* Nx cpu_mod (MS) */ /* cpu_cpuid */ /* cpu_psi */ @@ -122,6 +129,21 @@ uint64_t cpu_psi_fr[256]; /* 16 bytes per register! */ }; +#define MCA_GUID_CPU \ + {0xe429faf1,0x3cb7,0x11d4,{0xbc,0xa7,0x00,0x80,0xc7,0x3c,0x88,0x81}} +#define MCA_GUID_MEMORY \ + {0xe429faf2,0x3cb7,0x11d4,{0xbc,0xa7,0x00,0x80,0xc7,0x3c,0x88,0x81}} +#define MCA_GUID_SEL \ + {0xe429faf3,0x3cb7,0x11d4,{0xbc,0xa7,0x00,0x80,0xc7,0x3c,0x88,0x81}} +#define MCA_GUID_PCI_BUS \ + {0xe429faf4,0x3cb7,0x11d4,{0xbc,0xa7,0x00,0x80,0xc7,0x3c,0x88,0x81}} +#define MCA_GUID_SMBIOS \ + {0xe429faf5,0x3cb7,0x11d4,{0xbc,0xa7,0x00,0x80,0xc7,0x3c,0x88,0x81}} +#define MCA_GUID_PCI_DEV \ + {0xe429faf6,0x3cb7,0x11d4,{0xbc,0xa7,0x00,0x80,0xc7,0x3c,0x88,0x81}} +#define MCA_GUID_GENERIC \ + {0xe429faf7,0x3cb7,0x11d4,{0xbc,0xa7,0x00,0x80,0xc7,0x3c,0x88,0x81}} + #ifdef _KERNEL void ia64_mca_init(void); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message