Commit b423f5a9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 8c76163f 54774abb
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -130,6 +130,17 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
		},
		.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,
	},
	{}
};

+23 −6
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ struct prm_context_buffer {
static LIST_HEAD(prm_module_list);

struct prm_handler_info {
	guid_t guid;
	efi_guid_t guid;
	efi_status_t (__efiapi *handler_addr)(u64, void *);
	u64 static_data_buffer_addr;
	u64 acpi_param_buffer_addr;
@@ -72,16 +72,20 @@ struct prm_module_info {
	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;
	u64 pa_offset = pa & ~PAGE_MASK;
	u64 page = pa & PAGE_MASK;

	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;
		}
	}

	pr_warn("Failed to find VA for GUID: %pUL, PA: 0x%llx", guid, pa);

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

		guid_copy(&th->guid, (guid_t *)handler_info->handler_guid);
		th->handler_addr = (void *)efi_pa_va_lookup(handler_info->handler_address);
		th->static_data_buffer_addr = efi_pa_va_lookup(handler_info->static_data_buffer_address);
		th->acpi_param_buffer_addr = efi_pa_va_lookup(handler_info->acpi_param_buffer_address);
		th->handler_addr =
			(void *)efi_pa_va_lookup(&th->guid, handler_info->handler_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)));

	return 0;
@@ -277,6 +287,13 @@ 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) {
			buffer->prm_status = PRM_HANDLER_ERROR;
			return AE_OK;
		}

		ACPI_COPY_NAMESEG(context.signature, "PRMC");
		context.revision = 0x0;
		context.reserved = 0x0;
+7 −0
Original line number Diff line number Diff line
@@ -503,6 +503,13 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
			DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
		},
	},
	{
		/* LG Electronics 16T90SP */
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
			DMI_MATCH(DMI_BOARD_NAME, "16T90SP"),
		},
	},
	{ }
};