aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbxface.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/tables/tbxface.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables/tbxface.c')
-rw-r--r--drivers/acpi/tables/tbxface.c246
1 files changed, 107 insertions, 139 deletions
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index e18a05d1b9b3..3f96a4909aad 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -48,10 +48,8 @@
48#include <acpi/acnamesp.h> 48#include <acpi/acnamesp.h>
49#include <acpi/actables.h> 49#include <acpi/actables.h>
50 50
51
52#define _COMPONENT ACPI_TABLES 51#define _COMPONENT ACPI_TABLES
53 ACPI_MODULE_NAME ("tbxface") 52ACPI_MODULE_NAME("tbxface")
54
55 53
56/******************************************************************************* 54/*******************************************************************************
57 * 55 *
@@ -65,25 +63,20 @@
65 * provided RSDT 63 * provided RSDT
66 * 64 *
67 ******************************************************************************/ 65 ******************************************************************************/
68 66acpi_status acpi_load_tables(void)
69acpi_status
70acpi_load_tables (
71 void)
72{ 67{
73 struct acpi_pointer rsdp_address; 68 struct acpi_pointer rsdp_address;
74 acpi_status status; 69 acpi_status status;
75
76
77 ACPI_FUNCTION_TRACE ("acpi_load_tables");
78 70
71 ACPI_FUNCTION_TRACE("acpi_load_tables");
79 72
80 /* Get the RSDP */ 73 /* Get the RSDP */
81 74
82 status = acpi_os_get_root_pointer (ACPI_LOGICAL_ADDRESSING, 75 status = acpi_os_get_root_pointer(ACPI_LOGICAL_ADDRESSING,
83 &rsdp_address); 76 &rsdp_address);
84 if (ACPI_FAILURE (status)) { 77 if (ACPI_FAILURE(status)) {
85 ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", 78 ACPI_REPORT_ERROR(("acpi_load_tables: Could not get RSDP, %s\n",
86 acpi_format_exception (status))); 79 acpi_format_exception(status)));
87 goto error_exit; 80 goto error_exit;
88 } 81 }
89 82
@@ -91,54 +84,47 @@ acpi_load_tables (
91 84
92 acpi_gbl_table_flags = rsdp_address.pointer_type; 85 acpi_gbl_table_flags = rsdp_address.pointer_type;
93 86
94 status = acpi_tb_verify_rsdp (&rsdp_address); 87 status = acpi_tb_verify_rsdp(&rsdp_address);
95 if (ACPI_FAILURE (status)) { 88 if (ACPI_FAILURE(status)) {
96 ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", 89 ACPI_REPORT_ERROR(("acpi_load_tables: RSDP Failed validation: %s\n", acpi_format_exception(status)));
97 acpi_format_exception (status)));
98 goto error_exit; 90 goto error_exit;
99 } 91 }
100 92
101 /* Get the RSDT via the RSDP */ 93 /* Get the RSDT via the RSDP */
102 94
103 status = acpi_tb_get_table_rsdt (); 95 status = acpi_tb_get_table_rsdt();
104 if (ACPI_FAILURE (status)) { 96 if (ACPI_FAILURE(status)) {
105 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", 97 ACPI_REPORT_ERROR(("acpi_load_tables: Could not load RSDT: %s\n", acpi_format_exception(status)));
106 acpi_format_exception (status)));
107 goto error_exit; 98 goto error_exit;
108 } 99 }
109 100
110 /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */ 101 /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
111 102
112 status = acpi_tb_get_required_tables (); 103 status = acpi_tb_get_required_tables();
113 if (ACPI_FAILURE (status)) { 104 if (ACPI_FAILURE(status)) {
114 ACPI_REPORT_ERROR (( 105 ACPI_REPORT_ERROR(("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status)));
115 "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
116 acpi_format_exception (status)));
117 goto error_exit; 106 goto error_exit;
118 } 107 }
119 108
120 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); 109 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
121 110
122 /* Load the namespace from the tables */ 111 /* Load the namespace from the tables */
123 112
124 status = acpi_ns_load_namespace (); 113 status = acpi_ns_load_namespace();
125 if (ACPI_FAILURE (status)) { 114 if (ACPI_FAILURE(status)) {
126 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", 115 ACPI_REPORT_ERROR(("acpi_load_tables: Could not load namespace: %s\n", acpi_format_exception(status)));
127 acpi_format_exception (status)));
128 goto error_exit; 116 goto error_exit;
129 } 117 }
130 118
131 return_ACPI_STATUS (AE_OK); 119 return_ACPI_STATUS(AE_OK);
132 120
121 error_exit:
122 ACPI_REPORT_ERROR(("acpi_load_tables: Could not load tables: %s\n",
123 acpi_format_exception(status)));
133 124
134error_exit: 125 return_ACPI_STATUS(status);
135 ACPI_REPORT_ERROR (("acpi_load_tables: Could not load tables: %s\n",
136 acpi_format_exception (status)));
137
138 return_ACPI_STATUS (status);
139} 126}
140 127
141
142#ifdef ACPI_FUTURE_USAGE 128#ifdef ACPI_FUTURE_USAGE
143/******************************************************************************* 129/*******************************************************************************
144 * 130 *
@@ -156,43 +142,39 @@ error_exit:
156 * 142 *
157 ******************************************************************************/ 143 ******************************************************************************/
158 144
159acpi_status 145acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
160acpi_load_table (
161 struct acpi_table_header *table_ptr)
162{ 146{
163 acpi_status status; 147 acpi_status status;
164 struct acpi_table_desc table_info; 148 struct acpi_table_desc table_info;
165 struct acpi_pointer address; 149 struct acpi_pointer address;
166
167
168 ACPI_FUNCTION_TRACE ("acpi_load_table");
169 150
151 ACPI_FUNCTION_TRACE("acpi_load_table");
170 152
171 if (!table_ptr) { 153 if (!table_ptr) {
172 return_ACPI_STATUS (AE_BAD_PARAMETER); 154 return_ACPI_STATUS(AE_BAD_PARAMETER);
173 } 155 }
174 156
175 /* Copy the table to a local buffer */ 157 /* Copy the table to a local buffer */
176 158
177 address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING; 159 address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
178 address.pointer.logical = table_ptr; 160 address.pointer.logical = table_ptr;
179 161
180 status = acpi_tb_get_table_body (&address, table_ptr, &table_info); 162 status = acpi_tb_get_table_body(&address, table_ptr, &table_info);
181 if (ACPI_FAILURE (status)) { 163 if (ACPI_FAILURE(status)) {
182 return_ACPI_STATUS (status); 164 return_ACPI_STATUS(status);
183 } 165 }
184 166
185 /* Check signature for a valid table type */ 167 /* Check signature for a valid table type */
186 168
187 status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_ALL); 169 status = acpi_tb_recognize_table(&table_info, ACPI_TABLE_ALL);
188 if (ACPI_FAILURE (status)) { 170 if (ACPI_FAILURE(status)) {
189 return_ACPI_STATUS (status); 171 return_ACPI_STATUS(status);
190 } 172 }
191 173
192 /* Install the new table into the local data structures */ 174 /* Install the new table into the local data structures */
193 175
194 status = acpi_tb_install_table (&table_info); 176 status = acpi_tb_install_table(&table_info);
195 if (ACPI_FAILURE (status)) { 177 if (ACPI_FAILURE(status)) {
196 if (status == AE_ALREADY_EXISTS) { 178 if (status == AE_ALREADY_EXISTS) {
197 /* Table already exists, no error */ 179 /* Table already exists, no error */
198 180
@@ -201,8 +183,8 @@ acpi_load_table (
201 183
202 /* Free table allocated by acpi_tb_get_table_body */ 184 /* Free table allocated by acpi_tb_get_table_body */
203 185
204 acpi_tb_delete_single_table (&table_info); 186 acpi_tb_delete_single_table(&table_info);
205 return_ACPI_STATUS (status); 187 return_ACPI_STATUS(status);
206 } 188 }
207 189
208 /* Convert the table to common format if necessary */ 190 /* Convert the table to common format if necessary */
@@ -210,31 +192,32 @@ acpi_load_table (
210 switch (table_info.type) { 192 switch (table_info.type) {
211 case ACPI_TABLE_FADT: 193 case ACPI_TABLE_FADT:
212 194
213 status = acpi_tb_convert_table_fadt (); 195 status = acpi_tb_convert_table_fadt();
214 break; 196 break;
215 197
216 case ACPI_TABLE_FACS: 198 case ACPI_TABLE_FACS:
217 199
218 status = acpi_tb_build_common_facs (&table_info); 200 status = acpi_tb_build_common_facs(&table_info);
219 break; 201 break;
220 202
221 default: 203 default:
222 /* Load table into namespace if it contains executable AML */ 204 /* Load table into namespace if it contains executable AML */
223 205
224 status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node); 206 status =
207 acpi_ns_load_table(table_info.installed_desc,
208 acpi_gbl_root_node);
225 break; 209 break;
226 } 210 }
227 211
228 if (ACPI_FAILURE (status)) { 212 if (ACPI_FAILURE(status)) {
229 /* Uninstall table and free the buffer */ 213 /* Uninstall table and free the buffer */
230 214
231 (void) acpi_tb_uninstall_table (table_info.installed_desc); 215 (void)acpi_tb_uninstall_table(table_info.installed_desc);
232 } 216 }
233 217
234 return_ACPI_STATUS (status); 218 return_ACPI_STATUS(status);
235} 219}
236 220
237
238/******************************************************************************* 221/*******************************************************************************
239 * 222 *
240 * FUNCTION: acpi_unload_table 223 * FUNCTION: acpi_unload_table
@@ -247,20 +230,16 @@ acpi_load_table (
247 * 230 *
248 ******************************************************************************/ 231 ******************************************************************************/
249 232
250acpi_status 233acpi_status acpi_unload_table(acpi_table_type table_type)
251acpi_unload_table (
252 acpi_table_type table_type)
253{ 234{
254 struct acpi_table_desc *table_desc; 235 struct acpi_table_desc *table_desc;
255
256
257 ACPI_FUNCTION_TRACE ("acpi_unload_table");
258 236
237 ACPI_FUNCTION_TRACE("acpi_unload_table");
259 238
260 /* Parameter validation */ 239 /* Parameter validation */
261 240
262 if (table_type > ACPI_TABLE_MAX) { 241 if (table_type > ACPI_TABLE_MAX) {
263 return_ACPI_STATUS (AE_BAD_PARAMETER); 242 return_ACPI_STATUS(AE_BAD_PARAMETER);
264 } 243 }
265 244
266 /* Find all tables of the requested type */ 245 /* Find all tables of the requested type */
@@ -273,18 +252,17 @@ acpi_unload_table (
273 * "Scope" operator. Thus, we need to track ownership by an ID, not 252 * "Scope" operator. Thus, we need to track ownership by an ID, not
274 * simply a position within the hierarchy 253 * simply a position within the hierarchy
275 */ 254 */
276 acpi_ns_delete_namespace_by_owner (table_desc->owner_id); 255 acpi_ns_delete_namespace_by_owner(table_desc->owner_id);
277 acpi_ut_release_owner_id (&table_desc->owner_id); 256 acpi_ut_release_owner_id(&table_desc->owner_id);
278 table_desc = table_desc->next; 257 table_desc = table_desc->next;
279 } 258 }
280 259
281 /* Delete (or unmap) all tables of this type */ 260 /* Delete (or unmap) all tables of this type */
282 261
283 acpi_tb_delete_tables_by_type (table_type); 262 acpi_tb_delete_tables_by_type(table_type);
284 return_ACPI_STATUS (AE_OK); 263 return_ACPI_STATUS(AE_OK);
285} 264}
286 265
287
288/******************************************************************************* 266/*******************************************************************************
289 * 267 *
290 * FUNCTION: acpi_get_table_header 268 * FUNCTION: acpi_get_table_header
@@ -307,54 +285,49 @@ acpi_unload_table (
307 ******************************************************************************/ 285 ******************************************************************************/
308 286
309acpi_status 287acpi_status
310acpi_get_table_header ( 288acpi_get_table_header(acpi_table_type table_type,
311 acpi_table_type table_type, 289 u32 instance, struct acpi_table_header *out_table_header)
312 u32 instance,
313 struct acpi_table_header *out_table_header)
314{ 290{
315 struct acpi_table_header *tbl_ptr; 291 struct acpi_table_header *tbl_ptr;
316 acpi_status status; 292 acpi_status status;
317
318
319 ACPI_FUNCTION_TRACE ("acpi_get_table_header");
320 293
294 ACPI_FUNCTION_TRACE("acpi_get_table_header");
321 295
322 if ((instance == 0) || 296 if ((instance == 0) ||
323 (table_type == ACPI_TABLE_RSDP) || 297 (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) {
324 (!out_table_header)) { 298 return_ACPI_STATUS(AE_BAD_PARAMETER);
325 return_ACPI_STATUS (AE_BAD_PARAMETER);
326 } 299 }
327 300
328 /* Check the table type and instance */ 301 /* Check the table type and instance */
329 302
330 if ((table_type > ACPI_TABLE_MAX) || 303 if ((table_type > ACPI_TABLE_MAX) ||
331 (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) && 304 (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) &&
332 instance > 1)) { 305 instance > 1)) {
333 return_ACPI_STATUS (AE_BAD_PARAMETER); 306 return_ACPI_STATUS(AE_BAD_PARAMETER);
334 } 307 }
335 308
336 /* Get a pointer to the entire table */ 309 /* Get a pointer to the entire table */
337 310
338 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); 311 status = acpi_tb_get_table_ptr(table_type, instance, &tbl_ptr);
339 if (ACPI_FAILURE (status)) { 312 if (ACPI_FAILURE(status)) {
340 return_ACPI_STATUS (status); 313 return_ACPI_STATUS(status);
341 } 314 }
342 315
343 /* The function will return a NULL pointer if the table is not loaded */ 316 /* The function will return a NULL pointer if the table is not loaded */
344 317
345 if (tbl_ptr == NULL) { 318 if (tbl_ptr == NULL) {
346 return_ACPI_STATUS (AE_NOT_EXIST); 319 return_ACPI_STATUS(AE_NOT_EXIST);
347 } 320 }
348 321
349 /* Copy the header to the caller's buffer */ 322 /* Copy the header to the caller's buffer */
350 323
351 ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, 324 ACPI_MEMCPY((void *)out_table_header, (void *)tbl_ptr,
352 sizeof (struct acpi_table_header)); 325 sizeof(struct acpi_table_header));
353 326
354 return_ACPI_STATUS (status); 327 return_ACPI_STATUS(status);
355} 328}
356 329
357#endif /* ACPI_FUTURE_USAGE */ 330#endif /* ACPI_FUTURE_USAGE */
358 331
359/******************************************************************************* 332/*******************************************************************************
360 * 333 *
@@ -380,43 +353,39 @@ acpi_get_table_header (
380 ******************************************************************************/ 353 ******************************************************************************/
381 354
382acpi_status 355acpi_status
383acpi_get_table ( 356acpi_get_table(acpi_table_type table_type,
384 acpi_table_type table_type, 357 u32 instance, struct acpi_buffer *ret_buffer)
385 u32 instance,
386 struct acpi_buffer *ret_buffer)
387{ 358{
388 struct acpi_table_header *tbl_ptr; 359 struct acpi_table_header *tbl_ptr;
389 acpi_status status; 360 acpi_status status;
390 acpi_size table_length; 361 acpi_size table_length;
391
392
393 ACPI_FUNCTION_TRACE ("acpi_get_table");
394 362
363 ACPI_FUNCTION_TRACE("acpi_get_table");
395 364
396 /* Parameter validation */ 365 /* Parameter validation */
397 366
398 if (instance == 0) { 367 if (instance == 0) {
399 return_ACPI_STATUS (AE_BAD_PARAMETER); 368 return_ACPI_STATUS(AE_BAD_PARAMETER);
400 } 369 }
401 370
402 status = acpi_ut_validate_buffer (ret_buffer); 371 status = acpi_ut_validate_buffer(ret_buffer);
403 if (ACPI_FAILURE (status)) { 372 if (ACPI_FAILURE(status)) {
404 return_ACPI_STATUS (status); 373 return_ACPI_STATUS(status);
405 } 374 }
406 375
407 /* Check the table type and instance */ 376 /* Check the table type and instance */
408 377
409 if ((table_type > ACPI_TABLE_MAX) || 378 if ((table_type > ACPI_TABLE_MAX) ||
410 (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) && 379 (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) &&
411 instance > 1)) { 380 instance > 1)) {
412 return_ACPI_STATUS (AE_BAD_PARAMETER); 381 return_ACPI_STATUS(AE_BAD_PARAMETER);
413 } 382 }
414 383
415 /* Get a pointer to the entire table */ 384 /* Get a pointer to the entire table */
416 385
417 status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); 386 status = acpi_tb_get_table_ptr(table_type, instance, &tbl_ptr);
418 if (ACPI_FAILURE (status)) { 387 if (ACPI_FAILURE(status)) {
419 return_ACPI_STATUS (status); 388 return_ACPI_STATUS(status);
420 } 389 }
421 390
422 /* 391 /*
@@ -424,7 +393,7 @@ acpi_get_table (
424 * table is not loaded. 393 * table is not loaded.
425 */ 394 */
426 if (tbl_ptr == NULL) { 395 if (tbl_ptr == NULL) {
427 return_ACPI_STATUS (AE_NOT_EXIST); 396 return_ACPI_STATUS(AE_NOT_EXIST);
428 } 397 }
429 398
430 /* Get the table length */ 399 /* Get the table length */
@@ -432,23 +401,22 @@ acpi_get_table (
432 if (table_type == ACPI_TABLE_RSDP) { 401 if (table_type == ACPI_TABLE_RSDP) {
433 /* RSD PTR is the only "table" without a header */ 402 /* RSD PTR is the only "table" without a header */
434 403
435 table_length = sizeof (struct rsdp_descriptor); 404 table_length = sizeof(struct rsdp_descriptor);
436 } 405 } else {
437 else {
438 table_length = (acpi_size) tbl_ptr->length; 406 table_length = (acpi_size) tbl_ptr->length;
439 } 407 }
440 408
441 /* Validate/Allocate/Clear caller buffer */ 409 /* Validate/Allocate/Clear caller buffer */
442 410
443 status = acpi_ut_initialize_buffer (ret_buffer, table_length); 411 status = acpi_ut_initialize_buffer(ret_buffer, table_length);
444 if (ACPI_FAILURE (status)) { 412 if (ACPI_FAILURE(status)) {
445 return_ACPI_STATUS (status); 413 return_ACPI_STATUS(status);
446 } 414 }
447 415
448 /* Copy the table to the buffer */ 416 /* Copy the table to the buffer */
449 417
450 ACPI_MEMCPY ((void *) ret_buffer->pointer, (void *) tbl_ptr, table_length); 418 ACPI_MEMCPY((void *)ret_buffer->pointer, (void *)tbl_ptr, table_length);
451 return_ACPI_STATUS (AE_OK); 419 return_ACPI_STATUS(AE_OK);
452} 420}
453EXPORT_SYMBOL(acpi_get_table);
454 421
422EXPORT_SYMBOL(acpi_get_table);