Linux Audio

Check our new training course

Loading...
v3.1
 
  1/******************************************************************************
  2 *
  3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
  4 *
  5 *****************************************************************************/
  6
  7/*
  8 * Copyright (C) 2000 - 2011, Intel Corp.
  9 * All rights reserved.
 10 *
 11 * Redistribution and use in source and binary forms, with or without
 12 * modification, are permitted provided that the following conditions
 13 * are met:
 14 * 1. Redistributions of source code must retain the above copyright
 15 *    notice, this list of conditions, and the following disclaimer,
 16 *    without modification.
 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 18 *    substantially similar to the "NO WARRANTY" disclaimer below
 19 *    ("Disclaimer") and any redistribution must be conditioned upon
 20 *    including a substantially similar Disclaimer requirement for further
 21 *    binary redistribution.
 22 * 3. Neither the names of the above-listed copyright holders nor the names
 23 *    of any contributors may be used to endorse or promote products derived
 24 *    from this software without specific prior written permission.
 25 *
 26 * Alternatively, this software may be distributed under the terms of the
 27 * GNU General Public License ("GPL") version 2 as published by the Free
 28 * Software Foundation.
 29 *
 30 * NO WARRANTY
 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 41 * POSSIBILITY OF SUCH DAMAGES.
 42 */
 43
 44#ifndef __ACRESTYP_H__
 45#define __ACRESTYP_H__
 46
 47/*
 48 * Definitions for Resource Attributes
 49 */
 50typedef u16 acpi_rs_length;	/* Resource Length field is fixed at 16 bits */
 51typedef u32 acpi_rsdesc_size;	/* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
 52
 53/*
 54 * Memory Attributes
 55 */
 56#define ACPI_READ_ONLY_MEMORY           (u8) 0x00
 57#define ACPI_READ_WRITE_MEMORY          (u8) 0x01
 58
 59#define ACPI_NON_CACHEABLE_MEMORY       (u8) 0x00
 60#define ACPI_CACHABLE_MEMORY            (u8) 0x01
 61#define ACPI_WRITE_COMBINING_MEMORY     (u8) 0x02
 62#define ACPI_PREFETCHABLE_MEMORY        (u8) 0x03
 63
 
 64/*
 65 * IO Attributes
 66 * The ISA IO ranges are:     n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
 67 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
 68 */
 
 
 69#define ACPI_NON_ISA_ONLY_RANGES        (u8) 0x01
 70#define ACPI_ISA_ONLY_RANGES            (u8) 0x02
 71#define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
 72
 73/* Type of translation - 1=Sparse, 0=Dense */
 74
 75#define ACPI_SPARSE_TRANSLATION         (u8) 0x01
 76
 77/*
 78 * IO Port Descriptor Decode
 79 */
 80#define ACPI_DECODE_10                  (u8) 0x00	/* 10-bit IO address decode */
 81#define ACPI_DECODE_16                  (u8) 0x01	/* 16-bit IO address decode */
 82
 83/*
 84 * IRQ Attributes
 85 */
 
 
 
 86#define ACPI_LEVEL_SENSITIVE            (u8) 0x00
 87#define ACPI_EDGE_SENSITIVE             (u8) 0x01
 88
 
 
 89#define ACPI_ACTIVE_HIGH                (u8) 0x00
 90#define ACPI_ACTIVE_LOW                 (u8) 0x01
 
 
 
 91
 92#define ACPI_EXCLUSIVE                  (u8) 0x00
 93#define ACPI_SHARED                     (u8) 0x01
 94
 
 
 
 
 
 95/*
 96 * DMA Attributes
 97 */
 98#define ACPI_COMPATIBILITY              (u8) 0x00
 99#define ACPI_TYPE_A                     (u8) 0x01
