Skip to content

Commit b423f5a

Browse files
committed
Merge tag 'acpi-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These fix an ACPI PRM (Platform Runtime Mechanism) issue and add two new DMI quirks, one for an ACPI IRQ override and one for lid switch detection: - Make acpi_parse_prmt() look for EFI_MEMORY_RUNTIME memory regions only to comply with the UEFI specification and make PRM use efi_guid_t instead of guid_t to avoid a compiler warning triggered by that change (Koba Ko, Dan Carpenter) - Add an ACPI IRQ override quirk for LG 16T90SP (Christian Heusel) - Add a lid switch detection quirk for Samsung Galaxy Book2 (Shubham Panwar)" * tag 'acpi-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: PRM: Clean up guid type in struct prm_handler_info ACPI: button: Add DMI quirk for Samsung Galaxy Book2 to fix initial lid detection issue ACPI: resource: Add LG 16T90SP to irq1_level_low_skip_override[] ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context
2 parents 8c76163 + 54774ab commit b423f5a

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

drivers/acpi/button.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
130130
},
131131
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
132132
},
133+
{
134+
/*
135+
* Samsung galaxybook2 ,initial _LID device notification returns
136+
* lid closed.
137+
*/
138+
.matches = {
139+
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
140+
DMI_MATCH(DMI_PRODUCT_NAME, "750XED"),
141+
},
142+
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
143+
},
133144
{}
134145
};
135146

drivers/acpi/prmt.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct prm_context_buffer {
5252
static LIST_HEAD(prm_module_list);
5353

5454
struct prm_handler_info {
55-
guid_t guid;
55+
efi_guid_t guid;
5656
efi_status_t (__efiapi *handler_addr)(u64, void *);
5757
u64 static_data_buffer_addr;
5858
u64 acpi_param_buffer_addr;
@@ -72,17 +72,21 @@ struct prm_module_info {
7272
struct prm_handler_info handlers[] __counted_by(handler_count);
7373
};
7474

75-
static u64 efi_pa_va_lookup(u64 pa)
75+
static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
7676
{
7777
efi_memory_desc_t *md;
7878
u64 pa_offset = pa & ~PAGE_MASK;
7979
u64 page = pa & PAGE_MASK;
8080

8181
for_each_efi_memory_desc(md) {
82-
if (md->phys_addr < pa && pa < md->phys_addr + PAGE_SIZE * md->num_pages)
82+
if ((md->attribute & EFI_MEMORY_RUNTIME) &&
83+
(md->phys_addr < pa && pa < md->phys_addr + PAGE_SIZE * md->num_pages)) {
8384
return pa_offset + md->virt_addr + page - md->phys_addr;
85+
}
8486
}
8587

88+
pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
89+
8690
return 0;
8791
}
8892

@@ -148,9 +152,15 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
148152
th = &tm->handlers[cur_handler];
149153

150154
guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
151-
th->handler_addr = (void *)efi_pa_va_lookup(handler_info->handler_address);
152-
th->static_data_buffer_addr = efi_pa_va_lookup(handler_info->static_data_buffer_address);
153-
th->acpi_param_buffer_addr = efi_pa_va_lookup(handler_info->acpi_param_buffer_address);
155+
th->handler_addr =
156+
(void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
157+
158+
th->static_data_buffer_addr =
159+
efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
160+
161+
th->acpi_param_buffer_addr =
162+
efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
163+
154164
} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
155165

156166
return 0;
@@ -277,6 +287,13 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
277287
if (!handler || !module)
278288
goto invalid_guid;
279289

290+
if (!handler->handler_addr ||
291+
!handler->static_data_buffer_addr ||
292+
!handler->acpi_param_buffer_addr) {
293+
buffer->prm_status = PRM_HANDLER_ERROR;
294+
return AE_OK;
295+
}
296+
280297
ACPI_COPY_NAMESEG(context.signature, "PRMC");
281298
context.revision = 0x0;
282299
context.reserved = 0x0;

drivers/acpi/resource.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,13 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
503503
DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
504504
},
505505
},
506+
{
507+
/* LG Electronics 16T90SP */
508+
.matches = {
509+
DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
510+
DMI_MATCH(DMI_BOARD_NAME, "16T90SP"),
511+
},
512+
},
506513
{ }
507514
};
508515

0 commit comments

Comments
 (0)