PC31.asi 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /** @file
  2. Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. Name (SUPP, 0)
  6. Name (CTRL, 0)
  7. Method(_PXM) {
  8. if (LEqual (CLOD, 0)) {
  9. Return(5)
  10. } else {
  11. Return(10)
  12. }
  13. }
  14. Method(_OSC,4) {
  15. //
  16. // Create DWord-addressable fields from the capabilities Buffer
  17. //
  18. CreateDWordField(Arg3,0,CDW1)
  19. If (LEqual(Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
  20. //
  21. // Create DWord-addressable fields from the capabilities Buffer
  22. //
  23. CreateDWordField(Arg3,4,CDW2)
  24. //
  25. // Fill 3rd capability DWORD only if the count is greater than 2.
  26. //
  27. If(LGreater(Arg2,2)) {
  28. CreateDWordField(Arg3,8,CDW3)
  29. }
  30. //
  31. // Save Capabilities DWord2 & 3
  32. //
  33. Store(CDW2,SUPP)
  34. Store(CDW3,CTRL)
  35. //
  36. // Only allow native hot plug control if OS supports
  37. // * ASPM
  38. // * MSI/MSI-X
  39. //
  40. If (LOr(AHPE, LNotEqual(And(SUPP, 0x16), 0x16))) { // Conditions not met?
  41. And(CTRL, 0x1E, CTRL) // Mask bit 0 to deny.
  42. Sleep(1000)
  43. }
  44. //
  45. // Never allow SHPC (no SHPC controller in system)
  46. //
  47. And(CTRL, 0x1D, CTRL)
  48. //
  49. // Disable Native PCIe AER handling from OS so that it uses Firmware First model in WHEA
  50. //
  51. And (CTRL, 0x17, CTRL)
  52. If (Not(And(CDW1,1))) { // Query Flag Clear?
  53. //
  54. // Disable GPEs for Features granted native control
  55. //
  56. If (And(CTRL, 0x01)) { // Native Hot plug control granted?
  57. \_SB.PC31.TR1A.OSHP ()
  58. \_SB.PC31.TR1B.OSHP ()
  59. \_SB.PC31.TR1C.OSHP ()
  60. \_SB.PC31.TR1D.OSHP ()
  61. Store (0x01, GPSH) // Clear Hotplug SCI Enable in GPE0
  62. }
  63. }
  64. If (LNotEqual(Arg1,one)) { // unknown revision
  65. Or(CDW1,0x08,CDW1)
  66. }
  67. If(LNotEqual(CDW3,CTRL)) { // capabilities bits were masked
  68. Or(CDW1,0x10,CDW1)
  69. }
  70. //
  71. // update DWORD3 in the buffer
  72. //
  73. Store(CTRL,CDW3)
  74. Return(Arg3)
  75. } Else {
  76. //
  77. // Just indicate unrecognized UUID
  78. // Leave it at that
  79. //
  80. Or (CDW1,4,CDW1)
  81. Store (0xEE, IO80)
  82. Return(Arg3)
  83. }
  84. } // End _OSC
  85. Method(_STA){
  86. // Have to account for logical offline condition which IIOx stack is still in QPI fabric, but not OS visible
  87. ShiftRight(PRBM, 5, Local1)
  88. And(Local1, 0x1, Local1)
  89. // Check if Socket is present
  90. if(LEqual(Local1, 0x1)) {
  91. // Account for Socket 5 in bitmap (8 x Socket #)
  92. ShiftRight(IIOH, 40, Local1)
  93. // Shift for IIO Stack 1
  94. ShiftRight(Local1, 1, Local1)
  95. And(Local1, 0x1, Local1)
  96. // Check if IIO Stack is present
  97. if(LEqual(Local1, 0x1)) {
  98. // IIOx stack present and logically online
  99. Return(0x0F)
  100. }
  101. }
  102. // IIOx stack logically offline
  103. Return(0x00)
  104. } // End Method STA
  105. Name(PR31, ResourceTemplate() {
  106. //RESOURCE_CHUNK1_OFF
  107. WORDBusNumber( //Bus number resource (0); the bridge produces bus numbers for its subsequent buses
  108. ResourceProducer, // bit 0 of general flags is 1
  109. MinFixed, // Range is fixed
  110. MaxFixed, // Range is fixed
  111. PosDecode, // PosDecode
  112. 0x0000, // Granularity (FIX1 - Patched by ACPI Platform Driver during POST)
  113. 0x0000, // Min (FIX1 - Patched by ACPI Platform Driver during POST)
  114. 0x0000, // Max (FIX1 - Patched by ACPI Platform Driver during POST)
  115. 0x0000, // Translation
  116. 0x0001, // Range Length = Max-Min+1 (FIX1 - Patched by ACPI Platform Driver during POST)
  117. ,
  118. ,
  119. FIX1 // DescriptorName populated so iASL outputs offset for it in a .h file
  120. )
  121. //: Off board video card not detected in device manager when it is connected to CPU
  122. //RESOURCE_CHUNK5_OFF
  123. DWORDMEMORY( // descriptor for video RAM on video card
  124. ResourceProducer, // bit 0 of general flags is 0
  125. PosDecode,
  126. MinFixed, // Range is fixed
  127. MaxFixed, // Range is Fixed
  128. Cacheable,
  129. ReadWrite,
  130. 0x00000000, // Granularity (FIX5 - Patched by ACPI Platform Driver during POST)
  131. 0x00000000, // Min (FIX5 - Patched by ACPI Platform Driver during POST)
  132. 0x00000000, // Max (FIX5 - Patched by ACPI Platform Driver during POST)
  133. 0x00000000, // Translation
  134. 0x00000000, // Range Length (FIX5 - Patched by ACPI Platform Driver during POST)
  135. ,
  136. ,
  137. FIX5 // DescriptorName populated so iASL outputs offset for it in a .h file
  138. )
  139. //RESOURCE_CHUNK2_OFF
  140. WORDIO( //Consumed-and-produced resource (all I/O above CFF)
  141. ResourceProducer, // bit 0 of general flags is 0
  142. MinFixed, // Range is fixed
  143. MaxFixed, // Range is fixed
  144. PosDecode,
  145. EntireRange,
  146. 0x0000, // Granularity (FIX2 - Patched by ACPI Platform Driver during POST)
  147. 0x0000, // Min (FIX2 - Patched by ACPI Platform Driver during POST)
  148. 0x0000, // Max (FIX2 - Patched by ACPI Platform Driver during POST)
  149. 0x0000, // Translation
  150. 0x0001, // Range Length = Max-Min+1 (FIX2 - Patched by ACPI Platform Driver during POST)
  151. ,
  152. ,
  153. FIX2 // DescriptorName populated so iASL outputs offset for it in a .h file
  154. )
  155. //Off board video card not detected in device manager when it is connected to CPU
  156. //Descriptor for IO space of the video card.
  157. WORDIO( // Consumed-and-produced resource (all I/O below CF8)
  158. ResourceProducer, // bit 0 of general flags is 0
  159. MinFixed, // Range is fixed
  160. MaxFixed, // Range is fixed
  161. PosDecode,
  162. EntireRange,
  163. 0x0000, // Granularity (FIX6 - Patched by ACPI Platform Driver during POST)
  164. 0x0000, // Min (FIX6 - Patched by ACPI Platform Driver during POST)
  165. 0x0000, // Max (FIX6 - Patched by ACPI Platform Driver during POST)
  166. 0x0000, // Translation
  167. 0x0000, // Range Length
  168. ,
  169. ,
  170. FIX6 // DescriptorName populated so iASL outputs offset for it in a .h file
  171. )
  172. //Off board video card not detected in device manager when it is connected to CPU
  173. //Descriptor for IO space of the video card.
  174. WORDIO( // Consumed-and-produced resource (all I/O below CF8)
  175. ResourceProducer, // bit 0 of general flags is 0
  176. MinFixed, // Range is fixed
  177. MaxFixed, // Range is fixed
  178. PosDecode,
  179. EntireRange,
  180. 0x0000, // Granularity (FIX7 - Patched by ACPI Platform Driver during POST)
  181. 0x0000, // Min (FIX7 - Patched by ACPI Platform Driver during POST)
  182. 0x0000, // Max (FIX7 - Patched by ACPI Platform Driver during POST)
  183. 0x0000, // Translation
  184. 0x0000, // Range Length
  185. ,
  186. ,
  187. FIX7 // DescriptorName populated so iASL outputs offset for it in a .h file
  188. )
  189. //
  190. // PCI RESOURCE_32bit
  191. //
  192. DWORDMemory( // Consumed-and-produced resource(all of memory space)
  193. ResourceProducer, // bit 0 of general flags is 0
  194. PosDecode, // positive Decode
  195. MinFixed, // Range is fixed
  196. MaxFixed, // Range is fixed
  197. NonCacheable,
  198. ReadWrite,
  199. 0x00000000, // Granularity (FIX3 - Patched by ACPI Platform Driver during POST)
  200. 0x00000000, // Min (calculated dynamically) (FIX3 - Patched by ACPI Platform Driver during POST)
  201. 0x00000000, // Max = 4GB - 1MB (fwh + fwh alias) (FIX3 - Patched by ACPI Platform Driver during POST)
  202. 0x00000000, // Translation
  203. 0x00000000, // Range Length (calculated dynamically) (FIX3 - Patched by ACPI Platform Driver during POST)
  204. ,
  205. ,
  206. FIX3 // DescriptorName populated so iASL outputs offset for it in a .h file
  207. )
  208. //
  209. // PCI RESOURCE_64bit
  210. //
  211. QWORDMemory( // Consumed-and-produced resource(all of memory space)
  212. ResourceProducer, // bit 0 of general flags is 0
  213. PosDecode, // positive Decode
  214. MinFixed, // Range is fixed
  215. MaxFixed, // Range is fixed
  216. NonCacheable,
  217. ReadWrite,
  218. 0x00000000000, // Granularity (FIX4 - Patched by ACPI Platform Driver during POST)
  219. 0x00000000000, // Min (calculated dynamically) (FIX4 - Patched by ACPI Platform Driver during POST)
  220. 0x00000000000, // Max = 4GB - 1MB (fwh + fwh alias) (FIX4 - Patched by ACPI Platform Driver during POST)
  221. 0x00000000000, // Translation
  222. 0x00000000000, // Range Length (calculated dynamically) (FIX4 - Patched by ACPI Platform Driver during POST)
  223. ,
  224. ,
  225. FIX4 // DescriptorName populated so iASL outputs offset for it in a .h file
  226. )
  227. }) // end of PR31 Buffer
  228. // Current resource template return
  229. Method(_CRS, 0x0, NotSerialized) {
  230. Return(PR31)
  231. }