1cefc7ca4SErik Kaneda // SPDX-License-Identifier: GPL-2.0-only
2cefc7ca4SErik Kaneda /*
3cefc7ca4SErik Kaneda * Author: Erik Kaneda <erik.kaneda@intel.com>
4cefc7ca4SErik Kaneda * Copyright 2020 Intel Corporation
5cefc7ca4SErik Kaneda *
6cefc7ca4SErik Kaneda * prmt.c
7cefc7ca4SErik Kaneda *
8cefc7ca4SErik Kaneda * Each PRM service is an executable that is run in a restricted environment
9cefc7ca4SErik Kaneda * that is invoked by writing to the PlatformRtMechanism OperationRegion from
10cefc7ca4SErik Kaneda * AML bytecode.
11cefc7ca4SErik Kaneda *
12cefc7ca4SErik Kaneda * init_prmt initializes the Platform Runtime Mechanism (PRM) services by
13cefc7ca4SErik Kaneda * processing data in the PRMT as well as registering an ACPI OperationRegion
14cefc7ca4SErik Kaneda * handler for the PlatformRtMechanism subtype.
15cefc7ca4SErik Kaneda *
16cefc7ca4SErik Kaneda */
17cefc7ca4SErik Kaneda #include <linux/kernel.h>
18cefc7ca4SErik Kaneda #include <linux/efi.h>
19cefc7ca4SErik Kaneda #include <linux/acpi.h>
20cefc7ca4SErik Kaneda #include <linux/prmt.h>
21cefc7ca4SErik Kaneda #include <asm/efi.h>
22cefc7ca4SErik Kaneda
23cefc7ca4SErik Kaneda #pragma pack(1)
24cefc7ca4SErik Kaneda struct prm_mmio_addr_range {
25cefc7ca4SErik Kaneda u64 phys_addr;
26cefc7ca4SErik Kaneda u64 virt_addr;
27cefc7ca4SErik Kaneda u32 length;
28cefc7ca4SErik Kaneda };
29cefc7ca4SErik Kaneda
30cefc7ca4SErik Kaneda struct prm_mmio_info {
31cefc7ca4SErik Kaneda u64 mmio_count;
32cefc7ca4SErik Kaneda struct prm_mmio_addr_range addr_ranges[];
33cefc7ca4SErik Kaneda };
34cefc7ca4SErik Kaneda
35cefc7ca4SErik Kaneda struct prm_buffer {
36cefc7ca4SErik Kaneda u8 prm_status;
37cefc7ca4SErik Kaneda u64 efi_status;
38cefc7ca4SErik Kaneda u8 prm_cmd;
39cefc7ca4SErik Kaneda guid_t handler_guid;
40cefc7ca4SErik Kaneda };
41cefc7ca4SErik Kaneda
42cefc7ca4SErik Kaneda struct prm_context_buffer {
43cefc7ca4SErik Kaneda char signature[ACPI_NAMESEG_SIZE];
44cefc7ca4SErik Kaneda u16 revision;
45cefc7ca4SErik Kaneda u16 reserved;
46cefc7ca4SErik Kaneda guid_t identifier;
47cefc7ca4SErik Kaneda u64 static_data_buffer;
48cefc7ca4SErik Kaneda struct prm_mmio_info *mmio_ranges;
49cefc7ca4SErik Kaneda };
50cefc7ca4SErik Kaneda #pragma pack()
51cefc7ca4SErik Kaneda
52d7a188bbSWei Yongjun static LIST_HEAD(prm_module_list);
53cefc7ca4SErik Kaneda
54cefc7ca4SErik Kaneda struct prm_handler_info {
55cefc7ca4SErik Kaneda guid_t guid;
56e38abdabSArd Biesheuvel efi_status_t (__efiapi *handler_addr)(u64, void *);
57cefc7ca4SErik Kaneda u64 static_data_buffer_addr;
58cefc7ca4SErik Kaneda u64 acpi_param_buffer_addr;
59cefc7ca4SErik Kaneda
60cefc7ca4SErik Kaneda struct list_head handler_list;
61cefc7ca4SErik Kaneda };
62cefc7ca4SErik Kaneda
63cefc7ca4SErik Kaneda struct prm_module_info {
64cefc7ca4SErik Kaneda guid_t guid;
65cefc7ca4SErik Kaneda u16 major_rev;
66cefc7ca4SErik Kaneda u16 minor_rev;
67cefc7ca4SErik Kaneda u16 handler_count;
68cefc7ca4SErik Kaneda struct prm_mmio_info *mmio_info;
69cefc7ca4SErik Kaneda bool updatable;
70cefc7ca4SErik Kaneda
71cefc7ca4SErik Kaneda struct list_head module_list;
722e893457SKees Cook struct prm_handler_info handlers[] __counted_by(handler_count);
73cefc7ca4SErik Kaneda };
74cefc7ca4SErik Kaneda
efi_pa_va_lookup(u64 pa)75cefc7ca4SErik Kaneda static u64 efi_pa_va_lookup(u64 pa)
76cefc7ca4SErik Kaneda {
77cefc7ca4SErik Kaneda efi_memory_desc_t *md;
78cefc7ca4SErik Kaneda u64 pa_offset = pa & ~PAGE_MASK;
79cefc7ca4SErik Kaneda u64 page = pa & PAGE_MASK;
80cefc7ca4SErik Kaneda
81cefc7ca4SErik Kaneda for_each_efi_memory_desc(md) {
82cefc7ca4SErik Kaneda if (md->phys_addr < pa && pa < md->phys_addr + PAGE_SIZE * md->num_pages)
83cefc7ca4SErik Kaneda return pa_offset + md->virt_addr + page - md->phys_addr;
84cefc7ca4SErik Kaneda }
85cefc7ca4SErik Kaneda
86cefc7ca4SErik Kaneda return 0;
87cefc7ca4SErik Kaneda }
88cefc7ca4SErik Kaneda
89cefc7ca4SErik Kaneda #define get_first_handler(a) ((struct acpi_prmt_handler_info *) ((char *) (a) + a->handler_info_offset))
90cefc7ca4SErik Kaneda #define get_next_handler(a) ((struct acpi_prmt_handler_info *) (sizeof(struct acpi_prmt_handler_info) + (char *) a))
91cefc7ca4SErik Kaneda
92cefc7ca4SErik Kaneda static int __init
acpi_parse_prmt(union acpi_subtable_headers * header,const unsigned long end)93cefc7ca4SErik Kaneda acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
94cefc7ca4SErik Kaneda {
95cefc7ca4SErik Kaneda struct acpi_prmt_module_info *module_info;
96cefc7ca4SErik Kaneda struct acpi_prmt_handler_info *handler_info;
97cefc7ca4SErik Kaneda struct prm_handler_info *th;
98cefc7ca4SErik Kaneda struct prm_module_info *tm;
99c52ca713SAubrey Li u64 *mmio_count;
100cefc7ca4SErik Kaneda u64 cur_handler = 0;
101cefc7ca4SErik Kaneda u32 module_info_size = 0;
102cefc7ca4SErik Kaneda u64 mmio_range_size = 0;
103cefc7ca4SErik Kaneda void *temp_mmio;
104cefc7ca4SErik Kaneda
105cefc7ca4SErik Kaneda module_info = (struct acpi_prmt_module_info *) header;
106cefc7ca4SErik Kaneda module_info_size = struct_size(tm, handlers, module_info->handler_info_count);
107cefc7ca4SErik Kaneda tm = kmalloc(module_info_size, GFP_KERNEL);
108c52ca713SAubrey Li if (!tm)
109c52ca713SAubrey Li goto parse_prmt_out1;
110cefc7ca4SErik Kaneda
111cefc7ca4SErik Kaneda guid_copy(&tm->guid, (guid_t *) module_info->module_guid);
112cefc7ca4SErik Kaneda tm->major_rev = module_info->major_rev;
113cefc7ca4SErik Kaneda tm->minor_rev = module_info->minor_rev;
114cefc7ca4SErik Kaneda tm->handler_count = module_info->handler_info_count;
115cefc7ca4SErik Kaneda tm->updatable = true;
116cefc7ca4SErik Kaneda
117cefc7ca4SErik Kaneda if (module_info->mmio_list_pointer) {
118cefc7ca4SErik Kaneda /*
119cefc7ca4SErik Kaneda * Each module is associated with a list of addr
120cefc7ca4SErik Kaneda * ranges that it can use during the service
121cefc7ca4SErik Kaneda */
122c52ca713SAubrey Li mmio_count = (u64 *) memremap(module_info->mmio_list_pointer, 8, MEMREMAP_WB);
123c52ca713SAubrey Li if (!mmio_count)
124c52ca713SAubrey Li goto parse_prmt_out2;
125c52ca713SAubrey Li
126c52ca713SAubrey Li mmio_range_size = struct_size(tm->mmio_info, addr_ranges, *mmio_count);
127cefc7ca4SErik Kaneda tm->mmio_info = kmalloc(mmio_range_size, GFP_KERNEL);
128c52ca713SAubrey Li if (!tm->mmio_info)
129c52ca713SAubrey Li goto parse_prmt_out3;
130c52ca713SAubrey Li
131cefc7ca4SErik Kaneda temp_mmio = memremap(module_info->mmio_list_pointer, mmio_range_size, MEMREMAP_WB);
132c52ca713SAubrey Li if (!temp_mmio)
133c52ca713SAubrey Li goto parse_prmt_out4;
134cefc7ca4SErik Kaneda memmove(tm->mmio_info, temp_mmio, mmio_range_size);
135cefc7ca4SErik Kaneda } else {
136c52ca713SAubrey Li tm->mmio_info = kmalloc(sizeof(*tm->mmio_info), GFP_KERNEL);
137c52ca713SAubrey Li if (!tm->mmio_info)
138c52ca713SAubrey Li goto parse_prmt_out2;
139c52ca713SAubrey Li
140cefc7ca4SErik Kaneda tm->mmio_info->mmio_count = 0;
141cefc7ca4SErik Kaneda }
142cefc7ca4SErik Kaneda
143cefc7ca4SErik Kaneda INIT_LIST_HEAD(&tm->module_list);
144cefc7ca4SErik Kaneda list_add(&tm->module_list, &prm_module_list);
145cefc7ca4SErik Kaneda
146cefc7ca4SErik Kaneda handler_info = get_first_handler(module_info);
147cefc7ca4SErik Kaneda do {
148cefc7ca4SErik Kaneda th = &tm->handlers[cur_handler];
149cefc7ca4SErik Kaneda
150cefc7ca4SErik Kaneda guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
151353efd5eSSudeep Holla th->handler_addr = (void *)efi_pa_va_lookup(handler_info->handler_address);
152cefc7ca4SErik Kaneda th->static_data_buffer_addr = efi_pa_va_lookup(handler_info->static_data_buffer_address);
153cefc7ca4SErik Kaneda th->acpi_param_buffer_addr = efi_pa_va_lookup(handler_info->acpi_param_buffer_address);
154cefc7ca4SErik Kaneda } while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
155cefc7ca4SErik Kaneda
156cefc7ca4SErik Kaneda return 0;
157c52ca713SAubrey Li
158c52ca713SAubrey Li parse_prmt_out4:
159c52ca713SAubrey Li kfree(tm->mmio_info);
160c52ca713SAubrey Li parse_prmt_out3:
161c52ca713SAubrey Li memunmap(mmio_count);
162c52ca713SAubrey Li parse_prmt_out2:
163c52ca713SAubrey Li kfree(tm);
164c52ca713SAubrey Li parse_prmt_out1:
165c52ca713SAubrey Li return -ENOMEM;
166cefc7ca4SErik Kaneda }
167cefc7ca4SErik Kaneda
168cefc7ca4SErik Kaneda #define GET_MODULE 0
169cefc7ca4SErik Kaneda #define GET_HANDLER 1
170cefc7ca4SErik Kaneda
find_guid_info(const guid_t * guid,u8 mode)171cefc7ca4SErik Kaneda static void *find_guid_info(const guid_t *guid, u8 mode)
172cefc7ca4SErik Kaneda {
173cefc7ca4SErik Kaneda struct prm_handler_info *cur_handler;
174cefc7ca4SErik Kaneda struct prm_module_info *cur_module;
175cefc7ca4SErik Kaneda int i = 0;
176cefc7ca4SErik Kaneda
177cefc7ca4SErik Kaneda list_for_each_entry(cur_module, &prm_module_list, module_list) {
178cefc7ca4SErik Kaneda for (i = 0; i < cur_module->handler_count; ++i) {
179cefc7ca4SErik Kaneda cur_handler = &cur_module->handlers[i];
180cefc7ca4SErik Kaneda if (guid_equal(guid, &cur_handler->guid)) {
181cefc7ca4SErik Kaneda if (mode == GET_MODULE)
182cefc7ca4SErik Kaneda return (void *)cur_module;
183cefc7ca4SErik Kaneda else
184cefc7ca4SErik Kaneda return (void *)cur_handler;
185cefc7ca4SErik Kaneda }
186cefc7ca4SErik Kaneda }
187cefc7ca4SErik Kaneda }
188cefc7ca4SErik Kaneda
189cefc7ca4SErik Kaneda return NULL;
190cefc7ca4SErik Kaneda }
191cefc7ca4SErik Kaneda
find_prm_module(const guid_t * guid)192cefc7ca4SErik Kaneda static struct prm_module_info *find_prm_module(const guid_t *guid)
193cefc7ca4SErik Kaneda {
194cefc7ca4SErik Kaneda return (struct prm_module_info *)find_guid_info(guid, GET_MODULE);
195cefc7ca4SErik Kaneda }
196cefc7ca4SErik Kaneda
find_prm_handler(const guid_t * guid)197cefc7ca4SErik Kaneda static struct prm_handler_info *find_prm_handler(const guid_t *guid)
198cefc7ca4SErik Kaneda {
199cefc7ca4SErik Kaneda return (struct prm_handler_info *) find_guid_info(guid, GET_HANDLER);
200cefc7ca4SErik Kaneda }
201cefc7ca4SErik Kaneda
202cefc7ca4SErik Kaneda /* In-coming PRM commands */
203cefc7ca4SErik Kaneda
204cefc7ca4SErik Kaneda #define PRM_CMD_RUN_SERVICE 0
205cefc7ca4SErik Kaneda #define PRM_CMD_START_TRANSACTION 1
206cefc7ca4SErik Kaneda #define PRM_CMD_END_TRANSACTION 2
207cefc7ca4SErik Kaneda
208cefc7ca4SErik Kaneda /* statuses that can be passed back to ASL */
209cefc7ca4SErik Kaneda
210cefc7ca4SErik Kaneda #define PRM_HANDLER_SUCCESS 0
211cefc7ca4SErik Kaneda #define PRM_HANDLER_ERROR 1
212cefc7ca4SErik Kaneda #define INVALID_PRM_COMMAND 2
213cefc7ca4SErik Kaneda #define PRM_HANDLER_GUID_NOT_FOUND 3
214cefc7ca4SErik Kaneda #define UPDATE_LOCK_ALREADY_HELD 4
215cefc7ca4SErik Kaneda #define UPDATE_UNLOCK_WITHOUT_LOCK 5
216cefc7ca4SErik Kaneda
acpi_call_prm_handler(guid_t handler_guid,void * param_buffer)217*f0fcdd2cSJohn Allen int acpi_call_prm_handler(guid_t handler_guid, void *param_buffer)
218*f0fcdd2cSJohn Allen {
219*f0fcdd2cSJohn Allen struct prm_handler_info *handler = find_prm_handler(&handler_guid);
220*f0fcdd2cSJohn Allen struct prm_module_info *module = find_prm_module(&handler_guid);
221*f0fcdd2cSJohn Allen struct prm_context_buffer context;
222*f0fcdd2cSJohn Allen efi_status_t status;
223*f0fcdd2cSJohn Allen
224*f0fcdd2cSJohn Allen if (!module || !handler)
225*f0fcdd2cSJohn Allen return -ENODEV;
226*f0fcdd2cSJohn Allen
227*f0fcdd2cSJohn Allen memset(&context, 0, sizeof(context));
228*f0fcdd2cSJohn Allen ACPI_COPY_NAMESEG(context.signature, "PRMC");
229*f0fcdd2cSJohn Allen context.identifier = handler->guid;
230*f0fcdd2cSJohn Allen context.static_data_buffer = handler->static_data_buffer_addr;
231*f0fcdd2cSJohn Allen context.mmio_ranges = module->mmio_info;
232*f0fcdd2cSJohn Allen
233*f0fcdd2cSJohn Allen status = efi_call_acpi_prm_handler(handler->handler_addr,
234*f0fcdd2cSJohn Allen (u64)param_buffer,
235*f0fcdd2cSJohn Allen &context);
236*f0fcdd2cSJohn Allen
237*f0fcdd2cSJohn Allen return efi_status_to_err(status);
238*f0fcdd2cSJohn Allen }
239*f0fcdd2cSJohn Allen EXPORT_SYMBOL_GPL(acpi_call_prm_handler);
240*f0fcdd2cSJohn Allen
241cefc7ca4SErik Kaneda /*
242cefc7ca4SErik Kaneda * This is the PlatformRtMechanism opregion space handler.
243cefc7ca4SErik Kaneda * @function: indicates the read/write. In fact as the PlatformRtMechanism
244cefc7ca4SErik Kaneda * message is driven by command, only write is meaningful.
245cefc7ca4SErik Kaneda *
246cefc7ca4SErik Kaneda * @addr : not used
247cefc7ca4SErik Kaneda * @bits : not used.
248cefc7ca4SErik Kaneda * @value : it is an in/out parameter. It points to the PRM message buffer.
249cefc7ca4SErik Kaneda * @handler_context: not used
250cefc7ca4SErik Kaneda */
acpi_platformrt_space_handler(u32 function,acpi_physical_address addr,u32 bits,acpi_integer * value,void * handler_context,void * region_context)251cefc7ca4SErik Kaneda static acpi_status acpi_platformrt_space_handler(u32 function,
252cefc7ca4SErik Kaneda acpi_physical_address addr,
253cefc7ca4SErik Kaneda u32 bits, acpi_integer *value,
254cefc7ca4SErik Kaneda void *handler_context,
255cefc7ca4SErik Kaneda void *region_context)
256cefc7ca4SErik Kaneda {
257cefc7ca4SErik Kaneda struct prm_buffer *buffer = ACPI_CAST_PTR(struct prm_buffer, value);
258cefc7ca4SErik Kaneda struct prm_handler_info *handler;
259cefc7ca4SErik Kaneda struct prm_module_info *module;
260cefc7ca4SErik Kaneda efi_status_t status;
261cefc7ca4SErik Kaneda struct prm_context_buffer context;
262cefc7ca4SErik Kaneda
263182da6f2SArd Biesheuvel if (!efi_enabled(EFI_RUNTIME_SERVICES)) {
264182da6f2SArd Biesheuvel pr_err_ratelimited("PRM: EFI runtime services no longer available\n");
265182da6f2SArd Biesheuvel return AE_NO_HANDLER;
266182da6f2SArd Biesheuvel }
267182da6f2SArd Biesheuvel
268cefc7ca4SErik Kaneda /*
269cefc7ca4SErik Kaneda * The returned acpi_status will always be AE_OK. Error values will be
270cefc7ca4SErik Kaneda * saved in the first byte of the PRM message buffer to be used by ASL.
271cefc7ca4SErik Kaneda */
272cefc7ca4SErik Kaneda switch (buffer->prm_cmd) {
273cefc7ca4SErik Kaneda case PRM_CMD_RUN_SERVICE:
274cefc7ca4SErik Kaneda
275cefc7ca4SErik Kaneda handler = find_prm_handler(&buffer->handler_guid);
276cefc7ca4SErik Kaneda module = find_prm_module(&buffer->handler_guid);
277cefc7ca4SErik Kaneda if (!handler || !module)
278cefc7ca4SErik Kaneda goto invalid_guid;
279cefc7ca4SErik Kaneda
280cefc7ca4SErik Kaneda ACPI_COPY_NAMESEG(context.signature, "PRMC");
281cefc7ca4SErik Kaneda context.revision = 0x0;
282cefc7ca4SErik Kaneda context.reserved = 0x0;
283cefc7ca4SErik Kaneda context.identifier = handler->guid;
284cefc7ca4SErik Kaneda context.static_data_buffer = handler->static_data_buffer_addr;
285cefc7ca4SErik Kaneda context.mmio_ranges = module->mmio_info;
286cefc7ca4SErik Kaneda
2875894cf57SArd Biesheuvel status = efi_call_acpi_prm_handler(handler->handler_addr,
288cefc7ca4SErik Kaneda handler->acpi_param_buffer_addr,
289cefc7ca4SErik Kaneda &context);
290cefc7ca4SErik Kaneda if (status == EFI_SUCCESS) {
291cefc7ca4SErik Kaneda buffer->prm_status = PRM_HANDLER_SUCCESS;
292cefc7ca4SErik Kaneda } else {
293cefc7ca4SErik Kaneda buffer->prm_status = PRM_HANDLER_ERROR;
294cefc7ca4SErik Kaneda buffer->efi_status = status;
295cefc7ca4SErik Kaneda }
296cefc7ca4SErik Kaneda break;
297cefc7ca4SErik Kaneda
298cefc7ca4SErik Kaneda case PRM_CMD_START_TRANSACTION:
299cefc7ca4SErik Kaneda
300cefc7ca4SErik Kaneda module = find_prm_module(&buffer->handler_guid);
301cefc7ca4SErik Kaneda if (!module)
302cefc7ca4SErik Kaneda goto invalid_guid;
303cefc7ca4SErik Kaneda
304cefc7ca4SErik Kaneda if (module->updatable)
305cefc7ca4SErik Kaneda module->updatable = false;
306cefc7ca4SErik Kaneda else
307cefc7ca4SErik Kaneda buffer->prm_status = UPDATE_LOCK_ALREADY_HELD;
308cefc7ca4SErik Kaneda break;
309cefc7ca4SErik Kaneda
310cefc7ca4SErik Kaneda case PRM_CMD_END_TRANSACTION:
311cefc7ca4SErik Kaneda
312cefc7ca4SErik Kaneda module = find_prm_module(&buffer->handler_guid);
313cefc7ca4SErik Kaneda if (!module)
314cefc7ca4SErik Kaneda goto invalid_guid;
315cefc7ca4SErik Kaneda
316cefc7ca4SErik Kaneda if (module->updatable)
317cefc7ca4SErik Kaneda buffer->prm_status = UPDATE_UNLOCK_WITHOUT_LOCK;
318cefc7ca4SErik Kaneda else
319cefc7ca4SErik Kaneda module->updatable = true;
320cefc7ca4SErik Kaneda break;
321cefc7ca4SErik Kaneda
322cefc7ca4SErik Kaneda default:
323cefc7ca4SErik Kaneda
324cefc7ca4SErik Kaneda buffer->prm_status = INVALID_PRM_COMMAND;
325cefc7ca4SErik Kaneda break;
326cefc7ca4SErik Kaneda }
327cefc7ca4SErik Kaneda
328cefc7ca4SErik Kaneda return AE_OK;
329cefc7ca4SErik Kaneda
330cefc7ca4SErik Kaneda invalid_guid:
331cefc7ca4SErik Kaneda buffer->prm_status = PRM_HANDLER_GUID_NOT_FOUND;
332cefc7ca4SErik Kaneda return AE_OK;
333cefc7ca4SErik Kaneda }
334cefc7ca4SErik Kaneda
init_prmt(void)335cefc7ca4SErik Kaneda void __init init_prmt(void)
336cefc7ca4SErik Kaneda {
3373265cc3eSAubrey Li struct acpi_table_header *tbl;
338cefc7ca4SErik Kaneda acpi_status status;
3393265cc3eSAubrey Li int mc;
3403265cc3eSAubrey Li
3413265cc3eSAubrey Li status = acpi_get_table(ACPI_SIG_PRMT, 0, &tbl);
3423265cc3eSAubrey Li if (ACPI_FAILURE(status))
3433265cc3eSAubrey Li return;
3443265cc3eSAubrey Li
3453265cc3eSAubrey Li mc = acpi_table_parse_entries(ACPI_SIG_PRMT, sizeof(struct acpi_table_prmt) +
346cefc7ca4SErik Kaneda sizeof (struct acpi_table_prmt_header),
347cefc7ca4SErik Kaneda 0, acpi_parse_prmt, 0);
3483265cc3eSAubrey Li acpi_put_table(tbl);
3492bbfa0adSAubrey Li /*
3502bbfa0adSAubrey Li * Return immediately if PRMT table is not present or no PRM module found.
3512bbfa0adSAubrey Li */
3522bbfa0adSAubrey Li if (mc <= 0)
3532bbfa0adSAubrey Li return;
3542bbfa0adSAubrey Li
355cefc7ca4SErik Kaneda pr_info("PRM: found %u modules\n", mc);
356cefc7ca4SErik Kaneda
357182da6f2SArd Biesheuvel if (!efi_enabled(EFI_RUNTIME_SERVICES)) {
358182da6f2SArd Biesheuvel pr_err("PRM: EFI runtime services unavailable\n");
359182da6f2SArd Biesheuvel return;
360182da6f2SArd Biesheuvel }
361182da6f2SArd Biesheuvel
362cefc7ca4SErik Kaneda status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
363cefc7ca4SErik Kaneda ACPI_ADR_SPACE_PLATFORM_RT,
364cefc7ca4SErik Kaneda &acpi_platformrt_space_handler,
365cefc7ca4SErik Kaneda NULL, NULL);
366cefc7ca4SErik Kaneda if (ACPI_FAILURE(status))
367cefc7ca4SErik Kaneda pr_alert("PRM: OperationRegion handler could not be installed\n");
368cefc7ca4SErik Kaneda }
369