xref: /openbmc/linux/include/acpi/acrestyp.h (revision db66795f)
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  */
16 typedef u16 acpi_rs_length;	/* Resource Length field is fixed at 16 bits */
17 typedef 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 
126 struct acpi_uuid {
127 	u8 data[ACPI_UUID_LENGTH];
128 };
129 
130 struct acpi_vendor_uuid {
131 	u8 subtype;
132 	u8 data[ACPI_UUID_LENGTH];
133 };
134 
135 /*
136  * Structures used to describe device resources
137  */
138 struct 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 
151 struct 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 
162 struct 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 
173 struct acpi_resource_io {
174 	u8 io_decode;
175 	u8 alignment;
176 	u8 address_length;
177 	u16 minimum;
178 	u16 maximum;
179 };
180 
181 struct acpi_resource_fixed_io {
182 	u16 address;
183 	u8 address_length;
184 };
185 
186 struct 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 
201 struct 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 
208 struct acpi_resource_vendor_typed {
209 	u16 byte_length;
210 	u8 uuid_subtype;
211 	u8 uuid[ACPI_UUID_LENGTH];
212 	u8 byte_data[];
213 };
214 
215 struct acpi_resource_end_tag {
216 	u8 checksum;
217 };
218 
219 struct acpi_resource_memory24 {
220 	u8 write_protect;
221 	u16 minimum;
222 	u16 maximum;
223 	u16 alignment;
224 	u16 address_length;
225 };
226 
227 struct acpi_resource_memory32 {
228 	u8 write_protect;
229 	u32 minimum;
230 	u32 maximum;
231 	u32 alignment;
232 	u32 address_length;
233 };
234 
235 struct acpi_resource_fixed_memory32 {
236 	u8 write_protect;
237 	u32 address;
238 	u32 address_length;
239 };
240 
241 struct acpi_memory_attribute {
242 	u8 write_protect;
243 	u8 caching;
244 	u8 range_type;
245 	u8 translation;
246 };
247 
248 struct acpi_io_attribute {
249 	u8 range_type;
250 	u8 translation;
251 	u8 translation_type;
252 	u8 reserved1;
253 };
254 
255 union 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 
264 struct acpi_resource_label {
265 	u16 string_length;
266 	char *string_ptr;
267 };
268 
269 struct 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 
285 struct acpi_address16_attribute {
286 	u16 granularity;
287 	u16 minimum;
288 	u16 maximum;
289 	u16 translation_offset;
290 	u16 address_length;
291 };
292 
293 struct acpi_address32_attribute {
294 	u32 granularity;
295 	u32 minimum;
296 	u32 maximum;
297 	u32 translation_offset;
298 	u32 address_length;
299 };
300 
301 struct acpi_address64_attribute {
302 	u64 granularity;
303 	u64 minimum;
304 	u64 maximum;
305 	u64 translation_offset;
306 	u64 address_length;
307 };
308 
309 struct acpi_resource_address {
310 ACPI_RESOURCE_ADDRESS_COMMON};
311 
312 struct acpi_resource_address16 {
313 	ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address16_attribute address;
314 	struct acpi_resource_source resource_source;
315 };
316 
317 struct acpi_resource_address32 {
318 	ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address32_attribute address;
319 	struct acpi_resource_source resource_source;
320 };
321 
322 struct acpi_resource_address64 {
323 	ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address64_attribute address;
324 	struct acpi_resource_source resource_source;
325 };
326 
327 struct acpi_resource_extended_address64 {
328 	ACPI_RESOURCE_ADDRESS_COMMON u8 revision_ID;
329 	struct acpi_address64_attribute address;
330 	u64 type_specific;
331 };
332 
333 struct 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 
347 struct 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 
355 struct 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 
407 struct acpi_resource_common_serialbus {
408 ACPI_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 
422 struct 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 
433 struct 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 
463 struct 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 
518 struct acpi_resource_csi2_serialbus {
519 	ACPI_RESOURCE_SERIAL_COMMON u8 local_port_instance;
520 	u8 phy_type;
521 };
522 
523 struct 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 
535 struct 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 
548 struct 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 
574 struct 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 
584 struct 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 
595 struct 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 
639 union 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 
678 struct 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 
697 struct 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__ */
709