bbonefw.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /*++
  2. Copyright (c) 2014 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. bbonefw.h
  9. Abstract:
  10. This header contains definitions for the BeagleBone Black UEFI
  11. implementation.
  12. Author:
  13. Evan Green 19-Dec-2014
  14. --*/
  15. //
  16. // ------------------------------------------------------------------- Includes
  17. //
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // Define the BeagleBone RAM area.
  23. //
  24. #define BEAGLE_BONE_BLACK_RAM_START 0x80000000
  25. #define BEAGLE_BONE_BLACK_RAM_SIZE (1024 * 1024 * 512)
  26. //
  27. // Define the SYSBOOT pin connected to the boot button on the BeagleBone.
  28. //
  29. #define BEAGLE_BONE_PERIPHERAL_SYSBOOT 0x04
  30. //
  31. // ------------------------------------------------------ Data Type Definitions
  32. //
  33. //
  34. // -------------------------------------------------------------------- Globals
  35. //
  36. //
  37. // Store a boolean used for debugging that disables the watchdog timer.
  38. //
  39. extern BOOLEAN EfiDisableWatchdog;
  40. //
  41. // Store the boot device type.
  42. //
  43. UINT32 EfiBootDeviceCode;
  44. //
  45. // Define the base of the AM335 PRM Device registers.
  46. //
  47. extern VOID *EfiAm335PrmDeviceBase;
  48. //
  49. // Define the pointer to the RTC base, which will get virtualized when going
  50. // to runtime.
  51. //
  52. extern VOID *EfiAm335RtcBase;
  53. //
  54. // -------------------------------------------------------- Function Prototypes
  55. //
  56. VOID
  57. EfipBeagleBoneBlackSetLeds (
  58. UINT32 Leds
  59. );
  60. /*++
  61. Routine Description:
  62. This routine sets the LEDs to a new value.
  63. Arguments:
  64. Leds - Supplies the four bits containing whether to set the LEDs high or
  65. low.
  66. Return Value:
  67. None.
  68. --*/
  69. VOID
  70. EfipAm335InitializePowerAndClocks (
  71. VOID
  72. );
  73. /*++
  74. Routine Description:
  75. This routine initializes power and clocks for the UEFI firmware on the TI
  76. AM335x SoC.
  77. Arguments:
  78. None.
  79. Return Value:
  80. None.
  81. --*/
  82. EFI_STATUS
  83. EfipPlatformSetInterruptLineState (
  84. UINT32 LineNumber,
  85. BOOLEAN Enabled,
  86. BOOLEAN EdgeTriggered
  87. );
  88. /*++
  89. Routine Description:
  90. This routine enables or disables an interrupt line.
  91. Arguments:
  92. LineNumber - Supplies the line number to enable or disable.
  93. Enabled - Supplies a boolean indicating if the line should be enabled or
  94. disabled.
  95. EdgeTriggered - Supplies a boolean indicating if the interrupt is edge
  96. triggered (TRUE) or level triggered (FALSE).
  97. Return Value:
  98. EFI Status code.
  99. --*/
  100. EFI_STATUS
  101. EfipBeagleBoneEnumerateStorage (
  102. VOID
  103. );
  104. /*++
  105. Routine Description:
  106. This routine enumerates the SD card and eMMC on the BeagleBone.
  107. Arguments:
  108. None.
  109. Return Value:
  110. EFI status code.
  111. --*/
  112. EFI_STATUS
  113. EfipBeagleBoneBlackEnumerateVideo (
  114. VOID
  115. );
  116. /*++
  117. Routine Description:
  118. This routine enumerates the display on the BeagleBone Black.
  119. Arguments:
  120. None.
  121. Return Value:
  122. EFI status code.
  123. --*/
  124. EFI_STATUS
  125. EfipBeagleBoneEnumerateSerial (
  126. VOID
  127. );
  128. /*++
  129. Routine Description:
  130. This routine enumerates the serial port on the BeagleBone Black.
  131. Arguments:
  132. None.
  133. Return Value:
  134. EFI status code.
  135. --*/
  136. EFI_STATUS
  137. EfipEnumerateRamDisks (
  138. VOID
  139. );
  140. /*++
  141. Routine Description:
  142. This routine enumerates any RAM disks embedded in the firmware.
  143. Arguments:
  144. None.
  145. Return Value:
  146. EFI Status code.
  147. --*/
  148. EFI_STATUS
  149. EfipBeagleBoneCreateSmbiosTables (
  150. VOID
  151. );
  152. /*++
  153. Routine Description:
  154. This routine creates the SMBIOS tables.
  155. Arguments:
  156. None.
  157. Return Value:
  158. EFI Status code.
  159. --*/
  160. VOID
  161. EfipAm335I2c0Initialize (
  162. VOID
  163. );
  164. /*++
  165. Routine Description:
  166. This routine initializes the I2c bus.
  167. Arguments:
  168. None.
  169. Return Value:
  170. None.
  171. --*/
  172. VOID
  173. EfipAm335I2c0SetSlaveAddress (
  174. UINT8 SlaveAddress
  175. );
  176. /*++
  177. Routine Description:
  178. This routine sets which address on the I2C bus to talk to.
  179. Arguments:
  180. SlaveAddress - Supplies the slave address to communicate with.
  181. Return Value:
  182. None.
  183. --*/
  184. VOID
  185. EfipAm335I2c0Read (
  186. UINT32 Register,
  187. UINT32 Size,
  188. UINT8 *Data
  189. );
  190. /*++
  191. Routine Description:
  192. This routine performs a read from the I2C bus. This routine assumes the
  193. slave address has already been set.
  194. Arguments:
  195. Register - Supplies the register to read from. Supply -1 to skip
  196. transmitting a register number.
  197. Size - Supplies the number of data bytes to read.
  198. Data - Supplies a pointer where the data will be returned on success.
  199. Return Value:
  200. None.
  201. --*/
  202. VOID
  203. EfipAm335I2c0Write (
  204. UINT32 Register,
  205. UINT32 Size,
  206. UINT8 *Data
  207. );
  208. /*++
  209. Routine Description:
  210. This routine performs a write to the I2C bus. This routine assumes the
  211. slave address has already been set.
  212. Arguments:
  213. Register - Supplies the register to write to. Supply -1 to skip transmitting
  214. a register number.
  215. Size - Supplies the number of data bytes to write (not including the
  216. register byte itself).
  217. Data - Supplies a pointer to the data to write.
  218. Return Value:
  219. None.
  220. --*/
  221. VOID
  222. EfipBeagleBoneBlackInitializeRtc (
  223. VOID
  224. );
  225. /*++
  226. Routine Description:
  227. This routine fires up the RTC in the AM335x for the BeagleBone Black, if it
  228. is not already running.
  229. Arguments:
  230. None.
  231. Return Value:
  232. None.
  233. --*/
  234. EFIAPI
  235. VOID
  236. EfipAm335ResetSystem (
  237. EFI_RESET_TYPE ResetType,
  238. EFI_STATUS ResetStatus,
  239. UINTN DataSize,
  240. VOID *ResetData
  241. );
  242. /*++
  243. Routine Description:
  244. This routine resets the entire platform.
  245. Arguments:
  246. ResetType - Supplies the type of reset to perform.
  247. ResetStatus - Supplies the status code for this reset.
  248. DataSize - Supplies the size of the reset data.
  249. ResetData - Supplies an optional pointer for reset types of cold, warm, or
  250. shutdown to a null-terminated string, optionally followed by additional
  251. binary data.
  252. Return Value:
  253. None. This routine does not return.
  254. --*/
  255. EFIAPI
  256. EFI_STATUS
  257. EfipAm335GetTime (
  258. EFI_TIME *Time,
  259. EFI_TIME_CAPABILITIES *Capabilities
  260. );
  261. /*++
  262. Routine Description:
  263. This routine returns the current time and dat information, and
  264. timekeeping capabilities of the hardware platform.
  265. Arguments:
  266. Time - Supplies a pointer where the current time will be returned.
  267. Capabilities - Supplies an optional pointer where the capabilities will be
  268. returned on success.
  269. Return Value:
  270. EFI_SUCCESS on success.
  271. EFI_INVALID_PARAMETER if the time parameter was NULL.
  272. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  273. EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
  274. --*/
  275. EFIAPI
  276. EFI_STATUS
  277. EfipAm335SetTime (
  278. EFI_TIME *Time
  279. );
  280. /*++
  281. Routine Description:
  282. This routine sets the current local time and date information.
  283. Arguments:
  284. Time - Supplies a pointer to the time to set.
  285. Return Value:
  286. EFI_SUCCESS on success.
  287. EFI_INVALID_PARAMETER if a time field is out of range.
  288. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  289. EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
  290. --*/
  291. EFIAPI
  292. EFI_STATUS
  293. EfipAm335GetWakeupTime (
  294. BOOLEAN *Enabled,
  295. BOOLEAN *Pending,
  296. EFI_TIME *Time
  297. );
  298. /*++
  299. Routine Description:
  300. This routine gets the current wake alarm setting.
  301. Arguments:
  302. Enabled - Supplies a pointer that receives a boolean indicating if the
  303. alarm is currently enabled or disabled.
  304. Pending - Supplies a pointer that receives a boolean indicating if the
  305. alarm signal is pending and requires acknowledgement.
  306. Time - Supplies a pointer that receives the current wake time.
  307. Return Value:
  308. EFI_SUCCESS on success.
  309. EFI_INVALID_PARAMETER if any parameter is NULL.
  310. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  311. EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
  312. --*/
  313. EFIAPI
  314. EFI_STATUS
  315. EfipAm335SetWakeupTime (
  316. BOOLEAN Enable,
  317. EFI_TIME *Time
  318. );
  319. /*++
  320. Routine Description:
  321. This routine sets the current wake alarm setting.
  322. Arguments:
  323. Enable - Supplies a boolean enabling or disabling the wakeup timer.
  324. Time - Supplies an optional pointer to the time to set. This parameter is
  325. only optional if the enable parameter is FALSE.
  326. Return Value:
  327. EFI_SUCCESS on success.
  328. EFI_INVALID_PARAMETER if a time field is out of range.
  329. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  330. EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
  331. --*/