smbios.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. smbios.c
  5. Abstract:
  6. This module implements SMBIOS tables for the RK3288-based Veyron board.
  7. Author:
  8. Evan Green 9-Jul-2015
  9. Environment:
  10. Firmware
  11. --*/
  12. //
  13. // ------------------------------------------------------------------- Includes
  14. //
  15. #include <minoca/lib/types.h>
  16. #include <minoca/fw/smbios.h>
  17. #include "uefifw.h"
  18. #include "veyronfw.h"
  19. //
  20. // ---------------------------------------------------------------- Definitions
  21. //
  22. #define VEYRON_SMBIOS_BIOS_VENDOR "Minoca Corp"
  23. #define VEYRON_SMBIOS_SYSTEM_MANUFACTURER "ASUS"
  24. #define VEYRON_SMBIOS_SYSTEM_PRODUCT "C201"
  25. #define VEYRON_SMBIOS_SYSTEM_VERSION "1"
  26. #define VEYRON_SMBIOS_MODULE_MANUFACTURER "RockChip"
  27. #define VEYRON_SMBIOS_MODULE_PRODUCT "RK3288"
  28. #define VEYRON_SMBIOS_PROCESSOR_MANUFACTURER "ARM"
  29. #define VEYRON_SMBIOS_PROCESSOR_PART "A17"
  30. #define VEYRON_SMBIOS_PROCESSOR_EXTERNAL_CLOCK 24
  31. #define VEYRON_SMBIOS_PROCESSOR_MAX_SPEED 1800
  32. #define VEYRON_SMBIOS_PROCESSOR_CURRENT_SPEED 1800
  33. #define VEYRON_SMBIOS_PROCESSOR_CORE_COUNT 4
  34. #define VEYRON_SMBIOS_CACHE_L1_SIZE 32
  35. #define VEYRON_SMBIOS_CACHE_L2_SIZE 1024
  36. //
  37. // ------------------------------------------------------ Data Type Definitions
  38. //
  39. //
  40. // ----------------------------------------------- Internal Function Prototypes
  41. //
  42. //
  43. // -------------------------------------------------------------------- Globals
  44. //
  45. SMBIOS_BIOS_INFORMATION EfiVeyronSmbiosBiosInformation = {
  46. {
  47. SmbiosBiosInformation,
  48. sizeof(SMBIOS_BIOS_INFORMATION),
  49. 0x0100
  50. },
  51. 1,
  52. 2,
  53. 0,
  54. 3,
  55. 0,
  56. SMBIOS_BIOS_CHARACTERISTIC_UNSUPPORTED,
  57. 0,
  58. 0,
  59. 0,
  60. 0,
  61. 0
  62. };
  63. SMBIOS_SYSTEM_INFORMATION EfiVeyronSmbiosSystemInformation = {
  64. {
  65. SmbiosSystemInformation,
  66. sizeof(SMBIOS_SYSTEM_INFORMATION),
  67. 0x0101
  68. },
  69. 1,
  70. 2,
  71. 3,
  72. 4,
  73. {0},
  74. SMBIOS_SYSTEM_WAKEUP_UNKNOWN,
  75. 3,
  76. 2
  77. };
  78. SMBIOS_MODULE_INFORMATION EfiVeyronSmbiosModuleInformation = {
  79. {
  80. SmbiosModuleInformation,
  81. sizeof(SMBIOS_MODULE_INFORMATION),
  82. 0x0102
  83. },
  84. 1,
  85. 2,
  86. 0,
  87. 0,
  88. 0,
  89. SMBIOS_MODULE_MOTHERBOARD,
  90. 0,
  91. 0x0104,
  92. SMBIOS_MODULE_TYPE_MOTHERBOARD,
  93. 0
  94. };
  95. SMBIOS_ENCLOSURE EfiVeyronSmbiosEnclosure = {
  96. {
  97. SmbiosSystemEnclosure,
  98. sizeof(SMBIOS_ENCLOSURE),
  99. 0x0104
  100. },
  101. 0,
  102. SMBIOS_ENCLOSURE_TYPE_UNKNOWN,
  103. 0,
  104. 0,
  105. 0,
  106. SMBIOS_ENCLOSURE_STATE_UNKNOWN,
  107. SMBIOS_ENCLOSURE_STATE_UNKNOWN,
  108. SMBIOS_ENCLOSURE_SECURITY_STATE_UNKNOWN,
  109. 0,
  110. 0,
  111. 0,
  112. 0,
  113. 0,
  114. 0
  115. };
  116. SMBIOS_PROCESSOR_INFORMATION EfiVeyronSmbiosProcessorInformation = {
  117. {
  118. SmbiosProcessorInformation,
  119. sizeof(SMBIOS_PROCESSOR_INFORMATION),
  120. 0x0105
  121. },
  122. 0,
  123. SMBIOS_PROCESSOR_TYPE_CENTRAL_PROCESSOR,
  124. 0x2,
  125. 1,
  126. 0,
  127. 0,
  128. 0,
  129. VEYRON_SMBIOS_PROCESSOR_EXTERNAL_CLOCK,
  130. VEYRON_SMBIOS_PROCESSOR_MAX_SPEED,
  131. VEYRON_SMBIOS_PROCESSOR_CURRENT_SPEED,
  132. SMBIOS_PROCESSOR_STATUS_ENABLED,
  133. 0,
  134. 0x0106,
  135. 0x0107,
  136. 0xFFFF,
  137. 2,
  138. 0,
  139. 3,
  140. VEYRON_SMBIOS_PROCESSOR_CORE_COUNT,
  141. 0,
  142. SMBIOS_PROCESSOR_CHARACTERISTIC_UNKNOWN,
  143. 0
  144. };
  145. SMBIOS_CACHE_INFORMATION EfiVeyronSmbiosL1Cache = {
  146. {
  147. SmbiosCacheInformation,
  148. sizeof(SMBIOS_CACHE_INFORMATION),
  149. 0x0106
  150. },
  151. 0,
  152. SMBIOS_CACHE_ENABLED | SMBIOS_CACHE_WRITE_BACK,
  153. VEYRON_SMBIOS_CACHE_L1_SIZE,
  154. VEYRON_SMBIOS_CACHE_L1_SIZE,
  155. SMBIOS_CACHE_SRAM_UNKNOWN,
  156. SMBIOS_CACHE_SRAM_UNKNOWN,
  157. 0,
  158. SMBIOS_CACHE_ERROR_CORRECTION_NONE,
  159. SMBIOS_CACHE_TYPE_DATA,
  160. SMBIOS_CACHE_ASSOCIATIVITY_4_WAY_SET
  161. };
  162. SMBIOS_CACHE_INFORMATION EfiVeyronSmbiosL2Cache = {
  163. {
  164. SmbiosCacheInformation,
  165. sizeof(SMBIOS_CACHE_INFORMATION),
  166. 0x0107
  167. },
  168. 0,
  169. SMBIOS_CACHE_ENABLED | SMBIOS_CACHE_WRITE_BACK,
  170. VEYRON_SMBIOS_CACHE_L2_SIZE,
  171. VEYRON_SMBIOS_CACHE_L2_SIZE,
  172. SMBIOS_CACHE_SRAM_UNKNOWN,
  173. SMBIOS_CACHE_SRAM_UNKNOWN,
  174. 0,
  175. SMBIOS_CACHE_ERROR_CORRECTION_NONE,
  176. SMBIOS_CACHE_TYPE_DATA,
  177. SMBIOS_CACHE_ASSOCIATIVITY_16_WAY_SET
  178. };
  179. //
  180. // ------------------------------------------------------------------ Functions
  181. //
  182. EFI_STATUS
  183. EfipVeyronCreateSmbiosTables (
  184. VOID
  185. )
  186. /*++
  187. Routine Description:
  188. This routine creates the SMBIOS tables.
  189. Arguments:
  190. None.
  191. Return Value:
  192. EFI Status code.
  193. --*/
  194. {
  195. EFI_STATUS Status;
  196. EfiVeyronSmbiosBiosInformation.BiosMajorRelease = EfiVersionMajor;
  197. EfiVeyronSmbiosBiosInformation.BiosMinorRelease = EfiVersionMinor;
  198. Status = EfiSmbiosAddStructure(&EfiVeyronSmbiosBiosInformation,
  199. VEYRON_SMBIOS_BIOS_VENDOR,
  200. EfiBuildString,
  201. EfiBuildTimeString,
  202. NULL);
  203. if (EFI_ERROR(Status)) {
  204. return Status;
  205. }
  206. //
  207. // TODO: Determine if there is some sort of SoC or board serial number.
  208. //
  209. Status = EfiSmbiosAddStructure(&EfiVeyronSmbiosSystemInformation,
  210. VEYRON_SMBIOS_SYSTEM_MANUFACTURER,
  211. VEYRON_SMBIOS_SYSTEM_PRODUCT,
  212. VEYRON_SMBIOS_SYSTEM_VERSION,
  213. "",
  214. NULL);
  215. if (EFI_ERROR(Status)) {
  216. return Status;
  217. }
  218. Status = EfiSmbiosAddStructure(&EfiVeyronSmbiosModuleInformation,
  219. VEYRON_SMBIOS_MODULE_MANUFACTURER,
  220. VEYRON_SMBIOS_MODULE_PRODUCT,
  221. NULL);
  222. if (EFI_ERROR(Status)) {
  223. return Status;
  224. }
  225. Status = EfiSmbiosAddStructure(&EfiVeyronSmbiosEnclosure, NULL);
  226. if (EFI_ERROR(Status)) {
  227. return Status;
  228. }
  229. Status = EfiSmbiosAddStructure(&EfiVeyronSmbiosProcessorInformation,
  230. VEYRON_SMBIOS_PROCESSOR_MANUFACTURER,
  231. "",
  232. VEYRON_SMBIOS_PROCESSOR_PART,
  233. NULL);
  234. if (EFI_ERROR(Status)) {
  235. return Status;
  236. }
  237. Status = EfiSmbiosAddStructure(&EfiVeyronSmbiosL1Cache, NULL);
  238. if (EFI_ERROR(Status)) {
  239. return Status;
  240. }
  241. Status = EfiSmbiosAddStructure(&EfiVeyronSmbiosL2Cache, NULL);
  242. if (EFI_ERROR(Status)) {
  243. return Status;
  244. }
  245. return EFI_SUCCESS;
  246. }
  247. //
  248. // --------------------------------------------------------- Internal Functions
  249. //