Debian Codegraph @

tests/aslts/src/runtime/collections/functional/descriptor/register.asl

raw
1 /*
2 * Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 /*
29 * Resource Descriptor macros
30 *
31 * Generic Register Resource Descriptor Macro
32 */
33 Name (P436, Package (0x12)
34 {
35 ResourceTemplate ()
36 {
37 Register (SystemMemory,
38 0xF0, // Bit Width
39 0xF1, // Bit Offset
40 0xF2F3F4F5F6F7F8F9, // Address
41 ,)
42 },
43
44 ResourceTemplate ()
45 {
46 Register (SystemIO,
47 0xF0, // Bit Width
48 0xF1, // Bit Offset
49 0xF2F3F4F5F6F7F8F9, // Address
50 ,)
51 },
52
53 ResourceTemplate ()
54 {
55 Register (PCI_Config,
56 0xF0, // Bit Width
57 0xF1, // Bit Offset
58 0xF2F3F4F5F6F7F8F9, // Address
59 ,)
60 },
61
62 ResourceTemplate ()
63 {
64 Register (EmbeddedControl,
65 0xF0, // Bit Width
66 0xF1, // Bit Offset
67 0xF2F3F4F5F6F7F8F9, // Address
68 ,)
69 },
70
71 ResourceTemplate ()
72 {
73 Register (SMBus,
74 0xF0, // Bit Width
75 0xF1, // Bit Offset
76 0xF2F3F4F5F6F7F8F9, // Address
77 ,)
78 },
79
80 ResourceTemplate ()
81 {
82 Register (SystemCMOS,
83 0xF0, // Bit Width
84 0xF1, // Bit Offset
85 0xF2F3F4F5F6F7F8F9, // Address
86 ,)
87 },
88
89 ResourceTemplate ()
90 {
91 Register (PCIBARTarget,
92 0xF0, // Bit Width
93 0xF1, // Bit Offset
94 0xF2F3F4F5F6F7F8F9, // Address
95 ,)
96 },
97
98 ResourceTemplate ()
99 {
100 Register (IPMI,
101 0xF0, // Bit Width
102 0xF1, // Bit Offset
103 0xF2F3F4F5F6F7F8F9, // Address
104 ,)
105 },
106
107 ResourceTemplate ()
108 {
109 Register (GeneralPurposeIo,
110 0xF0, // Bit Width
111 0xF1, // Bit Offset
112 0xF2F3F4F5F6F7F8F9, // Address
113 ,)
114 },
115
116 ResourceTemplate ()
117 {
118 Register (GenericSerialBus,
119 0xF0, // Bit Width
120 0xF1, // Bit Offset
121 0xF2F3F4F5F6F7F8F9, // Address
122 ,)
123 },
124
125 ResourceTemplate ()
126 {
127 Register (FFixedHW,
128 0xF0, // Bit Width
129 0xF1, // Bit Offset
130 0xF2F3F4F5F6F7F8F9, // Address
131 ,)
132 },
133
134 ResourceTemplate ()
135 {
136 Register (SystemMemory,
137 0xF0, // Bit Width
138 0xF1, // Bit Offset
139 0xF2F3F4F5F6F7F8F9, // Address
140 ,)
141 },
142
143 ResourceTemplate ()
144 {
145 Register (SystemMemory,
146 0xF0, // Bit Width
147 0xF1, // Bit Offset
148 0xF2F3F4F5F6F7F8F9, // Address
149 0x01, // Access Size
150 )
151 },
152
153 ResourceTemplate ()
154 {
155 Register (SystemMemory,
156 0xF0, // Bit Width
157 0xF1, // Bit Offset
158 0xF2F3F4F5F6F7F8F9, // Address
159 0x02, // Access Size
160 )
161 },
162
163 ResourceTemplate ()
164 {
165 Register (SystemMemory,
166 0xF0, // Bit Width
167 0xF1, // Bit Offset
168 0xF2F3F4F5F6F7F8F9, // Address
169 0x03, // Access Size
170 )
171 },
172
173 ResourceTemplate ()
174 {
175 Register (SystemMemory,
176 0xF0, // Bit Width
177 0xF1, // Bit Offset
178 0xF2F3F4F5F6F7F8F9, // Address
179 0x04, // Access Size
180 )
181 },
182
183 ResourceTemplate ()
184 {
185 Register (SystemMemory,
186 0x00, // Bit Width
187 0x00, // Bit Offset
188 0x0000000000000000, // Address
189 ,)
190 },
191
192 ResourceTemplate ()
193 {
194 Register (SystemMemory,
195 0xFF, // Bit Width
196 0xFF, // Bit Offset
197 0x0000000000000000, // Address
198 ,)
199 }
200 })
201 /*
202 ACPI Specification, Revision 3.0, September 2, 2004
203 6.4.3.7 Generic Register Descriptor
204 Generic Register Descriptor layout:
205 Byte 0 Generic register descriptor Value = 10000010B (0x82) (Type = 1, Large item name = 0x2)
206 Byte 1 Length, bits[7:0] Value = 00001100B (12)
207 Byte 2 Length, bits[15:8] Value = 00000000B (0)
208 Byte 3 Address Space ID, _ASI The address space where the data structure or register exists.
209 Defined values are:
210 0x00 System Memory
211 0x01 System I/O
212 0x02 PCI Configuration Space
213 0x03 Embedded Controller
214 0x04 SMBus
215 0x7F Functional Fixed Hardware
216 Byte 4 Register Bit Width, _RBW Indicates the register width in bits.
217 Byte 5 Register Bit Offset, _RBO Indicates the offset to the start of the register in bits
218 from the Register Address.
219 Byte 6 Address Size, _ASZ Specifies access size.
220 0-Undefined (legacy reasons)
221 1-Byte access
222 2-Word access
223 3-Dword access
224 4-Qword access
225 Byte 7 Register Address, _ADR bits[7:0] Register Address
226 Byte 8 Register Address, _ADR bits[15:8]
227 Byte 9 Register Address, _ADR bits[23:16]
228 Byte 10 Register Address, _ADR bits[31:24]
229 Byte 11 Register Address, _ADR bits[39:32]
230 Byte 12 Register Address, _ADR bits[47:40]
231 Byte 13 Register Address, _ADR bits[55:48]
232 Byte 14 Register Address, _ADR bits[63:56]
233 */
234 Name (P437, Package (0x12)
235 {
236 /* Byte 3 (Address Space ID) of Register Descriptor */
237
238 ResourceTemplate ()
239 {
240 Register (SystemMemory,
241 0xF0, // Bit Width
242 0xF1, // Bit Offset
243 0xF2F3F4F5F6F7F8F9, // Address
244 ,)
245 },
246
247 ResourceTemplate ()
248 {
249 Register (SystemIO,
250 0xF0, // Bit Width
251 0xF1, // Bit Offset
252 0xF2F3F4F5F6F7F8F9, // Address
253 ,)
254 },
255
256 ResourceTemplate ()
257 {
258 Register (PCI_Config,
259 0xF0, // Bit Width
260 0xF1, // Bit Offset
261 0xF2F3F4F5F6F7F8F9, // Address
262 ,)
263 },
264
265 ResourceTemplate ()
266 {
267 Register (EmbeddedControl,
268 0xF0, // Bit Width
269 0xF1, // Bit Offset
270 0xF2F3F4F5F6F7F8F9, // Address
271 ,)
272 },
273
274 ResourceTemplate ()
275 {
276 Register (SMBus,
277 0xF0, // Bit Width
278 0xF1, // Bit Offset
279 0xF2F3F4F5F6F7F8F9, // Address
280 ,)
281 },
282
283 ResourceTemplate ()
284 {
285 Register (SystemCMOS,
286 0xF0, // Bit Width
287 0xF1, // Bit Offset
288 0xF2F3F4F5F6F7F8F9, // Address
289 ,)
290 },
291
292 ResourceTemplate ()
293 {
294 Register (PCIBARTarget,
295 0xF0, // Bit Width
296 0xF1, // Bit Offset
297 0xF2F3F4F5F6F7F8F9, // Address
298 ,)
299 },
300
301 ResourceTemplate ()
302 {
303 Register (IPMI,
304 0xF0, // Bit Width
305 0xF1, // Bit Offset
306 0xF2F3F4F5F6F7F8F9, // Address
307 ,)
308 },
309
310 ResourceTemplate ()
311 {
312 Register (GeneralPurposeIo,
313 0xF0, // Bit Width
314 0xF1, // Bit Offset
315 0xF2F3F4F5F6F7F8F9, // Address
316 ,)
317 },
318
319 ResourceTemplate ()
320 {
321 Register (GenericSerialBus,
322 0xF0, // Bit Width
323 0xF1, // Bit Offset
324 0xF2F3F4F5F6F7F8F9, // Address
325 ,)
326 },
327
328 ResourceTemplate ()
329 {
330 Register (FFixedHW,
331 0xF0, // Bit Width
332 0xF1, // Bit Offset
333 0xF2F3F4F5F6F7F8F9, // Address
334 ,)
335 },
336
337 /* Byte 6 (Address Size) of Register Descriptor */
338
339 ResourceTemplate ()
340 {
341 Register (SystemMemory,
342 0xF0, // Bit Width
343 0xF1, // Bit Offset
344 0xF2F3F4F5F6F7F8F9, // Address
345 ,)
346 },
347
348 ResourceTemplate ()
349 {
350 Register (SystemMemory,
351 0xF0, // Bit Width
352 0xF1, // Bit Offset
353 0xF2F3F4F5F6F7F8F9, // Address
354 0x01, // Access Size
355 )
356 },
357
358 ResourceTemplate ()
359 {
360 Register (SystemMemory,
361 0xF0, // Bit Width
362 0xF1, // Bit Offset
363 0xF2F3F4F5F6F7F8F9, // Address
364 0x02, // Access Size
365 )
366 },
367
368 ResourceTemplate ()
369 {
370 Register (SystemMemory,
371 0xF0, // Bit Width
372 0xF1, // Bit Offset
373 0xF2F3F4F5F6F7F8F9, // Address
374 0x03, // Access Size
375 )
376 },
377
378 ResourceTemplate ()
379 {
380 Register (SystemMemory,
381 0xF0, // Bit Width
382 0xF1, // Bit Offset
383 0xF2F3F4F5F6F7F8F9, // Address
384 0x04, // Access Size
385 )
386 },
387
388 /* Particular cases */
389
390 ResourceTemplate ()
391 {
392 Register (SystemMemory,
393 0x00, // Bit Width
394 0x00, // Bit Offset
395 0x0000000000000000, // Address
396 ,)
397 },
398
399 ResourceTemplate ()
400 {
401 Register (SystemMemory,
402 0xFF, // Bit Width
403 0xFF, // Bit Offset
404 0x0000000000000000, // Address
405 ,)
406 }
407 })
408 Method (RT19, 0, Serialized)
409 {
410 /* Emit test header, set the filename */
411
412 THDR (__METHOD__, "Register Resource Descriptor Macro", "register.asl")
413 /* The main test packages must have the same number of entries */
414
415 If ((SizeOf (P436) != SizeOf (P437)))
416 {
417 ERR (__METHOD__, 0xB3, __LINE__, 0x00, 0x00, 0x00, "Incorrect package length")
418 Return (Zero)
419 }
420
421 /* Main test case for packages above */
422
423 M330 (__METHOD__, SizeOf (P436), "p436", P436, P437)
424 /* Register macro DescriptorName is recently implemented */
425 /* Check resource descriptor tag offsets */
426 Local0 = ResourceTemplate ()
427 {
428 Register (SystemMemory,
429 0xF0, // Bit Width
430 0xF1, // Bit Offset
431 0xF2F3F4F5F6F7F8F9, // Address
432 ,)
433 Register (SystemMemory,
434 0xF0, // Bit Width
435 0xF1, // Bit Offset
436 0xF2F3F4F5F6F7F8F9, // Address
437 ,)
438 }
439 M331 (__METHOD__, 0x01, 0x18, 0x18, 0x90, 0x90, "_ASI")
440 M331 (__METHOD__, 0x02, 0x20, 0x20, 0x98, 0x98, "_RBW")
441 M331 (__METHOD__, 0x03, 0x28, 0x28, 0xA0, 0xA0, "_RBO")
442 M331 (__METHOD__, 0x04, 0x30, 0x30, 0xA8, 0xA8, "_ASZ")
443 M331 (__METHOD__, 0x05, 0x38, 0x38, 0xB0, 0xB0, "_ADR")
444 }