aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-09-30 19:03:00 -0400
committerLen Brown <len.brown@intel.com>2005-12-10 00:20:25 -0500
commit50eca3eb89d73d9f0aa070b126c7ee6a616016ab (patch)
treeb2d06d21b34b9bd17eea4c53cff1f3866fa1b21d /include/acpi
parent3d5271f9883cba7b54762bc4fe027d4172f06db7 (diff)
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acconfig.h2
-rw-r--r--include/acpi/acdisasm.h40
-rw-r--r--include/acpi/acglobal.h9
-rw-r--r--include/acpi/aclocal.h79
-rw-r--r--include/acpi/acmacros.h58
-rw-r--r--include/acpi/acpi_drivers.h4
-rw-r--r--include/acpi/acpixf.h3
-rw-r--r--include/acpi/acresrc.h313
-rw-r--r--include/acpi/actypes.h152
-rw-r--r--include/acpi/amlresrc.h242
10 files changed, 535 insertions, 367 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 1427c5cf4304..cb59b018c84c 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -63,7 +63,7 @@
63 63
64/* Current ACPICA subsystem version in YYYYMMDD format */ 64/* Current ACPICA subsystem version in YYYYMMDD format */
65 65
66#define ACPI_CA_VERSION 0x20050916 66#define ACPI_CA_VERSION 0x20050930
67 67
68/* 68/*
69 * OS name, used for the _OS object. The _OS object is essentially obsolete, 69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index 759b4cff4f88..b2921b869bb4 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -187,73 +187,67 @@ void acpi_dm_decode_attribute(u8 attribute);
187 * dmresrcl 187 * dmresrcl
188 */ 188 */
189void 189void
190acpi_dm_word_descriptor(union asl_resource_desc *resource, 190acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
191 u32 length, u32 level);
192 191
193void 192void
194acpi_dm_dword_descriptor(union asl_resource_desc *resource, 193acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
195 u32 length, u32 level);
196 194
197void 195void
198acpi_dm_extended_descriptor(union asl_resource_desc *resource, 196acpi_dm_extended_descriptor(union aml_resource *resource,
199 u32 length, u32 level); 197 u32 length, u32 level);
200 198
201void 199void
202acpi_dm_qword_descriptor(union asl_resource_desc *resource, 200acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
203 u32 length, u32 level);
204 201
205void 202void
206acpi_dm_memory24_descriptor(union asl_resource_desc *resource, 203acpi_dm_memory24_descriptor(union aml_resource *resource,
207 u32 length, u32 level); 204 u32 length, u32 level);
208 205
209void 206void
210acpi_dm_memory32_descriptor(union asl_resource_desc *resource, 207acpi_dm_memory32_descriptor(union aml_resource *resource,
211 u32 length, u32 level); 208 u32 length, u32 level);
212 209
213void 210void
214acpi_dm_fixed_memory32_descriptor(union asl_resource_desc *resource, 211acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
215 u32 length, u32 level); 212 u32 length, u32 level);
216 213
217void 214void
218acpi_dm_generic_register_descriptor(union asl_resource_desc *resource, 215acpi_dm_generic_register_descriptor(union aml_resource *resource,
219 u32 length, u32 level); 216 u32 length, u32 level);
220 217
221void 218void
222acpi_dm_interrupt_descriptor(union asl_resource_desc *resource, 219acpi_dm_interrupt_descriptor(union aml_resource *resource,
223 u32 length, u32 level); 220 u32 length, u32 level);
224 221
225void 222void
226acpi_dm_vendor_large_descriptor(union asl_resource_desc *resource, 223acpi_dm_vendor_large_descriptor(union aml_resource *resource,
227 u32 length, u32 level); 224 u32 length, u32 level);
228 225
229/* 226/*
230 * dmresrcs 227 * dmresrcs
231 */ 228 */
232void 229void
233acpi_dm_irq_descriptor(union asl_resource_desc *resource, 230acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
234 u32 length, u32 level);
235 231
236void 232void
237acpi_dm_dma_descriptor(union asl_resource_desc *resource, 233acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
238 u32 length, u32 level);
239 234
240void 235void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
241acpi_dm_io_descriptor(union asl_resource_desc *resource, u32 length, u32 level);
242 236
243void 237void
244acpi_dm_fixed_io_descriptor(union asl_resource_desc *resource, 238acpi_dm_fixed_io_descriptor(union aml_resource *resource,
245 u32 length, u32 level); 239 u32 length, u32 level);
246 240
247void 241void
248acpi_dm_start_dependent_descriptor(union asl_resource_desc *resource, 242acpi_dm_start_dependent_descriptor(union aml_resource *resource,
249 u32 length, u32 level); 243 u32 length, u32 level);
250 244
251void 245void
252acpi_dm_end_dependent_descriptor(union asl_resource_desc *resource, 246acpi_dm_end_dependent_descriptor(union aml_resource *resource,
253 u32 length, u32 level); 247 u32 length, u32 level);
254 248
255void 249void
256acpi_dm_vendor_small_descriptor(union asl_resource_desc *resource, 250acpi_dm_vendor_small_descriptor(union aml_resource *resource,
257 u32 length, u32 level); 251 u32 length, u32 level);
258 252
259/* 253/*
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index e9c2790139ec..cef51b1ddf94 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -80,6 +80,15 @@ extern u32 acpi_dbg_layer;
80 80
81extern u32 acpi_gbl_nesting_level; 81extern u32 acpi_gbl_nesting_level;
82 82
83/* Support for dynamic control method tracing mechanism */
84
85ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
86ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
87ACPI_EXTERN acpi_name acpi_gbl_trace_method_name;
88ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
89ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
90ACPI_EXTERN u32 acpi_gbl_trace_flags;
91
83/***************************************************************************** 92/*****************************************************************************
84 * 93 *
85 * Runtime configuration (static defaults that can be overriden at runtime) 94 * Runtime configuration (static defaults that can be overriden at runtime)
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 76ac1533c405..dca0d40ea395 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -735,59 +735,52 @@ struct acpi_bit_register_info {
735 735
736/* resource_type values */ 736/* resource_type values */
737 737
738#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 738#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
739#define ACPI_RESOURCE_TYPE_IO_RANGE 1 739#define ACPI_ADDRESS_TYPE_IO_RANGE 1
740#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 740#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
741 741
742/* Resource descriptor types and masks */ 742/* Resource descriptor types and masks */
743 743
744#define ACPI_RDESC_TYPE_LARGE 0x80 744#define ACPI_RESOURCE_NAME_LARGE 0x80
745#define ACPI_RDESC_TYPE_SMALL 0x00 745#define ACPI_RESOURCE_NAME_SMALL 0x00
746 746
747#define ACPI_RDESC_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ 747#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
748#define ACPI_RDESC_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ 748#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
749#define ACPI_RDESC_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ 749#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
750 750
751/* 751/*
752 * Small resource descriptor types 752 * Small resource descriptor "names" as defined by the ACPI specification.
753 * Note: Bits 2:0 are used for the descriptor length 753 * Note: Bits 2:0 are used for the descriptor length
754 */ 754 */
755#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 755#define ACPI_RESOURCE_NAME_IRQ 0x20
756#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 756#define ACPI_RESOURCE_NAME_DMA 0x28
757#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 757#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
758#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 758#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
759#define ACPI_RDESC_TYPE_IO_PORT 0x40 759#define ACPI_RESOURCE_NAME_IO 0x40
760#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 760#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
761#define ACPI_RDESC_TYPE_RESERVED_S1 0x50 761#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
762#define ACPI_RDESC_TYPE_RESERVED_S2 0x58 762#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
763#define ACPI_RDESC_TYPE_RESERVED_S3 0x60 763#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
764#define ACPI_RDESC_TYPE_RESERVED_S4 0x68 764#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
765#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 765#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
766#define ACPI_RDESC_TYPE_END_TAG 0x78 766#define ACPI_RESOURCE_NAME_END_TAG 0x78
767 767
768/* 768/*
769 * Large resource descriptor types 769 * Large resource descriptor "names" as defined by the ACPI specification.
770 * Note: includes the Large Descriptor bit in bit[7]
770 */ 771 */
771#define ACPI_RDESC_TYPE_MEMORY_24 0x81 772#define ACPI_RESOURCE_NAME_MEMORY24 0x81
772#define ACPI_RDESC_TYPE_GENERIC_REGISTER 0x82 773#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
773#define ACPI_RDESC_TYPE_RESERVED_L1 0x83 774#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
774#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 775#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
775#define ACPI_RDESC_TYPE_MEMORY_32 0x85 776#define ACPI_RESOURCE_NAME_MEMORY32 0x85
776#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 777#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
777#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 778#define ACPI_RESOURCE_NAME_ADDRESS32 0x87
778#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 779#define ACPI_RESOURCE_NAME_ADDRESS16 0x88
779#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 780#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
780#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A 781#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
781#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B 782#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
782#define ACPI_RDESC_LARGE_MAX 0x8B 783#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
783
784/*
785 * Minimum lengths for descriptors with optional fields
786 */
787#define ACPI_RDESC_QWORD_MIN 43
788#define ACPI_RDESC_DWORD_MIN 23
789#define ACPI_RDESC_WORD_MIN 13
790#define ACPI_RDESC_EXT_XRUPT_MIN 6
791 784
792/***************************************************************************** 785/*****************************************************************************
793 * 786 *
@@ -795,7 +788,7 @@ struct acpi_bit_register_info {
795 * 788 *
796 ****************************************************************************/ 789 ****************************************************************************/
797 790
798#define ACPI_ASCII_ZERO 0x30 791#define ACPI_ASCII_ZERO 0x30
799 792
800/***************************************************************************** 793/*****************************************************************************
801 * 794 *
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 702cc4e57f5f..258cfe5e2aac 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -525,6 +525,9 @@
525 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 525 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
526 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 526 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
527 * so that "_acpi_function_name" is defined. 527 * so that "_acpi_function_name" is defined.
528 *
529 * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
530 * about these constructs.
528 */ 531 */
529#ifdef ACPI_USE_DO_WHILE_0 532#ifdef ACPI_USE_DO_WHILE_0
530#define ACPI_DO_WHILE0(a) do a while(0) 533#define ACPI_DO_WHILE0(a) do a while(0)
@@ -532,10 +535,55 @@
532#define ACPI_DO_WHILE0(a) a 535#define ACPI_DO_WHILE0(a) a
533#endif 536#endif
534 537
535#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) 538#define return_VOID ACPI_DO_WHILE0 ({ \
536#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) 539 acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
537#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) 540 return;})
538#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) 541/*
542 * There are two versions of most of the return macros. The default version is
543 * safer, since it avoids side-effects by guaranteeing that the argument will
544 * not be evaluated twice.
545 *
546 * A less-safe version of the macros is provided for optional use if the
547 * compiler uses excessive CPU stack (for example, this may happen in the
548 * debug case if code optimzation is disabled.)
549 */
550#ifndef ACPI_SIMPLE_RETURN_MACROS
551
552#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
553 register acpi_status _s = (s); \
554 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \
555 return (_s); })
556#define return_PTR(s) ACPI_DO_WHILE0 ({ \
557 register void *_s = (void *) (s); \
558 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
559 return (_s); })
560#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
561 register acpi_integer _s = (s); \
562 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
563 return (_s); })
564#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
565 register u8 _s = (u8) (s); \
566 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
567 return (_s); })
568#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
569 register u32 _s = (u32) (s); \
570 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
571 return (_s); })
572#else /* Use original less-safe macros */
573
574#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
575 acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \
576 return((s)); })
577#define return_PTR(s) ACPI_DO_WHILE0 ({ \
578 acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
579 return((s)); })
580#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
581 acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \
582 return((s)); })
583#define return_UINT8(s) return_VALUE(s)
584#define return_UINT32(s) return_VALUE(s)
585
586#endif /* ACPI_SIMPLE_RETURN_MACROS */
539 587
540/* Conditional execution */ 588/* Conditional execution */
541 589
@@ -612,6 +660,8 @@
612#define return_VOID return 660#define return_VOID return
613#define return_ACPI_STATUS(s) return(s) 661#define return_ACPI_STATUS(s) return(s)
614#define return_VALUE(s) return(s) 662#define return_VALUE(s) return(s)
663#define return_UINT8(s) return(s)
664#define return_UINT32(s) return(s)
615#define return_PTR(s) return(s) 665#define return_PTR(s) return(s)
616 666
617#endif 667#endif
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index c1b4e1f882e4..b425f9bb6d43 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -52,8 +52,8 @@
52/* ACPI PCI Interrupt Link (pci_link.c) */ 52/* ACPI PCI Interrupt Link (pci_link.c) */
53 53
54int acpi_irq_penalty_init(void); 54int acpi_irq_penalty_init(void);
55int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level, 55int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering,
56 int *active_high_low, char **name); 56 int *polarity, char **name);
57int acpi_pci_link_free_irq(acpi_handle handle); 57int acpi_pci_link_free_irq(acpi_handle handle);
58 58
59/* ACPI PCI Interrupt Routing (pci_irq.c) */ 59/* ACPI PCI Interrupt Routing (pci_irq.c) */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 2a9dbc13b0f2..02f00a8fee03 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -149,6 +149,9 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler);
149acpi_status 149acpi_status
150acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); 150acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data);
151 151
152acpi_status
153acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags);
154
152/* 155/*
153 * Object manipulation and enumeration 156 * Object manipulation and enumeration
154 */ 157 */
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index ce2cf72fd4c8..b66994e9e4ee 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -44,6 +44,51 @@
44#ifndef __ACRESRC_H__ 44#ifndef __ACRESRC_H__
45#define __ACRESRC_H__ 45#define __ACRESRC_H__
46 46
47/* Need the AML resource descriptor structs */
48
49#include "amlresrc.h"
50
51/*
52 * Resource dispatch and info tables
53 */
54struct acpi_resource_info {
55 u8 length_type;
56 u8 minimum_aml_resource_length;
57 u8 minimum_internal_struct_length;
58};
59
60/* Types for length_type above */
61
62#define ACPI_FIXED_LENGTH 0
63#define ACPI_VARIABLE_LENGTH 1
64#define ACPI_SMALL_VARIABLE_LENGTH 2
65
66/* Handlers */
67
68typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource *
69 resource,
70 union aml_resource * aml);
71
72typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml,
73 u16 aml_resource_length,
74 struct acpi_resource *
75 resource);
76
77typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data);
78
79/* Tables indexed by internal resource type */
80
81extern u8 acpi_gbl_aml_resource_sizes[];
82extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[];
83extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[];
84
85/* Tables indexed by raw AML resource descriptor type */
86
87extern struct acpi_resource_info acpi_gbl_sm_resource_info[];
88extern struct acpi_resource_info acpi_gbl_lg_resource_info[];
89extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[];
90extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[];
91
47/* 92/*
48 * Function prototypes called from Acpi* APIs 93 * Function prototypes called from Acpi* APIs
49 */ 94 */
@@ -66,12 +111,12 @@ acpi_status
66acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 111acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
67 112
68acpi_status 113acpi_status
69acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, 114acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
70 struct acpi_buffer *output_buffer); 115 struct acpi_buffer *output_buffer);
71 116
72acpi_status 117acpi_status
73acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, 118acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
74 struct acpi_buffer *output_buffer); 119 struct acpi_buffer *output_buffer);
75 120
76acpi_status 121acpi_status
77acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 122acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
@@ -90,184 +135,240 @@ void acpi_rs_dump_irq_list(u8 * route_table);
90 * rscalc 135 * rscalc
91 */ 136 */
92acpi_status 137acpi_status
93acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, 138acpi_rs_get_list_length(u8 * aml_buffer,
94 u8 ** byte_stream_start, u32 * size); 139 u32 aml_buffer_length, acpi_size * size_needed);
95
96acpi_status
97acpi_rs_get_list_length(u8 * byte_stream_buffer,
98 u32 byte_stream_buffer_length, acpi_size * size_needed);
99 140
100acpi_status 141acpi_status
101acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, 142acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
102 acpi_size * size_needed); 143 acpi_size * size_needed);
103 144
104acpi_status 145acpi_status
105acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, 146acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
106 acpi_size * buffer_size_needed); 147 acpi_size * buffer_size_needed);
107 148
108acpi_status 149acpi_status
109acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, 150acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
110 u32 byte_stream_buffer_length, u8 * output_buffer); 151 u32 aml_buffer_length, u8 * output_buffer);
111 152
112acpi_status 153acpi_status
113acpi_rs_list_to_byte_stream(struct acpi_resource *resource, 154acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
114 acpi_size byte_stream_size_needed, 155 acpi_size aml_size_needed, u8 * output_buffer);
115 u8 * output_buffer);
116 156
157/*
158 * rsio
159 */
117acpi_status 160acpi_status
118acpi_rs_io_resource(u8 * byte_stream_buffer, 161acpi_rs_get_io(union aml_resource *aml,
119 acpi_size * bytes_consumed, 162 u16 aml_resource_length, struct acpi_resource *resource);
120 u8 ** output_buffer, acpi_size * structure_size);
121 163
122acpi_status 164acpi_status
123acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, 165acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml);
124 acpi_size * bytes_consumed,
125 u8 ** output_buffer, acpi_size * structure_size);
126 166
127acpi_status 167acpi_status
128acpi_rs_io_stream(struct acpi_resource *resource, 168acpi_rs_get_fixed_io(union aml_resource *aml,
129 u8 ** output_buffer, acpi_size * bytes_consumed); 169 u16 aml_resource_length, struct acpi_resource *resource);
130 170
131acpi_status 171acpi_status
132acpi_rs_fixed_io_stream(struct acpi_resource *resource, 172acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml);
133 u8 ** output_buffer, acpi_size * bytes_consumed);
134 173
135acpi_status 174acpi_status
136acpi_rs_irq_resource(u8 * byte_stream_buffer, 175acpi_rs_get_dma(union aml_resource *aml,
137 acpi_size * bytes_consumed, 176 u16 aml_resource_length, struct acpi_resource *resource);
138 u8 ** output_buffer, acpi_size * structure_size);
139 177
140acpi_status 178acpi_status
141acpi_rs_irq_stream(struct acpi_resource *resource, 179acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml);
142 u8 ** output_buffer, acpi_size * bytes_consumed);
143 180
181/*
182 * rsirq
183 */
144acpi_status 184acpi_status
145acpi_rs_dma_resource(u8 * byte_stream_buffer, 185acpi_rs_get_irq(union aml_resource *aml,
146 acpi_size * bytes_consumed, 186 u16 aml_resource_length, struct acpi_resource *resource);
147 u8 ** output_buffer, acpi_size * structure_size);
148 187
149acpi_status 188acpi_status
150acpi_rs_dma_stream(struct acpi_resource *resource, 189acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml);
151 u8 ** output_buffer, acpi_size * bytes_consumed);
152 190
153acpi_status 191acpi_status
154acpi_rs_address16_resource(u8 * byte_stream_buffer, 192acpi_rs_get_ext_irq(union aml_resource *aml,
155 acpi_size * bytes_consumed, 193 u16 aml_resource_length, struct acpi_resource *resource);
156 u8 ** output_buffer, acpi_size * structure_size);
157 194
158acpi_status 195acpi_status
159acpi_rs_address16_stream(struct acpi_resource *resource, 196acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml);
160 u8 ** output_buffer, acpi_size * bytes_consumed); 197
198/*
199 * rsaddr
200 */
201acpi_status
202acpi_rs_get_address16(union aml_resource *aml,
203 u16 aml_resource_length, struct acpi_resource *resource);
161 204
162acpi_status 205acpi_status
163acpi_rs_address32_resource(u8 * byte_stream_buffer, 206acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml);
164 acpi_size * bytes_consumed,
165 u8 ** output_buffer, acpi_size * structure_size);
166 207
167acpi_status 208acpi_status
168acpi_rs_address32_stream(struct acpi_resource *resource, 209acpi_rs_get_address32(union aml_resource *aml,
169 u8 ** output_buffer, acpi_size * bytes_consumed); 210 u16 aml_resource_length, struct acpi_resource *resource);
170 211
171acpi_status 212acpi_status
172acpi_rs_address64_resource(u8 * byte_stream_buffer, 213acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml);
173 acpi_size * bytes_consumed,
174 u8 ** output_buffer, acpi_size * structure_size);
175 214
176acpi_status 215acpi_status
177acpi_rs_address64_stream(struct acpi_resource *resource, 216acpi_rs_get_address64(union aml_resource *aml,
178 u8 ** output_buffer, acpi_size * bytes_consumed); 217 u16 aml_resource_length, struct acpi_resource *resource);
179 218
180acpi_status 219acpi_status
181acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, 220acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml);
182 acpi_size * bytes_consumed, 221
183 u8 ** output_buffer, 222acpi_status
184 acpi_size * structure_size); 223acpi_rs_get_ext_address64(union aml_resource *aml,
224 u16 aml_resource_length,
225 struct acpi_resource *resource);
226
227acpi_status
228acpi_rs_set_ext_address64(struct acpi_resource *resource,
229 union aml_resource *aml);
230
231/*
232 * rsmemory
233 */
234acpi_status
235acpi_rs_get_memory24(union aml_resource *aml,
236 u16 aml_resource_length, struct acpi_resource *resource);
185 237
186acpi_status 238acpi_status
187acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, 239acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml);
188 acpi_size * bytes_consumed,
189 u8 ** output_buffer,
190 acpi_size * structure_size);
191 240
192acpi_status 241acpi_status
193acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, 242acpi_rs_get_memory32(union aml_resource *aml,
194 u8 ** output_buffer, 243 u16 aml_resource_length, struct acpi_resource *resource);
195 acpi_size * bytes_consumed);
196 244
197acpi_status 245acpi_status
198acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, 246acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml);
199 u8 ** output_buffer, acpi_size * bytes_consumed);
200 247
201acpi_status 248acpi_status
202acpi_rs_memory24_resource(u8 * byte_stream_buffer, 249acpi_rs_get_fixed_memory32(union aml_resource *aml,
203 acpi_size * bytes_consumed, 250 u16 aml_resource_length,
204 u8 ** output_buffer, acpi_size * structure_size); 251 struct acpi_resource *resource);
205 252
206acpi_status 253acpi_status
207acpi_rs_memory24_stream(struct acpi_resource *resource, 254acpi_rs_set_fixed_memory32(struct acpi_resource *resource,
208 u8 ** output_buffer, acpi_size * bytes_consumed); 255 union aml_resource *aml);
209 256
257/*
258 * rsmisc
259 */
210acpi_status 260acpi_status
211acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, 261acpi_rs_get_generic_reg(union aml_resource *aml,
212 acpi_size * bytes_consumed, 262 u16 aml_resource_length,
213 u8 ** output_buffer, 263 struct acpi_resource *resource);
214 acpi_size * structure_size);
215 264
216acpi_status 265acpi_status
217acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, 266acpi_rs_set_generic_reg(struct acpi_resource *resource,
218 acpi_size * bytes_consumed, 267 union aml_resource *aml);
219 u8 ** output_buffer,
220 acpi_size * structure_size);
221 268
222acpi_status 269acpi_status
223acpi_rs_memory32_range_stream(struct acpi_resource *resource, 270acpi_rs_get_vendor(union aml_resource *aml,
224 u8 ** output_buffer, acpi_size * bytes_consumed); 271 u16 aml_resource_length, struct acpi_resource *resource);
225 272
226acpi_status 273acpi_status
227acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, 274acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml);
228 u8 ** output_buffer, acpi_size * bytes_consumed);
229 275
230acpi_status 276acpi_status
231acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, 277acpi_rs_get_start_dpf(union aml_resource *aml,
232 acpi_size * bytes_consumed, 278 u16 aml_resource_length, struct acpi_resource *resource);
233 u8 ** output_buffer, acpi_size * structure_size);
234 279
235acpi_status 280acpi_status
236acpi_rs_extended_irq_stream(struct acpi_resource *resource, 281acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml);
237 u8 ** output_buffer, acpi_size * bytes_consumed);
238 282
239acpi_status 283acpi_status
240acpi_rs_end_tag_resource(u8 * byte_stream_buffer, 284acpi_rs_get_end_dpf(union aml_resource *aml,
241 acpi_size * bytes_consumed, 285 u16 aml_resource_length, struct acpi_resource *resource);
242 u8 ** output_buffer, acpi_size * structure_size);
243 286
244acpi_status 287acpi_status
245acpi_rs_end_tag_stream(struct acpi_resource *resource, 288acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml);
246 u8 ** output_buffer, acpi_size * bytes_consumed);
247 289
248acpi_status 290acpi_status
249acpi_rs_vendor_resource(u8 * byte_stream_buffer, 291acpi_rs_get_end_tag(union aml_resource *aml,
250 acpi_size * bytes_consumed, 292 u16 aml_resource_length, struct acpi_resource *resource);
251 u8 ** output_buffer, acpi_size * structure_size);
252 293
253acpi_status 294acpi_status
254acpi_rs_vendor_stream(struct acpi_resource *resource, 295acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml);
255 u8 ** output_buffer, acpi_size * bytes_consumed); 296
297/*
298 * rsutils
299 */
300void
301acpi_rs_move_data(void *destination,
302 void *source, u16 item_count, u8 move_type);
303
304/* Types used in move_type above */
305
306#define ACPI_MOVE_TYPE_16_TO_32 0
307#define ACPI_MOVE_TYPE_32_TO_16 1
308#define ACPI_MOVE_TYPE_32_TO_32 2
309#define ACPI_MOVE_TYPE_64_TO_64 3
310
311u16
312acpi_rs_get_resource_source(u16 resource_length,
313 acpi_size minimum_length,
314 struct acpi_resource_source *resource_source,
315 union aml_resource *aml, char *string_ptr);
316
317acpi_size
318acpi_rs_set_resource_source(union aml_resource *aml,
319 acpi_size minimum_length,
320 struct acpi_resource_source *resource_source);
256 321
257u8 acpi_rs_get_resource_type(u8 resource_start_byte); 322u8 acpi_rs_get_resource_type(u8 resource_start_byte);
258 323
324u32 acpi_rs_get_descriptor_length(union aml_resource *aml);
325
326u16 acpi_rs_get_resource_length(union aml_resource *aml);
327
328void
329acpi_rs_set_resource_header(u8 descriptor_type,
330 acpi_size total_length, union aml_resource *aml);
331
332struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type);
333
334#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
259/* 335/*
260 * rsmisc 336 * rsdump
261 */ 337 */
262acpi_status 338void acpi_rs_dump_irq(union acpi_resource_data *resource);
263acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
264 acpi_size * bytes_consumed,
265 u8 ** output_buffer,
266 acpi_size * structure_size);
267 339
268acpi_status 340void acpi_rs_dump_address16(union acpi_resource_data *resource);
269acpi_rs_generic_register_stream(struct acpi_resource *resource, 341
270 u8 ** output_buffer, 342void acpi_rs_dump_address32(union acpi_resource_data *resource);
271 acpi_size * bytes_consumed); 343
344void acpi_rs_dump_address64(union acpi_resource_data *resource);
345
346void acpi_rs_dump_ext_address64(union acpi_resource_data *resource);
347
348void acpi_rs_dump_dma(union acpi_resource_data *resource);
349
350void acpi_rs_dump_io(union acpi_resource_data *resource);
351
352void acpi_rs_dump_ext_irq(union acpi_resource_data *resource);
353
354void acpi_rs_dump_fixed_io(union acpi_resource_data *resource);
355
356void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource);
357
358void acpi_rs_dump_memory24(union acpi_resource_data *resource);
359
360void acpi_rs_dump_memory32(union acpi_resource_data *resource);
361
362void acpi_rs_dump_start_dpf(union acpi_resource_data *resource);
363
364void acpi_rs_dump_vendor(union acpi_resource_data *resource);
365
366void acpi_rs_dump_generic_reg(union acpi_resource_data *resource);
367
368void acpi_rs_dump_end_dpf(union acpi_resource_data *resource);
369
370void acpi_rs_dump_end_tag(union acpi_resource_data *resource);
371
372#endif
272 373
273#endif /* __ACRESRC_H__ */ 374#endif /* __ACRESRC_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 1dfa64fae4ec..43f7c509317a 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -978,10 +978,10 @@ struct acpi_mem_space_context {
978 * Structures used to describe device resources 978 * Structures used to describe device resources
979 */ 979 */
980struct acpi_resource_irq { 980struct acpi_resource_irq {
981 u32 edge_level; 981 u32 triggering;
982 u32 active_high_low; 982 u32 polarity;
983 u32 shared_exclusive; 983 u32 sharable;
984 u32 number_of_interrupts; 984 u32 interrupt_count;
985 u32 interrupts[1]; 985 u32 interrupts[1];
986}; 986};
987 987
@@ -989,11 +989,11 @@ struct acpi_resource_dma {
989 u32 type; 989 u32 type;
990 u32 bus_master; 990 u32 bus_master;
991 u32 transfer; 991 u32 transfer;
992 u32 number_of_channels; 992 u32 channel_count;
993 u32 channels[1]; 993 u32 channels[1];
994}; 994};
995 995
996struct acpi_resource_start_dpf { 996struct acpi_resource_start_dependent {
997 u32 compatibility_priority; 997 u32 compatibility_priority;
998 u32 performance_robustness; 998 u32 performance_robustness;
999}; 999};
@@ -1005,46 +1005,46 @@ struct acpi_resource_start_dpf {
1005 1005
1006struct acpi_resource_io { 1006struct acpi_resource_io {
1007 u32 io_decode; 1007 u32 io_decode;
1008 u32 min_base_address; 1008 u32 minimum;
1009 u32 max_base_address; 1009 u32 maximum;
1010 u32 alignment; 1010 u32 alignment;
1011 u32 range_length; 1011 u32 address_length;
1012}; 1012};
1013 1013
1014struct acpi_resource_fixed_io { 1014struct acpi_resource_fixed_io {
1015 u32 base_address; 1015 u32 address;
1016 u32 range_length; 1016 u32 address_length;
1017}; 1017};
1018 1018
1019struct acpi_resource_vendor { 1019struct acpi_resource_vendor {
1020 u32 length; 1020 u32 byte_length;
1021 u8 reserved[1]; 1021 u8 byte_data[1];
1022}; 1022};
1023 1023
1024struct acpi_resource_end_tag { 1024struct acpi_resource_end_tag {
1025 u8 checksum; 1025 u8 checksum;
1026}; 1026};
1027 1027
1028struct acpi_resource_mem24 { 1028struct acpi_resource_memory24 {
1029 u32 read_write_attribute; 1029 u32 read_write_attribute;
1030 u32 min_base_address; 1030 u32 minimum;
1031 u32 max_base_address; 1031 u32 maximum;
1032 u32 alignment; 1032 u32 alignment;
1033 u32 range_length; 1033 u32 address_length;
1034}; 1034};
1035 1035
1036struct acpi_resource_mem32 { 1036struct acpi_resource_memory32 {
1037 u32 read_write_attribute; 1037 u32 read_write_attribute;
1038 u32 min_base_address; 1038 u32 minimum;
1039 u32 max_base_address; 1039 u32 maximum;
1040 u32 alignment; 1040 u32 alignment;
1041 u32 range_length; 1041 u32 address_length;
1042}; 1042};
1043 1043
1044struct acpi_resource_fixed_mem32 { 1044struct acpi_resource_fixed_memory32 {
1045 u32 read_write_attribute; 1045 u32 read_write_attribute;
1046 u32 range_base_address; 1046 u32 address;
1047 u32 range_length; 1047 u32 address_length;
1048}; 1048};
1049 1049
1050struct acpi_memory_attribute { 1050struct acpi_memory_attribute {
@@ -1089,93 +1089,105 @@ ACPI_RESOURCE_ADDRESS_COMMON};
1089 1089
1090struct acpi_resource_address16 { 1090struct acpi_resource_address16 {
1091 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; 1091 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
1092 u32 min_address_range; 1092 u32 minimum;
1093 u32 max_address_range; 1093 u32 maximum;
1094 u32 address_translation_offset; 1094 u32 translation_offset;
1095 u32 address_length; 1095 u32 address_length;
1096 struct acpi_resource_source resource_source; 1096 struct acpi_resource_source resource_source;
1097}; 1097};
1098 1098
1099struct acpi_resource_address32 { 1099struct acpi_resource_address32 {
1100 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; 1100 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
1101 u32 min_address_range; 1101 u32 minimum;
1102 u32 max_address_range; 1102 u32 maximum;
1103 u32 address_translation_offset; 1103 u32 translation_offset;
1104 u32 address_length; 1104 u32 address_length;
1105 struct acpi_resource_source resource_source; 1105 struct acpi_resource_source resource_source;
1106}; 1106};
1107 1107
1108struct acpi_resource_address64 { 1108struct acpi_resource_address64 {
1109 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; 1109 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
1110 u64 min_address_range; 1110 u64 minimum;
1111 u64 max_address_range; 1111 u64 maximum;
1112 u64 address_translation_offset; 1112 u64 translation_offset;
1113 u64 address_length; 1113 u64 address_length;
1114 u64 type_specific_attributes;
1115 struct acpi_resource_source resource_source; 1114 struct acpi_resource_source resource_source;
1116}; 1115};
1117 1116
1118struct acpi_resource_ext_irq { 1117struct acpi_resource_extended_address64 {
1118 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
1119 u64 minimum;
1120 u64 maximum;
1121 u64 translation_offset;
1122 u64 address_length;
1123 u64 type_specific_attributes;
1124 u8 revision_iD;
1125};
1126
1127struct acpi_resource_extended_irq {
1119 u32 producer_consumer; 1128 u32 producer_consumer;
1120 u32 edge_level; 1129 u32 triggering;
1121 u32 active_high_low; 1130 u32 polarity;
1122 u32 shared_exclusive; 1131 u32 sharable;
1123 u32 number_of_interrupts; 1132 u32 interrupt_count;
1124 struct acpi_resource_source resource_source; 1133 struct acpi_resource_source resource_source;
1125 u32 interrupts[1]; 1134 u32 interrupts[1];
1126}; 1135};
1127 1136
1128struct acpi_resource_generic_reg { 1137struct acpi_resource_generic_register {
1129 u32 space_id; 1138 u32 space_id;
1130 u32 bit_width; 1139 u32 bit_width;
1131 u32 bit_offset; 1140 u32 bit_offset;
1132 u32 address_size; 1141 u32 access_size;
1133 u64 address; 1142 u64 address;
1134}; 1143};
1135 1144
1136/* ACPI_RESOURCE_TYPEs */ 1145/* ACPI_RESOURCE_TYPEs */
1137 1146
1138#define ACPI_RSTYPE_IRQ 0 1147#define ACPI_RESOURCE_TYPE_IRQ 0
1139#define ACPI_RSTYPE_DMA 1 1148#define ACPI_RESOURCE_TYPE_DMA 1
1140#define ACPI_RSTYPE_START_DPF 2 1149#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
1141#define ACPI_RSTYPE_END_DPF 3 1150#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
1142#define ACPI_RSTYPE_IO 4 1151#define ACPI_RESOURCE_TYPE_IO 4
1143#define ACPI_RSTYPE_FIXED_IO 5 1152#define ACPI_RESOURCE_TYPE_FIXED_IO 5
1144#define ACPI_RSTYPE_VENDOR 6 1153#define ACPI_RESOURCE_TYPE_VENDOR 6
1145#define ACPI_RSTYPE_END_TAG 7 1154#define ACPI_RESOURCE_TYPE_END_TAG 7
1146#define ACPI_RSTYPE_MEM24 8 1155#define ACPI_RESOURCE_TYPE_MEMORY24 8
1147#define ACPI_RSTYPE_MEM32 9 1156#define ACPI_RESOURCE_TYPE_MEMORY32 9
1148#define ACPI_RSTYPE_FIXED_MEM32 10 1157#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
1149#define ACPI_RSTYPE_ADDRESS16 11 1158#define ACPI_RESOURCE_TYPE_ADDRESS16 11
1150#define ACPI_RSTYPE_ADDRESS32 12 1159#define ACPI_RESOURCE_TYPE_ADDRESS32 12
1151#define ACPI_RSTYPE_ADDRESS64 13 1160#define ACPI_RESOURCE_TYPE_ADDRESS64 13
1152#define ACPI_RSTYPE_EXT_IRQ 14 1161#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
1153#define ACPI_RSTYPE_GENERIC_REG 15 1162#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
1154#define ACPI_RSTYPE_MAX 15 1163#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
1155 1164#define ACPI_RESOURCE_TYPE_MAX 16
1156typedef u32 acpi_resource_type;
1157 1165
1158union acpi_resource_data { 1166union acpi_resource_data {
1159 struct acpi_resource_irq irq; 1167 struct acpi_resource_irq irq;
1160 struct acpi_resource_dma dma; 1168 struct acpi_resource_dma dma;
1161 struct acpi_resource_start_dpf start_dpf; 1169 struct acpi_resource_start_dependent start_dpf;
1162 struct acpi_resource_io io; 1170 struct acpi_resource_io io;
1163 struct acpi_resource_fixed_io fixed_io; 1171 struct acpi_resource_fixed_io fixed_io;
1164 struct acpi_resource_vendor vendor_specific; 1172 struct acpi_resource_vendor vendor;
1165 struct acpi_resource_end_tag end_tag; 1173 struct acpi_resource_end_tag end_tag;
1166 struct acpi_resource_mem24 memory24; 1174 struct acpi_resource_memory24 memory24;
1167 struct acpi_resource_mem32 memory32; 1175 struct acpi_resource_memory32 memory32;
1168 struct acpi_resource_fixed_mem32 fixed_memory32; 1176 struct acpi_resource_fixed_memory32 fixed_memory32;
1169 struct acpi_resource_address address; /* Common 16/32/64 address fields */
1170 struct acpi_resource_address16 address16; 1177 struct acpi_resource_address16 address16;
1171 struct acpi_resource_address32 address32; 1178 struct acpi_resource_address32 address32;
1172 struct acpi_resource_address64 address64; 1179 struct acpi_resource_address64 address64;
1173 struct acpi_resource_ext_irq extended_irq; 1180 struct acpi_resource_extended_address64 ext_address64;
1174 struct acpi_resource_generic_reg generic_reg; 1181 struct acpi_resource_extended_irq extended_irq;
1182 struct acpi_resource_generic_register generic_reg;
1183
1184 /* Common fields */
1185
1186 struct acpi_resource_address address; /* Common 16/32/64 address fields */
1175}; 1187};
1176 1188
1177struct acpi_resource { 1189struct acpi_resource {
1178 acpi_resource_type type; 1190 u32 type;
1179 u32 length; 1191 u32 length;
1180 union acpi_resource_data data; 1192 union acpi_resource_data data;
1181}; 1193};
@@ -1183,7 +1195,7 @@ struct acpi_resource {
1183#define ACPI_RESOURCE_LENGTH 12 1195#define ACPI_RESOURCE_LENGTH 12
1184#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ 1196#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
1185 1197
1186#define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) 1198#define ACPI_SIZEOF_RESOURCE(type) (u32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
1187 1199
1188#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) 1200#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
1189 1201
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
index a3c46ba6358d..103aff07db18 100644
--- a/include/acpi/amlresrc.h
+++ b/include/acpi/amlresrc.h
@@ -96,165 +96,159 @@ struct asl_resource_node {
96 * Resource descriptors defined in the ACPI specification. 96 * Resource descriptors defined in the ACPI specification.
97 * 97 *
98 * Packing/alignment must be BYTE because these descriptors 98 * Packing/alignment must be BYTE because these descriptors
99 * are used to overlay the AML byte stream. 99 * are used to overlay the raw AML byte stream.
100 */ 100 */
101#pragma pack(1) 101#pragma pack(1)
102 102
103struct asl_irq_format_desc { 103/*
104 u8 descriptor_type; 104 * SMALL descriptors
105 u16 irq_mask; 105 */
106#define AML_RESOURCE_SMALL_HEADER_COMMON \
107 u8 descriptor_type;
108
109struct aml_resource_small_header {
110AML_RESOURCE_SMALL_HEADER_COMMON};
111
112struct aml_resource_irq {
113 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
106 u8 flags; 114 u8 flags;
107}; 115};
108 116
109struct asl_irq_noflags_desc { 117struct aml_resource_irq_noflags {
110 u8 descriptor_type; 118 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
111 u16 irq_mask;
112}; 119};
113 120
114struct asl_dma_format_desc { 121struct aml_resource_dma {
115 u8 descriptor_type; 122 AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
116 u8 dma_channel_mask;
117 u8 flags; 123 u8 flags;
118}; 124};
119 125
120struct asl_start_dependent_desc { 126struct aml_resource_start_dependent {
121 u8 descriptor_type; 127 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
122 u8 flags;
123}; 128};
124 129
125struct asl_start_dependent_noprio_desc { 130struct aml_resource_start_dependent_noprio {
126 u8 descriptor_type; 131AML_RESOURCE_SMALL_HEADER_COMMON};
127};
128 132
129struct asl_end_dependent_desc { 133struct aml_resource_end_dependent {
130 u8 descriptor_type; 134AML_RESOURCE_SMALL_HEADER_COMMON};
131};
132 135
133struct asl_io_port_desc { 136struct aml_resource_io {
134 u8 descriptor_type; 137 AML_RESOURCE_SMALL_HEADER_COMMON u8 information;
135 u8 information; 138 u16 minimum;
136 u16 address_min; 139 u16 maximum;
137 u16 address_max;
138 u8 alignment; 140 u8 alignment;
139 u8 length; 141 u8 address_length;
140}; 142};
141 143
142struct asl_fixed_io_port_desc { 144struct aml_resource_fixed_io {
143 u8 descriptor_type; 145 AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
144 u16 base_address; 146 u8 address_length;
145 u8 length;
146}; 147};
147 148
148struct asl_small_vendor_desc { 149struct aml_resource_vendor_small {
149 u8 descriptor_type; 150AML_RESOURCE_SMALL_HEADER_COMMON};
150 u8 vendor_defined[7];
151};
152 151
153struct asl_end_tag_desc { 152struct aml_resource_end_tag {
154 u8 descriptor_type; 153 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
155 u8 checksum;
156}; 154};
157 155
158/* LARGE descriptors */ 156/*
159 157 * LARGE descriptors
160#define ASL_LARGE_HEADER_COMMON \ 158 */
159#define AML_RESOURCE_LARGE_HEADER_COMMON \
161 u8 descriptor_type;\ 160 u8 descriptor_type;\
162 u16 length; 161 u16 resource_length;
163 162
164struct asl_large_header { 163struct aml_resource_large_header {
165ASL_LARGE_HEADER_COMMON}; 164AML_RESOURCE_LARGE_HEADER_COMMON};
166 165
167struct asl_memory_24_desc { 166struct aml_resource_memory24 {
168 ASL_LARGE_HEADER_COMMON u8 information; 167 AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
169 u16 address_min; 168 u16 minimum;
170 u16 address_max; 169 u16 maximum;
171 u16 alignment; 170 u16 alignment;
172 u16 range_length; 171 u16 address_length;
173}; 172};
174 173
175struct asl_large_vendor_desc { 174struct aml_resource_vendor_large {
176 ASL_LARGE_HEADER_COMMON u8 vendor_defined[1]; 175AML_RESOURCE_LARGE_HEADER_COMMON};
177};
178 176
179struct asl_memory_32_desc { 177struct aml_resource_memory32 {
180 ASL_LARGE_HEADER_COMMON u8 information; 178 AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
181 u32 address_min; 179 u32 minimum;
182 u32 address_max; 180 u32 maximum;
183 u32 alignment; 181 u32 alignment;
184 u32 range_length; 182 u32 address_length;
185}; 183};
186 184
187struct asl_fixed_memory_32_desc { 185struct aml_resource_fixed_memory32 {
188 ASL_LARGE_HEADER_COMMON u8 information; 186 AML_RESOURCE_LARGE_HEADER_COMMON u8 information;
189 u32 base_address; 187 u32 address;
190 u32 range_length; 188 u32 address_length;
191}; 189};
192 190
193struct asl_extended_address_desc { 191#define AML_RESOURCE_ADDRESS_COMMON \
194 ASL_LARGE_HEADER_COMMON u8 resource_type; 192 u8 resource_type; \
195 u8 flags; 193 u8 flags; \
196 u8 specific_flags; 194 u8 specific_flags;
197 u8 revision_iD; 195
196struct aml_resource_address {
197AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
198
199struct aml_resource_extended_address64 {
200 AML_RESOURCE_LARGE_HEADER_COMMON
201 AML_RESOURCE_ADDRESS_COMMON u8 revision_iD;
198 u8 reserved; 202 u8 reserved;
199 u64 granularity; 203 u64 granularity;
200 u64 address_min; 204 u64 minimum;
201 u64 address_max; 205 u64 maximum;
202 u64 translation_offset; 206 u64 translation_offset;
203 u64 address_length; 207 u64 address_length;
204 u64 type_specific_attributes; 208 u64 type_specific_attributes;
205 u8 optional_fields[2]; /* Used for length calculation only */
206}; 209};
207 210
208#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ 211#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
209 212
210struct asl_qword_address_desc { 213struct aml_resource_address64 {
211 ASL_LARGE_HEADER_COMMON u8 resource_type; 214 AML_RESOURCE_LARGE_HEADER_COMMON
212 u8 flags; 215 AML_RESOURCE_ADDRESS_COMMON u64 granularity;
213 u8 specific_flags; 216 u64 minimum;
214 u64 granularity; 217 u64 maximum;
215 u64 address_min;
216 u64 address_max;
217 u64 translation_offset; 218 u64 translation_offset;
218 u64 address_length; 219 u64 address_length;
219 u8 optional_fields[2];
220}; 220};
221 221
222struct asl_dword_address_desc { 222struct aml_resource_address32 {
223 ASL_LARGE_HEADER_COMMON u8 resource_type; 223 AML_RESOURCE_LARGE_HEADER_COMMON
224 u8 flags; 224 AML_RESOURCE_ADDRESS_COMMON u32 granularity;
225 u8 specific_flags; 225 u32 minimum;
226 u32 granularity; 226 u32 maximum;
227 u32 address_min;
228 u32 address_max;
229 u32 translation_offset; 227 u32 translation_offset;
230 u32 address_length; 228 u32 address_length;
231 u8 optional_fields[2];
232}; 229};
233 230
234struct asl_word_address_desc { 231struct aml_resource_address16 {
235 ASL_LARGE_HEADER_COMMON u8 resource_type; 232 AML_RESOURCE_LARGE_HEADER_COMMON
236 u8 flags; 233 AML_RESOURCE_ADDRESS_COMMON u16 granularity;
237 u8 specific_flags; 234 u16 minimum;
238 u16 granularity; 235 u16 maximum;
239 u16 address_min;
240 u16 address_max;
241 u16 translation_offset; 236 u16 translation_offset;
242 u16 address_length; 237 u16 address_length;
243 u8 optional_fields[2];
244}; 238};
245 239
246struct asl_extended_xrupt_desc { 240struct aml_resource_extended_irq {
247 ASL_LARGE_HEADER_COMMON u8 flags; 241 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
248 u8 table_length; 242 u8 table_length;
249 u32 interrupt_number[1]; 243 u32 interrupt_number[1];
250 /* res_source_index, res_source optional fields follow */ 244 /* res_source_index, res_source optional fields follow */
251}; 245};
252 246
253struct asl_generic_register_desc { 247struct aml_resource_generic_register {
254 ASL_LARGE_HEADER_COMMON u8 address_space_id; 248 AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
255 u8 bit_width; 249 u8 bit_width;
256 u8 bit_offset; 250 u8 bit_offset;
257 u8 access_size; /* ACPI 3.0, was Reserved */ 251 u8 access_size; /* ACPI 3.0, was previously Reserved */
258 u64 address; 252 u64 address;
259}; 253};
260 254
@@ -264,27 +258,39 @@ struct asl_generic_register_desc {
264 258
265/* Union of all resource descriptors, so we can allocate the worst case */ 259/* Union of all resource descriptors, so we can allocate the worst case */
266 260
267union asl_resource_desc { 261union aml_resource {
268 struct asl_irq_format_desc irq; 262 /* Descriptor headers */
269 struct asl_dma_format_desc dma; 263
270 struct asl_io_port_desc iop; 264 struct aml_resource_small_header small_header;
271 struct asl_fixed_io_port_desc fio; 265 struct aml_resource_large_header large_header;
272 struct asl_start_dependent_desc std; 266
273 struct asl_end_dependent_desc end; 267 /* Small resource descriptors */
274 struct asl_small_vendor_desc smv; 268
275 struct asl_end_tag_desc et; 269 struct aml_resource_irq irq;
276 270 struct aml_resource_dma dma;
277 struct asl_large_header lhd; 271 struct aml_resource_start_dependent start_dpf;
278 struct asl_memory_24_desc M24; 272 struct aml_resource_end_dependent end_dpf;
279 struct asl_large_vendor_desc lgv; 273 struct aml_resource_io io;
280 struct asl_memory_32_desc M32; 274 struct aml_resource_fixed_io fixed_io;
281 struct asl_fixed_memory_32_desc F32; 275 struct aml_resource_vendor_small vendor_small;
282 struct asl_qword_address_desc qas; 276 struct aml_resource_end_tag end_tag;
283 struct asl_dword_address_desc das; 277
284 struct asl_word_address_desc was; 278 /* Large resource descriptors */
285 struct asl_extended_address_desc eas; 279
286 struct asl_extended_xrupt_desc exx; 280 struct aml_resource_memory24 memory24;
287 struct asl_generic_register_desc grg; 281 struct aml_resource_generic_register generic_reg;
282 struct aml_resource_vendor_large vendor_large;
283 struct aml_resource_memory32 memory32;
284 struct aml_resource_fixed_memory32 fixed_memory32;
285 struct aml_resource_address16 address16;
286 struct aml_resource_address32 address32;
287 struct aml_resource_address64 address64;
288 struct aml_resource_extended_address64 ext_address64;
289 struct aml_resource_extended_irq extended_irq;
290
291 /* Utility overlays */
292
293 struct aml_resource_address address;
288 u32 u32_item; 294 u32 u32_item;
289 u16 u16_item; 295 u16 u16_item;
290 u8 U8item; 296 u8 U8item;