1*1708Sstevel /* 2*1708Sstevel * CDDL HEADER START 3*1708Sstevel * 4*1708Sstevel * The contents of this file are subject to the terms of the 5*1708Sstevel * Common Development and Distribution License, Version 1.0 only 6*1708Sstevel * (the "License"). You may not use this file except in compliance 7*1708Sstevel * with the License. 8*1708Sstevel * 9*1708Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*1708Sstevel * or http://www.opensolaris.org/os/licensing. 11*1708Sstevel * See the License for the specific language governing permissions 12*1708Sstevel * and limitations under the License. 13*1708Sstevel * 14*1708Sstevel * When distributing Covered Code, include this CDDL HEADER in each 15*1708Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*1708Sstevel * If applicable, add the following below this CDDL HEADER, with the 17*1708Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 18*1708Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 19*1708Sstevel * 20*1708Sstevel * CDDL HEADER END 21*1708Sstevel */ 22*1708Sstevel /* 23*1708Sstevel * Copyright (c) 1999 by Sun Microsystems, Inc. 24*1708Sstevel * All rights reserved. 25*1708Sstevel */ 26*1708Sstevel 27*1708Sstevel #ifndef _PDEVINFO_SUN4U_H 28*1708Sstevel #define _PDEVINFO_SUN4U_H 29*1708Sstevel 30*1708Sstevel #pragma ident "%Z%%M% %I% %E% SMI" 31*1708Sstevel 32*1708Sstevel #include <sys/obpdefs.h> 33*1708Sstevel #include <sys/fhc.h> 34*1708Sstevel #include <sys/sysctrl.h> 35*1708Sstevel #include <sys/environ.h> 36*1708Sstevel #include <sys/envctrl_gen.h> 37*1708Sstevel #include <sys/envctrl_ue250.h> 38*1708Sstevel #include <sys/envctrl_ue450.h> 39*1708Sstevel #include <sys/simmstat.h> 40*1708Sstevel #include <sys/ac.h> 41*1708Sstevel #include <sys/sram.h> 42*1708Sstevel #include <reset_info.h> 43*1708Sstevel 44*1708Sstevel #ifdef __cplusplus 45*1708Sstevel extern "C" { 46*1708Sstevel #endif 47*1708Sstevel 48*1708Sstevel #define UNIX "unix" 49*1708Sstevel 50*1708Sstevel /* Define names of nodes to search for */ 51*1708Sstevel #define CPU_NAME "SUNW,UltraSPARC" 52*1708Sstevel #define SBUS_NAME "sbus" 53*1708Sstevel #define PCI_NAME "pci" 54*1708Sstevel #define FFB_NAME "SUNW,ffb" 55*1708Sstevel #define AFB_NAME "SUNW,afb" 56*1708Sstevel 57*1708Sstevel struct mem_stat_data { 58*1708Sstevel enum ac_bank_status status; /* bank status values */ 59*1708Sstevel enum ac_bank_condition condition; /* bank conditions */ 60*1708Sstevel }; 61*1708Sstevel 62*1708Sstevel struct bd_kstat_data { 63*1708Sstevel u_longlong_t ac_memctl; /* Memctl register contents */ 64*1708Sstevel u_longlong_t ac_memdecode[2]; /* memory decode registers . */ 65*1708Sstevel int ac_kstats_ok; /* successful kstat read occurred */ 66*1708Sstevel uint_t fhc_bsr; /* FHC Board Status Register */ 67*1708Sstevel uint_t fhc_csr; /* FHC Control Status Register */ 68*1708Sstevel int fhc_kstats_ok; /* successful kstat read occurred */ 69*1708Sstevel uchar_t simm_status[SIMM_COUNT]; /* SIMM status */ 70*1708Sstevel int simmstat_kstats_ok; /* successful read occurred */ 71*1708Sstevel struct temp_stats tempstat; 72*1708Sstevel int temp_kstat_ok; 73*1708Sstevel struct mem_stat_data mem_stat[2]; /* raw kstat bank information */ 74*1708Sstevel int ac_memstat_ok; /* successful read of memory status */ 75*1708Sstevel }; 76*1708Sstevel 77*1708Sstevel /* 78*1708Sstevel * Hot plug info structure. If a hotplug kstat is found, the bd_info 79*1708Sstevel * structure from the kstat is filled in the the hp_info structure 80*1708Sstevel * is marked OK. 81*1708Sstevel */ 82*1708Sstevel struct hp_info { 83*1708Sstevel struct bd_info bd_info; 84*1708Sstevel int kstat_ok; 85*1708Sstevel }; 86*1708Sstevel 87*1708Sstevel /* Environmental info for Tazmo */ 88*1708Sstevel struct envctrl_kstat_data { 89*1708Sstevel envctrl_ps_t ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ 90*1708Sstevel envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */ 91*1708Sstevel envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */ 92*1708Sstevel }; 93*1708Sstevel 94*1708Sstevel /* Environmental info for Javelin */ 95*1708Sstevel struct envctrltwo_kstat_data { 96*1708Sstevel envctrl_ps2_t ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ 97*1708Sstevel int num_ps_kstats; 98*1708Sstevel envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */ 99*1708Sstevel int num_fan_kstats; 100*1708Sstevel envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */ 101*1708Sstevel int num_encl_kstats; 102*1708Sstevel envctrl_temp_t temp_kstats[MAX_DEVS]; /* kstats for temperatures */ 103*1708Sstevel int num_temp_kstats; 104*1708Sstevel envctrl_disk_t disk_kstats[MAX_DEVS]; /* kstats for disks */ 105*1708Sstevel int num_disk_kstats; 106*1708Sstevel }; 107*1708Sstevel 108*1708Sstevel struct system_kstat_data { 109*1708Sstevel uchar_t sysctrl; /* sysctrl register contents */ 110*1708Sstevel uchar_t sysstat1; /* system status1 register contents. */ 111*1708Sstevel uchar_t sysstat2; /* system status2 register contents. */ 112*1708Sstevel uchar_t ps_shadow[SYS_PS_COUNT]; /* power supply shadow */ 113*1708Sstevel int psstat_kstat_ok; 114*1708Sstevel uchar_t clk_freq2; /* clock frequency register 2 contents */ 115*1708Sstevel uchar_t fan_status; /* shadow fan status */ 116*1708Sstevel uchar_t keysw_status; /* status of the key switch */ 117*1708Sstevel enum power_state power_state; /* redundant power state */ 118*1708Sstevel uchar_t clk_ver; /* clock version register */ 119*1708Sstevel int sys_kstats_ok; /* successful kstat read occurred */ 120*1708Sstevel struct temp_stats tempstat; 121*1708Sstevel int temp_kstat_ok; 122*1708Sstevel struct reset_info reset_info; 123*1708Sstevel int reset_kstats_ok; /* kstat read OK */ 124*1708Sstevel struct bd_kstat_data bd_ksp_list[MAX_BOARDS]; 125*1708Sstevel struct hp_info hp_info[MAX_BOARDS]; 126*1708Sstevel struct ft_list *ft_array; /* fault array */ 127*1708Sstevel int nfaults; /* number of faults in fault array */ 128*1708Sstevel int ft_kstat_ok; /* Fault kstats OK */ 129*1708Sstevel struct envctrl_kstat_data env_data; /* environment data for Tazmo */ 130*1708Sstevel int envctrl_kstat_ok; 131*1708Sstevel struct envctrltwo_kstat_data envc_data; /* environ data for Javelin */ 132*1708Sstevel int envctrltwo_kstat_ok; 133*1708Sstevel }; 134*1708Sstevel 135*1708Sstevel /* Description of a single memory group */ 136*1708Sstevel struct grp { 137*1708Sstevel int valid; /* active memory group present */ 138*1708Sstevel u_longlong_t base; /* Phyiscal base of group */ 139*1708Sstevel uint_t size; /* size in bytes */ 140*1708Sstevel uint_t curr_size; /* current size in bytes */ 141*1708Sstevel int board; /* board number */ 142*1708Sstevel enum board_type type; /* board type */ 143*1708Sstevel int group; /* group # on board (0 or 1) */ 144*1708Sstevel int factor; /* interleave factor (0,2,4,8,16) */ 145*1708Sstevel int speed; /* Memory speed (in ns) */ 146*1708Sstevel char groupid; /* Alpha tag for group ID */ 147*1708Sstevel enum ac_bank_status status; /* bank status values */ 148*1708Sstevel enum ac_bank_condition condition; /* bank conditions */ 149*1708Sstevel }; 150*1708Sstevel 151*1708Sstevel #define MAX_GROUPS 32 152*1708Sstevel #define MAXSTRLEN 256 153*1708Sstevel 154*1708Sstevel /* Array of all possible groups in the system. */ 155*1708Sstevel struct grp_info { 156*1708Sstevel struct grp grp[MAX_GROUPS]; 157*1708Sstevel }; 158*1708Sstevel 159*1708Sstevel /* A memory interleave structure */ 160*1708Sstevel struct inter_grp { 161*1708Sstevel u_longlong_t base; /* Physical base of group */ 162*1708Sstevel int valid; 163*1708Sstevel int count; 164*1708Sstevel char groupid; 165*1708Sstevel }; 166*1708Sstevel 167*1708Sstevel /* Array of all possible memory interleave structures */ 168*1708Sstevel struct mem_inter { 169*1708Sstevel struct inter_grp i_grp[MAX_GROUPS]; 170*1708Sstevel }; 171*1708Sstevel 172*1708Sstevel /* FFB info structure */ 173*1708Sstevel struct ffbinfo { 174*1708Sstevel int board; 175*1708Sstevel int upa_id; 176*1708Sstevel char *dev; 177*1708Sstevel struct ffbinfo *next; 178*1708Sstevel }; 179*1708Sstevel 180*1708Sstevel /* FFB strap reg union */ 181*1708Sstevel union strap_un { 182*1708Sstevel struct { 183*1708Sstevel uint_t unused:24; 184*1708Sstevel uint_t afb_flag:1; 185*1708Sstevel uint_t major_rev:2; 186*1708Sstevel uint_t board_rev:2; 187*1708Sstevel uint_t board_mem:1; 188*1708Sstevel uint_t cbuf:1; 189*1708Sstevel uint_t bbuf:1; 190*1708Sstevel } fld; 191*1708Sstevel uint_t ffb_strap_bits; 192*1708Sstevel }; 193*1708Sstevel 194*1708Sstevel /* known values for manufacturer's JED code */ 195*1708Sstevel #define MANF_BROOKTREE 214 196*1708Sstevel #define MANF_MITSUBISHI 28 197*1708Sstevel 198*1708Sstevel /* FFB mnufacturer union */ 199*1708Sstevel union manuf { 200*1708Sstevel struct { 201*1708Sstevel uint_t version:4; /* version of part number */ 202*1708Sstevel uint_t partno:16; /* part number */ 203*1708Sstevel uint_t manf:11; /* manufacturer's JED code */ 204*1708Sstevel uint_t one:1; /* always set to '1' */ 205*1708Sstevel } fld; 206*1708Sstevel uint_t encoded_id; 207*1708Sstevel }; 208*1708Sstevel 209*1708Sstevel #define FFBIOC ('F' << 8) 210*1708Sstevel #define FFB_SYS_INFO (FFBIOC| 80) 211*1708Sstevel 212*1708Sstevel struct ffb_sys_info { 213*1708Sstevel unsigned int ffb_strap_bits; /* ffb_strapping register */ 214*1708Sstevel #define FFB_B_BUFF 0x01 /* B buffer present */ 215*1708Sstevel #define FFB_C_BUFF 0x02 /* C buffer present */ 216*1708Sstevel #define FB_TYPE_AFB 0x80 /* AFB or FFB */ 217*1708Sstevel unsigned int fbc_version; /* revision of FBC chip */ 218*1708Sstevel unsigned int dac_version; /* revision of DAC chip */ 219*1708Sstevel unsigned int fbram_version; /* revision of FBRAMs chip */ 220*1708Sstevel unsigned int flags; /* miscellaneous flags */ 221*1708Sstevel #define FFB_KSIM 0x00000001 /* kernel simulator */ 222*1708Sstevel #define FFB_PAGE_FILL_BUG 0x00000002 /* FBRAM has page fill bug */ 223*1708Sstevel unsigned int afb_nfloats; /* no. of Float asics in AFB */ 224*1708Sstevel unsigned int pad[58]; /* padding for AFB chips & misc. */ 225*1708Sstevel }; 226*1708Sstevel 227*1708Sstevel int get_id(Prom_node *); 228*1708Sstevel 229*1708Sstevel #ifdef __cplusplus 230*1708Sstevel } 231*1708Sstevel #endif 232*1708Sstevel 233*1708Sstevel #endif /* _PDEVINFO_SUN4U_H */ 234