1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define PCI_HOST_BRIDGE_OSC_UUID "33db4d5b-1ff7-401c-9657-7441c03dd766"
4 #define CXL_HOST_BRIDGE_OSC_UUID "68f2d50b-c469-4d8a-bd3d-941a103fd3fc"
6 #define OSC_RET_FAILURE 0x02
7 #define OSC_RET_UNRECOGNIZED_UUID 0x04
8 #define OSC_RET_UNRECOGNIZED_REV 0x08
9 #define OSC_RET_CAPABILITIES_MASKED 0x10
11 #define OSC_QUERY_SUPPORT_SET 0x01
13 #define ASL_UUID_UNHANDLED 0x00
14 #define ASL_UUID_HANDLED 0x01
19 * \_SB.POSC - OSC handler for PCIe _OSC calls
22 * 6.2.11 in https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/06_Device_Configuration/Device_Configuration.html
25 * This call negotiate with OS on fixed firmware capabilities. It doesn't support to runtime
26 * change firmware settings.
29 * Arg0 - Map to _OSC Arg0. A Buffer containing a UUID
30 * Arg1 - Map to _OSC Arg1. An Integer containing a Revision ID of the buffer format
31 * Arg2 - Map to _OSC Arg2. An Integer containing a count of entries in Arg3
32 * Arg3 - Map to _OSC Arg3. A Buffer containing a list of DWORD capabilities
33 * Arg4 - GrantedPCIeFeatures
35 * Arg6 - GrantedCxlFeatures
37 * _OSC ASL Return Value:
38 * A Buffer containing a list of capabilities
40 * Local Variables Assignment:
47 * Local6 - Record whether the UUID is handled
48 * Local7 - Backs up the input value of Arg3
51 * Name - Width Source Offset Description
52 * --------------------------------
53 * RETE - DWord Arg3 0x00 Returned errors
54 * SUPP - Dword Arg3 0x04 PCIe Features that OS supported
55 * CTRL - Dword Arg3 0x08 PCIe Features that firmware grant control to OS
56 * OTRL - Dword Local7 0x08 PCIe Features that OS requests for control
57 * SUPC - Dword Arg3 0x0C CXL Features that OS supported
58 * CTRC - Dword Arg3 0x10 CXL Features that firmware grant control to OS
59 * OTRC - Dword Local7 0x10 CXL Features that OS requests for control
62 Method (POSC, 7, NotSerialized)
69 #define GrantedPCIeFeatures Arg4
70 #define IsCxlDomain Arg5
71 #define GrantedCxlFeatures Arg6
74 CreateDWordField (OscArg3, Zero, RETE)
76 Local6 = ASL_UUID_UNHANDLED
78 If ((OscArg1 != 0x01))
80 RETE = OSC_RET_UNRECOGNIZED_REV
86 RETE = OSC_RET_FAILURE
90 If ((OscArg0 == ToUUID (PCI_HOST_BRIDGE_OSC_UUID)) ||
91 ((IsCxlDomain != 0x00) &&
92 (OscArg0 == ToUUID (CXL_HOST_BRIDGE_OSC_UUID))))
94 CreateDWordField (OscArg3, 0x04, SUPP)
95 CreateDWordField (OscArg3, 0x08, CTRL)
96 CreateDWordField (Local7, 0x08, OTRL)
98 CTRL &= GrantedPCIeFeatures
100 /* TODO: further suppress CTRL bits per SUPP caps */
104 RETE = OSC_RET_CAPABILITIES_MASKED
107 Local6 = ASL_UUID_HANDLED
110 If ((IsCxlDomain != 0x00) &&
111 (OscArg0 == ToUUID (CXL_HOST_BRIDGE_OSC_UUID)))
113 CreateDWordField (OscArg3, 0x0C, SUPC)
114 CreateDWordField (OscArg3, 0x10, CTRC)
115 CreateDWordField (Local7, 0x10, OTRC)
117 CTRC &= GrantedCxlFeatures
119 /* TODO: further suppress CTRC bits per SUPC caps */
123 RETE = OSC_RET_CAPABILITIES_MASKED
126 Local6 = ASL_UUID_HANDLED
129 If ((Local6 == ASL_UUID_UNHANDLED))
131 RETE = OSC_RET_UNRECOGNIZED_UUID