aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:18 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:21 -0500
commitf3d2e7865c816258c699ff965768e46b50d536d3 (patch)
tree83d21269e506109275b77d3ed161883bba8a39cf /include
parent2e42005bcdb4f63bed1cea7f537a5534d4bd7a57 (diff)
ACPICA: Implement simplified Table Manager
The Table Manager component has been completely redesigned and reimplemented. The new design is much simpler, and reduces the overall code and data size of the kernel-resident ACPICA by approximately 5%. Also, it is now possible to obtain the ACPI tables very early during kernel initialization, even before dynamic memory management is initialized. Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h11
-rw-r--r--include/acpi/acdispat.h2
-rw-r--r--include/acpi/acglobal.h42
-rw-r--r--include/acpi/aclocal.h39
-rw-r--r--include/acpi/acnamesp.h9
-rw-r--r--include/acpi/acpiosxf.h6
-rw-r--r--include/acpi/acpixf.h28
-rw-r--r--include/acpi/acstruct.h3
-rw-r--r--include/acpi/actables.h103
-rw-r--r--include/acpi/actbl.h328
-rw-r--r--include/acpi/actbl1.h472
-rw-r--r--include/acpi/actypes.h56
12 files changed, 456 insertions, 643 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 7ece21369bb5..40f856c0f108 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 0x20060721 66#define ACPI_CA_VERSION 0x20060823
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,
@@ -115,6 +115,10 @@
115 115
116#define ACPI_NUM_OWNERID_MASKS 8 116#define ACPI_NUM_OWNERID_MASKS 8
117 117
118/* Size of the root table array is increased by this increment */
119
120#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
121
118/****************************************************************************** 122/******************************************************************************
119 * 123 *
120 * ACPI Specification constants (Do not change unless the specification changes) 124 * ACPI Specification constants (Do not change unless the specification changes)
@@ -152,6 +156,11 @@
152#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ 156#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
153#define ACPI_PATH_SEPARATOR '.' 157#define ACPI_PATH_SEPARATOR '.'
154 158
159/* Sizes for ACPI table headers */
160
161#define ACPI_OEM_ID_SIZE 6
162#define ACPI_OEM_TABLE_ID_SIZE 8
163
155/* Constants used in searching for the RSDP in low memory */ 164/* Constants used in searching for the RSDP in low memory */
156 165
157#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ 166#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index a22fe9cf8493..f0272d41d962 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -210,7 +210,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state);
210 * dsinit 210 * dsinit
211 */ 211 */
212acpi_status 212acpi_status
213acpi_ds_initialize_objects(struct acpi_table_desc *table_desc, 213acpi_ds_initialize_objects(acpi_native_uint table_index,
214 struct acpi_namespace_node *start_node); 214 struct acpi_namespace_node *start_node);
215 215
216/* 216/*
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index bf4318447f1a..82d42b82594a 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -140,47 +140,23 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
140 ****************************************************************************/ 140 ****************************************************************************/
141 141
142/* 142/*
143 * Table pointers. 143 * acpi_gbl_root_table_list is the master list of ACPI tables found in the
144 * Although these pointers are somewhat redundant with the global acpi_table, 144 * RSDT/XSDT.
145 * they are convenient because they are typed pointers.
146 * 145 *
147 * These tables are single-table only; meaning that there can be at most one 146 * acpi_gbl_FADT is a local copy of the FADT, converted to a common format.
148 * of each in the system. Each global points to the actual table.
149 */ 147 */
150ACPI_EXTERN u32 acpi_gbl_table_flags; 148ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
151ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; 149ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
152ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
153ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT;
154ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT;
155ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
156ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS;
157ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
158/*
159 * Since there may be multiple SSDTs and PSDTs, a single pointer is not
160 * sufficient; Therefore, there isn't one!
161 */
162
163/* The root table can be either an RSDT or an XSDT */
164
165ACPI_EXTERN u8 acpi_gbl_root_table_type;
166#define ACPI_TABLE_TYPE_RSDT 'R'
167#define ACPI_TABLE_TYPE_XSDT 'X'
168 150
169/* 151/*
170 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths: 152 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
171 * If we are executing a method that exists in a 32-bit ACPI table, 153 * determined by the revision of the DSDT: If the DSDT revision is less than
172 * use only the lower 32 bits of the (internal) 64-bit Integer. 154 * 2, use only the lower 32 bits of the internal 64-bit Integer.
173 */ 155 */
174ACPI_EXTERN u8 acpi_gbl_integer_bit_width; 156ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
175ACPI_EXTERN u8 acpi_gbl_integer_byte_width; 157ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
176ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; 158ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
177 159
178/*
179 * ACPI Table info arrays
180 */
181extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
182extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
183
184/***************************************************************************** 160/*****************************************************************************
185 * 161 *
186 * Mutual exlusion within ACPICA subsystem 162 * Mutual exlusion within ACPICA subsystem
@@ -188,7 +164,7 @@ extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
188 ****************************************************************************/ 164 ****************************************************************************/
189 165
190/* 166/*
191 * Predefined mutex objects. This array contains the 167 * Predefined mutex objects. This array contains the
192 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. 168 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
193 * (The table maps local handles to the real OS handles) 169 * (The table maps local handles to the real OS handles)
194 */ 170 */
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index d5421403089b..0f12fecba637 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -51,6 +51,7 @@
51#define ACPI_SERIALIZED 0xFF 51#define ACPI_SERIALIZED 0xFF
52 52
53typedef u32 acpi_mutex_handle; 53typedef u32 acpi_mutex_handle;
54#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
54 55
55/* Total number of aml opcodes defined */ 56/* Total number of aml opcodes defined */
56 57
@@ -79,8 +80,8 @@ union acpi_parse_object;
79 * table below also! 80 * table below also!
80 */ 81 */
81#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ 82#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
82#define ACPI_MTX_TABLES 1 /* Data for ACPI tables */ 83#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
83#define ACPI_MTX_NAMESPACE 2 /* ACPI Namespace */ 84#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
84#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ 85#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
85#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ 86#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
86#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ 87#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
@@ -218,25 +219,35 @@ struct acpi_namespace_node {
218 * ACPI Table Descriptor. One per ACPI table 219 * ACPI Table Descriptor. One per ACPI table
219 */ 220 */
220struct acpi_table_desc { 221struct acpi_table_desc {
221 struct acpi_table_desc *prev; 222 acpi_physical_address address;
222 struct acpi_table_desc *next;
223 struct acpi_table_desc *installed_desc;
224 struct acpi_table_header *pointer; 223 struct acpi_table_header *pointer;
225 u8 *aml_start; 224 u32 length; /* Length fixed at 32 bits */
226 u64 physical_address; 225 union acpi_name_union signature;
227 acpi_size length;
228 u32 aml_length;
229 acpi_owner_id owner_id; 226 acpi_owner_id owner_id;
230 u8 type; 227 u8 flags;
231 u8 allocation;
232 u8 loaded_into_namespace;
233}; 228};
234 229
235struct acpi_table_list { 230struct acpi_internal_rsdt {
236 struct acpi_table_desc *next; 231 struct acpi_table_desc *tables;
237 u32 count; 232 u32 count;
233 u32 size;
234 u8 flags;
238}; 235};
239 236
237/* Flags for both structs above */
238
239#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
240#define ACPI_TABLE_ORIGIN_MAPPED (1)
241#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
242#define ACPI_TABLE_ORIGIN_MASK (3)
243#define ACPI_TABLE_FLAGS_LOADED (4)
244#define ACPI_TABLE_FLAGS_ALLOW_RESIZE (8)
245
246/* Predefined (fixed) table indexes */
247
248#define ACPI_TABLE_INDEX_DSDT (0)
249#define ACPI_TABLE_INDEX_FACS (1)
250
240struct acpi_find_context { 251struct acpi_find_context {
241 char *search_for; 252 char *search_for;
242 acpi_handle *list; 253 acpi_handle *list;
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index 83b52f9f899a..b3b9f0ec79c3 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -82,7 +82,7 @@ acpi_status acpi_ns_initialize_devices(void);
82acpi_status acpi_ns_load_namespace(void); 82acpi_status acpi_ns_load_namespace(void);
83 83
84acpi_status 84acpi_status
85acpi_ns_load_table(struct acpi_table_desc *table_desc, 85acpi_ns_load_table(acpi_native_uint table_index,
86 struct acpi_namespace_node *node); 86 struct acpi_namespace_node *node);
87 87
88/* 88/*
@@ -106,11 +106,12 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
106 * nsparse - table parsing 106 * nsparse - table parsing
107 */ 107 */
108acpi_status 108acpi_status
109acpi_ns_parse_table(struct acpi_table_desc *table_desc, 109acpi_ns_parse_table(acpi_native_uint table_index,
110 struct acpi_namespace_node *scope); 110 struct acpi_namespace_node *start_node);
111 111
112acpi_status 112acpi_status
113acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc); 113acpi_ns_one_complete_parse(acpi_native_uint pass_number,
114 acpi_native_uint table_index);
114 115
115/* 116/*
116 * nsaccess - Top-level namespace access 117 * nsaccess - Top-level namespace access
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 0cd63bce0ae4..9a5ffcf88f59 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -85,7 +85,7 @@ acpi_status acpi_os_terminate(void);
85/* 85/*
86 * ACPI Table interfaces 86 * ACPI Table interfaces
87 */ 87 */
88acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *address); 88acpi_physical_address acpi_os_get_root_pointer(void);
89 89
90acpi_status 90acpi_status
91acpi_os_predefined_override(const struct acpi_predefined_names *init_val, 91acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
@@ -143,9 +143,7 @@ void acpi_os_release_mutex(acpi_mutex handle);
143 */ 143 */
144void *acpi_os_allocate(acpi_size size); 144void *acpi_os_allocate(acpi_size size);
145 145
146acpi_status 146void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_native_uint length);
147acpi_os_map_memory(acpi_physical_address physical_address,
148 acpi_size size, void __iomem ** logical_address);
149 147
150void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); 148void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
151 149
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 81458767a90e..f4b0a81ee7cb 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -51,6 +51,10 @@
51/* 51/*
52 * Global interfaces 52 * Global interfaces
53 */ 53 */
54acpi_status
55acpi_initialize_tables(struct acpi_table_desc *initial_storage,
56 u32 initial_table_count, u8 allow_resize);
57
54acpi_status acpi_initialize_subsystem(void); 58acpi_status acpi_initialize_subsystem(void);
55 59
56acpi_status acpi_enable_subsystem(u32 flags); 60acpi_status acpi_enable_subsystem(u32 flags);
@@ -92,30 +96,28 @@ void acpi_free(void *address);
92/* 96/*
93 * ACPI table manipulation interfaces 97 * ACPI table manipulation interfaces
94 */ 98 */
95acpi_status 99acpi_status acpi_reallocate_root_table(void);
96acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address); 100
101acpi_status acpi_find_root_pointer(acpi_native_uint * rsdp_address);
97 102
98acpi_status acpi_load_tables(void); 103acpi_status acpi_load_tables(void);
99 104
100acpi_status acpi_load_table(struct acpi_table_header *table_ptr); 105acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
101 106
102acpi_status acpi_unload_table_id(acpi_table_type table_type, acpi_owner_id id); 107acpi_status acpi_unload_table_id(acpi_owner_id id);
103 108
104#ifdef ACPI_FUTURE_USAGE
105acpi_status acpi_unload_table(acpi_table_type table_type);
106acpi_status 109acpi_status
107acpi_get_table_header(acpi_table_type table_type, 110acpi_get_table_header(acpi_string signature,
108 u32 instance, struct acpi_table_header *out_table_header); 111 acpi_native_uint instance,
109#endif /* ACPI_FUTURE_USAGE */ 112 struct acpi_table_header **out_table_header);
110 113
111acpi_status 114acpi_status
112acpi_get_table(acpi_table_type table_type, 115acpi_get_table(acpi_string signature,
113 u32 instance, struct acpi_buffer *ret_buffer); 116 acpi_native_uint instance, struct acpi_table_header **out_table);
114 117
115acpi_status 118acpi_status
116acpi_get_firmware_table(acpi_string signature, 119acpi_get_table_by_index(acpi_native_uint table_index,
117 u32 instance, 120 struct acpi_table_header **out_table);
118 u32 flags, struct acpi_table_header **table_pointer);
119 121
120/* 122/*
121 * Namespace and name interfaces 123 * Namespace and name interfaces
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index 5e8095f0f78f..9c800b6cd8c7 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -139,7 +139,8 @@ struct acpi_init_walk_info {
139 u16 buffer_init; 139 u16 buffer_init;
140 u16 package_init; 140 u16 package_init;
141 u16 object_count; 141 u16 object_count;
142 struct acpi_table_desc *table_desc; 142 acpi_owner_id owner_id;
143 acpi_native_uint table_index;
143}; 144};
144 145
145struct acpi_get_devices_info { 146struct acpi_get_devices_info {
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index 4dbaf02fe526..1737a2f045f6 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -44,105 +44,62 @@
44#ifndef __ACTABLES_H__ 44#ifndef __ACTABLES_H__
45#define __ACTABLES_H__ 45#define __ACTABLES_H__
46 46
47/* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */
48
49#define SIZE_IN_HEADER 0
50
51/*
52 * tbconvrt - Table conversion routines
53 */
54acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info);
55
56acpi_status acpi_tb_convert_table_fadt(void);
57
58acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info);
59
60u32
61acpi_tb_get_table_count(struct rsdp_descriptor *RSDP,
62 struct acpi_table_header *RSDT);
63
64/* 47/*
65 * tbget - Table "get" routines 48 * tbfind - find ACPI table
66 */ 49 */
67acpi_status 50acpi_status
68acpi_tb_get_table(struct acpi_pointer *address, 51acpi_tb_find_table(char *signature,
69 struct acpi_table_desc *table_info); 52 char *oem_id,
70 53 char *oem_table_id, acpi_native_uint * table_index);
71acpi_status
72acpi_tb_get_table_header(struct acpi_pointer *address,
73 struct acpi_table_header *return_header);
74
75acpi_status
76acpi_tb_get_table_body(struct acpi_pointer *address,
77 struct acpi_table_header *header,
78 struct acpi_table_desc *table_info);
79
80acpi_status
81acpi_tb_get_table_ptr(acpi_table_type table_type,
82 u32 instance, struct acpi_table_header **table_ptr_loc);
83
84acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address);
85
86void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address);
87
88acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr);
89 54
90/* 55/*
91 * tbgetall - get multiple required tables 56 * tbinstal - Table removal and deletion
92 */ 57 */
93acpi_status acpi_tb_get_required_tables(void); 58acpi_status acpi_tb_resize_root_table_list(void);
94 59
95/* 60acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc);
96 * tbinstall - Table installation
97 */
98acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info);
99 61
100acpi_status 62acpi_status
101acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type); 63acpi_tb_add_table(struct acpi_table_header *table,
64 acpi_native_uint * table_index);
102 65
103acpi_status 66acpi_status
104acpi_tb_init_table_descriptor(acpi_table_type table_type, 67acpi_tb_store_table(acpi_physical_address address,
105 struct acpi_table_desc *table_info); 68 struct acpi_table_header *table,
69 u32 length, u8 flags, acpi_native_uint * table_index);
106 70
107/* 71void acpi_tb_delete_table(acpi_native_uint table_index);
108 * tbremove - Table removal and deletion
109 */
110void acpi_tb_delete_all_tables(void);
111 72
112void acpi_tb_delete_tables_by_type(acpi_table_type type); 73void acpi_tb_terminate(void);
113 74
114void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc); 75void acpi_tb_delete_namespace_by_owner(acpi_native_uint table_index);
115 76
116struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc 77acpi_status acpi_tb_allocate_owner_id(acpi_native_uint table_index);
117 *table_desc); 78
79acpi_status acpi_tb_release_owner_id(acpi_native_uint table_index);
118 80
119/*
120 * tbxfroot - RSDP, RSDT utilities
121 */
122acpi_status 81acpi_status
123acpi_tb_find_table(char *signature, 82acpi_tb_get_owner_id(acpi_native_uint table_index, acpi_owner_id * owner_id);
124 char *oem_id,
125 char *oem_table_id, struct acpi_table_header **table_ptr);
126 83
127acpi_status acpi_tb_get_table_rsdt(void); 84u8 acpi_tb_is_table_loaded(acpi_native_uint table_index);
128 85
129acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp); 86void acpi_tb_set_table_loaded_flag(acpi_native_uint table_index, u8 is_loaded);
130 87
131/* 88/*
132 * tbutils - common table utilities 89 * tbutils - table manager utilities
133 */ 90 */
134acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc); 91void
92acpi_tb_print_table_header(acpi_physical_address address,
93 struct acpi_table_header *header);
135 94
136acpi_status 95u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length);
137acpi_tb_verify_table_checksum(struct acpi_table_header *table_header);
138 96
139u8 acpi_tb_sum_table(void *buffer, u32 length); 97void acpi_tb_convert_fadt(struct acpi_table_fadt *fadt);
140 98
141u8 acpi_tb_generate_checksum(struct acpi_table_header *table); 99acpi_status acpi_tb_parse_root_table(struct acpi_table_rsdp *rsdp, u8 flags);
142 100
143void acpi_tb_set_checksum(struct acpi_table_header *table); 101void *acpi_tb_map(acpi_physical_address address, u32 length, u32 flags);
144 102
145acpi_status 103void acpi_tb_unmap(void *pointer, u32 length, u32 flags);
146acpi_tb_validate_table_header(struct acpi_table_header *table_header);
147 104
148#endif /* __ACTABLES_H__ */ 105#endif /* __ACTABLES_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index b125ceed9cb7..b455f540a165 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -48,15 +48,15 @@
48 * Values for description table header signatures. Useful because they make 48 * Values for description table header signatures. Useful because they make
49 * it more difficult to inadvertently type in the wrong signature. 49 * it more difficult to inadvertently type in the wrong signature.
50 */ 50 */
51#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ 51#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */
52#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ 52#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
53#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ 53#define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */
54#define PSDT_SIG "PSDT" /* Persistent System Description Table */ 54#define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */
55#define RSDP_SIG "RSD PTR " /* Root System Description Pointer */ 55#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */
56#define RSDT_SIG "RSDT" /* Root System Description Table */ 56#define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */
57#define XSDT_SIG "XSDT" /* Extended System Description Table */ 57#define ACPI_SIG_XSDT "XSDT" /* Extended System Description Table */
58#define SSDT_SIG "SSDT" /* Secondary System Description Table */ 58#define ACPI_SIG_SSDT "SSDT" /* Secondary System Description Table */
59#define RSDP_NAME "RSDP" 59#define ACPI_RSDP_NAME "RSDP"
60 60
61/* 61/*
62 * All tables and structures must be byte-packed to match the ACPI 62 * All tables and structures must be byte-packed to match the ACPI
@@ -83,27 +83,29 @@
83 * 83 *
84 ******************************************************************************/ 84 ******************************************************************************/
85 85
86#define ACPI_TABLE_HEADER_DEF \
87 char signature[4]; /* ASCII table signature */\
88 u32 length; /* Length of table in bytes, including this header */\
89 u8 revision; /* ACPI Specification minor version # */\
90 u8 checksum; /* To make sum of entire table == 0 */\
91 char oem_id[6]; /* ASCII OEM identification */\
92 char oem_table_id[8]; /* ASCII OEM table identification */\
93 u32 oem_revision; /* OEM revision number */\
94 char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\
95 u32 asl_compiler_revision; /* ASL compiler version */
96
97struct acpi_table_header { 86struct acpi_table_header {
98ACPI_TABLE_HEADER_DEF}; 87 char signature[ACPI_NAME_SIZE]; /* ASCII table signature */
88 u32 length; /* Length of table in bytes, including this header */
89 u8 revision; /* ACPI Specification minor version # */
90 u8 checksum; /* To make sum of entire table == 0 */
91 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
92 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
93 u32 oem_revision; /* OEM revision number */
94 char asl_compiler_id[ACPI_NAME_SIZE]; /* ASCII ASL compiler vendor ID */
95 u32 asl_compiler_revision; /* ASL compiler version */
96};
99 97
100/* 98/*
101 * GAS - Generic Address Structure (ACPI 2.0+) 99 * GAS - Generic Address Structure (ACPI 2.0+)
100 *
101 * Note: Since this structure is used in the ACPI tables, it is byte aligned.
102 * If misalignment is not supported, access to the Address field must be
103 * performed with care.
102 */ 104 */
103struct acpi_generic_address { 105struct acpi_generic_address {
104 u8 address_space_id; /* Address space where struct or register exists */ 106 u8 space_id; /* Address space where struct or register exists */
105 u8 register_bit_width; /* Size in bits of given register */ 107 u8 bit_width; /* Size in bits of given register */
106 u8 register_bit_offset; /* Bit offset within the register */ 108 u8 bit_offset; /* Bit offset within the register */
107 u8 access_width; /* Minimum Access size (ACPI 3.0) */ 109 u8 access_width; /* Minimum Access size (ACPI 3.0) */
108 u64 address; /* 64-bit address of struct or register */ 110 u64 address; /* 64-bit address of struct or register */
109}; 111};
@@ -114,10 +116,10 @@ struct acpi_generic_address {
114 * 116 *
115 ******************************************************************************/ 117 ******************************************************************************/
116 118
117struct rsdp_descriptor { 119struct acpi_table_rsdp {
118 char signature[8]; /* ACPI signature, contains "RSD PTR " */ 120 char signature[8]; /* ACPI signature, contains "RSD PTR " */
119 u8 checksum; /* ACPI 1.0 checksum */ 121 u8 checksum; /* ACPI 1.0 checksum */
120 char oem_id[6]; /* OEM identification */ 122 char oem_id[ACPI_OEM_ID_SIZE]; /* OEM identification */
121 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ 123 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
122 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ 124 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
123 u32 length; /* Table length in bytes, including header (ACPI 2.0+) */ 125 u32 length; /* Table length in bytes, including header (ACPI 2.0+) */
@@ -134,12 +136,14 @@ struct rsdp_descriptor {
134 * 136 *
135 ******************************************************************************/ 137 ******************************************************************************/
136 138
137struct rsdt_descriptor { 139struct acpi_table_rsdt {
138 ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ 140 struct acpi_table_header header; /* Common ACPI table header */
141 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
139}; 142};
140 143
141struct xsdt_descriptor { 144struct acpi_table_xsdt {
142 ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ 145 struct acpi_table_header header; /* Common ACPI table header */
146 u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
143}; 147};
144 148
145/******************************************************************************* 149/*******************************************************************************
@@ -148,36 +152,27 @@ struct xsdt_descriptor {
148 * 152 *
149 ******************************************************************************/ 153 ******************************************************************************/
150 154
151struct facs_descriptor { 155struct acpi_table_facs {
152 char signature[4]; /* ASCII table signature */ 156 char signature[4]; /* ASCII table signature */
153 u32 length; /* Length of structure, in bytes */ 157 u32 length; /* Length of structure, in bytes */
154 u32 hardware_signature; /* Hardware configuration signature */ 158 u32 hardware_signature; /* Hardware configuration signature */
155 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */ 159 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */
156 u32 global_lock; /* Global Lock for shared hardware resources */ 160 u32 global_lock; /* Global Lock for shared hardware resources */
157 161 u32 flags;
158 /* Flags (32 bits) */
159
160 u8 S4bios_f:1; /* 00: S4BIOS support is present */
161 u8:7; /* 01-07: Reserved, must be zero */
162 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
163
164 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ 162 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
165 u8 version; /* Version of this table (ACPI 2.0+) */ 163 u8 version; /* Version of this table (ACPI 2.0+) */
166 u8 reserved[31]; /* Reserved, must be zero */ 164 u8 reserved[31]; /* Reserved, must be zero */
167}; 165};
168 166
167/* Flag macros */
168
169#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */
170
171/* Global lock flags */
172
169#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ 173#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */
170#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ 174#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */
171 175
172/*
173 * Common FACS - This is a version-independent FACS structure used for internal use only
174 */
175struct acpi_common_facs {
176 u32 *global_lock;
177 u64 *firmware_waking_vector;
178 u8 vector_width;
179};
180
181/******************************************************************************* 176/*******************************************************************************
182 * 177 *
183 * FADT - Fixed ACPI Description Table (Signature "FACP") 178 * FADT - Fixed ACPI Description Table (Signature "FACP")
@@ -186,121 +181,98 @@ struct acpi_common_facs {
186 181
187/* Fields common to all versions of the FADT */ 182/* Fields common to all versions of the FADT */
188 183
189#define ACPI_FADT_COMMON \ 184struct acpi_table_fadt {
190 ACPI_TABLE_HEADER_DEF \ 185 struct acpi_table_header header; /* Common ACPI table header */
191 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ 186 u32 facs; /* 32-bit physical address of FACS */
192 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ 187 u32 dsdt; /* 32-bit physical address of DSDT */
193 u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ 188 u8 model; /* System Interrupt Model (ACPI 1.0) not used in ACPI 2.0+ */
194 u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ 189 u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */
195 u16 sci_int; /* System vector of SCI interrupt */ \ 190 u16 sci_interrupt; /* System vector of SCI interrupt */
196 u32 smi_cmd; /* Port address of SMI command port */ \ 191 u32 smi_command; /* Port address of SMI command port */
197 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ 192 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
198 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ 193 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
199 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ 194 u8 S4bios_request; /* Value to write to SMI CMD to enter S4BIOS state */
200 u8 pstate_cnt; /* Processor performance state control*/ \ 195 u8 pstate_control; /* Processor performance state control */
201 u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \ 196 u32 pm1a_event_block; /* Port address of Power Mgt 1a Event Reg Blk */
202 u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \ 197 u32 pm1b_event_block; /* Port address of Power Mgt 1b Event Reg Blk */
203 u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ 198 u32 pm1a_control_block; /* Port address of Power Mgt 1a Control Reg Blk */
204 u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ 199 u32 pm1b_control_block; /* Port address of Power Mgt 1b Control Reg Blk */
205 u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ 200 u32 pm2_control_block; /* Port address of Power Mgt 2 Control Reg Blk */
206 u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ 201 u32 pm_timer_block; /* Port address of Power Mgt Timer Ctrl Reg Blk */
207 u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ 202 u32 gpe0_block; /* Port addr of General Purpose acpi_event 0 Reg Blk */
208 u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ 203 u32 gpe1_block; /* Port addr of General Purpose acpi_event 1 Reg Blk */
209 u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \ 204 u8 pm1_event_length; /* Byte Length of ports at pm1_x_evt_blk */
210 u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \ 205 u8 pm1_control_length; /* Byte Length of ports at pm1_x_cnt_blk */
211 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ 206 u8 pm2_control_length; /* Byte Length of ports at pm2_cnt_blk */
212 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ 207 u8 pm_timer_length; /* Byte Length of ports at pm_tmr_blk */
213 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ 208 u8 gpe0_block_length; /* Byte Length of ports at gpe0_blk */
214 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ 209 u8 gpe1_block_length; /* Byte Length of ports at gpe1_blk */
215 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ 210 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */
216 u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ 211 u8 cst_control; /* Support for the _CST object and C States change notification. */
217 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ 212 u16 C2latency; /* Worst case HW latency to enter/exit C2 state */
218 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ 213 u16 C3latency; /* Worst case HW latency to enter/exit C3 state */
219 u16 flush_size; /* Processor's memory cache line width, in bytes */ \ 214 u16 flush_size; /* Processor's memory cache line width, in bytes */
220 u16 flush_stride; /* Number of flush strides that need to be read */ \ 215 u16 flush_stride; /* Number of flush strides that need to be read */
221 u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ 216 u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg */
222 u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ 217 u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register. */
223 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ 218 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */
224 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ 219 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */
225 u8 century; /* Index to century in RTC CMOS RAM */ \ 220 u8 century; /* Index to century in RTC CMOS RAM */
226 u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \ 221 u16 boot_flags; /* IA-PC Boot Architecture Flags. See Table 5-10 for description */
227 u8 reserved2; /* Reserved, must be zero */ 222 u8 reserved; /* Reserved, must be zero */
228 223 u32 flags; /* Miscellaneous flag bits */
229/*
230 * ACPI 2.0+ FADT
231 */
232struct fadt_descriptor {
233 ACPI_FADT_COMMON
234 /* Flags (32 bits) */
235 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
236 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
237 u8 proc_c1:1; /* 02: All processors support C1 state */
238 u8 plvl2_up:1; /* 03: C2 state works on MP system */
239 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
240 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
241 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
242 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
243 u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
244 u8 dock_cap:1; /* 09: Docking supported */
245 u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
246 u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
247 u8 headless:1; /* 12: No local video capabilities or local input devices */
248 u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
249
250 u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
251 u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
252 u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
253 u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
254 u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
255 u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */
256 u8:4; /* 20-23: Reserved, must be zero */
257 u8 reserved3; /* 24-31: Reserved, must be zero */
258
259 struct acpi_generic_address reset_register; /* Reset register address in GAS format */ 224 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
260 u8 reset_value; /* Value to write to the reset_register port to reset the system */ 225 u8 reset_value; /* Value to write to the reset_register port to reset the system */
261 u8 reserved4[3]; /* These three bytes must be zero */ 226 u8 reserved4[3]; /* These three bytes must be zero */
262 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ 227 u64 Xfacs; /* 64-bit physical address of FACS */
263 u64 Xdsdt; /* 64-bit physical address of DSDT */ 228 u64 Xdsdt; /* 64-bit physical address of DSDT */
264 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ 229 struct acpi_generic_address xpm1a_event_block; /* Extended Power Mgt 1a acpi_event Reg Blk address */
265 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ 230 struct acpi_generic_address xpm1b_event_block; /* Extended Power Mgt 1b acpi_event Reg Blk address */
266 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ 231 struct acpi_generic_address xpm1a_control_block; /* Extended Power Mgt 1a Control Reg Blk address */
267 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ 232 struct acpi_generic_address xpm1b_control_block; /* Extended Power Mgt 1b Control Reg Blk address */
268 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ 233 struct acpi_generic_address xpm2_control_block; /* Extended Power Mgt 2 Control Reg Blk address */
269 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ 234 struct acpi_generic_address xpm_timer_block; /* Extended Power Mgt Timer Ctrl Reg Blk address */
270 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ 235 struct acpi_generic_address xgpe0_block; /* Extended General Purpose acpi_event 0 Reg Blk address */
271 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ 236 struct acpi_generic_address xgpe1_block; /* Extended General Purpose acpi_event 1 Reg Blk address */
272}; 237};
273 238
274/* 239/* FADT flags */
275 * "Down-revved" ACPI 2.0 FADT descriptor 240
276 * Defined here to allow compiler to generate the length of the struct 241#define ACPI_FADT_WBINVD (1) /* 00: The wbinvd instruction works properly */
277 */ 242#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: The wbinvd flushes but does not invalidate */
278struct fadt_descriptor_rev2_minus { 243#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: All processors support C1 state */
279 ACPI_FADT_COMMON u32 flags; 244#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: C2 state works on MP system */
280 struct acpi_generic_address reset_register; /* Reset register address in GAS format */ 245#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */
281 u8 reset_value; /* Value to write to the reset_register port to reset the system. */ 246#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */
282 u8 reserved7[3]; /* Reserved, must be zero */ 247#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */
283}; 248#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup stat not possible from S4 */
249#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */
250#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */
251#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */
252#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: No internal expansion capabilities and case is sealed */
253#define ACPI_FADT_HEADLESS (1<<12) /* 12: No local video capabilities or local input devices */
254#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: Must execute native instruction after writing SLP_TYPx register */
255#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
256#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
257#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
258#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: System is compatible with remote power on (ACPI 3.0) */
259#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: All local APICs must use cluster model (ACPI 3.0) */
260#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */
284 261
285/* 262/*
286 * ACPI 1.0 FADT 263 * FADT Prefered Power Management Profiles
287 * Defined here to allow compiler to generate the length of the struct
288 */ 264 */
289struct fadt_descriptor_rev1 { 265enum acpi_prefered_pm_profiles {
290 ACPI_FADT_COMMON u32 flags; 266 PM_UNSPECIFIED = 0,
267 PM_DESKTOP = 1,
268 PM_MOBILE = 2,
269 PM_WORKSTATION = 3,
270 PM_ENTERPRISE_SERVER = 4,
271 PM_SOHO_SERVER = 5,
272 PM_APPLIANCE_PC = 6
291}; 273};
292 274
293/* FADT: Prefered Power Management Profiles */ 275/* FADT Boot Arch Flags */
294
295#define PM_UNSPECIFIED 0
296#define PM_DESKTOP 1
297#define PM_MOBILE 2
298#define PM_WORKSTATION 3
299#define PM_ENTERPRISE_SERVER 4
300#define PM_SOHO_SERVER 5
301#define PM_APPLIANCE_PC 6
302
303/* FADT: Boot Arch Flags */
304 276
305#define BAF_LEGACY_DEVICES 0x0001 277#define BAF_LEGACY_DEVICES 0x0001
306#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
@@ -312,59 +284,11 @@ struct fadt_descriptor_rev1 {
312 284
313#pragma pack() 285#pragma pack()
314 286
315/* 287#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f)
316 * This macro is temporary until the table bitfield flag definitions
317 * are removed and replaced by a Flags field.
318 */
319#define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \
320 sizeof(((d *)0)->f) + o)
321/*
322 * Get the remaining ACPI tables
323 */
324#include "actbl1.h"
325 288
326/* 289/*
327 * ACPI Table information. We save the table address, length, 290 * Get the remaining ACPI tables
328 * and type of memory allocation (mapped or allocated) for each
329 * table for 1) when we exit, and 2) if a new table is installed
330 */ 291 */
331#define ACPI_MEM_NOT_ALLOCATED 0 292#include <acpi/actbl1.h>
332#define ACPI_MEM_ALLOCATED 1
333#define ACPI_MEM_MAPPED 2
334
335/* Definitions for the Flags bitfield member of struct acpi_table_support */
336
337#define ACPI_TABLE_SINGLE 0x00
338#define ACPI_TABLE_MULTIPLE 0x01
339#define ACPI_TABLE_EXECUTABLE 0x02
340
341#define ACPI_TABLE_ROOT 0x00
342#define ACPI_TABLE_PRIMARY 0x10
343#define ACPI_TABLE_SECONDARY 0x20
344#define ACPI_TABLE_ALL 0x30
345#define ACPI_TABLE_TYPE_MASK 0x30
346
347/* Data about each known table type */
348
349struct acpi_table_support {
350 char *name;
351 char *signature;
352 void **global_ptr;
353 u8 sig_length;
354 u8 flags;
355};
356
357extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
358 * needed for certain workarounds */
359/* Macros used to generate offsets to specific table fields */
360
361#define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f)
362#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f)
363#define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f)
364#define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f)
365#define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f)
366
367#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o)
368#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o)
369 293
370#endif /* __ACTBL_H__ */ 294#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 745a6445a4f9..8ae30b7ed652 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -73,12 +73,6 @@
73#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ 73#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
74#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ 74#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
75 75
76/* Legacy names */
77
78#define APIC_SIG "APIC" /* Multiple APIC Description Table */
79#define BOOT_SIG "BOOT" /* Simple Boot Flag Table */
80#define SBST_SIG "SBST" /* Smart Battery Specification Table */
81
82/* 76/*
83 * All tables must be byte-packed to match the ACPI specification, since 77 * All tables must be byte-packed to match the ACPI specification, since
84 * the tables are provided by the system BIOS. 78 * the tables are provided by the system BIOS.
@@ -91,6 +85,13 @@
91 * portable, so do not use any other bitfield types. 85 * portable, so do not use any other bitfield types.
92 */ 86 */
93 87
88/* Common Sub-table header (used in MADT, SRAT, etc.) */
89
90struct acpi_subtable_header {
91 u8 type;
92 u8 length;
93};
94
94/******************************************************************************* 95/*******************************************************************************
95 * 96 *
96 * ASF - Alert Standard Format table (Signature "ASF!") 97 * ASF - Alert Standard Format table (Signature "ASF!")
@@ -98,24 +99,27 @@
98 ******************************************************************************/ 99 ******************************************************************************/
99 100
100struct acpi_table_asf { 101struct acpi_table_asf {
101ACPI_TABLE_HEADER_DEF}; 102 struct acpi_table_header header; /* Common ACPI table header */
103};
102 104
103#define ACPI_ASF_HEADER_DEF \ 105/* ASF subtable header */
104 u8 type; \
105 u8 reserved; \
106 u16 length;
107 106
108struct acpi_asf_header { 107struct acpi_asf_header {
109ACPI_ASF_HEADER_DEF}; 108 u8 type;
109 u8 reserved;
110 u16 length;
111};
110 112
111/* Values for Type field */ 113/* Values for Type field above */
112 114
113#define ASF_INFO 0 115enum acpi_asf_type {
114#define ASF_ALERT 1 116 ACPI_ASF_TYPE_INFO = 0,
115#define ASF_CONTROL 2 117 ACPI_ASF_TYPE_ALERT = 1,
116#define ASF_BOOT 3 118 ACPI_ASF_TYPE_CONTROL = 2,
117#define ASF_ADDRESS 4 119 ACPI_ASF_TYPE_BOOT = 3,
118#define ASF_RESERVED 5 120 ACPI_ASF_TYPE_ADDRESS = 4,
121 ACPI_ASF_TYPE_RESERVED = 5
122};
119 123
120/* 124/*
121 * ASF subtables 125 * ASF subtables
@@ -124,7 +128,8 @@ ACPI_ASF_HEADER_DEF};
124/* 0: ASF Information */ 128/* 0: ASF Information */
125 129
126struct acpi_asf_info { 130struct acpi_asf_info {
127 ACPI_ASF_HEADER_DEF u8 min_reset_value; 131 struct acpi_asf_header header;
132 u8 min_reset_value;
128 u8 min_poll_interval; 133 u8 min_poll_interval;
129 u16 system_id; 134 u16 system_id;
130 u32 mfg_id; 135 u32 mfg_id;
@@ -135,7 +140,8 @@ struct acpi_asf_info {
135/* 1: ASF Alerts */ 140/* 1: ASF Alerts */
136 141
137struct acpi_asf_alert { 142struct acpi_asf_alert {
138 ACPI_ASF_HEADER_DEF u8 assert_mask; 143 struct acpi_asf_header header;
144 u8 assert_mask;
139 u8 deassert_mask; 145 u8 deassert_mask;
140 u8 alerts; 146 u8 alerts;
141 u8 data_length; 147 u8 data_length;
@@ -145,7 +151,8 @@ struct acpi_asf_alert {
145/* 2: ASF Remote Control */ 151/* 2: ASF Remote Control */
146 152
147struct acpi_asf_remote { 153struct acpi_asf_remote {
148 ACPI_ASF_HEADER_DEF u8 controls; 154 struct acpi_asf_header header;
155 u8 controls;
149 u8 data_length; 156 u8 data_length;
150 u16 reserved2; 157 u16 reserved2;
151 u8 array[1]; 158 u8 array[1];
@@ -154,7 +161,8 @@ struct acpi_asf_remote {
154/* 3: ASF RMCP Boot Options */ 161/* 3: ASF RMCP Boot Options */
155 162
156struct acpi_asf_rmcp { 163struct acpi_asf_rmcp {
157 ACPI_ASF_HEADER_DEF u8 capabilities[7]; 164 struct acpi_asf_header header;
165 u8 capabilities[7];
158 u8 completion_code; 166 u8 completion_code;
159 u32 enterprise_id; 167 u32 enterprise_id;
160 u8 command; 168 u8 command;
@@ -166,7 +174,8 @@ struct acpi_asf_rmcp {
166/* 4: ASF Address */ 174/* 4: ASF Address */
167 175
168struct acpi_asf_address { 176struct acpi_asf_address {
169 ACPI_ASF_HEADER_DEF u8 eprom_address; 177 struct acpi_asf_header header;
178 u8 eprom_address;
170 u8 devices; 179 u8 devices;
171 u8 smbus_addresses[1]; 180 u8 smbus_addresses[1];
172}; 181};
@@ -178,7 +187,8 @@ struct acpi_asf_address {
178 ******************************************************************************/ 187 ******************************************************************************/
179 188
180struct acpi_table_boot { 189struct acpi_table_boot {
181 ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */ 190 struct acpi_table_header header; /* Common ACPI table header */
191 u8 cmos_index; /* Index in CMOS RAM for the boot register */
182 u8 reserved[3]; 192 u8 reserved[3];
183}; 193};
184 194
@@ -189,7 +199,8 @@ struct acpi_table_boot {
189 ******************************************************************************/ 199 ******************************************************************************/
190 200
191struct acpi_table_cpep { 201struct acpi_table_cpep {
192 ACPI_TABLE_HEADER_DEF u64 reserved; 202 struct acpi_table_header header; /* Common ACPI table header */
203 u64 reserved;
193}; 204};
194 205
195/* Subtable */ 206/* Subtable */
@@ -197,9 +208,9 @@ struct acpi_table_cpep {
197struct acpi_cpep_polling { 208struct acpi_cpep_polling {
198 u8 type; 209 u8 type;
199 u8 length; 210 u8 length;
200 u8 processor_id; /* Processor ID */ 211 u8 id; /* Processor ID */
201 u8 processor_eid; /* Processor EID */ 212 u8 eid; /* Processor EID */
202 u32 polling_interval; /* Polling interval (msec) */ 213 u32 interval; /* Polling interval (msec) */
203}; 214};
204 215
205/******************************************************************************* 216/*******************************************************************************
@@ -209,7 +220,8 @@ struct acpi_cpep_polling {
209 ******************************************************************************/ 220 ******************************************************************************/
210 221
211struct acpi_table_dbgp { 222struct acpi_table_dbgp {
212 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 223 struct acpi_table_header header; /* Common ACPI table header */
224 u8 type; /* 0=full 16550, 1=subset of 16550 */
213 u8 reserved[3]; 225 u8 reserved[3];
214 struct acpi_generic_address debug_port; 226 struct acpi_generic_address debug_port;
215}; 227};
@@ -220,12 +232,13 @@ struct acpi_table_dbgp {
220 * 232 *
221 ******************************************************************************/ 233 ******************************************************************************/
222 234
223struct ec_boot_resources { 235struct acpi_table_ecdt {
224 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ 236 struct acpi_table_header header; /* Common ACPI table header */
225 struct acpi_generic_address ec_data; /* Address of EC data register */ 237 struct acpi_generic_address control; /* Address of EC command/status register */
238 struct acpi_generic_address data; /* Address of EC data register */
226 u32 uid; /* Unique ID - must be same as the EC _UID method */ 239 u32 uid; /* Unique ID - must be same as the EC _UID method */
227 u8 gpe_bit; /* The GPE for the EC */ 240 u8 gpe; /* The GPE for the EC */
228 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ 241 u8 id[1]; /* Full namepath of the EC in the ACPI namespace */
229}; 242};
230 243
231/******************************************************************************* 244/*******************************************************************************
@@ -234,22 +247,22 @@ struct ec_boot_resources {
234 * 247 *
235 ******************************************************************************/ 248 ******************************************************************************/
236 249
237struct acpi_hpet_table { 250struct acpi_table_hpet {
238 ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */ 251 struct acpi_table_header header; /* Common ACPI table header */
239 struct acpi_generic_address base_address; /* Address of event timer block */ 252 u32 id; /* Hardware ID of event timer block */
240 u8 hpet_number; /* HPET sequence number */ 253 struct acpi_generic_address address; /* Address of event timer block */
241 u16 clock_tick; /* Main counter min tick, periodic mode */ 254 u8 sequence; /* HPET sequence number */
242 u8 attributes; 255 u16 minimum_tick; /* Main counter min tick, periodic mode */
256 u8 flags;
243}; 257};
244 258
245#if 0 /* HPET flags to be converted to macros */ 259/*! Flags */
246struct { /* Flags (8 bits) */ 260
247 u8 page_protect:1; /* 00: No page protection */ 261#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */
248 u8 page_protect4:1; /* 01: 4_kB page protected */ 262#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */
249 u8 page_protect64:1; /* 02: 64_kB page protected */ 263#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */
250 u8:5; /* 03-07: Reserved, must be zero */ 264
251} flags; 265/*! [End] no source code translation !*/
252#endif
253 266
254/******************************************************************************* 267/*******************************************************************************
255 * 268 *
@@ -257,148 +270,159 @@ struct { /* Flags (8 bits) */
257 * 270 *
258 ******************************************************************************/ 271 ******************************************************************************/
259 272
260struct multiple_apic_table { 273struct acpi_table_madt {
261 ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */ 274 struct acpi_table_header header; /* Common ACPI table header */
262 275 u32 address; /* Physical address of local APIC */
263 /* Flags (32 bits) */ 276 u32 flags;
264
265 u8 PCATcompat:1; /* 00: System also has dual 8259s */
266 u8:7; /* 01-07: Reserved, must be zero */
267 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
268}; 277};
269 278
270/* Values for MADT PCATCompat */ 279/* Flags */
271
272#define DUAL_PIC 0
273#define MULTIPLE_APIC 1
274
275/* Common MADT Sub-table header */
276
277#define APIC_HEADER_DEF \
278 u8 type; \
279 u8 length;
280
281struct apic_header {
282APIC_HEADER_DEF};
283
284/* Values for Type in struct apic_header */
285 280
286#define APIC_PROCESSOR 0 281#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
287#define APIC_IO 1
288#define APIC_XRUPT_OVERRIDE 2
289#define APIC_NMI 3
290#define APIC_LOCAL_NMI 4
291#define APIC_ADDRESS_OVERRIDE 5
292#define APIC_IO_SAPIC 6
293#define APIC_LOCAL_SAPIC 7
294#define APIC_XRUPT_SOURCE 8
295#define APIC_RESERVED 9 /* 9 and greater are reserved */
296 282
297/* Flag definitions for MADT sub-tables */ 283/* Values for PCATCompat flag */
298 284
299#define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \ 285#define ACPI_MADT_DUAL_PIC 0
300 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ 286#define ACPI_MADT_MULTIPLE_APIC 1
301 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
302 u8 : 4; /* 04-07: Reserved, must be zero */\
303 u8 reserved1; /* 08-15: Reserved, must be zero */
304 287
305#define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \ 288/* Values for subtable type in struct acpi_subtable_header */
306 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
307 u8 : 7; /* 01-07: Reserved, must be zero */\
308 u8 reserved2[3]; /* 08-31: Reserved, must be zero */
309 289
310/* Values for MPS INTI flags */ 290enum acpi_madt_type {
311 291 ACPI_MADT_TYPE_LOCAL_APIC = 0,
312#define POLARITY_CONFORMS 0 292 ACPI_MADT_TYPE_IO_APIC = 1,
313#define POLARITY_ACTIVE_HIGH 1 293 ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
314#define POLARITY_RESERVED 2 294 ACPI_MADT_TYPE_NMI_SOURCE = 3,
315#define POLARITY_ACTIVE_LOW 3 295 ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
316 296 ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
317#define TRIGGER_CONFORMS 0 297 ACPI_MADT_TYPE_IO_SAPIC = 6,
318#define TRIGGER_EDGE 1 298 ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
319#define TRIGGER_RESERVED 2 299 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
320#define TRIGGER_LEVEL 3 300 ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */
301};
321 302
322/* 303/*
323 * MADT Sub-tables, correspond to Type in struct apic_header 304 * MADT Sub-tables, correspond to Type in struct acpi_subtable_header
324 */ 305 */
325 306
326/* 0: processor APIC */ 307/* 0: Processor Local APIC */
327 308
328struct madt_processor_apic { 309struct acpi_madt_local_apic {
329 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 310 struct acpi_subtable_header header;
330 u8 local_apic_id; /* Processor's local APIC id */ 311 u8 processor_id; /* ACPI processor id */
331 ACPI_MADT_LFLAGS}; 312 u8 id; /* Processor's local APIC id */
313 u32 lapic_flags;
314};
332 315
333/* 1: IO APIC */ 316/* 1: IO APIC */
334 317
335struct madt_io_apic { 318struct acpi_madt_io_apic {
336 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ 319 struct acpi_subtable_header header;
320 u8 id; /* I/O APIC ID */
337 u8 reserved; /* Reserved - must be zero */ 321 u8 reserved; /* Reserved - must be zero */
338 u32 address; /* APIC physical address */ 322 u32 address; /* APIC physical address */
339 u32 interrupt; /* Global system interrupt where INTI lines start */ 323 u32 global_irq_base; /* Global system interrupt where INTI lines start */
340}; 324};
341 325
342/* 2: Interrupt Override */ 326/* 2: Interrupt Override */
343 327
344struct madt_interrupt_override { 328struct acpi_madt_interrupt_override {
345 APIC_HEADER_DEF u8 bus; /* 0 - ISA */ 329 struct acpi_subtable_header header;
346 u8 source; /* Interrupt source (IRQ) */ 330 u8 bus; /* 0 - ISA */
347 u32 interrupt; /* Global system interrupt */ 331 u8 source_irq; /* Interrupt source (IRQ) */
348 ACPI_MADT_IFLAGS}; 332 u32 global_irq; /* Global system interrupt */
333 u16 inti_flags;
334};
349 335
350/* 3: NMI Sources */ 336/* 3: NMI Source */
351 337
352struct madt_nmi_source { 338struct acpi_madt_nmi_source {
353 APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */ 339 struct acpi_subtable_header header;
340 u16 inti_flags;
341 u32 global_irq; /* Global system interrupt */
354}; 342};
355 343
356/* 4: Local APIC NMI */ 344/* 4: Local APIC NMI */
357 345
358struct madt_local_apic_nmi { 346struct acpi_madt_local_apic_nmi {
359 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 347 struct acpi_subtable_header header;
360 ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */ 348 u8 processor_id; /* ACPI processor id */
349 u16 inti_flags;
350 u8 lint; /* LINTn to which NMI is connected */
361}; 351};
362 352
363/* 5: Address Override */ 353/* 5: Address Override */
364 354
365struct madt_address_override { 355struct acpi_madt_local_apic_override {
366 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ 356 struct acpi_subtable_header header;
357 u16 reserved; /* Reserved, must be zero */
367 u64 address; /* APIC physical address */ 358 u64 address; /* APIC physical address */
368}; 359};
369 360
370/* 6: I/O Sapic */ 361/* 6: I/O Sapic */
371 362
372struct madt_io_sapic { 363struct acpi_madt_io_sapic {
373 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ 364 struct acpi_subtable_header header;
365 u8 id; /* I/O SAPIC ID */
374 u8 reserved; /* Reserved, must be zero */ 366 u8 reserved; /* Reserved, must be zero */
375 u32 interrupt_base; /* Glocal interrupt for SAPIC start */ 367 u32 global_irq_base; /* Global interrupt for SAPIC start */
376 u64 address; /* SAPIC physical address */ 368 u64 address; /* SAPIC physical address */
377}; 369};
378 370
379/* 7: Local Sapic */ 371/* 7: Local Sapic */
380 372
381struct madt_local_sapic { 373struct acpi_madt_local_sapic {
382 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 374 struct acpi_subtable_header header;
383 u8 local_sapic_id; /* SAPIC ID */ 375 u8 processor_id; /* ACPI processor id */
384 u8 local_sapic_eid; /* SAPIC EID */ 376 u8 id; /* SAPIC ID */
377 u8 eid; /* SAPIC EID */
385 u8 reserved[3]; /* Reserved, must be zero */ 378 u8 reserved[3]; /* Reserved, must be zero */
386 ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ 379 u32 lapic_flags;
387 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ 380 u32 uid; /* Numeric UID - ACPI 3.0 */
381 char uid_string[1]; /* String UID - ACPI 3.0 */
388}; 382};
389 383
390/* 8: Platform Interrupt Source */ 384/* 8: Platform Interrupt Source */
391 385
392struct madt_interrupt_source { 386struct acpi_madt_interrupt_source {
393 APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ 387 struct acpi_subtable_header header;
394 u8 processor_id; /* Processor ID */ 388 u16 inti_flags;
395 u8 processor_eid; /* Processor EID */ 389 u8 type; /* 1=PMI, 2=INIT, 3=corrected */
390 u8 id; /* Processor ID */
391 u8 eid; /* Processor EID */
396 u8 io_sapic_vector; /* Vector value for PMI interrupts */ 392 u8 io_sapic_vector; /* Vector value for PMI interrupts */
397 u32 interrupt; /* Global system interrupt */ 393 u32 global_irq; /* Global system interrupt */
398 u32 flags; /* Interrupt Source Flags */ 394 u32 flags; /* Interrupt Source Flags */
399}; 395};
400 396
401#ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H 397/* Flags field above */
398
399#define ACPI_MADT_CPEI_OVERRIDE (1)
400
401/*
402 * Common flags fields for MADT subtables
403 */
404
405/* MADT Local APIC flags (lapic_flags) */
406
407#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
408
409/* MADT MPS INTI flags (inti_flags) */
410
411#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
412#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
413
414/* Values for MPS INTI flags */
415
416#define ACPI_MADT_POLARITY_CONFORMS 0
417#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
418#define ACPI_MADT_POLARITY_RESERVED 2
419#define ACPI_MADT_POLARITY_ACTIVE_LOW 3
420
421#define ACPI_MADT_TRIGGER_CONFORMS (0)
422#define ACPI_MADT_TRIGGER_EDGE (1<<2)
423#define ACPI_MADT_TRIGGER_RESERVED (2<<2)
424#define ACPI_MADT_TRIGGER_LEVEL (3<<2)
425
402/******************************************************************************* 426/*******************************************************************************
403 * 427 *
404 * MCFG - PCI Memory Mapped Configuration table and sub-table 428 * MCFG - PCI Memory Mapped Configuration table and sub-table
@@ -406,17 +430,19 @@ struct madt_interrupt_source {
406 ******************************************************************************/ 430 ******************************************************************************/
407 431
408struct acpi_table_mcfg { 432struct acpi_table_mcfg {
409 ACPI_TABLE_HEADER_DEF u8 reserved[8]; 433 struct acpi_table_header header; /* Common ACPI table header */
434 u8 reserved[8];
410}; 435};
411 436
437/* Subtable */
438
412struct acpi_mcfg_allocation { 439struct acpi_mcfg_allocation {
413 u64 base_address; /* Base address, processor-relative */ 440 u64 address; /* Base address, processor-relative */
414 u16 pci_segment; /* PCI segment group number */ 441 u16 pci_segment; /* PCI segment group number */
415 u8 start_bus_number; /* Starting PCI Bus number */ 442 u8 start_bus_number; /* Starting PCI Bus number */
416 u8 end_bus_number; /* Final PCI Bus number */ 443 u8 end_bus_number; /* Final PCI Bus number */
417 u32 reserved; 444 u32 reserved;
418}; 445};
419#endif
420 446
421/******************************************************************************* 447/*******************************************************************************
422 * 448 *
@@ -424,8 +450,9 @@ struct acpi_mcfg_allocation {
424 * 450 *
425 ******************************************************************************/ 451 ******************************************************************************/
426 452
427struct smart_battery_table { 453struct acpi_table_sbst {
428 ACPI_TABLE_HEADER_DEF u32 warning_level; 454 struct acpi_table_header header; /* Common ACPI table header */
455 u32 warning_level;
429 u32 low_level; 456 u32 low_level;
430 u32 critical_level; 457 u32 critical_level;
431}; 458};
@@ -436,9 +463,10 @@ struct smart_battery_table {
436 * 463 *
437 ******************************************************************************/ 464 ******************************************************************************/
438 465
439struct system_locality_info { 466struct acpi_table_slit {
440 ACPI_TABLE_HEADER_DEF u64 locality_count; 467 struct acpi_table_header header; /* Common ACPI table header */
441 u8 entry[1][1]; 468 u64 locality_count;
469 u8 entry[1]; /* Real size = localities^2 */
442}; 470};
443 471
444/******************************************************************************* 472/*******************************************************************************
@@ -448,7 +476,8 @@ struct system_locality_info {
448 ******************************************************************************/ 476 ******************************************************************************/
449 477
450struct acpi_table_spcr { 478struct acpi_table_spcr {
451 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 479 struct acpi_table_header header; /* Common ACPI table header */
480 u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
452 u8 reserved[3]; 481 u8 reserved[3];
453 struct acpi_generic_address serial_port; 482 struct acpi_generic_address serial_port;
454 u8 interrupt_type; 483 u8 interrupt_type;
@@ -459,7 +488,7 @@ struct acpi_table_spcr {
459 u8 stop_bits; 488 u8 stop_bits;
460 u8 flow_control; 489 u8 flow_control;
461 u8 terminal_type; 490 u8 terminal_type;
462 u8 reserved2; 491 u8 reserved1;
463 u16 pci_device_id; 492 u16 pci_device_id;
464 u16 pci_vendor_id; 493 u16 pci_vendor_id;
465 u8 pci_bus; 494 u8 pci_bus;
@@ -467,7 +496,7 @@ struct acpi_table_spcr {
467 u8 pci_function; 496 u8 pci_function;
468 u32 pci_flags; 497 u32 pci_flags;
469 u8 pci_segment; 498 u8 pci_segment;
470 u32 reserved3; 499 u32 reserved2;
471}; 500};
472 501
473/******************************************************************************* 502/*******************************************************************************
@@ -477,12 +506,13 @@ struct acpi_table_spcr {
477 ******************************************************************************/ 506 ******************************************************************************/
478 507
479struct acpi_table_spmi { 508struct acpi_table_spmi {
480 ACPI_TABLE_HEADER_DEF u8 reserved; 509 struct acpi_table_header header; /* Common ACPI table header */
510 u8 reserved;
481 u8 interface_type; 511 u8 interface_type;
482 u16 spec_revision; /* Version of IPMI */ 512 u16 spec_revision; /* Version of IPMI */
483 u8 interrupt_type; 513 u8 interrupt_type;
484 u8 gpe_number; /* GPE assigned */ 514 u8 gpe_number; /* GPE assigned */
485 u8 reserved2; 515 u8 reserved1;
486 u8 pci_device_flag; 516 u8 pci_device_flag;
487 u32 interrupt; 517 u32 interrupt;
488 struct acpi_generic_address ipmi_register; 518 struct acpi_generic_address ipmi_register;
@@ -498,56 +528,61 @@ struct acpi_table_spmi {
498 * 528 *
499 ******************************************************************************/ 529 ******************************************************************************/
500 530
501struct system_resource_affinity { 531struct acpi_table_srat {
502 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ 532 struct acpi_table_header header; /* Common ACPI table header */
503 u64 reserved2; /* Reserved, must be zero */ 533 u32 table_revision; /* Must be value '1' */
534 u64 reserved; /* Reserved, must be zero */
504}; 535};
505 536
506/* SRAT common sub-table header */ 537/* Values for subtable type in struct acpi_subtable_header */
507
508#define SRAT_SUBTABLE_HEADER \
509 u8 type; \
510 u8 length;
511
512/* Values for Type above */
513 538
514#define SRAT_CPU_AFFINITY 0 539enum acpi_srat_type {
515#define SRAT_MEMORY_AFFINITY 1 540 ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
516#define SRAT_RESERVED 2 541 ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
542 ACPI_SRAT_TYPE_RESERVED = 2
543};
517 544
518/* SRAT sub-tables */ 545/* SRAT sub-tables */
519 546
520struct static_resource_alloc { 547struct acpi_srat_cpu_affinity {
521 SRAT_SUBTABLE_HEADER u8 proximity_domain_lo; 548 struct acpi_subtable_header header;
549 u8 proximity_domain_lo;
522 u8 apic_id; 550 u8 apic_id;
523 551 u32 flags;
524 /* Flags (32 bits) */
525
526 u8 enabled:1; /* 00: Use affinity structure */
527 u8:7; /* 01-07: Reserved, must be zero */
528 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
529
530 u8 local_sapic_eid; 552 u8 local_sapic_eid;
531 u8 proximity_domain_hi[3]; 553 u8 proximity_domain_hi[3];
532 u32 reserved4; /* Reserved, must be zero */ 554 u32 reserved; /* Reserved, must be zero */
533}; 555};
534 556
535struct memory_affinity { 557/* Flags */
536 SRAT_SUBTABLE_HEADER u32 proximity_domain; 558
537 u16 reserved3; 559#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
560
561struct acpi_srat_mem_affinity {
562 struct acpi_subtable_header header;
563 u32 proximity_domain;
564 u16 reserved; /* Reserved, must be zero */
538 u64 base_address; 565 u64 base_address;
539 u64 address_length; 566 u64 length;
540 u32 reserved4; 567 u32 memory_type; /* See acpi_address_range_id */
568 u32 flags;
569 u64 reserved1; /* Reserved, must be zero */
570};
571
572/* Flags */
541 573
542 /* Flags (32 bits) */ 574#define ACPI_SRAT_MEM_ENABLED (1) /* 00: Use affinity structure */
575#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
576#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
543 577
544 u8 enabled:1; /* 00: Use affinity structure */ 578/* Memory types */
545 u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
546 u8 non_volatile:1; /* 02: Memory is non-volatile */
547 u8:5; /* 03-07: Reserved, must be zero */
548 u8 reserved5[3]; /* 08-31: Reserved, must be zero */
549 579
550 u64 reserved6; /* Reserved, must be zero */ 580enum acpi_address_range_id {
581 ACPI_ADDRESS_RANGE_MEMORY = 1,
582 ACPI_ADDRESS_RANGE_RESERVED = 2,
583 ACPI_ADDRESS_RANGE_ACPI = 3,
584 ACPI_ADDRESS_RANGE_NVS = 4,
585 ACPI_ADDRESS_RANGE_COUNT = 5
551}; 586};
552 587
553/******************************************************************************* 588/*******************************************************************************
@@ -557,7 +592,8 @@ struct memory_affinity {
557 ******************************************************************************/ 592 ******************************************************************************/
558 593
559struct acpi_table_tcpa { 594struct acpi_table_tcpa {
560 ACPI_TABLE_HEADER_DEF u16 reserved; 595 struct acpi_table_header header; /* Common ACPI table header */
596 u16 reserved;
561 u32 max_log_length; /* Maximum length for the event log area */ 597 u32 max_log_length; /* Maximum length for the event log area */
562 u64 log_address; /* Address of the event log area */ 598 u64 log_address; /* Address of the event log area */
563}; 599};
@@ -569,7 +605,8 @@ struct acpi_table_tcpa {
569 ******************************************************************************/ 605 ******************************************************************************/
570 606
571struct acpi_table_wdrt { 607struct acpi_table_wdrt {
572 ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */ 608 struct acpi_table_header header; /* Common ACPI table header */
609 u32 header_length; /* Watchdog Header Length */
573 u8 pci_segment; /* PCI Segment number */ 610 u8 pci_segment; /* PCI Segment number */
574 u8 pci_bus; /* PCI Bus number */ 611 u8 pci_bus; /* PCI Bus number */
575 u8 pci_device; /* PCI Device number */ 612 u8 pci_device; /* PCI Device number */
@@ -582,58 +619,9 @@ struct acpi_table_wdrt {
582 u32 entries; /* Number of watchdog entries that follow */ 619 u32 entries; /* Number of watchdog entries that follow */
583}; 620};
584 621
585#if 0 /* Flags, will be converted to macros */ 622/* Flags */
586u8 enabled:1; /* 00: Timer enabled */ 623
587u8:6; /* 01-06: Reserved */ 624#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */
588u8 sleep_stop:1; /* 07: Timer stopped in sleep state */
589#endif
590
591/* Macros used to generate offsets to specific table fields */
592
593#define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f)
594#define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f)
595#define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f)
596#define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f)
597#define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f)
598#define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f)
599#define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f)
600#define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f)
601#define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f)
602#define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f)
603#define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f)
604#define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f)
605#define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f)
606#define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f)
607#define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f)
608#define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f)
609#define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f)
610#define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f)
611#define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f)
612#define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f)
613#define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f)
614#define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f)
615#define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f)
616#define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f)
617#define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f)
618#define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f)
619#define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f)
620#define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f)
621#define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f)
622#define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f)
623#define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f)
624#define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f)
625#define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f)
626
627#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o)
628#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o)
629#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o)
630#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o)
631#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o)
632#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o)
633#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o)
634#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o)
635#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o)
636#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o)
637 625
638/* Reset to default packing */ 626/* Reset to default packing */
639 627
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 64b603cfe92e..b0cdee69ff5d 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -191,7 +191,7 @@ typedef s32 acpi_native_int;
191 191
192typedef u64 acpi_table_ptr; 192typedef u64 acpi_table_ptr;
193typedef u32 acpi_io_address; 193typedef u32 acpi_io_address;
194typedef u64 acpi_physical_address; 194typedef u32 acpi_physical_address;
195 195
196#define ACPI_MAX_PTR ACPI_UINT32_MAX 196#define ACPI_MAX_PTR ACPI_UINT32_MAX
197#define ACPI_SIZE_MAX ACPI_UINT32_MAX 197#define ACPI_SIZE_MAX ACPI_UINT32_MAX
@@ -311,36 +311,6 @@ typedef acpi_native_uint acpi_size;
311 * 311 *
312 ******************************************************************************/ 312 ******************************************************************************/
313 313
314/*
315 * Pointer overlays to avoid lots of typecasting for
316 * code that accepts both physical and logical pointers.
317 */
318union acpi_pointers {
319 acpi_physical_address physical;
320 void *logical;
321 acpi_table_ptr value;
322};
323
324struct acpi_pointer {
325 u32 pointer_type;
326 union acpi_pointers pointer;
327};
328
329/* pointer_types for above */
330
331#define ACPI_PHYSICAL_POINTER 0x01
332#define ACPI_LOGICAL_POINTER 0x02
333
334/* Processor mode */
335
336#define ACPI_PHYSICAL_ADDRESSING 0x04
337#define ACPI_LOGICAL_ADDRESSING 0x08
338#define ACPI_MEMORY_MODE 0x0C
339
340#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
341#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
342#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
343
344/* Logical defines and NULL */ 314/* Logical defines and NULL */
345 315
346#ifdef FALSE 316#ifdef FALSE
@@ -491,21 +461,6 @@ typedef u64 acpi_integer;
491#define ACPI_NOTIFY_POWER_FAULT (u8) 7 461#define ACPI_NOTIFY_POWER_FAULT (u8) 7
492 462
493/* 463/*
494 * Table types. These values are passed to the table related APIs
495 */
496typedef u32 acpi_table_type;
497
498#define ACPI_TABLE_ID_RSDP (acpi_table_type) 0
499#define ACPI_TABLE_ID_DSDT (acpi_table_type) 1
500#define ACPI_TABLE_ID_FADT (acpi_table_type) 2
501#define ACPI_TABLE_ID_FACS (acpi_table_type) 3
502#define ACPI_TABLE_ID_PSDT (acpi_table_type) 4
503#define ACPI_TABLE_ID_SSDT (acpi_table_type) 5
504#define ACPI_TABLE_ID_XSDT (acpi_table_type) 6
505#define ACPI_TABLE_ID_MAX 6
506#define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1)
507
508/*
509 * Types associated with ACPI names and objects. The first group of 464 * Types associated with ACPI names and objects. The first group of
510 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 465 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
511 * of the ACPI object_type() operator (See the ACPI Spec). Therefore, 466 * of the ACPI object_type() operator (See the ACPI Spec). Therefore,
@@ -816,13 +771,6 @@ struct acpi_buffer {
816#define ACPI_SYS_MODES_MASK 0x0003 771#define ACPI_SYS_MODES_MASK 0x0003
817 772
818/* 773/*
819 * ACPI Table Info. One per ACPI table _type_
820 */
821struct acpi_table_info {
822 u32 count;
823};
824
825/*
826 * System info returned by acpi_get_system_info() 774 * System info returned by acpi_get_system_info()
827 */ 775 */
828struct acpi_system_info { 776struct acpi_system_info {
@@ -833,8 +781,6 @@ struct acpi_system_info {
833 u32 reserved2; 781 u32 reserved2;
834 u32 debug_level; 782 u32 debug_level;
835 u32 debug_layer; 783 u32 debug_layer;
836 u32 num_table_types;
837 struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1];
838}; 784};
839 785
840/* 786/*