1
2
3
4
5
6
7
8
9
10 #ifndef __ACRESTYP_H__
11 #define __ACRESTYP_H__
12
13
14
15
16 typedef u16 acpi_rs_length;
17 typedef u32 acpi_rsdesc_size;
18
19
20
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
31
32
33
34
35
36
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
43
44 #define ACPI_SPARSE_TRANSLATION (u8) 0x01
45
46
47
48
49 #define ACPI_DECODE_10 (u8) 0x00
50 #define ACPI_DECODE_16 (u8) 0x01
51
52
53
54
55
56
57
58 #define ACPI_LEVEL_SENSITIVE (u8) 0x00
59 #define ACPI_EDGE_SENSITIVE (u8) 0x01
60
61
62
63 #define ACPI_ACTIVE_HIGH (u8) 0x00
64 #define ACPI_ACTIVE_LOW (u8) 0x01
65 #define ACPI_ACTIVE_BOTH (u8) 0x02
66
67
68
69 #define ACPI_EXCLUSIVE (u8) 0x00
70 #define ACPI_SHARED (u8) 0x01
71
72
73
74 #define ACPI_NOT_WAKE_CAPABLE (u8) 0x00
75 #define ACPI_WAKE_CAPABLE (u8) 0x01
76
77
78
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
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
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
113
114 #define ACPI_PRODUCER (u8) 0x00
115 #define ACPI_CONSUMER (u8) 0x01
116
117
118
119
120 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
121 #pragma pack(1)
122 #endif
123
124
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
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 u8 interrupts[1];
146 };
147
148 struct acpi_resource_dma {
149 u8 type;
150 u8 bus_master;
151 u8 transfer;
152 u8 channel_count;
153 u8 channels[1];
154 };
155
156 struct acpi_resource_start_dependent {
157 u8 descriptor_length;
158 u8 compatibility_priority;
159 u8 performance_robustness;
160 };
161
162
163
164
165
166
167 struct acpi_resource_io {
168 u8 io_decode;
169 u8 alignment;
170 u8 address_length;
171 u16 minimum;
172 u16 maximum;
173 };
174
175 struct acpi_resource_fixed_io {
176 u16 address;
177 u8 address_length;
178 };
179
180 struct acpi_resource_fixed_dma {
181 u16 request_lines;
182 u16 channels;
183 u8 width;
184 };
185
186
187
188 #define ACPI_DMA_WIDTH8 0
189 #define ACPI_DMA_WIDTH16 1
190 #define ACPI_DMA_WIDTH32 2
191 #define ACPI_DMA_WIDTH64 3
192 #define ACPI_DMA_WIDTH128 4
193 #define ACPI_DMA_WIDTH256 5
194
195 struct acpi_resource_vendor {
196 u16 byte_length;
197 u8 byte_data[1];
198 };
199
200
201
202 struct 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
209 struct acpi_resource_end_tag {
210 u8 checksum;
211 };
212
213 struct acpi_resource_memory24 {
214 u8 write_protect;
215 u16 minimum;
216 u16 maximum;
217 u16 alignment;
218 u16 address_length;
219 };
220
221 struct acpi_resource_memory32 {
222 u8 write_protect;
223 u32 minimum;
224 u32 maximum;
225 u32 alignment;
226 u32 address_length;
227 };
228
229 struct acpi_resource_fixed_memory32 {
230 u8 write_protect;
231 u32 address;
232 u32 address_length;
233 };
234
235 struct acpi_memory_attribute {
236 u8 write_protect;
237 u8 caching;
238 u8 range_type;
239 u8 translation;
240 };
241
242 struct acpi_io_attribute {
243 u8 range_type;
244 u8 translation;
245 u8 translation_type;
246 u8 reserved1;
247 };
248
249 union acpi_resource_attribute {
250 struct acpi_memory_attribute mem;
251 struct acpi_io_attribute io;
252
253
254
255 u8 type_specific;
256 };
257
258 struct acpi_resource_label {
259 u16 string_length;
260 char *string_ptr;
261 };
262
263 struct acpi_resource_source {
264 u8 index;
265 u16 string_length;
266 char *string_ptr;
267 };
268
269
270
271 #define ACPI_RESOURCE_ADDRESS_COMMON \
272 u8 resource_type; \
273 u8 producer_consumer; \
274 u8 decode; \
275 u8 min_address_fixed; \
276 u8 max_address_fixed; \
277 union acpi_resource_attribute info;
278
279 struct acpi_address16_attribute {
280 u16 granularity;
281 u16 minimum;
282 u16 maximum;
283 u16 translation_offset;
284 u16 address_length;
285 };
286
287 struct acpi_address32_attribute {
288 u32 granularity;
289 u32 minimum;
290 u32 maximum;
291 u32 translation_offset;
292 u32 address_length;
293 };
294
295 struct acpi_address64_attribute {
296 u64 granularity;
297 u64 minimum;
298 u64 maximum;
299 u64 translation_offset;
300 u64 address_length;
301 };
302
303 struct acpi_resource_address {
304 ACPI_RESOURCE_ADDRESS_COMMON};
305
306 struct acpi_resource_address16 {
307 ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address16_attribute address;
308 struct acpi_resource_source resource_source;
309 };
310
311 struct acpi_resource_address32 {
312 ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address32_attribute address;
313 struct acpi_resource_source resource_source;
314 };
315
316 struct acpi_resource_address64 {
317 ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address64_attribute address;
318 struct acpi_resource_source resource_source;
319 };
320
321 struct acpi_resource_extended_address64 {
322 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_ID;
323 struct acpi_address64_attribute address;
324 u64 type_specific;
325 };
326
327 struct acpi_resource_extended_irq {
328 u8 producer_consumer;
329 u8 triggering;
330 u8 polarity;
331 u8 shareable;
332 u8 wake_capable;
333 u8 interrupt_count;
334 struct acpi_resource_source resource_source;
335 u32 interrupts[1];
336 };
337
338 struct acpi_resource_generic_register {
339 u8 space_id;
340 u8 bit_width;
341 u8 bit_offset;
342 u8 access_size;
343 u64 address;
344 };
345
346 struct acpi_resource_gpio {
347 u8 revision_id;
348 u8 connection_type;
349 u8 producer_consumer;
350 u8 pin_config;
351 u8 shareable;
352 u8 wake_capable;
353 u8 io_restriction;
354 u8 triggering;
355 u8 polarity;
356 u16 drive_strength;
357 u16 debounce_timeout;
358 u16 pin_table_length;
359 u16 vendor_length;
360 struct acpi_resource_source resource_source;
361 u16 *pin_table;
362 u8 *vendor_data;
363 };
364
365
366
367 #define ACPI_RESOURCE_GPIO_TYPE_INT 0
368 #define ACPI_RESOURCE_GPIO_TYPE_IO 1
369
370
371
372 #define ACPI_PIN_CONFIG_DEFAULT 0
373 #define ACPI_PIN_CONFIG_PULLUP 1
374 #define ACPI_PIN_CONFIG_PULLDOWN 2
375 #define ACPI_PIN_CONFIG_NOPULL 3
376
377
378
379 #define ACPI_IO_RESTRICT_NONE 0
380 #define ACPI_IO_RESTRICT_INPUT 1
381 #define ACPI_IO_RESTRICT_OUTPUT 2
382 #define ACPI_IO_RESTRICT_NONE_PRESERVE 3
383
384
385
386 #define ACPI_RESOURCE_SERIAL_COMMON \
387 u8 revision_id; \
388 u8 type; \
389 u8 producer_consumer; \
390 u8 slave_mode; \
391 u8 connection_sharing; \
392 u8 type_revision_id; \
393 u16 type_data_length; \
394 u16 vendor_length; \
395 struct acpi_resource_source resource_source; \
396 u8 *vendor_data;
397
398 struct acpi_resource_common_serialbus {
399 ACPI_RESOURCE_SERIAL_COMMON};
400
401
402
403 #define ACPI_RESOURCE_SERIAL_TYPE_I2C 1
404 #define ACPI_RESOURCE_SERIAL_TYPE_SPI 2
405 #define ACPI_RESOURCE_SERIAL_TYPE_UART 3
406
407
408
409 #define ACPI_CONTROLLER_INITIATED 0
410 #define ACPI_DEVICE_INITIATED 1
411
412 struct acpi_resource_i2c_serialbus {
413 ACPI_RESOURCE_SERIAL_COMMON u8 access_mode;
414 u16 slave_address;
415 u32 connection_speed;
416 };
417
418
419
420 #define ACPI_I2C_7BIT_MODE 0
421 #define ACPI_I2C_10BIT_MODE 1
422
423 struct acpi_resource_spi_serialbus {
424 ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode;
425 u8 device_polarity;
426 u8 data_bit_length;
427 u8 clock_phase;
428 u8 clock_polarity;
429 u16 device_selection;
430 u32 connection_speed;
431 };
432
433
434
435 #define ACPI_SPI_4WIRE_MODE 0
436 #define ACPI_SPI_3WIRE_MODE 1
437
438
439
440 #define ACPI_SPI_ACTIVE_LOW 0
441 #define ACPI_SPI_ACTIVE_HIGH 1
442
443
444
445 #define ACPI_SPI_FIRST_PHASE 0
446 #define ACPI_SPI_SECOND_PHASE 1
447
448
449
450 #define ACPI_SPI_START_LOW 0
451 #define ACPI_SPI_START_HIGH 1
452
453 struct acpi_resource_uart_serialbus {
454 ACPI_RESOURCE_SERIAL_COMMON u8 endian;
455 u8 data_bits;
456 u8 stop_bits;
457 u8 flow_control;
458 u8 parity;
459 u8 lines_enabled;
460 u16 rx_fifo_size;
461 u16 tx_fifo_size;
462 u32 default_baud_rate;
463 };
464
465
466
467 #define ACPI_UART_LITTLE_ENDIAN 0
468 #define ACPI_UART_BIG_ENDIAN 1
469
470
471
472 #define ACPI_UART_5_DATA_BITS 0
473 #define ACPI_UART_6_DATA_BITS 1
474 #define ACPI_UART_7_DATA_BITS 2
475 #define ACPI_UART_8_DATA_BITS 3
476 #define ACPI_UART_9_DATA_BITS 4
477
478
479
480 #define ACPI_UART_NO_STOP_BITS 0
481 #define ACPI_UART_1_STOP_BIT 1
482 #define ACPI_UART_1P5_STOP_BITS 2
483 #define ACPI_UART_2_STOP_BITS 3
484
485
486
487 #define ACPI_UART_FLOW_CONTROL_NONE 0
488 #define ACPI_UART_FLOW_CONTROL_HW 1
489 #define ACPI_UART_FLOW_CONTROL_XON_XOFF 2
490
491
492
493 #define ACPI_UART_PARITY_NONE 0
494 #define ACPI_UART_PARITY_EVEN 1
495 #define ACPI_UART_PARITY_ODD 2
496 #define ACPI_UART_PARITY_MARK 3
497 #define ACPI_UART_PARITY_SPACE 4
498
499
500
501 #define ACPI_UART_CARRIER_DETECT (1<<2)
502 #define ACPI_UART_RING_INDICATOR (1<<3)
503 #define ACPI_UART_DATA_SET_READY (1<<4)
504 #define ACPI_UART_DATA_TERMINAL_READY (1<<5)
505 #define ACPI_UART_CLEAR_TO_SEND (1<<6)
506 #define ACPI_UART_REQUEST_TO_SEND (1<<7)
507
508 struct acpi_resource_pin_function {
509 u8 revision_id;
510 u8 pin_config;
511 u8 shareable;
512 u16 function_number;
513 u16 pin_table_length;
514 u16 vendor_length;
515 struct acpi_resource_source resource_source;
516 u16 *pin_table;
517 u8 *vendor_data;
518 };
519
520 struct acpi_resource_pin_config {
521 u8 revision_id;
522 u8 producer_consumer;
523 u8 shareable;
524 u8 pin_config_type;
525 u32 pin_config_value;
526 u16 pin_table_length;
527 u16 vendor_length;
528 struct acpi_resource_source resource_source;
529 u16 *pin_table;
530 u8 *vendor_data;
531 };
532
533
534
535 #define ACPI_PIN_CONFIG_DEFAULT 0
536 #define ACPI_PIN_CONFIG_BIAS_PULL_UP 1
537 #define ACPI_PIN_CONFIG_BIAS_PULL_DOWN 2
538 #define ACPI_PIN_CONFIG_BIAS_DEFAULT 3
539 #define ACPI_PIN_CONFIG_BIAS_DISABLE 4
540 #define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE 5
541 #define ACPI_PIN_CONFIG_BIAS_BUS_HOLD 6
542 #define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN 7
543 #define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE 8
544 #define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL 9
545 #define ACPI_PIN_CONFIG_DRIVE_STRENGTH 10
546 #define ACPI_PIN_CONFIG_SLEW_RATE 11
547 #define ACPI_PIN_CONFIG_INPUT_DEBOUNCE 12
548 #define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER 13
549
550 struct acpi_resource_pin_group {
551 u8 revision_id;
552 u8 producer_consumer;
553 u16 pin_table_length;
554 u16 vendor_length;
555 u16 *pin_table;
556 struct acpi_resource_label resource_label;
557 u8 *vendor_data;
558 };
559
560 struct acpi_resource_pin_group_function {
561 u8 revision_id;
562 u8 producer_consumer;
563 u8 shareable;
564 u16 function_number;
565 u16 vendor_length;
566 struct acpi_resource_source resource_source;
567 struct acpi_resource_label resource_source_label;
568 u8 *vendor_data;
569 };
570
571 struct acpi_resource_pin_group_config {
572 u8 revision_id;
573 u8 producer_consumer;
574 u8 shareable;
575 u8 pin_config_type;
576 u32 pin_config_value;
577 u16 vendor_length;
578 struct acpi_resource_source resource_source;
579 struct acpi_resource_label resource_source_label;
580 u8 *vendor_data;
581 };
582
583
584
585 #define ACPI_RESOURCE_TYPE_IRQ 0
586 #define ACPI_RESOURCE_TYPE_DMA 1
587 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
588 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
589 #define ACPI_RESOURCE_TYPE_IO 4
590 #define ACPI_RESOURCE_TYPE_FIXED_IO 5
591 #define ACPI_RESOURCE_TYPE_VENDOR 6
592 #define ACPI_RESOURCE_TYPE_END_TAG 7
593 #define ACPI_RESOURCE_TYPE_MEMORY24 8
594 #define ACPI_RESOURCE_TYPE_MEMORY32 9
595 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
596 #define ACPI_RESOURCE_TYPE_ADDRESS16 11
597 #define ACPI_RESOURCE_TYPE_ADDRESS32 12
598 #define ACPI_RESOURCE_TYPE_ADDRESS64 13
599 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14
600 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
601 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
602 #define ACPI_RESOURCE_TYPE_GPIO 17
603 #define ACPI_RESOURCE_TYPE_FIXED_DMA 18
604 #define ACPI_RESOURCE_TYPE_SERIAL_BUS 19
605 #define ACPI_RESOURCE_TYPE_PIN_FUNCTION 20
606 #define ACPI_RESOURCE_TYPE_PIN_CONFIG 21
607 #define ACPI_RESOURCE_TYPE_PIN_GROUP 22
608 #define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION 23
609 #define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG 24
610 #define ACPI_RESOURCE_TYPE_MAX 24
611
612
613
614 union acpi_resource_data {
615 struct acpi_resource_irq irq;
616 struct acpi_resource_dma dma;
617 struct acpi_resource_start_dependent start_dpf;
618 struct acpi_resource_io io;
619 struct acpi_resource_fixed_io fixed_io;
620 struct acpi_resource_fixed_dma fixed_dma;
621 struct acpi_resource_vendor vendor;
622 struct acpi_resource_vendor_typed vendor_typed;
623 struct acpi_resource_end_tag end_tag;
624 struct acpi_resource_memory24 memory24;
625 struct acpi_resource_memory32 memory32;
626 struct acpi_resource_fixed_memory32 fixed_memory32;
627 struct acpi_resource_address16 address16;
628 struct acpi_resource_address32 address32;
629 struct acpi_resource_address64 address64;
630 struct acpi_resource_extended_address64 ext_address64;
631 struct acpi_resource_extended_irq extended_irq;
632 struct acpi_resource_generic_register generic_reg;
633 struct acpi_resource_gpio gpio;
634 struct acpi_resource_i2c_serialbus i2c_serial_bus;
635 struct acpi_resource_spi_serialbus spi_serial_bus;
636 struct acpi_resource_uart_serialbus uart_serial_bus;
637 struct acpi_resource_common_serialbus common_serial_bus;
638 struct acpi_resource_pin_function pin_function;
639 struct acpi_resource_pin_config pin_config;
640 struct acpi_resource_pin_group pin_group;
641 struct acpi_resource_pin_group_function pin_group_function;
642 struct acpi_resource_pin_group_config pin_group_config;
643
644
645
646 struct acpi_resource_address address;
647 };
648
649
650
651 struct acpi_resource {
652 u32 type;
653 u32 length;
654 union acpi_resource_data data;
655 };
656
657
658
659 #pragma pack()
660
661 #define ACPI_RS_SIZE_NO_DATA 8
662 #define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
663 #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
664
665
666
667 #define ACPI_NEXT_RESOURCE(res) \
668 ACPI_ADD_PTR (struct acpi_resource, (res), (res)->length)
669
670 struct acpi_pci_routing_table {
671 u32 length;
672 u32 pin;
673 u64 address;
674 u32 source_index;
675 char source[4];
676 };
677
678 #endif