aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/Makefile1
-rw-r--r--drivers/acpi/acpica/achware.h3
-rw-r--r--drivers/acpi/acpica/aclocal.h23
-rw-r--r--drivers/acpi/acpica/acmacros.h29
-rw-r--r--drivers/acpi/acpica/dswload.c14
-rw-r--r--drivers/acpi/acpica/dswload2.c14
-rw-r--r--drivers/acpi/acpica/evgpe.c24
-rw-r--r--drivers/acpi/acpica/evxfgpe.c3
-rw-r--r--drivers/acpi/acpica/hwgpe.c15
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c1
-rw-r--r--drivers/acpi/acpica/nsdump.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c20
-rw-r--r--drivers/acpi/acpica/tbxface.c41
-rw-r--r--drivers/acpi/acpica/utosi.c1
-rw-r--r--drivers/acpi/acpica/utxface.c354
-rw-r--r--drivers/acpi/acpica/utxfinit.c317
16 files changed, 521 insertions, 341 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 0a1b3435f920..7f1d40797e80 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -158,5 +158,6 @@ acpi-y += \
158 utresrc.o \ 158 utresrc.o \
159 utstate.o \ 159 utstate.o \
160 utxface.o \ 160 utxface.o \
161 utxfinit.o \
161 utxferror.o \ 162 utxferror.o \
162 utxfmutex.o 163 utxfmutex.o
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index 5de4ec72766d..d902d31abc6c 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -110,8 +110,7 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width);
110/* 110/*
111 * hwgpe - GPE support 111 * hwgpe - GPE support
112 */ 112 */
113u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, 113u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info);
114 struct acpi_gpe_register_info *gpe_register_info);
115 114
116acpi_status 115acpi_status
117acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action); 116acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action);
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index cc80fe10e8ea..c816ee675094 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -707,15 +707,18 @@ union acpi_parse_value {
707 u8 disasm_opcode; /* Subtype used for disassembly */\ 707 u8 disasm_opcode; /* Subtype used for disassembly */\
708 char aml_op_name[16]) /* Op name (debug only) */ 708 char aml_op_name[16]) /* Op name (debug only) */
709 709
710#define ACPI_DASM_BUFFER 0x00 710/* Flags for disasm_flags field above */
711#define ACPI_DASM_RESOURCE 0x01 711
712#define ACPI_DASM_STRING 0x02 712#define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */
713#define ACPI_DASM_UNICODE 0x03 713#define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */
714#define ACPI_DASM_EISAID 0x04 714#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */
715#define ACPI_DASM_MATCHOP 0x05 715#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */
716#define ACPI_DASM_LNOT_PREFIX 0x06 716#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */
717#define ACPI_DASM_LNOT_SUFFIX 0x07 717#define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */
718#define ACPI_DASM_IGNORE 0x08 718#define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */
719#define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a Lnot_equal (etc.) pair of opcodes */
720#define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a Lnot_equal (etc.) pair of opcodes */
721#define ACPI_DASM_IGNORE 0x09 /* Not used at this time */
719 722
720/* 723/*
721 * Generic operation (for example: If, While, Store) 724 * Generic operation (for example: If, While, Store)
@@ -932,6 +935,7 @@ struct acpi_bit_register_info {
932#define ACPI_OSI_WIN_VISTA_SP1 0x09 935#define ACPI_OSI_WIN_VISTA_SP1 0x09
933#define ACPI_OSI_WIN_VISTA_SP2 0x0A 936#define ACPI_OSI_WIN_VISTA_SP2 0x0A
934#define ACPI_OSI_WIN_7 0x0B 937#define ACPI_OSI_WIN_7 0x0B
938#define ACPI_OSI_WIN_8 0x0C
935 939
936#define ACPI_ALWAYS_ILLEGAL 0x00 940#define ACPI_ALWAYS_ILLEGAL 0x00
937 941
@@ -1024,6 +1028,7 @@ struct acpi_port_info {
1024 ****************************************************************************/ 1028 ****************************************************************************/
1025 1029
1026struct acpi_db_method_info { 1030struct acpi_db_method_info {
1031 acpi_handle method;
1027 acpi_handle main_thread_gate; 1032 acpi_handle main_thread_gate;
1028 acpi_handle thread_complete_gate; 1033 acpi_handle thread_complete_gate;
1029 acpi_thread_id *threads; 1034 acpi_thread_id *threads;
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 832b6198652e..a7f68c47f517 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -277,10 +277,33 @@
277 277
278/* Bitfields within ACPI registers */ 278/* Bitfields within ACPI registers */
279 279
280#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) 280#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) \
281#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) 281 ((val << pos) & mask)
282 282
283#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) 283#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) \
284 reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
285
286#define ACPI_INSERT_BITS(target, mask, source) \
287 target = ((target & (~(mask))) | (source & mask))
288
289/* Generic bitfield macros and masks */
290
291#define ACPI_GET_BITS(source_ptr, position, mask) \
292 ((*source_ptr >> position) & mask)
293
294#define ACPI_SET_BITS(target_ptr, position, mask, value) \
295 (*target_ptr |= ((value & mask) << position))
296
297#define ACPI_1BIT_MASK 0x00000001
298#define ACPI_2BIT_MASK 0x00000003
299#define ACPI_3BIT_MASK 0x00000007
300#define ACPI_4BIT_MASK 0x0000000F
301#define ACPI_5BIT_MASK 0x0000001F
302#define ACPI_6BIT_MASK 0x0000003F
303#define ACPI_7BIT_MASK 0x0000007F
304#define ACPI_8BIT_MASK 0x000000FF
305#define ACPI_16BIT_MASK 0x0000FFFF
306#define ACPI_24BIT_MASK 0x00FFFFFF
284 307
285/* 308/*
286 * An object of type struct acpi_namespace_node can appear in some contexts 309 * An object of type struct acpi_namespace_node can appear in some contexts
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 552aa3a50c84..557510084c7a 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -230,6 +230,20 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
230 walk_state->scope_info->common.value = ACPI_TYPE_ANY; 230 walk_state->scope_info->common.value = ACPI_TYPE_ANY;
231 break; 231 break;
232 232
233 case ACPI_TYPE_METHOD:
234
235 /*
236 * Allow scope change to root during execution of module-level
237 * code. Root is typed METHOD during this time.
238 */
239 if ((node == acpi_gbl_root_node) &&
240 (walk_state->
241 parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
242 break;
243 }
244
245 /*lint -fallthrough */
246
233 default: 247 default:
234 248
235 /* All other types are an error */ 249 /* All other types are an error */
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index ae7147724763..89c0114210c0 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -230,6 +230,20 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
230 walk_state->scope_info->common.value = ACPI_TYPE_ANY; 230 walk_state->scope_info->common.value = ACPI_TYPE_ANY;
231 break; 231 break;
232 232
233 case ACPI_TYPE_METHOD:
234
235 /*
236 * Allow scope change to root during execution of module-level
237 * code. Root is typed METHOD during this time.
238 */
239 if ((node == acpi_gbl_root_node) &&
240 (walk_state->
241 parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
242 break;
243 }
244
245 /*lint -fallthrough */
246
233 default: 247 default:
234 248
235 /* All other types are an error */ 249 /* All other types are an error */
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index afbd5cb391f6..ef0193d74b5d 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -80,8 +80,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
80 return_ACPI_STATUS(AE_NOT_EXIST); 80 return_ACPI_STATUS(AE_NOT_EXIST);
81 } 81 }
82 82
83 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, 83 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
84 gpe_register_info);
85 84
86 /* Clear the run bit up front */ 85 /* Clear the run bit up front */
87 86
@@ -379,6 +378,18 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
379 */ 378 */
380 if (!(gpe_register_info->enable_for_run | 379 if (!(gpe_register_info->enable_for_run |
381 gpe_register_info->enable_for_wake)) { 380 gpe_register_info->enable_for_wake)) {
381 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
382 "Ignore disabled registers for GPE%02X-GPE%02X: "
383 "RunEnable=%02X, WakeEnable=%02X\n",
384 gpe_register_info->
385 base_gpe_number,
386 gpe_register_info->
387 base_gpe_number +
388 (ACPI_GPE_REGISTER_WIDTH - 1),
389 gpe_register_info->
390 enable_for_run,
391 gpe_register_info->
392 enable_for_wake));
382 continue; 393 continue;
383 } 394 }
384 395
@@ -401,9 +412,14 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
401 } 412 }
402 413
403 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, 414 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
404 "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n", 415 "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, "
416 "RunEnable=%02X, WakeEnable=%02X\n",
405 gpe_register_info->base_gpe_number, 417 gpe_register_info->base_gpe_number,
406 status_reg, enable_reg)); 418 gpe_register_info->base_gpe_number +
419 (ACPI_GPE_REGISTER_WIDTH - 1),
420 status_reg, enable_reg,
421 gpe_register_info->enable_for_run,
422 gpe_register_info->enable_for_wake));
407 423
408 /* Check if there is anything active at all in this register */ 424 /* Check if there is anything active at all in this register */
409 425
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 6affbdb4b88c..87c5f2332260 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -357,8 +357,7 @@ acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 ac
357 goto unlock_and_exit; 357 goto unlock_and_exit;
358 } 358 }
359 359
360 register_bit = 360 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
361 acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info);
362 361
363 /* Perform the action */ 362 /* Perform the action */
364 363
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index 25bd28c4ae8d..db4076580e2b 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -60,7 +60,6 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
60 * FUNCTION: acpi_hw_get_gpe_register_bit 60 * FUNCTION: acpi_hw_get_gpe_register_bit
61 * 61 *
62 * PARAMETERS: gpe_event_info - Info block for the GPE 62 * PARAMETERS: gpe_event_info - Info block for the GPE
63 * gpe_register_info - Info block for the GPE register
64 * 63 *
65 * RETURN: Register mask with a one in the GPE bit position 64 * RETURN: Register mask with a one in the GPE bit position
66 * 65 *
@@ -69,11 +68,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
69 * 68 *
70 ******************************************************************************/ 69 ******************************************************************************/
71 70
72u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, 71u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info)
73 struct acpi_gpe_register_info *gpe_register_info)
74{ 72{
75 return (u32)1 << (gpe_event_info->gpe_number - 73 return (u32)1 << (gpe_event_info->gpe_number -
76 gpe_register_info->base_gpe_number); 74 gpe_event_info->register_info->base_gpe_number);
77} 75}
78 76
79/****************************************************************************** 77/******************************************************************************
@@ -115,8 +113,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
115 113
116 /* Set or clear just the bit that corresponds to this GPE */ 114 /* Set or clear just the bit that corresponds to this GPE */
117 115
118 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, 116 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
119 gpe_register_info);
120 switch (action) { 117 switch (action) {
121 case ACPI_GPE_CONDITIONAL_ENABLE: 118 case ACPI_GPE_CONDITIONAL_ENABLE:
122 119
@@ -178,8 +175,7 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
178 * Write a one to the appropriate bit in the status register to 175 * Write a one to the appropriate bit in the status register to
179 * clear this GPE. 176 * clear this GPE.
180 */ 177 */
181 register_bit = 178 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
182 acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info);
183 179
184 status = acpi_hw_write(register_bit, 180 status = acpi_hw_write(register_bit,
185 &gpe_register_info->status_address); 181 &gpe_register_info->status_address);
@@ -222,8 +218,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
222 218
223 /* Get the register bitmask for this GPE */ 219 /* Get the register bitmask for this GPE */
224 220
225 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, 221 register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
226 gpe_register_info);
227 222
228 /* GPE currently enabled? (enabled for runtime?) */ 223 /* GPE currently enabled? (enabled for runtime?) */
229 224
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 1f165a750ae2..0ff1ecea5c3a 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -381,7 +381,6 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
381 * FUNCTION: acpi_leave_sleep_state_prep 381 * FUNCTION: acpi_leave_sleep_state_prep
382 * 382 *
383 * PARAMETERS: sleep_state - Which sleep state we are exiting 383 * PARAMETERS: sleep_state - Which sleep state we are exiting
384 * flags - ACPI_EXECUTE_BFS to run optional method
385 * 384 *
386 * RETURN: Status 385 * RETURN: Status
387 * 386 *
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 7ee4e6aeb0a2..2526aaf945ee 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -264,7 +264,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
264 switch (type) { 264 switch (type) {
265 case ACPI_TYPE_PROCESSOR: 265 case ACPI_TYPE_PROCESSOR:
266 266
267 acpi_os_printf("ID %X Len %.4X Addr %p\n", 267 acpi_os_printf("ID %02X Len %02X Addr %p\n",
268 obj_desc->processor.proc_id, 268 obj_desc->processor.proc_id,
269 obj_desc->processor.length, 269 obj_desc->processor.length,
270 ACPI_CAST_PTR(void, 270 ACPI_CAST_PTR(void,
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 74f97d74db1c..70f9d787c82c 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -350,6 +350,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header
350acpi_status acpi_tb_resize_root_table_list(void) 350acpi_status acpi_tb_resize_root_table_list(void)
351{ 351{
352 struct acpi_table_desc *tables; 352 struct acpi_table_desc *tables;
353 u32 table_count;
353 354
354 ACPI_FUNCTION_TRACE(tb_resize_root_table_list); 355 ACPI_FUNCTION_TRACE(tb_resize_root_table_list);
355 356
@@ -363,8 +364,13 @@ acpi_status acpi_tb_resize_root_table_list(void)
363 364
364 /* Increase the Table Array size */ 365 /* Increase the Table Array size */
365 366
366 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. 367 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
367 max_table_count + 368 table_count = acpi_gbl_root_table_list.max_table_count;
369 } else {
370 table_count = acpi_gbl_root_table_list.current_table_count;
371 }
372
373 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count +
368 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 374 ACPI_ROOT_TABLE_SIZE_INCREMENT) *
369 sizeof(struct acpi_table_desc)); 375 sizeof(struct acpi_table_desc));
370 if (!tables) { 376 if (!tables) {
@@ -377,8 +383,8 @@ acpi_status acpi_tb_resize_root_table_list(void)
377 383
378 if (acpi_gbl_root_table_list.tables) { 384 if (acpi_gbl_root_table_list.tables) {
379 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, 385 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables,
380 (acpi_size) acpi_gbl_root_table_list. 386 (acpi_size) table_count *
381 max_table_count * sizeof(struct acpi_table_desc)); 387 sizeof(struct acpi_table_desc));
382 388
383 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { 389 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
384 ACPI_FREE(acpi_gbl_root_table_list.tables); 390 ACPI_FREE(acpi_gbl_root_table_list.tables);
@@ -386,9 +392,9 @@ acpi_status acpi_tb_resize_root_table_list(void)
386 } 392 }
387 393
388 acpi_gbl_root_table_list.tables = tables; 394 acpi_gbl_root_table_list.tables = tables;
389 acpi_gbl_root_table_list.max_table_count += 395 acpi_gbl_root_table_list.max_table_count =
390 ACPI_ROOT_TABLE_SIZE_INCREMENT; 396 table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT;
391 acpi_gbl_root_table_list.flags |= (u8)ACPI_ROOT_ORIGIN_ALLOCATED; 397 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
392 398
393 return_ACPI_STATUS(AE_OK); 399 return_ACPI_STATUS(AE_OK);
394} 400}
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 29e51bc01383..21101262e47a 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -159,14 +159,12 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
159 * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the 159 * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the
160 * root list from the previously provided scratch area. Should 160 * root list from the previously provided scratch area. Should
161 * be called once dynamic memory allocation is available in the 161 * be called once dynamic memory allocation is available in the
162 * kernel 162 * kernel.
163 * 163 *
164 ******************************************************************************/ 164 ******************************************************************************/
165acpi_status acpi_reallocate_root_table(void) 165acpi_status acpi_reallocate_root_table(void)
166{ 166{
167 struct acpi_table_desc *tables; 167 acpi_status status;
168 acpi_size new_size;
169 acpi_size current_size;
170 168
171 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); 169 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table);
172 170
@@ -178,39 +176,10 @@ acpi_status acpi_reallocate_root_table(void)
178 return_ACPI_STATUS(AE_SUPPORT); 176 return_ACPI_STATUS(AE_SUPPORT);
179 } 177 }
180 178
181 /* 179 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ALLOW_RESIZE;
182 * Get the current size of the root table and add the default
183 * increment to create the new table size.
184 */
185 current_size = (acpi_size)
186 acpi_gbl_root_table_list.current_table_count *
187 sizeof(struct acpi_table_desc);
188
189 new_size = current_size +
190 (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof(struct acpi_table_desc));
191
192 /* Create new array and copy the old array */
193
194 tables = ACPI_ALLOCATE_ZEROED(new_size);
195 if (!tables) {
196 return_ACPI_STATUS(AE_NO_MEMORY);
197 }
198 180
199 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, current_size); 181 status = acpi_tb_resize_root_table_list();
200 182 return_ACPI_STATUS(status);
201 /*
202 * Update the root table descriptor. The new size will be the current
203 * number of tables plus the increment, independent of the reserved
204 * size of the original table list.
205 */
206 acpi_gbl_root_table_list.tables = tables;
207 acpi_gbl_root_table_list.max_table_count =
208 acpi_gbl_root_table_list.current_table_count +
209 ACPI_ROOT_TABLE_SIZE_INCREMENT;
210 acpi_gbl_root_table_list.flags =
211 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
212
213 return_ACPI_STATUS(AE_OK);
214} 183}
215 184
216/******************************************************************************* 185/*******************************************************************************
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index 34ef0bd7e4b4..676285d6116d 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -73,6 +73,7 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
73 {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ 73 {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */
74 {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ 74 {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */
75 {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ 75 {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */
76 {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */
76 77
77 /* Feature Group Strings */ 78 /* Feature Group Strings */
78 79
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 534179f1177b..b09632b4f5b3 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Module Name: utxface - External interfaces for "global" ACPI functions 3 * Module Name: utxface - External interfaces, miscellaneous utility functions
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -53,271 +53,6 @@
53#define _COMPONENT ACPI_UTILITIES 53#define _COMPONENT ACPI_UTILITIES
54ACPI_MODULE_NAME("utxface") 54ACPI_MODULE_NAME("utxface")
55 55
56#ifndef ACPI_ASL_COMPILER
57/*******************************************************************************
58 *
59 * FUNCTION: acpi_initialize_subsystem
60 *
61 * PARAMETERS: None
62 *
63 * RETURN: Status
64 *
65 * DESCRIPTION: Initializes all global variables. This is the first function
66 * called, so any early initialization belongs here.
67 *
68 ******************************************************************************/
69acpi_status __init acpi_initialize_subsystem(void)
70{
71 acpi_status status;
72
73 ACPI_FUNCTION_TRACE(acpi_initialize_subsystem);
74
75 acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE;
76 ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
77
78 /* Initialize the OS-Dependent layer */
79
80 status = acpi_os_initialize();
81 if (ACPI_FAILURE(status)) {
82 ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
83 return_ACPI_STATUS(status);
84 }
85
86 /* Initialize all globals used by the subsystem */
87
88 status = acpi_ut_init_globals();
89 if (ACPI_FAILURE(status)) {
90 ACPI_EXCEPTION((AE_INFO, status,
91 "During initialization of globals"));
92 return_ACPI_STATUS(status);
93 }
94
95 /* Create the default mutex objects */
96
97 status = acpi_ut_mutex_initialize();
98 if (ACPI_FAILURE(status)) {
99 ACPI_EXCEPTION((AE_INFO, status,
100 "During Global Mutex creation"));
101 return_ACPI_STATUS(status);
102 }
103
104 /*
105 * Initialize the namespace manager and
106 * the root of the namespace tree
107 */
108 status = acpi_ns_root_initialize();
109 if (ACPI_FAILURE(status)) {
110 ACPI_EXCEPTION((AE_INFO, status,
111 "During Namespace initialization"));
112 return_ACPI_STATUS(status);
113 }
114
115 /* Initialize the global OSI interfaces list with the static names */
116
117 status = acpi_ut_initialize_interfaces();
118 if (ACPI_FAILURE(status)) {
119 ACPI_EXCEPTION((AE_INFO, status,
120 "During OSI interfaces initialization"));
121 return_ACPI_STATUS(status);
122 }
123
124 /* If configured, initialize the AML debugger */
125
126 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
127 return_ACPI_STATUS(status);
128}
129
130/*******************************************************************************
131 *
132 * FUNCTION: acpi_enable_subsystem
133 *
134 * PARAMETERS: flags - Init/enable Options
135 *
136 * RETURN: Status
137 *
138 * DESCRIPTION: Completes the subsystem initialization including hardware.
139 * Puts system into ACPI mode if it isn't already.
140 *
141 ******************************************************************************/
142acpi_status acpi_enable_subsystem(u32 flags)
143{
144 acpi_status status = AE_OK;
145
146 ACPI_FUNCTION_TRACE(acpi_enable_subsystem);
147
148#if (!ACPI_REDUCED_HARDWARE)
149
150 /* Enable ACPI mode */
151
152 if (!(flags & ACPI_NO_ACPI_ENABLE)) {
153 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
154 "[Init] Going into ACPI mode\n"));
155
156 acpi_gbl_original_mode = acpi_hw_get_mode();
157
158 status = acpi_enable();
159 if (ACPI_FAILURE(status)) {
160 ACPI_WARNING((AE_INFO, "AcpiEnable failed"));
161 return_ACPI_STATUS(status);
162 }
163 }
164
165 /*
166 * Obtain a permanent mapping for the FACS. This is required for the
167 * Global Lock and the Firmware Waking Vector
168 */
169 status = acpi_tb_initialize_facs();
170 if (ACPI_FAILURE(status)) {
171 ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
172 return_ACPI_STATUS(status);
173 }
174#endif /* !ACPI_REDUCED_HARDWARE */
175
176 /*
177 * Install the default op_region handlers. These are installed unless
178 * other handlers have already been installed via the
179 * install_address_space_handler interface.
180 */
181 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
182 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
183 "[Init] Installing default address space handlers\n"));
184
185 status = acpi_ev_install_region_handlers();
186 if (ACPI_FAILURE(status)) {
187 return_ACPI_STATUS(status);
188 }
189 }
190#if (!ACPI_REDUCED_HARDWARE)
191 /*
192 * Initialize ACPI Event handling (Fixed and General Purpose)
193 *
194 * Note1: We must have the hardware and events initialized before we can
195 * execute any control methods safely. Any control method can require
196 * ACPI hardware support, so the hardware must be fully initialized before
197 * any method execution!
198 *
199 * Note2: Fixed events are initialized and enabled here. GPEs are
200 * initialized, but cannot be enabled until after the hardware is
201 * completely initialized (SCI and global_lock activated)
202 */
203 if (!(flags & ACPI_NO_EVENT_INIT)) {
204 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
205 "[Init] Initializing ACPI events\n"));
206
207 status = acpi_ev_initialize_events();
208 if (ACPI_FAILURE(status)) {
209 return_ACPI_STATUS(status);
210 }
211 }
212
213 /*
214 * Install the SCI handler and Global Lock handler. This completes the
215 * hardware initialization.
216 */
217 if (!(flags & ACPI_NO_HANDLER_INIT)) {
218 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
219 "[Init] Installing SCI/GL handlers\n"));
220
221 status = acpi_ev_install_xrupt_handlers();
222 if (ACPI_FAILURE(status)) {
223 return_ACPI_STATUS(status);
224 }
225 }
226#endif /* !ACPI_REDUCED_HARDWARE */
227
228 return_ACPI_STATUS(status);
229}
230
231ACPI_EXPORT_SYMBOL(acpi_enable_subsystem)
232
233/*******************************************************************************
234 *
235 * FUNCTION: acpi_initialize_objects
236 *
237 * PARAMETERS: flags - Init/enable Options
238 *
239 * RETURN: Status
240 *
241 * DESCRIPTION: Completes namespace initialization by initializing device
242 * objects and executing AML code for Regions, buffers, etc.
243 *
244 ******************************************************************************/
245acpi_status acpi_initialize_objects(u32 flags)
246{
247 acpi_status status = AE_OK;
248
249 ACPI_FUNCTION_TRACE(acpi_initialize_objects);
250
251 /*
252 * Run all _REG methods
253 *
254 * Note: Any objects accessed by the _REG methods will be automatically
255 * initialized, even if they contain executable AML (see the call to
256 * acpi_ns_initialize_objects below).
257 */
258 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
259 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
260 "[Init] Executing _REG OpRegion methods\n"));
261
262 status = acpi_ev_initialize_op_regions();
263 if (ACPI_FAILURE(status)) {
264 return_ACPI_STATUS(status);
265 }
266 }
267
268 /*
269 * Execute any module-level code that was detected during the table load
270 * phase. Although illegal since ACPI 2.0, there are many machines that
271 * contain this type of code. Each block of detected executable AML code
272 * outside of any control method is wrapped with a temporary control
273 * method object and placed on a global list. The methods on this list
274 * are executed below.
275 */
276 acpi_ns_exec_module_code_list();
277
278 /*
279 * Initialize the objects that remain uninitialized. This runs the
280 * executable AML that may be part of the declaration of these objects:
281 * operation_regions, buffer_fields, Buffers, and Packages.
282 */
283 if (!(flags & ACPI_NO_OBJECT_INIT)) {
284 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
285 "[Init] Completing Initialization of ACPI Objects\n"));
286
287 status = acpi_ns_initialize_objects();
288 if (ACPI_FAILURE(status)) {
289 return_ACPI_STATUS(status);
290 }
291 }
292
293 /*
294 * Initialize all device objects in the namespace. This runs the device
295 * _STA and _INI methods.
296 */
297 if (!(flags & ACPI_NO_DEVICE_INIT)) {
298 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
299 "[Init] Initializing ACPI Devices\n"));
300
301 status = acpi_ns_initialize_devices();
302 if (ACPI_FAILURE(status)) {
303 return_ACPI_STATUS(status);
304 }
305 }
306
307 /*
308 * Empty the caches (delete the cached objects) on the assumption that
309 * the table load filled them up more than they will be at runtime --
310 * thus wasting non-paged memory.
311 */
312 status = acpi_purge_cached_objects();
313
314 acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
315 return_ACPI_STATUS(status);
316}
317
318ACPI_EXPORT_SYMBOL(acpi_initialize_objects)
319
320#endif
321/******************************************************************************* 56/*******************************************************************************
322 * 57 *
323 * FUNCTION: acpi_terminate 58 * FUNCTION: acpi_terminate
@@ -683,3 +418,90 @@ acpi_check_address_range(acpi_adr_space_type space_id,
683 418
684ACPI_EXPORT_SYMBOL(acpi_check_address_range) 419ACPI_EXPORT_SYMBOL(acpi_check_address_range)
685#endif /* !ACPI_ASL_COMPILER */ 420#endif /* !ACPI_ASL_COMPILER */
421/*******************************************************************************
422 *
423 * FUNCTION: acpi_decode_pld_buffer
424 *
425 * PARAMETERS: in_buffer - Buffer returned by _PLD method
426 * length - Length of the in_buffer
427 * return_buffer - Where the decode buffer is returned
428 *
429 * RETURN: Status and the decoded _PLD buffer. User must deallocate
430 * the buffer via ACPI_FREE.
431 *
432 * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into
433 * a local struct that is much more useful to an ACPI driver.
434 *
435 ******************************************************************************/
436acpi_status
437acpi_decode_pld_buffer(u8 *in_buffer,
438 acpi_size length, struct acpi_pld_info ** return_buffer)
439{
440 struct acpi_pld_info *pld_info;
441 u32 *buffer = ACPI_CAST_PTR(u32, in_buffer);
442 u32 dword;
443
444 /* Parameter validation */
445
446 if (!in_buffer || !return_buffer || (length < 16)) {
447 return (AE_BAD_PARAMETER);
448 }
449
450 pld_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pld_info));
451 if (!pld_info) {
452 return (AE_NO_MEMORY);
453 }
454
455 /* First 32-bit DWord */
456
457 ACPI_MOVE_32_TO_32(&dword, &buffer[0]);
458 pld_info->revision = ACPI_PLD_GET_REVISION(&dword);
459 pld_info->ignore_color = ACPI_PLD_GET_IGNORE_COLOR(&dword);
460 pld_info->color = ACPI_PLD_GET_COLOR(&dword);
461
462 /* Second 32-bit DWord */
463
464 ACPI_MOVE_32_TO_32(&dword, &buffer[1]);
465 pld_info->width = ACPI_PLD_GET_WIDTH(&dword);
466 pld_info->height = ACPI_PLD_GET_HEIGHT(&dword);
467
468 /* Third 32-bit DWord */
469
470 ACPI_MOVE_32_TO_32(&dword, &buffer[2]);
471 pld_info->user_visible = ACPI_PLD_GET_USER_VISIBLE(&dword);
472 pld_info->dock = ACPI_PLD_GET_DOCK(&dword);
473 pld_info->lid = ACPI_PLD_GET_LID(&dword);
474 pld_info->panel = ACPI_PLD_GET_PANEL(&dword);
475 pld_info->vertical_position = ACPI_PLD_GET_VERTICAL(&dword);
476 pld_info->horizontal_position = ACPI_PLD_GET_HORIZONTAL(&dword);
477 pld_info->shape = ACPI_PLD_GET_SHAPE(&dword);
478 pld_info->group_orientation = ACPI_PLD_GET_ORIENTATION(&dword);
479 pld_info->group_token = ACPI_PLD_GET_TOKEN(&dword);
480 pld_info->group_position = ACPI_PLD_GET_POSITION(&dword);
481 pld_info->bay = ACPI_PLD_GET_BAY(&dword);
482
483 /* Fourth 32-bit DWord */
484
485 ACPI_MOVE_32_TO_32(&dword, &buffer[3]);
486 pld_info->ejectable = ACPI_PLD_GET_EJECTABLE(&dword);
487 pld_info->ospm_eject_required = ACPI_PLD_GET_OSPM_EJECT(&dword);
488 pld_info->cabinet_number = ACPI_PLD_GET_CABINET(&dword);
489 pld_info->card_cage_number = ACPI_PLD_GET_CARD_CAGE(&dword);
490 pld_info->reference = ACPI_PLD_GET_REFERENCE(&dword);
491 pld_info->rotation = ACPI_PLD_GET_ROTATION(&dword);
492 pld_info->order = ACPI_PLD_GET_ORDER(&dword);
493
494 if (length >= ACPI_PLD_BUFFER_SIZE) {
495
496 /* Fifth 32-bit DWord (Revision 2 of _PLD) */
497
498 ACPI_MOVE_32_TO_32(&dword, &buffer[4]);
499 pld_info->vertical_offset = ACPI_PLD_GET_VERT_OFFSET(&dword);
500 pld_info->horizontal_offset = ACPI_PLD_GET_HORIZ_OFFSET(&dword);
501 }
502
503 *return_buffer = pld_info;
504 return (AE_OK);
505}
506
507ACPI_EXPORT_SYMBOL(acpi_decode_pld_buffer)
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c
new file mode 100644
index 000000000000..14f523627a5e
--- /dev/null
+++ b/drivers/acpi/acpica/utxfinit.c
@@ -0,0 +1,317 @@
1/******************************************************************************
2 *
3 * Module Name: utxfinit - External interfaces for ACPICA initialization
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <linux/export.h>
45#include <acpi/acpi.h>
46#include "accommon.h"
47#include "acevents.h"
48#include "acnamesp.h"
49#include "acdebug.h"
50#include "actables.h"
51
52#define _COMPONENT ACPI_UTILITIES
53ACPI_MODULE_NAME("utxfinit")
54
55/*******************************************************************************
56 *
57 * FUNCTION: acpi_initialize_subsystem
58 *
59 * PARAMETERS: None
60 *
61 * RETURN: Status
62 *
63 * DESCRIPTION: Initializes all global variables. This is the first function
64 * called, so any early initialization belongs here.
65 *
66 ******************************************************************************/
67acpi_status acpi_initialize_subsystem(void)
68{
69 acpi_status status;
70
71 ACPI_FUNCTION_TRACE(acpi_initialize_subsystem);
72
73 acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE;
74 ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
75
76 /* Initialize the OS-Dependent layer */
77
78 status = acpi_os_initialize();
79 if (ACPI_FAILURE(status)) {
80 ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
81 return_ACPI_STATUS(status);
82 }
83
84 /* Initialize all globals used by the subsystem */
85
86 status = acpi_ut_init_globals();
87 if (ACPI_FAILURE(status)) {
88 ACPI_EXCEPTION((AE_INFO, status,
89 "During initialization of globals"));
90 return_ACPI_STATUS(status);
91 }
92
93 /* Create the default mutex objects */
94
95 status = acpi_ut_mutex_initialize();
96 if (ACPI_FAILURE(status)) {
97 ACPI_EXCEPTION((AE_INFO, status,
98 "During Global Mutex creation"));
99 return_ACPI_STATUS(status);
100 }
101
102 /*
103 * Initialize the namespace manager and
104 * the root of the namespace tree
105 */
106 status = acpi_ns_root_initialize();
107 if (ACPI_FAILURE(status)) {
108 ACPI_EXCEPTION((AE_INFO, status,
109 "During Namespace initialization"));
110 return_ACPI_STATUS(status);
111 }
112
113 /* Initialize the global OSI interfaces list with the static names */
114
115 status = acpi_ut_initialize_interfaces();
116 if (ACPI_FAILURE(status)) {
117 ACPI_EXCEPTION((AE_INFO, status,
118 "During OSI interfaces initialization"));
119 return_ACPI_STATUS(status);
120 }
121
122 /* If configured, initialize the AML debugger */
123
124 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
125 return_ACPI_STATUS(status);
126}
127ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem)
128
129/*******************************************************************************
130 *
131 * FUNCTION: acpi_enable_subsystem
132 *
133 * PARAMETERS: flags - Init/enable Options
134 *
135 * RETURN: Status
136 *
137 * DESCRIPTION: Completes the subsystem initialization including hardware.
138 * Puts system into ACPI mode if it isn't already.
139 *
140 ******************************************************************************/
141acpi_status acpi_enable_subsystem(u32 flags)
142{
143 acpi_status status = AE_OK;
144
145 ACPI_FUNCTION_TRACE(acpi_enable_subsystem);
146
147#if (!ACPI_REDUCED_HARDWARE)
148
149 /* Enable ACPI mode */
150
151 if (!(flags & ACPI_NO_ACPI_ENABLE)) {
152 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
153 "[Init] Going into ACPI mode\n"));
154
155 acpi_gbl_original_mode = acpi_hw_get_mode();
156
157 status = acpi_enable();
158 if (ACPI_FAILURE(status)) {
159 ACPI_WARNING((AE_INFO, "AcpiEnable failed"));
160 return_ACPI_STATUS(status);
161 }
162 }
163
164 /*
165 * Obtain a permanent mapping for the FACS. This is required for the
166 * Global Lock and the Firmware Waking Vector
167 */
168 status = acpi_tb_initialize_facs();
169 if (ACPI_FAILURE(status)) {
170 ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
171 return_ACPI_STATUS(status);
172 }
173#endif /* !ACPI_REDUCED_HARDWARE */
174
175 /*
176 * Install the default op_region handlers. These are installed unless
177 * other handlers have already been installed via the
178 * install_address_space_handler interface.
179 */
180 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
181 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
182 "[Init] Installing default address space handlers\n"));
183
184 status = acpi_ev_install_region_handlers();
185 if (ACPI_FAILURE(status)) {
186 return_ACPI_STATUS(status);
187 }
188 }
189#if (!ACPI_REDUCED_HARDWARE)
190 /*
191 * Initialize ACPI Event handling (Fixed and General Purpose)
192 *
193 * Note1: We must have the hardware and events initialized before we can
194 * execute any control methods safely. Any control method can require
195 * ACPI hardware support, so the hardware must be fully initialized before
196 * any method execution!
197 *
198 * Note2: Fixed events are initialized and enabled here. GPEs are
199 * initialized, but cannot be enabled until after the hardware is
200 * completely initialized (SCI and global_lock activated) and the various
201 * initialization control methods are run (_REG, _STA, _INI) on the
202 * entire namespace.
203 */
204 if (!(flags & ACPI_NO_EVENT_INIT)) {
205 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
206 "[Init] Initializing ACPI events\n"));
207
208 status = acpi_ev_initialize_events();
209 if (ACPI_FAILURE(status)) {
210 return_ACPI_STATUS(status);
211 }
212 }
213
214 /*
215 * Install the SCI handler and Global Lock handler. This completes the
216 * hardware initialization.
217 */
218 if (!(flags & ACPI_NO_HANDLER_INIT)) {
219 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
220 "[Init] Installing SCI/GL handlers\n"));
221
222 status = acpi_ev_install_xrupt_handlers();
223 if (ACPI_FAILURE(status)) {
224 return_ACPI_STATUS(status);
225 }
226 }
227#endif /* !ACPI_REDUCED_HARDWARE */
228
229 return_ACPI_STATUS(status);
230}
231ACPI_EXPORT_SYMBOL(acpi_enable_subsystem)
232
233/*******************************************************************************
234 *
235 * FUNCTION: acpi_initialize_objects
236 *
237 * PARAMETERS: flags - Init/enable Options
238 *
239 * RETURN: Status
240 *
241 * DESCRIPTION: Completes namespace initialization by initializing device
242 * objects and executing AML code for Regions, buffers, etc.
243 *
244 ******************************************************************************/
245acpi_status acpi_initialize_objects(u32 flags)
246{
247 acpi_status status = AE_OK;
248
249 ACPI_FUNCTION_TRACE(acpi_initialize_objects);
250
251 /*
252 * Run all _REG methods
253 *
254 * Note: Any objects accessed by the _REG methods will be automatically
255 * initialized, even if they contain executable AML (see the call to
256 * acpi_ns_initialize_objects below).
257 */
258 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
259 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
260 "[Init] Executing _REG OpRegion methods\n"));
261
262 status = acpi_ev_initialize_op_regions();
263 if (ACPI_FAILURE(status)) {
264 return_ACPI_STATUS(status);
265 }
266 }
267
268 /*
269 * Execute any module-level code that was detected during the table load
270 * phase. Although illegal since ACPI 2.0, there are many machines that
271 * contain this type of code. Each block of detected executable AML code
272 * outside of any control method is wrapped with a temporary control
273 * method object and placed on a global list. The methods on this list
274 * are executed below.
275 */
276 acpi_ns_exec_module_code_list();
277
278 /*
279 * Initialize the objects that remain uninitialized. This runs the
280 * executable AML that may be part of the declaration of these objects:
281 * operation_regions, buffer_fields, Buffers, and Packages.
282 */
283 if (!(flags & ACPI_NO_OBJECT_INIT)) {
284 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
285 "[Init] Completing Initialization of ACPI Objects\n"));
286
287 status = acpi_ns_initialize_objects();
288 if (ACPI_FAILURE(status)) {
289 return_ACPI_STATUS(status);
290 }
291 }
292
293 /*
294 * Initialize all device objects in the namespace. This runs the device
295 * _STA and _INI methods.
296 */
297 if (!(flags & ACPI_NO_DEVICE_INIT)) {
298 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
299 "[Init] Initializing ACPI Devices\n"));
300
301 status = acpi_ns_initialize_devices();
302 if (ACPI_FAILURE(status)) {
303 return_ACPI_STATUS(status);
304 }
305 }
306
307 /*
308 * Empty the caches (delete the cached objects) on the assumption that
309 * the table load filled them up more than they will be at runtime --
310 * thus wasting non-paged memory.
311 */
312 status = acpi_purge_cached_objects();
313
314 acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
315 return_ACPI_STATUS(status);
316}
317ACPI_EXPORT_SYMBOL(acpi_initialize_objects)