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