utils_host_board.h (7224B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 5 */ 6 7 8 #ifndef __UTILS_HOST_BOARD_H_INCLUDED__ 9 /* { */ 10 #define __UTILS_HOST_BOARD_H_INCLUDED__ 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 17 #include "appl/diag/dcmn/bsp_cards_consts.h" 18 19 #if !DUNE_BCM 20 #else 21 #ifndef B_HOST_MAX_PARAM_LEN 22 #define B_HOST_MAX_PARAM_LEN 20 23 #endif 24 #endif 25 26 void 27 init_host_board( 28 void 29 ); 30 unsigned int 31 utils_is_in_crate( 32 void 33 ); 34 35 unsigned int 36 utils_is_crate_gobi( 37 const unsigned int crate_type 38 ); 39 40 unsigned int 41 utils_is_crate_negev( 42 const unsigned int crate_type 43 ); 44 45 int 46 reset_device_on_host_board( 47 const unsigned int deassert_not_assert_reset, 48 const unsigned int device_location_on_reset_word 49 ); 50 51 #define __ATTRIBUTE_PACKED__ __attribute__ ((packed)) 52 53 /* 54 * App Activate 55 * { 56 */ 57 58 typedef enum 59 { 60 SOC_D_USR_APP_FLAVOR_NONE = 0, 61 SOC_D_USR_APP_FLAVOR_NORMAL = 1, 62 SOC_D_USR_APP_FLAVOR_MINIMAL = 2, 63 SOC_D_USR_APP_FLAVOR_WIN_01 = 3, 64 SOC_D_USR_APP_FLAVOR_SERVER = 4, 65 SOC_D_USR_APP_FLAVOR_NORMAL_AND_SERVER = 5, 66 SOC_D_USR_APP_FLAVOR_SERVER_WITH_INIT = 6, 67 SOC_D_USR_APP_FLAVOR_MINIMAL_NO_APP = 7, 68 SOC_D_USR_APP_FLAVOR_NOF_ENUMS 69 70 } SOC_D_USR_APP_FLAVOR; 71 72 73 void 74 d_usr_app_flavor_get( 75 SOC_D_USR_APP_FLAVOR* usr_app_flavor 76 ); 77 78 const char* 79 d_usr_app_flavor_to_str( 80 const SOC_D_USR_APP_FLAVOR usr_app_flavor, 81 const unsigned int short_format 82 ); 83 84 /* 85 * } 86 */ 87 88 89 90 91 /* 92 * App State 93 * { 94 */ 95 typedef enum 96 { 97 D_APP_STATE_E_NOT_VALID = 0, /*Defualt value - Not Valid*/ 98 D_APP_STATE_E_BOOT_FIN, /*Boot is Over*/ 99 D_APP_STATE_E_START_UP_APP_FIN, /*Start UP App is Over - FE/FAP/NP app is running*/ 100 D_APP_STATE_E_START_UP_FIN_NO_APP, /*Start UP is Over - NO FE/FAP/NP app is running*/ 101 D_APP_STATE_E_APP_ERR, /*Start UP is Over - Application was running and error was found*/ 102 103 /* 104 * Last enumerator 105 */ 106 D_APP_STATE_E_NOF_STATES 107 } D_APP_STATE_ENUM; 108 109 typedef struct 110 { 111 D_APP_STATE_ENUM enum_state; 112 113 unsigned long tbd_1; 114 unsigned long tbd_2; 115 unsigned long tbd_3; 116 unsigned long tbd_4; 117 unsigned long tbd_5; 118 unsigned long tbd_6; 119 unsigned long tbd_7; 120 unsigned long tbd_8; 121 unsigned long tbd_9; 122 } __ATTRIBUTE_PACKED__ D_APP_STATE; 123 124 /* 125 * Is used by 'd_app_state_set_state()' 126 */ 127 #define D_APP_STATE_SET_STATE_PRINT_SHORT_MAX (6) 128 129 void 130 d_app_state_get( 131 D_APP_STATE* d_app_state 132 ); 133 134 void 135 d_app_state_set_state( 136 const D_APP_STATE_ENUM e_state 137 ); 138 139 D_APP_STATE_ENUM 140 d_app_state_get_state(void 141 ); 142 143 const char* 144 d_app_state_set_state_to_str( 145 const D_APP_STATE* d_app_state, 146 const unsigned int short_format 147 ); 148 149 150 /* 151 * } 152 */ 153 154 155 156 157 /* 158 * { 159 * D_BOARD_INFO structure 160 */ 161 162 163 /* 164 * Structure of 'Dune Board Information' 165 * --- Always Change at the END of the structure--- 166 */ 167 typedef struct 168 { 169 /* 170 * On return, the finger load here the host board type. 171 * As return from "host_board_type_from_nv()". 172 */ 173 SOC_BSP_CARDS_DEFINES host_board_type ; 174 175 /* 176 * On return, the finger load here the host slot-id. 177 * As return from "slot_id()". 178 */ 179 unsigned char slot_id ; 180 181 /* 182 * On return, the finger load here the host board device version. 183 * As return from "host_board_type_from_nv()". 184 */ 185 unsigned int device_ver ; 186 187 /* 188 * On return, the finger load here the host board serial number. 189 * As return from "host_board_sn_from_nv()". 190 */ 191 unsigned short host_board_serial_number ; 192 193 /* 194 * On return, the finger load here the Crate Type. 195 * As return from "get_crate_type()". 196 */ 197 unsigned char crate_type ; 198 199 /* 200 * On return, the finger load here the SW version. 201 * As return from "get_prog_ver()". 202 */ 203 unsigned long prog_version; 204 205 /* 206 * On return, the finger load here the CPU board serial number. 207 * As return from "host_board_sn_from_nv()". 208 */ 209 unsigned short cpu_board_serial_number ; 210 211 /* 212 * On return, the finger load here the Chassis crate-id. 213 * As return from "get_crate_id()". 214 * If the CPU is not in crate - it will be indicated in 215 * 'slot_id' as ZERO. 216 */ 217 unsigned long crate_id; 218 219 /* 220 * Application state, as return from "d_app_state_get()" 221 * This is run-time state. 222 */ 223 D_APP_STATE app_state; 224 225 /* 226 * Application Activate, as return from "d_usr_app_flavor_get()". 227 * This is user request in the NvRam 228 */ 229 SOC_D_USR_APP_FLAVOR usr_app_flavor; 230 231 /* 232 * On return, the finger load here the front-host board serial number. 233 * As return from "host_board_sn_from_nv()". 234 */ 235 unsigned short front_host_board_serial_number ; 236 237 /* 238 * On return, the finger loads here the host daughter-board serial number. 239 * As return from "host_board_sn_from_nv()". 240 */ 241 unsigned short host_db_serial_number ; 242 243 /* 244 * On return, the finger load here the host board device debug version (device subversion). 245 * As return from "host_board_type_from_nv()". 246 */ 247 unsigned int device_dbg_ver ; 248 249 /* 250 * Adding fields here only 251 */ 252 253 } __ATTRIBUTE_PACKED__ D_BOARD_INFO_STRCT; 254 255 256 257 #define D_BOARD_INFO_SIZE_IN_LONG 100 258 typedef union 259 { 260 D_BOARD_INFO_STRCT inf; 261 unsigned long FILLER[D_BOARD_INFO_SIZE_IN_LONG]; 262 263 } __ATTRIBUTE_PACKED__ D_BOARD_INFO; 264 265 266 267 int 268 board_information_get( 269 D_BOARD_INFO* b_info 270 ); 271 void 272 board_information_print( 273 const D_BOARD_INFO* b_info, 274 const unsigned int short_format 275 ); 276 void 277 board_information_clear( 278 D_BOARD_INFO* b_info 279 ); 280 /* 281 * } 282 */ 283 284 285 /* 286 * { 287 * D_BOARD_NV_APP_INFO structure 288 */ 289 290 291 typedef struct 292 { 293 char host_board_param_1[B_HOST_MAX_PARAM_LEN]; 294 char host_board_param_2[B_HOST_MAX_PARAM_LEN]; 295 char host_board_param_3[B_HOST_MAX_PARAM_LEN]; 296 char host_board_param_4[B_HOST_MAX_PARAM_LEN]; 297 char host_board_param_5[B_HOST_MAX_PARAM_LEN]; 298 char host_board_param_6[B_HOST_MAX_PARAM_LEN]; 299 char host_board_param_7[B_HOST_MAX_PARAM_LEN]; 300 char host_board_param_8[B_HOST_MAX_PARAM_LEN]; 301 char host_board_param_9[B_HOST_MAX_PARAM_LEN]; 302 char host_board_param_10[B_HOST_MAX_PARAM_LEN]; 303 } __ATTRIBUTE_PACKED__ D_BOARD_NV_APP_INFO; 304 305 306 int 307 board_nv_app_information_get( 308 D_BOARD_NV_APP_INFO* b_app 309 ); 310 int 311 board_nv_app_information_set( 312 const D_BOARD_NV_APP_INFO* b_app 313 ); 314 315 void 316 board_nv_app_information_print( 317 const D_BOARD_NV_APP_INFO* b_app, 318 const unsigned int short_format 319 ); 320 void 321 board_nv_app_information_clear( 322 D_BOARD_NV_APP_INFO* b_app 323 ); 324 325 /* 326 * } 327 */ 328 329 330 331 332 333 /* 334 * { 335 * D_BOARD_NV_CPU_INFO -- CPU board - NvRam values 336 */ 337 338 339 typedef struct 340 { 341 unsigned short board_serial_number ; 342 unsigned short board_version ; 343 char board_description[40] ; 344 char board_name[12] ; 345 } D_BOARD_NV_CPU_INFO; 346 347 348 int 349 board_nv_cpu_info_get( 350 D_BOARD_NV_CPU_INFO* b_cpu 351 ); 352 353 void 354 board_nv_cpu_info_print( 355 const D_BOARD_NV_CPU_INFO* b_cpu, 356 const unsigned int short_format 357 ); 358 359 void 360 board_nv_cpu_info_get_clear( 361 D_BOARD_NV_CPU_INFO* b_cpu 362 ); 363 364 365 /* 366 * } 367 */ 368 369 #ifdef __cplusplus 370 } 371 #endif 372 373 /* } __UTILS_HOST_BOARD_H_INCLUDED__*/ 374 #endif 375