1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_PDA_H 28*0Sstevel@tonic-gate #define _SYS_PDA_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #include <sys/types.h> 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate /* 39*0Sstevel@tonic-gate * Contains definitions used for PDA (Post Descriptor Array) [post2obp] 40*0Sstevel@tonic-gate * support. 41*0Sstevel@tonic-gate * 42*0Sstevel@tonic-gate * XXX - These data structures is defined in SSP-land in: 43*0Sstevel@tonic-gate * src/post/export/xf_postif.h. It is not anticipated 44*0Sstevel@tonic-gate * that any future changes will be made to this data 45*0Sstevel@tonic-gate * structure so we'll allow this hack on this go around. 46*0Sstevel@tonic-gate */ 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate #define MAX_ABUSES 4 /* Address buses */ 49*0Sstevel@tonic-gate #define MAX_DBUSES 2 /* Data buses */ 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate #define MAX_SYSBDS 16 /* no more than 16 system boards */ 52*0Sstevel@tonic-gate #define MAX_PROCMODS 4 /* Per system board */ 53*0Sstevel@tonic-gate #define MAX_PC 3 /* Per system board */ 54*0Sstevel@tonic-gate #define MAX_XDB 4 /* Per system board */ 55*0Sstevel@tonic-gate #define MAX_CIC 4 /* Per system board */ 56*0Sstevel@tonic-gate #define MAX_MGROUPS 4 /* Per MC and system board */ 57*0Sstevel@tonic-gate #define MAX_IOCS 2 /* Per system board */ 58*0Sstevel@tonic-gate #define MAX_SLOTS_PER_IOC 4 /* Per ioc */ 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate typedef struct { 61*0Sstevel@tonic-gate ushort_t bda_board; /* BDAN 0|Anyred|mem|Board */ 62*0Sstevel@tonic-gate ushort_t bda_proc; /* BDAN Processor 3:0 */ 63*0Sstevel@tonic-gate ushort_t bda_pc; /* BDAN PC asic 2:0 */ 64*0Sstevel@tonic-gate ushort_t bda_xdb; /* BDAN XDB asic 3:0 */ 65*0Sstevel@tonic-gate ushort_t bda_cic; /* BDAN CIC asic 3:0 */ 66*0Sstevel@tonic-gate ushort_t bda_ldpath; /* BDAN 0|0| ldpath [dbus] */ 67*0Sstevel@tonic-gate ushort_t bda_ioc; /* BDAN 0|0| ioc 1:0 */ 68*0Sstevel@tonic-gate ushort_t bda_ios[MAX_IOCS]; /* BDAN Scard 3:0 */ 69*0Sstevel@tonic-gate ushort_t bda_mgroup; /* BDAN memory group 3:0 */ 70*0Sstevel@tonic-gate } board_desc_t; 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate typedef struct { 73*0Sstevel@tonic-gate ushort_t bada_proc [MAX_PROCMODS]; /* Extra status on procs */ 74*0Sstevel@tonic-gate uchar_t bada_iom_type; /* I/O module type. */ 75*0Sstevel@tonic-gate uchar_t bada_fill[3]; 76*0Sstevel@tonic-gate ushort_t bada_ioc[MAX_IOCS]; /* Extra status on iocs */ 77*0Sstevel@tonic-gate } board_auxdesc_t; 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate /* 80*0Sstevel@tonic-gate * The three lsb of bada_proc holds the ecache size of that proc 81*0Sstevel@tonic-gate * module, as (log-base-2 - 19), so 1/2 MB is 0, 1 MB is 1, ... 82*0Sstevel@tonic-gate * 32 MB is 6. 7 is a bogus value. 83*0Sstevel@tonic-gate */ 84*0Sstevel@tonic-gate #define BADA_PROC_GET_ECL2M19(bada_proc) ((bada_proc) & 0x7) 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gate typedef struct { 87*0Sstevel@tonic-gate uint32_t bmda_adr; /* MC ADR */ 88*0Sstevel@tonic-gate uint32_t bmda_gab_bank_sel; /* MC gab bank sel reg */ 89*0Sstevel@tonic-gate ushort_t bmda_bank_setup; /* MC gab bank setup reg */ 90*0Sstevel@tonic-gate ushort_t bmda_filler; 91*0Sstevel@tonic-gate int32_t bmda_badpage[MAX_MGROUPS]; 92*0Sstevel@tonic-gate /* 93*0Sstevel@tonic-gate * One bad page offset per 94*0Sstevel@tonic-gate * mgroup is allowed. No 95*0Sstevel@tonic-gate * bad page if < 0. 96*0Sstevel@tonic-gate */ 97*0Sstevel@tonic-gate } board_mdesc_t; 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate /* 100*0Sstevel@tonic-gate * BDA nibble status definitions: 101*0Sstevel@tonic-gate * These are ordered in terms of preserving interesting information 102*0Sstevel@tonic-gate * in POST displays where all configurations are displayed in a 103*0Sstevel@tonic-gate * single value. The highest value for a resource over all 104*0Sstevel@tonic-gate * configurations is shown. 105*0Sstevel@tonic-gate * Of course, this is just for help to engineers/technicians in 106*0Sstevel@tonic-gate * understanding what happened; for the most part, everything 107*0Sstevel@tonic-gate * except "GOOD" is just different flavors of "BAD". 108*0Sstevel@tonic-gate * Note the special macro SET_BDA_NBL_CRUNCH below which requires 109*0Sstevel@tonic-gate * that BDAN_CRUNCH be 0. 110*0Sstevel@tonic-gate */ 111*0Sstevel@tonic-gate #define BDAN_CRUNCH 0x0 /* Unusable by implication */ 112*0Sstevel@tonic-gate #define BDAN_UNDEFINED 0x1 /* Architecturally Missing */ 113*0Sstevel@tonic-gate #define BDAN_MISS 0x2 /* Missing */ 114*0Sstevel@tonic-gate #define BDAN_FAIL 0x3 /* Tested and failed */ 115*0Sstevel@tonic-gate #define BDAN_BLACK 0x4 /* Blacklisted */ 116*0Sstevel@tonic-gate #define BDAN_RED 0x5 /* Redlisted */ 117*0Sstevel@tonic-gate #define BDAN_EXCLUDED 0x6 /* Board is not in this domain */ 118*0Sstevel@tonic-gate #define BDAN_UNCONFIG 0x7 /* Good, but not in config. */ 119*0Sstevel@tonic-gate #define BDAN_GOOD 0x8 /* Like it says. */ 120*0Sstevel@tonic-gate #define BDAN_MASK 0xF 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate /* Macros for accessing BDA nibbles */ 124*0Sstevel@tonic-gate #define BDA_NBL(shrt, nibix) \ 125*0Sstevel@tonic-gate (((shrt) >> ((nibix) << 2)) & BDAN_MASK) 126*0Sstevel@tonic-gate #define SET_BDA_NBL(shrt, nibix, val) \ 127*0Sstevel@tonic-gate { \ 128*0Sstevel@tonic-gate shrt &= ~(BDAN_MASK << ((nibix) << 2)); \ 129*0Sstevel@tonic-gate shrt |= (val) << ((nibix) << 2); \ 130*0Sstevel@tonic-gate } 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate /* 133*0Sstevel@tonic-gate * This exists to keep lint from complaining about statements with 134*0Sstevel@tonic-gate * null efect when we OR in a constant 0 in SET_BDA_NBL. It's a pain, 135*0Sstevel@tonic-gate * but it does save the code optimizer some work. ;-{ 136*0Sstevel@tonic-gate */ 137*0Sstevel@tonic-gate #define SET_BDA_NBL_CRUNCH(shrt, nibix) \ 138*0Sstevel@tonic-gate (shrt &= ~(BDAN_MASK << ((nibix) << 2))) 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gate /* Definitions for nibbles in the bda_board element: */ 141*0Sstevel@tonic-gate #define BDA_GEN_NBL 0 /* Overall state of the board */ 142*0Sstevel@tonic-gate #define BDA_MC_NBL 1 /* State of the memory. */ 143*0Sstevel@tonic-gate /* 144*0Sstevel@tonic-gate * BDAN_RED if anything red on board, or board is BDAN_EXCLUDED; 145*0Sstevel@tonic-gate * otherwise BDAN_GOOD 146*0Sstevel@tonic-gate */ 147*0Sstevel@tonic-gate #define BDA_ANYRED_NBL 2 148*0Sstevel@tonic-gate /* 149*0Sstevel@tonic-gate * Macro BDA_PAGESHIFT hides Solaris page size to Starfire POST, as POST 150*0Sstevel@tonic-gate * assumes Solaris basic page size as 8K. 151*0Sstevel@tonic-gate * Note: Only BDA_PAGESHIFT is used, BDA_PAGESIZE is added for readability. 152*0Sstevel@tonic-gate */ 153*0Sstevel@tonic-gate #define BDA_PAGESHIFT 13 154*0Sstevel@tonic-gate #define BDA_PAGESIZE (1<<BDA_PAGESHIFT) 155*0Sstevel@tonic-gate 156*0Sstevel@tonic-gate typedef struct { /* Memory Total Descriptor */ 157*0Sstevel@tonic-gate int32_t Memt_NumPages; /* 8 KB each */ 158*0Sstevel@tonic-gate int32_t Memt_NumChunks; 159*0Sstevel@tonic-gate } MemoryTotal_t; 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gate typedef struct { /* Chunk Descriptor */ 162*0Sstevel@tonic-gate uint32_t Memc_StartAddress; /* In 8 KB pages */ 163*0Sstevel@tonic-gate int32_t Memc_Size; /* In 8 KB pages */ 164*0Sstevel@tonic-gate } MemChunk_t; 165*0Sstevel@tonic-gate 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate #define P2OBP_MAGIC "XFPOST_2OBP" 168*0Sstevel@tonic-gate #define VAR_ARRAY_LEN 1 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate typedef struct { 171*0Sstevel@tonic-gate char p2o_magic[12]; /* magic cookie = P2OBP_MAGIC */ 172*0Sstevel@tonic-gate int32_t p2o_struct_version; /* equal to P2OBP_VERSION */ 173*0Sstevel@tonic-gate uint32_t p2o_csum; /* sum(uint[]) */ 174*0Sstevel@tonic-gate uint32_t p2o_post_time; /* creation time */ 175*0Sstevel@tonic-gate uint32_t p2o_post_pid; /* pid of sequencer on SSP */ 176*0Sstevel@tonic-gate uint32_t p2o_post_level; /* level at which hpost ran */ 177*0Sstevel@tonic-gate short p2o_abus_mask; /* [3:0] = Valid PA buses */ 178*0Sstevel@tonic-gate /* [5:4] = bus shuffle mode */ 179*0Sstevel@tonic-gate short p2o_dbus_mask; /* Valid physdata buses */ 180*0Sstevel@tonic-gate uint32_t p2o_intercon_freq; /* hz */ 181*0Sstevel@tonic-gate uint32_t p2o_procssor_freq; /* hz */ 182*0Sstevel@tonic-gate int32_t p2o_post_private; 183*0Sstevel@tonic-gate uint32_t p2o_flags; /* See P2OFLAG_XXX */ 184*0Sstevel@tonic-gate uchar_t p2o_procint_intx_freq_ratio; /* 0 if not known */ 185*0Sstevel@tonic-gate uchar_t p2o_fill_byte[3]; 186*0Sstevel@tonic-gate uint_t p2o_filler[6]; /* for expansion */ 187*0Sstevel@tonic-gate board_desc_t p2o_bdinfo[MAX_SYSBDS]; 188*0Sstevel@tonic-gate board_mdesc_t p2o_bdminfo[MAX_SYSBDS]; 189*0Sstevel@tonic-gate board_auxdesc_t p2o_auxinfo[MAX_SYSBDS]; 190*0Sstevel@tonic-gate MemoryTotal_t p2o_memtotal; 191*0Sstevel@tonic-gate /* 192*0Sstevel@tonic-gate * Array of descriptors of existing memory. 193*0Sstevel@tonic-gate * Number of descriptors is given in memtotal.NumChunks. 194*0Sstevel@tonic-gate */ 195*0Sstevel@tonic-gate MemChunk_t p2o_mchunks[VAR_ARRAY_LEN]; 196*0Sstevel@tonic-gate } post2obp_info_t; 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gate #ifdef _KERNEL 199*0Sstevel@tonic-gate /* 200*0Sstevel@tonic-gate * Following definitions in support of DR. 201*0Sstevel@tonic-gate */ 202*0Sstevel@tonic-gate typedef void *pda_handle_t; 203*0Sstevel@tonic-gate 204*0Sstevel@tonic-gate extern pda_handle_t pda_open(); 205*0Sstevel@tonic-gate extern void pda_close(pda_handle_t ph); 206*0Sstevel@tonic-gate extern int pda_board_present(pda_handle_t ph, int boardnum); 207*0Sstevel@tonic-gate extern void *pda_get_board_info(pda_handle_t ph, int boardnum); 208*0Sstevel@tonic-gate extern uint_t pda_get_mem_size(pda_handle_t ph, int boardnum); 209*0Sstevel@tonic-gate extern void pda_mem_add_span(pda_handle_t ph, 210*0Sstevel@tonic-gate uint64_t basepa, 211*0Sstevel@tonic-gate uint64_t nbytes); 212*0Sstevel@tonic-gate extern void pda_mem_del_span(pda_handle_t ph, 213*0Sstevel@tonic-gate uint64_t basepa, 214*0Sstevel@tonic-gate uint64_t nbytes); 215*0Sstevel@tonic-gate extern void pda_mem_sync(pda_handle_t ph, int board, int unit); 216*0Sstevel@tonic-gate extern void pda_get_busmask(pda_handle_t ph, 217*0Sstevel@tonic-gate short *amask, short *dmask); 218*0Sstevel@tonic-gate extern int pda_is_valid(pda_handle_t ph); 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate #endif /* _KERNEL */ 221*0Sstevel@tonic-gate 222*0Sstevel@tonic-gate #ifdef __cplusplus 223*0Sstevel@tonic-gate } 224*0Sstevel@tonic-gate #endif 225*0Sstevel@tonic-gate 226*0Sstevel@tonic-gate #endif /* _SYS_PDA_H */ 227