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 2004 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 _PICLDEVTREE_H 28*0Sstevel@tonic-gate #define _PICLDEVTREE_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 "picldefs.h" 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #define DEVICE_TYPE_BLOCK "block" 39*0Sstevel@tonic-gate #define DEVICE_TYPE_BYTE "byte" 40*0Sstevel@tonic-gate #define DEVICE_TYPE_DISK "disk" 41*0Sstevel@tonic-gate #define DEVICE_TYPE_SES "ses" 42*0Sstevel@tonic-gate #define DEVICE_TYPE_FP "fp" 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate #define HASH_TABLE_SIZE 64 45*0Sstevel@tonic-gate #define HASH_INDEX(s, x) ((int)((x) & ((s) - 1))) 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate #define MAX_NAMEVAL_SIZE 80 48*0Sstevel@tonic-gate #define CONFFILE_LINELEN_MAX 1024 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate #define KSTAT_STATE_BEGIN "state_begin" 51*0Sstevel@tonic-gate #define KSTAT_CPU_INFO "cpu_info" 52*0Sstevel@tonic-gate #define ASR_DISABLED "disabled" 53*0Sstevel@tonic-gate #define ASR_FAILED "failed" 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate #define DEVTREE_CONFFILE_NAME "picldevtree.conf" 56*0Sstevel@tonic-gate #define ASRTREE_CONFFILE_NAME "picl_asr.conf" 57*0Sstevel@tonic-gate #define CONFFILE_COMMENT_CHAR '#' 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate /* 60*0Sstevel@tonic-gate * Constants 61*0Sstevel@tonic-gate */ 62*0Sstevel@tonic-gate #define FFB_MANUF_BUFSIZE 256 63*0Sstevel@tonic-gate #define SUPPORTED_NUM_CELL_SIZE 2 /* #size-cells */ 64*0Sstevel@tonic-gate #define MAX_STATE_SIZE 32 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate /* 67*0Sstevel@tonic-gate * Hash table structure 68*0Sstevel@tonic-gate */ 69*0Sstevel@tonic-gate typedef struct hash_elem { 70*0Sstevel@tonic-gate picl_nodehdl_t hdl; 71*0Sstevel@tonic-gate struct hash_elem *next; 72*0Sstevel@tonic-gate } hash_elem_t; 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate typedef struct { 75*0Sstevel@tonic-gate int hash_size; 76*0Sstevel@tonic-gate hash_elem_t **tbl; 77*0Sstevel@tonic-gate } hash_t; 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate /* 80*0Sstevel@tonic-gate * name to class map entries in the conf file 81*0Sstevel@tonic-gate */ 82*0Sstevel@tonic-gate typedef struct conf_entries { 83*0Sstevel@tonic-gate char *name; 84*0Sstevel@tonic-gate char *piclclass; 85*0Sstevel@tonic-gate struct conf_entries *next; 86*0Sstevel@tonic-gate } conf_entries_t; 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate /* 89*0Sstevel@tonic-gate * name to address to class map for asr2 90*0Sstevel@tonic-gate */ 91*0Sstevel@tonic-gate typedef struct asr_conf_entries { 92*0Sstevel@tonic-gate char *name; 93*0Sstevel@tonic-gate char *piclclass; 94*0Sstevel@tonic-gate char *status; 95*0Sstevel@tonic-gate char *address; 96*0Sstevel@tonic-gate char *props; 97*0Sstevel@tonic-gate struct asr_conf_entries *next; 98*0Sstevel@tonic-gate } asr_conf_entries_t; 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate /* 101*0Sstevel@tonic-gate * type, name, val property triplet for asr2 102*0Sstevel@tonic-gate */ 103*0Sstevel@tonic-gate typedef struct asr_prop_triplet { 104*0Sstevel@tonic-gate char *proptype; 105*0Sstevel@tonic-gate char *propname; 106*0Sstevel@tonic-gate char *propval; 107*0Sstevel@tonic-gate } asr_prop_triplet_t; 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate /* 110*0Sstevel@tonic-gate * built-in name to class mapping table 111*0Sstevel@tonic-gate */ 112*0Sstevel@tonic-gate typedef struct { 113*0Sstevel@tonic-gate char name[MAX_NAMEVAL_SIZE]; 114*0Sstevel@tonic-gate char piclclass[PICL_CLASSNAMELEN_MAX]; 115*0Sstevel@tonic-gate } builtin_map_t; 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate /* 118*0Sstevel@tonic-gate * property name to type mapping table 119*0Sstevel@tonic-gate */ 120*0Sstevel@tonic-gate typedef struct { 121*0Sstevel@tonic-gate char pname[PICL_PROPNAMELEN_MAX]; 122*0Sstevel@tonic-gate int type; 123*0Sstevel@tonic-gate } pname_type_map_t; 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate /* known values for manufacturer's JED code */ 126*0Sstevel@tonic-gate #define MANF_BROOKTREE 214 127*0Sstevel@tonic-gate #define MANF_MITSUBISHI 28 128*0Sstevel@tonic-gate #define FFB_NAME "ffb" 129*0Sstevel@tonic-gate #define FFBIOC ('F' << 8) 130*0Sstevel@tonic-gate #define FFB_SYS_INFO (FFBIOC| 80) 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate /* FFB strap reg union */ 133*0Sstevel@tonic-gate typedef union { 134*0Sstevel@tonic-gate struct { 135*0Sstevel@tonic-gate uint32_t unused:24; 136*0Sstevel@tonic-gate uint32_t afb_flag:1; 137*0Sstevel@tonic-gate uint32_t major_rev:2; 138*0Sstevel@tonic-gate uint32_t board_rev:2; 139*0Sstevel@tonic-gate uint32_t board_mem:1; 140*0Sstevel@tonic-gate uint32_t cbuf:1; 141*0Sstevel@tonic-gate uint32_t bbuf:1; 142*0Sstevel@tonic-gate } fld; 143*0Sstevel@tonic-gate uint32_t ffb_strap_bits; 144*0Sstevel@tonic-gate } strap_un_t; 145*0Sstevel@tonic-gate 146*0Sstevel@tonic-gate /* FFB mnufacturer union */ 147*0Sstevel@tonic-gate typedef union { 148*0Sstevel@tonic-gate struct { 149*0Sstevel@tonic-gate uint32_t version:4; /* version of part number */ 150*0Sstevel@tonic-gate uint32_t partno:16; /* part number */ 151*0Sstevel@tonic-gate uint32_t manf:11; /* manufacturer's JED code */ 152*0Sstevel@tonic-gate uint32_t one:1; /* always set to '1' */ 153*0Sstevel@tonic-gate } fld; 154*0Sstevel@tonic-gate uint32_t encoded_id; 155*0Sstevel@tonic-gate } manuf_t; 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate typedef struct ffb_sys_info { 158*0Sstevel@tonic-gate strap_un_t ffb_strap_bits; /* ffb_strapping register */ 159*0Sstevel@tonic-gate manuf_t fbc_version; /* revision of FBC chip */ 160*0Sstevel@tonic-gate manuf_t dac_version; /* revision of DAC chip */ 161*0Sstevel@tonic-gate manuf_t fbram_version; /* revision of FBRAMs chip */ 162*0Sstevel@tonic-gate uint32_t flags; /* miscellaneous flags */ 163*0Sstevel@tonic-gate uint32_t afb_nfloats; /* no. of Float asics in AFB */ 164*0Sstevel@tonic-gate uint32_t pad[58]; /* padding for AFB chips & misc. */ 165*0Sstevel@tonic-gate } ffb_sys_info_t; 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate typedef struct memspecs { 168*0Sstevel@tonic-gate uint32_t physlo; 169*0Sstevel@tonic-gate uint32_t physhi; 170*0Sstevel@tonic-gate uint64_t size; 171*0Sstevel@tonic-gate } memspecs_t; 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gate /* 174*0Sstevel@tonic-gate * UnitAddress property related constants and data structures 175*0Sstevel@tonic-gate */ 176*0Sstevel@tonic-gate 177*0Sstevel@tonic-gate #define DEFAULT_ADDRESS_CELLS 2 178*0Sstevel@tonic-gate #define MAX_UNIT_ADDRESS_LEN 256 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gate typedef int unitaddr_func_t(char *, int, uint32_t *, uint_t); 181*0Sstevel@tonic-gate 182*0Sstevel@tonic-gate typedef struct { 183*0Sstevel@tonic-gate char *class; /* class name */ 184*0Sstevel@tonic-gate unitaddr_func_t *func; /* function to encode unit address */ 185*0Sstevel@tonic-gate int addrcellcnt; /* #addrcell expected, if non-zero */ 186*0Sstevel@tonic-gate } unitaddr_map_t; 187*0Sstevel@tonic-gate 188*0Sstevel@tonic-gate #ifdef __cplusplus 189*0Sstevel@tonic-gate } 190*0Sstevel@tonic-gate #endif 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate #endif /* _PICLDEVTREE_H */ 193