1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
/* SPDX-License-Identifier: GPL-2.0-only */
#define PCI_HOST_BRIDGE_OSC_UUID "33db4d5b-1ff7-401c-9657-7441c03dd766"
#define CXL_HOST_BRIDGE_OSC_UUID "68f2d50b-c469-4d8a-bd3d-941a103fd3fc"
#define OSC_RET_FAILURE 0x02
#define OSC_RET_UNRECOGNIZED_UUID 0x04
#define OSC_RET_UNRECOGNIZED_REV 0x08
#define OSC_RET_CAPABILITIES_MASKED 0x10
#define OSC_QUERY_SUPPORT_SET 0x01
#define ASL_UUID_UNHANDLED 0x00
#define ASL_UUID_HANDLED 0x01
Scope (\_SB)
{
/*
* \_SB.POSC - OSC handler for PCIe _OSC calls
*
* Reference:
* 6.2.11 in https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/06_Device_Configuration/Device_Configuration.html
*
* Note:
* This call negotiate with OS on fixed firmware capabilities. It doesn't support to runtime
* change firmware settings.
*
* Arguments: (7)
* Arg0 - Map to _OSC Arg0. A Buffer containing a UUID
* Arg1 - Map to _OSC Arg1. An Integer containing a Revision ID of the buffer format
* Arg2 - Map to _OSC Arg2. An Integer containing a count of entries in Arg3
* Arg3 - Map to _OSC Arg3. A Buffer containing a list of DWORD capabilities
* Arg4 - GrantedPCIeFeatures
* Arg5 - IsCxlDomain
* Arg6 - GrantedCxlFeatures
*
* _OSC ASL Return Value:
* A Buffer containing a list of capabilities
*
* Local Variables Assignment:
* Local0 - Not used
* Local1 - Not used
* Local2 - Not used
* Local3 - Not used
* Local4 - Not used
* Local5 - Not used
* Local6 - Record whether the UUID is handled
* Local7 - Backs up the input value of Arg3
*
* Field Definitions:
* Name - Width Source Offset Description
* --------------------------------
* RETE - DWord Arg3 0x00 Returned errors
* SUPP - Dword Arg3 0x04 PCIe Features that OS supported
* CTRL - Dword Arg3 0x08 PCIe Features that firmware grant control to OS
* OTRL - Dword Local7 0x08 PCIe Features that OS requests for control
* SUPC - Dword Arg3 0x0C CXL Features that OS supported
* CTRC - Dword Arg3 0x10 CXL Features that firmware grant control to OS
* OTRC - Dword Local7 0x10 CXL Features that OS requests for control
*/
Method (POSC, 7, NotSerialized)
{
#define OscArg0 Arg0
#define OscArg1 Arg1
#define OscArg2 Arg2
#define OscArg3 Arg3
#define GrantedPCIeFeatures Arg4
#define IsCxlDomain Arg5
#define GrantedCxlFeatures Arg6
Local7 = OscArg3
CreateDWordField (OscArg3, Zero, RETE)
RETE = 0x0
Local6 = ASL_UUID_UNHANDLED
If ((OscArg1 != 0x01))
{
RETE = OSC_RET_UNRECOGNIZED_REV
Return (OscArg3)
}
If ((OscArg2 < 0x03))
{
RETE = OSC_RET_FAILURE
Return (OscArg3)
}
If ((OscArg0 == ToUUID (PCI_HOST_BRIDGE_OSC_UUID)) ||
((IsCxlDomain != 0x00) &&
(OscArg0 == ToUUID (CXL_HOST_BRIDGE_OSC_UUID))))
{
CreateDWordField (OscArg3, 0x04, SUPP)
CreateDWordField (OscArg3, 0x08, CTRL)
CreateDWordField (Local7, 0x08, OTRL)
CTRL &= GrantedPCIeFeatures
/* TODO: further suppress CTRL bits per SUPP caps */
If ((CTRL != OTRL))
{
RETE = OSC_RET_CAPABILITIES_MASKED
}
Local6 = ASL_UUID_HANDLED
}
If ((IsCxlDomain != 0x00) &&
(OscArg0 == ToUUID (CXL_HOST_BRIDGE_OSC_UUID)))
{
CreateDWordField (OscArg3, 0x0C, SUPC)
CreateDWordField (OscArg3, 0x10, CTRC)
CreateDWordField (Local7, 0x10, OTRC)
CTRC &= GrantedCxlFeatures
/* TODO: further suppress CTRC bits per SUPC caps */
If ((CTRC != OTRC))
{
RETE = OSC_RET_CAPABILITIES_MASKED
}
Local6 = ASL_UUID_HANDLED
}
If ((Local6 == ASL_UUID_UNHANDLED))
{
RETE = OSC_RET_UNRECOGNIZED_UUID
}
Return (OscArg3)
}
}
|