Commit 9e50ab91d025afc17ca14a1764be2e1d0c24245d

Authored by Linus Torvalds

Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (27 commits)
  ACPI / ACPICA: Simplify acpi_ev_initialize_gpe_block()
  ACPI / ACPICA: Fail acpi_gpe_wakeup() if ACPI_GPE_CAN_WAKE is unset
  ACPI / ACPICA: Do not execute _PRW methods during initialization
  ACPI: Fix bogus GPE test in acpi_bus_set_run_wake_flags()
  ACPICA: Update version to 20100702
  ACPICA: Fix for Alias references within Package objects
  ACPICA: Fix lint warning for 64-bit constant
  ACPICA: Remove obsolete GPE function
  ACPICA: Update debug output components
  ACPICA: Add support for WDDT - Watchdog Descriptor Table
  ACPICA: Drop acpi_set_gpe
  ACPICA: Use low-level GPE enable during GPE block initialization
  ACPI / EC: Do not use acpi_set_gpe
  ACPI / EC: Drop suspend and resume routines
  ACPICA: Remove wakeup GPE reference counting which is not used
  ACPICA: Introduce acpi_gpe_wakeup()
  ACPICA: Rename acpi_hw_gpe_register_bit
  ACPICA: Update version to 20100528
  ACPICA: Add signatures for undefined tables: ATKG, GSCI, IEIT
  ACPICA: Optimization: Reduce the number of namespace walks
  ...

Showing 53 changed files Side-by-side Diff

drivers/acpi/acpica/acevents.h
... ... @@ -78,7 +78,9 @@
78 78 u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
79 79  
80 80 acpi_status
81   -acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info);
  81 +acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
  82 +
  83 +acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
82 84  
83 85 struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
84 86 u32 gpe_number);
drivers/acpi/acpica/acglobal.h
... ... @@ -100,13 +100,6 @@
100 100 u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
101 101  
102 102 /*
103   - * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and
104   - * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only
105   - * be enabled just before going to sleep.
106   - */
107   -u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
108   -
109   -/*
110 103 * Optionally use default values for the ACPI register widths. Set this to
111 104 * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
112 105 */
drivers/acpi/acpica/achware.h
... ... @@ -90,14 +90,11 @@
90 90 /*
91 91 * hwgpe - GPE support
92 92 */
93   -u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info,
  93 +u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info,
94 94 struct acpi_gpe_register_info *gpe_register_info);
95 95  
96 96 acpi_status
97 97 acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action);
98   -
99   -acpi_status
100   -acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
101 98  
102 99 acpi_status
103 100 acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
drivers/acpi/acpica/aclocal.h
... ... @@ -184,8 +184,9 @@
184 184 u8 flags; /* Miscellaneous flags */
185 185 acpi_owner_id owner_id; /* Node creator */
186 186 union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
  187 + struct acpi_namespace_node *parent; /* Parent node */
187 188 struct acpi_namespace_node *child; /* First child */
188   - struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
  189 + struct acpi_namespace_node *peer; /* First peer */
189 190  
190 191 /*
191 192 * The following fields are used by the ASL compiler and disassembler only
... ... @@ -199,7 +200,7 @@
199 200  
200 201 /* Namespace Node flags */
201 202  
202   -#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
  203 +#define ANOBJ_RESERVED 0x01 /* Available for use */
203 204 #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
204 205 #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
205 206 #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
... ... @@ -428,7 +429,6 @@
428 429 u8 flags; /* Misc info about this GPE */
429 430 u8 gpe_number; /* This GPE */
430 431 u8 runtime_count; /* References to a run GPE */
431   - u8 wakeup_count; /* References to a wake GPE */
432 432 };
433 433  
434 434 /* Information about a GPE register pair, one per each status/enable pair in an array */
drivers/acpi/acpica/acnamesp.h
... ... @@ -369,12 +369,5 @@
369 369  
370 370 void acpi_ns_terminate(void);
371 371  
372   -struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
373   - *node);
374   -
375   -struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
376   - acpi_namespace_node
377   - *node);
378   -
379 372 #endif /* __ACNAMESP_H__ */
drivers/acpi/acpica/acobject.h
... ... @@ -91,14 +91,14 @@
91 91  
92 92 /* Values for Flag byte above */
93 93  
94   -#define AOPOBJ_AML_CONSTANT 0x01
95   -#define AOPOBJ_STATIC_POINTER 0x02
96   -#define AOPOBJ_DATA_VALID 0x04
97   -#define AOPOBJ_OBJECT_INITIALIZED 0x08
98   -#define AOPOBJ_SETUP_COMPLETE 0x10
99   -#define AOPOBJ_SINGLE_DATUM 0x20
100   -#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */
101   -#define AOPOBJ_MODULE_LEVEL 0x80
  94 +#define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */
  95 +#define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */
  96 +#define AOPOBJ_DATA_VALID 0x04 /* Object is intialized and data is valid */
  97 +#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */
  98 +#define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */
  99 +#define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */
  100 +#define AOPOBJ_MODULE_LEVEL 0x40 /* Method is actually module-level code */
  101 +#define AOPOBJ_MODIFIED_NAMESPACE 0x80 /* Method modified the namespace */
102 102  
103 103 /******************************************************************************
104 104 *
drivers/acpi/acpica/acpredef.h
... ... @@ -503,15 +503,16 @@
503 503 {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
504 504 {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
505 505  
506   - {{{0,0,0,0}, 0,0}} /* Table terminator */
507   -};
  506 + /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */
508 507  
509   -#if 0
510   - /* Not implemented */
  508 + {{"_WDG", 0, ACPI_RTYPE_BUFFER}},
  509 + {{"_WED", 1,
  510 + ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}},
511 511  
512   - {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */
513   - {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */
  512 + {{{0, 0, 0, 0}, 0, 0}} /* Table terminator */
  513 +};
514 514  
  515 +#if 0
515 516 /* This is an internally implemented control method, no need to check */
516 517 {{"_OSI", 1, ACPI_RTYPE_INTEGER}},
517 518  
drivers/acpi/acpica/acstruct.h
... ... @@ -127,22 +127,22 @@
127 127 acpi_parse_upwards ascending_callback;
128 128 };
129 129  
130   -/* Info used by acpi_ps_init_objects */
  130 +/* Info used by acpi_ns_initialize_objects and acpi_ds_initialize_objects */
131 131  
132 132 struct acpi_init_walk_info {
133   - u16 method_count;
134   - u16 device_count;
135   - u16 op_region_count;
136   - u16 field_count;
137   - u16 buffer_count;
138   - u16 package_count;
139   - u16 op_region_init;
140   - u16 field_init;
141   - u16 buffer_init;
142   - u16 package_init;
143   - u16 object_count;
144   - acpi_owner_id owner_id;
145 133 u32 table_index;
  134 + u32 object_count;
  135 + u32 method_count;
  136 + u32 device_count;
  137 + u32 op_region_count;
  138 + u32 field_count;
  139 + u32 buffer_count;
  140 + u32 package_count;
  141 + u32 op_region_init;
  142 + u32 field_init;
  143 + u32 buffer_init;
  144 + u32 package_init;
  145 + acpi_owner_id owner_id;
146 146 };
147 147  
148 148 struct acpi_get_devices_info {
149 149  
... ... @@ -201,11 +201,11 @@
201 201 /* Info used by acpi_ns_initialize_devices */
202 202  
203 203 struct acpi_device_walk_info {
204   - u16 device_count;
205   - u16 num_STA;
206   - u16 num_INI;
207 204 struct acpi_table_desc *table_desc;
208 205 struct acpi_evaluate_info *evaluate_info;
  206 + u32 device_count;
  207 + u32 num_STA;
  208 + u32 num_INI;
209 209 };
210 210  
211 211 /* TBD: [Restructure] Merge with struct above */
drivers/acpi/acpica/dsinit.c
... ... @@ -171,12 +171,12 @@
171 171 "**** Starting initialization of namespace objects ****\n"));
172 172 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:"));
173 173  
174   - info.method_count = 0;
175   - info.op_region_count = 0;
176   - info.object_count = 0;
177   - info.device_count = 0;
178   - info.table_index = table_index;
  174 + /* Set all init info to zero */
  175 +
  176 + ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
  177 +
179 178 info.owner_id = owner_id;
  179 + info.table_index = table_index;
180 180  
181 181 /* Walk entire namespace from the supplied root */
182 182  
183 183  
... ... @@ -204,13 +204,13 @@
204 204 }
205 205  
206 206 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
207   - "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
  207 + "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n",
208 208 table->signature, owner_id, info.object_count,
209 209 info.device_count, info.method_count,
210 210 info.op_region_count));
211 211  
212 212 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
213   - "%hd Methods, %hd Regions\n", info.method_count,
  213 + "%u Methods, %u Regions\n", info.method_count,
214 214 info.op_region_count));
215 215  
216 216 return_ACPI_STATUS(AE_OK);
drivers/acpi/acpica/dsmethod.c
... ... @@ -584,8 +584,22 @@
584 584 * want make the objects permanent.
585 585 */
586 586 if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) {
587   - acpi_ns_delete_namespace_by_owner(method_desc->method.
588   - owner_id);
  587 +
  588 + /* Delete any direct children of (created by) this method */
  589 +
  590 + acpi_ns_delete_namespace_subtree(walk_state->
  591 + method_node);
  592 +
  593 + /*
  594 + * Delete any objects that were created by this method
  595 + * elsewhere in the namespace (if any were created).
  596 + */
  597 + if (method_desc->method.
  598 + flags & AOPOBJ_MODIFIED_NAMESPACE) {
  599 + acpi_ns_delete_namespace_by_owner(method_desc->
  600 + method.
  601 + owner_id);
  602 + }
589 603 }
590 604 }
591 605  
... ... @@ -605,7 +619,7 @@
605 619 * we immediately reuse it for the next thread executing this method
606 620 */
607 621 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
608   - "*** Completed execution of one thread, %d threads remaining\n",
  622 + "*** Completed execution of one thread, %u threads remaining\n",
609 623 method_desc->method.thread_count));
610 624 } else {
611 625 /* This is the only executing thread for this method */
drivers/acpi/acpica/dsmthdat.c
... ... @@ -102,8 +102,7 @@
102 102 walk_state->arguments[i].name.integer |= (i << 24);
103 103 walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED;
104 104 walk_state->arguments[i].type = ACPI_TYPE_ANY;
105   - walk_state->arguments[i].flags =
106   - ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
  105 + walk_state->arguments[i].flags = ANOBJ_METHOD_ARG;
107 106 }
108 107  
109 108 /* Init the method locals */
... ... @@ -116,8 +115,7 @@
116 115 walk_state->local_variables[i].descriptor_type =
117 116 ACPI_DESC_TYPE_NAMED;
118 117 walk_state->local_variables[i].type = ACPI_TYPE_ANY;
119   - walk_state->local_variables[i].flags =
120   - ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
  118 + walk_state->local_variables[i].flags = ANOBJ_METHOD_LOCAL;
121 119 }
122 120  
123 121 return_VOID;
... ... @@ -146,7 +144,7 @@
146 144  
147 145 for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
148 146 if (walk_state->local_variables[index].object) {
149   - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
  147 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%u=%p\n",
150 148 index,
151 149 walk_state->local_variables[index].
152 150 object));
... ... @@ -162,7 +160,7 @@
162 160  
163 161 for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
164 162 if (walk_state->arguments[index].object) {
165   - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
  163 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%u=%p\n",
166 164 index,
167 165 walk_state->arguments[index].object));
168 166  
... ... @@ -226,7 +224,7 @@
226 224 index++;
227 225 }
228 226  
229   - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%d args passed to method\n", index));
  227 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%u args passed to method\n", index));
