HOST_BUS.ASL 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. /*++
  2. Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. Module Name:
  5. HOST_BUS.ASL
  6. Abstract:
  7. Baytrail PCI configuration space definition.
  8. ---*/
  9. Device(VLVC)
  10. {
  11. Name(_ADR, 0x00000000) // Device 0, Function 0
  12. // Define various MCH Controller PCI Configuration Space
  13. // registers which will be used to dynamically produce all
  14. // resources in the Host Bus _CRS.
  15. OperationRegion(HBUS, PCI_Config, 0x00, 0xFF)
  16. Field(HBUS, DWordAcc, NoLock, Preserve)
  17. {
  18. Offset(0xD0),
  19. SMCR, 32, // VLV Message Control Register (0xD0)
  20. Offset(0xD4),
  21. SMDR, 32, // VLV Message Data Register (0xD4)
  22. Offset(0xD8),
  23. MCRX, 32, // VLV Message Control Register Extension (0xD8)
  24. }
  25. // Define a method to read a 32-bit register on the VLV Message bus.
  26. // Arg0 = Port
  27. // Arg1 = Register
  28. //
  29. // Returns 32-bit register value
  30. Method(RMBR, 2, Serialized)
  31. {
  32. // Initiate regsiter read message on VLV Message Bus MCR
  33. Or(ShiftLeft(Arg0, 16), ShiftLeft(Arg1, 8), Local0)
  34. Or(0x100000F0, Local0, SMCR)
  35. // Read register value from Message Data Register
  36. Return(SMDR)
  37. }
  38. // Define a method to write a 32-bit register on the VLV Message bus MDR.
  39. // Arg0 = Port
  40. // Arg1 = Register
  41. // Arg2 = 32-bit value
  42. Method(WMBR, 3, Serialized)
  43. {
  44. // Write register value to Message Data Register
  45. Store(Arg2, SMDR)
  46. // Initiate register write message on VLV Message Bus
  47. Or(ShiftLeft(Arg0, 16), ShiftLeft(Arg1, 8), Local0)
  48. Or(0x110000F0, Local0, SMCR)
  49. }
  50. }
  51. //
  52. // BUS, I/O, and MMIO resources
  53. //
  54. Method(_CRS,0,Serialized)
  55. {
  56. //Update ISP0 reserved memory
  57. CreateDwordField(RES0, ^ISP0._MIN,ISMN)
  58. CreateDwordField(RES0, ^ISP0._MAX,ISMX)
  59. CreateDwordField(RES0, ^ISP0._LEN,ISLN)
  60. If (LEqual(ISPD,1))
  61. {
  62. Store (ISPA, ISMN)
  63. Add (ISMN, ISLN, ISMX)
  64. Subtract(ISMX, 1, ISMX)
  65. } Else
  66. {
  67. Store (0, ISMN)
  68. Store (0, ISMX)
  69. Store (0, ISLN)
  70. }
  71. //PCI MMIO SPACE
  72. CreateDwordField(RES0, ^PM01._MIN,M1MN)
  73. CreateDwordField(RES0, ^PM01._MAX,M1MX)
  74. CreateDwordField(RES0, ^PM01._LEN,M1LN)
  75. //Get dBMBOUND Base
  76. And(BMBD, 0xFF000000, M1MN)
  77. //Get ECBASE
  78. Store(PCIT, M1MX)
  79. Add(Subtract(M1MX, M1MN), 1, M1LN)
  80. Subtract(M1MX, 1, M1MX)
  81. // Create pointers to Gfx Stolen Memory Sizing values.
  82. CreateDwordField(RES0, ^STOM._MIN,GSMN)
  83. CreateDwordField(RES0, ^STOM._MAX,GSMX)
  84. CreateDwordField(RES0, ^STOM._LEN,GSLN)
  85. If (LNotEqual (\_SB.PCI0.GFX0.GSTM, 0xFFFFFFFF))
  86. {
  87. Store(0x00, GSMN) //Read the Stolen memory base from B0:D2:F0:R5C
  88. } else
  89. {
  90. Store(\_SB.PCI0.GFX0.GSTM, GSMN) //Read the Stolen memory base from B0:D2:F0:R5C
  91. }
  92. If (LNotEqual (\_SB.PCI0.GFX0.GUMA, 0xFFFFFFFF))
  93. {
  94. Store(0x00, GSLN) //Read the Stolen memory base from B0:D2:F0:R5C
  95. } else
  96. {
  97. ShiftLeft(\_SB.PCI0.GFX0.GUMA, 25, GSLN) //Read Stolen memory base form B0:D2:F0:R50
  98. }
  99. Add(GSMN, GSLN, GSMX) //Store the Stolen Memory Size
  100. Subtract(GSMX, 1, GSMX)
  101. Return(RES0)
  102. }
  103. Name( RES0,ResourceTemplate()
  104. {
  105. WORDBusNumber ( // Bus number resource (0); the bridge produces bus numbers for its subsequent buses
  106. ResourceProducer, // bit 0 of general flags is 1
  107. MinFixed, // Range is fixed
  108. MaxFixed, // Range is fixed
  109. PosDecode, // PosDecode
  110. 0x0000, // Granularity
  111. 0x0000, // Min
  112. 0x00FF, // Max
  113. 0x0000, // Translation
  114. 0x0100 // Range Length = Max-Min+1
  115. )
  116. IO (Decode16, 0x70, 0x77, 0x01, 0x08) //Consumed resource (0xCF8-0xCFF)
  117. IO (Decode16, 0xCF8, 0xCF8, 0x01, 0x08) //Consumed resource (0xCF8-0xCFF)
  118. WORDIO ( // Consumed-and-produced resource (all I/O below CF8)
  119. ResourceProducer, // bit 0 of general flags is 0
  120. MinFixed, // Range is fixed
  121. MaxFixed, // Range is fixed
  122. PosDecode,
  123. EntireRange,
  124. 0x0000, // Granularity
  125. 0x0000, // Min
  126. 0x006F, // Max
  127. 0x0000, // Translation
  128. 0x0070 // Range Length
  129. )
  130. WORDIO ( // Consumed-and-produced resource
  131. ResourceProducer, // bit 0 of general flags is 0
  132. MinFixed, // Range is fixed
  133. MaxFixed, // Range is fixed
  134. PosDecode,
  135. EntireRange,
  136. 0x0000, // Granularity
  137. 0x0078, // Min
  138. 0x0CF7, // Max
  139. 0x0000, // Translation
  140. 0x0C80 // Range Length
  141. )
  142. WORDIO ( // Consumed-and-produced resource (all I/O above CFF)
  143. ResourceProducer, // bit 0 of general flags is 0
  144. MinFixed, // Range is fixed
  145. MaxFixed, // Range is fixed
  146. PosDecode,
  147. EntireRange,
  148. 0x0000, // Granularity
  149. 0x0D00, // Min
  150. 0xFFFF, // Max
  151. 0x0000, // Translation
  152. 0xF300 // Range Length
  153. )
  154. DWORDMEMORY ( // Descriptor for legacy VGA video RAM
  155. ResourceProducer, // bit 0 of general flags is 0
  156. PosDecode,
  157. MinFixed, // Range is fixed
  158. MaxFixed, // Range is fixed
  159. Cacheable,
  160. ReadWrite,
  161. 0x00000000, // Granularity
  162. 0x000A0000, // Min
  163. 0x000BFFFF, // Max
  164. 0x00000000, // Translation
  165. 0x00020000 // Range Length
  166. )
  167. DWORDMEMORY ( // Descriptor for legacy OptionRom
  168. ResourceProducer, // bit 0 of general flags is 0
  169. PosDecode,
  170. MinFixed, // Range is fixed
  171. MaxFixed, // Range is fixed
  172. Cacheable,
  173. ReadWrite,
  174. 0x00000000, // Granularity
  175. 0x000C0000, // Min
  176. 0x000DFFFF, // Max
  177. 0x00000000, // Translation
  178. 0x00020000 // Range Length
  179. )
  180. DWORDMEMORY ( // Descriptor for BIOS Area
  181. ResourceProducer, // bit 0 of general flags is 0
  182. PosDecode,
  183. MinFixed, // Range is fixed
  184. MaxFixed, // Range is fixed
  185. Cacheable,
  186. ReadWrite,
  187. 0x00000000, // Granularity
  188. 0x000E0000, // Min
  189. 0x000FFFFF, // Max
  190. 0x00000000, // Translation
  191. 0x00020000 // Range Length
  192. )
  193. DWORDMEMORY ( // Descriptor for ISP0 reserved Mem
  194. ResourceProducer, // bit 0 of general flags is 0
  195. PosDecode,
  196. MinFixed, // Range is fixed
  197. MaxFixed, // Range is fixed
  198. Cacheable,
  199. ReadWrite,
  200. 0x00000000, // Granularity
  201. 0x7A000000, // Min
  202. 0x7A3FFFFF, // Max
  203. 0x00000000, // Translation
  204. 0x00400000 // Range Length
  205. ,,,
  206. ISP0
  207. )
  208. DWORDMEMORY ( // Descriptor for VGA Stolen Mem
  209. ResourceProducer, // bit 0 of general flags is 0
  210. PosDecode,
  211. MinFixed, // Range is fixed
  212. MaxFixed, // Range is fixed
  213. Cacheable,
  214. ReadWrite,
  215. 0x00000000, // Granularity
  216. 0x7C000000, // Min
  217. 0x7FFFFFFF, // Max
  218. 0x00000000, // Translation
  219. 0x04000000 // Range Length
  220. ,,,
  221. STOM
  222. )
  223. DWORDMEMORY ( // Descriptor for PCI MMIO
  224. ResourceProducer, // bit 0 of general flags is 0
  225. PosDecode,
  226. MinFixed, // Range is fixed
  227. MaxFixed, // Range is fixed
  228. Cacheable,
  229. ReadWrite,
  230. 0x00000000, // Granularity
  231. 0x80000000, // Min
  232. 0xDFFFFFFF, // Max
  233. 0x00000000, // Translation
  234. 0x60000000 // Range Length
  235. ,,,
  236. PM01
  237. )
  238. })
  239. //Name(GUID,UUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))
  240. Name(GUID,Buffer()
  241. {
  242. 0x5b, 0x4d, 0xdb, 0x33,
  243. 0xf7, 0x1f,
  244. 0x1c, 0x40,
  245. 0x96, 0x57,
  246. 0x74, 0x41, 0xc0, 0x3d, 0xd7, 0x66
  247. })
  248. Name(SUPP,0) // PCI _OSC Support Field value
  249. Name(CTRL,0) // PCI _OSC Control Field value
  250. Method(_OSC,4,Serialized)
  251. {
  252. // Check for proper UUID
  253. // Save the capabilities buffer
  254. Store(Arg3,Local0)
  255. // Create DWord-adressable fields from the Capabilties Buffer
  256. CreateDWordField(Local0,0,CDW1)
  257. CreateDWordField(Local0,4,CDW2)
  258. CreateDWordField(Local0,8,CDW3)
  259. // Check for proper UUID
  260. If(LAnd(LEqual(Arg0,GUID),NEXP))
  261. {
  262. // Save Capabilities DWord2 & 3
  263. Store(CDW2,SUPP)
  264. Store(CDW3,CTRL)
  265. If(Not(And(CDW1,1))) // Query flag clear?
  266. {
  267. // Disable GPEs for features granted native control.
  268. If(And(CTRL,0x02))
  269. {
  270. NHPG()
  271. }
  272. If(And(CTRL,0x04)) // PME control granted?
  273. {
  274. NPME()
  275. }
  276. }
  277. If(LNotEqual(Arg1,One))
  278. {
  279. // Unknown revision
  280. Or(CDW1,0x08,CDW1)
  281. }
  282. If(LNotEqual(CDW3,CTRL))
  283. {
  284. // Capabilities bits were masked
  285. Or(CDW1,0x10,CDW1)
  286. }
  287. // Update DWORD3 in the buffer
  288. And(CTRL,0xfe,CTRL)
  289. Store(CTRL,CDW3)
  290. Store(CTRL,OSCC)
  291. Return(Local0)
  292. } Else
  293. {
  294. Or(CDW1,4,CDW1) // Unrecognized UUID
  295. Return(Local0)
  296. }
  297. } // End _OSC