cvmx-app-init.h revision 215014
1/***********************license start*************** 2 * Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights 3 * reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above 14 * copyright notice, this list of conditions and the following 15 * disclaimer in the documentation and/or other materials provided 16 * with the distribution. 17 * 18 * * Neither the name of Cavium Networks nor the names of 19 * its contributors may be used to endorse or promote products 20 * derived from this software without specific prior written 21 * permission. 22 * 23 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 24 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS 25 * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH 26 * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY 27 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT 28 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES 29 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR 30 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET 31 * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT 32 * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 33 * 34 * 35 * For any questions regarding licensing please contact marketing@caviumnetworks.com 36 * 37 ***********************license end**************************************/ 38 39 40 41 42 43/** 44 * @file 45 * Header file for simple executive application initialization. This defines 46 * part of the ABI between the bootloader and the application. 47 * <hr>$Revision: 41586 $<hr> 48 * 49 */ 50 51#ifndef __CVMX_APP_INIT_H__ 52#define __CVMX_APP_INIT_H__ 53 54#ifdef __cplusplus 55extern "C" { 56#endif 57 58 59/* Current major and minor versions of the CVMX bootinfo block that is passed 60** from the bootloader to the application. This is versioned so that applications 61** can properly handle multiple bootloader versions. */ 62#define CVMX_BOOTINFO_MAJ_VER 1 63#define CVMX_BOOTINFO_MIN_VER 2 64 65 66#if (CVMX_BOOTINFO_MAJ_VER == 1) 67#define CVMX_BOOTINFO_OCTEON_SERIAL_LEN 20 68/* This structure is populated by the bootloader. For binary 69** compatibility the only changes that should be made are 70** adding members to the end of the structure, and the minor 71** version should be incremented at that time. 72** If an incompatible change is made, the major version 73** must be incremented, and the minor version should be reset 74** to 0. 75*/ 76typedef struct 77{ 78 uint32_t major_version; 79 uint32_t minor_version; 80 81 uint64_t stack_top; 82 uint64_t heap_base; 83 uint64_t heap_end; 84 uint64_t desc_vaddr; 85 86 uint32_t exception_base_addr; 87 uint32_t stack_size; 88 uint32_t flags; 89 uint32_t core_mask; 90 uint32_t dram_size; /**< DRAM size in megabytes */ 91 uint32_t phy_mem_desc_addr; /**< physical address of free memory descriptor block*/ 92 uint32_t debugger_flags_base_addr; /**< used to pass flags from app to debugger */ 93 uint32_t eclock_hz; /**< CPU clock speed, in hz */ 94 uint32_t dclock_hz; /**< DRAM clock speed, in hz */ 95 uint32_t reserved0; 96 uint16_t board_type; 97 uint8_t board_rev_major; 98 uint8_t board_rev_minor; 99 uint16_t reserved1; 100 uint8_t reserved2; 101 uint8_t reserved3; 102 char board_serial_number[CVMX_BOOTINFO_OCTEON_SERIAL_LEN]; 103 uint8_t mac_addr_base[6]; 104 uint8_t mac_addr_count; 105#if (CVMX_BOOTINFO_MIN_VER >= 1) 106 /* Several boards support compact flash on the Octeon boot bus. The CF 107 ** memory spaces may be mapped to different addresses on different boards. 108 ** These are the physical addresses, so care must be taken to use the correct 109 ** XKPHYS/KSEG0 addressing depending on the application's ABI. 110 ** These values will be 0 if CF is not present */ 111 uint64_t compact_flash_common_base_addr; 112 uint64_t compact_flash_attribute_base_addr; 113 /* Base address of the LED display (as on EBT3000 board) 114 ** This will be 0 if LED display not present. */ 115 uint64_t led_display_base_addr; 116#endif 117#if (CVMX_BOOTINFO_MIN_VER >= 2) 118 uint32_t dfa_ref_clock_hz; /**< DFA reference clock in hz (if applicable)*/ 119 uint32_t config_flags; /**< flags indicating various configuration options. These flags supercede 120 ** the 'flags' variable and should be used instead if available */ 121#endif 122 123 124} cvmx_bootinfo_t; 125 126#define CVMX_BOOTINFO_CFG_FLAG_PCI_HOST (1ull << 0) 127#define CVMX_BOOTINFO_CFG_FLAG_PCI_TARGET (1ull << 1) 128#define CVMX_BOOTINFO_CFG_FLAG_DEBUG (1ull << 2) 129#define CVMX_BOOTINFO_CFG_FLAG_NO_MAGIC (1ull << 3) 130/* This flag is set if the TLB mappings are not contained in the 131** 0x10000000 - 0x20000000 boot bus region. */ 132#define CVMX_BOOTINFO_CFG_FLAG_OVERSIZE_TLB_MAPPING (1ull << 4) 133#define CVMX_BOOTINFO_CFG_FLAG_BREAK (1ull << 5) 134 135#endif /* (CVMX_BOOTINFO_MAJ_VER == 1) */ 136 137 138/* Type defines for board and chip types */ 139enum cvmx_board_types_enum { 140 CVMX_BOARD_TYPE_NULL = 0, 141 CVMX_BOARD_TYPE_SIM = 1, 142 CVMX_BOARD_TYPE_EBT3000 = 2, 143 CVMX_BOARD_TYPE_KODAMA = 3, 144 CVMX_BOARD_TYPE_NIAGARA = 4, /* Obsolete, no longer supported */ 145 CVMX_BOARD_TYPE_NAC38 = 5, /* formerly NAO38 */ 146 CVMX_BOARD_TYPE_THUNDER = 6, 147 CVMX_BOARD_TYPE_TRANTOR = 7, /* Obsolete, no longer supported */ 148 CVMX_BOARD_TYPE_EBH3000 = 8, 149 CVMX_BOARD_TYPE_EBH3100 = 9, 150 CVMX_BOARD_TYPE_HIKARI = 10, 151 CVMX_BOARD_TYPE_CN3010_EVB_HS5 = 11, 152 CVMX_BOARD_TYPE_CN3005_EVB_HS5 = 12, 153 CVMX_BOARD_TYPE_KBP = 13, 154 CVMX_BOARD_TYPE_CN3020_EVB_HS5 = 14, /* Deprecated, CVMX_BOARD_TYPE_CN3010_EVB_HS5 supports the CN3020 */ 155 CVMX_BOARD_TYPE_EBT5800 = 15, 156 CVMX_BOARD_TYPE_NICPRO2 = 16, 157 CVMX_BOARD_TYPE_EBH5600 = 17, 158 CVMX_BOARD_TYPE_EBH5601 = 18, 159 CVMX_BOARD_TYPE_EBH5200 = 19, 160 CVMX_BOARD_TYPE_BBGW_REF = 20, 161 CVMX_BOARD_TYPE_NIC_XLE_4G = 21, 162 CVMX_BOARD_TYPE_EBT5600 = 22, 163 CVMX_BOARD_TYPE_EBH5201 = 23, 164 CVMX_BOARD_TYPE_EBT5200 = 24, 165 CVMX_BOARD_TYPE_CB5600 = 25, 166 CVMX_BOARD_TYPE_CB5601 = 26, 167 CVMX_BOARD_TYPE_CB5200 = 27, 168 CVMX_BOARD_TYPE_GENERIC = 28, /* Special 'generic' board type, supports many boards */ 169 CVMX_BOARD_TYPE_MAX, 170 171 /* The range from CVMX_BOARD_TYPE_MAX to CVMX_BOARD_TYPE_CUST_DEFINED_MIN is reserved 172 ** for future SDK use. */ 173 174 /* Set aside a range for customer boards. These numbers are managed 175 ** by Cavium. 176 */ 177 CVMX_BOARD_TYPE_CUST_DEFINED_MIN = 10000, 178 CVMX_BOARD_TYPE_CUST_WSX16 = 10001, 179 CVMX_BOARD_TYPE_CUST_NS0216 = 10002, 180 CVMX_BOARD_TYPE_CUST_NB5 = 10003, 181 CVMX_BOARD_TYPE_CUST_WMR500 = 10004, 182 CVMX_BOARD_TYPE_CUST_ITB101 = 10005, 183 CVMX_BOARD_TYPE_CUST_NTE102 = 10006, 184 CVMX_BOARD_TYPE_CUST_AGS103 = 10007, 185#if !defined(OCTEON_VENDOR_LANNER) 186 CVMX_BOARD_TYPE_CUST_GST104 = 10008, 187#else 188 CVMX_BOARD_TYPE_CUST_LANNER_MR955= 10008, 189#endif 190 CVMX_BOARD_TYPE_CUST_GCT105 = 10009, 191 CVMX_BOARD_TYPE_CUST_AGS106 = 10010, 192 CVMX_BOARD_TYPE_CUST_SGM107 = 10011, 193 CVMX_BOARD_TYPE_CUST_GCT108 = 10012, 194 CVMX_BOARD_TYPE_CUST_AGS109 = 10013, 195 CVMX_BOARD_TYPE_CUST_GCT110 = 10014, 196#if defined(OCTEON_VENDOR_LANNER) 197 CVMX_BOARD_TYPE_CUST_LANNER_MR730= 10021, 198#endif 199 CVMX_BOARD_TYPE_CUST_DEFINED_MAX = 20000, 200 201 /* Set aside a range for customer private use. The SDK won't 202 ** use any numbers in this range. */ 203 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001, 204#if defined(OCTEON_VENDOR_LANNER) 205 CVMX_BOARD_TYPE_CUST_LANNER_MR320= 20002, 206#endif 207 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000, 208 209 /* The remaining range is reserved for future use. */ 210}; 211enum cvmx_chip_types_enum { 212 CVMX_CHIP_TYPE_NULL = 0, 213 CVMX_CHIP_SIM_TYPE_DEPRECATED = 1, 214 CVMX_CHIP_TYPE_OCTEON_SAMPLE = 2, 215 CVMX_CHIP_TYPE_MAX, 216}; 217 218/* Compatability alias for NAC38 name change, planned to be removed from SDK 1.7 */ 219#define CVMX_BOARD_TYPE_NAO38 CVMX_BOARD_TYPE_NAC38 220 221/* Functions to return string based on type */ 222#define ENUM_BRD_TYPE_CASE(x) case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ 223static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum type) 224{ 225 switch (type) 226 { 227 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL) 228 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_SIM) 229 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT3000) 230 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KODAMA) 231 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIAGARA) 232 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NAC38) 233 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_THUNDER) 234 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_TRANTOR) 235 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3000) 236 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3100) 237 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_HIKARI) 238 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3010_EVB_HS5) 239 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3005_EVB_HS5) 240 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KBP) 241 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3020_EVB_HS5) 242 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5800) 243 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NICPRO2) 244 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5600) 245 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5601) 246 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5200) 247 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_BBGW_REF) 248 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_4G) 249 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5600) 250 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5201) 251 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5200) 252 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5600) 253 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5601) 254 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5200) 255 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_GENERIC) 256 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MAX) 257 258 /* Customer boards listed here */ 259 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MIN) 260 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WSX16) 261 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NS0216) 262 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NB5) 263 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WMR500) 264 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_ITB101) 265 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NTE102) 266 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS103) 267#if !defined(OCTEON_VENDOR_LANNER) 268 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GST104) 269#else 270 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR955) 271#endif 272 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT105) 273 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS106) 274 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_SGM107) 275 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT108) 276 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS109) 277 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT110) 278#if defined(OCTEON_VENDOR_LANNER) 279 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR730) 280#endif 281 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MAX) 282 283 /* Customer private range */ 284 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN) 285#if defined(OCTEON_VENDOR_LANNER) 286 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR320) 287#endif 288 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX) 289 } 290 return "Unsupported Board"; 291} 292 293#define ENUM_CHIP_TYPE_CASE(x) case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ 294static inline const char *cvmx_chip_type_to_string(enum cvmx_chip_types_enum type) 295{ 296 switch (type) 297 { 298 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_NULL) 299 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_SIM_TYPE_DEPRECATED) 300 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_OCTEON_SAMPLE) 301 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_MAX) 302 } 303 return "Unsupported Chip"; 304} 305 306 307extern int cvmx_debug_uart; 308 309 310 311#ifdef __cplusplus 312} 313#endif 314 315#endif /* __CVMX_APP_INIT_H__ */ 316