Commit 314b97cc authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'acpica', 'acpi-osl', 'acpi-bus' and 'acpi-tables'

Merge ACPICA changes, ACPI OS-layer changes, ACPI bus-type and _OSC
support changes and ACPI tables parsing changes for 5.18-rc1:

 - Use uintptr_t and offsetof() in the ACPICA code to avoid compiler
   warnings regarding NULL pointer arithmetic (Rafael Wysocki).

 - Fix possible NULL pointer dereference in acpi_ns_walk_namespace()
   when passed "acpi=off" in the command line (Rafael Wysocki).

 - Fix and clean up acpi_os_read/write_port() (Rafael Wysocki).

 - Introduce acpi_bus_for_each_dev() and use it for walking all ACPI
   device objects in the Type C code (Rafael Wysocki).

 - Fix the _OSC platform capabilities negotioation and prevent CPPC
   from being used if the platform firmware indicates that it not
   supported via _OSC (Rafael Wysocki).

 - Add AGDI and CEDT to the list of known ACPI table signatures (Ilkka
   Koskinen, Robert Kiraly).

* acpica:
  ACPICA: Avoid walking the ACPI Namespace if it is not there
  ACPICA: Use uintptr_t and offsetof() in Linux kernel builds

* acpi-osl:
  ACPI: OSL: Fix and clean up acpi_os_read/write_port()

* acpi-bus:
  ACPI: bus: Avoid using CPPC if not supported by firmware
  Revert "ACPI: Pass the same capabilities to the _OSC regardless of the query flag"
  ACPI: bus: Introduce acpi_bus_for_each_dev()

* acpi-tables:
  ACPI: tables: Add AGDI to the list of known table signatures
  ACPI: tables: Add CEDT signature to the list of known tables
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -169,6 +169,9 @@ acpi_ns_walk_namespace(acpi_object_type type,

	if (start_node == ACPI_ROOT_OBJECT) {
		start_node = acpi_gbl_root_node;
		if (!start_node) {
			return_ACPI_STATUS(AE_NO_NAMESPACE);
		}
	}

	/* Null child means "get first node" */
+33 −9
Original line number Diff line number Diff line
@@ -283,6 +283,8 @@ EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed);
bool osc_sb_native_usb4_support_confirmed;
EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed);

bool osc_sb_cppc_not_supported;

static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
static void acpi_bus_osc_negotiate_platform_control(void)
{
@@ -332,21 +334,38 @@ static void acpi_bus_osc_negotiate_platform_control(void)
	if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
		return;

	capbuf_ret = context.ret.pointer;
	if (context.ret.length <= OSC_SUPPORT_DWORD) {
		kfree(context.ret.pointer);
		return;
	}

#ifdef CONFIG_X86
	if (boot_cpu_has(X86_FEATURE_HWP))
		osc_sb_cppc_not_supported = !(capbuf_ret[OSC_SUPPORT_DWORD] &
				(OSC_SB_CPC_SUPPORT | OSC_SB_CPCV2_SUPPORT));
#endif

	/* Now run _OSC again with query flag clear */
	/*
	 * Now run _OSC again with query flag clear and with the caps
	 * supported by both the OS and the platform.
	 */
	capbuf[OSC_QUERY_DWORD] = 0;
	capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD];
	kfree(context.ret.pointer);

	if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
		return;

	capbuf_ret = context.ret.pointer;
	if (context.ret.length > OSC_SUPPORT_DWORD) {
		osc_sb_apei_support_acked =
			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
		osc_pc_lpi_support_confirmed =
			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
		osc_sb_native_usb4_support_confirmed =
			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
	}

	kfree(context.ret.pointer);
}
@@ -1043,7 +1062,12 @@ struct bus_type acpi_bus_type = {
	.remove		= acpi_device_remove,
	.uevent		= acpi_device_uevent,
};
EXPORT_SYMBOL_GPL(acpi_bus_type);

int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data)
{
	return bus_for_each_dev(&acpi_bus_type, NULL, data, fn);
}
EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev);

/* --------------------------------------------------------------------------
                             Initialization/Cleanup
+3 −0
Original line number Diff line number Diff line
@@ -656,6 +656,9 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
	acpi_status status;
	int ret = -EFAULT;

	if (osc_sb_cppc_not_supported)
		return -ENODEV;

	/* Parse the ACPI _CPC table for this CPU. */
	status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
			ACPI_TYPE_PACKAGE);
+11 −8
Original line number Diff line number Diff line
@@ -646,18 +646,20 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
{
	u32 dummy;

	if (!value)
	if (value)
		*value = 0;
	else
		value = &dummy;

	*value = 0;
	if (width <= 8) {
		*(u8 *) value = inb(port);
		*value = inb(port);
	} else if (width <= 16) {
		*(u16 *) value = inw(port);
		*value = inw(port);
	} else if (width <= 32) {
		*(u32 *) value = inl(port);
		*value = inl(port);
	} else {
		BUG();
		pr_debug("%s: Access width %d not supported\n", __func__, width);
		return AE_BAD_PARAMETER;
	}

	return AE_OK;
@@ -674,7 +676,8 @@ acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
	} else if (width <= 32) {
		outl(value, port);
	} else {
		BUG();
		pr_debug("%s: Access width %d not supported\n", __func__, width);
		return AE_BAD_PARAMETER;
	}

	return AE_OK;
+1 −1
Original line number Diff line number Diff line
@@ -545,7 +545,7 @@ static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst = {
	ACPI_SIG_WDDT, ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT,
	ACPI_SIG_PSDT, ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT,
	ACPI_SIG_IORT, ACPI_SIG_NFIT, ACPI_SIG_HMAT, ACPI_SIG_PPTT,
	ACPI_SIG_NHLT, ACPI_SIG_AEST };
	ACPI_SIG_NHLT, ACPI_SIG_AEST, ACPI_SIG_CEDT, ACPI_SIG_AGDI };

#define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)

Loading