230 228 return_ACPI_STATUS(AE_OK);
231 229 }
232 230  
... ... @@ -323,7 +321,7 @@
323 321 ACPI_FUNCTION_TRACE(ds_method_data_set_value);
324 322  
325 323 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
326   - "NewObj %p Type %2.2X, Refs=%d [%s]\n", object,
  324 + "NewObj %p Type %2.2X, Refs=%u [%s]\n", object,
327 325 type, object->common.reference_count,
328 326 acpi_ut_get_type_name(object->common.type)));
329 327  
... ... @@ -543,7 +541,7 @@
543 541 union acpi_operand_object *new_obj_desc;
544 542  
545 543 ACPI_FUNCTION_TRACE(ds_store_object_to_local);
546   - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
  544 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%u Obj=%p\n",
547 545 type, index, obj_desc));
548 546  
549 547 /* Parameter validation */
drivers/acpi/acpica/dsobject.c
... ... @@ -81,6 +81,7 @@
81 81 {
82 82 union acpi_operand_object *obj_desc;
83 83 acpi_status status;
  84 + acpi_object_type type;
84 85  
85 86 ACPI_FUNCTION_TRACE(ds_build_internal_object);
86 87  
... ... @@ -172,7 +173,20 @@
172 173 return_ACPI_STATUS(status);
173 174 }
174 175  
175   - switch (op->common.node->type) {
  176 + /*
  177 + * Special handling for Alias objects. We need to setup the type
  178 + * and the Op->Common.Node to point to the Alias target. Note,
  179 + * Alias has at most one level of indirection internally.
  180 + */
  181 + type = op->common.node->type;
  182 + if (type == ACPI_TYPE_LOCAL_ALIAS) {
  183 + type = obj_desc->common.type;
  184 + op->common.node =
  185 + ACPI_CAST_PTR(struct acpi_namespace_node,
  186 + op->common.node->object);
  187 + }
  188 +
  189 + switch (type) {
176 190 /*
177 191 * For these types, we need the actual node, not the subobject.
178 192 * However, the subobject did not get an extra reference count above.
drivers/acpi/acpica/dsopcode.c
... ... @@ -213,7 +213,7 @@
213 213  
214 214 /* Execute the AML code for the term_arg arguments */
215 215  
216   - status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
  216 + status = acpi_ds_execute_arguments(node, node->parent,
217 217 extra_desc->extra.aml_length,
218 218 extra_desc->extra.aml_start);
219 219 return_ACPI_STATUS(status);
... ... @@ -257,7 +257,7 @@
257 257  
258 258 /* Execute the AML code for the term_arg arguments */
259 259  
260   - status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
  260 + status = acpi_ds_execute_arguments(node, node->parent,
261 261 extra_desc->extra.aml_length,
262 262 extra_desc->extra.aml_start);
263 263 return_ACPI_STATUS(status);
... ... @@ -394,7 +394,7 @@
394 394  
395 395 /* Execute the argument AML */
396 396  
397   - status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
  397 + status = acpi_ds_execute_arguments(node, node->parent,
398 398 extra_desc->extra.aml_length,
399 399 extra_desc->extra.aml_start);
400 400 if (ACPI_FAILURE(status)) {
drivers/acpi/acpica/dsutils.c
... ... @@ -746,7 +746,7 @@
746 746 index--;
747 747  
748 748 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
749   - "Arg #%d (%p) done, Arg1=%p\n", index, arg,
  749 + "Arg #%u (%p) done, Arg1=%p\n", index, arg,
750 750 first_arg));
751 751 }
752 752  
... ... @@ -760,7 +760,7 @@
760 760 */
761 761 acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
762 762  
763   - ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d", index));
  763 + ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %u", index));
764 764 return_ACPI_STATUS(status);
765 765 }
766 766  
drivers/acpi/acpica/evevent.c
... ... @@ -102,9 +102,8 @@
102 102 * RETURN: Status
103 103 *
104 104 * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks
105   - * (0 and 1). This causes the _PRW methods to be run, so the HW
106   - * must be fully initialized at this point, including global lock
107   - * support.
  105 + * (0 and 1). The HW must be fully initialized at this point,
  106 + * including global lock support.
108 107 *
109 108 ******************************************************************************/
110 109  
drivers/acpi/acpica/evgpe.c
... ... @@ -54,49 +54,84 @@
54 54  
55 55 /*******************************************************************************
56 56 *
57   - * FUNCTION: acpi_ev_update_gpe_enable_masks
  57 + * FUNCTION: acpi_ev_update_gpe_enable_mask
58 58 *
59 59 * PARAMETERS: gpe_event_info - GPE to update
60 60 *
61 61 * RETURN: Status
62 62 *
63   - * DESCRIPTION: Updates GPE register enable masks based upon whether there are
64   - * references (either wake or run) to this GPE
  63 + * DESCRIPTION: Updates GPE register enable mask based upon whether there are
  64 + * runtime references to this GPE
65 65 *
66 66 ******************************************************************************/
67 67  
68 68 acpi_status
69   -acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info)
  69 +acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
70 70 {
71 71 struct acpi_gpe_register_info *gpe_register_info;
72 72 u32 register_bit;
73 73  
74   - ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks);
  74 + ACPI_FUNCTION_TRACE(ev_update_gpe_enable_mask);
75 75  
76 76 gpe_register_info = gpe_event_info->register_info;
77 77 if (!gpe_register_info) {
78 78 return_ACPI_STATUS(AE_NOT_EXIST);
79 79 }
80 80  
81   - register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
  81 + register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info,
82 82 gpe_register_info);
83 83  
84   - /* Clear the wake/run bits up front */
  84 + /* Clear the run bit up front */
85 85  
86   - ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, register_bit);
87 86 ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
88 87  
89   - /* Set the mask bits only if there are references to this GPE */
  88 + /* Set the mask bit only if there are references to this GPE */
90 89  
91 90 if (gpe_event_info->runtime_count) {
92   - ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
  91 + ACPI_SET_BIT(gpe_register_info->enable_for_run, (u8)register_bit);
93 92 }
94 93  
95   - if (gpe_event_info->wakeup_count) {
96   - ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
  94 + return_ACPI_STATUS(AE_OK);
  95 +}
  96 +
  97 +/*******************************************************************************
  98 + *
  99 + * FUNCTION: acpi_ev_enable_gpe
  100 + *
  101 + * PARAMETERS: gpe_event_info - GPE to enable
  102 + *
  103 + * RETURN: Status
  104 + *
  105 + * DESCRIPTION: Clear the given GPE from stale events and enable it.
  106 + *
  107 + ******************************************************************************/
  108 +acpi_status
  109 +acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
  110 +{
  111 + acpi_status status;
  112 +
  113 + ACPI_FUNCTION_TRACE(ev_enable_gpe);
  114 +
  115 + /*
  116 + * We will only allow a GPE to be enabled if it has either an
  117 + * associated method (_Lxx/_Exx) or a handler. Otherwise, the
  118 + * GPE will be immediately disabled by acpi_ev_gpe_dispatch the
  119 + * first time it fires.
  120 + */
  121 + if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) {
  122 + return_ACPI_STATUS(AE_NO_HANDLER);
97 123 }
98 124  
99   - return_ACPI_STATUS(AE_OK);
  125 + /* Clear the GPE (of stale events) */
  126 + status = acpi_hw_clear_gpe(gpe_event_info);
  127 + if (ACPI_FAILURE(status)) {
  128 + return_ACPI_STATUS(status);
  129 + }
  130 +
  131 + /* Enable the requested GPE */
  132 + status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
  133 +
  134 + return_ACPI_STATUS(status);
100 135 }
101 136  
102 137  
... ... @@ -417,8 +452,12 @@
417 452 }
418 453 }
419 454  
420   - /* Enable this GPE */
421   - (void)acpi_hw_write_gpe_enable_reg(gpe_event_info);
  455 + /*
  456 + * Enable this GPE, conditionally. This means that the GPE will only be
  457 + * physically enabled if the enable_for_run bit is set in the event_info
  458 + */
  459 + (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE);
  460 +
422 461 return_VOID;
423 462 }
424 463  
drivers/acpi/acpica/evgpeblk.c
... ... @@ -439,8 +439,6 @@
439 439 {
440 440 acpi_status status;
441 441 struct acpi_gpe_event_info *gpe_event_info;
442   - struct acpi_gpe_walk_info walk_info;
443   - u32 wake_gpe_count;
444 442 u32 gpe_enabled_count;
445 443 u32 gpe_index;
446 444 u32 gpe_number;
447 445  
... ... @@ -456,37 +454,9 @@
456 454 }
457 455  
458 456 /*
459   - * Runtime option: Should wake GPEs be enabled at runtime? The default
460   - * is no, they should only be enabled just as the machine goes to sleep.
  457 + * Enable all GPEs that have a corresponding method. Any other GPEs
  458 + * within this block must be enabled via the acpi_enable_gpe interface.
461 459 */
462   - if (acpi_gbl_leave_wake_gpes_disabled) {
463   - /*
464   - * Differentiate runtime vs wake GPEs, via the _PRW control methods.
465   - * Each GPE that has one or more _PRWs that reference it is by
466   - * definition a wake GPE and will not be enabled while the machine
467   - * is running.
468   - */
469   - walk_info.gpe_block = gpe_block;
470   - walk_info.gpe_device = gpe_device;
471   - walk_info.execute_by_owner_id = FALSE;
472   -
473   - status =
474   - acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
475   - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
476   - acpi_ev_match_prw_and_gpe, NULL,
477   - &walk_info, NULL);
478   - if (ACPI_FAILURE(status)) {
479   - ACPI_EXCEPTION((AE_INFO, status,
480   - "While executing _PRW methods"));
481   - }
482   - }
483   -
484   - /*
485   - * Enable all GPEs that have a corresponding method and are not
486   - * capable of generating wakeups. Any other GPEs within this block
487   - * must be enabled via the acpi_enable_gpe interface.
488   - */
489   - wake_gpe_count = 0;
490 460 gpe_enabled_count = 0;
491 461  
492 462 if (gpe_device == acpi_gbl_fadt_gpe_device) {
493 463  
494 464  
... ... @@ -502,35 +472,21 @@
502 472 gpe_event_info = &gpe_block->event_info[gpe_index];
503 473 gpe_number = gpe_index + gpe_block->block_base_number;
504 474  
505   - /*
506   - * If the GPE has already been enabled for runtime
507   - * signaling, make sure it remains enabled, but do not
508   - * increment its reference counter.
509   - */
510   - if (gpe_event_info->runtime_count) {
511   - acpi_set_gpe(gpe_device, gpe_number,
512   - ACPI_GPE_ENABLE);
513   - gpe_enabled_count++;
514   - continue;
515   - }
516   -
517   - if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
518   - wake_gpe_count++;
519   - if (acpi_gbl_leave_wake_gpes_disabled) {
520   - continue;
521   - }
522   - }
523   -
524 475 /* Ignore GPEs that have no corresponding _Lxx/_Exx method */
525 476  
526 477 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) {
527 478 continue;
528 479 }
529 480  
530   - /* Enable this GPE */
  481 + /*
  482 + * If the GPE has already been enabled for runtime
  483 + * signaling, make sure it remains enabled, but do not
  484 + * increment its reference counter.
  485 + */
  486 + status = gpe_event_info->runtime_count ?
  487 + acpi_ev_enable_gpe(gpe_event_info) :
  488 + acpi_enable_gpe(gpe_device, gpe_number);
531 489  
532   - status = acpi_enable_gpe(gpe_device, gpe_number,
533   - ACPI_GPE_TYPE_RUNTIME);
534 490 if (ACPI_FAILURE(status)) {
535 491 ACPI_EXCEPTION((AE_INFO, status,
536 492 "Could not enable GPE 0x%02X",
537 493  
... ... @@ -542,10 +498,10 @@
542 498 }
543 499 }
544 500  
545   - if (gpe_enabled_count || wake_gpe_count) {
  501 + if (gpe_enabled_count) {
546 502 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
547   - "Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n",
548   - gpe_enabled_count, wake_gpe_count));
  503 + "Enabled %u GPEs in this block\n",
  504 + gpe_enabled_count));
549 505 }
550 506  
551 507 return_ACPI_STATUS(AE_OK);
drivers/acpi/acpica/evgpeinit.c
... ... @@ -211,9 +211,7 @@
211 211 * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a
212 212 * result of a Load() or load_table() operation. If new GPE
213 213 * methods have been installed, register the new methods and
214   - * enable and runtime GPEs that are associated with them. Also,
215   - * run any newly loaded _PRW methods in order to discover any
216   - * new CAN_WAKE GPEs.
  214 + * enable and runtime GPEs that are associated with them.
217 215 *
218 216 ******************************************************************************/
219 217  
220 218  
221 219  
... ... @@ -223,49 +221,12 @@
223 221 struct acpi_gpe_block_info *gpe_block;
224 222 struct acpi_gpe_walk_info walk_info;
225 223 acpi_status status = AE_OK;
226   - u32 new_wake_gpe_count = 0;
227 224  
228   - /* We will examine only _PRW/_Lxx/_Exx methods owned by this table */
229   -
230   - walk_info.owner_id = table_owner_id;
231   - walk_info.execute_by_owner_id = TRUE;
232   - walk_info.count = 0;
233   -
234   - if (acpi_gbl_leave_wake_gpes_disabled) {
235   - /*
236   - * 1) Run any newly-loaded _PRW methods to find any GPEs that
237   - * can now be marked as CAN_WAKE GPEs. Note: We must run the
238   - * _PRW methods before we process the _Lxx/_Exx methods because
239   - * we will enable all runtime GPEs associated with the new
240   - * _Lxx/_Exx methods at the time we process those methods.
241   - *
242   - * Unlock interpreter so that we can run the _PRW methods.
243   - */
244   - walk_info.gpe_block = NULL;
245   - walk_info.gpe_device = NULL;
246   -
247   - acpi_ex_exit_interpreter();
248   -
249   - status =
250   - acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
251   - ACPI_UINT32_MAX,
252   - ACPI_NS_WALK_NO_UNLOCK,
253   - acpi_ev_match_prw_and_gpe, NULL,
254   - &walk_info, NULL);
255   - if (ACPI_FAILURE(status)) {
256   - ACPI_EXCEPTION((AE_INFO, status,
257   - "While executing _PRW methods"));
258   - }
259   -
260   - acpi_ex_enter_interpreter();
261   - new_wake_gpe_count = walk_info.count;
262   - }
263   -
264 225 /*
265 226 * 2) Find any _Lxx/_Exx GPE methods that have just been loaded.
266 227 *
267   - * Any GPEs that correspond to new _Lxx/_Exx methods and are not
268   - * marked as CAN_WAKE are immediately enabled.
  228 + * Any GPEs that correspond to new _Lxx/_Exx methods are immediately
  229 + * enabled.
269 230 *
270 231 * Examine the namespace underneath each gpe_device within the
271 232 * gpe_block lists.
... ... @@ -275,6 +236,8 @@
275 236 return;
276 237 }
277 238  
  239 + walk_info.owner_id = table_owner_id;
  240 + walk_info.execute_by_owner_id = TRUE;
278 241 walk_info.count = 0;
279 242 walk_info.enable_this_gpe = TRUE;
280 243  
... ... @@ -307,10 +270,8 @@
307 270 gpe_xrupt_info = gpe_xrupt_info->next;
308 271 }
309 272  
310   - if (walk_info.count || new_wake_gpe_count) {
311   - ACPI_INFO((AE_INFO,
312   - "Enabled %u new runtime GPEs, added %u new wakeup GPEs",
313   - walk_info.count, new_wake_gpe_count));
  273 + if (walk_info.count) {
  274 + ACPI_INFO((AE_INFO, "Enabled %u new GPEs", walk_info.count));
314 275 }
315 276  
316 277 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
... ... @@ -386,9 +347,6 @@
386 347 /*
387 348 * 3) Edge/Level determination is based on the 2nd character
388 349 * of the method name
389   - *
390   - * NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is
391   - * found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set.
392 350 */
393 351 switch (name[1]) {
394 352 case 'L':
395 353  
396 354  
397 355  
... ... @@ -471,184 +429,24 @@
471 429 */
472 430 if (walk_info->enable_this_gpe) {
473 431  
474   - /* Ignore GPEs that can wake the system */
  432 + walk_info->count++;
  433 + gpe_device = walk_info->gpe_device;
475 434  
476   - if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE) ||
477   - !acpi_gbl_leave_wake_gpes_disabled) {
478   - walk_info->count++;
479   - gpe_device = walk_info->gpe_device;
  435 + if (gpe_device == acpi_gbl_fadt_gpe_device) {
  436 + gpe_device = NULL;
  437 + }
480 438  
481   - if (gpe_device == acpi_gbl_fadt_gpe_device) {
482   - gpe_device = NULL;
483   - }
484   -
485   - status = acpi_enable_gpe(gpe_device, gpe_number,
486   - ACPI_GPE_TYPE_RUNTIME);
487   - if (ACPI_FAILURE(status)) {
488   - ACPI_EXCEPTION((AE_INFO, status,
489   - "Could not enable GPE 0x%02X",
490   - gpe_number));
491   - }
  439 + status = acpi_enable_gpe(gpe_device, gpe_number);
  440 + if (ACPI_FAILURE(status)) {
  441 + ACPI_EXCEPTION((AE_INFO, status,
  442 + "Could not enable GPE 0x%02X",
  443 + gpe_number));
492 444 }
493 445 }
494 446  
495 447 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
496 448 "Registered GPE method %s as GPE number 0x%.2X\n",
497 449 name, gpe_number));
498   - return_ACPI_STATUS(AE_OK);
499   -}
500   -
501   -/*******************************************************************************
502   - *
503   - * FUNCTION: acpi_ev_match_prw_and_gpe
504   - *
505   - * PARAMETERS: Callback from walk_namespace
506   - *
507   - * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
508   - * not aborted on a single _PRW failure.
509   - *
510   - * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a
511   - * Device. Run the _PRW method. If present, extract the GPE
512   - * number and mark the GPE as a CAN_WAKE GPE. Allows a
513   - * per-owner_id execution if execute_by_owner_id is TRUE in the
514   - * walk_info parameter block.
515   - *
516   - * If walk_info->execute_by_owner_id is TRUE, we only execute _PRWs with that
517   - * owner.
518   - * If walk_info->gpe_device is NULL, we execute every _PRW found. Otherwise,
519   - * we only execute _PRWs that refer to the input gpe_device.
520   - *
521   - ******************************************************************************/
522   -
523   -acpi_status
524   -acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
525   - u32 level, void *context, void **return_value)
526   -{
527   - struct acpi_gpe_walk_info *walk_info =
528   - ACPI_CAST_PTR(struct acpi_gpe_walk_info, context);
529   - struct acpi_namespace_node *gpe_device;
530   - struct acpi_gpe_block_info *gpe_block;
531   - struct acpi_namespace_node *target_gpe_device;
532   - struct acpi_namespace_node *prw_node;
533   - struct acpi_gpe_event_info *gpe_event_info;
534   - union acpi_operand_object *pkg_desc;
535   - union acpi_operand_object *obj_desc;
536   - u32 gpe_number;
537   - acpi_status status;
538   -
539   - ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe);
540   -
541   - /* Check for a _PRW method under this device */
542   -
543   - status = acpi_ns_get_node(obj_handle, METHOD_NAME__PRW,
544   - ACPI_NS_NO_UPSEARCH, &prw_node);
545   - if (ACPI_FAILURE(status)) {
546   - return_ACPI_STATUS(AE_OK);
547   - }
548   -
549   - /* Check if requested owner_id matches this owner_id */
550   -
551   - if ((walk_info->execute_by_owner_id) &&
552   - (prw_node->owner_id != walk_info->owner_id)) {
553   - return_ACPI_STATUS(AE_OK);
554   - }
555   -
556   - /* Execute the _PRW */
557   -
558   - status = acpi_ut_evaluate_object(prw_node, NULL,
559   - ACPI_BTYPE_PACKAGE, &pkg_desc);
560   - if (ACPI_FAILURE(status)) {
561   - return_ACPI_STATUS(AE_OK);
562   - }
563   -
564   - /* The returned _PRW package must have at least two elements */
565   -
566   - if (pkg_desc->package.count < 2) {
567   - goto cleanup;
568   - }
569   -
570   - /* Extract pointers from the input context */
571   -
572   - gpe_device = walk_info->gpe_device;
573   - gpe_block = walk_info->gpe_block;
574   -
575   - /*
576   - * The _PRW object must return a package, we are only interested
577   - * in the first element
578   - */
579   - obj_desc = pkg_desc->package.elements[0];
580   -
581   - if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
582   -
583   - /* Use FADT-defined GPE device (from definition of _PRW) */
584   -
585   - target_gpe_device = NULL;
586   - if (gpe_device) {
587   - target_gpe_device = acpi_gbl_fadt_gpe_device;
588   - }
589   -
590   - /* Integer is the GPE number in the FADT described GPE blocks */
591   -
592   - gpe_number = (u32)obj_desc->integer.value;
593   - } else if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
594   -
595   - /* Package contains a GPE reference and GPE number within a GPE block */
596   -
597   - if ((obj_desc->package.count < 2) ||
598   - ((obj_desc->package.elements[0])->common.type !=
599   - ACPI_TYPE_LOCAL_REFERENCE) ||
600   - ((obj_desc->package.elements[1])->common.type !=
601   - ACPI_TYPE_INTEGER)) {
602   - goto cleanup;
603   - }
604   -
605   - /* Get GPE block reference and decode */
606   -
607   - target_gpe_device =
608   - obj_desc->package.elements[0]->reference.node;
609   - gpe_number = (u32)obj_desc->package.elements[1]->integer.value;
610   - } else {
611   - /* Unknown type, just ignore it */
612   -
613   - goto cleanup;
614   - }
615   -
616   - /* Get the gpe_event_info for this GPE */
617   -
618   - if (gpe_device) {
619   - /*
620   - * Is this GPE within this block?
621   - *
622   - * TRUE if and only if these conditions are true:
623   - * 1) The GPE devices match.
624   - * 2) The GPE index(number) is within the range of the Gpe Block
625   - * associated with the GPE device.
626   - */
627   - if (gpe_device != target_gpe_device) {
628   - goto cleanup;
629   - }
630   -
631   - gpe_event_info =
632   - acpi_ev_low_get_gpe_info(gpe_number, gpe_block);
633   - } else {
634   - /* gpe_device is NULL, just match the target_device and gpe_number */
635   -
636   - gpe_event_info =
637   - acpi_ev_get_gpe_event_info(target_gpe_device, gpe_number);
638   - }
639   -
640   - if (gpe_event_info) {
641   - if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
642   -
643   - /* This GPE can wake the system */
644   -
645   - gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
646   - walk_info->count++;
647   - }
648   - }
649   -
650   - cleanup:
651   - acpi_ut_remove_reference(pkg_desc);
652 450 return_ACPI_STATUS(AE_OK);
653 451 }
drivers/acpi/acpica/evrgnini.c
... ... @@ -199,7 +199,7 @@
199 199 return_ACPI_STATUS(status);
200 200 }
201 201  
202   - parent_node = acpi_ns_get_parent_node(region_obj->region.node);
  202 + parent_node = region_obj->region.node->parent;
203 203  
204 204 /*
205 205 * Get the _SEG and _BBN values from the device upon which the handler
... ... @@ -248,7 +248,7 @@
248 248 break;
249 249 }
250 250  
251   - pci_root_node = acpi_ns_get_parent_node(pci_root_node);
  251 + pci_root_node = pci_root_node->parent;
252 252 }
253 253  
254 254 /* PCI root bridge not found, use namespace root node */
... ... @@ -280,7 +280,7 @@
280 280 */
281 281 pci_device_node = region_obj->region.node;
282 282 while (pci_device_node && (pci_device_node->type != ACPI_TYPE_DEVICE)) {
283   - pci_device_node = acpi_ns_get_parent_node(pci_device_node);
  283 + pci_device_node = pci_device_node->parent;
284 284 }
285 285  
286 286 if (!pci_device_node) {
... ... @@ -521,7 +521,7 @@
521 521 return_ACPI_STATUS(AE_NOT_EXIST);
522 522 }
523 523  
524   - node = acpi_ns_get_parent_node(region_obj->region.node);
  524 + node = region_obj->region.node->parent;
525 525 space_id = region_obj->region.space_id;
526 526  
527 527 /* Setup defaults */
... ... @@ -654,7 +654,7 @@
654 654  
655 655 /* This node does not have the handler we need; Pop up one level */
656 656  
657   - node = acpi_ns_get_parent_node(node);
  657 + node = node->parent;
658 658 }
659 659  
660 660 /* If we get here, there is no handler for this region */
drivers/acpi/acpica/evxfevnt.c
... ... @@ -213,101 +213,71 @@
213 213  
214 214 /*******************************************************************************
215 215 *
216   - * FUNCTION: acpi_clear_and_enable_gpe
  216 + * FUNCTION: acpi_gpe_wakeup
217 217 *
218   - * PARAMETERS: gpe_event_info - GPE to enable
219   - *
220   - * RETURN: Status
221   - *
222   - * DESCRIPTION: Clear the given GPE from stale events and enable it.
223   - *
224   - ******************************************************************************/
225   -static acpi_status
226   -acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
227   -{
228   - acpi_status status;
229   -
230   - /*
231   - * We will only allow a GPE to be enabled if it has either an
232   - * associated method (_Lxx/_Exx) or a handler. Otherwise, the
233   - * GPE will be immediately disabled by acpi_ev_gpe_dispatch the
234   - * first time it fires.
235   - */
236   - if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) {
237   - return_ACPI_STATUS(AE_NO_HANDLER);
238   - }
239   -
240   - /* Clear the GPE (of stale events) */
241   - status = acpi_hw_clear_gpe(gpe_event_info);
242   - if (ACPI_FAILURE(status)) {
243   - return_ACPI_STATUS(status);
244   - }
245   -
246   - /* Enable the requested GPE */
247   - status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
248   -
249   - return_ACPI_STATUS(status);
250   -}
251   -
252   -/*******************************************************************************
253   - *
254   - * FUNCTION: acpi_set_gpe
255   - *
256 218 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
257 219 * gpe_number - GPE level within the GPE block
258   - * action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE
  220 + * Action - Enable or Disable
259 221 *
260 222 * RETURN: Status
261 223 *
262   - * DESCRIPTION: Enable or disable an individual GPE. This function bypasses
263   - * the reference count mechanism used in the acpi_enable_gpe and
264   - * acpi_disable_gpe interfaces -- and should be used with care.
  224 + * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit.
265 225 *
266   - * Note: Typically used to disable a runtime GPE for short period of time,
267   - * then re-enable it, without disturbing the existing reference counts. This
268   - * is useful, for example, in the Embedded Controller (EC) driver.
269   - *
270 226 ******************************************************************************/
271   -acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
  227 +acpi_status acpi_gpe_wakeup(acpi_handle gpe_device, u32 gpe_number, u8 action)
272 228 {
  229 + acpi_status status = AE_OK;
273 230 struct acpi_gpe_event_info *gpe_event_info;
274   - acpi_status status;
  231 + struct acpi_gpe_register_info *gpe_register_info;
275 232 acpi_cpu_flags flags;
  233 + u32 register_bit;
276 234  
277   - ACPI_FUNCTION_TRACE(acpi_set_gpe);
  235 + ACPI_FUNCTION_TRACE(acpi_gpe_wakeup);
278 236  
279 237 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
280 238  
281 239 /* Ensure that we have a valid GPE number */
282 240  
283 241 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
284   - if (!gpe_event_info) {
  242 + if (!gpe_event_info || !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
285 243 status = AE_BAD_PARAMETER;
286 244 goto unlock_and_exit;
287 245 }
288 246  
  247 + gpe_register_info = gpe_event_info->register_info;
  248 + if (!gpe_register_info) {
  249 + status = AE_NOT_EXIST;
  250 + goto unlock_and_exit;
  251 + }
  252 +
  253 + register_bit =
  254 + acpi_hw_get_gpe_register_bit(gpe_event_info, gpe_register_info);
  255 +
289 256 /* Perform the action */
290 257  
291 258 switch (action) {
292 259 case ACPI_GPE_ENABLE:
293   - status = acpi_clear_and_enable_gpe(gpe_event_info);
  260 + ACPI_SET_BIT(gpe_register_info->enable_for_wake,
  261 + (u8)register_bit);
294 262 break;
295 263  
296 264 case ACPI_GPE_DISABLE:
297   - status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
  265 + ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
  266 + (u8)register_bit);
298 267 break;
299 268  
300 269 default:
  270 + ACPI_ERROR((AE_INFO, "%u, Invalid action", action));
301 271 status = AE_BAD_PARAMETER;
302 272 break;
303 273 }
304 274  
305   - unlock_and_exit:
  275 +unlock_and_exit:
306 276 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
307 277 return_ACPI_STATUS(status);
308 278 }
309 279  
310   -ACPI_EXPORT_SYMBOL(acpi_set_gpe)
  280 +ACPI_EXPORT_SYMBOL(acpi_gpe_wakeup)
311 281  
312 282 /*******************************************************************************
313 283 *
314 284  
315 285  
... ... @@ -315,17 +285,14 @@
315 285 *
316 286 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
317 287 * gpe_number - GPE level within the GPE block
318   - * gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE
319   - * or both
320 288 *
321 289 * RETURN: Status
322 290 *
323 291 * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
324   - * hardware-enabled (for runtime GPEs), or the GPE register mask
325   - * is updated (for wake GPEs).
  292 + * hardware-enabled.
326 293 *
327 294 ******************************************************************************/
328   -acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type)
  295 +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
329 296 {
330 297 acpi_status status = AE_OK;
331 298 struct acpi_gpe_event_info *gpe_event_info;
... ... @@ -333,12 +300,6 @@
333 300  
334 301 ACPI_FUNCTION_TRACE(acpi_enable_gpe);
335 302  
336   - /* Parameter validation */
337   -
338   - if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) {
339   - return_ACPI_STATUS(AE_BAD_PARAMETER);
340   - }
341   -
342 303 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
343 304  
344 305 /* Ensure that we have a valid GPE number */
345 306  
346 307  
347 308  
... ... @@ -349,47 +310,20 @@
349 310 goto unlock_and_exit;
350 311 }
351 312  
352   - if (gpe_type & ACPI_GPE_TYPE_RUNTIME) {
353   - if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
354   - status = AE_LIMIT; /* Too many references */
355   - goto unlock_and_exit;
356   - }
357   -
358   - gpe_event_info->runtime_count++;
359   - if (gpe_event_info->runtime_count == 1) {
360   - status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
361   - if (ACPI_SUCCESS(status)) {
362   - status = acpi_clear_and_enable_gpe(gpe_event_info);
363   - }
364   -
365   - if (ACPI_FAILURE(status)) {
366   - gpe_event_info->runtime_count--;
367   - goto unlock_and_exit;
368   - }
369   - }
  313 + if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
  314 + status = AE_LIMIT; /* Too many references */
  315 + goto unlock_and_exit;
370 316 }
371 317  
372   - if (gpe_type & ACPI_GPE_TYPE_WAKE) {
373   - /* The GPE must have the ability to wake the system */
374   -
375   - if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
376   - status = AE_TYPE;
377   - goto unlock_and_exit;
  318 + gpe_event_info->runtime_count++;
  319 + if (gpe_event_info->runtime_count == 1) {
  320 + status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
  321 + if (ACPI_SUCCESS(status)) {
  322 + status = acpi_ev_enable_gpe(gpe_event_info);
378 323 }
379   -
380   - if (gpe_event_info->wakeup_count == ACPI_UINT8_MAX) {
381   - status = AE_LIMIT; /* Too many references */
382   - goto unlock_and_exit;
  324 + if (ACPI_FAILURE(status)) {
  325 + gpe_event_info->runtime_count--;
383 326 }
384   -
385   - /*
386   - * Update the enable mask on the first wakeup reference. Wake GPEs
387   - * are only hardware-enabled just before sleeping.
388   - */
389   - gpe_event_info->wakeup_count++;
390   - if (gpe_event_info->wakeup_count == 1) {
391   - status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
392   - }
393 327 }
394 328  
395 329 unlock_and_exit:
... ... @@ -404,8 +338,6 @@
404 338 *
405 339 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
406 340 * gpe_number - GPE level within the GPE block
407   - * gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE
408   - * or both
409 341 *
410 342 * RETURN: Status
411 343 *
... ... @@ -414,7 +346,7 @@
414 346 * the GPE mask bit disabled (for wake GPEs)
415 347 *
416 348 ******************************************************************************/
417   -acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type)
  349 +acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
418 350 {
419 351 acpi_status status = AE_OK;
420 352 struct acpi_gpe_event_info *gpe_event_info;
... ... @@ -422,12 +354,6 @@
422 354  
423 355 ACPI_FUNCTION_TRACE(acpi_disable_gpe);
424 356  
425   - /* Parameter validation */
426   -
427   - if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) {
428   - return_ACPI_STATUS(AE_BAD_PARAMETER);
429   - }
430   -
431 357 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
432 358  
433 359 /* Ensure that we have a valid GPE number */
434 360  
435 361  
... ... @@ -440,41 +366,21 @@
440 366  
441 367 /* Hardware-disable a runtime GPE on removal of the last reference */
442 368  
443   - if (gpe_type & ACPI_GPE_TYPE_RUNTIME) {
444   - if (!gpe_event_info->runtime_count) {
445   - status = AE_LIMIT; /* There are no references to remove */
446   - goto unlock_and_exit;
447   - }
448   -
449   - gpe_event_info->runtime_count--;
450   - if (!gpe_event_info->runtime_count) {
451   - status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
452   - if (ACPI_SUCCESS(status)) {
453   - status = acpi_hw_low_set_gpe(gpe_event_info,
454   - ACPI_GPE_DISABLE);
455   - }
456   -
457   - if (ACPI_FAILURE(status)) {
458   - gpe_event_info->runtime_count++;
459   - goto unlock_and_exit;
460   - }
461   - }
  369 + if (!gpe_event_info->runtime_count) {
  370 + status = AE_LIMIT; /* There are no references to remove */
  371 + goto unlock_and_exit;
462 372 }
463 373  
464   - /*
465   - * Update masks for wake GPE on removal of the last reference.
466   - * No need to hardware-disable wake GPEs here, they are not currently
467   - * enabled.
468   - */
469   - if (gpe_type & ACPI_GPE_TYPE_WAKE) {
470   - if (!gpe_event_info->wakeup_count) {
471   - status = AE_LIMIT; /* There are no references to remove */
472   - goto unlock_and_exit;
  374 + gpe_event_info->runtime_count--;
  375 + if (!gpe_event_info->runtime_count) {
  376 + status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
  377 + if (ACPI_SUCCESS(status)) {
  378 + status =
  379 + acpi_hw_low_set_gpe(gpe_event_info,
  380 + ACPI_GPE_DISABLE);
473 381 }
474   -
475   - gpe_event_info->wakeup_count--;
476   - if (!gpe_event_info->wakeup_count) {
477   - status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
  382 + if (ACPI_FAILURE(status)) {
  383 + gpe_event_info->runtime_count++;
478 384 }
479 385 }
480 386  
... ... @@ -486,6 +392,59 @@
486 392  
487 393 /*******************************************************************************
488 394 *
  395 + * FUNCTION: acpi_gpe_can_wake
  396 + *
  397 + * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
  398 + * gpe_number - GPE level within the GPE block
  399 + *
  400 + * RETURN: Status
  401 + *
  402 + * DESCRIPTION: Set the ACPI_GPE_CAN_WAKE flag for the given GPE. If the GPE
  403 + * has a corresponding method and is currently enabled, disable it
  404 + * (GPEs with corresponding methods are enabled unconditionally
  405 + * during initialization, but GPEs that can wake up are expected
  406 + * to be initially disabled).
  407 + *
  408 + ******************************************************************************/
  409 +acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number)
  410 +{
  411 + acpi_status status = AE_OK;
  412 + struct acpi_gpe_event_info *gpe_event_info;
  413 + acpi_cpu_flags flags;
  414 + u8 disable = 0;
  415 +
  416 + ACPI_FUNCTION_TRACE(acpi_gpe_can_wake);
  417 +
  418 + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
  419 +
  420 + /* Ensure that we have a valid GPE number */
  421 +
  422 + gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
  423 + if (!gpe_event_info) {
  424 + status = AE_BAD_PARAMETER;
  425 + goto unlock_and_exit;
  426 + }
  427 +
  428 + if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
  429 + goto unlock_and_exit;
  430 + }
  431 +
  432 + gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
  433 + disable = (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)
  434 + && gpe_event_info->runtime_count;
  435 +
  436 +unlock_and_exit:
  437 + acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
  438 +
  439 + if (disable)
  440 + status = acpi_disable_gpe(gpe_device, gpe_number);
  441 +
  442 + return_ACPI_STATUS(status);
  443 +}
  444 +ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake)
  445 +
  446 +/*******************************************************************************
  447 + *
489 448 * FUNCTION: acpi_disable_event
490 449 *
491 450 * PARAMETERS: Event - The fixed eventto be enabled
... ... @@ -800,7 +759,7 @@
800 759  
801 760 obj_desc->device.gpe_block = gpe_block;
802 761  
803   - /* Run the _PRW methods and enable the runtime GPEs in the new block */
  762 + /* Enable the runtime GPEs in the new block */
804 763  
805 764 status = acpi_ev_initialize_gpe_block(node, gpe_block);
806 765  
drivers/acpi/acpica/exconfig.c
... ... @@ -120,7 +120,7 @@
120 120 acpi_ns_exec_module_code_list();
121 121 acpi_ex_enter_interpreter();
122 122  
123   - /* Update GPEs for any new _PRW or _Lxx/_Exx methods. Ignore errors */
  123 + /* Update GPEs for any new _Lxx/_Exx methods. Ignore errors */
124 124  
125 125 status = acpi_tb_get_owner_id(table_index, &owner_id);
126 126 if (ACPI_SUCCESS(status)) {
drivers/acpi/acpica/exdump.c
... ... @@ -742,7 +742,7 @@
742 742 }
743 743  
744 744 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
745   - "**** Start operand dump for opcode [%s], %d operands\n",
  745 + "**** Start operand dump for opcode [%s], %u operands\n",
746 746 opcode_name, num_operands));
747 747  
748 748 if (num_operands == 0) {
... ... @@ -812,7 +812,7 @@
812 812 acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type));
813 813 acpi_ex_out_pointer("Attached Object",
814 814 acpi_ns_get_attached_object(node));
815   - acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node));
  815 + acpi_ex_out_pointer("Parent", node->parent);
816 816  
817 817 acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node),
818 818 acpi_ex_dump_node);
... ... @@ -945,7 +945,7 @@
945 945  
946 946 case ACPI_TYPE_PACKAGE:
947 947  
948   - acpi_os_printf("[Package] Contains %d Elements:\n",
  948 + acpi_os_printf("[Package] Contains %u Elements:\n",
949 949 obj_desc->package.count);
950 950  
951 951 for (i = 0; i < obj_desc->package.count; i++) {
drivers/acpi/acpica/exfldio.c
... ... @@ -534,13 +534,13 @@
534 534 if (ACPI_SUCCESS(status)) {
535 535 if (read_write == ACPI_READ) {
536 536 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
537   - "Value Read %8.8X%8.8X, Width %d\n",
  537 + "Value Read %8.8X%8.8X, Width %u\n",
538 538 ACPI_FORMAT_UINT64(*value),
539 539 obj_desc->common_field.
540 540 access_byte_width));
541 541 } else {
542 542 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
543   - "Value Written %8.8X%8.8X, Width %d\n",
  543 + "Value Written %8.8X%8.8X, Width %u\n",
544 544 ACPI_FORMAT_UINT64(*value),
545 545 obj_desc->common_field.
546 546 access_byte_width));
drivers/acpi/acpica/exprep.c
... ... @@ -108,11 +108,11 @@
108 108 field_byte_length = field_byte_end_offset - field_byte_offset;
109 109  
110 110 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
111   - "Bit length %d, Bit offset %d\n",
  111 + "Bit length %u, Bit offset %u\n",
112 112 field_bit_length, field_bit_offset));
113 113  
114 114 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
115   - "Byte Length %d, Byte Offset %d, End Offset %d\n",
  115 + "Byte Length %u, Byte Offset %u, End Offset %u\n",
116 116 field_byte_length, field_byte_offset,
117 117 field_byte_end_offset));
118 118  
119 119  
... ... @@ -147,11 +147,11 @@
147 147 accesses = field_end_offset - field_start_offset;
148 148  
149 149 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
150   - "AccessWidth %d end is within region\n",
  150 + "AccessWidth %u end is within region\n",
151 151 access_byte_width));
152 152  
153 153 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
154   - "Field Start %d, Field End %d -- requires %d accesses\n",
  154 + "Field Start %u, Field End %u -- requires %u accesses\n",
155 155 field_start_offset, field_end_offset,
156 156 accesses));
157 157  
... ... @@ -159,7 +159,7 @@
159 159  
160 160 if (accesses <= 1) {
161 161 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
162   - "Entire field can be accessed with one operation of size %d\n",
  162 + "Entire field can be accessed with one operation of size %u\n",
163 163 access_byte_width));
164 164 return_VALUE(access_byte_width);
165 165 }
... ... @@ -174,7 +174,7 @@
174 174 }
175 175 } else {
176 176 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
177   - "AccessWidth %d end is NOT within region\n",
  177 + "AccessWidth %u end is NOT within region\n",
178 178 access_byte_width));
179 179 if (access_byte_width == 1) {
180 180 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
... ... @@ -190,7 +190,7 @@
190 190 * previous access
191 191 */
192 192 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
193   - "Backing off to previous optimal access width of %d\n",
  193 + "Backing off to previous optimal access width of %u\n",
194 194 minimum_access_width));
195 195 return_VALUE(minimum_access_width);
196 196 }
... ... @@ -384,15 +384,6 @@
384 384 obj_desc->common_field.start_field_bit_offset = (u8)
385 385 (field_bit_position -
386 386 ACPI_MUL_8(obj_desc->common_field.base_byte_offset));
387   -
388   - /*
389   - * Does the entire field fit within a single field access element? (datum)
390   - * (i.e., without crossing a datum boundary)
391   - */
392   - if ((obj_desc->common_field.start_field_bit_offset +
393   - field_bit_length) <= (u16) access_bit_width) {
394   - obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
395   - }
396 387  
397 388 return_ACPI_STATUS(AE_OK);
398 389 }
drivers/acpi/acpica/exregion.c
... ... @@ -194,7 +194,7 @@
194 194 ((u64) address - (u64) mem_info->mapped_physical_address);
195 195  
196 196 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
197   - "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
  197 + "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
198 198 bit_width, function,
199 199 ACPI_FORMAT_NATIVE_UINT(address)));
200 200  
... ... @@ -297,7 +297,7 @@
297 297 ACPI_FUNCTION_TRACE(ex_system_io_space_handler);
298 298  
299 299 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
300   - "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
  300 + "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
301 301 bit_width, function,
302 302 ACPI_FORMAT_NATIVE_UINT(address)));
303 303  
... ... @@ -373,7 +373,7 @@
373 373 pci_register = (u16) (u32) address;
374 374  
375 375 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
376   - "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
  376 + "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
377 377 function, bit_width, pci_id->segment, pci_id->bus,
378 378 pci_id->device, pci_id->function, pci_register));
379 379  
drivers/acpi/acpica/hwgpe.c
... ... @@ -57,7 +57,7 @@
57 57  
58 58 /******************************************************************************
59 59 *
60   - * FUNCTION: acpi_hw_gpe_register_bit
  60 + * FUNCTION: acpi_hw_get_gpe_register_bit
61 61 *
62 62 * PARAMETERS: gpe_event_info - Info block for the GPE
63 63 * gpe_register_info - Info block for the GPE register
... ... @@ -69,7 +69,7 @@
69 69 *
70 70 ******************************************************************************/
71 71  
72   -u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info,
  72 +u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info,
73 73 struct acpi_gpe_register_info *gpe_register_info)
74 74 {
75 75 return (u32)1 << (gpe_event_info->gpe_number -
... ... @@ -115,7 +115,7 @@
115 115  
116 116 /* Set ot clear just the bit that corresponds to this GPE */
117 117  
118   - register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
  118 + register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info,
119 119 gpe_register_info);
120 120 switch (action) {
121 121 case ACPI_GPE_COND_ENABLE:
... ... @@ -143,31 +143,6 @@
143 143  
144 144 /******************************************************************************
145 145 *
146   - * FUNCTION: acpi_hw_write_gpe_enable_reg
147   - *
148   - * PARAMETERS: gpe_event_info - Info block for the GPE to be enabled
149   - *
150   - * RETURN: Status
151   - *
152   - * DESCRIPTION: Write a GPE enable register. Note: The bit for this GPE must
153   - * already be cleared or set in the parent register
154   - * enable_for_run mask.
155   - *
156   - ******************************************************************************/
157   -
158   -acpi_status
159   -acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
160   -{
161   - acpi_status status;
162   -
163   - ACPI_FUNCTION_ENTRY();
164   -
165   - status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE);
166   - return (status);
167   -}
168   -
169   -/******************************************************************************
170   - *
171 146 * FUNCTION: acpi_hw_clear_gpe
172 147 *
173 148 * PARAMETERS: gpe_event_info - Info block for the GPE to be cleared
... ... @@ -193,7 +168,7 @@
193 168 return (AE_NOT_EXIST);
194 169 }
195 170  
196   - register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
  171 + register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info,
197 172 gpe_register_info);
198 173  
199 174 /*
... ... @@ -241,7 +216,7 @@
241 216  
242 217 /* Get the register bitmask for this GPE */
243 218  
244   - register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
  219 + register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info,
245 220 gpe_register_info);
246 221  
247 222 /* GPE currently enabled? (enabled for runtime?) */
drivers/acpi/acpica/hwsleep.c
... ... @@ -307,7 +307,7 @@
307 307 return_ACPI_STATUS(status);
308 308 }
309 309 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
310   - "Entering sleep state [S%d]\n", sleep_state));
  310 + "Entering sleep state [S%u]\n", sleep_state));
311 311  
312 312 /* Clear the SLP_EN and SLP_TYP fields */
313 313  
drivers/acpi/acpica/nsaccess.c
... ... @@ -338,8 +338,7 @@
338 338 */
339 339 while (!acpi_ns_opens_scope(prefix_node->type) &&
340 340 prefix_node->type != ACPI_TYPE_ANY) {
341   - prefix_node =
342   - acpi_ns_get_parent_node(prefix_node);
  341 + prefix_node = prefix_node->parent;
343 342 }
344 343 }
345 344 }
... ... @@ -419,7 +418,7 @@
419 418 /* Backup to the parent node */
420 419  
421 420 num_carats++;
422   - this_node = acpi_ns_get_parent_node(this_node);
  421 + this_node = this_node->parent;
423 422 if (!this_node) {
424 423  
425 424 /* Current scope has no parent scope */
... ... @@ -433,7 +432,7 @@
433 432  
434 433 if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
435 434 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
436   - "Search scope is [%4.4s], path has %d carat(s)\n",
  435 + "Search scope is [%4.4s], path has %u carat(s)\n",
437 436 acpi_ut_get_node_name
438 437 (this_node), num_carats));
439 438 }
... ... @@ -495,7 +494,7 @@
495 494 path++;
496 495  
497 496 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
498   - "Multi Pathname (%d Segments, Flags=%X)\n",
  497 + "Multi Pathname (%u Segments, Flags=%X)\n",
499 498 num_segments, flags));
500 499 break;
501 500  
drivers/acpi/acpica/nsalloc.c
... ... @@ -159,7 +159,7 @@
159 159  
160 160 ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node);
161 161  
162   - parent_node = acpi_ns_get_parent_node(node);
  162 + parent_node = node->parent;
163 163  
164 164 prev_node = NULL;
165 165 next_node = parent_node->child;
166 166  
167 167  
... ... @@ -168,29 +168,20 @@
168 168  
169 169 while (next_node != node) {
170 170 prev_node = next_node;
171   - next_node = prev_node->peer;
  171 + next_node = next_node->peer;
172 172 }
173 173  
174 174 if (prev_node) {
175 175  
176 176 /* Node is not first child, unlink it */
177 177  
178   - prev_node->peer = next_node->peer;
179   - if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
180   - prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
181   - }
  178 + prev_node->peer = node->peer;
182 179 } else {
183   - /* Node is first child (has no previous peer) */
184   -
185   - if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
186   -
187   - /* No peers at all */
188   -
189   - parent_node->child = NULL;
190   - } else { /* Link peer list to parent */
191   -
192   - parent_node->child = next_node->peer;
193   - }
  180 + /*
  181 + * Node is first child (has no previous peer).
  182 + * Link peer list to parent
  183 + */
  184 + parent_node->child = node->peer;
194 185 }
195 186  
196 187 /* Delete the node and any attached objects */
197 188  
198 189  
199 190  
200 191  
201 192  
202 193  
203 194  
... ... @@ -228,33 +219,42 @@
228 219  
229 220 ACPI_FUNCTION_TRACE(ns_install_node);
230 221  
231   - /*
232   - * Get the owner ID from the Walk state. The owner ID is used to track
233   - * table deletion and deletion of objects created by methods.
234   - */
235 222 if (walk_state) {
  223 + /*
  224 + * Get the owner ID from the Walk state. The owner ID is used to
  225 + * track table deletion and deletion of objects created by methods.
  226 + */
236 227 owner_id = walk_state->owner_id;
  228 +
  229 + if ((walk_state->method_desc) &&
  230 + (parent_node != walk_state->method_node)) {
  231 + /*
  232 + * A method is creating a new node that is not a child of the
  233 + * method (it is non-local). Mark the executing method as having
  234 + * modified the namespace. This is used for cleanup when the
  235 + * method exits.
  236 + */
  237 + walk_state->method_desc->method.flags |=
  238 + AOPOBJ_MODIFIED_NAMESPACE;
  239 + }
237 240 }
238 241  
239 242 /* Link the new entry into the parent and existing children */
240 243  
  244 + node->peer = NULL;
  245 + node->parent = parent_node;
241 246 child_node = parent_node->child;
  247 +
242 248 if (!child_node) {
243 249 parent_node->child = node;
244   - node->flags |= ANOBJ_END_OF_PEER_LIST;
245   - node->peer = parent_node;
246 250 } else {
247   - while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
  251 + /* Add node to the end of the peer list */
  252 +
  253 + while (child_node->peer) {
248 254 child_node = child_node->peer;
249 255 }
250 256  
251 257 child_node->peer = node;
252   -
253   - /* Clear end-of-list flag */
254   -
255   - child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
256   - node->flags |= ANOBJ_END_OF_PEER_LIST;
257   - node->peer = parent_node;
258 258 }
259 259  
260 260 /* Init the new entry */
261 261  
... ... @@ -288,9 +288,8 @@
288 288  
289 289 void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
290 290 {
291   - struct acpi_namespace_node *child_node;
292 291 struct acpi_namespace_node *next_node;
293   - u8 flags;
  292 + struct acpi_namespace_node *node_to_delete;
294 293  
295 294 ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node);
296 295  
297 296  
298 297  
299 298  
300 299  
301 300  
302 301  
... ... @@ -298,38 +297,27 @@
298 297 return_VOID;
299 298 }
300 299  
301   - /* If no children, all done! */
302   -
303   - child_node = parent_node->child;
304   - if (!child_node) {
305   - return_VOID;
306   - }
307   -
308 300 /* Deallocate all children at this level */
309 301  
310   - do {
  302 + next_node = parent_node->child;
  303 + while (next_node) {
311 304  
312   - /* Get the things we need */
313   -
314   - next_node = child_node->peer;
315   - flags = child_node->flags;
316   -
317 305 /* Grandchildren should have all been deleted already */
318 306  
319   - if (child_node->child) {
  307 + if (next_node->child) {
320 308 ACPI_ERROR((AE_INFO, "Found a grandchild! P=%p C=%p",
321   - parent_node, child_node));
  309 + parent_node, next_node));
322 310 }
323 311  
324 312 /*
325 313 * Delete this child node and move on to the next child in the list.
326 314 * No need to unlink the node since we are deleting the entire branch.
327 315 */
328   - acpi_ns_delete_node(child_node);
329   - child_node = next_node;
  316 + node_to_delete = next_node;
  317 + next_node = next_node->peer;
  318 + acpi_ns_delete_node(node_to_delete);
  319 + };
330 320  
331   - } while (!(flags & ANOBJ_END_OF_PEER_LIST));
332   -
333 321 /* Clear the parent's child pointer */
334 322  
335 323 parent_node->child = NULL;
... ... @@ -405,7 +393,7 @@
405 393  
406 394 /* Move up the tree to the grandparent */
407 395  
408   - parent_node = acpi_ns_get_parent_node(parent_node);
  396 + parent_node = parent_node->parent;
409 397 }
410 398 }
411 399  
... ... @@ -510,7 +498,7 @@
510 498  
511 499 /* Move up the tree to the grandparent */
512 500  
513   - parent_node = acpi_ns_get_parent_node(parent_node);
  501 + parent_node = parent_node->parent;
514 502 }
515 503 }
516 504  
drivers/acpi/acpica/nsdump.c
... ... @@ -441,7 +441,7 @@
441 441 return (AE_OK);
442 442 }
443 443  
444   - acpi_os_printf("(R%d)", obj_desc->common.reference_count);
  444 + acpi_os_printf("(R%u)", obj_desc->common.reference_count);
445 445  
446 446 switch (type) {
447 447 case ACPI_TYPE_METHOD:
drivers/acpi/acpica/nsinit.c
... ... @@ -103,8 +103,8 @@
103 103 }
104 104  
105 105 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
106   - "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd "
107   - "Buffers %hd/%hd Packages (%hd nodes)\n",
  106 + "\nInitialized %u/%u Regions %u/%u Fields %u/%u "
  107 + "Buffers %u/%u Packages (%u nodes)\n",
108 108 info.op_region_init, info.op_region_count,
109 109 info.field_init, info.field_count,
110 110 info.buffer_init, info.buffer_count,
111 111  
... ... @@ -112,9 +112,9 @@
112 112 info.object_count));
113 113  
114 114 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
115   - "%hd Control Methods found\n", info.method_count));
  115 + "%u Control Methods found\n", info.method_count));
116 116 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
117   - "%hd Op Regions found\n", info.op_region_count));
  117 + "%u Op Regions found\n", info.op_region_count));
118 118  
119 119 return_ACPI_STATUS(AE_OK);
120 120 }
... ... @@ -208,8 +208,8 @@
208 208 }
209 209  
210 210 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
211   - "\nExecuted %hd _INI methods requiring %hd _STA executions "
212   - "(examined %hd objects)\n",
  211 + "\nExecuted %u _INI methods requiring %u _STA executions "
  212 + "(examined %u objects)\n",
213 213 info.num_INI, info.num_STA, info.device_count));
214 214  
215 215 return_ACPI_STATUS(status);
... ... @@ -410,7 +410,7 @@
410 410 * The only _INI methods that we care about are those that are
411 411 * present under Device, Processor, and Thermal objects.
412 412 */
413   - parent_node = acpi_ns_get_parent_node(node);
  413 + parent_node = node->parent;
414 414 switch (parent_node->type) {
415 415 case ACPI_TYPE_DEVICE:
416 416 case ACPI_TYPE_PROCESSOR:
... ... @@ -420,7 +420,7 @@
420 420  
421 421 while (parent_node) {
422 422 parent_node->flags |= ANOBJ_SUBTREE_HAS_INI;
423   - parent_node = acpi_ns_get_parent_node(parent_node);
  423 + parent_node = parent_node->parent;
424 424 }
425 425 break;
426 426  
drivers/acpi/acpica/nsnames.c
... ... @@ -93,7 +93,7 @@
93 93 /* Put the name into the buffer */
94 94  
95 95 ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name);
96   - parent_node = acpi_ns_get_parent_node(parent_node);
  96 + parent_node = parent_node->parent;
97 97  
98 98 /* Prefix name with the path separator */
99 99  
... ... @@ -198,7 +198,7 @@
198 198 return 0;
199 199 }
200 200 size += ACPI_PATH_SEGMENT_LENGTH;
201   - next_node = acpi_ns_get_parent_node(next_node);
  201 + next_node = next_node->parent;
202 202 }
203 203  
204 204 if (!size) {
drivers/acpi/acpica/nsparse.c
... ... @@ -136,8 +136,8 @@
136 136  
137 137 /* Parse the AML */
138 138  
139   - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n",
140   - (unsigned)pass_number));
  139 + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %u parse\n",
  140 + pass_number));
141 141 status = acpi_ps_parse_aml(walk_state);
142 142  
143 143 cleanup:
drivers/acpi/acpica/nsrepair.c
... ... @@ -556,7 +556,7 @@
556 556  
557 557 /* Need an Integer - create a zero-value integer */
558 558  
559   - new_object = acpi_ut_create_integer_object(0);
  559 + new_object = acpi_ut_create_integer_object((u64)0);
560 560 } else if (expected_btypes & ACPI_RTYPE_STRING) {
561 561  
562 562 /* Need a String - create a NULL string */
drivers/acpi/acpica/nsrepair2.c
... ... @@ -112,6 +112,13 @@
112 112 * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
113 113 * _PSS: Sort the list descending by Power
114 114 * _TSS: Sort the list descending by Power
  115 + *
  116 + * Names that must be packages, but cannot be sorted:
  117 + *
  118 + * _BCL: Values are tied to the Package index where they appear, and cannot
  119 + * be moved or sorted. These index values are used for _BQC and _BCM.
  120 + * However, we can fix the case where a buffer is returned, by converting
  121 + * it to a Package of integers.
115 122 */
116 123 static const struct acpi_repair_info acpi_ns_repairable_names[] = {
117 124 {"_ALR", acpi_ns_repair_ALR},
drivers/acpi/acpica/nssearch.c
... ... @@ -152,17 +152,6 @@
152 152 return_ACPI_STATUS(AE_OK);
153 153 }
154 154  
155   - /*
156   - * The last entry in the list points back to the parent,
157   - * so a flag is used to indicate the end-of-list
158   - */
159   - if (node->flags & ANOBJ_END_OF_PEER_LIST) {
160   -
161   - /* Searched entire list, we are done */
162   -
163   - break;
164   - }
165   -
166 155 /* Didn't match name, move on to the next peer object */
167 156  
168 157 node = node->peer;
... ... @@ -217,7 +206,7 @@
217 206  
218 207 ACPI_FUNCTION_TRACE(ns_search_parent_tree);
219 208  
220   - parent_node = acpi_ns_get_parent_node(node);
  209 + parent_node = node->parent;
221 210  
222 211 /*
223 212 * If there is no parent (i.e., we are at the root) or type is "local",
... ... @@ -261,7 +250,7 @@
261 250  
262 251 /* Not found here, go up another level (until we reach the root) */
263 252  
264   - parent_node = acpi_ns_get_parent_node(parent_node);
  253 + parent_node = parent_node->parent;
265 254 }
266 255  
267 256 /* Not found in parent tree */
drivers/acpi/acpica/nsutils.c
... ... @@ -847,117 +847,4 @@
847 847 ACPI_FREE(internal_path);
848 848 return_ACPI_STATUS(status);
849 849 }
850   -
851   -/*******************************************************************************
852   - *
853   - * FUNCTION: acpi_ns_get_parent_node
854   - *
855   - * PARAMETERS: Node - Current table entry
856   - *
857   - * RETURN: Parent entry of the given entry
858   - *
859   - * DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
860   - *
861   - ******************************************************************************/
862   -
863   -struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
864   - *node)
865   -{
866   - ACPI_FUNCTION_ENTRY();
867   -
868   - if (!node) {
869   - return (NULL);
870   - }
871   -
872   - /*
873   - * Walk to the end of this peer list. The last entry is marked with a flag
874   - * and the peer pointer is really a pointer back to the parent. This saves
875   - * putting a parent back pointer in each and every named object!
876   - */
877   - while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
878   - node = node->peer;
879   - }
880   -
881   - return (node->peer);
882   -}
883   -
884   -/*******************************************************************************
885   - *
886   - * FUNCTION: acpi_ns_get_next_valid_node
887   - *
888   - * PARAMETERS: Node - Current table entry
889   - *
890   - * RETURN: Next valid Node in the linked node list. NULL if no more valid
891   - * nodes.
892   - *
893   - * DESCRIPTION: Find the next valid node within a name table.
894   - * Useful for implementing NULL-end-of-list loops.
895   - *
896   - ******************************************************************************/
897   -
898   -struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
899   - acpi_namespace_node
900   - *node)
901   -{
902   -
903   - /* If we are at the end of this peer list, return NULL */
904   -
905   - if (node->flags & ANOBJ_END_OF_PEER_LIST) {
906   - return NULL;
907   - }
908   -
909   - /* Otherwise just return the next peer */
910   -
911   - return (node->peer);
912   -}
913   -
914   -#ifdef ACPI_OBSOLETE_FUNCTIONS
915   -/*******************************************************************************
916   - *
917   - * FUNCTION: acpi_ns_find_parent_name
918   - *
919   - * PARAMETERS: *child_node - Named Obj whose name is to be found
920   - *
921   - * RETURN: The ACPI name
922   - *
923   - * DESCRIPTION: Search for the given obj in its parent scope and return the
924   - * name segment, or "????" if the parent name can't be found
925   - * (which "should not happen").
926   - *
927   - ******************************************************************************/
928   -
929   -acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
930   -{
931   - struct acpi_namespace_node *parent_node;
932   -
933   - ACPI_FUNCTION_TRACE(ns_find_parent_name);
934   -
935   - if (child_node) {
936   -
937   - /* Valid entry. Get the parent Node */
938   -
939   - parent_node = acpi_ns_get_parent_node(child_node);
940   - if (parent_node) {
941   - ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
942   - "Parent of %p [%4.4s] is %p [%4.4s]\n",
943   - child_node,
944   - acpi_ut_get_node_name(child_node),
945   - parent_node,
946   - acpi_ut_get_node_name(parent_node)));
947   -
948   - if (parent_node->name.integer) {
949   - return_VALUE((acpi_name) parent_node->name.
950   - integer);
951   - }
952   - }
953   -
954   - ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
955   - "Unable to find parent of %p (%4.4s)\n",
956   - child_node,
957   - acpi_ut_get_node_name(child_node)));
958   - }
959   -
960   - return_VALUE(ACPI_UNKNOWN_NAME);
961   -}
962   -#endif
drivers/acpi/acpica/nswalk.c
... ... @@ -79,15 +79,6 @@
79 79 return parent_node->child;
80 80 }
81 81  
82   - /*
83   - * Get the next node.
84   - *
85   - * If we are at the end of this peer list, return NULL
86   - */
87   - if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
88   - return NULL;
89   - }
90   -
91 82 /* Otherwise just return the next peer */
92 83  
93 84 return child_node->peer;
94 85  
... ... @@ -146,9 +137,9 @@
146 137 return (next_node);
147 138 }
148 139  
149   - /* Otherwise, move on to the next node */
  140 + /* Otherwise, move on to the next peer node */
150 141  
151   - next_node = acpi_ns_get_next_valid_node(next_node);
  142 + next_node = next_node->peer;
152 143 }
153 144  
154 145 /* Not found */
... ... @@ -355,7 +346,7 @@
355 346 */
356 347 level--;
357 348 child_node = parent_node;
358   - parent_node = acpi_ns_get_parent_node(parent_node);
  349 + parent_node = parent_node->parent;
359 350  
360 351 node_previously_visited = TRUE;
361 352 }
drivers/acpi/acpica/nsxfobj.c
... ... @@ -190,7 +190,7 @@
190 190  
191 191 /* Get the parent entry */
192 192  
193   - parent_node = acpi_ns_get_parent_node(node);
  193 + parent_node = node->parent;
194 194 *ret_handle = ACPI_CAST_PTR(acpi_handle, parent_node);
195 195  
196 196 /* Return exception if parent is null */
drivers/acpi/acpica/utglobal.c
... ... @@ -813,10 +813,10 @@
813 813 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
814 814 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
815 815 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
  816 + acpi_gbl_root_node_struct.parent = NULL;
816 817 acpi_gbl_root_node_struct.child = NULL;
817 818 acpi_gbl_root_node_struct.peer = NULL;
818 819 acpi_gbl_root_node_struct.object = NULL;
819   - acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
820 820  
821 821 #ifdef ACPI_DEBUG_OUTPUT
822 822 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
drivers/acpi/acpica/utxface.c
... ... @@ -293,12 +293,8 @@
293 293 * Complete the GPE initialization for the GPE blocks defined in the FADT
294 294 * (GPE block 0 and 1).
295 295 *
296   - * Note1: This is where the _PRW methods are executed for the GPEs. These
297   - * methods can only be executed after the SCI and Global Lock handlers are
298   - * installed and initialized.
299   - *
300   - * Note2: Currently, there seems to be no need to run the _REG methods
301   - * before execution of the _PRW methods and enabling of the GPEs.
  296 + * NOTE: Currently, there seems to be no need to run the _REG methods
  297 + * before enabling the GPEs.
302 298 */
303 299 if (!(flags & ACPI_NO_EVENT_INIT)) {
304 300 status = acpi_ev_install_fadt_gpes();
drivers/acpi/button.c
... ... @@ -424,8 +424,7 @@
424 424 if (device->wakeup.flags.valid) {
425 425 /* Button's GPE is run-wake GPE */
426 426 acpi_enable_gpe(device->wakeup.gpe_device,
427   - device->wakeup.gpe_number,
428   - ACPI_GPE_TYPE_RUNTIME);
  427 + device->wakeup.gpe_number);
429 428 device->wakeup.run_wake_count++;
430 429 device->wakeup.state.enabled = 1;
431 430 }
... ... @@ -448,8 +447,7 @@
448 447  
449 448 if (device->wakeup.flags.valid) {
450 449 acpi_disable_gpe(device->wakeup.gpe_device,
451   - device->wakeup.gpe_number,
452   - ACPI_GPE_TYPE_RUNTIME);
  450 + device->wakeup.gpe_number);
453 451 device->wakeup.run_wake_count--;
454 452 device->wakeup.state.enabled = 0;
455 453 }
... ... @@ -303,11 +303,8 @@
303 303 pr_debug(PREFIX "transaction start\n");
304 304 /* disable GPE during transaction if storm is detected */
305 305 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
306   - /*
307   - * It has to be disabled at the hardware level regardless of the
308   - * GPE reference counting, so that it doesn't trigger.
309   - */
310   - acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
  306 + /* It has to be disabled, so that it doesn't trigger. */
  307 + acpi_disable_gpe(NULL, ec->gpe);
311 308 }
312 309  
313 310 status = acpi_ec_transaction_unlocked(ec, t);
... ... @@ -316,12 +313,8 @@
316 313 ec_check_sci_sync(ec, acpi_ec_read_status(ec));
317 314 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
318 315 msleep(1);
319   - /*
320   - * It is safe to enable the GPE outside of the transaction. Use
321   - * acpi_set_gpe() for that, since we used it to disable the GPE
322   - * above.
323   - */
324   - acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
  316 + /* It is safe to enable the GPE outside of the transaction. */
  317 + acpi_enable_gpe(NULL, ec->gpe);
325 318 } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
326 319 pr_info(PREFIX "GPE storm detected, "
327 320 "transactions will use polling mode\n");
... ... @@ -746,7 +739,7 @@
746 739 if (ACPI_FAILURE(status))
747 740 return -ENODEV;
748 741  
749   - acpi_enable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
  742 + acpi_enable_gpe(NULL, ec->gpe);
750 743 status = acpi_install_address_space_handler(ec->handle,
751 744 ACPI_ADR_SPACE_EC,
752 745 &acpi_ec_space_handler,
... ... @@ -763,7 +756,7 @@
763 756 } else {
764 757 acpi_remove_gpe_handler(NULL, ec->gpe,
765 758 &acpi_ec_gpe_handler);
766   - acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
  759 + acpi_disable_gpe(NULL, ec->gpe);
767 760 return -ENODEV;
768 761 }
769 762 }
... ... @@ -774,7 +767,7 @@
774 767  
775 768 static void ec_remove_handlers(struct acpi_ec *ec)
776 769 {
777   - acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
  770 + acpi_disable_gpe(NULL, ec->gpe);
778 771 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
779 772 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
780 773 pr_err(PREFIX "failed to remove space handler\n");
... ... @@ -1018,22 +1011,6 @@
1018 1011 return -ENODEV;
1019 1012 }
1020 1013  
1021   -static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state)
1022   -{
1023   - struct acpi_ec *ec = acpi_driver_data(device);
1024   - /* Stop using the GPE, but keep it reference counted. */
1025   - acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
1026   - return 0;
1027   -}
1028   -
1029   -static int acpi_ec_resume(struct acpi_device *device)
1030   -{
1031   - struct acpi_ec *ec = acpi_driver_data(device);
1032   - /* Enable the GPE again, but don't reference count it once more. */
1033   - acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
1034   - return 0;
1035   -}
1036   -
1037 1014 static struct acpi_driver acpi_ec_driver = {
1038 1015 .name = "ec",
1039 1016 .class = ACPI_EC_CLASS,
... ... @@ -1041,8 +1018,6 @@
1041 1018 .ops = {
1042 1019 .add = acpi_ec_add,
1043 1020 .remove = acpi_ec_remove,
1044   - .suspend = acpi_ec_suspend,
1045   - .resume = acpi_ec_resume,
1046 1021 },
1047 1022 };
1048 1023  
... ... @@ -1046,26 +1046,6 @@
1046 1046  
1047 1047 __setup("acpi_serialize", acpi_serialize_setup);
1048 1048  
1049   -/*
1050   - * Wake and Run-Time GPES are expected to be separate.
1051   - * We disable wake-GPEs at run-time to prevent spurious
1052   - * interrupts.
1053   - *
1054   - * However, if a system exists that shares Wake and
1055   - * Run-time events on the same GPE this flag is available
1056   - * to tell Linux to keep the wake-time GPEs enabled at run-time.
1057   - */
1058   -static int __init acpi_wake_gpes_always_on_setup(char *str)
1059   -{
1060   - printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
1061   -
1062   - acpi_gbl_leave_wake_gpes_disabled = FALSE;
1063   -
1064   - return 1;
1065   -}
1066   -
1067   -__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
1068   -
1069 1049 /* Check of resource interference between native drivers and ACPI
1070 1050 * OperationRegions (SystemIO and System Memory only).
1071 1051 * IO ports and memory declared in ACPI might be used by the ACPI subsystem
... ... @@ -740,6 +740,8 @@
740 740 device->wakeup.resources.handles[i] = element->reference.handle;
741 741 }
742 742  
  743 + acpi_gpe_can_wake(device->wakeup.gpe_device, device->wakeup.gpe_number);
  744 +
743 745 return AE_OK;
744 746 }
745 747  
... ... @@ -764,8 +766,9 @@
764 766 return;
765 767 }
766 768  
767   - status = acpi_get_gpe_status(NULL, device->wakeup.gpe_number,
768   - &event_status);
  769 + status = acpi_get_gpe_status(device->wakeup.gpe_device,
  770 + device->wakeup.gpe_number,
  771 + &event_status);
769 772 if (status == AE_OK)
770 773 device->wakeup.flags.run_wake =
771 774 !!(event_status & ACPI_EVENT_FLAG_HANDLE);
drivers/acpi/sleep.c
... ... @@ -663,18 +663,9 @@
663 663 return -ENODEV;
664 664 }
665 665  
666   - if (enable) {
667   - error = acpi_enable_wakeup_device_power(adev,
668   - acpi_target_sleep_state);
669   - if (!error)
670   - acpi_enable_gpe(adev->wakeup.gpe_device,
671   - adev->wakeup.gpe_number,
672   - ACPI_GPE_TYPE_WAKE);
673   - } else {
674   - acpi_disable_gpe(adev->wakeup.gpe_device, adev->wakeup.gpe_number,
675   - ACPI_GPE_TYPE_WAKE);
676   - error = acpi_disable_wakeup_device_power(adev);
677   - }
  666 + error = enable ?
  667 + acpi_enable_wakeup_device_power(adev, acpi_target_sleep_state) :
  668 + acpi_disable_wakeup_device_power(adev);
678 669 if (!error)
679 670 dev_info(dev, "wake-up capability %s by ACPI\n",
680 671 enable ? "enabled" : "disabled");
drivers/acpi/system.c
... ... @@ -388,12 +388,10 @@
388 388 if (index < num_gpes) {
389 389 if (!strcmp(buf, "disable\n") &&
390 390 (status & ACPI_EVENT_FLAG_ENABLED))
391   - result = acpi_disable_gpe(handle, index,
392   - ACPI_GPE_TYPE_RUNTIME);
  391 + result = acpi_disable_gpe(handle, index);
393 392 else if (!strcmp(buf, "enable\n") &&
394 393 !(status & ACPI_EVENT_FLAG_ENABLED))
395   - result = acpi_enable_gpe(handle, index,
396   - ACPI_GPE_TYPE_RUNTIME);
  394 + result = acpi_enable_gpe(handle, index);
397 395 else if (!strcmp(buf, "clear\n") &&
398 396 (status & ACPI_EVENT_FLAG_SET))
399 397 result = acpi_clear_gpe(handle, index);
drivers/acpi/wakeup.c
... ... @@ -64,13 +64,14 @@
64 64 struct acpi_device *dev =
65 65 container_of(node, struct acpi_device, wakeup_list);
66 66  
67   - if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled
  67 + if (!dev->wakeup.flags.valid
  68 + || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count)
68 69 || sleep_state > (u32) dev->wakeup.sleep_state)
69 70 continue;
70 71  
71 72 /* The wake-up power should have been enabled already. */
72   - acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
73   - ACPI_GPE_TYPE_WAKE);
  73 + acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
  74 + ACPI_GPE_ENABLE);
74 75 }
75 76 }
76 77  
77 78  
... ... @@ -89,13 +90,16 @@
89 90 struct acpi_device *dev =
90 91 container_of(node, struct acpi_device, wakeup_list);
91 92  
92   - if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled
  93 + if (!dev->wakeup.flags.valid
  94 + || !(dev->wakeup.state.enabled || dev->wakeup.prepare_count)
93 95 || (sleep_state > (u32) dev->wakeup.sleep_state))
94 96 continue;
95 97  
96   - acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
97   - ACPI_GPE_TYPE_WAKE);
98   - acpi_disable_wakeup_device_power(dev);
  98 + acpi_gpe_wakeup(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
  99 + ACPI_GPE_DISABLE);
  100 +
  101 + if (dev->wakeup.state.enabled)
  102 + acpi_disable_wakeup_device_power(dev);
99 103 }
100 104 }
101 105  
drivers/pci/pci-acpi.c
... ... @@ -296,14 +296,12 @@
296 296 if (!dev->wakeup.run_wake_count++) {
297 297 acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0);
298 298 acpi_enable_gpe(dev->wakeup.gpe_device,
299   - dev->wakeup.gpe_number,
300   - ACPI_GPE_TYPE_RUNTIME);
  299 + dev->wakeup.gpe_number);
301 300 }
302 301 } else if (dev->wakeup.run_wake_count > 0) {
303 302 if (!--dev->wakeup.run_wake_count) {
304 303 acpi_disable_gpe(dev->wakeup.gpe_device,
305   - dev->wakeup.gpe_number,
306   - ACPI_GPE_TYPE_RUNTIME);
  304 + dev->wakeup.gpe_number);
307 305 acpi_disable_wakeup_device_power(dev);
308 306 }
309 307 } else {
include/acpi/acoutput.h
... ... @@ -71,8 +71,9 @@
71 71 #define ACPI_TOOLS 0x00002000
72 72 #define ACPI_EXAMPLE 0x00004000
73 73 #define ACPI_DRIVER 0x00008000
  74 +#define DT_COMPILER 0x00010000
74 75  
75   -#define ACPI_ALL_COMPONENTS 0x0000FFFF
  76 +#define ACPI_ALL_COMPONENTS 0x0001FFFF
76 77 #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
77 78  
78 79 /* Component IDs reserved for ACPI drivers */
include/acpi/acpixf.h
... ... @@ -47,7 +47,7 @@
47 47  
48 48 /* Current ACPICA subsystem version in YYYYMMDD format */
49 49  
50   -#define ACPI_CA_VERSION 0x20100428
  50 +#define ACPI_CA_VERSION 0x20100702
51 51  
52 52 #include "actypes.h"
53 53 #include "actbl.h"
... ... @@ -63,7 +63,6 @@
63 63 extern u8 acpi_gbl_enable_interpreter_slack;
64 64 extern u8 acpi_gbl_all_methods_serialized;
65 65 extern u8 acpi_gbl_create_osi_method;
66   -extern u8 acpi_gbl_leave_wake_gpes_disabled;
67 66 extern u8 acpi_gbl_use_default_register_widths;
68 67 extern acpi_name acpi_gbl_trace_method_name;
69 68 extern u32 acpi_gbl_trace_flags;
70 69  
71 70  
72 71  
... ... @@ -282,15 +281,15 @@
282 281 /*
283 282 * GPE Interfaces
284 283 */
285   -acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action);
  284 +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number);
286 285  
287   -acpi_status
288   -acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type);
  286 +acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number);
289 287  
290   -acpi_status
291   -acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type);
  288 +acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number);
292 289  
293 290 acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number);
  291 +
  292 +acpi_status acpi_gpe_wakeup(acpi_handle gpe_device, u32 gpe_number, u8 action);
294 293  
295 294 acpi_status
296 295 acpi_get_gpe_status(acpi_handle gpe_device,
include/acpi/actbl2.h
... ... @@ -77,9 +77,19 @@
77 77 #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
78 78 #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */
79 79 #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
  80 +#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */
80 81 #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
81 82  
  83 +#ifdef ACPI_UNDEFINED_TABLES
82 84 /*
  85 + * These tables have been seen in the field, but no definition has been found
  86 + */
  87 +#define ACPI_SIG_ATKG "ATKG"
  88 +#define ACPI_SIG_GSCI "GSCI" /* GMCH SCI table */
  89 +#define ACPI_SIG_IEIT "IEIT"
  90 +#endif
  91 +
  92 +/*
83 93 * All tables must be byte-packed to match the ACPI specification, since
84 94 * the tables are provided by the system BIOS.
85 95 */
... ... @@ -906,6 +916,44 @@
906 916 ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */
907 917 ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */
908 918 };
  919 +
  920 +/*******************************************************************************
  921 + *
  922 + * WDDT - Watchdog Descriptor Table
  923 + * Version 1
  924 + *
  925 + * Conforms to "Using the Intel ICH Family Watchdog Timer (WDT)",
  926 + * Version 001, September 2002
  927 + *
  928 + ******************************************************************************/
  929 +
  930 +struct acpi_table_wddt {
  931 + struct acpi_table_header header; /* Common ACPI table header */
  932 + u16 spec_version;
  933 + u16 table_version;
  934 + u16 pci_vendor_id;
  935 + struct acpi_generic_address address;
  936 + u16 max_count; /* Maximum counter value supported */
  937 + u16 min_count; /* Minimum counter value supported */
  938 + u16 period;
  939 + u16 status;
  940 + u16 capability;
  941 +};
  942 +
  943 +/* Flags for Status field above */
  944 +
  945 +#define ACPI_WDDT_AVAILABLE (1)
  946 +#define ACPI_WDDT_ACTIVE (1<<1)
  947 +#define ACPI_WDDT_TCO_OS_OWNED (1<<2)
  948 +#define ACPI_WDDT_USER_RESET (1<<11)
  949 +#define ACPI_WDDT_WDT_RESET (1<<12)
  950 +#define ACPI_WDDT_POWER_FAIL (1<<13)
  951 +#define ACPI_WDDT_UNKNOWN_RESET (1<<14)
  952 +
  953 +/* Flags for Capability field above */
  954 +
  955 +#define ACPI_WDDT_AUTO_RESET (1)
  956 +#define ACPI_WDDT_ALERT_SUPPORT (1<<1)
909 957  
910 958 /*******************************************************************************
911 959 *
include/acpi/actypes.h
... ... @@ -663,17 +663,11 @@
663 663 #define ACPI_GPE_MAX 0xFF
664 664 #define ACPI_NUM_GPE 256
665 665  
666   -/* Actions for acpi_set_gpe and acpi_hw_low_set_gpe */
  666 +/* Actions for acpi_gpe_wakeup, acpi_hw_low_set_gpe */
667 667  
668 668 #define ACPI_GPE_ENABLE 0
669 669 #define ACPI_GPE_DISABLE 1
670 670 #define ACPI_GPE_COND_ENABLE 2
671   -
672   -/* gpe_types for acpi_enable_gpe and acpi_disable_gpe */
673   -
674   -#define ACPI_GPE_TYPE_WAKE (u8) 0x01
675   -#define ACPI_GPE_TYPE_RUNTIME (u8) 0x02
676   -#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x03
677 671  
678 672 /*
679 673 * GPE info flags - Per GPE