BoardFeatureD06.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. /** @file
  2. *
  3. * Copyright (c) 2018, Hisilicon Limited. All rights reserved.
  4. * Copyright (c) 2018, Linaro Limited. All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-2-Clause-Patent
  7. *
  8. **/
  9. #include <Uefi.h>
  10. #include <IndustryStandard/SmBios.h>
  11. #include <Library/BaseMemoryLib.h>
  12. #include <Library/DebugLib.h>
  13. #include <Library/HiiLib.h>
  14. #include <Library/I2CLib.h>
  15. #include <Library/IoLib.h>
  16. #include <Library/OemMiscLib.h>
  17. #include <Protocol/Smbios.h>
  18. #include <PlatformArch.h>
  19. I2C_DEVICE gRtcDevice = {
  20. .Socket = 0,
  21. .Port = 5,
  22. .DeviceType = DEVICE_TYPE_SPD,
  23. .SlaveDeviceAddress = 0x68
  24. };
  25. SERDES_POLARITY_INVERT gSerdesPolarityTxDesc[] =
  26. {
  27. {SERDES_INVALID_MACRO_ID, SERDES_INVALID_LANE_NUM}
  28. };
  29. SERDES_POLARITY_INVERT gSerdesPolarityRxDesc[] =
  30. {
  31. {SERDES_INVALID_MACRO_ID, SERDES_INVALID_LANE_NUM}
  32. };
  33. SERDES_PARAM gSerdesParamNA = {
  34. .Hilink0Mode = EmHilink0Hccs1X8Width16,
  35. .Hilink1Mode = EmHilink1Hccs0X8Width16,
  36. .Hilink2Mode = EmHilink2Pcie2X8,
  37. .Hilink3Mode = 0x0,
  38. .Hilink4Mode = 0xF,
  39. .Hilink5Mode = EmHilink5Sas1X4,
  40. .Hilink6Mode = 0x0,
  41. .UseSsc = 0,
  42. };
  43. SERDES_PARAM gSerdesParamNB = {
  44. .Hilink0Mode = EmHilink0Pcie1X8,
  45. .Hilink1Mode = EmHilink1Pcie0X8,
  46. .Hilink2Mode = EmHilink2Sas0X8,
  47. .Hilink3Mode = 0x0,
  48. .Hilink4Mode = 0xF,
  49. .Hilink5Mode = EmHilink5Pcie2X2Pcie3X2,
  50. .Hilink6Mode = 0xF,
  51. .UseSsc = 0,
  52. };
  53. SERDES_PARAM gSerdesParamS1NA = {
  54. .Hilink0Mode = EmHilink0Hccs1X8Width16,
  55. .Hilink1Mode = EmHilink1Hccs0X8Width16,
  56. .Hilink2Mode = EmHilink2Pcie2X8,
  57. .Hilink3Mode = 0x0,
  58. .Hilink4Mode = 0xF,
  59. .Hilink5Mode = EmHilink5Sas1X4,
  60. .Hilink6Mode = 0x0,
  61. .UseSsc = 0,
  62. };
  63. SERDES_PARAM gSerdesParamS1NB = {
  64. .Hilink0Mode = EmHilink0Pcie1X8,
  65. .Hilink1Mode = EmHilink1Pcie0X8,
  66. .Hilink2Mode = EmHilink2Sas0X8,
  67. .Hilink3Mode = 0x0,
  68. .Hilink4Mode = 0xF,
  69. .Hilink5Mode = EmHilink5Pcie2X2Pcie3X2,
  70. .Hilink6Mode = 0xF,
  71. .UseSsc = 0,
  72. };
  73. EFI_STATUS
  74. OemGetSerdesParam (
  75. OUT SERDES_PARAM *ParamA,
  76. OUT SERDES_PARAM *ParamB,
  77. IN UINT32 SocketId
  78. )
  79. {
  80. if (NULL == ParamA) {
  81. DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Param == NULL!\n", __FUNCTION__, __LINE__));
  82. return EFI_INVALID_PARAMETER;
  83. } if (NULL == ParamB) {
  84. DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Param == NULL!\n", __FUNCTION__, __LINE__));
  85. return EFI_INVALID_PARAMETER;
  86. }
  87. if (0 == SocketId) {
  88. (VOID) CopyMem (ParamA, &gSerdesParamNA, sizeof (*ParamA));
  89. (VOID) CopyMem (ParamB, &gSerdesParamNB, sizeof (*ParamB));
  90. } else {
  91. (VOID) CopyMem (ParamA, &gSerdesParamS1NA, sizeof (*ParamA));
  92. (VOID) CopyMem (ParamB, &gSerdesParamS1NB, sizeof (*ParamB));
  93. }
  94. return EFI_SUCCESS;
  95. }
  96. VOID
  97. OemPcieResetAndOffReset (
  98. VOID
  99. )
  100. {
  101. return;
  102. }
  103. SMBIOS_TABLE_TYPE9 gPcieSlotInfo[] = {
  104. // PCIe0 Slot 1
  105. {
  106. { // Hdr
  107. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  108. 0, // Length,
  109. 0 // Handle
  110. },
  111. 1, // SlotDesignation
  112. SlotTypePciExpressX16, // SlotType
  113. SlotDataBusWidth16X, // SlotDataBusWidth
  114. SlotUsageAvailable, // SlotUsage
  115. SlotLengthOther, // SlotLength
  116. 0x0001, // SlotId
  117. { // SlotCharacteristics1
  118. 0, // CharacteristicsUnknown :1;
  119. 0, // Provides50Volts :1;
  120. 0, // Provides33Volts :1;
  121. 0, // SharedSlot :1;
  122. 0, // PcCard16Supported :1;
  123. 0, // CardBusSupported :1;
  124. 0, // ZoomVideoSupported :1;
  125. 0 // ModemRingResumeSupported:1;
  126. },
  127. { // SlotCharacteristics2
  128. 0, // PmeSignalSupported :1;
  129. 0, // HotPlugDevicesSupported :1;
  130. 0, // SmbusSignalSupported :1;
  131. 0 // Reserved :5;
  132. },
  133. 0x00, // SegmentGroupNum
  134. 0x00, // BusNum
  135. 0 // DevFuncNum
  136. },
  137. {
  138. { // Hdr
  139. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  140. 0, // Length,
  141. 0 // Handle
  142. },
  143. 1, // SlotDesignation
  144. SlotTypePciExpressX8, // SlotType
  145. SlotDataBusWidth8X, // SlotDataBusWidth
  146. SlotUsageAvailable, // SlotUsage
  147. SlotLengthOther, // SlotLength
  148. 0x0002, // SlotId
  149. { // SlotCharacteristics1
  150. 0, // CharacteristicsUnknown :1;
  151. 0, // Provides50Volts :1;
  152. 0, // Provides33Volts :1;
  153. 0, // SharedSlot :1;
  154. 0, // PcCard16Supported :1;
  155. 0, // CardBusSupported :1;
  156. 0, // ZoomVideoSupported :1;
  157. 0 // ModemRingResumeSupported:1;
  158. },
  159. { // SlotCharacteristics2
  160. 0, // PmeSignalSupported :1;
  161. 0, // HotPlugDevicesSupported :1;
  162. 0, // SmbusSignalSupported :1;
  163. 0 // Reserved :5;
  164. },
  165. 0x00, // SegmentGroupNum
  166. 0x00, // BusNum
  167. 0 // DevFuncNum
  168. },
  169. {
  170. { // Hdr
  171. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  172. 0, // Length,
  173. 0 // Handle
  174. },
  175. 1, // SlotDesignation
  176. SlotTypePciExpressX8, // SlotType
  177. SlotDataBusWidth8X, // SlotDataBusWidth
  178. SlotUsageAvailable, // SlotUsage
  179. SlotLengthOther, // SlotLength
  180. 0x0003, // SlotId
  181. { // SlotCharacteristics1
  182. 0, // CharacteristicsUnknown :1;
  183. 0, // Provides50Volts :1;
  184. 0, // Provides33Volts :1;
  185. 0, // SharedSlot :1;
  186. 0, // PcCard16Supported :1;
  187. 0, // CardBusSupported :1;
  188. 0, // ZoomVideoSupported :1;
  189. 0 // ModemRingResumeSupported:1;
  190. },
  191. { // SlotCharacteristics2
  192. 0, // PmeSignalSupported :1;
  193. 0, // HotPlugDevicesSupported :1;
  194. 0, // SmbusSignalSupported :1;
  195. 0 // Reserved :5;
  196. },
  197. 0x00, // SegmentGroupNum
  198. 0x00, // BusNum
  199. 0 // DevFuncNum
  200. },
  201. {
  202. { // Hdr
  203. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  204. 0, // Length,
  205. 0 // Handle
  206. },
  207. 1, // SlotDesignation
  208. SlotTypePciExpressX8, // SlotType
  209. SlotDataBusWidth8X, // SlotDataBusWidth
  210. SlotUsageAvailable, // SlotUsage
  211. SlotLengthOther, // SlotLength
  212. 0x0004, // SlotId
  213. { // SlotCharacteristics1
  214. 0, // CharacteristicsUnknown :1;
  215. 0, // Provides50Volts :1;
  216. 0, // Provides33Volts :1;
  217. 0, // SharedSlot :1;
  218. 0, // PcCard16Supported :1;
  219. 0, // CardBusSupported :1;
  220. 0, // ZoomVideoSupported :1;
  221. 0 // ModemRingResumeSupported:1;
  222. },
  223. { // SlotCharacteristics2
  224. 0, // PmeSignalSupported :1;
  225. 0, // HotPlugDevicesSupported :1;
  226. 0, // SmbusSignalSupported :1;
  227. 0 // Reserved :5;
  228. },
  229. 0x00, // SegmentGroupNum
  230. 0x00, // BusNum
  231. 0 // DevFuncNum
  232. },
  233. {
  234. { // Hdr
  235. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  236. 0, // Length,
  237. 0 // Handle
  238. },
  239. 1, // SlotDesignation
  240. SlotTypePciExpressX16, // SlotType
  241. SlotDataBusWidth16X, // SlotDataBusWidth
  242. SlotUsageAvailable, // SlotUsage
  243. SlotLengthOther, // SlotLength
  244. 0x0005, // SlotId
  245. { // SlotCharacteristics1
  246. 0, // CharacteristicsUnknown :1;
  247. 0, // Provides50Volts :1;
  248. 0, // Provides33Volts :1;
  249. 0, // SharedSlot :1;
  250. 0, // PcCard16Supported :1;
  251. 0, // CardBusSupported :1;
  252. 0, // ZoomVideoSupported :1;
  253. 0 // ModemRingResumeSupported:1;
  254. },
  255. { // SlotCharacteristics2
  256. 0, // PmeSignalSupported :1;
  257. 0, // HotPlugDevicesSupported :1;
  258. 0, // SmbusSignalSupported :1;
  259. 0 // Reserved :5;
  260. },
  261. 0x00, // SegmentGroupNum
  262. 0x00, // BusNum
  263. 0 // DevFuncNum
  264. },
  265. {
  266. { // Hdr
  267. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  268. 0, // Length,
  269. 0 // Handle
  270. },
  271. 1, // SlotDesignation
  272. SlotTypePciExpressX8, // SlotType
  273. SlotDataBusWidth8X, // SlotDataBusWidth
  274. SlotUsageAvailable, // SlotUsage
  275. SlotLengthOther, // SlotLength
  276. 0x0006, // SlotId
  277. { // SlotCharacteristics1
  278. 0, // CharacteristicsUnknown :1;
  279. 0, // Provides50Volts :1;
  280. 0, // Provides33Volts :1;
  281. 0, // SharedSlot :1;
  282. 0, // PcCard16Supported :1;
  283. 0, // CardBusSupported :1;
  284. 0, // ZoomVideoSupported :1;
  285. 0 // ModemRingResumeSupported:1;
  286. },
  287. { // SlotCharacteristics2
  288. 0, // PmeSignalSupported :1;
  289. 0, // HotPlugDevicesSupported :1;
  290. 0, // SmbusSignalSupported :1;
  291. 0 // Reserved :5;
  292. },
  293. 0x00, // SegmentGroupNum
  294. 0x00, // BusNum
  295. 0 // DevFuncNum
  296. },
  297. {
  298. { // Hdr
  299. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  300. 0, // Length,
  301. 0 // Handle
  302. },
  303. 1, // SlotDesignation
  304. SlotTypePciExpressX8, // SlotType
  305. SlotDataBusWidth8X, // SlotDataBusWidth
  306. SlotUsageAvailable, // SlotUsage
  307. SlotLengthOther, // SlotLength
  308. 0x0007, // SlotId
  309. { // SlotCharacteristics1
  310. 0, // CharacteristicsUnknown :1;
  311. 0, // Provides50Volts :1;
  312. 0, // Provides33Volts :1;
  313. 0, // SharedSlot :1;
  314. 0, // PcCard16Supported :1;
  315. 0, // CardBusSupported :1;
  316. 0, // ZoomVideoSupported :1;
  317. 0 // ModemRingResumeSupported:1;
  318. },
  319. { // SlotCharacteristics2
  320. 0, // PmeSignalSupported :1;
  321. 0, // HotPlugDevicesSupported :1;
  322. 0, // SmbusSignalSupported :1;
  323. 0 // Reserved :5;
  324. },
  325. 0x00, // SegmentGroupNum
  326. 0x00, // BusNum
  327. 0 // DevFuncNum
  328. },
  329. {
  330. { // Hdr
  331. EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // Type,
  332. 0, // Length,
  333. 0 // Handle
  334. },
  335. 1, // SlotDesignation
  336. SlotTypePciExpressX8, // SlotType
  337. SlotDataBusWidth8X, // SlotDataBusWidth
  338. SlotUsageAvailable, // SlotUsage
  339. SlotLengthOther, // SlotLength
  340. 0x0008, // SlotId
  341. { // SlotCharacteristics1
  342. 0, // CharacteristicsUnknown :1;
  343. 0, // Provides50Volts :1;
  344. 0, // Provides33Volts :1;
  345. 0, // SharedSlot :1;
  346. 0, // PcCard16Supported :1;
  347. 0, // CardBusSupported :1;
  348. 0, // ZoomVideoSupported :1;
  349. 0 // ModemRingResumeSupported:1;
  350. },
  351. { // SlotCharacteristics2
  352. 0, // PmeSignalSupported :1;
  353. 0, // HotPlugDevicesSupported :1;
  354. 0, // SmbusSignalSupported :1;
  355. 0 // Reserved :5;
  356. },
  357. 0x00, // SegmentGroupNum
  358. 0x00, // BusNum
  359. 0 // DevFuncNum
  360. },
  361. };
  362. UINT8
  363. OemGetPcieSlotNumber (
  364. VOID
  365. )
  366. {
  367. return sizeof (gPcieSlotInfo) / sizeof (SMBIOS_TABLE_TYPE9);
  368. }
  369. EFI_STRING_ID gDimmToDevLocator[MAX_SOCKET][MAX_CHANNEL][MAX_DIMM] = {
  370. {{STRING_TOKEN(STR_LEMON_C10_DIMM_000), STRING_TOKEN(STR_LEMON_C10_DIMM_001)},
  371. {STRING_TOKEN(STR_LEMON_C10_DIMM_010), STRING_TOKEN(STR_LEMON_C10_DIMM_011)},
  372. {STRING_TOKEN(STR_LEMON_C10_DIMM_020), STRING_TOKEN(STR_LEMON_C10_DIMM_021)},
  373. {STRING_TOKEN(STR_LEMON_C10_DIMM_030), STRING_TOKEN(STR_LEMON_C10_DIMM_031)},
  374. {STRING_TOKEN(STR_LEMON_C10_DIMM_040), STRING_TOKEN(STR_LEMON_C10_DIMM_041)},
  375. {STRING_TOKEN(STR_LEMON_C10_DIMM_050), STRING_TOKEN(STR_LEMON_C10_DIMM_051)},
  376. {STRING_TOKEN(STR_LEMON_C10_DIMM_060), STRING_TOKEN(STR_LEMON_C10_DIMM_061)},
  377. {STRING_TOKEN(STR_LEMON_C10_DIMM_070), STRING_TOKEN(STR_LEMON_C10_DIMM_071)}},
  378. {{STRING_TOKEN(STR_LEMON_C10_DIMM_100), STRING_TOKEN(STR_LEMON_C10_DIMM_101)},
  379. {STRING_TOKEN(STR_LEMON_C10_DIMM_110), STRING_TOKEN(STR_LEMON_C10_DIMM_111)},
  380. {STRING_TOKEN(STR_LEMON_C10_DIMM_120), STRING_TOKEN(STR_LEMON_C10_DIMM_121)},
  381. {STRING_TOKEN(STR_LEMON_C10_DIMM_130), STRING_TOKEN(STR_LEMON_C10_DIMM_131)},
  382. {STRING_TOKEN(STR_LEMON_C10_DIMM_140), STRING_TOKEN(STR_LEMON_C10_DIMM_141)},
  383. {STRING_TOKEN(STR_LEMON_C10_DIMM_150), STRING_TOKEN(STR_LEMON_C10_DIMM_151)},
  384. {STRING_TOKEN(STR_LEMON_C10_DIMM_160), STRING_TOKEN(STR_LEMON_C10_DIMM_161)},
  385. {STRING_TOKEN(STR_LEMON_C10_DIMM_170), STRING_TOKEN(STR_LEMON_C10_DIMM_171)}}
  386. };
  387. EFI_HII_HANDLE
  388. EFIAPI
  389. OemGetPackages (
  390. VOID
  391. )
  392. {
  393. return HiiAddPackages (
  394. &gEfiCallerIdGuid,
  395. NULL,
  396. OemMiscLibStrings,
  397. NULL,
  398. NULL
  399. );
  400. }