SsdtPcieOscTemplate.asl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /** @file
  2. SSDT Pci Osc (Operating System Capabilities)
  3. Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. @par Reference(s):
  6. - PCI Firmware Specification - Revision 3.3
  7. - ACPI 6.4 specification:
  8. - s6.2.13 "_PRT (PCI Routing Table)"
  9. - s6.1.1 "_ADR (Address)"
  10. - linux kernel code
  11. **/
  12. DefinitionBlock ("SsdtPciOsc.aml", "SSDT", 2, "ARMLTD", "PCI-OSC", 1) {
  13. // This table is just a template and is never installed as a table.
  14. // Pci devices are dynamically created at runtime as:
  15. // ASL:
  16. // Device (PCIx) {
  17. // ...
  18. // }
  19. // and the _OSC method available below is appended to the PCIx device as:
  20. // ASL:
  21. // Device (PCIx) {
  22. // ...
  23. // Method (_OSC, 4 {
  24. // ...
  25. // })
  26. // }
  27. Method (_OSC, 4) {
  28. //
  29. // OS Control Handoff
  30. //
  31. Name (SUPP, Zero) // PCI _OSC Support Field value
  32. Name (CTRL, Zero) // PCI _OSC Control Field value
  33. // Create DWord-addressable fields from the Capabilities Buffer
  34. CreateDWordField (Arg3, 0, CDW1)
  35. CreateDWordField (Arg3, 4, CDW2)
  36. CreateDWordField (Arg3, 8, CDW3)
  37. // Check for proper UUID
  38. If (LEqual (Arg0,ToUUID ("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
  39. // Save Capabilities DWord2 & 3
  40. Store (CDW2, SUPP)
  41. Store (CDW3, CTRL)
  42. // Only allow native hot plug control if OS supports:
  43. // * ASPM
  44. // * Clock PM
  45. // * MSI/MSI-X
  46. If (LNotEqual (And (SUPP, 0x16), 0x16)) {
  47. And (CTRL, 0x1E, CTRL) // Mask bit 0 (and undefined bits)
  48. }
  49. // Always allow native PME, AER (no dependencies)
  50. // Never allow SHPC (no SHPC controller in this system)
  51. And (CTRL, 0x1D, CTRL)
  52. If (LNotEqual (Arg1, One)) { // Unknown revision
  53. Or (CDW1, 0x08, CDW1)
  54. }
  55. If (LNotEqual (CDW3, CTRL)) { // Capabilities bits were masked
  56. Or (CDW1, 0x10, CDW1)
  57. }
  58. // Update DWORD3 in the buffer
  59. Store (CTRL,CDW3)
  60. Return (Arg3)
  61. } Else {
  62. Or (CDW1, 4, CDW1) // Unrecognized UUID
  63. Return (Arg3)
  64. } // If
  65. } // _OSC
  66. }