Uart.asl 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /** @file
  2. *
  3. * [DSDT] Serial devices (UART).
  4. *
  5. * Copyright (c) 2021, ARM Limited. All rights reserved.
  6. * Copyright (c) 2020, Pete Batard <pete@akeo.ie>
  7. * Copyright (c) 2018, Andrey Warkentin <andrey.warkentin@gmail.com>
  8. * Copyright (c) Microsoft Corporation. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: BSD-2-Clause-Patent
  11. *
  12. **/
  13. #include <IndustryStandard/Bcm2836.h>
  14. #include "AcpiTables.h"
  15. // PL011 based UART.
  16. Device (URT0)
  17. {
  18. Name (_HID, "BCM2837")
  19. Name (_CID, "ARMH0011")
  20. Name (_UID, 0x4)
  21. Name (_CCA, 0x0)
  22. Method (_STA)
  23. {
  24. Return (0xf)
  25. }
  26. Name (RBUF, ResourceTemplate ()
  27. {
  28. MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM)
  29. Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_PL011_UART_INTERRUPT }
  30. })
  31. Method (_CRS, 0x0, Serialized)
  32. {
  33. MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_PL011_UART_OFFSET)
  34. Return (^RBUF)
  35. }
  36. Name (CLCK, 48000000)
  37. Name (_DSD, Package ()
  38. {
  39. ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
  40. {
  41. Package (2) { "clock-frequency", CLCK },
  42. }
  43. })
  44. }
  45. //
  46. // UART Mini.
  47. //
  48. // This device is referenced in the DBG2 table, which will cause the system to
  49. // not start the driver when the debugger is enabled and to mark the device
  50. // with problem code 53 (CM_PROB_USED_BY_DEBUGGER).
  51. //
  52. Device (URTM)
  53. {
  54. Name (_HID, "BCM2836")
  55. Name (_CID, "BCM2836")
  56. Name (_UID, 0x0)
  57. Name (_CCA, 0x0)
  58. Method (_STA)
  59. {
  60. Return (0xf)
  61. }
  62. Name (RBUF, ResourceTemplate ()
  63. {
  64. MEMORY32FIXED (ReadWrite, 0, BCM2836_MINI_UART_LENGTH, RMEM)
  65. Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_MINI_UART_INTERRUPT }
  66. })
  67. Method (_CRS, 0x0, Serialized)
  68. {
  69. MEMORY32SETBASE (RBUF, RMEM, RBAS, BCM2836_MINI_UART_OFFSET)
  70. Return (^RBUF)
  71. }
  72. //
  73. // Mini Uart Clock Rate will be dynamically updated during boot
  74. // 0x4D 0x55 0x43 0x52 0xC 0x1000000 (Value must be > 16777215)
  75. //
  76. Name (MUCR, 0x1000000)
  77. Name (_DSD, Package ()
  78. {
  79. ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package ()
  80. {
  81. Package (2) { "clock-frequency", MUCR },
  82. }
  83. })
  84. }
  85. //
  86. // Multifunction serial bus device to support Bluetooth function.
  87. //
  88. Device(BTH0)
  89. {
  90. Name (_HID, "BCM2EA6")
  91. Name (_CID, "BCM2EA6")
  92. //
  93. // UART In Use will be dynamically updated during boot
  94. // 0x55 0x52 0x49 0x55 0xA 0x2 (Value must > 1)
  95. //
  96. Name (URIU, 0x2)
  97. Method (_STA)
  98. {
  99. Return (0xf)
  100. }
  101. //
  102. // Resource for URT0 (PL011)
  103. //
  104. Name (BTPL, ResourceTemplate ()
  105. {
  106. UARTSerialBus(
  107. 115200, // InitialBaudRate: in BPS
  108. , // BitsPerByte: default to 8 bits
  109. , // StopBits: Defaults to one bit
  110. 0x00, // LinesInUse: 8 1-bit flags to
  111. // declare enabled control lines.
  112. // Raspberry Pi does not exposed
  113. // HW control signals -> not supported.
  114. // Optional bits:
  115. // - Bit 7 (0x80) Request To Send (RTS)
  116. // - Bit 6 (0x40) Clear To Send (CTS)
  117. // - Bit 5 (0x20) Data Terminal Ready (DTR)
  118. // - Bit 4 (0x10) Data Set Ready (DSR)
  119. // - Bit 3 (0x08) Ring Indicator (RI)
  120. // - Bit 2 (0x04) Data Carrier Detect (DTD)
  121. // - Bit 1 (0x02) Reserved. Must be 0.
  122. // - Bit 0 (0x01) Reserved. Must be 0.
  123. , // IsBigEndian:
  124. // default to LittleEndian.
  125. , // Parity: Defaults to no parity
  126. , // FlowControl: Defaults to
  127. // no flow control.
  128. 16, // ReceiveBufferSize
  129. 16, // TransmitBufferSize
  130. "\\_SB.GDV0.URT0", // ResourceSource:
  131. // UART bus controller name
  132. , // ResourceSourceIndex: assumed to be 0
  133. , // ResourceUsage: assumed to be
  134. // ResourceConsumer
  135. UAR0, // DescriptorName: creates name
  136. // for offset of resource descriptor
  137. ) // Vendor data
  138. })
  139. //
  140. // Resource for URTM (miniUART)
  141. //
  142. Name (BTMN, ResourceTemplate ()
  143. {
  144. //
  145. // BT UART: ResourceSource will be dynamically updated to
  146. // either URT0 (PL011) or URTM (miniUART) during boot
  147. //
  148. UARTSerialBus(
  149. 115200, // InitialBaudRate: in BPS
  150. , // BitsPerByte: default to 8 bits
  151. , // StopBits: Defaults to one bit
  152. 0x00, // LinesInUse: 8 1-bit flags to
  153. // declare enabled control lines.
  154. // Raspberry Pi does not exposed
  155. // HW control signals -> not supported.
  156. // Optional bits:
  157. // - Bit 7 (0x80) Request To Send (RTS)
  158. // - Bit 6 (0x40) Clear To Send (CTS)
  159. // - Bit 5 (0x20) Data Terminal Ready (DTR)
  160. // - Bit 4 (0x10) Data Set Ready (DSR)
  161. // - Bit 3 (0x08) Ring Indicator (RI)
  162. // - Bit 2 (0x04) Data Carrier Detect (DTD)
  163. // - Bit 1 (0x02) Reserved. Must be 0.
  164. // - Bit 0 (0x01) Reserved. Must be 0.
  165. , // IsBigEndian:
  166. // default to LittleEndian.
  167. , // Parity: Defaults to no parity
  168. , // FlowControl: Defaults to
  169. // no flow control.
  170. 16, // ReceiveBufferSize
  171. 16, // TransmitBufferSize
  172. "\\_SB.GDV0.URTM", // ResourceSource:
  173. // UART bus controller name
  174. , // ResourceSourceIndex: assumed to be 0
  175. , // ResourceUsage: assumed to be
  176. // ResourceConsumer
  177. UARM, // DescriptorName: creates name
  178. // for offset of resource descriptor
  179. ) // Vendor data
  180. })
  181. Method (_CRS, 0x0, Serialized)
  182. {
  183. if (URIU == 0)
  184. {
  185. //
  186. // PL011 UART is configured for console output
  187. // Return Mini UART for Bluetooth
  188. //
  189. return (^BTMN)
  190. }
  191. else
  192. {
  193. //
  194. // Mini UART is configured for console output
  195. // Return PL011 UART for Bluetooth
  196. //
  197. return (^BTPL)
  198. }
  199. }
  200. }