Skip to content

Commit 4aa8784

Browse files
committed
ACPI: PRM: Add PRM handler direct call support
JIRA: https://issues.redhat.com/browse/RHEL-22695 Tested: sanity commit f0fcdd2 Author: John Allen <[email protected]> Date: Tue Jul 30 15:17:30 2024 +0000 ACPI: PRM: Add PRM handler direct call support Platform Runtime Mechanism (PRM) handlers can be invoked from either the AML interpreter or directly by an OS driver. Implement the latter. [ bp: Massage commit message. ] Signed-off-by: John Allen <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Yazen Ghannam <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Aristeu Rozanski <[email protected]>
1 parent 2e45454 commit 4aa8784

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

drivers/acpi/prmt.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,30 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)
214214
#define UPDATE_LOCK_ALREADY_HELD 4
215215
#define UPDATE_UNLOCK_WITHOUT_LOCK 5
216216

217+
int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
218+
{
219+
struct prm_handler_info *handler = find_prm_handler(&handler_guid);
220+
struct prm_module_info *module = find_prm_module(&handler_guid);
221+
struct prm_context_buffer context;
222+
efi_status_t status;
223+
224+
if (!module || !handler)
225+
return -ENODEV;
226+
227+
memset(&context, 0, sizeof(context));
228+
ACPI_COPY_NAMESEG(context.signature, "PRMC");
229+
context.identifier = handler->guid;
230+
context.static_data_buffer = handler->static_data_buffer_addr;
231+
context.mmio_ranges = module->mmio_info;
232+
233+
status = efi_call_acpi_prm_handler(handler->handler_addr,
234+
(u64)param_buffer,
235+
&context);
236+
237+
return efi_status_to_err(status);
238+
}
239+
EXPORT_SYMBOL_GPL(acpi_call_prm_handler);
240+
217241
/*
218242
* This is the PlatformRtMechanism opregion space handler.
219243
* @function: indicates the read/write. In fact as the PlatformRtMechanism

include/linux/prmt.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
#ifdef CONFIG_ACPI_PRMT
44
void init_prmt(void);
5+
int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer);
56
#else
67
static inline void init_prmt(void) { }
8+
static inline int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
9+
{
10+
return -EOPNOTSUPP;
11+
}
712
#endif

0 commit comments

Comments
 (0)