100#define ACPI_TYPE_B                     (u8) 0x02
101#define ACPI_TYPE_F                     (u8) 0x03
102
103#define ACPI_NOT_BUS_MASTER             (u8) 0x00
104#define ACPI_BUS_MASTER                 (u8) 0x01
105
106#define ACPI_TRANSFER_8                 (u8) 0x00
107#define ACPI_TRANSFER_8_16              (u8) 0x01
108#define ACPI_TRANSFER_16                (u8) 0x02
109
110/*
111 * Start Dependent Functions Priority definitions
112 */
113#define ACPI_GOOD_CONFIGURATION         (u8) 0x00
114#define ACPI_ACCEPTABLE_CONFIGURATION   (u8) 0x01
115#define ACPI_SUB_OPTIMAL_CONFIGURATION  (u8) 0x02
116
117/*
118 * 16, 32 and 64-bit Address Descriptor resource types
119 */
120#define ACPI_MEMORY_RANGE               (u8) 0x00
121#define ACPI_IO_RANGE                   (u8) 0x01
122#define ACPI_BUS_NUMBER_RANGE           (u8) 0x02
123
124#define ACPI_ADDRESS_NOT_FIXED          (u8) 0x00
125#define ACPI_ADDRESS_FIXED              (u8) 0x01
126
127#define ACPI_POS_DECODE                 (u8) 0x00
128#define ACPI_SUB_DECODE                 (u8) 0x01
129
 
 
130#define ACPI_PRODUCER                   (u8) 0x00
131#define ACPI_CONSUMER                   (u8) 0x01
132
133/*
134 * If possible, pack the following structures to byte alignment
135 */
136#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
137#pragma pack(1)
138#endif
139
140/* UUID data structures for use in vendor-defined resource descriptors */
141
142struct acpi_uuid {
143	u8 data[ACPI_UUID_LENGTH];
144};
145
146struct acpi_vendor_uuid {
147	u8 subtype;
148	u8 data[ACPI_UUID_LENGTH];
149};
150
151/*
152 * Structures used to describe device resources
153 */
154struct acpi_resource_irq {
155	u8 descriptor_length;
156	u8 triggering;
157	u8 polarity;
158	u8 sharable;
 
159	u8 interrupt_count;
160	u8 interrupts[1];
 
 
 
161};
162
163struct acpi_resource_dma {
164	u8 type;
165	u8 bus_master;
166	u8 transfer;
167	u8 channel_count;
168	u8 channels[1];
 
 
 
169};
170
171struct acpi_resource_start_dependent {
172	u8 descriptor_length;
173	u8 compatibility_priority;
174	u8 performance_robustness;
175};
176
177/*
178 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
179 * needed because it has no fields
180 */
181
182struct acpi_resource_io {
183	u8 io_decode;
184	u8 alignment;
185	u8 address_length;
186	u16 minimum;
187	u16 maximum;
188};
189
190struct acpi_resource_fixed_io {
191	u16 address;
192	u8 address_length;
193};
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195struct acpi_resource_vendor {
196	u16 byte_length;
197	u8 byte_data[1];
198};
199
200/* Vendor resource with UUID info (introduced in ACPI 3.0) */
201
202struct acpi_resource_vendor_typed {
203	u16 byte_length;
204	u8 uuid_subtype;
205	u8 uuid[ACPI_UUID_LENGTH];
206	u8 byte_data[1];
207};
208
209struct acpi_resource_end_tag {
210	u8 checksum;
211};
212
213struct acpi_resource_memory24 {
214	u8 write_protect;
215	u16 minimum;
216	u16 maximum;
217	u16 alignment;
218	u16 address_length;
219};
220
221struct acpi_resource_memory32 {
222	u8 write_protect;
223	u32 minimum;
224	u32 maximum;
225	u32 alignment;
226	u32 address_length;
227};
228
229struct acpi_resource_fixed_memory32 {
230	u8 write_protect;
231	u32 address;
232	u32 address_length;
233};
234
235struct acpi_memory_attribute {
236	u8 write_protect;
237	u8 caching;
238	u8 range_type;
239	u8 translation;
240};
241
242struct acpi_io_attribute {
243	u8 range_type;
244	u8 translation;
245	u8 translation_type;
246	u8 reserved1;
247};
248
249union acpi_resource_attribute {
250	struct acpi_memory_attribute mem;
251	struct acpi_io_attribute io;
252
253	/* Used for the *word_space macros */
254
255	u8 type_specific;
256};
257
 
 
 
 
 
