cvmx-bootinfo.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. * Header file containing the ABI with the bootloader.
  29. */
  30. #ifndef __CVMX_BOOTINFO_H__
  31. #define __CVMX_BOOTINFO_H__
  32. /*
  33. * Current major and minor versions of the CVMX bootinfo block that is
  34. * passed from the bootloader to the application. This is versioned
  35. * so that applications can properly handle multiple bootloader
  36. * versions.
  37. */
  38. #define CVMX_BOOTINFO_MAJ_VER 1
  39. #define CVMX_BOOTINFO_MIN_VER 2
  40. #if (CVMX_BOOTINFO_MAJ_VER == 1)
  41. #define CVMX_BOOTINFO_OCTEON_SERIAL_LEN 20
  42. /*
  43. * This structure is populated by the bootloader. For binary
  44. * compatibility the only changes that should be made are
  45. * adding members to the end of the structure, and the minor
  46. * version should be incremented at that time.
  47. * If an incompatible change is made, the major version
  48. * must be incremented, and the minor version should be reset
  49. * to 0.
  50. */
  51. struct cvmx_bootinfo {
  52. uint32_t major_version;
  53. uint32_t minor_version;
  54. uint64_t stack_top;
  55. uint64_t heap_base;
  56. uint64_t heap_end;
  57. uint64_t desc_vaddr;
  58. uint32_t exception_base_addr;
  59. uint32_t stack_size;
  60. uint32_t flags;
  61. uint32_t core_mask;
  62. /* DRAM size in megabytes */
  63. uint32_t dram_size;
  64. /* physical address of free memory descriptor block*/
  65. uint32_t phy_mem_desc_addr;
  66. /* used to pass flags from app to debugger */
  67. uint32_t debugger_flags_base_addr;
  68. /* CPU clock speed, in hz */
  69. uint32_t eclock_hz;
  70. /* DRAM clock speed, in hz */
  71. uint32_t dclock_hz;
  72. uint32_t reserved0;
  73. uint16_t board_type;
  74. uint8_t board_rev_major;
  75. uint8_t board_rev_minor;
  76. uint16_t reserved1;
  77. uint8_t reserved2;
  78. uint8_t reserved3;
  79. char board_serial_number[CVMX_BOOTINFO_OCTEON_SERIAL_LEN];
  80. uint8_t mac_addr_base[6];
  81. uint8_t mac_addr_count;
  82. #if (CVMX_BOOTINFO_MIN_VER >= 1)
  83. /*
  84. * Several boards support compact flash on the Octeon boot
  85. * bus. The CF memory spaces may be mapped to different
  86. * addresses on different boards. These are the physical
  87. * addresses, so care must be taken to use the correct
  88. * XKPHYS/KSEG0 addressing depending on the application's
  89. * ABI. These values will be 0 if CF is not present.
  90. */
  91. uint64_t compact_flash_common_base_addr;
  92. uint64_t compact_flash_attribute_base_addr;
  93. /*
  94. * Base address of the LED display (as on EBT3000 board)
  95. * This will be 0 if LED display not present.
  96. */
  97. uint64_t led_display_base_addr;
  98. #endif
  99. #if (CVMX_BOOTINFO_MIN_VER >= 2)
  100. /* DFA reference clock in hz (if applicable)*/
  101. uint32_t dfa_ref_clock_hz;
  102. /*
  103. * flags indicating various configuration options. These
  104. * flags supercede the 'flags' variable and should be used
  105. * instead if available.
  106. */
  107. uint32_t config_flags;
  108. #endif
  109. };
  110. #define CVMX_BOOTINFO_CFG_FLAG_PCI_HOST (1ull << 0)
  111. #define CVMX_BOOTINFO_CFG_FLAG_PCI_TARGET (1ull << 1)
  112. #define CVMX_BOOTINFO_CFG_FLAG_DEBUG (1ull << 2)
  113. #define CVMX_BOOTINFO_CFG_FLAG_NO_MAGIC (1ull << 3)
  114. /* This flag is set if the TLB mappings are not contained in the
  115. * 0x10000000 - 0x20000000 boot bus region. */
  116. #define CVMX_BOOTINFO_CFG_FLAG_OVERSIZE_TLB_MAPPING (1ull << 4)
  117. #define CVMX_BOOTINFO_CFG_FLAG_BREAK (1ull << 5)
  118. #endif /* (CVMX_BOOTINFO_MAJ_VER == 1) */
  119. /* Type defines for board and chip types */
  120. enum cvmx_board_types_enum {
  121. CVMX_BOARD_TYPE_NULL = 0,
  122. CVMX_BOARD_TYPE_SIM = 1,
  123. CVMX_BOARD_TYPE_EBT3000 = 2,
  124. CVMX_BOARD_TYPE_KODAMA = 3,
  125. CVMX_BOARD_TYPE_NIAGARA = 4,
  126. CVMX_BOARD_TYPE_NAC38 = 5, /* formerly NAO38 */
  127. CVMX_BOARD_TYPE_THUNDER = 6,
  128. CVMX_BOARD_TYPE_TRANTOR = 7,
  129. CVMX_BOARD_TYPE_EBH3000 = 8,
  130. CVMX_BOARD_TYPE_EBH3100 = 9,
  131. CVMX_BOARD_TYPE_HIKARI = 10,
  132. CVMX_BOARD_TYPE_CN3010_EVB_HS5 = 11,
  133. CVMX_BOARD_TYPE_CN3005_EVB_HS5 = 12,
  134. CVMX_BOARD_TYPE_KBP = 13,
  135. /* Deprecated, CVMX_BOARD_TYPE_CN3010_EVB_HS5 supports the CN3020 */
  136. CVMX_BOARD_TYPE_CN3020_EVB_HS5 = 14,
  137. CVMX_BOARD_TYPE_EBT5800 = 15,
  138. CVMX_BOARD_TYPE_NICPRO2 = 16,
  139. CVMX_BOARD_TYPE_EBH5600 = 17,
  140. CVMX_BOARD_TYPE_EBH5601 = 18,
  141. CVMX_BOARD_TYPE_EBH5200 = 19,
  142. CVMX_BOARD_TYPE_BBGW_REF = 20,
  143. CVMX_BOARD_TYPE_NIC_XLE_4G = 21,
  144. CVMX_BOARD_TYPE_EBT5600 = 22,
  145. CVMX_BOARD_TYPE_EBH5201 = 23,
  146. CVMX_BOARD_TYPE_EBT5200 = 24,
  147. CVMX_BOARD_TYPE_CB5600 = 25,
  148. CVMX_BOARD_TYPE_CB5601 = 26,
  149. CVMX_BOARD_TYPE_CB5200 = 27,
  150. /* Special 'generic' board type, supports many boards */
  151. CVMX_BOARD_TYPE_GENERIC = 28,
  152. CVMX_BOARD_TYPE_EBH5610 = 29,
  153. CVMX_BOARD_TYPE_MAX,
  154. /*
  155. * The range from CVMX_BOARD_TYPE_MAX to
  156. * CVMX_BOARD_TYPE_CUST_DEFINED_MIN is reserved for future
  157. * SDK use.
  158. */
  159. /*
  160. * Set aside a range for customer boards. These numbers are managed
  161. * by Cavium.
  162. */
  163. CVMX_BOARD_TYPE_CUST_DEFINED_MIN = 10000,
  164. CVMX_BOARD_TYPE_CUST_WSX16 = 10001,
  165. CVMX_BOARD_TYPE_CUST_NS0216 = 10002,
  166. CVMX_BOARD_TYPE_CUST_NB5 = 10003,
  167. CVMX_BOARD_TYPE_CUST_WMR500 = 10004,
  168. CVMX_BOARD_TYPE_CUST_DEFINED_MAX = 20000,
  169. /*
  170. * Set aside a range for customer private use. The SDK won't
  171. * use any numbers in this range.
  172. */
  173. CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
  174. CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
  175. /* The remaining range is reserved for future use. */
  176. };
  177. enum cvmx_chip_types_enum {
  178. CVMX_CHIP_TYPE_NULL = 0,
  179. CVMX_CHIP_SIM_TYPE_DEPRECATED = 1,
  180. CVMX_CHIP_TYPE_OCTEON_SAMPLE = 2,
  181. CVMX_CHIP_TYPE_MAX,
  182. };
  183. /* Compatability alias for NAC38 name change, planned to be removed
  184. * from SDK 1.7 */
  185. #define CVMX_BOARD_TYPE_NAO38 CVMX_BOARD_TYPE_NAC38
  186. /* Functions to return string based on type */
  187. #define ENUM_BRD_TYPE_CASE(x) \
  188. case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */
  189. static inline const char *cvmx_board_type_to_string(enum
  190. cvmx_board_types_enum type)
  191. {
  192. switch (type) {
  193. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NULL)
  194. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_SIM)
  195. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT3000)
  196. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KODAMA)
  197. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIAGARA)
  198. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NAC38)
  199. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_THUNDER)
  200. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_TRANTOR)
  201. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3000)
  202. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH3100)
  203. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_HIKARI)
  204. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3010_EVB_HS5)
  205. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3005_EVB_HS5)
  206. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KBP)
  207. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CN3020_EVB_HS5)
  208. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5800)
  209. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NICPRO2)
  210. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5600)
  211. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5601)
  212. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5200)
  213. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_BBGW_REF)
  214. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_NIC_XLE_4G)
  215. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5600)
  216. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5201)
  217. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBT5200)
  218. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5600)
  219. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5601)
  220. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CB5200)
  221. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_GENERIC)
  222. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_EBH5610)
  223. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_MAX)
  224. /* Customer boards listed here */
  225. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MIN)
  226. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WSX16)
  227. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NS0216)
  228. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_NB5)
  229. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_WMR500)
  230. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DEFINED_MAX)
  231. /* Customer private range */
  232. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
  233. ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
  234. }
  235. return "Unsupported Board";
  236. }
  237. #define ENUM_CHIP_TYPE_CASE(x) \
  238. case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */
  239. static inline const char *cvmx_chip_type_to_string(enum
  240. cvmx_chip_types_enum type)
  241. {
  242. switch (type) {
  243. ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_NULL)
  244. ENUM_CHIP_TYPE_CASE(CVMX_CHIP_SIM_TYPE_DEPRECATED)
  245. ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_OCTEON_SAMPLE)
  246. ENUM_CHIP_TYPE_CASE(CVMX_CHIP_TYPE_MAX)
  247. }
  248. return "Unsupported Chip";
  249. }
  250. #endif /* __CVMX_BOOTINFO_H__ */