Commit 6f1e8b12 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'acpi-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "These update the ACPICA kernel code to upstream revision 20210730,
  clean up the ACPI companion binding code, optimize the I2C handling in
  the XPower PMIC driver, add 16550-compatible Serial Port Subtype
  support to the SPCR parsing code, add a few LoongArch support bits,
  add a ne quirk to the button driver, add new PCH FIVR methods to the
  DPTF code, replace deprecated CPU-hotplug functions in the processor
  driver, improve the acpi_os_map_memory() handling on non-x86 and do
  some assorted cleanups.

  Specifics:

   - Update ACPICA code in the kernel to upstream revision 20210730
     including the following changes:
       - Add support for the AEST table (data compiler) to iASL (Bob
         Moore)
       - Fix an if statement (add parens) (Bob Moore)
       - Drop trailing semicolon from some macros (Bob Moore)
       - Fix compilation of WPBT table with no command-line arguments in
         iASL (Bob Moore)
       - Add method name "_DIS" for use with aslmethod.c (Bob Moore)
       - Add new DBG2 Serial Port Subtypes (Marcin Wojtas)

   - Add new PCH FIVR methods to the DPTF code (Srinivas Pandruvada)

   - Add support for the new 16550-compatible Serial Port Subtype to the
     SPCR table parsing code (Marcin Wojtas)

   - Add DMI quirk for Lenovo Yoga 9 (14INTL5) to the ACPI button driver
     (Ulrich Huber)

   - Add LoongArch support for ACPI_PROCESSOR/ACPI_NUMA (Huacai Chen)

   - Add memory semantics to acpi_os_map_memory() (Lorenzo Pieralisi)

   - Replace deprecated CPU-hotplug functions in the ACPI processor
     driver (Sebastian Andrzej Siewior)

   - Optimize I2C-bus handling in the XPower PMIC driver (Hans de Goede)

   - Make platform-profile catch profile changes initiated by user space
     and notify user processes of them (Hans de Goede)

   - Clean up the ACPI companion binding and unbinding code and update
     debug messaging in the ACPI power resources code (Rafael Wysocki)

   - Clean up a couple of code pieces related to configfs (Andy
     Shevchenko)

   - Rearrange the FPDT table parsing code to avoid printing warning
     messages for reserved record types (Adrian Huang)"

* tag 'acpi-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (27 commits)
  ACPI: power: Drop name from struct acpi_power_resource
  ACPI: power: Use acpi_handle_debug() to print debug messages
  ACPI: tables: FPDT: Do not print FW_BUG message if record types are reserved
  ACPI: button: Add DMI quirk for Lenovo Yoga 9 (14INTL5)
  ACPI: Add memory semantics to acpi_os_map_memory()
  ACPI: SPCR: Add support for the new 16550-compatible Serial Port Subtype
  ACPI: platform-profile: call sysfs_notify() from platform_profile_store()
  ACPICA: Update version to 20210730
  ACPICA: Add method name "_DIS" For use with aslmethod.c
  ACPICA: iASL: Fix for WPBT table with no command-line arguments
  ACPICA: Headers: Add new DBG2 Serial Port Subtypes
  ACPICA: Macros should not use a trailing semicolon
  ACPICA: Fix an if statement (add parens)
  ACPICA: iASL: Add support for the AEST table (data compiler)
  ACPI: processor: Replace deprecated CPU-hotplug functions
  ACPI: DPTF: Add new PCH FIVR methods
  ACPI: configfs: Make get_header() to return error pointer
  ACPI: configfs: Use sysfs_emit() in "show" functions
  driver core: Split device_platform_notify()
  software nodes: Split software_node_notify()
  ...
