acrestyp.h revision 202771
117721Speter/******************************************************************************
217721Speter *
317721Speter * Name: acrestyp.h - Defines, types, and structures for resource descriptors
417721Speter *
517721Speter *****************************************************************************/
617721Speter
717721Speter/******************************************************************************
817721Speter *
917721Speter * 1. Copyright Notice
1017721Speter *
1117721Speter * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
1217721Speter * All rights reserved.
1317721Speter *
1417721Speter * 2. License
1517721Speter *
1617721Speter * 2.1. This is your license from Intel Corp. under its intellectual property
1717721Speter * rights.  You may have additional license terms from the party that provided
1817721Speter * you this software, covering your right to use that party's intellectual
1917721Speter * property rights.
2017721Speter *
2117721Speter * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2217721Speter * copy of the source code appearing in this file ("Covered Code") an
2317721Speter * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2417721Speter * base code distributed originally by Intel ("Original Intel Code") to copy,
2517721Speter * make derivatives, distribute, use and display any portion of the Covered
2617721Speter * Code in any form, with the right to sublicense such rights; and
2717721Speter *
2817721Speter * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
2917721Speter * license (with the right to sublicense), under only those claims of Intel
3017721Speter * patents that are infringed by the Original Intel Code, to make, use, sell,
3117721Speter * offer to sell, and import the Covered Code and derivative works thereof
3217721Speter * solely to the minimum extent necessary to exercise the above copyright
3317721Speter * license, and in no event shall the patent license extend to any additions
3417721Speter * to or modifications of the Original Intel Code.  No other license or right
3517721Speter * is granted directly or by implication, estoppel or otherwise;
3617721Speter *
3717721Speter * The above copyright and patent license is granted only if the following
3817721Speter * conditions are met:
3917721Speter *
4017721Speter * 3. Conditions
4117721Speter *
4217721Speter * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4317721Speter * Redistribution of source code of any substantial portion of the Covered
4417721Speter * Code or modification with rights to further distribute source must include
4517721Speter * the above Copyright Notice, the above License, this list of Conditions,
4617721Speter * and the following Disclaimer and Export Compliance provision.  In addition,
4717721Speter * Licensee must cause all Covered Code to which Licensee contributes to
4817721Speter * contain a file documenting the changes Licensee made to create that Covered
4917721Speter * Code and the date of any change.  Licensee must include in that file the
5017721Speter * documentation of any changes made by any predecessor Licensee.  Licensee
5117721Speter * must include a prominent statement that the modification is derived,
5217721Speter * directly or indirectly, from Original Intel Code.
5317721Speter *
5417721Speter * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5517721Speter * Redistribution of source code of any substantial portion of the Covered
5617721Speter * Code or modification without rights to further distribute source must
5717721Speter * include the following Disclaimer and Export Compliance provision in the
5817721Speter * documentation and/or other materials provided with distribution.  In
5917721Speter * addition, Licensee may not authorize further sublicense of source of any
6017721Speter * portion of the Covered Code, and must include terms to the effect that the
6117721Speter * license from Licensee to its licensee is limited to the intellectual
6217721Speter * property embodied in the software Licensee provides to its licensee, and
6317721Speter * not to intellectual property embodied in modifications its licensee may
6417721Speter * make.
6517721Speter *
6617721Speter * 3.3. Redistribution of Executable. Redistribution in executable form of any
6717721Speter * substantial portion of the Covered Code or modification must reproduce the
6817721Speter * above Copyright Notice, and the following Disclaimer and Export Compliance
6917721Speter * provision in the documentation and/or other materials provided with the
7017721Speter * distribution.
7117721Speter *
7217721Speter * 3.4. Intel retains all right, title, and interest in and to the Original
7317721Speter * Intel Code.
7417721Speter *
7517721Speter * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7617721Speter * Intel shall be used in advertising or otherwise to promote the sale, use or
7717721Speter * other dealings in products derived from or relating to the Covered Code
7817721Speter * without prior written authorization from Intel.
7917721Speter *
8017721Speter * 4. Disclaimer and Export Compliance
8117721Speter *
8217721Speter * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8317721Speter * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8417721Speter * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8517721Speter * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8617721Speter * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8717721Speter * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8817721Speter * PARTICULAR PURPOSE.
8917721Speter *
9017721Speter * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9117721Speter * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9217721Speter * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9317721Speter * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9417721Speter * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9517721Speter * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9617721Speter * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9717721Speter * LIMITED REMEDY.
9817721Speter *
9917721Speter * 4.3. Licensee shall not export, either directly or indirectly, any of this
10017721Speter * software or system incorporating such software without first obtaining any
10117721Speter * required license or other approval from the U. S. Department of Commerce or
10217721Speter * any other agency or department of the United States Government.  In the
10317721Speter * event Licensee exports any such software from the United States or
10417721Speter * re-exports any such software from a foreign destination, Licensee shall
10517721Speter * ensure that the distribution and export/re-export of the software is in
10617721Speter * compliance with all laws, regulations, orders, or other restrictions of the
10717721Speter * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10817721Speter * any of its subsidiaries will export/re-export any technical data, process,
10917721Speter * software, or service, directly or indirectly, to any country for which the
11017721Speter * United States government or any agency thereof requires an export license,
11117721Speter * other governmental approval, or letter of assurance, without first obtaining
11217721Speter * such license, approval or letter.
11317721Speter *
11417721Speter *****************************************************************************/
115
116#ifndef __ACRESTYP_H__
117#define __ACRESTYP_H__
118
119
120/*
121 * Definitions for Resource Attributes
122 */
123typedef UINT16                          ACPI_RS_LENGTH;    /* Resource Length field is fixed at 16 bits */
124typedef 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
216typedef struct acpi_uuid
217{
218    UINT8                           Data[ACPI_UUID_LENGTH];
219} ACPI_UUID;
220
221typedef 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 */
231typedef 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
242typedef 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
252typedef 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
267typedef 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
277typedef struct acpi_resource_fixed_io
278{
279    UINT16                          Address;
280    UINT8                           AddressLength;
281
282} ACPI_RESOURCE_FIXED_IO;
283
284typedef 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
293typedef 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
302typedef struct acpi_resource_end_tag
303{
304    UINT8                           Checksum;
305
306} ACPI_RESOURCE_END_TAG;
307
308typedef 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
318typedef 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
328typedef struct acpi_resource_fixed_memory32
329{
330    UINT8                           WriteProtect;
331    UINT32                          Address;
332    UINT32                          AddressLength;
333
334} ACPI_RESOURCE_FIXED_MEMORY32;
335
336typedef struct acpi_memory_attribute
337{
338    UINT8                           WriteProtect;
339    UINT8                           Caching;
340    UINT8                           RangeType;
341    UINT8                           Translation;
342
343} ACPI_MEMORY_ATTRIBUTE;
344
345typedef struct acpi_io_attribute
346{
347    UINT8                           RangeType;
348    UINT8                           Translation;
349    UINT8                           TranslationType;
350    UINT8                           Reserved1;
351
352} ACPI_IO_ATTRIBUTE;
353
354typedef 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
365typedef 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
383typedef struct acpi_resource_address
384{
385    ACPI_RESOURCE_ADDRESS_COMMON
386
387} ACPI_RESOURCE_ADDRESS;
388
389typedef 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
401typedef 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
413typedef 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
425typedef 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
438typedef 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
450typedef 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
484typedef 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
513typedef 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
533typedef struct acpi_pci_routing_table
534{
535    UINT32                          Length;
536    UINT32                          Pin;
537    UINT64                          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