xref: /illumos-gate/usr/src/uts/intel/sys/acpi/acrestyp.h (revision 46b592853d0f4f11781b6b0a7533f267c6aee132)
1 /******************************************************************************
2  *
3  * Name: acrestyp.h - Defines, types, and structures for resource descriptors
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights.  You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code.  No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision.  In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change.  Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee.  Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution.  In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government.  In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115 
116 #ifndef __ACRESTYP_H__
117 #define __ACRESTYP_H__
118 
119 
120 /*
121  * Definitions for Resource Attributes
122  */
123 typedef UINT16                          ACPI_RS_LENGTH;    /* Resource Length field is fixed at 16 bits */
124 typedef UINT32                          ACPI_RSDESC_SIZE;  /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
125 
126 /*
127  * Memory Attributes
128  */
129 #define ACPI_READ_ONLY_MEMORY           (UINT8) 0x00
130 #define ACPI_READ_WRITE_MEMORY          (UINT8) 0x01
131 
132 #define ACPI_NON_CACHEABLE_MEMORY       (UINT8) 0x00
133 #define ACPI_CACHABLE_MEMORY            (UINT8) 0x01
134 #define ACPI_WRITE_COMBINING_MEMORY     (UINT8) 0x02
135 #define ACPI_PREFETCHABLE_MEMORY        (UINT8) 0x03
136 
137 /*
138  * IO Attributes
139  * The ISA IO ranges are:     n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
140  * The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
141  */
142 #define ACPI_NON_ISA_ONLY_RANGES        (UINT8) 0x01
143 #define ACPI_ISA_ONLY_RANGES            (UINT8) 0x02
144 #define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
145 
146 /* Type of translation - 1=Sparse, 0=Dense */
147 
148 #define ACPI_SPARSE_TRANSLATION         (UINT8) 0x01
149 
150 /*
151  * IO Port Descriptor Decode
152  */
153 #define ACPI_DECODE_10                  (UINT8) 0x00    /* 10-bit IO address decode */
154 #define ACPI_DECODE_16                  (UINT8) 0x01    /* 16-bit IO address decode */
155 
156 /*
157  * IRQ Attributes
158  */
159 #define ACPI_LEVEL_SENSITIVE            (UINT8) 0x00
160 #define ACPI_EDGE_SENSITIVE             (UINT8) 0x01
161 
162 #define ACPI_ACTIVE_HIGH                (UINT8) 0x00
163 #define ACPI_ACTIVE_LOW                 (UINT8) 0x01
164 
165 #define ACPI_EXCLUSIVE                  (UINT8) 0x00
166 #define ACPI_SHARED                     (UINT8) 0x01
167 
168 /*
169  * DMA Attributes
170  */
171 #define ACPI_COMPATIBILITY              (UINT8) 0x00
172 #define ACPI_TYPE_A                     (UINT8) 0x01
173 #define ACPI_TYPE_B                     (UINT8) 0x02
174 #define ACPI_TYPE_F                     (UINT8) 0x03
175 
176 #define ACPI_NOT_BUS_MASTER             (UINT8) 0x00
177 #define ACPI_BUS_MASTER                 (UINT8) 0x01
178 
179 #define ACPI_TRANSFER_8                 (UINT8) 0x00
180 #define ACPI_TRANSFER_8_16              (UINT8) 0x01
181 #define ACPI_TRANSFER_16                (UINT8) 0x02
182 
183 /*
184  * Start Dependent Functions Priority definitions
185  */
186 #define ACPI_GOOD_CONFIGURATION         (UINT8) 0x00
187 #define ACPI_ACCEPTABLE_CONFIGURATION   (UINT8) 0x01
188 #define ACPI_SUB_OPTIMAL_CONFIGURATION  (UINT8) 0x02
189 
190 /*
191  * 16, 32 and 64-bit Address Descriptor resource types
192  */
193 #define ACPI_MEMORY_RANGE               (UINT8) 0x00
194 #define ACPI_IO_RANGE                   (UINT8) 0x01
195 #define ACPI_BUS_NUMBER_RANGE           (UINT8) 0x02
196 
197 #define ACPI_ADDRESS_NOT_FIXED          (UINT8) 0x00
198 #define ACPI_ADDRESS_FIXED              (UINT8) 0x01
199 
200 #define ACPI_POS_DECODE                 (UINT8) 0x00
201 #define ACPI_SUB_DECODE                 (UINT8) 0x01
202 
203 #define ACPI_PRODUCER                   (UINT8) 0x00
204 #define ACPI_CONSUMER                   (UINT8) 0x01
205 
206 
207 /*
208  * If possible, pack the following structures to byte alignment
209  */
210 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
211 #pragma pack(1)
212 #endif
213 
214 /* UUID data structures for use in vendor-defined resource descriptors */
215 
216 typedef struct acpi_uuid
217 {
218     UINT8                           Data[ACPI_UUID_LENGTH];
219 } ACPI_UUID;
220 
221 typedef struct acpi_vendor_uuid
222 {
223     UINT8                           Subtype;
224     UINT8                           Data[ACPI_UUID_LENGTH];
225 
226 } ACPI_VENDOR_UUID;
227 
228 /*
229  * Structures used to describe device resources
230  */
231 typedef struct acpi_resource_irq
232 {
233     UINT8                           DescriptorLength;
234     UINT8                           Triggering;
235     UINT8                           Polarity;
236     UINT8                           Sharable;
237     UINT8                           InterruptCount;
238     UINT8                           Interrupts[1];
239 
240 } ACPI_RESOURCE_IRQ;
241 
242 typedef struct ACPI_RESOURCE_DMA
243 {
244     UINT8                           Type;
245     UINT8                           BusMaster;
246     UINT8                           Transfer;
247     UINT8                           ChannelCount;
248     UINT8                           Channels[1];
249 
250 } ACPI_RESOURCE_DMA;
251 
252 typedef struct acpi_resource_start_dependent
253 {
254     UINT8                           DescriptorLength;
255     UINT8                           CompatibilityPriority;
256     UINT8                           PerformanceRobustness;
257 
258 } ACPI_RESOURCE_START_DEPENDENT;
259 
260 
261 /*
262  * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
263  * needed because it has no fields
264  */
265 
266 
267 typedef struct acpi_resource_io
268 {
269     UINT8                           IoDecode;
270     UINT8                           Alignment;
271     UINT8                           AddressLength;
272     UINT16                          Minimum;
273     UINT16                          Maximum;
274 
275 } ACPI_RESOURCE_IO;
276 
277 typedef struct acpi_resource_fixed_io
278 {
279     UINT16                          Address;
280     UINT8                           AddressLength;
281 
282 } ACPI_RESOURCE_FIXED_IO;
283 
284 typedef struct acpi_resource_vendor
285 {
286     UINT16                          ByteLength;
287     UINT8                           ByteData[1];
288 
289 } ACPI_RESOURCE_VENDOR;
290 
291 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
292 
293 typedef struct acpi_resource_vendor_typed
294 {
295     UINT16                          ByteLength;
296     UINT8                           UuidSubtype;
297     UINT8                           Uuid[ACPI_UUID_LENGTH];
298     UINT8                           ByteData[1];
299 
300 } ACPI_RESOURCE_VENDOR_TYPED;
301 
302 typedef struct acpi_resource_end_tag
303 {
304     UINT8                           Checksum;
305 
306 } ACPI_RESOURCE_END_TAG;
307 
308 typedef struct acpi_resource_memory24
309 {
310     UINT8                           WriteProtect;
311     UINT16                          Minimum;
312     UINT16                          Maximum;
313     UINT16                          Alignment;
314     UINT16                          AddressLength;
315 
316 } ACPI_RESOURCE_MEMORY24;
317 
318 typedef struct acpi_resource_memory32
319 {
320     UINT8                           WriteProtect;
321     UINT32                          Minimum;
322     UINT32                          Maximum;
323     UINT32                          Alignment;
324     UINT32                          AddressLength;
325 
326 } ACPI_RESOURCE_MEMORY32;
327 
328 typedef struct acpi_resource_fixed_memory32
329 {
330     UINT8                           WriteProtect;
331     UINT32                          Address;
332     UINT32                          AddressLength;
333 
334 } ACPI_RESOURCE_FIXED_MEMORY32;
335 
336 typedef struct acpi_memory_attribute
337 {
338     UINT8                           WriteProtect;
339     UINT8                           Caching;
340     UINT8                           RangeType;
341     UINT8                           Translation;
342 
343 } ACPI_MEMORY_ATTRIBUTE;
344 
345 typedef struct acpi_io_attribute
346 {
347     UINT8                           RangeType;
348     UINT8                           Translation;
349     UINT8                           TranslationType;
350     UINT8                           Reserved1;
351 
352 } ACPI_IO_ATTRIBUTE;
353 
354 typedef union acpi_resource_attribute
355 {
356     ACPI_MEMORY_ATTRIBUTE           Mem;
357     ACPI_IO_ATTRIBUTE               Io;
358 
359     /* Used for the *WordSpace macros */
360 
361     UINT8                           TypeSpecific;
362 
363 } ACPI_RESOURCE_ATTRIBUTE;
364 
365 typedef struct acpi_resource_source
366 {
367     UINT8                           Index;
368     UINT16                          StringLength;
369     char                            *StringPtr;
370 
371 } ACPI_RESOURCE_SOURCE;
372 
373 /* Fields common to all address descriptors, 16/32/64 bit */
374 
375 #define ACPI_RESOURCE_ADDRESS_COMMON \
376     UINT8                           ResourceType; \
377     UINT8                           ProducerConsumer; \
378     UINT8                           Decode; \
379     UINT8                           MinAddressFixed; \
380     UINT8                           MaxAddressFixed; \
381     ACPI_RESOURCE_ATTRIBUTE         Info;
382 
383 typedef struct acpi_resource_address
384 {
385     ACPI_RESOURCE_ADDRESS_COMMON
386 
387 } ACPI_RESOURCE_ADDRESS;
388 
389 typedef struct acpi_resource_address16
390 {
391     ACPI_RESOURCE_ADDRESS_COMMON
392     UINT16                          Granularity;
393     UINT16                          Minimum;
394     UINT16                          Maximum;
395     UINT16                          TranslationOffset;
396     UINT16                          AddressLength;
397     ACPI_RESOURCE_SOURCE            ResourceSource;
398 
399 } ACPI_RESOURCE_ADDRESS16;
400 
401 typedef struct acpi_resource_address32
402 {
403     ACPI_RESOURCE_ADDRESS_COMMON
404     UINT32                          Granularity;
405     UINT32                          Minimum;
406     UINT32                          Maximum;
407     UINT32                          TranslationOffset;
408     UINT32                          AddressLength;
409     ACPI_RESOURCE_SOURCE            ResourceSource;
410 
411 } ACPI_RESOURCE_ADDRESS32;
412 
413 typedef struct acpi_resource_address64
414 {
415     ACPI_RESOURCE_ADDRESS_COMMON
416     UINT64                          Granularity;
417     UINT64                          Minimum;
418     UINT64                          Maximum;
419     UINT64                          TranslationOffset;
420     UINT64                          AddressLength;
421     ACPI_RESOURCE_SOURCE            ResourceSource;
422 
423 } ACPI_RESOURCE_ADDRESS64;
424 
425 typedef struct acpi_resource_extended_address64
426 {
427     ACPI_RESOURCE_ADDRESS_COMMON
428     UINT8                           RevisionID;
429     UINT64                          Granularity;
430     UINT64                          Minimum;
431     UINT64                          Maximum;
432     UINT64                          TranslationOffset;
433     UINT64                          AddressLength;
434     UINT64                          TypeSpecific;
435 
436 } ACPI_RESOURCE_EXTENDED_ADDRESS64;
437 
438 typedef struct acpi_resource_extended_irq
439 {
440     UINT8                           ProducerConsumer;
441     UINT8                           Triggering;
442     UINT8                           Polarity;
443     UINT8                           Sharable;
444     UINT8                           InterruptCount;
445     ACPI_RESOURCE_SOURCE            ResourceSource;
446     UINT32                          Interrupts[1];
447 
448 } ACPI_RESOURCE_EXTENDED_IRQ;
449 
450 typedef struct acpi_resource_generic_register
451 {
452     UINT8                           SpaceId;
453     UINT8                           BitWidth;
454     UINT8                           BitOffset;
455     UINT8                           AccessSize;
456     UINT64                          Address;
457 
458 } ACPI_RESOURCE_GENERIC_REGISTER;
459 
460 
461 /* ACPI_RESOURCE_TYPEs */
462 
463 #define ACPI_RESOURCE_TYPE_IRQ                  0
464 #define ACPI_RESOURCE_TYPE_DMA                  1
465 #define ACPI_RESOURCE_TYPE_START_DEPENDENT      2
466 #define ACPI_RESOURCE_TYPE_END_DEPENDENT        3
467 #define ACPI_RESOURCE_TYPE_IO                   4
468 #define ACPI_RESOURCE_TYPE_FIXED_IO             5
469 #define ACPI_RESOURCE_TYPE_VENDOR               6
470 #define ACPI_RESOURCE_TYPE_END_TAG              7
471 #define ACPI_RESOURCE_TYPE_MEMORY24             8
472 #define ACPI_RESOURCE_TYPE_MEMORY32             9
473 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32       10
474 #define ACPI_RESOURCE_TYPE_ADDRESS16            11
475 #define ACPI_RESOURCE_TYPE_ADDRESS32            12
476 #define ACPI_RESOURCE_TYPE_ADDRESS64            13
477 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64   14  /* ACPI 3.0 */
478 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ         15
479 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER     16
480 #define ACPI_RESOURCE_TYPE_MAX                  16
481 
482 /* Master union for resource descriptors */
483 
484 typedef union acpi_resource_data
485 {
486     ACPI_RESOURCE_IRQ                       Irq;
487     ACPI_RESOURCE_DMA                       Dma;
488     ACPI_RESOURCE_START_DEPENDENT           StartDpf;
489     ACPI_RESOURCE_IO                        Io;
490     ACPI_RESOURCE_FIXED_IO                  FixedIo;
491     ACPI_RESOURCE_VENDOR                    Vendor;
492     ACPI_RESOURCE_VENDOR_TYPED              VendorTyped;
493     ACPI_RESOURCE_END_TAG                   EndTag;
494     ACPI_RESOURCE_MEMORY24                  Memory24;
495     ACPI_RESOURCE_MEMORY32                  Memory32;
496     ACPI_RESOURCE_FIXED_MEMORY32            FixedMemory32;
497     ACPI_RESOURCE_ADDRESS16                 Address16;
498     ACPI_RESOURCE_ADDRESS32                 Address32;
499     ACPI_RESOURCE_ADDRESS64                 Address64;
500     ACPI_RESOURCE_EXTENDED_ADDRESS64        ExtAddress64;
501     ACPI_RESOURCE_EXTENDED_IRQ              ExtendedIrq;
502     ACPI_RESOURCE_GENERIC_REGISTER          GenericReg;
503 
504     /* Common fields */
505 
506     ACPI_RESOURCE_ADDRESS                   Address;        /* Common 16/32/64 address fields */
507 
508 } ACPI_RESOURCE_DATA;
509 
510 
511 /* Common resource header */
512 
513 typedef struct acpi_resource
514 {
515     UINT32                          Type;
516     UINT32                          Length;
517     ACPI_RESOURCE_DATA              Data;
518 
519 } ACPI_RESOURCE;
520 
521 /* restore default alignment */
522 
523 #pragma pack()
524 
525 
526 #define ACPI_RS_SIZE_NO_DATA                8       /* Id + Length fields */
527 #define ACPI_RS_SIZE_MIN                    (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
528 #define ACPI_RS_SIZE(Type)                  (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
529 
530 #define ACPI_NEXT_RESOURCE(Res)             (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
531 
532 
533 typedef struct acpi_pci_routing_table
534 {
535     UINT32                          Length;
536     UINT32                          Pin;
537     ACPI_INTEGER                    Address;        /* here for 64-bit alignment */
538     UINT32                          SourceIndex;
539     char                            Source[4];      /* pad to 64 bits so sizeof() works in all cases */
540 
541 } ACPI_PCI_ROUTING_TABLE;
542 
543 #endif /* __ACRESTYP_H__ */
544 
545