1 /***********************license start*************** 2 * Author: Cavium Networks 3 * 4 * Contact: support@caviumnetworks.com 5 * This file is part of the OCTEON SDK 6 * 7 * Copyright (c) 2003-2008 Cavium Networks 8 * 9 * This file is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License, Version 2, as 11 * published by the Free Software Foundation. 12 * 13 * This file is distributed in the hope that it will be useful, but 14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 16 * NONINFRINGEMENT. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this file; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 * or visit http://www.gnu.org/licenses/. 23 * 24 * This file may also be available under a different license from Cavium. 25 * Contact Cavium Networks for more information 26 ***********************license end**************************************/ 27 28 /* 29 * Header file containing the ABI with the bootloader. 30 */ 31 32 #ifndef __CVMX_BOOTINFO_H__ 33 #define __CVMX_BOOTINFO_H__ 34 35 /* 36 * Current major and minor versions of the CVMX bootinfo block that is 37 * passed from the bootloader to the application. This is versioned 38 * so that applications can properly handle multiple bootloader 39 * versions. 40 */ 41 #define CVMX_BOOTINFO_MAJ_VER 1 42 #define CVMX_BOOTINFO_MIN_VER 3 43 44 #if (CVMX_BOOTINFO_MAJ_VER == 1) 45 #define CVMX_BOOTINFO_OCTEON_SERIAL_LEN 20 46 /* 47 * This structure is populated by the bootloader. For binary 48 * compatibility the only changes that should be made are 49 * adding members to the end of the structure, and the minor 50 * version should be incremented at that time. 51 * If an incompatible change is made, the major version 52 * must be incremented, and the minor version should be reset 53 * to 0. 54 */ 55 struct cvmx_bootinfo { 56 uint32_t major_version; 57 uint32_t minor_version; 58 59 uint64_t stack_top; 60 uint64_t heap_base; 61 uint64_t heap_end; 62 uint64_t desc_vaddr; 63 64 uint32_t exception_base_addr; 65 uint32_t stack_size; 66 uint32_t flags; 67 uint32_t core_mask; 68 /* DRAM size in megabytes */ 69 uint32_t dram_size; 70 /* physical address of free memory descriptor block*/ 71 uint32_t phy_mem_desc_addr; 72 /* used to pass flags from app to debugger */ 73 uint32_t debugger_flags_base_addr; 74 75 /* CPU clock speed, in hz */ 76 uint32_t eclock_hz; 77 78 /* DRAM clock speed, in hz */ 79 uint32_t dclock_hz; 80 81 uint32_t reserved0; 82 uint16_t board_type; 83 uint8_t board_rev_major; 84 uint8_t board_rev_minor; 85 uint16_t reserved1; 86 uint8_t reserved2; 87 uint8_t reserved3; 88 char board_serial_number[CVMX_BOOTINFO_OCTEON_SERIAL_LEN]; 89 uint8_t mac_addr_base[6]; 90 uint8_t mac_addr_count; 91 #if (CVMX_BOOTINFO_MIN_VER >= 1) 92 /* 93 * Several boards support compact flash on the Octeon boot 94 * bus. The CF memory spaces may be mapped to different 95 * addresses on different boards. These are the physical 96 * addresses, so care must be taken to use the correct 97 * XKPHYS/KSEG0 addressing depending on the application's 98 * ABI. These values will be 0 if CF is not present. 99 */ 100 uint64_t compact_flash_common_base_addr; 101 uint64_t compact_flash_attribute_base_addr; 102 /* 103 * Base address of the LED display (as on EBT3000 board) 104 * This will be 0 if LED display not present. 105 */ 106 uint64_t led_display_base_addr; 107 #endif 108 #if (CVMX_BOOTINFO_MIN_VER >= 2) 109 /* DFA reference clock in hz (if applicable)*/ 110 uint32_t dfa_ref_clock_hz; 111 112 /* 113 * flags indicating various configuration options. These 114 * flags supercede the 'flags' variable and should be used 115 * instead if available. 116 */ 117 uint32_t config_flags; 118 #endif 119 #if (CVMX_BOOTINFO_MIN_VER >= 3) 120 /* 121 * Address of the OF Flattened Device Tree structure 122 * describing the board. 123 */ 124 uint64_t fdt_addr; 125 #endif 126 }; 127 128 #define CVMX_BOOTINFO_CFG_FLAG_PCI_HOST (1ull << 0) 129 #define CVMX_BOOTINFO_CFG_FLAG_PCI_TARGET (1ull << 1) 130 #define CVMX_BOOTINFO_CFG_FLAG_DEBUG (1ull << 2) 131 #define CVMX_BOOTINFO_CFG_FLAG_NO_MAGIC (1ull << 3) 132 /* This flag is set if the TLB mappings are not contained in the 133 * 0x10000000 - 0x20000000 boot bus region. */ 134 #define CVMX_BOOTINFO_CFG_FLAG_OVERSIZE_TLB_MAPPING (1ull << 4) 135 #define CVMX_BOOTINFO_CFG_FLAG_BREAK (1ull << 5) 136 137 #endif /* (CVMX_BOOTINFO_MAJ_VER == 1) */ 138 139 /* Type defines for board and chip types */ 140 enum cvmx_board_types_enum { 141 CVMX_BOARD_TYPE_NULL = 0, 142 CVMX_BOARD_TYPE_SIM = 1, 143 CVMX_BOARD_TYPE_EBT3000 = 2, 144 CVMX_BOARD_TYPE_KODAMA = 3, 145 CVMX_BOARD_TYPE_NIAGARA = 4, 146 CVMX_BOARD_TYPE_NAC38 = 5, /* formerly NAO38 */ 147 CVMX_BOARD_TYPE_THUNDER = 6, 148 CVMX_BOARD_TYPE_TRANTOR = 7, 149 CVMX_BOARD_TYPE_EBH3000 = 8, 150 CVMX_BOARD_TYPE_EBH3100 = 9, 151 CVMX_BOARD_TYPE_HIKARI = 10, 152 CVMX_BOARD_TYPE_CN3010_EVB_HS5 = 11, 153 CVMX_BOARD_TYPE_CN3005_EVB_HS5 = 12, 154 CVMX_BOARD_TYPE_KBP = 13, 155 /* Deprecated, CVMX_BOARD_TYPE_CN3010_EVB_HS5 supports the CN3020 */ 156 CVMX_BOARD_TYPE_CN3020_EVB_HS5 = 14, 157 CVMX_BOARD_TYPE_EBT5800 = 15, 158 CVMX_BOARD_TYPE_NICPRO2 = 16, 159 CVMX_BOARD_TYPE_EBH5600 = 17, 160 CVMX_BOARD_TYPE_EBH5601 = 18, 161 CVMX_BOARD_TYPE_EBH5200 = 19, 162 CVMX_BOARD_TYPE_BBGW_REF = 20, 163 CVMX_BOARD_TYPE_NIC_XLE_4G = 21, 164 CVMX_BOARD_TYPE_EBT5600 = 22, 165 CVMX_BOARD_TYPE_EBH5201 = 23, 166 CVMX_BOARD_TYPE_EBT5200 = 24, 167 CVMX_BOARD_TYPE_CB5600 = 25, 168 CVMX_BOARD_TYPE_CB5601 = 26, 169 CVMX_BOARD_TYPE_CB5200 = 27, 170 /* Special 'generic' board type, supports many boards */ 171 CVMX_BOARD_TYPE_GENERIC = 28, 172 CVMX_BOARD_TYPE_EBH5610 = 29, 173 CVMX_BOARD_TYPE_LANAI2_A = 30, 174 CVMX_BOARD_TYPE_LANAI2_U = 31, 175 CVMX_BOARD_TYPE_EBB5600 = 32, 176 CVMX_BOARD_TYPE_EBB6300 = 33, 177 CVMX_BOARD_TYPE_NIC_XLE_10G = 34, 178 CVMX_BOARD_TYPE_LANAI2_G = 35, 179 CVMX_BOARD_TYPE_EBT5810 = 36, 180 CVMX_BOARD_TYPE_NIC10E = 37, 181 CVMX_BOARD_TYPE_EP6300C = 38, 182 CVMX_BOARD_TYPE_EBB6800 = 39, 183 CVMX_BOARD_TYPE_NIC4E = 40, 184 CVMX_BOARD_TYPE_NIC2E = 41, 185 CVMX_BOARD_TYPE_EBB6600 = 42, 186 CVMX_BOARD_TYPE_REDWING = 43, 187 CVMX_BOARD_TYPE_NIC68_4 = 44, 188 CVMX_BOARD_TYPE_NIC10E_66 = 45, 189 CVMX_BOARD_TYPE_MAX, 190 191 /* 192 * The range from CVMX_BOARD_TYPE_MAX to 193 * CVMX_BOARD_TYPE_CUST_DEFINED_MIN is reserved for future 194 * SDK use. 195 */ 196 197 /* 198 * Set aside a range for customer boards. These numbers are managed 199 * by Cavium. 200 */ 201 CVMX_BOARD_TYPE_CUST_DEFINED_MIN = 10000, 202 CVMX_BOARD_TYPE_CUST_WSX16 = 10001, 203 CVMX_BOARD_TYPE_CUST_NS0216 = 10002, 204 CVMX_BOARD_TYPE_CUST_NB5 = 10003, 205 CVMX_BOARD_TYPE_CUST_WMR500 = 10004, 206 CVMX_BOARD_TYPE_CUST_ITB101 = 10005, 207 CVMX_BOARD_TYPE_CUST_NTE102 = 10006, 208 CVMX_BOARD_TYPE_CUST_AGS103 = 10007, 209 CVMX_BOARD_TYPE_CUST_GST104 = 10008, 210 CVMX_BOARD_TYPE_CUST_GCT105 = 10009, 211 CVMX_BOARD_TYPE_CUST_AGS106 = 10010, 212 CVMX_BOARD_TYPE_CUST_SGM107 = 10011, 213 CVMX_BOARD_TYPE_CUST_GCT108 = 10012, 214 CVMX_BOARD_TYPE_CUST_AGS109 = 10013, 215 CVMX_BOARD_TYPE_CUST_GCT110 = 10014, 216 CVMX_BOARD_TYPE_CUST_L2_AIR_SENDER = 10015, 217 CVMX_BOARD_TYPE_CUST_L2_AIR_RECEIVER = 10016, 218 CVMX_BOARD_TYPE_CUST_L2_ACCTON2_TX = 10017, 219 CVMX_BOARD_TYPE_CUST_L2_ACCTON2_RX = 10018, 220 CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_TX = 10019, 221 CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_RX = 10020, 222 CVMX_BOARD_TYPE_CUST_L2_ZINWELL = 10021, 223 CVMX_BOARD_TYPE_CUST_DEFINED_MAX = 20000, 224 225 /* 226 * Set aside a range for customer private use. The SDK won't 227 * use any numbers in this range. 228 */ 229 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001, 230 CVMX_BOARD_TYPE_UBNT_E100 = 20002, 231 CVMX_BOARD_TYPE_CUST_DSR1000N = 20006, 232 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000, 233 234 /* The remaining range is reserved for future use. */ 235 }; 236 237 enum cvmx_chip_types_enum { 238 CVMX_CHIP_TYPE_NULL = 0, 239 CVMX_CHIP_SIM_TYPE_DEPRECATED = 1, 240 CVMX_CHIP_TYPE_OCTEON_SAMPLE = 2, 241 CVMX_CHIP_TYPE_MAX, 242 }; 243 244 /* Compatibility alias for NAC38 name change, planned to be removed 245 * from SDK 1.7 */ 246 #define CVMX_BOARD_TYPE_NAO38 CVMX_BOARD_TYPE_NAC38 247 248 /* Functions to return string based on type */ 249 #define ENUM_BRD_TYPE_CASE(x) \ 250 case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ 251 static inline const char *cvmx_board_type_to_string(enum 252 cvmx_board_types_enum type) 253 { 254 switch (type) { 255 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL) 256 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_SIM) 257 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT3000) 258 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KODAMA) 259 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIAGARA) 260 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NAC38) 261 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_THUNDER) 262 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_TRANTOR) 263 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3000) 264 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3100) 265 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_HIKARI) 266 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3010_EVB_HS5) 267 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3005_EVB_HS5) 268 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KBP) 269 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3020_EVB_HS5) 270 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5800) 271 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NICPRO2) 272 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5600) 273 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5601) 274 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5200) 275 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_BBGW_REF) 276 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_4G) 277 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5600) 278 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5201) 279 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5200) 280 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5600) 281 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5601) 282 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5200) 283 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_GENERIC) 284 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5610) 285 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_A) 286 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_U) 287 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB5600) 288 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB6300) 289 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_10G) 290 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_LANAI2_G) 291 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5810) 292 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC10E) 293 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EP6300C) 294 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB6800) 295 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC4E) 296 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC2E) 297 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBB6600) 298 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_REDWING) 299 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC68_4) 300 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC10E_66) 301 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MAX) 302 303 /* Customer boards listed here */ 304 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MIN) 305 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WSX16) 306 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NS0216) 307 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NB5) 308 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WMR500) 309 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_ITB101) 310 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NTE102) 311 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS103) 312 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GST104) 313 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT105) 314 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS106) 315 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_SGM107) 316 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT108) 317 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_AGS109) 318 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_GCT110) 319 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_AIR_SENDER) 320 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_AIR_RECEIVER) 321 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ACCTON2_TX) 322 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ACCTON2_RX) 323 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_TX) 324 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_WSTRNSNIC_RX) 325 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_L2_ZINWELL) 326 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MAX) 327 328 /* Customer private range */ 329 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN) 330 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100) 331 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DSR1000N) 332 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX) 333 } 334 return "Unsupported Board"; 335 } 336 337 #define ENUM_CHIP_TYPE_CASE(x) \ 338 case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ 339 static inline const char *cvmx_chip_type_to_string(enum 340 cvmx_chip_types_enum type) 341 { 342 switch (type) { 343 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_NULL) 344 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_SIM_TYPE_DEPRECATED) 345 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_OCTEON_SAMPLE) 346 ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_MAX) 347 } 348 return "Unsupported Chip"; 349 } 350 351 #endif /* __CVMX_BOOTINFO_H__ */ 352