258struct acpi_resource_source {
259	u8 index;
260	u16 string_length;
261	char *string_ptr;
262};
263
264/* Fields common to all address descriptors, 16/32/64 bit */
265
266#define ACPI_RESOURCE_ADDRESS_COMMON \
267	u8                                      resource_type; \
268	u8                                      producer_consumer; \
269	u8                                      decode; \
270	u8                                      min_address_fixed; \
271	u8                                      max_address_fixed; \
272	union acpi_resource_attribute           info;
273
274struct acpi_resource_address {
275ACPI_RESOURCE_ADDRESS_COMMON};
276
277struct acpi_resource_address16 {
278	ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
279	u16 minimum;
280	u16 maximum;
281	u16 translation_offset;
282	u16 address_length;
283	struct acpi_resource_source resource_source;
284};
285
286struct acpi_resource_address32 {
287	ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
288	u32 minimum;
289	u32 maximum;
290	u32 translation_offset;
291	u32 address_length;
292	struct acpi_resource_source resource_source;
293};
294
295struct acpi_resource_address64 {
296	ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
297	u64 minimum;
298	u64 maximum;
299	u64 translation_offset;
300	u64 address_length;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301	struct acpi_resource_source resource_source;
302};
303
304struct acpi_resource_extended_address64 {
305	ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
306	u64 granularity;
307	u64 minimum;
308	u64 maximum;
309	u64 translation_offset;
310	u64 address_length;
311	u64 type_specific;
312};
313
314struct acpi_resource_extended_irq {
315	u8 producer_consumer;
316	u8 triggering;
317	u8 polarity;
318	u8 sharable;
 
319	u8 interrupt_count;
320	struct acpi_resource_source resource_source;
321	u32 interrupts[1];
 
 
 
322};
323
324struct acpi_resource_generic_register {
325	u8 space_id;
326	u8 bit_width;
327	u8 bit_offset;
328	u8 access_size;
329	u64 address;
330};
331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332/* ACPI_RESOURCE_TYPEs */
333
334#define ACPI_RESOURCE_TYPE_IRQ                  0
335#define ACPI_RESOURCE_TYPE_DMA                  1
336#define ACPI_RESOURCE_TYPE_START_DEPENDENT      2
337#define ACPI_RESOURCE_TYPE_END_DEPENDENT        3
338#define ACPI_RESOURCE_TYPE_IO                   4
339#define ACPI_RESOURCE_TYPE_FIXED_IO             5
340#define ACPI_RESOURCE_TYPE_VENDOR               6
341#define ACPI_RESOURCE_TYPE_END_TAG              7
342#define ACPI_RESOURCE_TYPE_MEMORY24             8
343#define ACPI_RESOURCE_TYPE_MEMORY32             9
344#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32       10
345#define ACPI_RESOURCE_TYPE_ADDRESS16            11
346#define ACPI_RESOURCE_TYPE_ADDRESS32            12
347#define ACPI_RESOURCE_TYPE_ADDRESS64            13
348#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64   14	/* ACPI 3.0 */
349#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ         15
350#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER     16
351#define ACPI_RESOURCE_TYPE_MAX                  16
 
 
 
 
 
 
 
 
 
352
353/* Master union for resource descriptors */
354
355union acpi_resource_data {
356	struct acpi_resource_irq irq;
357	struct acpi_resource_dma dma;
358	struct acpi_resource_start_dependent start_dpf;
359	struct acpi_resource_io io;
360	struct acpi_resource_fixed_io fixed_io;
 
361	struct acpi_resource_vendor vendor;
362	struct acpi_resource_vendor_typed vendor_typed;
363	struct acpi_resource_end_tag end_tag;
364	struct acpi_resource_memory24 memory24;
365	struct acpi_resource_memory32 memory32;
366	struct acpi_resource_fixed_memory32 fixed_memory32;
367	struct acpi_resource_address16 address16;
368	struct acpi_resource_address32 address32;
369	struct acpi_resource_address64 address64;
370	struct acpi_resource_extended_address64 ext_address64;
371	struct acpi_resource_extended_irq extended_irq;
372	struct acpi_resource_generic_register generic_reg;
 
 
 
 
 
 
 
 
 
 
 
 
373
374	/* Common fields */
375
376	struct acpi_resource_address address;	/* Common 16/32/64 address fields */
377};
378
379/* Common resource header */
380
381struct acpi_resource {
382	u32 type;
383	u32 length;
384	union acpi_resource_data data;
385};
386
387/* restore default alignment */
388
389#pragma pack()
390
391#define ACPI_RS_SIZE_NO_DATA                8	/* Id + Length fields */
392#define ACPI_RS_SIZE_MIN                    (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
393#define ACPI_RS_SIZE(type)                  (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
394
395#define ACPI_NEXT_RESOURCE(res)             (struct acpi_resource *)((u8 *) res + res->length)
 
 
 
