You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

thunderxcfg.h 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. #ifndef _THUNDERXCFG_H
  2. #define _THUNDERXCFG_H
  3. /** @file
  4. *
  5. * Cavium ThunderX Board Configuration
  6. *
  7. * The definitions in this section are extracted from BSD-licensed
  8. * (but non-public) portions of ThunderPkg.
  9. *
  10. */
  11. FILE_LICENCE ( BSD2 );
  12. #include <ipxe/efi/efi.h>
  13. /******************************************************************************
  14. *
  15. * From ThunderxBoardConfig.h
  16. *
  17. ******************************************************************************
  18. *
  19. * Header file for Cavium ThunderX Board Configurations
  20. * Copyright (c) 2015, Cavium Inc.
  21. * All rights reserved.
  22. *
  23. * Redistribution and use in source and binary forms, with or without
  24. * modification, are permitted provided that the following conditions
  25. * are met:
  26. *
  27. * 1. Redistributions of source code must retain the above copyright
  28. * notice, this list of conditions and the following disclaimer.
  29. * 2. Redistributions in binary form must reproduce the above
  30. * copyright notice, this list of conditions and the following
  31. * disclaimer in the documentation and/or other materials provided
  32. * with the distribution.
  33. *
  34. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  35. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  36. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  37. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  39. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  40. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
  41. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  42. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  43. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  44. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  45. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46. * SUCH DAMAGE.
  47. *
  48. */
  49. #define MAX_NODES 2
  50. #define CLUSTER_COUNT 3
  51. #define CORE_PER_CLUSTER_COUNT 16
  52. #define CORE_COUNT (CLUSTER_COUNT*CORE_PER_CLUSTER_COUNT)
  53. #define BGX_PER_NODE_COUNT 2
  54. #define LMAC_PER_BGX_COUNT 4
  55. #define PEM_PER_NODE_COUNT 6
  56. #define LMC_PER_NODE_COUNT 4
  57. #define DIMM_PER_LMC_COUNT 2
  58. #define THUNDERX_CPU_ID(node, cluster, core) (((node) << 16) | ((cluster) << 8) | (core))
  59. //TODO: Put common type definitions in separate common include file
  60. typedef enum {
  61. BGX_MODE_SGMII, /* 1 lane, 1.250 Gbaud */
  62. BGX_MODE_XAUI, /* 4 lanes, 3.125 Gbaud */
  63. BGX_MODE_DXAUI, /* 4 lanes, 6.250 Gbaud */
  64. BGX_MODE_RXAUI, /* 2 lanes, 6.250 Gbaud */
  65. BGX_MODE_XFI, /* 1 lane, 10.3125 Gbaud */
  66. BGX_MODE_XLAUI, /* 4 lanes, 10.3125 Gbaud */
  67. BGX_MODE_10G_KR,/* 1 lane, 10.3125 Gbaud */
  68. BGX_MODE_40G_KR,/* 4 lanes, 10.3125 Gbaud */
  69. BGX_MODE_UNKNOWN
  70. } BGX_MODE_T;
  71. typedef enum {
  72. EBB8800,
  73. EBB8804,
  74. CRB_1S,
  75. CRB_2S,
  76. ASIANCAT,
  77. GBT_MT60,
  78. INVENTEC_P3E003,
  79. BOARD_MAX
  80. } BOARD_TYPE;
  81. typedef struct {
  82. BOOLEAN Enabled;
  83. UINT64 LaneToSds;
  84. UINT64 MacAddress;
  85. } LMAC_CFG;
  86. typedef struct {
  87. BOOLEAN BgxEnabled;
  88. BGX_MODE_T BgxMode;
  89. UINTN LmacCount; //Maximum number of LMAcs
  90. UINT64 BaseAddress;
  91. UINT64 LmacType;
  92. /* Bit mask of QLMs connected to this BGX */
  93. UINT64 QlmMask;
  94. UINT64 QlmFreq;
  95. BOOLEAN UseTraining;
  96. LMAC_CFG Lmacs[LMAC_PER_BGX_COUNT];
  97. } BGX_CFG;
  98. typedef struct {
  99. BOOLEAN PemUsable;
  100. } PEM_CFG;
  101. typedef struct {
  102. enum { NotPresent, Empty, Available } Status;
  103. UINT8 Type;
  104. UINT8 SubType;
  105. UINT8 Rank;
  106. UINT16 Mfg;
  107. UINTN SizeMb;
  108. UINTN Speed;
  109. CHAR8 Serial[16];
  110. CHAR8 PartNo[24];
  111. } DIMM_CFG;
  112. typedef struct {
  113. DIMM_CFG DimmCfg[DIMM_PER_LMC_COUNT];
  114. } LMC_CFG;
  115. typedef struct {
  116. BOOLEAN Core[CORE_COUNT];
  117. BGX_CFG BgxCfg[BGX_PER_NODE_COUNT];
  118. PEM_CFG PemCfg[PEM_PER_NODE_COUNT];
  119. LMC_CFG LmcCfg[LMC_PER_NODE_COUNT];
  120. UINT64 RamStart;
  121. UINT64 RamReserve;
  122. UINT64 RamSize;
  123. UINTN CPUSpeed;
  124. UINTN CPUVersion;
  125. } NODE_CFG;
  126. #define MAX_SERIAL 32
  127. #define MAX_REVISION 32
  128. typedef struct {
  129. BOARD_TYPE BoardType;
  130. CHAR8 Serial[MAX_SERIAL];
  131. CHAR8 Revision[MAX_REVISION];
  132. UINTN NumNodes;
  133. UINTN BmcBootTwsiBus;
  134. UINTN BmcBootTwsiAddr;
  135. UINTN RtcTwsiBus;
  136. UINTN RtcTwsiAddr;
  137. /* IPMI support*/
  138. UINTN BmcIpmiTwsiBus;
  139. UINTN BmcIpmiTwsiAddr;
  140. NODE_CFG Node[MAX_NODES];
  141. UINT16 CpuClusterCount;
  142. UINT16 CpuPerClusterCount;
  143. UINT16 PcieSegmentCount;
  144. UINT64 MacAddrRangeStart;
  145. UINTN DdrSpeed;
  146. UINT64 AcpiOemTableId;
  147. } BOARD_CFG;
  148. /******************************************************************************
  149. *
  150. * From ThunderConfigProtocol.h
  151. *
  152. ******************************************************************************
  153. *
  154. * Thunder board Configuration Protocol
  155. *
  156. * Copyright (c) 2015, Cavium Inc. All rights reserved.<BR>
  157. *
  158. * This program and the accompanying materials are licensed and made
  159. * available under the terms and conditions of the BSD License which
  160. * accompanies this distribution. The full text of the license may
  161. * be found at http://opensource.org/licenses/bsd-license.php
  162. *
  163. * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
  164. * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
  165. * EXPRESS OR IMPLIED.
  166. *
  167. */
  168. #define EFI_THUNDER_CONFIG_PROTOCOL_GUID \
  169. {0xb75a0608, 0x99ff, 0x11e5, {0x9b, 0xeb, 0x00, 0x14, 0xd1, 0xfa, 0x23, 0x5c}}
  170. ///
  171. /// Forward declaration
  172. ///
  173. typedef struct _EFI_THUNDER_CONFIG_PROTOCOL EFI_THUNDER_CONFIG_PROTOCOL;
  174. ///
  175. /// Function prototypes
  176. ///
  177. typedef
  178. EFI_STATUS
  179. (EFIAPI *EFI_THUNDER_CONFIG_PROTOCOL_GET_CONFIG)(
  180. IN EFI_THUNDER_CONFIG_PROTOCOL *This,
  181. OUT BOARD_CFG** cfg
  182. );
  183. ///
  184. /// Protocol structure
  185. ///
  186. struct _EFI_THUNDER_CONFIG_PROTOCOL {
  187. EFI_THUNDER_CONFIG_PROTOCOL_GET_CONFIG GetConfig;
  188. BOARD_CFG* BoardConfig;
  189. };
  190. #endif /* _THUNDERXCFG_H */