diff options
Diffstat (limited to 'drivers/acpi/tables/tbgetall.c')
-rw-r--r-- | drivers/acpi/tables/tbgetall.c | 189 |
1 files changed, 82 insertions, 107 deletions
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index eea5b8cb5ebb..8d72343537e7 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c | |||
@@ -41,27 +41,21 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
47 | 46 | ||
48 | |||
49 | #define _COMPONENT ACPI_TABLES | 47 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbgetall") | 48 | ACPI_MODULE_NAME("tbgetall") |
51 | 49 | ||
52 | /* Local prototypes */ | 50 | /* Local prototypes */ |
53 | |||
54 | static acpi_status | 51 | static acpi_status |
55 | acpi_tb_get_primary_table ( | 52 | acpi_tb_get_primary_table(struct acpi_pointer *address, |
56 | struct acpi_pointer *address, | 53 | struct acpi_table_desc *table_info); |
57 | struct acpi_table_desc *table_info); | ||
58 | 54 | ||
59 | static acpi_status | 55 | static acpi_status |
60 | acpi_tb_get_secondary_table ( | 56 | acpi_tb_get_secondary_table(struct acpi_pointer *address, |
61 | struct acpi_pointer *address, | 57 | acpi_string signature, |
62 | acpi_string signature, | 58 | struct acpi_table_desc *table_info); |
63 | struct acpi_table_desc *table_info); | ||
64 | |||
65 | 59 | ||
66 | /******************************************************************************* | 60 | /******************************************************************************* |
67 | * | 61 | * |
@@ -77,58 +71,54 @@ acpi_tb_get_secondary_table ( | |||
77 | ******************************************************************************/ | 71 | ******************************************************************************/ |
78 | 72 | ||
79 | static acpi_status | 73 | static acpi_status |
80 | acpi_tb_get_primary_table ( | 74 | acpi_tb_get_primary_table(struct acpi_pointer *address, |
81 | struct acpi_pointer *address, | 75 | struct acpi_table_desc *table_info) |
82 | struct acpi_table_desc *table_info) | ||
83 | { | 76 | { |
84 | acpi_status status; | 77 | acpi_status status; |
85 | struct acpi_table_header header; | 78 | struct acpi_table_header header; |
86 | |||
87 | |||
88 | ACPI_FUNCTION_TRACE ("tb_get_primary_table"); | ||
89 | 79 | ||
80 | ACPI_FUNCTION_TRACE("tb_get_primary_table"); | ||
90 | 81 | ||
91 | /* Ignore a NULL address in the RSDT */ | 82 | /* Ignore a NULL address in the RSDT */ |
92 | 83 | ||
93 | if (!address->pointer.value) { | 84 | if (!address->pointer.value) { |
94 | return_ACPI_STATUS (AE_OK); | 85 | return_ACPI_STATUS(AE_OK); |
95 | } | 86 | } |
96 | 87 | ||
97 | /* Get the header in order to get signature and table size */ | 88 | /* Get the header in order to get signature and table size */ |
98 | 89 | ||
99 | status = acpi_tb_get_table_header (address, &header); | 90 | status = acpi_tb_get_table_header(address, &header); |
100 | if (ACPI_FAILURE (status)) { | 91 | if (ACPI_FAILURE(status)) { |
101 | return_ACPI_STATUS (status); | 92 | return_ACPI_STATUS(status); |
102 | } | 93 | } |
103 | 94 | ||
104 | /* Clear the table_info */ | 95 | /* Clear the table_info */ |
105 | 96 | ||
106 | ACPI_MEMSET (table_info, 0, sizeof (struct acpi_table_desc)); | 97 | ACPI_MEMSET(table_info, 0, sizeof(struct acpi_table_desc)); |
107 | 98 | ||
108 | /* | 99 | /* |
109 | * Check the table signature and make sure it is recognized. | 100 | * Check the table signature and make sure it is recognized. |
110 | * Also checks the header checksum | 101 | * Also checks the header checksum |
111 | */ | 102 | */ |
112 | table_info->pointer = &header; | 103 | table_info->pointer = &header; |
113 | status = acpi_tb_recognize_table (table_info, ACPI_TABLE_PRIMARY); | 104 | status = acpi_tb_recognize_table(table_info, ACPI_TABLE_PRIMARY); |
114 | if (ACPI_FAILURE (status)) { | 105 | if (ACPI_FAILURE(status)) { |
115 | return_ACPI_STATUS (status); | 106 | return_ACPI_STATUS(status); |
116 | } | 107 | } |
117 | 108 | ||
118 | /* Get the entire table */ | 109 | /* Get the entire table */ |
119 | 110 | ||
120 | status = acpi_tb_get_table_body (address, &header, table_info); | 111 | status = acpi_tb_get_table_body(address, &header, table_info); |
121 | if (ACPI_FAILURE (status)) { | 112 | if (ACPI_FAILURE(status)) { |
122 | return_ACPI_STATUS (status); | 113 | return_ACPI_STATUS(status); |
123 | } | 114 | } |
124 | 115 | ||
125 | /* Install the table */ | 116 | /* Install the table */ |
126 | 117 | ||
127 | status = acpi_tb_install_table (table_info); | 118 | status = acpi_tb_install_table(table_info); |
128 | return_ACPI_STATUS (status); | 119 | return_ACPI_STATUS(status); |
129 | } | 120 | } |
130 | 121 | ||
131 | |||
132 | /******************************************************************************* | 122 | /******************************************************************************* |
133 | * | 123 | * |
134 | * FUNCTION: acpi_tb_get_secondary_table | 124 | * FUNCTION: acpi_tb_get_secondary_table |
@@ -143,32 +133,27 @@ acpi_tb_get_primary_table ( | |||
143 | ******************************************************************************/ | 133 | ******************************************************************************/ |
144 | 134 | ||
145 | static acpi_status | 135 | static acpi_status |
146 | acpi_tb_get_secondary_table ( | 136 | acpi_tb_get_secondary_table(struct acpi_pointer *address, |
147 | struct acpi_pointer *address, | 137 | acpi_string signature, |
148 | acpi_string signature, | 138 | struct acpi_table_desc *table_info) |
149 | struct acpi_table_desc *table_info) | ||
150 | { | 139 | { |
151 | acpi_status status; | 140 | acpi_status status; |
152 | struct acpi_table_header header; | 141 | struct acpi_table_header header; |
153 | |||
154 | |||
155 | ACPI_FUNCTION_TRACE_STR ("tb_get_secondary_table", signature); | ||
156 | 142 | ||
143 | ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature); | ||
157 | 144 | ||
158 | /* Get the header in order to match the signature */ | 145 | /* Get the header in order to match the signature */ |
159 | 146 | ||
160 | status = acpi_tb_get_table_header (address, &header); | 147 | status = acpi_tb_get_table_header(address, &header); |
161 | if (ACPI_FAILURE (status)) { | 148 | if (ACPI_FAILURE(status)) { |
162 | return_ACPI_STATUS (status); | 149 | return_ACPI_STATUS(status); |
163 | } | 150 | } |
164 | 151 | ||
165 | /* Signature must match request */ | 152 | /* Signature must match request */ |
166 | 153 | ||
167 | if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { | 154 | if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) { |
168 | ACPI_REPORT_ERROR (( | 155 | ACPI_REPORT_ERROR(("Incorrect table signature - wanted [%s] found [%4.4s]\n", signature, header.signature)); |
169 | "Incorrect table signature - wanted [%s] found [%4.4s]\n", | 156 | return_ACPI_STATUS(AE_BAD_SIGNATURE); |
170 | signature, header.signature)); | ||
171 | return_ACPI_STATUS (AE_BAD_SIGNATURE); | ||
172 | } | 157 | } |
173 | 158 | ||
174 | /* | 159 | /* |
@@ -176,25 +161,24 @@ acpi_tb_get_secondary_table ( | |||
176 | * Also checks the header checksum | 161 | * Also checks the header checksum |
177 | */ | 162 | */ |
178 | table_info->pointer = &header; | 163 | table_info->pointer = &header; |
179 | status = acpi_tb_recognize_table (table_info, ACPI_TABLE_SECONDARY); | 164 | status = acpi_tb_recognize_table(table_info, ACPI_TABLE_SECONDARY); |
180 | if (ACPI_FAILURE (status)) { | 165 | if (ACPI_FAILURE(status)) { |
181 | return_ACPI_STATUS (status); | 166 | return_ACPI_STATUS(status); |
182 | } | 167 | } |
183 | 168 | ||
184 | /* Get the entire table */ | 169 | /* Get the entire table */ |
185 | 170 | ||
186 | status = acpi_tb_get_table_body (address, &header, table_info); | 171 | status = acpi_tb_get_table_body(address, &header, table_info); |
187 | if (ACPI_FAILURE (status)) { | 172 | if (ACPI_FAILURE(status)) { |
188 | return_ACPI_STATUS (status); | 173 | return_ACPI_STATUS(status); |
189 | } | 174 | } |
190 | 175 | ||
191 | /* Install the table */ | 176 | /* Install the table */ |
192 | 177 | ||
193 | status = acpi_tb_install_table (table_info); | 178 | status = acpi_tb_install_table(table_info); |
194 | return_ACPI_STATUS (status); | 179 | return_ACPI_STATUS(status); |
195 | } | 180 | } |
196 | 181 | ||
197 | |||
198 | /******************************************************************************* | 182 | /******************************************************************************* |
199 | * | 183 | * |
200 | * FUNCTION: acpi_tb_get_required_tables | 184 | * FUNCTION: acpi_tb_get_required_tables |
@@ -214,23 +198,19 @@ acpi_tb_get_secondary_table ( | |||
214 | * | 198 | * |
215 | ******************************************************************************/ | 199 | ******************************************************************************/ |
216 | 200 | ||
217 | acpi_status | 201 | acpi_status acpi_tb_get_required_tables(void) |
218 | acpi_tb_get_required_tables ( | ||
219 | void) | ||
220 | { | 202 | { |
221 | acpi_status status = AE_OK; | 203 | acpi_status status = AE_OK; |
222 | u32 i; | 204 | u32 i; |
223 | struct acpi_table_desc table_info; | 205 | struct acpi_table_desc table_info; |
224 | struct acpi_pointer address; | 206 | struct acpi_pointer address; |
225 | |||
226 | 207 | ||
227 | ACPI_FUNCTION_TRACE ("tb_get_required_tables"); | 208 | ACPI_FUNCTION_TRACE("tb_get_required_tables"); |
228 | 209 | ||
229 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", | 210 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", |
230 | acpi_gbl_rsdt_table_count)); | 211 | acpi_gbl_rsdt_table_count)); |
231 | 212 | ||
232 | 213 | address.pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; | |
233 | address.pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING; | ||
234 | 214 | ||
235 | /* | 215 | /* |
236 | * Loop through all table pointers found in RSDT. | 216 | * Loop through all table pointers found in RSDT. |
@@ -243,84 +223,79 @@ acpi_tb_get_required_tables ( | |||
243 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 223 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
244 | /* Get the table address from the common internal XSDT */ | 224 | /* Get the table address from the common internal XSDT */ |
245 | 225 | ||
246 | address.pointer.value = | 226 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; |
247 | acpi_gbl_XSDT->table_offset_entry[i]; | ||
248 | 227 | ||
249 | /* | 228 | /* |
250 | * Get the tables needed by this subsystem (FADT and any SSDTs). | 229 | * Get the tables needed by this subsystem (FADT and any SSDTs). |
251 | * NOTE: All other tables are completely ignored at this time. | 230 | * NOTE: All other tables are completely ignored at this time. |
252 | */ | 231 | */ |
253 | status = acpi_tb_get_primary_table (&address, &table_info); | 232 | status = acpi_tb_get_primary_table(&address, &table_info); |
254 | if ((status != AE_OK) && (status != AE_TABLE_NOT_SUPPORTED)) { | 233 | if ((status != AE_OK) && (status != AE_TABLE_NOT_SUPPORTED)) { |
255 | ACPI_REPORT_WARNING (("%s, while getting table at %8.8X%8.8X\n", | 234 | ACPI_REPORT_WARNING(("%s, while getting table at %8.8X%8.8X\n", acpi_format_exception(status), ACPI_FORMAT_UINT64(address.pointer.value))); |
256 | acpi_format_exception (status), | ||
257 | ACPI_FORMAT_UINT64 (address.pointer.value))); | ||
258 | } | 235 | } |
259 | } | 236 | } |
260 | 237 | ||
261 | /* We must have a FADT to continue */ | 238 | /* We must have a FADT to continue */ |
262 | 239 | ||
263 | if (!acpi_gbl_FADT) { | 240 | if (!acpi_gbl_FADT) { |
264 | ACPI_REPORT_ERROR (("No FADT present in RSDT/XSDT\n")); | 241 | ACPI_REPORT_ERROR(("No FADT present in RSDT/XSDT\n")); |
265 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 242 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
266 | } | 243 | } |
267 | 244 | ||
268 | /* | 245 | /* |
269 | * Convert the FADT to a common format. This allows earlier revisions of | 246 | * Convert the FADT to a common format. This allows earlier revisions of |
270 | * the table to coexist with newer versions, using common access code. | 247 | * the table to coexist with newer versions, using common access code. |
271 | */ | 248 | */ |
272 | status = acpi_tb_convert_table_fadt (); | 249 | status = acpi_tb_convert_table_fadt(); |
273 | if (ACPI_FAILURE (status)) { | 250 | if (ACPI_FAILURE(status)) { |
274 | ACPI_REPORT_ERROR (( | 251 | ACPI_REPORT_ERROR(("Could not convert FADT to internal common format\n")); |
275 | "Could not convert FADT to internal common format\n")); | 252 | return_ACPI_STATUS(status); |
276 | return_ACPI_STATUS (status); | ||
277 | } | 253 | } |
278 | 254 | ||
279 | /* Get the FACS (Pointed to by the FADT) */ | 255 | /* Get the FACS (Pointed to by the FADT) */ |
280 | 256 | ||
281 | address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; | 257 | address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; |
282 | 258 | ||
283 | status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); | 259 | status = acpi_tb_get_secondary_table(&address, FACS_SIG, &table_info); |
284 | if (ACPI_FAILURE (status)) { | 260 | if (ACPI_FAILURE(status)) { |
285 | ACPI_REPORT_ERROR (("Could not get/install the FACS, %s\n", | 261 | ACPI_REPORT_ERROR(("Could not get/install the FACS, %s\n", |
286 | acpi_format_exception (status))); | 262 | acpi_format_exception(status))); |
287 | return_ACPI_STATUS (status); | 263 | return_ACPI_STATUS(status); |
288 | } | 264 | } |
289 | 265 | ||
290 | /* | 266 | /* |
291 | * Create the common FACS pointer table | 267 | * Create the common FACS pointer table |
292 | * (Contains pointers to the original table) | 268 | * (Contains pointers to the original table) |
293 | */ | 269 | */ |
294 | status = acpi_tb_build_common_facs (&table_info); | 270 | status = acpi_tb_build_common_facs(&table_info); |
295 | if (ACPI_FAILURE (status)) { | 271 | if (ACPI_FAILURE(status)) { |
296 | return_ACPI_STATUS (status); | 272 | return_ACPI_STATUS(status); |
297 | } | 273 | } |
298 | 274 | ||
299 | /* Get/install the DSDT (Pointed to by the FADT) */ | 275 | /* Get/install the DSDT (Pointed to by the FADT) */ |
300 | 276 | ||
301 | address.pointer.value = acpi_gbl_FADT->Xdsdt; | 277 | address.pointer.value = acpi_gbl_FADT->Xdsdt; |
302 | 278 | ||
303 | status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); | 279 | status = acpi_tb_get_secondary_table(&address, DSDT_SIG, &table_info); |
304 | if (ACPI_FAILURE (status)) { | 280 | if (ACPI_FAILURE(status)) { |
305 | ACPI_REPORT_ERROR (("Could not get/install the DSDT\n")); | 281 | ACPI_REPORT_ERROR(("Could not get/install the DSDT\n")); |
306 | return_ACPI_STATUS (status); | 282 | return_ACPI_STATUS(status); |
307 | } | 283 | } |
308 | 284 | ||
309 | /* Set Integer Width (32/64) based upon DSDT revision */ | 285 | /* Set Integer Width (32/64) based upon DSDT revision */ |
310 | 286 | ||
311 | acpi_ut_set_integer_width (acpi_gbl_DSDT->revision); | 287 | acpi_ut_set_integer_width(acpi_gbl_DSDT->revision); |
312 | 288 | ||
313 | /* Dump the entire DSDT */ | 289 | /* Dump the entire DSDT */ |
314 | 290 | ||
315 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, | 291 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
316 | "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", | 292 | "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", |
317 | acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, acpi_gbl_integer_bit_width)); | 293 | acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, |
318 | ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length); | 294 | acpi_gbl_integer_bit_width)); |
295 | ACPI_DUMP_BUFFER((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length); | ||
319 | 296 | ||
320 | /* Always delete the RSDP mapping, we are done with it */ | 297 | /* Always delete the RSDP mapping, we are done with it */ |
321 | 298 | ||
322 | acpi_tb_delete_tables_by_type (ACPI_TABLE_RSDP); | 299 | acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP); |
323 | return_ACPI_STATUS (status); | 300 | return_ACPI_STATUS(status); |
324 | } | 301 | } |
325 | |||
326 | |||