parents 5cbba605 2cbd4070
...@@ -111,3 +111,43 @@ Contact: linux-acpi@vger.kernel.org ...@@ -111,3 +111,43 @@ Contact: linux-acpi@vger.kernel.org
Description: Description:
(RW) The PCH FIVR (Fully Integrated Voltage Regulator) switching frequency in MHz, (RW) The PCH FIVR (Fully Integrated Voltage Regulator) switching frequency in MHz,
when FIVR clock is 38.4MHz. when FIVR clock is 38.4MHz.
What: /sys/bus/platform/devices/INTC1045:00/pch_fivr_switch_frequency/fivr_switching_freq_mhz
Date: September, 2021
KernelVersion: v5.15
Contact: linux-acpi@vger.kernel.org
Description:
(RO) Get the FIVR switching control frequency in MHz.
What: /sys/bus/platform/devices/INTC1045:00/pch_fivr_switch_frequency/fivr_switching_fault_status
Date: September, 2021
KernelVersion: v5.15
Contact: linux-acpi@vger.kernel.org
Description:
(RO) Read the FIVR switching frequency control fault status.
What: /sys/bus/platform/devices/INTC1045:00/pch_fivr_switch_frequency/ssc_clock_info
Date: September, 2021
KernelVersion: v5.15
Contact: linux-acpi@vger.kernel.org
Description:
(RO) Presents SSC (spread spectrum clock) information for EMI
(Electro magnetic interference) control. This is a bit mask.
Bits Description
[7:0] Sets clock spectrum spread percentage:
0x00=0.2% , 0x3F=10%
1 LSB = 0.1% increase in spread (for
settings 0x01 thru 0x1C)
1 LSB = 0.2% increase in spread (for
settings 0x1E thru 0x3F)
[8] When set to 1, enables spread
spectrum clock
[9] 0: Triangle mode. FFC frequency
walks around the Fcenter in a linear
fashion
1: Random walk mode. FFC frequency
changes randomly within the SSC
(Spread spectrum clock) range
[10] 0: No white noise. 1: Add white noise
to spread waveform
[11] When 1, future writes are ignored.
...@@ -26,3 +26,10 @@ Contact: Hans de Goede <hdegoede@redhat.com> ...@@ -26,3 +26,10 @@ Contact: Hans de Goede <hdegoede@redhat.com>
Description: Reading this file gives the current selected profile for this Description: Reading this file gives the current selected profile for this
device. Writing this file with one of the strings from device. Writing this file with one of the strings from
platform_profile_choices changes the profile to the new value. platform_profile_choices changes the profile to the new value.
This file can be monitored for changes by polling for POLLPRI,
POLLPRI will be signalled on any changes, independent of those
changes coming from a userspace write; or coming from another
source such as e.g. a hotkey triggered profile change handled
either directly by the embedded-controller or fully handled
inside the kernel.
...@@ -50,6 +50,9 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr); ...@@ -50,6 +50,9 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
#define acpi_os_ioremap acpi_os_ioremap #define acpi_os_ioremap acpi_os_ioremap
void __iomem *acpi_os_memmap(acpi_physical_address phys, acpi_size size);
#define acpi_os_memmap acpi_os_memmap
typedef u64 phys_cpuid_t; typedef u64 phys_cpuid_t;
#define PHYS_CPUID_INVALID INVALID_HWID #define PHYS_CPUID_INVALID INVALID_HWID
......
...@@ -273,7 +273,8 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr) ...@@ -273,7 +273,8 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)
return __pgprot(PROT_DEVICE_nGnRnE); return __pgprot(PROT_DEVICE_nGnRnE);
} }
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) static void __iomem *__acpi_os_ioremap(acpi_physical_address phys,
acpi_size size, bool memory)
{ {
efi_memory_desc_t *md, *region = NULL; efi_memory_desc_t *md, *region = NULL;
pgprot_t prot; pgprot_t prot;
...@@ -299,9 +300,11 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) ...@@ -299,9 +300,11 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
* It is fine for AML to remap regions that are not represented in the * It is fine for AML to remap regions that are not represented in the
* EFI memory map at all, as it only describes normal memory, and MMIO * EFI memory map at all, as it only describes normal memory, and MMIO
* regions that require a virtual mapping to make them accessible to * regions that require a virtual mapping to make them accessible to
* the EFI runtime services. * the EFI runtime services. Determine the region default
* attributes by checking the requested memory semantics.
*/ */
prot = __pgprot(PROT_DEVICE_nGnRnE); prot = memory ? __pgprot(PROT_NORMAL_NC) :
__pgprot(PROT_DEVICE_nGnRnE);
if (region) { if (region) {
switch (region->type) { switch (region->type) {
case EFI_LOADER_CODE: case EFI_LOADER_CODE:
...@@ -361,6 +364,16 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) ...@@ -361,6 +364,16 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
return __ioremap(phys, size, prot); return __ioremap(phys, size, prot);
} }
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
{
return __acpi_os_ioremap(phys, size, false);
}
void __iomem *acpi_os_memmap(acpi_physical_address phys, acpi_size size)
{
return __acpi_os_ioremap(phys, size, true);
}
/* /*
* Claim Synchronous External Aborts as a firmware first notification. * Claim Synchronous External Aborts as a firmware first notification.
* *
......
...@@ -280,9 +280,9 @@ config ACPI_CPPC_LIB ...@@ -280,9 +280,9 @@ config ACPI_CPPC_LIB
config ACPI_PROCESSOR config ACPI_PROCESSOR
tristate "Processor" tristate "Processor"
depends on X86 || IA64 || ARM64 depends on X86 || IA64 || ARM64 || LOONGARCH
select ACPI_PROCESSOR_IDLE select ACPI_PROCESSOR_IDLE
select ACPI_CPU_FREQ_PSS if X86 || IA64 select ACPI_CPU_FREQ_PSS if X86 || IA64 || LOONGARCH
default y default y
help help
This driver adds support for the ACPI Processor package. It is required This driver adds support for the ACPI Processor package. It is required
......
...@@ -70,7 +70,7 @@ static inline struct acpi_table_header *get_header(struct config_item *cfg) ...@@ -70,7 +70,7 @@ static inline struct acpi_table_header *get_header(struct config_item *cfg)
if (!table->header) if (!table->header)
pr_err("table not loaded\n"); pr_err("table not loaded\n");
return table->header; return table->header ?: ERR_PTR(-EINVAL);
} }
static ssize_t acpi_table_aml_read(struct config_item *cfg, static ssize_t acpi_table_aml_read(struct config_item *cfg,
...@@ -78,8 +78,8 @@ static ssize_t acpi_table_aml_read(struct config_item *cfg, ...@@ -78,8 +78,8 @@ static ssize_t acpi_table_aml_read(struct config_item *cfg,
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
if (data) if (data)
memcpy(data, h, h->length); memcpy(data, h, h->length);
...@@ -100,60 +100,60 @@ static ssize_t acpi_table_signature_show(struct config_item *cfg, char *str) ...@@ -100,60 +100,60 @@ static ssize_t acpi_table_signature_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature); return sysfs_emit(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature);
} }
static ssize_t acpi_table_length_show(struct config_item *cfg, char *str) static ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%d\n", h->length); return sysfs_emit(str, "%d\n", h->length);
} }
static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str) static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%d\n", h->revision); return sysfs_emit(str, "%d\n", h->revision);
} }
static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str) static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id); return sysfs_emit(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id);
} }
static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str) static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id); return sysfs_emit(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id);
} }
static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str) static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%d\n", h->oem_revision); return sysfs_emit(str, "%d\n", h->oem_revision);
} }
static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg, static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
...@@ -161,10 +161,10 @@ static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg, ...@@ -161,10 +161,10 @@ static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->asl_compiler_id); return sysfs_emit(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->asl_compiler_id);
} }
static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg, static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
...@@ -172,10 +172,10 @@ static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg, ...@@ -172,10 +172,10 @@ static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
if (!h) if (IS_ERR(h))
return -EINVAL; return PTR_ERR(h);
return sprintf(str, "%d\n", h->asl_compiler_revision); return sysfs_emit(str, "%d\n", h->asl_compiler_revision);
} }
CONFIGFS_ATTR_RO(acpi_table_, signature); CONFIGFS_ATTR_RO(acpi_table_, signature);
......
...@@ -220,8 +220,8 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type) ...@@ -220,8 +220,8 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
break; break;
default: default:
pr_err(FW_BUG "Invalid record %d found.\n", record_header->type); /* Other types are reserved in ACPI 6.4 spec. */
return -EINVAL; break;
} }
} }
return 0; return 0;
...@@ -254,8 +254,7 @@ static int __init acpi_init_fpdt(void) ...@@ -254,8 +254,7 @@ static int __init acpi_init_fpdt(void)
subtable->type); subtable->type);
break; break;
default: default:
pr_info(FW_BUG "Invalid subtable type %d found.\n", /* Other types are reserved in ACPI 6.4 spec. */
subtable->type);
break; break;
} }
offset += sizeof(*subtable); offset += sizeof(*subtable);
......
...@@ -249,12 +249,12 @@ static void set_power_saving_task_num(unsigned int num) ...@@ -249,12 +249,12 @@ static void set_power_saving_task_num(unsigned int num)
static void acpi_pad_idle_cpus(unsigned int num_cpus) static void acpi_pad_idle_cpus(unsigned int num_cpus)
{ {
get_online_cpus(); cpus_read_lock();
num_cpus = min_t(unsigned int, num_cpus, num_online_cpus()); num_cpus = min_t(unsigned int, num_cpus, num_online_cpus());
set_power_saving_task_num(num_cpus); set_power_saving_task_num(num_cpus);
put_online_cpus(); cpus_read_unlock();
} }
static uint32_t acpi_pad_idle_cpus_num(void) static uint32_t acpi_pad_idle_cpus_num(void)
......
...@@ -182,7 +182,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) ...@@ -182,7 +182,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
return -ENODEV; return -ENODEV;
cpu_maps_update_begin(); cpu_maps_update_begin();
cpu_hotplug_begin(); cpus_write_lock();
ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id); ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
if (ret) if (ret)
...@@ -203,7 +203,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) ...@@ -203,7 +203,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
pr->flags.need_hotplug_init = 1; pr->flags.need_hotplug_init = 1;
out: out:
cpu_hotplug_done(); cpus_write_unlock();
cpu_maps_update_done(); cpu_maps_update_done();
return ret; return ret;
} }
...@@ -454,13 +454,13 @@ static void acpi_processor_remove(struct acpi_device *device) ...@@ -454,13 +454,13 @@ static void acpi_processor_remove(struct acpi_device *device)
per_cpu(processors, pr->id) = NULL; per_cpu(processors, pr->id) = NULL;
cpu_maps_update_begin(); cpu_maps_update_begin();
cpu_hotplug_begin(); cpus_write_lock();
/* Remove the CPU. */ /* Remove the CPU. */
arch_unregister_cpu(pr->id); arch_unregister_cpu(pr->id);
acpi_unmap_cpu(pr->id); acpi_unmap_cpu(pr->id);
cpu_hotplug_done(); cpus_write_unlock();
cpu_maps_update_done(); cpu_maps_update_done();
try_offline_node(cpu_to_node(pr->id)); try_offline_node(cpu_to_node(pr->id));
......
...@@ -561,11 +561,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ...@@ -561,11 +561,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
op->common. op->common.
node->object, node->object,
NULL); NULL);
if ACPI_FAILURE if (ACPI_FAILURE(status)) {
(status) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"While writing to buffer field")); "While writing to buffer field"));
} }
} }
ACPI_FREE(namepath); ACPI_FREE(namepath);
status = AE_OK; status = AE_OK;
......
...@@ -498,24 +498,24 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -498,24 +498,24 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
acpi_evaluate_ost(handle, type, ost_code, NULL); acpi_evaluate_ost(handle, type, ost_code, NULL);
} }
static void acpi_device_notify(acpi_handle handle, u32 event, void *data) static void acpi_notify_device(acpi_handle handle, u32 event, void *data)
{ {
struct acpi_device *device = data; struct acpi_device *device = data;
device->driver->ops.notify(device, event); device->driver->ops.notify(device, event);
} }
static void acpi_device_notify_fixed(void *data) static void acpi_notify_device_fixed(void *data)
{ {
struct acpi_device *device = data; struct acpi_device *device = data;
/* Fixed hardware devices have no handles */ /* Fixed hardware devices have no handles */
acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); acpi_notify_device(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
} }
static u32 acpi_device_fixed_event(void *data) static u32 acpi_device_fixed_event(void *data)
{ {
acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data); acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_notify_device_fixed, data);
return ACPI_INTERRUPT_HANDLED; return ACPI_INTERRUPT_HANDLED;
} }
...@@ -536,7 +536,7 @@ static int acpi_device_install_notify_handler(struct acpi_device *device) ...@@ -536,7 +536,7 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
else else
status = acpi_install_notify_handler(device->handle, status = acpi_install_notify_handler(device->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_device_notify, acpi_notify_device,
device); device);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
...@@ -554,7 +554,7 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) ...@@ -554,7 +554,7 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
acpi_device_fixed_event); acpi_device_fixed_event);
else else
acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
acpi_device_notify); acpi_notify_device);
} }
/* Handle events targeting \_SB device (at present only graceful shutdown) */ /* Handle events targeting \_SB device (at present only graceful shutdown) */
......
...@@ -77,6 +77,17 @@ static const struct dmi_system_id dmi_lid_quirks[] = { ...@@ -77,6 +77,17 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
}, },
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED, .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED,
}, },
{
/*
* Lenovo Yoga 9 14ITL5, initial notification of the LID device
* never happens.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_NAME, "82BG"),
},
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
},
{ {
/* /*
* Medion Akoya E2215T, notification of the LID device only * Medion Akoya E2215T, notification of the LID device only
......
...@@ -90,15 +90,24 @@ static ssize_t name##_store(struct device *dev,\ ...@@ -90,15 +90,24 @@ static ssize_t name##_store(struct device *dev,\
PCH_FIVR_SHOW(freq_mhz_low_clock, GFC0) PCH_FIVR_SHOW(freq_mhz_low_clock, GFC0)
PCH_FIVR_SHOW(freq_mhz_high_clock, GFC1) PCH_FIVR_SHOW(freq_mhz_high_clock, GFC1)
PCH_FIVR_SHOW(ssc_clock_info, GEMI)
PCH_FIVR_SHOW(fivr_switching_freq_mhz, GFCS)
PCH_FIVR_SHOW(fivr_switching_fault_status, GFFS)
PCH_FIVR_STORE(freq_mhz_low_clock, RFC0) PCH_FIVR_STORE(freq_mhz_low_clock, RFC0)
PCH_FIVR_STORE(freq_mhz_high_clock, RFC1) PCH_FIVR_STORE(freq_mhz_high_clock, RFC1)
static DEVICE_ATTR_RW(freq_mhz_low_clock); static DEVICE_ATTR_RW(freq_mhz_low_clock);
static DEVICE_ATTR_RW(freq_mhz_high_clock); static DEVICE_ATTR_RW(freq_mhz_high_clock);
static DEVICE_ATTR_RO(ssc_clock_info);
static DEVICE_ATTR_RO(fivr_switching_freq_mhz);
static DEVICE_ATTR_RO(fivr_switching_fault_status);
static struct attribute *fivr_attrs[] = { static struct attribute *fivr_attrs[] = {
&dev_attr_freq_mhz_low_clock.attr, &dev_attr_freq_mhz_low_clock.attr,
&dev_attr_freq_mhz_high_clock.attr, &dev_attr_freq_mhz_high_clock.attr,
&dev_attr_ssc_clock_info.attr,
&dev_attr_fivr_switching_freq_mhz.attr,
&dev_attr_fivr_switching_fault_status.attr,
NULL NULL
}; };
......
...@@ -285,29 +285,27 @@ int acpi_unbind_one(struct device *dev) ...@@ -285,29 +285,27 @@ int acpi_unbind_one(struct device *dev)
} }
EXPORT_SYMBOL_GPL(acpi_unbind_one); EXPORT_SYMBOL_GPL(acpi_unbind_one);
static int acpi_device_notify(struct device *dev) void acpi_device_notify(struct device *dev)
{ {
struct acpi_bus_type *type = acpi_get_bus_type(dev); struct acpi_bus_type *type = acpi_get_bus_type(dev);
struct acpi_device *adev; struct acpi_device *adev;
int ret; int ret;
ret = acpi_bind_one(dev, NULL); ret = acpi_bind_one(dev, NULL);
if (ret && type) { if (ret) {
struct acpi_device *adev; if (!type)
goto err;
adev = type->find_companion(dev); adev = type->find_companion(dev);
if (!adev) { if (!adev) {
pr_debug("Unable to get handle for %s\n", dev_name(dev)); dev_dbg(dev, "ACPI companion not found\n");
ret = -ENODEV; goto err;
goto out;
} }
ret = acpi_bind_one(dev, adev); ret = acpi_bind_one(dev, adev);
if (ret) if (ret)
goto out; goto err;
} }
adev = ACPI_COMPANION(dev); adev = ACPI_COMPANION(dev);
if (!adev)
goto out;
if (dev_is_platform(dev)) if (dev_is_platform(dev))
acpi_configure_pmsi_domain(dev); acpi_configure_pmsi_domain(dev);
...@@ -317,27 +315,22 @@ static int acpi_device_notify(struct device *dev) ...@@ -317,27 +315,22 @@ static int acpi_device_notify(struct device *dev)
else if (adev->handler && adev->handler->bind) else if (adev->handler && adev->handler->bind)
adev->handler->bind(dev); adev->handler->bind(dev);
out: acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
if (!ret) { dev_name(dev));
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer); return;
pr_debug("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer);
kfree(buffer.pointer);
} else {
pr_debug("Device %s -> No ACPI support\n", dev_name(dev));
}
return ret; err:
dev_dbg(dev, "No ACPI support\n");
} }
static int acpi_device_notify_remove(struct device *dev) void acpi_device_notify_remove(struct device *dev)
{ {
struct acpi_device *adev = ACPI_COMPANION(dev); struct acpi_device *adev = ACPI_COMPANION(dev);
struct acpi_bus_type *type; struct acpi_bus_type *type;
if (!adev) if (!adev)
return 0; return;
type = acpi_get_bus_type(dev); type = acpi_get_bus_type(dev);
if (type && type->cleanup) if (type && type->cleanup)
...@@ -346,20 +339,4 @@ static int acpi_device_notify_remove(struct device *dev) ...@@ -346,20 +339,4 @@ static int acpi_device_notify_remove(struct device *dev)
adev->handler->unbind(dev); adev->handler->unbind(dev);
acpi_unbind_one(dev); acpi_unbind_one(dev);
return 0;
}
int acpi_platform_notify(struct device *dev, enum kobject_action action)
{
switch (action) {
case KOBJ_ADD:
acpi_device_notify(dev);
break;
case KOBJ_REMOVE:
acpi_device_notify_remove(dev);
break;
default:
break;
}
return 0;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
config ACPI_NUMA config ACPI_NUMA
bool "NUMA support" bool "NUMA support"
depends on NUMA depends on NUMA
depends on (X86 || IA64 || ARM64) depends on (X86 || IA64 || ARM64 || LOONGARCH)
default y if IA64 || ARM64 default y if IA64 || ARM64
config ACPI_HMAT config ACPI_HMAT
......
...@@ -206,7 +206,7 @@ int __init srat_disabled(void) ...@@ -206,7 +206,7 @@ int __init srat_disabled(void)
return acpi_numa < 0; return acpi_numa < 0;
} }
#if defined(CONFIG_X86) || defined(CONFIG_ARM64) #if defined(CONFIG_X86) || defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH)
/* /*
* Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for
* I/O localities since SRAT does not list them. I/O localities are * I/O localities since SRAT does not list them. I/O localities are
......
...@@ -284,7 +284,8 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) ...@@ -284,7 +284,8 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
#define should_use_kmap(pfn) page_is_ram(pfn) #define should_use_kmap(pfn) page_is_ram(pfn)
#endif #endif
static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz) static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz,
bool memory)
{ {
unsigned long pfn; unsigned long pfn;
...@@ -294,7 +295,8 @@ static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz) ...@@ -294,7 +295,8 @@ static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
return NULL; return NULL;
return (void __iomem __force *)kmap(pfn_to_page(pfn)); return (void __iomem __force *)kmap(pfn_to_page(pfn));
} else } else
return acpi_os_ioremap(pg_off, pg_sz); return memory ? acpi_os_memmap(pg_off, pg_sz) :
acpi_os_ioremap(pg_off, pg_sz);
} }
static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
...@@ -309,9 +311,10 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) ...@@ -309,9 +311,10 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
} }
/** /**
* acpi_os_map_iomem - Get a virtual address for a given physical address range. * __acpi_os_map_iomem - Get a virtual address for a given physical address range.
* @phys: Start of the physical address range to map. * @phys: Start of the physical address range to map.
* @size: Size of the physical address range to map. * @size: Size of the physical address range to map.
* @memory: true if remapping memory, false if IO
* *
* Look up the given physical address range in the list of existing ACPI memory * Look up the given physical address range in the list of existing ACPI memory
* mappings. If found, get a reference to it and return a pointer to it (its * mappings. If found, get a reference to it and return a pointer to it (its
...@@ -321,8 +324,8 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) ...@@ -321,8 +324,8 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
* During early init (when acpi_permanent_mmap has not been set yet) this * During early init (when acpi_permanent_mmap has not been set yet) this
* routine simply calls __acpi_map_table() to get the job done. * routine simply calls __acpi_map_table() to get the job done.
*/ */
void __iomem __ref static void __iomem __ref
*acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) *__acpi_os_map_iomem(acpi_physical_address phys, acpi_size size, bool memory)
{ {
struct acpi_ioremap *map; struct acpi_ioremap *map;
void __iomem *virt; void __iomem *virt;
...@@ -353,7 +356,7 @@ void __iomem __ref ...@@ -353,7 +356,7 @@ void __iomem __ref
pg_off = round_down(phys, PAGE_SIZE); pg_off = round_down(phys, PAGE_SIZE);
pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
virt = acpi_map(phys, size); virt = acpi_map(phys, size, memory);
if (!virt) { if (!virt) {
mutex_unlock(&acpi_ioremap_lock); mutex_unlock(&acpi_ioremap_lock);
kfree(map); kfree(map);
...@@ -372,11 +375,17 @@ void __iomem __ref ...@@ -372,11 +375,17 @@ void __iomem __ref
mutex_unlock(&acpi_ioremap_lock); mutex_unlock(&acpi_ioremap_lock);
return map->virt + (phys - map->phys); return map->virt + (phys - map->phys);
} }
void __iomem *__ref
acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
{
return __acpi_os_map_iomem(phys, size, false);
}
EXPORT_SYMBOL_GPL(acpi_os_map_iomem); EXPORT_SYMBOL_GPL(acpi_os_map_iomem);
void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size) void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
{ {
return (void *)acpi_os_map_iomem(phys, size); return (void *)__acpi_os_map_iomem(phys, size, true);
} }
EXPORT_SYMBOL_GPL(acpi_os_map_memory); EXPORT_SYMBOL_GPL(acpi_os_map_memory);
......
...@@ -106,6 +106,9 @@ static ssize_t platform_profile_store(struct device *dev, ...@@ -106,6 +106,9 @@ static ssize_t platform_profile_store(struct device *dev,
} }
err = cur_profile->profile_set(cur_profile, i); err = cur_profile->profile_set(cur_profile, i);
if (!err)
sysfs_notify(acpi_kobj, NULL, "platform_profile");
mutex_unlock(&profile_lock); mutex_unlock(&profile_lock);
if (err) if (err)
return err; return err;
......
...@@ -178,15 +178,17 @@ static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg, ...@@ -178,15 +178,17 @@ static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg,
{ {
int data, ret; int data, ret;
/* GPIO1 LDO regulator needs special handling */
if (reg == XPOWER_GPI1_CTRL)
return regmap_update_bits(regmap, reg, GPI1_LDO_MASK,
on ? GPI1_LDO_ON : GPI1_LDO_OFF);
ret = iosf_mbi_block_punit_i2c_access(); ret = iosf_mbi_block_punit_i2c_access();
if (ret) if (ret)
return ret; return ret;
/* GPIO1 LDO regulator needs special handling */
if (reg == XPOWER_GPI1_CTRL) {
ret = regmap_update_bits(regmap, reg, GPI1_LDO_MASK,
on ? GPI1_LDO_ON : GPI1_LDO_OFF);
goto out;
}
if (regmap_read(regmap, reg, &data)) { if (regmap_read(regmap, reg, &data)) {
ret = -EIO; ret = -EIO;
goto out; goto out;
...@@ -234,6 +236,11 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) ...@@ -234,6 +236,11 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
return ret; return ret;
if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) { if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) {
/*
* AXP288_ADC_TS_PIN_CTRL reads are cached by the regmap, so
* this does to a single I2C-transfer, and thus there is no
* need to explicitly call iosf_mbi_block_punit_i2c_access().
*/
ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL, ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL,
AXP288_ADC_TS_CURRENT_ON_OFF_MASK, AXP288_ADC_TS_CURRENT_ON_OFF_MASK,
AXP288_ADC_TS_CURRENT_ON_ONDEMAND); AXP288_ADC_TS_CURRENT_ON_ONDEMAND);
...@@ -244,6 +251,10 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) ...@@ -244,6 +251,10 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
usleep_range(6000, 10000); usleep_range(6000, 10000);
} }
ret = iosf_mbi_block_punit_i2c_access();
if (ret)
return ret;
ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2); ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2);
if (ret == 0) if (ret == 0)
ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f); ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f);
...@@ -254,6 +265,31 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) ...@@ -254,6 +265,31 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
AXP288_ADC_TS_CURRENT_ON); AXP288_ADC_TS_CURRENT_ON);
} }
iosf_mbi_unblock_punit_i2c_access();
return ret;
}
static int intel_xpower_exec_mipi_pmic_seq_element(struct regmap *regmap,
u16 i2c_address, u32 reg_address,
u32 value, u32 mask)
{
int ret;
if (i2c_address != 0x34) {
pr_err("%s: Unexpected i2c-addr: 0x%02x (reg-addr 0x%x value 0x%x mask 0x%x)\n",
__func__, i2c_address, reg_address, value, mask);
return -ENXIO;
}
ret = iosf_mbi_block_punit_i2c_access();
if (ret)
return ret;
ret = regmap_update_bits(regmap, reg_address, mask, value);
iosf_mbi_unblock_punit_i2c_access();
return ret; return ret;
} }
...@@ -261,6 +297,7 @@ static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = { ...@@ -261,6 +297,7 @@ static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = {
.get_power = intel_xpower_pmic_get_power, .get_power = intel_xpower_pmic_get_power,
.update_power = intel_xpower_pmic_update_power, .update_power = intel_xpower_pmic_update_power,
.get_raw_temp = intel_xpower_pmic_get_raw_temp, .get_raw_temp = intel_xpower_pmic_get_raw_temp,
.exec_mipi_pmic_seq_element = intel_xpower_exec_mipi_pmic_seq_element,
.power_table = power_table, .power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table), .power_table_count = ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
......
...@@ -48,7 +48,6 @@ struct acpi_power_dependent_device { ...@@ -48,7 +48,6 @@ struct acpi_power_dependent_device {
struct acpi_power_resource { struct acpi_power_resource {
struct acpi_device device; struct acpi_device device;
struct list_head list_node; struct list_head list_node;
char *name;
u32 system_level; u32 system_level;
u32 order; u32 order;
unsigned int ref_count; unsigned int ref_count;
...@@ -70,6 +69,11 @@ static DEFINE_MUTEX(power_resource_list_lock); ...@@ -70,6 +69,11 @@ static DEFINE_MUTEX(power_resource_list_lock);
Power Resource Management Power Resource Management
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static inline const char *resource_dev_name(struct acpi_power_resource *pr)
{
return dev_name(&pr->device.dev);
}
static inline static inline
struct acpi_power_resource *to_power_resource(struct acpi_device *device) struct acpi_power_resource *to_power_resource(struct acpi_device *device)
{ {
...@@ -264,7 +268,8 @@ acpi_power_resource_add_dependent(struct acpi_power_resource *resource, ...@@ -264,7 +268,8 @@ acpi_power_resource_add_dependent(struct acpi_power_resource *resource,
dep->dev = dev; dep->dev = dev;
list_add_tail(&dep->node, &resource->dependents); list_add_tail(&dep->node, &resource->dependents);
dev_dbg(dev, "added power dependency to [%s]\n", resource->name); dev_dbg(dev, "added power dependency to [%s]\n",
resource_dev_name(resource));
unlock: unlock:
mutex_unlock(&resource->resource_lock); mutex_unlock(&resource->resource_lock);
...@@ -283,7 +288,7 @@ acpi_power_resource_remove_dependent(struct acpi_power_resource *resource, ...@@ -283,7 +288,7 @@ acpi_power_resource_remove_dependent(struct acpi_power_resource *resource,
list_del(&dep->node); list_del(&dep->node);
kfree(dep); kfree(dep);
dev_dbg(dev, "removed power dependency to [%s]\n", dev_dbg(dev, "removed power dependency to [%s]\n",
resource->name); resource_dev_name(resource));
break; break;
} }
} }
...@@ -356,10 +361,11 @@ void acpi_device_power_remove_dependent(struct acpi_device *adev, ...@@ -356,10 +361,11 @@ void acpi_device_power_remove_dependent(struct acpi_device *adev,
static int __acpi_power_on(struct acpi_power_resource *resource) static int __acpi_power_on(struct acpi_power_resource *resource)
{ {
acpi_handle handle = resource->device.handle;
struct acpi_power_dependent_device *dep; struct acpi_power_dependent_device *dep;
acpi_status status = AE_OK; acpi_status status = AE_OK;
status = acpi_evaluate_object(resource->device.handle, "_ON", NULL, NULL); status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN; resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
return -ENODEV; return -ENODEV;
...@@ -367,7 +373,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource) ...@@ -367,7 +373,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
resource->state = ACPI_POWER_RESOURCE_STATE_ON; resource->state = ACPI_POWER_RESOURCE_STATE_ON;
pr_debug("Power resource [%s] turned on\n", resource->name); acpi_handle_debug(handle, "Power resource turned on\n");
/* /*
* If there are other dependents on this power resource we need to * If there are other dependents on this power resource we need to
...@@ -380,7 +386,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource) ...@@ -380,7 +386,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
list_for_each_entry(dep, &resource->dependents, node) { list_for_each_entry(dep, &resource->dependents, node) {
dev_dbg(dep->dev, "runtime resuming because [%s] turned on\n", dev_dbg(dep->dev, "runtime resuming because [%s] turned on\n",
resource->name); resource_dev_name(resource));
pm_request_resume(dep->dev); pm_request_resume(dep->dev);
} }
...@@ -392,7 +398,8 @@ static int acpi_power_on_unlocked(struct acpi_power_resource *resource) ...@@ -392,7 +398,8 @@ static int acpi_power_on_unlocked(struct acpi_power_resource *resource)
int result = 0; int result = 0;
if (resource->ref_count++) { if (resource->ref_count++) {
pr_debug("Power resource [%s] already on\n", resource->name); acpi_handle_debug(resource->device.handle,
"Power resource already on\n");
} else { } else {
result = __acpi_power_on(resource); result = __acpi_power_on(resource);
if (result) if (result)
...@@ -413,10 +420,10 @@ static int acpi_power_on(struct acpi_power_resource *resource) ...@@ -413,10 +420,10 @@ static int acpi_power_on(struct acpi_power_resource *resource)
static int __acpi_power_off(struct acpi_power_resource *resource) static int __acpi_power_off(struct acpi_power_resource *resource)
{ {
acpi_handle handle = resource->device.handle;
acpi_status status; acpi_status status;
status = acpi_evaluate_object(resource->device.handle, "_OFF", status = acpi_evaluate_object(handle, "_OFF", NULL, NULL);
NULL, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN; resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
return -ENODEV; return -ENODEV;
...@@ -424,7 +431,7 @@ static int __acpi_power_off(struct acpi_power_resource *resource) ...@@ -424,7 +431,7 @@ static int __acpi_power_off(struct acpi_power_resource *resource)
resource->state = ACPI_POWER_RESOURCE_STATE_OFF; resource->state = ACPI_POWER_RESOURCE_STATE_OFF;
pr_debug("Power resource [%s] turned off\n", resource->name); acpi_handle_debug(handle, "Power resource turned off\n");
return 0; return 0;
} }
...@@ -434,12 +441,14 @@ static int acpi_power_off_unlocked(struct acpi_power_resource *resource) ...@@ -434,12 +441,14 @@ static int acpi_power_off_unlocked(struct acpi_power_resource *resource)
int result = 0; int result = 0;
if (!resource->ref_count) { if (!resource->ref_count) {
pr_debug("Power resource [%s] already off\n", resource->name); acpi_handle_debug(resource->device.handle,
"Power resource already off\n");
return 0; return 0;
} }
if (--resource->ref_count) { if (--resource->ref_count) {
pr_debug("Power resource [%s] still in use\n", resource->name); acpi_handle_debug(resource->device.handle,
"Power resource still in use\n");
} else { } else {
result = __acpi_power_off(resource); result = __acpi_power_off(resource);
if (result) if (result)
...@@ -949,7 +958,6 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle) ...@@ -949,7 +958,6 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
mutex_init(&resource->resource_lock); mutex_init(&resource->resource_lock);
INIT_LIST_HEAD(&resource->list_node); INIT_LIST_HEAD(&resource->list_node);
INIT_LIST_HEAD(&resource->dependents); INIT_LIST_HEAD(&resource->dependents);
resource->name = device->pnp.bus_id;
strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_POWER_CLASS); strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
device->power.state = ACPI_STATE_UNKNOWN; device->power.state = ACPI_STATE_UNKNOWN;
...@@ -1004,7 +1012,7 @@ void acpi_resume_power_resources(void) ...@@ -1004,7 +1012,7 @@ void acpi_resume_power_resources(void)
if (state == ACPI_POWER_RESOURCE_STATE_OFF if (state == ACPI_POWER_RESOURCE_STATE_OFF
&& resource->ref_count) { && resource->ref_count) {
dev_dbg(&resource->device.dev, "Turning ON\n"); acpi_handle_debug(resource->device.handle, "Turning ON\n");
__acpi_power_on(resource); __acpi_power_on(resource);
} }
...@@ -1034,7 +1042,7 @@ void acpi_turn_off_unused_power_resources(void) ...@@ -1034,7 +1042,7 @@ void acpi_turn_off_unused_power_resources(void)
*/ */
if (!resource->ref_count && if (!resource->ref_count &&
resource->state != ACPI_POWER_RESOURCE_STATE_OFF) { resource->state != ACPI_POWER_RESOURCE_STATE_OFF) {
dev_dbg(&resource->device.dev, "Turning OFF\n"); acpi_handle_debug(resource->device.handle, "Turning OFF\n");
__acpi_power_off(resource); __acpi_power_off(resource);
} }
......
...@@ -1301,7 +1301,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr) ...@@ -1301,7 +1301,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) {
/* Protect against cpu-hotplug */ /* Protect against cpu-hotplug */
get_online_cpus(); cpus_read_lock();
cpuidle_pause_and_lock(); cpuidle_pause_and_lock();
/* Disable all cpuidle devices */ /* Disable all cpuidle devices */
...@@ -1330,7 +1330,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr) ...@@ -1330,7 +1330,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
} }
} }
cpuidle_resume_and_unlock(); cpuidle_resume_and_unlock();
put_online_cpus(); cpus_read_unlock();
} }
return 0; return 0;
......
...@@ -136,6 +136,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) ...@@ -136,6 +136,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
break; break;
case ACPI_DBG2_16550_COMPATIBLE: case ACPI_DBG2_16550_COMPATIBLE:
case ACPI_DBG2_16550_SUBSET: case ACPI_DBG2_16550_SUBSET:
case ACPI_DBG2_16550_WITH_GAS:
uart = "uart"; uart = "uart";
break; break;
default: default:
......
...@@ -202,3 +202,6 @@ int devtmpfs_delete_node(struct device *dev); ...@@ -202,3 +202,6 @@ int devtmpfs_delete_node(struct device *dev);
static inline int devtmpfs_create_node(struct device *dev) { return 0; } static inline int devtmpfs_create_node(struct device *dev) { return 0; }
static inline int devtmpfs_delete_node(struct device *dev) { return 0; } static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
#endif #endif
void software_node_notify(struct device *dev);
void software_node_notify_remove(struct device *dev);
...@@ -2002,24 +2002,24 @@ static inline int device_is_not_partition(struct device *dev) ...@@ -2002,24 +2002,24 @@ static inline int device_is_not_partition(struct device *dev)
} }
#endif #endif
static int static void device_platform_notify(struct device *dev)
device_platform_notify(struct device *dev, enum kobject_action action)
{ {
int ret; acpi_device_notify(dev);
ret = acpi_platform_notify(dev, action); software_node_notify(dev);
if (ret)
return ret;
ret = software_node_notify(dev, action); if (platform_notify)
if (ret)
return ret;
if (platform_notify && action == KOBJ_ADD)
platform_notify(dev); platform_notify(dev);
else if (platform_notify_remove && action == KOBJ_REMOVE) }
static void device_platform_notify_remove(struct device *dev)
{
acpi_device_notify_remove(dev);
software_node_notify_remove(dev);
if (platform_notify_remove)
platform_notify_remove(dev); platform_notify_remove(dev);
return 0;
} }
/** /**
...@@ -3292,9 +3292,7 @@ int device_add(struct device *dev) ...@@ -3292,9 +3292,7 @@ int device_add(struct device *dev)
} }
/* notify platform of device entry */ /* notify platform of device entry */
error = device_platform_notify(dev, KOBJ_ADD); device_platform_notify(dev);
if (error)
goto platform_error;
error = device_create_file(dev, &dev_attr_uevent); error = device_create_file(dev, &dev_attr_uevent);
if (error) if (error)
...@@ -3397,8 +3395,7 @@ int device_add(struct device *dev) ...@@ -3397,8 +3395,7 @@ int device_add(struct device *dev)
SymlinkError: SymlinkError:
device_remove_file(dev, &dev_attr_uevent); device_remove_file(dev, &dev_attr_uevent);
attrError: attrError:
device_platform_notify(dev, KOBJ_REMOVE); device_platform_notify_remove(dev);
platform_error:
kobject_uevent(&dev->kobj, KOBJ_REMOVE); kobject_uevent(&dev->kobj, KOBJ_REMOVE);
glue_dir = get_glue_dir(dev); glue_dir = get_glue_dir(dev);
kobject_del(&dev->kobj); kobject_del(&dev->kobj);
...@@ -3543,7 +3540,7 @@ void device_del(struct device *dev) ...@@ -3543,7 +3540,7 @@ void device_del(struct device *dev)
bus_remove_device(dev); bus_remove_device(dev);
device_pm_remove(dev); device_pm_remove(dev);
driver_deferred_probe_del(dev); driver_deferred_probe_del(dev);
device_platform_notify(dev, KOBJ_REMOVE); device_platform_notify_remove(dev);
device_remove_properties(dev); device_remove_properties(dev);
device_links_purge(dev); device_links_purge(dev);
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <linux/property.h> #include <linux/property.h>
#include <linux/slab.h> #include <linux/slab.h>
#include "base.h"
struct swnode { struct swnode {
struct kobject kobj; struct kobject kobj;
struct fwnode_handle fwnode; struct fwnode_handle fwnode;
...@@ -1053,7 +1055,7 @@ int device_add_software_node(struct device *dev, const struct software_node *nod ...@@ -1053,7 +1055,7 @@ int device_add_software_node(struct device *dev, const struct software_node *nod
* balance. * balance.
*/ */
if (device_is_registered(dev)) if (device_is_registered(dev))
software_node_notify(dev, KOBJ_ADD); software_node_notify(dev);
return 0; return 0;
} }
...@@ -1074,7 +1076,8 @@ void device_remove_software_node(struct device *dev) ...@@ -1074,7 +1076,8 @@ void device_remove_software_node(struct device *dev)
return; return;
if (device_is_registered(dev)) if (device_is_registered(dev))
software_node_notify(dev, KOBJ_REMOVE); software_node_notify_remove(dev);
set_secondary_fwnode(dev, NULL); set_secondary_fwnode(dev, NULL);
kobject_put(&swnode->kobj); kobject_put(&swnode->kobj);
} }
...@@ -1117,44 +1120,44 @@ int device_create_managed_software_node(struct device *dev, ...@@ -1117,44 +1120,44 @@ int device_create_managed_software_node(struct device *dev,
} }
EXPORT_SYMBOL_GPL(device_create_managed_software_node); EXPORT_SYMBOL_GPL(device_create_managed_software_node);
int software_node_notify(struct device *dev, unsigned long action) void software_node_notify(struct device *dev)
{ {
struct swnode *swnode; struct swnode *swnode;
int ret; int ret;
swnode = dev_to_swnode(dev); swnode = dev_to_swnode(dev);
if (!swnode) if (!swnode)
return 0; return;
switch (action) { ret = sysfs_create_link(&dev->kobj, &swnode->kobj, "software_node");
case KOBJ_ADD: if (ret)
ret = sysfs_create_link(&dev->kobj, &swnode->kobj, "software_node"); return;
if (ret)
break;
ret = sysfs_create_link(&swnode->kobj, &dev->kobj, ret = sysfs_create_link(&swnode->kobj, &dev->kobj, dev_name(dev));
dev_name(dev)); if (ret) {
if (ret) {
sysfs_remove_link(&dev->kobj, "software_node");
break;
}
kobject_get(&swnode->kobj);
break;
case KOBJ_REMOVE:
sysfs_remove_link(&swnode->kobj, dev_name(dev));
sysfs_remove_link(&dev->kobj, "software_node"); sysfs_remove_link(&dev->kobj, "software_node");
kobject_put(&swnode->kobj); return;
if (swnode->managed) {
set_secondary_fwnode(dev, NULL);
kobject_put(&swnode->kobj);
}
break;
default:
break;
} }
return 0; kobject_get(&swnode->kobj);
}
void software_node_notify_remove(struct device *dev)
{
struct swnode *swnode;
swnode = dev_to_swnode(dev);
if (!swnode)
return;
sysfs_remove_link(&swnode->kobj, dev_name(dev));
sysfs_remove_link(&dev->kobj, "software_node");
kobject_put(&swnode->kobj);
if (swnode->managed) {
set_secondary_fwnode(dev, NULL);
kobject_put(&swnode->kobj);
}
} }
static int __init software_node_init(void) static int __init software_node_init(void)
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define METHOD_NAME__CLS "_CLS" #define METHOD_NAME__CLS "_CLS"
#define METHOD_NAME__CRS "_CRS" #define METHOD_NAME__CRS "_CRS"
#define METHOD_NAME__DDN "_DDN" #define METHOD_NAME__DDN "_DDN"
#define METHOD_NAME__DIS "_DIS"
#define METHOD_NAME__DMA "_DMA" #define METHOD_NAME__DMA "_DMA"
#define METHOD_NAME__HID "_HID" #define METHOD_NAME__HID "_HID"
#define METHOD_NAME__INI "_INI" #define METHOD_NAME__INI "_INI"
......
...@@ -415,7 +415,7 @@ ...@@ -415,7 +415,7 @@
/* Conditional execution */ /* Conditional execution */
#define ACPI_DEBUG_EXEC(a) a #define ACPI_DEBUG_EXEC(a) a
#define ACPI_DEBUG_ONLY_MEMBERS(a) a; #define ACPI_DEBUG_ONLY_MEMBERS(a) a
#define _VERBOSE_STRUCTURES #define _VERBOSE_STRUCTURES
/* Various object display routines for debug */ /* Various object display routines for debug */
......
...@@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, ...@@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
} }
#endif #endif
#ifndef acpi_os_memmap
static inline void __iomem *acpi_os_memmap(acpi_physical_address phys,
acpi_size size)
{
return ioremap_cache(phys, size);
}
#endif
extern bool acpi_permanent_mmap; extern bool acpi_permanent_mmap;
void __iomem __ref void __iomem __ref
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20210604 #define ACPI_CA_VERSION 0x20210730
#include <acpi/acconfig.h> #include <acpi/acconfig.h>
#include <acpi/actypes.h> #include <acpi/actypes.h>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* file. Useful because they make it more difficult to inadvertently type in * file. Useful because they make it more difficult to inadvertently type in
* the wrong signature. * the wrong signature.
*/ */
#define ACPI_SIG_AEST "AEST" /* Arm Error Source Table */
#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ #define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */
#define ACPI_SIG_BGRT "BGRT" /* Boot Graphics Resource Table */ #define ACPI_SIG_BGRT "BGRT" /* Boot Graphics Resource Table */
...@@ -482,7 +483,7 @@ struct acpi_csrt_descriptor { ...@@ -482,7 +483,7 @@ struct acpi_csrt_descriptor {
* DBG2 - Debug Port Table 2 * DBG2 - Debug Port Table 2
* Version 0 (Both main table and subtables) * Version 0 (Both main table and subtables)
* *
* Conforms to "Microsoft Debug Port Table 2 (DBG2)", December 10, 2015 * Conforms to "Microsoft Debug Port Table 2 (DBG2)", September 21, 2020
* *
******************************************************************************/ ******************************************************************************/
...@@ -532,11 +533,24 @@ struct acpi_dbg2_device { ...@@ -532,11 +533,24 @@ struct acpi_dbg2_device {
#define ACPI_DBG2_16550_COMPATIBLE 0x0000 #define ACPI_DBG2_16550_COMPATIBLE 0x0000
#define ACPI_DBG2_16550_SUBSET 0x0001 #define ACPI_DBG2_16550_SUBSET 0x0001
#define ACPI_DBG2_MAX311XE_SPI 0x0002
#define ACPI_DBG2_ARM_PL011 0x0003 #define ACPI_DBG2_ARM_PL011 0x0003
#define ACPI_DBG2_MSM8X60 0x0004
#define ACPI_DBG2_16550_NVIDIA 0x0005
#define ACPI_DBG2_TI_OMAP 0x0006
#define ACPI_DBG2_APM88XXXX 0x0008
#define ACPI_DBG2_MSM8974 0x0009
#define ACPI_DBG2_SAM5250 0x000A
#define ACPI_DBG2_INTEL_USIF 0x000B
#define ACPI_DBG2_IMX6 0x000C
#define ACPI_DBG2_ARM_SBSA_32BIT 0x000D #define ACPI_DBG2_ARM_SBSA_32BIT 0x000D
#define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E #define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E
#define ACPI_DBG2_ARM_DCC 0x000F #define ACPI_DBG2_ARM_DCC 0x000F
#define ACPI_DBG2_BCM2835 0x0010 #define ACPI_DBG2_BCM2835 0x0010
#define ACPI_DBG2_SDM845_1_8432MHZ 0x0011
#define ACPI_DBG2_16550_WITH_GAS 0x0012
#define ACPI_DBG2_SDM845_7_372MHZ 0x0013
#define ACPI_DBG2_INTEL_LPSS 0x0014
#define ACPI_DBG2_1394_STANDARD 0x0000 #define ACPI_DBG2_1394_STANDARD 0x0000
......
...@@ -67,6 +67,176 @@ ...@@ -67,6 +67,176 @@
* See http://stackoverflow.com/a/1053662/41661 * See http://stackoverflow.com/a/1053662/41661
*/ */
/*******************************************************************************
*
* AEST - Arm Error Source Table
*
* Conforms to: ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document
* September 2020.
*
******************************************************************************/
struct acpi_table_aest {
struct acpi_table_header header;
void *node_array[];
};
/* Common Subtable header - one per Node Structure (Subtable) */
struct acpi_aest_hdr {
u8 type;
u16 length;
u8 reserved;
u32 node_specific_offset;
u32 node_interface_offset;
u32 node_interrupt_offset;
u32 node_interrupt_count;
u64 timestamp_rate;
u64 reserved1;
u64 error_injection_rate;
};
/* Values for Type above */
#define ACPI_AEST_PROCESSOR_ERROR_NODE 0
#define ACPI_AEST_MEMORY_ERROR_NODE 1
#define ACPI_AEST_SMMU_ERROR_NODE 2
#define ACPI_AEST_VENDOR_ERROR_NODE 3
#define ACPI_AEST_GIC_ERROR_NODE 4
#define ACPI_AEST_NODE_TYPE_RESERVED 5 /* 5 and above are reserved */
/*
* AEST subtables (Error nodes)
*/
/* 0: Processor Error */
typedef struct acpi_aest_processor {
u32 processor_id;
u8 resource_type;
u8 reserved;
u8 flags;
u8 revision;
u64 processor_affinity;
} acpi_aest_processor;
/* Values for resource_type above, related structs below */
#define ACPI_AEST_CACHE_RESOURCE 0
#define ACPI_AEST_TLB_RESOURCE 1
#define ACPI_AEST_GENERIC_RESOURCE 2
#define ACPI_AEST_RESOURCE_RESERVED 3 /* 3 and above are reserved */
/* 0R: Processor Cache Resource Substructure */
typedef struct acpi_aest_processor_cache {
u32 cache_reference;
u32 reserved;
} acpi_aest_processor_cache;
/* Values for cache_type above */
#define ACPI_AEST_CACHE_DATA 0
#define ACPI_AEST_CACHE_INSTRUCTION 1
#define ACPI_AEST_CACHE_UNIFIED 2
#define ACPI_AEST_CACHE_RESERVED 3 /* 3 and above are reserved */
/* 1R: Processor TLB Resource Substructure */
typedef struct acpi_aest_processor_tlb {
u32 tlb_level;
u32 reserved;
} acpi_aest_processor_tlb;
/* 2R: Processor Generic Resource Substructure */
typedef struct acpi_aest_processor_generic {
u8 *resource;
} acpi_aest_processor_generic;
/* 1: Memory Error */
typedef struct acpi_aest_memory {
u32 srat_proximity_domain;
} acpi_aest_memory;
/* 2: Smmu Error */
typedef struct acpi_aest_smmu {
u32 iort_node_reference;
u32 subcomponent_reference;
} acpi_aest_smmu;
/* 3: Vendor Defined */
typedef struct acpi_aest_vendor {
u32 acpi_hid;
u32 acpi_uid;
u8 vendor_specific_data[16];
} acpi_aest_vendor;
/* 4: Gic Error */
typedef struct acpi_aest_gic {
u32 interface_type;
u32 instance_id;
} acpi_aest_gic;
/* Values for interface_type above */
#define ACPI_AEST_GIC_CPU 0
#define ACPI_AEST_GIC_DISTRIBUTOR 1
#define ACPI_AEST_GIC_REDISTRIBUTOR 2
#define ACPI_AEST_GIC_ITS 3
#define ACPI_AEST_GIC_RESERVED 4 /* 4 and above are reserved */
/* Node Interface Structure */
typedef struct acpi_aest_node_interface {
u8 type;
u8 reserved[3];
u32 flags;
u64 address;
u32 error_record_index;
u32 error_record_count;
u64 error_record_implemented;
u64 error_status_reporting;
u64 addressing_mode;
} acpi_aest_node_interface;
/* Values for Type field above */
#define ACPI_AEST_NODE_SYSTEM_REGISTER 0
#define ACPI_AEST_NODE_MEMORY_MAPPED 1
#define ACPI_AEST_XFACE_RESERVED 2 /* 2 and above are reserved */
/* Node Interrupt Structure */
typedef struct acpi_aest_node_interrupt {
u8 type;
u8 reserved[2];
u8 flags;
u32 gsiv;
u8 iort_id;
u8 reserved1[3];
} acpi_aest_node_interrupt;
/* Values for Type field above */
#define ACPI_AEST_NODE_FAULT_HANDLING 0
#define ACPI_AEST_NODE_ERROR_RECOVERY 1
#define ACPI_AEST_XRUPT_RESERVED 2 /* 2 and above are reserved */
/******************************************************************************* /*******************************************************************************
* *
* BDAT - BIOS Data ACPI Table * BDAT - BIOS Data ACPI Table
......
...@@ -723,6 +723,10 @@ struct acpi_table_wpbt { ...@@ -723,6 +723,10 @@ struct acpi_table_wpbt {
u16 arguments_length; u16 arguments_length;
}; };
struct acpi_wpbt_unicode {
u16 *unicode_string;
};
/******************************************************************************* /*******************************************************************************
* *
* WSMT - Windows SMM Security Mitigations Table * WSMT - Windows SMM Security Mitigations Table
......
...@@ -249,7 +249,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); ...@@ -249,7 +249,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
/* the following numa functions are architecture-dependent */ /* the following numa functions are architecture-dependent */
void acpi_numa_slit_init (struct acpi_table_slit *slit); void acpi_numa_slit_init (struct acpi_table_slit *slit);
#if defined(CONFIG_X86) || defined(CONFIG_IA64) #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_LOONGARCH)
void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
#else #else
static inline void static inline void
...@@ -1380,13 +1380,11 @@ static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) ...@@ -1380,13 +1380,11 @@ static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
#endif #endif
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
extern int acpi_platform_notify(struct device *dev, enum kobject_action action); extern void acpi_device_notify(struct device *dev);
extern void acpi_device_notify_remove(struct device *dev);
#else #else
static inline int static inline void acpi_device_notify(struct device *dev) { }
acpi_platform_notify(struct device *dev, enum kobject_action action) static inline void acpi_device_notify_remove(struct device *dev) { }
{
return 0;
}
#endif #endif
#endif /*_LINUX_ACPI_H*/ #endif /*_LINUX_ACPI_H*/
...@@ -484,8 +484,6 @@ void software_node_unregister_node_group(const struct software_node **node_group ...@@ -484,8 +484,6 @@ void software_node_unregister_node_group(const struct software_node **node_group
int software_node_register(const struct software_node *node); int software_node_register(const struct software_node *node);
void software_node_unregister(const struct software_node *node); void software_node_unregister(const struct software_node *node);
int software_node_notify(struct device *dev, unsigned long action);
struct fwnode_handle * struct fwnode_handle *
fwnode_create_software_node(const struct property_entry *properties, fwnode_create_software_node(const struct property_entry *properties,
const struct fwnode_handle *parent); const struct fwnode_handle *parent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment