Skip to content

Commit f7eae09

Browse files
committed
Merge branch 'acpica'
Merge additional ACPICA changes for 6.2-rc1: - Avoid trying to resolve operands in AML when there are none (Amadeusz Sławiński). - Fix indentation in include/acpi/acpixf.h to help applying patches from the upstream ACPICA git (Hans de Goede). - Make it possible to install an address space handler without evaluating _REG for Operation Regions in the given address space (Hans de Goede). * acpica: ACPICA: Allow address_space_handler Install and _REG execution as 2 separate steps ACPICA: include/acpi/acpixf.h: Fix indentation ACPICA: Fix operand resolution
2 parents bee74dc + 54c516a commit f7eae09

File tree

3 files changed

+159
-69
lines changed

3 files changed

+159
-69
lines changed

drivers/acpi/acpica/dswexec.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,11 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
389389

390390
/*
391391
* All opcodes require operand resolution, with the only exceptions
392-
* being the object_type and size_of operators.
392+
* being the object_type and size_of operators as well as opcodes that
393+
* take no arguments.
393394
*/
394-
if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
395+
if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE) &&
396+
(walk_state->op_info->flags & AML_HAS_ARGS)) {
395397

396398
/* Resolve all operands */
397399

drivers/acpi/acpica/evxfregn.c

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ ACPI_MODULE_NAME("evxfregn")
2020

2121
/*******************************************************************************
2222
*
23-
* FUNCTION: acpi_install_address_space_handler
23+
* FUNCTION: acpi_install_address_space_handler_internal
2424
*
2525
* PARAMETERS: device - Handle for the device
2626
* space_id - The address space ID
2727
* handler - Address of the handler
2828
* setup - Address of the setup function
2929
* context - Value passed to the handler on each access
30+
* Run_reg - Run _REG methods for this address space?
3031
*
3132
* RETURN: Status
3233
*
@@ -37,13 +38,16 @@ ACPI_MODULE_NAME("evxfregn")
3738
* are executed here, and these methods can only be safely executed after
3839
* the default handlers have been installed and the hardware has been
3940
* initialized (via acpi_enable_subsystem.)
41+
* To avoid this problem pass FALSE for Run_Reg and later on call
42+
* acpi_execute_reg_methods() to execute _REG.
4043
*
4144
******************************************************************************/
42-
acpi_status
43-
acpi_install_address_space_handler(acpi_handle device,
44-
acpi_adr_space_type space_id,
45-
acpi_adr_space_handler handler,
46-
acpi_adr_space_setup setup, void *context)
45+
static acpi_status
46+
acpi_install_address_space_handler_internal(acpi_handle device,
47+
acpi_adr_space_type space_id,
48+
acpi_adr_space_handler handler,
49+
acpi_adr_space_setup setup,
50+
void *context, u8 run_reg)
4751
{
4852
struct acpi_namespace_node *node;
4953
acpi_status status;
@@ -80,14 +84,40 @@ acpi_install_address_space_handler(acpi_handle device,
8084

8185
/* Run all _REG methods for this address space */
8286

83-
acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT);
87+
if (run_reg) {
88+
acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT);
89+
}
8490

8591
unlock_and_exit:
8692
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
8793
return_ACPI_STATUS(status);
8894
}
8995

96+
acpi_status
97+
acpi_install_address_space_handler(acpi_handle device,
98+
acpi_adr_space_type space_id,
99+
acpi_adr_space_handler handler,
100+
acpi_adr_space_setup setup, void *context)
101+
{
102+
return acpi_install_address_space_handler_internal(device, space_id,
103+
handler, setup,
104+
context, TRUE);
105+
}
106+
90107
ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler)
108+
acpi_status
109+
acpi_install_address_space_handler_no_reg(acpi_handle device,
110+
acpi_adr_space_type space_id,
111+
acpi_adr_space_handler handler,
112+
acpi_adr_space_setup setup,
113+
void *context)
114+
{
115+
return acpi_install_address_space_handler_internal(device, space_id,
116+
handler, setup,
117+
context, FALSE);
118+
}
119+
120+
ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler_no_reg)
91121

92122
/*******************************************************************************
93123
*
@@ -228,3 +258,51 @@ acpi_remove_address_space_handler(acpi_handle device,
228258
}
229259

230260
ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler)
261+
/*******************************************************************************
262+
*
263+
* FUNCTION: acpi_execute_reg_methods
264+
*
265+
* PARAMETERS: device - Handle for the device
266+
* space_id - The address space ID
267+
*
268+
* RETURN: Status
269+
*
270+
* DESCRIPTION: Execute _REG for all op_regions of a given space_id.
271+
*
272+
******************************************************************************/
273+
acpi_status
274+
acpi_execute_reg_methods(acpi_handle device, acpi_adr_space_type space_id)
275+
{
276+
struct acpi_namespace_node *node;
277+
acpi_status status;
278+
279+
ACPI_FUNCTION_TRACE(acpi_execute_reg_methods);
280+
281+
/* Parameter validation */
282+
283+
if (!device) {
284+
return_ACPI_STATUS(AE_BAD_PARAMETER);
285+
}
286+
287+
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
288+
if (ACPI_FAILURE(status)) {
289+
return_ACPI_STATUS(status);
290+
}
291+
292+
/* Convert and validate the device handle */
293+
294+
node = acpi_ns_validate_handle(device);
295+
if (node) {
296+
297+
/* Run all _REG methods for this address space */
298+
299+
acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT);
300+
} else {
301+
status = AE_BAD_PARAMETER;
302+
}
303+
304+
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
305+
return_ACPI_STATUS(status);
306+
}
307+
308+
ACPI_EXPORT_SYMBOL(acpi_execute_reg_methods)

include/acpi/acpixf.h

Lines changed: 70 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -589,82 +589,92 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
589589
acpi_install_initialization_handler
590590
(acpi_init_handler handler, u32 function))
591591
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
592-
acpi_install_sci_handler(acpi_sci_handler
593-
address,
594-
void *context))
595-
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
596-
acpi_remove_sci_handler(acpi_sci_handler
597-
address))
592+
acpi_install_sci_handler(acpi_sci_handler
593+
address,
594+
void *context))
598595
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
599-
acpi_install_global_event_handler
600-
(acpi_gbl_event_handler handler,
601-
void *context))
596+
acpi_remove_sci_handler(acpi_sci_handler
597+
address))
602598
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
603-
acpi_install_fixed_event_handler(u32
604-
acpi_event,
605-
acpi_event_handler
606-
handler,
607-
void
608-
*context))
599+
acpi_install_global_event_handler
600+
(acpi_gbl_event_handler handler,
601+
void *context))
609602
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
610-
acpi_remove_fixed_event_handler(u32 acpi_event,
603+
acpi_install_fixed_event_handler(u32
604+
acpi_event,
611605
acpi_event_handler
612-
handler))
613-
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
614-
acpi_install_gpe_handler(acpi_handle
615-
gpe_device,
616-
u32 gpe_number,
617-
u32 type,
618-
acpi_gpe_handler
619-
address,
620-
void *context))
606+
handler,
607+
void
608+
*context))
621609
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
622-
acpi_install_gpe_raw_handler(acpi_handle
623-
gpe_device,
624-
u32 gpe_number,
625-
u32 type,
626-
acpi_gpe_handler
627-
address,
628-
void *context))
610+
acpi_remove_fixed_event_handler(u32 acpi_event,
611+
acpi_event_handler
612+
handler))
629613
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
630-
acpi_remove_gpe_handler(acpi_handle gpe_device,
614+
acpi_install_gpe_handler(acpi_handle
615+
gpe_device,
631616
u32 gpe_number,
617+
u32 type,
632618
acpi_gpe_handler
633-
address))
634-
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
635-
acpi_install_notify_handler(acpi_handle device,
636-
u32 handler_type,
637-
acpi_notify_handler
638-
handler,
619+
address,
639620
void *context))
621+
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
622+
acpi_install_gpe_raw_handler(acpi_handle
623+
gpe_device,
624+
u32 gpe_number,
625+
u32 type,
626+
acpi_gpe_handler
627+
address,
628+
void *context))
629+
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
630+
acpi_remove_gpe_handler(acpi_handle gpe_device,
631+
u32 gpe_number,
632+
acpi_gpe_handler
633+
address))
640634
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
641-
acpi_remove_notify_handler(acpi_handle device,
635+
acpi_install_notify_handler(acpi_handle device,
642636
u32 handler_type,
643637
acpi_notify_handler
644-
handler))
645-
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
646-
acpi_install_address_space_handler(acpi_handle
647-
device,
648-
acpi_adr_space_type
649-
space_id,
650-
acpi_adr_space_handler
651-
handler,
652-
acpi_adr_space_setup
653-
setup,
654-
void *context))
655-
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
656-
acpi_remove_address_space_handler(acpi_handle
638+
handler,
639+
void *context))
640+
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
641+
acpi_remove_notify_handler(acpi_handle device,
642+
u32 handler_type,
643+
acpi_notify_handler
644+
handler))
645+
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
646+
acpi_install_address_space_handler(acpi_handle
657647
device,
658648
acpi_adr_space_type
659649
space_id,
660650
acpi_adr_space_handler
661-
handler))
662-
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
663-
acpi_install_exception_handler
664-
(acpi_exception_handler handler))
665-
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
666-
acpi_install_interface_handler
667-
(acpi_interface_handler handler))
651+
handler,
652+
acpi_adr_space_setup
653+
setup,
654+
void *context))
655+
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
656+
acpi_install_address_space_handler_no_reg
657+
(acpi_handle device, acpi_adr_space_type space_id,
658+
acpi_adr_space_handler handler,
659+
acpi_adr_space_setup setup,
660+
void *context))
661+
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
662+
acpi_execute_reg_methods(acpi_handle device,
663+
acpi_adr_space_type
664+
space_id))
665+
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
666+
acpi_remove_address_space_handler(acpi_handle
667+
device,
668+
acpi_adr_space_type
669+
space_id,
670+
acpi_adr_space_handler
671+
handler))
672+
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
673+
acpi_install_exception_handler
674+
(acpi_exception_handler handler))
675+
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
676+
acpi_install_interface_handler
677+
(acpi_interface_handler handler))
668678

669679
/*
670680
* Global Lock interfaces

0 commit comments

Comments
 (0)