Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions drivers/acpi/prmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct prm_module_info {
bool updatable;

struct list_head module_list;
struct prm_handler_info handlers[];
struct prm_handler_info handlers[] __counted_by(handler_count);
};

static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
Expand Down Expand Up @@ -224,6 +224,30 @@ static struct prm_handler_info *find_prm_handler(const guid_t *guid)
#define UPDATE_LOCK_ALREADY_HELD 4
#define UPDATE_UNLOCK_WITHOUT_LOCK 5

int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
{
struct prm_handler_info *handler = find_prm_handler(&handler_guid);
struct prm_module_info *module = find_prm_module(&handler_guid);
struct prm_context_buffer context;
efi_status_t status;

if (!module || !handler)
return -ENODEV;

memset(&context, 0, sizeof(context));
ACPI_COPY_NAMESEG(context.signature, "PRMC");
context.identifier = handler->guid;
context.static_data_buffer = handler->static_data_buffer_addr;
context.mmio_ranges = module->mmio_info;

status = efi_call_acpi_prm_handler(handler->handler_addr,
(u64)param_buffer,
&context);

return efi_status_to_err(status);
}
EXPORT_SYMBOL_GPL(acpi_call_prm_handler);

/*
* This is the PlatformRtMechanism opregion space handler.
* @function: indicates the read/write. In fact as the PlatformRtMechanism
Expand Down Expand Up @@ -263,9 +287,7 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
if (!handler || !module)
goto invalid_guid;

if (!handler->handler_addr ||
!handler->static_data_buffer_addr ||
!handler->acpi_param_buffer_addr) {
if (!handler->handler_addr) {
buffer->prm_status = PRM_HANDLER_ERROR;
return AE_OK;
}
Expand Down
5 changes: 5 additions & 0 deletions include/linux/prmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

#ifdef CONFIG_ACPI_PRMT
void init_prmt(void);
int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer);
#else
static inline void init_prmt(void) { }
static inline int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
{
return -EOPNOTSUPP;
}
#endif