ACPI updates for 6.12-rc5

- 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).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmcbvF8SHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxVOIP/0zoNdhHqjQtF26Wj9n1cYjQ5q1Uh5St
 M+PxW0sSrkhbDEYExXp9mjIQW+hSErG5CorH+yQGhUs82eaTLwlASIYnm78vRzH7
 UzEFat+ZY4Yqq9BQvNX0rch2kjEqu5Ck7OntnCw+XGYxV67CbF5LBJSBr5SwlHUZ
 9m35XXg+0DNpc8MsD7MGMB8BIe0t3PzjZiygpqzj7Rl0wSBBUvSJvoNwsMgTpQMr
 o9mMV1jcWmxxeCTq6WXETU9WQAYWiU8GaPN7h+T+Fmt9rk7xdkMahEP95J4qIWnd
 B2kbxGfDqp4Q5bKIF2L0JmNqA2h2WKdVpIiMm/4RubYbKRQn5AtVV61/3sSZLYCo
 /HsxzWgazEY6fflcQQa7NXwujaB9BlKZkRv9LkecEa/EE6xv4kovTawLTugVUgZJ
 z2R4JqOKEYAaFfS/h3Y5slTC72EW99JOMpJgJvSNZtxBdrHH1ikNqsX0R0nFK6xH
 bTRqv2bATZ6YBKx6fnjNhBoaZ0BTHvVEOqhdQyqJhqhZ4eiS7aEvlJGB6Kcyih+n
 2QG3hF4SnXgvPNQ3PcWC1daNVOO4HC4vofabfi5jei1926B6xEBZeCCNMw2hY0E3
 /VZfd3eGADA/yMUtR3eoWflHPw8AkUhy0J0CYVdrDcQpVch3sDi8hd4yOVd1SUMf
 SCrn5rPZ4MK/
 =8OkL
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-10-25 11:04:34 -07:00
commit b423f5a9a6
3 changed files with 41 additions and 6 deletions

View File

@ -130,6 +130,17 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
}, },
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
}, },
{
/*
* Samsung galaxybook2 ,initial _LID device notification returns
* lid closed.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "750XED"),
},
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
},
{} {}
}; };

View File

@ -52,7 +52,7 @@ struct prm_context_buffer {
static LIST_HEAD(prm_module_list); static LIST_HEAD(prm_module_list);
struct prm_handler_info { struct prm_handler_info {
guid_t guid; efi_guid_t guid;
efi_status_t (__efiapi *handler_addr)(u64, void *); efi_status_t (__efiapi *handler_addr)(u64, void *);
u64 static_data_buffer_addr; u64 static_data_buffer_addr;
u64 acpi_param_buffer_addr; u64 acpi_param_buffer_addr;
@ -72,17 +72,21 @@ struct prm_module_info {
struct prm_handler_info handlers[] __counted_by(handler_count); struct prm_handler_info handlers[] __counted_by(handler_count);
}; };
static u64 efi_pa_va_lookup(u64 pa) static u64 efi_pa_va_lookup(efi_guid_t *guid, u64 pa)
{ {
efi_memory_desc_t *md; efi_memory_desc_t *md;
u64 pa_offset = pa & ~PAGE_MASK; u64 pa_offset = pa & ~PAGE_MASK;
u64 page = pa & PAGE_MASK; u64 page = pa & PAGE_MASK;
for_each_efi_memory_desc(md) { for_each_efi_memory_desc(md) {
if (md->phys_addr < pa && pa < md->phys_addr + PAGE_SIZE * md->num_pages) if ((md->attribute & EFI_MEMORY_RUNTIME) &&
(md->phys_addr < pa && pa < md->phys_addr + PAGE_SIZE * md->num_pages)) {
return pa_offset + md->virt_addr + page - md->phys_addr; return pa_offset + md->virt_addr + page - md->phys_addr;
}
} }
pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);
return 0; return 0;
} }
@ -148,9 +152,15 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
th = &tm->handlers[cur_handler]; th = &tm->handlers[cur_handler];
guid_copy(&th->guid, (guid_t *)handler_info->handler_guid); guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
th->handler_addr = (void *)efi_pa_va_lookup(handler_info->handler_address); th->handler_addr =
th->static_data_buffer_addr = efi_pa_va_lookup(handler_info->static_data_buffer_address); (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
th->acpi_param_buffer_addr = efi_pa_va_lookup(handler_info->acpi_param_buffer_address);
th->static_data_buffer_addr =
efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
th->acpi_param_buffer_addr =
efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info))); } while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
return 0; return 0;
@ -277,6 +287,13 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
if (!handler || !module) if (!handler || !module)
goto invalid_guid; goto invalid_guid;
if (!handler->handler_addr ||
!handler->static_data_buffer_addr ||
!handler->acpi_param_buffer_addr) {
buffer->prm_status = PRM_HANDLER_ERROR;
return AE_OK;
}
ACPI_COPY_NAMESEG(context.signature, "PRMC"); ACPI_COPY_NAMESEG(context.signature, "PRMC");
context.revision = 0x0; context.revision = 0x0;
context.reserved = 0x0; context.reserved = 0x0;

View File

@ -503,6 +503,13 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
DMI_MATCH(DMI_BOARD_NAME, "17U70P"), DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
}, },
}, },
{
/* LG Electronics 16T90SP */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
DMI_MATCH(DMI_BOARD_NAME, "16T90SP"),
},
},
{ } { }
}; };