cvmx-app-init.h revision 210311
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 CVMX_BOARD_TYPE_CUST_GST104 = 10008, 186 CVMX_BOARD_TYPE_CUST_GCT105 = 10009, 187 CVMX_BOARD_TYPE_CUST_AGS106 = 10010, 188 CVMX_BOARD_TYPE_CUST_SGM107 = 10011, 189 CVMX_BOARD_TYPE_CUST_GCT108 = 10012, 190 CVMX_BOARD_TYPE_CUST_AGS109 = 10013, 191 CVMX_BOARD_TYPE_CUST_GCT110 = 10014, 192 CVMX_BOARD_TYPE_CUST_DEFINED_MAX = 20000, 193 194 /* Set aside a range for customer private use. The SDK won't 195 ** use any numbers in this range. */ 196 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001, 197#if defined(OCTEON_VENDOR_LANNER) 198 CVMX_BOARD_TYPE_CUST_LANNER_MR320= 20002, 199#endif 200 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000, 201 202 /* The remaining range is reserved for future use. */ 203}; 204enum cvmx_chip_types_enum { 205 CVMX_CHIP_TYPE_NULL = 0, 206 CVMX_CHIP_SIM_TYPE_DEPRECATED = 1, 207 CVMX_CHIP_TYPE_OCTEON_SAMPLE = 2, 208 CVMX_CHIP_TYPE_MAX, 209}; 210 211/* Compatability alias for NAC38 name change, planned to be removed from SDK 1.7 */ 212#define CVMX_BOARD_TYPE_NAO38 CVMX_BOARD_TYPE_NAC38 213 214/* Functions to return string based on type */ 215#define ENUM_BRD_TYPE_CASE(x) case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ 216static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum type) 217{ 218 switch (type) 219 { 220 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL) 221 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_SIM) 222 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT3000) 223 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KODAMA) 224 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIAGARA) 225 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NAC38) 226 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_THUNDER) 227 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_TRANTOR) 228 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3000) 229 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3100) 230 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_HIKARI) 231 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3010_EVB_HS5) 232 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3005_EVB_HS5) 233 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KBP) 234 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3020_EVB_HS5) 235 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5800) 236 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NICPRO2) 237 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5600) 238 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5601) 239 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5200) 240 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_BBGW_REF) 241 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_4G) 242 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5600) 243 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5201) 244 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5200) 245 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5600) 246 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5601) 247 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5200) 248 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_GENERIC) 249 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MAX) 250 251 /* Customer boards listed here */ 252 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MIN) 253 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WSX16) 254 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NS0216) 255 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NB5) 256 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WMR500) 257 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_ITB101) 258 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NTE102) 259 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS103) 260 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GST104) 261 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT105) 262 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS106) 263 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_SGM107) 264 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT108) 265 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS109) 266 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT110) 267 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MAX) 268 269 /* Customer private range */ 270 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN) 271#if defined(OCTEON_VENDOR_LANNER) 272 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR320) 273#endif 274 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX) 275 } 276 return "Unsupported Board"; 277} 278 279#define ENUM_CHIP_TYPE_CASE(x) case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ 280static inline const char *cvmx_chip_type_to_string(enum cvmx_chip_types_enum type) 281{ 282 switch (type) 283 { 284 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_NULL) 285 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_SIM_TYPE_DEPRECATED) 286 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_OCTEON_SAMPLE) 287 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_MAX) 288 } 289 return "Unsupported Chip"; 290} 291 292 293extern int cvmx_debug_uart; 294 295 296 297#ifdef __cplusplus 298} 299#endif 300 301#endif /* __CVMX_APP_INIT_H__ */ 302