396
397struct acpi_pci_routing_table {
398	u32 length;
399	u32 pin;
400	u64 address;		/* here for 64-bit alignment */
401	u32 source_index;
402	char source[4];		/* pad to 64 bits so sizeof() works in all cases */
 
 
 
403};
404
405#endif				/* __ACRESTYP_H__ */
v6.9.4
  1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
  2/******************************************************************************
  3 *
  4 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
  5 *
  6 * Copyright (C) 2000 - 2023, Intel Corp.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  7 *
  8 *****************************************************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  9
 10#ifndef __ACRESTYP_H__
 11#define __ACRESTYP_H__
 12
 13/*
 14 * Definitions for Resource Attributes
 15 */
 16typedef u16 acpi_rs_length;	/* Resource Length field is fixed at 16 bits */
 17typedef u32 acpi_rsdesc_size;	/* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
 18
 19/*
 20 * Memory Attributes
 21 */
 22#define ACPI_READ_ONLY_MEMORY           (u8) 0x00
 23#define ACPI_READ_WRITE_MEMORY          (u8) 0x01
 24
 25#define ACPI_NON_CACHEABLE_MEMORY       (u8) 0x00
 26#define ACPI_CACHABLE_MEMORY            (u8) 0x01
 27#define ACPI_WRITE_COMBINING_MEMORY     (u8) 0x02
 28#define ACPI_PREFETCHABLE_MEMORY        (u8) 0x03
 29
 30/*! [Begin] no source code translation */
 31/*
 32 * IO Attributes
 33 * The ISA IO ranges are:     n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
 34 * The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
 35 */
 36/*! [End] no source code translation !*/
 37
 38#define ACPI_NON_ISA_ONLY_RANGES        (u8) 0x01
 39#define ACPI_ISA_ONLY_RANGES            (u8) 0x02
 40#define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
 41
 42/* Type of translation - 1=Sparse, 0=Dense */
 43
 44#define ACPI_SPARSE_TRANSLATION         (u8) 0x01
 45
 46/*
 47 * IO Port Descriptor Decode
 48 */
 49#define ACPI_DECODE_10                  (u8) 0x00	/* 10-bit IO address decode */
 50#define ACPI_DECODE_16                  (u8) 0x01	/* 16-bit IO address decode */
 51
 52/*
 53 * Interrupt attributes - used in multiple descriptors
 54 */
 55
 56/* Triggering */
 57
 58#define ACPI_LEVEL_SENSITIVE            (u8) 0x00
 59#define ACPI_EDGE_SENSITIVE             (u8) 0x01
 60
 61/* Polarity */
 62
 63#define ACPI_ACTIVE_HIGH                (u8) 0x00
 64#define ACPI_ACTIVE_LOW                 (u8) 0x01
 65#define ACPI_ACTIVE_BOTH                (u8) 0x02
 66
 67/* Sharing */
 68
 69#define ACPI_EXCLUSIVE                  (u8) 0x00
 70#define ACPI_SHARED                     (u8) 0x01
 71
 72/* Wake */
 73
 74#define ACPI_NOT_WAKE_CAPABLE           (u8) 0x00
 75#define ACPI_WAKE_CAPABLE               (u8) 0x01
 76
 77/*
 78 * DMA Attributes
 79 */
 80#define ACPI_COMPATIBILITY              (u8) 0x00
 81#define ACPI_TYPE_A                     (u8) 0x01
 82#define ACPI_TYPE_B                     (u8) 0x02
 83#define ACPI_TYPE_F                     (u8) 0x03
 84
 85#define ACPI_NOT_BUS_MASTER             (u8) 0x00
 86#define ACPI_BUS_MASTER                 (u8) 0x01
 87
 88#define ACPI_TRANSFER_8                 (u8) 0x00
 89#define ACPI_TRANSFER_8_16              (u8) 0x01
 90#define ACPI_TRANSFER_16                (u8) 0x02
 91
 92/*
 93 * Start Dependent Functions Priority definitions
 94 */
 95#define ACPI_GOOD_CONFIGURATION         (u8) 0x00
 96#define ACPI_ACCEPTABLE_CONFIGURATION   (u8) 0x01
 97#define ACPI_SUB_OPTIMAL_CONFIGURATION  (u8) 0x02
 98
 99/*
100 * 16, 32 and 64-bit Address Descriptor resource types
101 */
102#define ACPI_MEMORY_RANGE               (u8) 0x00
103#define ACPI_IO_RANGE                   (u8) 0x01
104#define ACPI_BUS_NUMBER_RANGE           (u8) 0x02
105
106#define ACPI_ADDRESS_NOT_FIXED          (u8) 0x00
107#define ACPI_ADDRESS_FIXED              (u8) 0x01
108
109#define ACPI_POS_DECODE                 (u8) 0x00
110#define ACPI_SUB_DECODE                 (u8) 0x01
111
112/* Producer/Consumer */
113
114#define ACPI_PRODUCER                   (u8) 0x00
115#define ACPI_CONSUMER                   (u8) 0x01
116
117/*
118 * If possible, pack the following structures to byte alignment
119 */
120#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
121#pragma pack(1)
122#endif
123
124/* UUID data structures for use in vendor-defined resource descriptors */
125
126struct acpi_uuid {
127	u8 data[ACPI_UUID_LENGTH];
128};
129
130struct acpi_vendor_uuid {
131	u8 subtype;
132	u8 data[ACPI_UUID_LENGTH];
133};
134
135/*
136 * Structures used to describe device resources
137 */
138struct acpi_resource_irq {
139	u8 descriptor_length;
140	u8 triggering;
141	u8 polarity;
142	u8 shareable;
143	u8 wake_capable;
144	u8 interrupt_count;
145	union {
146		u8 interrupt;
147		 ACPI_FLEX_ARRAY(u8, interrupts);
148	};
149};
150
151struct acpi_resource_dma {
152	u8 type;
153	u8 bus_master;
154	u8 transfer;
155	u8 channel_count;
156	union {
157		u8 channel;
158		 ACPI_FLEX_ARRAY(u8, channels);
159	};
160};
161
162struct acpi_resource_start_dependent {
163	u8 descriptor_length;
164	u8 compatibility_priority;
165	u8 performance_robustness;
166};
167
168/*
169 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
170 * needed because it has no fields
171 */
172
173struct acpi_resource_io {
174	u8 io_decode;
175	u8 alignment;
176	u8 address_length;
177	u16 minimum;
178	u16 maximum;
179};
180
181struct acpi_resource_fixed_io {
182	u16 address;
183	u8 address_length;
184};
185
186struct acpi_resource_fixed_dma {
187	u16 request_lines;
188	u16 channels;
189	u8 width;
190};
191
192/* Values for Width field above */
193
194#define ACPI_DMA_WIDTH8                         0
195#define ACPI_DMA_WIDTH16                        1
196#define ACPI_DMA_WIDTH32                        2
197#define ACPI_DMA_WIDTH64                        3
198#define ACPI_DMA_WIDTH128                       4
199#define ACPI_DMA_WIDTH256                       5
200
201struct acpi_resource_vendor {
202	u16 byte_length;
203	u8 byte_data[];
204};
205
206/* Vendor resource with UUID info (introduced in ACPI 3.0) */
207
208struct acpi_resource_vendor_typed {
209	u16 byte_length;
210	u8 uuid_subtype;
211	u8 uuid[ACPI_UUID_LENGTH];
212	u8 byte_data[];
213};
214
215struct acpi_resource_end_tag {
216	u8 checksum;
217};
218
219struct acpi_resource_memory24 {
220	u8 write_protect;
221	u16 minimum;
222	u16 maximum;
223	u16 alignment;
224	u16 address_length;
225};
226
227struct acpi_resource_memory32 {
228	u8 write_protect;
229	u32 minimum;
230	u32 maximum;
231	u32 alignment;
232	u32 address_length;
233};
234
235struct acpi_resource_fixed_memory32 {
236	u8 write_protect;
237	u32 address;
238	u32 address_length;
239};
240
241struct acpi_memory_attribute {
242	u8 write_protect;
243	u8 caching;
244	u8 range_type;
245	u8 translation;
246};
247
248struct acpi_io_attribute {
249	u8 range_type;
250	u8 translation;
251	u8 translation_type;
252	u8 reserved1;
253};
254
255union acpi_resource_attribute {
256	struct acpi_memory_attribute mem;
257	struct acpi_io_attribute io;
258
259	/* Used for the *word_space macros */
260
261	u8 type_specific;
262};
263
264struct acpi_resource_label {
265	u16 string_length;
266	char *string_ptr;
267};
268
269struct acpi_resource_source {
270	u8 index;
271	u16 string_length;
272	char *string_ptr;
273};
274
275/* Fields common to all address descriptors, 16/32/64 bit */
276
277#define ACPI_RESOURCE_ADDRESS_COMMON \
278	u8                                      resource_type; \
279	u8                                      producer_consumer; \
280	u8                                      decode; \
281	u8                                      min_address_fixed; \
282	u8                                      max_address_fixed; \
283	union acpi_resource_attribute           info;
284
285struct acpi_address16_attribute {
286	u16 granularity;
 
 
 
287	u16 minimum;
288	u16 maximum;
289	u16 translation_offset;
290	u16 address_length;
 
291};
292
293struct acpi_address32_attribute {
294	u32 granularity;
295	u32 minimum;
296	u32 maximum;
297	u32 translation_offset;
298	u32 address_length;
 
299};
300
301struct acpi_address64_attribute {
302	u64 granularity;
303	u64 minimum;
304	u64 maximum;
305	u64 translation_offset;
306	u64 address_length;
307};
308
309struct acpi_resource_address {
310ACPI_RESOURCE_ADDRESS_COMMON};
311
312struct acpi_resource_address16 {
313	ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address16_attribute address;
314	struct acpi_resource_source resource_source;
315};
316
317struct acpi_resource_address32 {
318	ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address32_attribute address;
319	struct acpi_resource_source resource_source;
320};
321
322struct acpi_resource_address64 {
323	ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address64_attribute address;
324	struct acpi_resource_source resource_source;
325};
326
327struct acpi_resource_extended_address64 {
328	ACPI_RESOURCE_ADDRESS_COMMON u8 revision_ID;
329	struct acpi_address64_attribute address;
 
 
 
 
330	u64 type_specific;
331};
332
333struct acpi_resource_extended_irq {
334	u8 producer_consumer;
335	u8 triggering;
336	u8 polarity;
337	u8 shareable;
338	u8 wake_capable;
339	u8 interrupt_count;
340	struct acpi_resource_source resource_source;
341	union {
342		u32 interrupt;
343		 ACPI_FLEX_ARRAY(u32, interrupts);
344	};
345};
346
347struct acpi_resource_generic_register {
348	u8 space_id;
349	u8 bit_width;
350	u8 bit_offset;
351	u8 access_size;
352	u64 address;
353};
354
355struct acpi_resource_gpio {
356	u8 revision_id;
357	u8 connection_type;
358	u8 producer_consumer;	/* For values, see Producer/Consumer above */
359	u8 pin_config;
360	u8 shareable;		/* For values, see Interrupt Attributes above */
361	u8 wake_capable;	/* For values, see Interrupt Attributes above */
362	u8 io_restriction;
363	u8 triggering;		/* For values, see Interrupt Attributes above */
364	u8 polarity;		/* For values, see Interrupt Attributes above */
365	u16 drive_strength;
366	u16 debounce_timeout;
367	u16 pin_table_length;
368	u16 vendor_length;
369	struct acpi_resource_source resource_source;
370	u16 *pin_table;
371	u8 *vendor_data;
372};
373
374/* Values for GPIO connection_type field above */
375
376#define ACPI_RESOURCE_GPIO_TYPE_INT             0
377#define ACPI_RESOURCE_GPIO_TYPE_IO              1
378
379/* Values for pin_config field above */
380
381#define ACPI_PIN_CONFIG_DEFAULT                 0
382#define ACPI_PIN_CONFIG_PULLUP                  1
383#define ACPI_PIN_CONFIG_PULLDOWN                2
384#define ACPI_PIN_CONFIG_NOPULL                  3
385
386/* Values for io_restriction field above */
387
388#define ACPI_IO_RESTRICT_NONE                   0
389#define ACPI_IO_RESTRICT_INPUT                  1
390#define ACPI_IO_RESTRICT_OUTPUT                 2
391#define ACPI_IO_RESTRICT_NONE_PRESERVE          3
392
393/* Common structure for I2C, SPI, UART, CSI2 serial descriptors */
394
395#define ACPI_RESOURCE_SERIAL_COMMON \
396	u8                                      revision_id; \
397	u8                                      type; \
398	u8                                      producer_consumer;   /* For values, see Producer/Consumer above */\
399	u8                                      slave_mode; \
400	u8                                      connection_sharing; \
401	u8                                      type_revision_id; \
402	u16                                     type_data_length; \
403	u16                                     vendor_length; \
404	struct acpi_resource_source             resource_source; \
405	u8                                      *vendor_data;
406
407struct acpi_resource_common_serialbus {
408ACPI_RESOURCE_SERIAL_COMMON};
409
410/* Values for the Type field above */
411
412#define ACPI_RESOURCE_SERIAL_TYPE_I2C           1
413#define ACPI_RESOURCE_SERIAL_TYPE_SPI           2
414#define ACPI_RESOURCE_SERIAL_TYPE_UART          3
415#define ACPI_RESOURCE_SERIAL_TYPE_CSI2          4
416
417/* Values for slave_mode field above */
418
419#define ACPI_CONTROLLER_INITIATED               0
420#define ACPI_DEVICE_INITIATED                   1
421
422struct acpi_resource_i2c_serialbus {
423	ACPI_RESOURCE_SERIAL_COMMON u8 access_mode;
424	u16 slave_address;
425	u32 connection_speed;
426};
427
428/* Values for access_mode field above */
429
430#define ACPI_I2C_7BIT_MODE                      0
431#define ACPI_I2C_10BIT_MODE                     1
432
433struct acpi_resource_spi_serialbus {
434	ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode;
435	u8 device_polarity;
436	u8 data_bit_length;
437	u8 clock_phase;
438	u8 clock_polarity;
439	u16 device_selection;
440	u32 connection_speed;
441};
442
443/* Values for wire_mode field above */
444
445#define ACPI_SPI_4WIRE_MODE                     0
446#define ACPI_SPI_3WIRE_MODE                     1
447
448/* Values for device_polarity field above */
449
450#define ACPI_SPI_ACTIVE_LOW                     0
451#define ACPI_SPI_ACTIVE_HIGH                    1
452
453/* Values for clock_phase field above */
454
455#define ACPI_SPI_FIRST_PHASE                    0
456#define ACPI_SPI_SECOND_PHASE                   1
457
458/* Values for clock_polarity field above */
459
460#define ACPI_SPI_START_LOW                      0
461#define ACPI_SPI_START_HIGH                     1
462
463struct acpi_resource_uart_serialbus {
464	ACPI_RESOURCE_SERIAL_COMMON u8 endian;
465	u8 data_bits;
466	u8 stop_bits;
467	u8 flow_control;
468	u8 parity;
469	u8 lines_enabled;
470	u16 rx_fifo_size;
471	u16 tx_fifo_size;
472	u32 default_baud_rate;
473};
474
475/* Values for Endian field above */
476
477#define ACPI_UART_LITTLE_ENDIAN                 0
478#define ACPI_UART_BIG_ENDIAN                    1
479
480/* Values for data_bits field above */
481
482#define ACPI_UART_5_DATA_BITS                   0
483#define ACPI_UART_6_DATA_BITS                   1
484#define ACPI_UART_7_DATA_BITS                   2
485#define ACPI_UART_8_DATA_BITS                   3
486#define ACPI_UART_9_DATA_BITS                   4
487
488/* Values for stop_bits field above */
489
490#define ACPI_UART_NO_STOP_BITS                  0
491#define ACPI_UART_1_STOP_BIT                    1
492#define ACPI_UART_1P5_STOP_BITS                 2
493#define ACPI_UART_2_STOP_BITS                   3
494
495/* Values for flow_control field above */
496
497#define ACPI_UART_FLOW_CONTROL_NONE             0
498#define ACPI_UART_FLOW_CONTROL_HW               1
499#define ACPI_UART_FLOW_CONTROL_XON_XOFF         2
500
501/* Values for Parity field above */
502
503#define ACPI_UART_PARITY_NONE                   0
504#define ACPI_UART_PARITY_EVEN                   1
505#define ACPI_UART_PARITY_ODD                    2
506#define ACPI_UART_PARITY_MARK                   3
507#define ACPI_UART_PARITY_SPACE                  4
508
509/* Values for lines_enabled bitfield above */
510
511#define ACPI_UART_CARRIER_DETECT                (1<<2)
512#define ACPI_UART_RING_INDICATOR                (1<<3)
513#define ACPI_UART_DATA_SET_READY                (1<<4)
514#define ACPI_UART_DATA_TERMINAL_READY           (1<<5)
515#define ACPI_UART_CLEAR_TO_SEND                 (1<<6)
516#define ACPI_UART_REQUEST_TO_SEND               (1<<7)
517
518struct acpi_resource_csi2_serialbus {
519	ACPI_RESOURCE_SERIAL_COMMON u8 local_port_instance;
520	u8 phy_type;
521};
522
523struct acpi_resource_pin_function {
524	u8 revision_id;
525	u8 pin_config;
526	u8 shareable;		/* For values, see Interrupt Attributes above */
527	u16 function_number;
528	u16 pin_table_length;
529	u16 vendor_length;
530	struct acpi_resource_source resource_source;
531	u16 *pin_table;
532	u8 *vendor_data;
533};
534
535struct acpi_resource_pin_config {
536	u8 revision_id;
537	u8 producer_consumer;	/* For values, see Producer/Consumer above */
538	u8 shareable;		/* For values, see Interrupt Attributes above */
539	u8 pin_config_type;
540	u32 pin_config_value;
541	u16 pin_table_length;
542	u16 vendor_length;
543	struct acpi_resource_source resource_source;
544	u16 *pin_table;
545	u8 *vendor_data;
546};
547
548struct acpi_resource_clock_input {
549	u8 revision_id;
550	u8 mode;
551	u8 scale;
552	u16 frequency_divisor;
553	u32 frequency_numerator;
554	struct acpi_resource_source resource_source;
555};
556
557/* Values for pin_config_type field above */
558
559#define ACPI_PIN_CONFIG_DEFAULT                 0
560#define ACPI_PIN_CONFIG_BIAS_PULL_UP            1
561#define ACPI_PIN_CONFIG_BIAS_PULL_DOWN          2
562#define ACPI_PIN_CONFIG_BIAS_DEFAULT            3
563#define ACPI_PIN_CONFIG_BIAS_DISABLE            4
564#define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE     5
565#define ACPI_PIN_CONFIG_BIAS_BUS_HOLD           6
566#define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN        7
567#define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE       8
568#define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL         9
569#define ACPI_PIN_CONFIG_DRIVE_STRENGTH          10
570#define ACPI_PIN_CONFIG_SLEW_RATE               11
571#define ACPI_PIN_CONFIG_INPUT_DEBOUNCE          12
572#define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER   13
573
574struct acpi_resource_pin_group {
575	u8 revision_id;
576	u8 producer_consumer;	/* For values, see Producer/Consumer above */
577	u16 pin_table_length;
578	u16 vendor_length;
579	u16 *pin_table;
580	struct acpi_resource_label resource_label;
581	u8 *vendor_data;
582};
583
584struct acpi_resource_pin_group_function {
585	u8 revision_id;
586	u8 producer_consumer;	/* For values, see Producer/Consumer above */
587	u8 shareable;		/* For values, see Interrupt Attributes above */
588	u16 function_number;
589	u16 vendor_length;
590	struct acpi_resource_source resource_source;
591	struct acpi_resource_label resource_source_label;
592	u8 *vendor_data;
593};
594
595struct acpi_resource_pin_group_config {
596	u8 revision_id;
597	u8 producer_consumer;	/* For values, see Producer/Consumer above */
598	u8 shareable;		/* For values, see Interrupt Attributes above */
599	u8 pin_config_type;	/* For values, see pin_config_type above */
600	u32 pin_config_value;
601	u16 vendor_length;
602	struct acpi_resource_source resource_source;
603	struct acpi_resource_label resource_source_label;
604	u8 *vendor_data;
605};
606
607/* ACPI_RESOURCE_TYPEs */
608
609#define ACPI_RESOURCE_TYPE_IRQ                  0
610#define ACPI_RESOURCE_TYPE_DMA                  1
611#define ACPI_RESOURCE_TYPE_START_DEPENDENT      2
612#define ACPI_RESOURCE_TYPE_END_DEPENDENT        3
613#define ACPI_RESOURCE_TYPE_IO                   4
614#define ACPI_RESOURCE_TYPE_FIXED_IO             5
615#define ACPI_RESOURCE_TYPE_VENDOR               6
616#define ACPI_RESOURCE_TYPE_END_TAG              7
617#define ACPI_RESOURCE_TYPE_MEMORY24             8
618#define ACPI_RESOURCE_TYPE_MEMORY32             9
619#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32       10
620#define ACPI_RESOURCE_TYPE_ADDRESS16            11
621#define ACPI_RESOURCE_TYPE_ADDRESS32            12
622#define ACPI_RESOURCE_TYPE_ADDRESS64            13
623#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64   14	/* ACPI 3.0 */
624#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ         15
625#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER     16
626#define ACPI_RESOURCE_TYPE_GPIO                 17	/* ACPI 5.0 */
627#define ACPI_RESOURCE_TYPE_FIXED_DMA            18	/* ACPI 5.0 */
628#define ACPI_RESOURCE_TYPE_SERIAL_BUS           19	/* ACPI 5.0 */
629#define ACPI_RESOURCE_TYPE_PIN_FUNCTION         20	/* ACPI 6.2 */
630#define ACPI_RESOURCE_TYPE_PIN_CONFIG           21	/* ACPI 6.2 */
631#define ACPI_RESOURCE_TYPE_PIN_GROUP            22	/* ACPI 6.2 */
632#define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION   23	/* ACPI 6.2 */
633#define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG     24	/* ACPI 6.2 */
634#define ACPI_RESOURCE_TYPE_CLOCK_INPUT          25	/* ACPI 6.5 */
635#define ACPI_RESOURCE_TYPE_MAX                  25
636
637/* Master union for resource descriptors */
638
639union acpi_resource_data {
640	struct acpi_resource_irq irq;
641	struct acpi_resource_dma dma;
642	struct acpi_resource_start_dependent start_dpf;
643	struct acpi_resource_io io;
644	struct acpi_resource_fixed_io fixed_io;
645	struct acpi_resource_fixed_dma fixed_dma;
646	struct acpi_resource_vendor vendor;
647	struct acpi_resource_vendor_typed vendor_typed;
648	struct acpi_resource_end_tag end_tag;
649	struct acpi_resource_memory24 memory24;
650	struct acpi_resource_memory32 memory32;
651	struct acpi_resource_fixed_memory32 fixed_memory32;
652	struct acpi_resource_address16 address16;
653	struct acpi_resource_address32 address32;
654	struct acpi_resource_address64 address64;
655	struct acpi_resource_extended_address64 ext_address64;
656	struct acpi_resource_extended_irq extended_irq;
657	struct acpi_resource_generic_register generic_reg;
658	struct acpi_resource_gpio gpio;
659	struct acpi_resource_i2c_serialbus i2c_serial_bus;
660	struct acpi_resource_spi_serialbus spi_serial_bus;
661	struct acpi_resource_uart_serialbus uart_serial_bus;
662	struct acpi_resource_csi2_serialbus csi2_serial_bus;
663	struct acpi_resource_common_serialbus common_serial_bus;
664	struct acpi_resource_pin_function pin_function;
665	struct acpi_resource_pin_config pin_config;
666	struct acpi_resource_pin_group pin_group;
667	struct acpi_resource_pin_group_function pin_group_function;
668	struct acpi_resource_pin_group_config pin_group_config;
669	struct acpi_resource_clock_input clock_input;
670
671	/* Common fields */
672
673	struct acpi_resource_address address;	/* Common 16/32/64 address fields */
674};
675
676/* Common resource header */
677
678struct acpi_resource {
679	u32 type;
680	u32 length;
681	union acpi_resource_data data;
682};
683
684/* restore default alignment */
685
686#pragma pack()
687
688#define ACPI_RS_SIZE_NO_DATA                8	/* Id + Length fields */
689#define ACPI_RS_SIZE_MIN                    (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
690#define ACPI_RS_SIZE(type)                  (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
691
692/* Macro for walking resource templates with multiple descriptors */
693
694#define ACPI_NEXT_RESOURCE(res) \
695	ACPI_ADD_PTR (struct acpi_resource, (res), (res)->length)
696
697struct acpi_pci_routing_table {
698	u32 length;
699	u32 pin;
700	u64 address;		/* here for 64-bit alignment */
701	u32 source_index;
702	union {
703		char pad[4];	/* pad to 64 bits so sizeof() works in all cases */
704		 ACPI_FLEX_ARRAY(char, source);
705	};
706};
707
708#endif				/* __ACRESTYP_H__ */