diff options
| author | stevel <none@none> | 2006-03-29 15:44:11 -0800 |
|---|---|---|
| committer | stevel <none@none> | 2006-03-29 15:44:11 -0800 |
| commit | 03831d35f7499c87d51205817c93e9a8d42c4bae (patch) | |
| tree | bffe92ec7d68bd67b0cd216c9186bf7a01118b8a /usr/src/lib/libprtdiag/inc | |
| parent | 1b01eaa0e4d0703606fba8c845845b4a7f0c0583 (diff) | |
| download | illumos-joyent-03831d35f7499c87d51205817c93e9a8d42c4bae.tar.gz | |
6392837 move sram to usr/src
6393316 move fcgp2 to usr/src
6393416 move gptwo_pci to usr/src
6393420 move gptwo_wci to usr/src
6393421 move sc_gptwocfg to usr/src
6393424 move axq to usr/src
6393425 move dman to usr/src
6393426 move iosram to usr/src
6393427 move mboxsc to usr/src
6393428 move sbdp to usr/src
6393429 move schpc to usr/src
6393432 move sckmdrv to usr/src
6393435 move scosmb to usr/src
6393437 move driver sgcn to usr/src
6393438 move sgenv to usr/src
6393439 move sgfru to usr/src
6393440 move driver sghsc to usr/src
6393441 move driver sgsbbc to usr/src
6393442 move driver ssm to usr/src
6393452 move pcf8574_nct to usr/src
6393453 move pcf8591_nct to usr/src
6393454 move acebus to usr/src
6393455 move scsb to usr/src
6393462 move lw8 to usr/src
6393463 move driver rmc_comm to usr/src
6393464 move driver rmcadm to usr/src
6393475 move todsg to usr/src
6393889 move libprtdiag to usr/src
6393890 move libprtdiag_psr to usr/src
6393896 move librsc to usr/src
6393898 move scadm to usr/src
6399766 move serengeti platform to usr/src
6399770 move starcat platform to usr/src
6400949 daktari platmod Makefile references incorrect platmod directory
Diffstat (limited to 'usr/src/lib/libprtdiag/inc')
| -rw-r--r-- | usr/src/lib/libprtdiag/inc/display.h | 62 | ||||
| -rw-r--r-- | usr/src/lib/libprtdiag/inc/display_sun4u.h | 96 | ||||
| -rw-r--r-- | usr/src/lib/libprtdiag/inc/display_sun4v.h | 60 | ||||
| -rw-r--r-- | usr/src/lib/libprtdiag/inc/libprtdiag.h | 202 | ||||
| -rw-r--r-- | usr/src/lib/libprtdiag/inc/pdevinfo.h | 192 | ||||
| -rw-r--r-- | usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h | 233 | ||||
| -rw-r--r-- | usr/src/lib/libprtdiag/inc/reset_info.h | 108 |
7 files changed, 953 insertions, 0 deletions
diff --git a/usr/src/lib/libprtdiag/inc/display.h b/usr/src/lib/libprtdiag/inc/display.h new file mode 100644 index 0000000000..d90f5dc219 --- /dev/null +++ b/usr/src/lib/libprtdiag/inc/display.h @@ -0,0 +1,62 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _DISPLAY_H +#define _DISPLAY_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +extern int logging; +extern int print_flag; + +#define NOPRINT 0 +#define PRINT 1 +#define MX_SBUS_SLOTS 4 + +/* + * Define a structure to contain both the DRAM SIMM and NVRAM + * SIMM memory totals in MBytes. + */ +struct mem_total { + int dram; + int nvsimm; +}; + +/* Functions in common display.c module */ +void disp_powerfail(Prom_node *); +void log_printf(char *, ...); +char *get_time(uchar_t *); +void print_header(int); + +#ifdef __cplusplus +} +#endif + +#endif /* _DISPLAY_H */ diff --git a/usr/src/lib/libprtdiag/inc/display_sun4u.h b/usr/src/lib/libprtdiag/inc/display_sun4u.h new file mode 100644 index 0000000000..f9c7ed4f8e --- /dev/null +++ b/usr/src/lib/libprtdiag/inc/display_sun4u.h @@ -0,0 +1,96 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1999-2001 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _DISPLAY_SUN4U_H +#define _DISPLAY_SUN4U_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <pdevinfo_sun4u.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define the memory decode bits for easier reading. These are from + * the Sunfire Programmer's Manual. + */ +#define MEM_SIZE_64M 0x4 +#define MEM_SIZE_256M 0xb +#define MEM_SIZE_1G 0xf +#define MEM_SIZE_2G 0x2 + +#define MEM_SPEED_50ns 0x0 +#define MEM_SPEED_60ns 0x3 +#define MEM_SPEED_70ns 0x2 +#define MEM_SPEED_80ns 0x1 + +/* + * If a QLC card is present in the system, the following values are needed + * to decode what type of a QLC card it is. + */ +#define AMBER_SUBSYSTEM_ID 0x4082 +#define CRYSTAL_SUBSYSTEM_ID 0x4083 + +#define AMBER_CARD_NAME "Amber" +#define CRYSTAL_CARD_NAME "Crystal+" + +#define MAX_QLC_MODEL_LEN 10 + +/* + * Define strings in this structure as arrays instead of pointers so + * that copying is easier. + */ +struct io_card { + int display; /* Should we display this card? */ + int node_id; /* Node ID */ + int board; /* Board number */ + char bus_type[MAXSTRLEN]; /* Type of bus this IO card is on */ + int schizo_portid; /* portid of the Schizo for this card */ + char pci_bus; /* PCI bus A or B */ + int slot; /* Slot number */ + char slot_str[MAXSTRLEN]; /* Slot description string */ + int freq; /* Frequency (in MHz) */ + char status[MAXSTRLEN]; /* Card status */ + char name[MAXSTRLEN]; /* Card name */ + char model[MAXSTRLEN]; /* Card model */ + int dev_no; /* device number */ + int func_no; /* function number */ + char notes[MAXSTRLEN]; /* notes */ + struct io_card *next; +}; + +/* used to determine whether slot (int) or slot_str(char*) should be used */ +#define PCI_SLOT_IS_STRING (-99) + +int display(Sys_tree *, Prom_node *, struct system_kstat_data *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* _DISPLAY_SUN4U_H */ diff --git a/usr/src/lib/libprtdiag/inc/display_sun4v.h b/usr/src/lib/libprtdiag/inc/display_sun4v.h new file mode 100644 index 0000000000..19a4c3d295 --- /dev/null +++ b/usr/src/lib/libprtdiag/inc/display_sun4v.h @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _DISPLAY_SUN4V_H +#define _DISPLAY_SUN4V_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <picl.h> + +#define CLK_FREQ_TO_MHZ(x) (((x) + 500000) / 1000000) +#define MAXSTRLEN 256 +#define CPU_STRAND_NAC "MB/CMP0/P" +#define H20_IMPL 0x5678 +#define IS_H20(impl) ((impl) == H20_IMPL) + +#define EM_INIT_FAIL dgettext(TEXT_DOMAIN,\ + "picl_initialize failed: %s\n") +#define EM_GET_ROOT_FAIL dgettext(TEXT_DOMAIN,\ + "Getting root node failed: %s\n") + +void sun4v_display_pci(picl_nodehdl_t plafh); +void sun4v_display_memoryconf(); +void sun4v_display_cpu_devices(picl_nodehdl_t plafh); +int sun4v_display_cpus(picl_nodehdl_t cpuh, void* args); +void sun4v_display_diaginfo(int flag, Prom_node *root, picl_nodehdl_t plafh); +int sun4v_display(Sys_tree *, Prom_node *, int, picl_nodehdl_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _DISPLAY_SUN4V_H */ diff --git a/usr/src/lib/libprtdiag/inc/libprtdiag.h b/usr/src/lib/libprtdiag/inc/libprtdiag.h new file mode 100644 index 0000000000..0354aea6a3 --- /dev/null +++ b/usr/src/lib/libprtdiag/inc/libprtdiag.h @@ -0,0 +1,202 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_LIBPRTDIAG_H +#define _SYS_LIBPRTDIAG_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/openpromio.h> +#include <sys/cheetahregs.h> +#include "pdevinfo.h" +#include "display.h" +#include "pdevinfo_sun4u.h" +#include "display_sun4u.h" + +#ifdef DEBUG +#define D_PRINTF printf +#else +#define D_PRINTF +#endif + +#define EXIT_MSG(msg, err) \ + { printf("\n%s failed with %d\n", msg, err); exit(err); } + +/* global data */ +#define PCI_DEVICE(x) ((x >> 11) & 0x1f) +#define PCI_REG_TO_DEV(x) ((x & 0xf800) >> 11) +#define PCI_REG_TO_FUNC(x) ((x & 0x700) >> 8) +#define BUS_TYPE "UPA" +#define MAX_SLOTS_PER_IO_BD 8 + + +int sys_clk; /* System clock freq. (in MHz) */ + +/* + * Defines for identifying PCI devices + */ +#define PCI_BRIDGE_CLASS 0x6 +#define PCI_CLASS_SHIFT 0x10 +#define PCI_PCI_BRIDGE_SUBCLASS 0x4 +#define PCI_SUBCLASS_SHIFT 0x8 +#define PCI_SUBCLASS_MASK 0xFF00 +#define PCI_SUBCLASS_OTHER 0x80 + +#define CLASS_REG_TO_SUBCLASS(class) (((class) & PCI_SUBCLASS_MASK) \ + >> PCI_SUBCLASS_SHIFT) +#define CLASS_REG_TO_CLASS(class) ((class) >> PCI_CLASS_SHIFT) + +/* + * display functions + */ +int error_check(Sys_tree *tree, struct system_kstat_data *kstats); +int disp_fail_parts(Sys_tree *tree); +void display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats); +void display_diaginfo(int flag, Prom_node *root, Sys_tree *tree, + struct system_kstat_data *kstats); +void resolve_board_types(Sys_tree *); +void display_boardnum(int num); +void display_platform_specific_header(void); + +/* + * cpu functions + */ +void display_cpu_devices(Sys_tree *); +void display_cpus(Board_node *); +void display_mid(int mid); +int get_cpu_freq(Prom_node *); +int get_ecache_size(Prom_node *); + +/* + * io functions + */ +Prom_node *find_pci_bus(Prom_node *, int, int); +int get_pci_bus(Prom_node *); +int get_pci_device(Prom_node *); +int get_pci_to_pci_device(Prom_node *); +void free_io_cards(struct io_card *); +struct io_card *insert_io_card(struct io_card *, struct io_card *); +char *fmt_manf_id(unsigned int, char *); +int get_sbus_slot(Prom_node *); +void display_io_devices(Sys_tree *tree); +void display_pci(Board_node *bnode); +void display_io_cards(struct io_card *); +void display_ffb(Board_node *, int); +void display_sbus(Board_node *); +int populate_slot_name_arr(Prom_node *pci, int *slot_name_bits, + char **slot_name_arr, int num_slots); +int get_card_frequency(Prom_node *pci); +void get_dev_func_num(Prom_node *card_node, int *dev_no, int *func_no); +void get_pci_class_codes(Prom_node *card_node, int *class_code, + int *subclass_code); +int is_pci_bridge(Prom_node *card_node, char *name); +int is_pci_bridge_other(Prom_node *card_node, char *name); +void get_pci_card_model(Prom_node *card_node, char *model); +void create_io_card_name(Prom_node *card_node, char *name, + char *card_name); +void display_psycho_pci(Board_node *bnode); +void get_slot_number_str(struct io_card *card, char **slot_name_arr, + int slot_name_bits); +void distinguish_identical_io_cards(char *name, Prom_node *node, + struct io_card *card); +void decode_qlc_card_model_prop(Prom_node *card_node, struct io_card *card); + +/* + * kstat functions + */ +void read_platform_kstats(Sys_tree *tree, + struct system_kstat_data *sys_kstat, + struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep); +void read_sun4u_kstats(Sys_tree *, struct system_kstat_data *); + +/* + * memory functions + */ +void display_memorysize(Sys_tree *tree, struct system_kstat_data *kstats, + struct grp_info *grps, struct mem_total *memory_total); +void display_memoryconf(Sys_tree *tree, struct grp_info *grps); + +/* + * prom functions + */ +void platform_disp_prom_version(Sys_tree *); +void disp_prom_version(Prom_node *); +void add_node(Sys_tree *, Prom_node *); +Prom_node *find_device(Board_node *, int, char *); +Prom_node *walk(Sys_tree *, Prom_node *, int); +int get_pci_class_code_reg(Prom_node *); + +/* + * libdevinfo functions + */ +int do_devinfo(int, char *, int, int); + +/* + * mc-us3 memory functions and structs + */ +typedef struct memory_bank { + int id; + int portid; + ushort_t valid; + ushort_t uk; + uint_t um; + uchar_t lk; + uchar_t lm; + uint64_t bank_size; + char *bank_status; + struct memory_bank *next; /* mc in the devtree */ + struct memory_bank *seg_next; /* in the segment */ +} memory_bank_t; + +typedef struct memory_seg { + int id; + int intlv; /* interleave for this segment */ + uint64_t base; /* base address for this segment */ + uint64_t size; /* size of this segment */ + int nbanks; /* number of banks in this segment */ + memory_bank_t *banks; /* pointer to the banks of this seg */ + struct memory_seg *next; +} memory_seg_t; + +#define NUM_MBANKS_PER_MC 4 + +int get_us3_mem_regs(Board_node *bnode); +void display_us3_banks(void); +int display_us3_failed_banks(int system_failed); +void print_us3_memory_line(int portid, int bank_id, uint64_t bank_size, + char *bank_status, uint64_t dimm_size, uint32_t intlv, int seg_id); +void print_us3_failed_memory_line(int portid, int bank_id, + char *bank_status); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_LIBPRTDIAG_H */ diff --git a/usr/src/lib/libprtdiag/inc/pdevinfo.h b/usr/src/lib/libprtdiag/inc/pdevinfo.h new file mode 100644 index 0000000000..fc6e1bc8e7 --- /dev/null +++ b/usr/src/lib/libprtdiag/inc/pdevinfo.h @@ -0,0 +1,192 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _PDEVINFO_H +#define _PDEVINFO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* structures necessary to hold Openprom data */ + +/* + * 128 is the size of the largest (currently) property name + * 4096 - MAXPROPSIZE - sizeof (int) is the size of the largest + * (currently) property value that is allowed. + * the sizeof (u_int) is from struct openpromio + */ +#define MAXPROPSIZE 128 +#define MAXVALSIZE (4096 - MAXPROPSIZE - sizeof (uint_t)) +#define BUFSIZE (MAXPROPSIZE + MAXVALSIZE + sizeof (uint_t)) +typedef union { + char buf[BUFSIZE]; + struct openpromio opp; + void *val_ptr; +} Oppbuf; + +/* + * The prop structures associated with a Prom_node were formerly statically + * sized - via the buf element of the Oppbuf union. This was highly memory + * inefficient, so dynamic sizing capabilities have been introduced. + * + * This has been achieved via the creation of dynopenpromio and dynOppbuf + * structs, and altering the prop structure. The prop structure's name and value + * elements are now typed as dynOppbuf instead of Oppbuf. + * + * For legacy purposes, static_prop has been created. It is essentially the same + * as the former prop structure, but the *next element now points to a + * static_prop structure instead of a prop structure. + */ +typedef struct static_prop StaticProp; +struct static_prop { + StaticProp *next; + Oppbuf name; + Oppbuf value; + int size; /* size of data in bytes */ +}; + +/* + * dynopenpromio structs are similar to openpromio structs, but with 2 major + * differences. The first is that the opio_u.b element is char * instead of + * char [], which allows for dynamic sizing. + * + * The second regards opio_u.i, which was an int, but is now int []. In almost + * all cases, only opio_u.i (opio_u.i[0]) will be referenced. However, certain + * platforms rely on the fact that Prop structures formerly contained Oppbuf + * unions, the buf element of which was statically sized at 4k. In theory, this + * enabled those platforms to validly reference any part of the union up to 4k + * from the start. In reality, no element greater than opio_u.i[4] is currently + * referenced, hence OPROM_NODE_SIZE (named because opio_u.i is usually + * referenced as oprom_node) being set to 5. + * + * A minor difference is that the holds_array element has been added, which + * affords an easy way to determine whether opio_u contains char * or int. + */ +#define OPROM_NODE_SIZE 5 +struct dynopenpromio { + uint_t oprom_size; + union { + char *b; + int i[OPROM_NODE_SIZE]; + } opio_u; + uint_t holds_array; +}; + +/* + * dynOppbuf structs are a dynamic alternative to Oppbuf unions. The statically + * sized Oppbuf.buf element has been removed, and the opp element common to both + * is of type struct dynopenpromio instead of struct openpromio. This allows us + * to take advantage of dynopenpromio's dynamic sizing capabilities. + */ +typedef struct dynoppbuf dynOppbuf; +struct dynoppbuf { + struct dynopenpromio opp; + char *val_ptr; +}; + +typedef struct prop Prop; +struct prop { + Prop *next; + dynOppbuf name; + dynOppbuf value; + int size; /* size of data in bytes */ +}; + +typedef struct prom_node Prom_node; +struct prom_node { + Prom_node *parent; /* points to parent node */ + Prom_node *child; /* points to child PROM node */ + Prom_node *sibling; /* point to next sibling */ + Prop *props; /* points to list of properties */ +}; + +/* + * Defines for board types. + */ + +typedef struct board_node Board_node; +struct board_node { + int node_id; + int board_num; + int board_type; + Prom_node *nodes; + Board_node *next; /* link for list */ +}; + +typedef struct system_tree Sys_tree; +struct system_tree { + Prom_node *sys_mem; /* System memory node */ + Prom_node *boards; /* boards node holds bif info if present */ + Board_node *bd_list; /* node holds list of boards */ + int board_cnt; /* number of boards in the system */ +}; + +int do_prominfo(int, char *, int, int); +int is_openprom(void); +void promclose(void); +int promopen(int); +extern char *badarchmsg; +int _error(char *fmt, ...); + +/* Functions for building the user copy of the device tree. */ +Board_node *find_board(Sys_tree *, int); +Board_node *insert_board(Sys_tree *, int); + +/* functions for searching for Prom nodes */ +char *get_node_name(Prom_node *); +char *get_node_type(Prom_node *); +Prom_node *dev_find_node(Prom_node *, char *); +Prom_node *dev_next_node(Prom_node *, char *); +Prom_node *dev_find_node_by_type(Prom_node *root, char *type, char *property); +Prom_node *dev_next_node_by_type(Prom_node *root, char *type, char *property); +Prom_node *dev_find_type(Prom_node *, char *); +Prom_node *dev_next_type(Prom_node *, char *); +Prom_node *sys_find_node(Sys_tree *, int, char *); +Prom_node *find_failed_node(Prom_node *); +Prom_node *next_failed_node(Prom_node *); +Prom_node *dev_find_node_by_compatible(Prom_node *root, char *compat); +Prom_node *dev_next_node_by_compatible(Prom_node *root, char *compat); +int node_failed(Prom_node *); +int node_status(Prom_node *node, char *status); +void dump_node(Prom_node *); +int next(int); +int has_board_num(Prom_node *); +int get_board_num(Prom_node *); +int child(int); + +/* functions for searching for properties, extracting data from them */ +void *get_prop_val(Prop *); +void getpropval(struct openpromio *); +Prop *find_prop(Prom_node *, char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _PDEVINFO_H */ diff --git a/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h b/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h new file mode 100644 index 0000000000..7273d62b8d --- /dev/null +++ b/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h @@ -0,0 +1,233 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _PDEVINFO_SUN4U_H +#define _PDEVINFO_SUN4U_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/obpdefs.h> +#include <sys/fhc.h> +#include <sys/sysctrl.h> +#include <sys/environ.h> +#include <sys/envctrl_gen.h> +#include <sys/envctrl_ue250.h> +#include <sys/envctrl_ue450.h> +#include <sys/simmstat.h> +#include <sys/ac.h> +#include <sys/sram.h> +#include <reset_info.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define UNIX "unix" + +/* Define names of nodes to search for */ +#define CPU_NAME "SUNW,UltraSPARC" +#define SBUS_NAME "sbus" +#define PCI_NAME "pci" +#define FFB_NAME "SUNW,ffb" +#define AFB_NAME "SUNW,afb" + +struct mem_stat_data { + enum ac_bank_status status; /* bank status values */ + enum ac_bank_condition condition; /* bank conditions */ +}; + +struct bd_kstat_data { + u_longlong_t ac_memctl; /* Memctl register contents */ + u_longlong_t ac_memdecode[2]; /* memory decode registers . */ + int ac_kstats_ok; /* successful kstat read occurred */ + uint_t fhc_bsr; /* FHC Board Status Register */ + uint_t fhc_csr; /* FHC Control Status Register */ + int fhc_kstats_ok; /* successful kstat read occurred */ + uchar_t simm_status[SIMM_COUNT]; /* SIMM status */ + int simmstat_kstats_ok; /* successful read occurred */ + struct temp_stats tempstat; + int temp_kstat_ok; + struct mem_stat_data mem_stat[2]; /* raw kstat bank information */ + int ac_memstat_ok; /* successful read of memory status */ +}; + +/* + * Hot plug info structure. If a hotplug kstat is found, the bd_info + * structure from the kstat is filled in the the hp_info structure + * is marked OK. + */ +struct hp_info { + struct bd_info bd_info; + int kstat_ok; +}; + +/* Environmental info for Tazmo */ +struct envctrl_kstat_data { + envctrl_ps_t ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ + envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */ + envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */ +}; + +/* Environmental info for Javelin */ +struct envctrltwo_kstat_data { + envctrl_ps2_t ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ + int num_ps_kstats; + envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */ + int num_fan_kstats; + envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */ + int num_encl_kstats; + envctrl_temp_t temp_kstats[MAX_DEVS]; /* kstats for temperatures */ + int num_temp_kstats; + envctrl_disk_t disk_kstats[MAX_DEVS]; /* kstats for disks */ + int num_disk_kstats; +}; + +struct system_kstat_data { + uchar_t sysctrl; /* sysctrl register contents */ + uchar_t sysstat1; /* system status1 register contents. */ + uchar_t sysstat2; /* system status2 register contents. */ + uchar_t ps_shadow[SYS_PS_COUNT]; /* power supply shadow */ + int psstat_kstat_ok; + uchar_t clk_freq2; /* clock frequency register 2 contents */ + uchar_t fan_status; /* shadow fan status */ + uchar_t keysw_status; /* status of the key switch */ + enum power_state power_state; /* redundant power state */ + uchar_t clk_ver; /* clock version register */ + int sys_kstats_ok; /* successful kstat read occurred */ + struct temp_stats tempstat; + int temp_kstat_ok; + struct reset_info reset_info; + int reset_kstats_ok; /* kstat read OK */ + struct bd_kstat_data bd_ksp_list[MAX_BOARDS]; + struct hp_info hp_info[MAX_BOARDS]; + struct ft_list *ft_array; /* fault array */ + int nfaults; /* number of faults in fault array */ + int ft_kstat_ok; /* Fault kstats OK */ + struct envctrl_kstat_data env_data; /* environment data for Tazmo */ + int envctrl_kstat_ok; + struct envctrltwo_kstat_data envc_data; /* environ data for Javelin */ + int envctrltwo_kstat_ok; +}; + +/* Description of a single memory group */ +struct grp { + int valid; /* active memory group present */ + u_longlong_t base; /* Phyiscal base of group */ + uint_t size; /* size in bytes */ + uint_t curr_size; /* current size in bytes */ + int board; /* board number */ + enum board_type type; /* board type */ + int group; /* group # on board (0 or 1) */ + int factor; /* interleave factor (0,2,4,8,16) */ + int speed; /* Memory speed (in ns) */ + char groupid; /* Alpha tag for group ID */ + enum ac_bank_status status; /* bank status values */ + enum ac_bank_condition condition; /* bank conditions */ +}; + +#define MAX_GROUPS 32 +#define MAXSTRLEN 256 + +/* Array of all possible groups in the system. */ +struct grp_info { + struct grp grp[MAX_GROUPS]; +}; + +/* A memory interleave structure */ +struct inter_grp { + u_longlong_t base; /* Physical base of group */ + int valid; + int count; + char groupid; +}; + +/* Array of all possible memory interleave structures */ +struct mem_inter { + struct inter_grp i_grp[MAX_GROUPS]; +}; + +/* FFB info structure */ +struct ffbinfo { + int board; + int upa_id; + char *dev; + struct ffbinfo *next; +}; + +/* FFB strap reg union */ +union strap_un { + struct { + uint_t unused:24; + uint_t afb_flag:1; + uint_t major_rev:2; + uint_t board_rev:2; + uint_t board_mem:1; + uint_t cbuf:1; + uint_t bbuf:1; + } fld; + uint_t ffb_strap_bits; +}; + +/* known values for manufacturer's JED code */ +#define MANF_BROOKTREE 214 +#define MANF_MITSUBISHI 28 + +/* FFB mnufacturer union */ +union manuf { + struct { + uint_t version:4; /* version of part number */ + uint_t partno:16; /* part number */ + uint_t manf:11; /* manufacturer's JED code */ + uint_t one:1; /* always set to '1' */ + } fld; + uint_t encoded_id; +}; + +#define FFBIOC ('F' << 8) +#define FFB_SYS_INFO (FFBIOC| 80) + +struct ffb_sys_info { + unsigned int ffb_strap_bits; /* ffb_strapping register */ +#define FFB_B_BUFF 0x01 /* B buffer present */ +#define FFB_C_BUFF 0x02 /* C buffer present */ +#define FB_TYPE_AFB 0x80 /* AFB or FFB */ + unsigned int fbc_version; /* revision of FBC chip */ + unsigned int dac_version; /* revision of DAC chip */ + unsigned int fbram_version; /* revision of FBRAMs chip */ + unsigned int flags; /* miscellaneous flags */ +#define FFB_KSIM 0x00000001 /* kernel simulator */ +#define FFB_PAGE_FILL_BUG 0x00000002 /* FBRAM has page fill bug */ + unsigned int afb_nfloats; /* no. of Float asics in AFB */ + unsigned int pad[58]; /* padding for AFB chips & misc. */ +}; + +int get_id(Prom_node *); + +#ifdef __cplusplus +} +#endif + +#endif /* _PDEVINFO_SUN4U_H */ diff --git a/usr/src/lib/libprtdiag/inc/reset_info.h b/usr/src/lib/libprtdiag/inc/reset_info.h new file mode 100644 index 0000000000..8f94813a6f --- /dev/null +++ b/usr/src/lib/libprtdiag/inc/reset_info.h @@ -0,0 +1,108 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1999 by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _RESET_INFO_H +#define _RESET_INFO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * All of the following data structures and defines come from sun4u server + * POST. If the data in POST changes, then these structures must reflect + * those changes. + */ + +#include <sys/fhc.h> /* To get MAX_BOARDS constant */ + +/* BDA bit assignments */ +#define BOARD_PRESENT (1<<0) +#define BOARD_OK (1<<1) +#define BOARD_TYPE_MSK (7<<2) +#define BOARD_TYPE(x) (((x) & BOARD_TYPE_MSK) >> 2) + +/* Board state mask and defines */ +#define BD_STATE_MASK 0x3 +#define BD_LPM_FZN 0 +#define BD_ONLINE_FAIL 1 +#define BD_NOT_PRESENT 2 +#define BD_ONLINE_NORMAL 3 + +/* define CPU 0 fields */ +#define CPU0_PRESENT (1<<8) +#define CPU0_OK (1<<9) +#define CPU0_FAIL_CODE_MSK (7<<10) + +/* define CPU 1 fields */ +#define CPU1_PRESENT (1<<16) +#define CPU1_OK (1<<17) +#define CPU1_FAIL_CODE_MSK (7<<18) + +/* supported board types */ +#define CPU_TYPE 0 +#define MEM_TYPE 1 /* CPU/MEM board with only memory */ +#define IO_TYPE1 2 +#define IO_TYPE2 3 +#define IO_TYPE3 4 +#define IO_TYPE4 5 /* same as IO TYPE 1 but no HM or PHY chip */ +#define CLOCK_TYPE 7 + +/* for CPU type UPA ports */ +typedef struct { + u_longlong_t afsr; /* Fault status register for CPU */ + u_longlong_t afar; /* Fault address register for CPU */ +} cpu_reset_state; + +/* For the clock board */ +typedef struct { + unsigned long clk_ssr_1; /* reset status for the clock board */ +} clock_reset_state; + +struct board_info { + u_longlong_t board_desc; + cpu_reset_state cpu[2]; /* could be a CPU */ + u_longlong_t ac_error_status; + u_longlong_t dc_shadow_chain; + uint_t fhc_csr; + uint_t fhc_rcsr; +}; + +struct reset_info { + int length; /* size of the structure */ + int version; /* Version of the structure */ + struct board_info bd_reset_info[MAX_BOARDS]; + clock_reset_state clk; /* one clock board */ + unsigned char tod_timestamp[7]; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _RESET_INFO_H */ |
