mirror of https://gitee.com/openkylin/linux.git
Merge branches 'acpi-tables', 'acpi-bus' and 'acpi-processor'
* acpi-tables: ACPI: SPCR: Make SPCR available to x86 ACPI / tables: Add IORT to injectable table list * acpi-bus: ACPI / bus: Parse tables as term_list for Dell XPS 9570 and Precision M5530 ACPI / scan: Use acpi_bus_get_status() to initialize ACPI_TYPE_DEVICE devs ACPI / bus: Do not call _STA on battery devices with unmet dependencies PCI: acpiphp_ibm: prepare for acpi_get_object_info() no longer returning status ACPI: export acpi_bus_get_status_handle() * acpi-processor: ACPI / processor: Set default C1 idle state description ACPI: processor_perflib: Do not send _PPC change notification if not ready
This commit is contained in:
commit
3c9c75de4c
|
@ -917,9 +917,12 @@
|
|||
|
||||
earlycon= [KNL] Output early console device and options.
|
||||
|
||||
When used with no options, the early console is
|
||||
determined by the stdout-path property in device
|
||||
tree's chosen node.
|
||||
[ARM64] The early console is determined by the
|
||||
stdout-path property in device tree's chosen node,
|
||||
or determined by the ACPI SPCR table.
|
||||
|
||||
[X86] When used with no options the early console is
|
||||
determined by the ACPI SPCR table.
|
||||
|
||||
cdns,<addr>[,options]
|
||||
Start an early, polled-mode console on a Cadence
|
||||
|
|
|
@ -230,10 +230,10 @@ void __init acpi_boot_table_init(void)
|
|||
|
||||
done:
|
||||
if (acpi_disabled) {
|
||||
if (earlycon_init_is_deferred)
|
||||
if (earlycon_acpi_spcr_enable)
|
||||
early_init_dt_scan_chosen_stdout();
|
||||
} else {
|
||||
parse_spcr(earlycon_init_is_deferred);
|
||||
acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
|
||||
if (IS_ENABLED(CONFIG_ACPI_BGRT))
|
||||
acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <linux/ioport.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/efi-bgrt.h>
|
||||
#include <linux/serial_core.h>
|
||||
|
||||
#include <asm/e820/api.h>
|
||||
#include <asm/irqdomain.h>
|
||||
|
@ -1625,6 +1626,8 @@ int __init acpi_boot_init(void)
|
|||
if (!acpi_noirq)
|
||||
x86_init.pci.init = pci_acpi_init;
|
||||
|
||||
/* Do not enable ACPI SPCR console by default */
|
||||
acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,12 @@ config ACPI_DEBUGGER_USER
|
|||
endif
|
||||
|
||||
config ACPI_SPCR_TABLE
|
||||
bool
|
||||
bool "ACPI Serial Port Console Redirection Support"
|
||||
default y if X86
|
||||
help
|
||||
Enable support for Serial Port Console Redirection (SPCR) Table.
|
||||
This table provides information about the configuration of the
|
||||
earlycon console.
|
||||
|
||||
config ACPI_LPIT
|
||||
bool
|
||||
|
|
|
@ -66,10 +66,37 @@ static int set_copy_dsdt(const struct dmi_system_id *id)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int set_gbl_term_list(const struct dmi_system_id *id)
|
||||
{
|
||||
acpi_gbl_parse_table_as_term_list = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
|
||||
static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {
|
||||
/*
|
||||
* Touchpad on Dell XPS 9570/Precision M5530 doesn't work under I2C
|
||||
* mode.
|
||||
* https://bugzilla.kernel.org/show_bug.cgi?id=198515
|
||||
*/
|
||||
{
|
||||
.callback = set_gbl_term_list,
|
||||
.ident = "Dell Precision M5530",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "Precision M5530"),
|
||||
},
|
||||
},
|
||||
{
|
||||
.callback = set_gbl_term_list,
|
||||
.ident = "Dell XPS 15 9570",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "XPS 15 9570"),
|
||||
},
|
||||
},
|
||||
/*
|
||||
* Invoke DSDT corruption work-around on all Toshiba Satellite.
|
||||
* DSDT will be copied to memory.
|
||||
* https://bugzilla.kernel.org/show_bug.cgi?id=14679
|
||||
*/
|
||||
{
|
||||
|
@ -83,7 +110,7 @@ static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
|
|||
{}
|
||||
};
|
||||
#else
|
||||
static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
|
||||
static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
@ -108,6 +135,7 @@ acpi_status acpi_bus_get_status_handle(acpi_handle handle,
|
|||
}
|
||||
return status;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_bus_get_status_handle);
|
||||
|
||||
int acpi_bus_get_status(struct acpi_device *device)
|
||||
{
|
||||
|
@ -119,6 +147,12 @@ int acpi_bus_get_status(struct acpi_device *device)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Battery devices must have their deps met before calling _STA */
|
||||
if (acpi_device_is_battery(device) && device->dep_unmet) {
|
||||
acpi_set_device_status(device, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = acpi_bus_get_status_handle(device->handle, &sta);
|
||||
if (ACPI_FAILURE(status))
|
||||
return -ENODEV;
|
||||
|
@ -1001,11 +1035,8 @@ void __init acpi_early_init(void)
|
|||
|
||||
acpi_permanent_mmap = true;
|
||||
|
||||
/*
|
||||
* If the machine falls into the DMI check table,
|
||||
* DSDT will be copied to memory
|
||||
*/
|
||||
dmi_check_system(dsdt_dmi_table);
|
||||
/* Check machine-specific quirks */
|
||||
dmi_check_system(acpi_quirks_dmi_table);
|
||||
|
||||
status = acpi_reallocate_root_table();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
|
|
@ -291,6 +291,9 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr)
|
|||
pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
|
||||
pr->power.states[ACPI_STATE_C1].valid = 1;
|
||||
pr->power.states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_HALT;
|
||||
|
||||
snprintf(pr->power.states[ACPI_STATE_C1].desc,
|
||||
ACPI_CX_DESC_LEN, "ACPI HLT");
|
||||
}
|
||||
/* the C0 state only exists as a filler in our array */
|
||||
pr->power.states[ACPI_STATE_C0].valid = 1;
|
||||
|
|
|
@ -159,7 +159,7 @@ void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (ignore_ppc) {
|
||||
if (ignore_ppc || !pr->performance) {
|
||||
/*
|
||||
* Only when it is notification event, the _OST object
|
||||
* will be evaluated. Otherwise it is skipped.
|
||||
|
|
|
@ -1565,6 +1565,8 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
|||
device_initialize(&device->dev);
|
||||
dev_set_uevent_suppress(&device->dev, true);
|
||||
acpi_init_coherency(device);
|
||||
/* Assume there are unmet deps until acpi_device_dep_initialize() runs */
|
||||
device->dep_unmet = 1;
|
||||
}
|
||||
|
||||
void acpi_device_add_finalize(struct acpi_device *device)
|
||||
|
@ -1588,6 +1590,14 @@ static int acpi_add_single_object(struct acpi_device **child,
|
|||
}
|
||||
|
||||
acpi_init_device_object(device, handle, type, sta);
|
||||
/*
|
||||
* For ACPI_BUS_TYPE_DEVICE getting the status is delayed till here so
|
||||
* that we can call acpi_bus_get_status() and use its quirk handling.
|
||||
* Note this must be done before the get power-/wakeup_dev-flags calls.
|
||||
*/
|
||||
if (type == ACPI_BUS_TYPE_DEVICE)
|
||||
acpi_bus_get_status(device);
|
||||
|
||||
acpi_bus_get_power_flags(device);
|
||||
acpi_bus_get_wakeup_device_flags(device);
|
||||
|
||||
|
@ -1660,9 +1670,11 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type,
|
|||
return -ENODEV;
|
||||
|
||||
*type = ACPI_BUS_TYPE_DEVICE;
|
||||
status = acpi_bus_get_status_handle(handle, sta);
|
||||
if (ACPI_FAILURE(status))
|
||||
*sta = 0;
|
||||
/*
|
||||
* acpi_add_single_object updates this once we've an acpi_device
|
||||
* so that acpi_bus_get_status' quirk handling can be used.
|
||||
*/
|
||||
*sta = 0;
|
||||
break;
|
||||
case ACPI_TYPE_PROCESSOR:
|
||||
*type = ACPI_BUS_TYPE_PROCESSOR;
|
||||
|
@ -1760,6 +1772,8 @@ static void acpi_device_dep_initialize(struct acpi_device *adev)
|
|||
acpi_status status;
|
||||
int i;
|
||||
|
||||
adev->dep_unmet = 0;
|
||||
|
||||
if (!acpi_has_method(adev->handle, "_DEP"))
|
||||
return;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* occasionally getting stuck as 1. To avoid the potential for a hang, check
|
||||
* TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
|
||||
* implementations, so only do so if an affected platform is detected in
|
||||
* parse_spcr().
|
||||
* acpi_parse_spcr().
|
||||
*/
|
||||
bool qdf2400_e44_present;
|
||||
EXPORT_SYMBOL(qdf2400_e44_present);
|
||||
|
@ -74,19 +74,21 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
|
|||
}
|
||||
|
||||
/**
|
||||
* parse_spcr() - parse ACPI SPCR table and add preferred console
|
||||
* acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
|
||||
*
|
||||
* @earlycon: set up earlycon for the console specified by the table
|
||||
* @enable_earlycon: set up earlycon for the console specified by the table
|
||||
* @enable_console: setup the console specified by the table.
|
||||
*
|
||||
* For the architectures with support for ACPI, CONFIG_ACPI_SPCR_TABLE may be
|
||||
* defined to parse ACPI SPCR table. As a result of the parsing preferred
|
||||
* console is registered and if @earlycon is true, earlycon is set up.
|
||||
* console is registered and if @enable_earlycon is true, earlycon is set up.
|
||||
* If @enable_console is true the system console is also configured.
|
||||
*
|
||||
* When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
|
||||
* from arch initialization code as soon as the DT/ACPI decision is made.
|
||||
*
|
||||
*/
|
||||
int __init parse_spcr(bool earlycon)
|
||||
int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
|
||||
{
|
||||
static char opts[64];
|
||||
struct acpi_table_spcr *table;
|
||||
|
@ -105,11 +107,8 @@ int __init parse_spcr(bool earlycon)
|
|||
if (ACPI_FAILURE(status))
|
||||
return -ENOENT;
|
||||
|
||||
if (table->header.revision < 2) {
|
||||
err = -ENOENT;
|
||||
pr_err("wrong table version\n");
|
||||
goto done;
|
||||
}
|
||||
if (table->header.revision < 2)
|
||||
pr_info("SPCR table version %d\n", table->header.revision);
|
||||
|
||||
if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
|
||||
switch (ACPI_ACCESS_BIT_WIDTH((
|
||||
|
@ -185,7 +184,7 @@ int __init parse_spcr(bool earlycon)
|
|||
*/
|
||||
if (qdf2400_erratum_44_present(&table->header)) {
|
||||
qdf2400_e44_present = true;
|
||||
if (earlycon)
|
||||
if (enable_earlycon)
|
||||
uart = "qdf2400_e44";
|
||||
}
|
||||
|
||||
|
@ -205,11 +204,13 @@ int __init parse_spcr(bool earlycon)
|
|||
|
||||
pr_info("console: %s\n", opts);
|
||||
|
||||
if (earlycon)
|
||||
if (enable_earlycon)
|
||||
setup_earlycon(opts);
|
||||
|
||||
err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
|
||||
|
||||
if (enable_console)
|
||||
err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
|
||||
else
|
||||
err = 0;
|
||||
done:
|
||||
acpi_put_table((struct acpi_table_header *)table);
|
||||
return err;
|
||||
|
|
|
@ -456,7 +456,8 @@ static const char * const table_sigs[] = {
|
|||
ACPI_SIG_SLIC, ACPI_SIG_SPCR, ACPI_SIG_SPMI, ACPI_SIG_TCPA,
|
||||
ACPI_SIG_UEFI, ACPI_SIG_WAET, ACPI_SIG_WDAT, ACPI_SIG_WDDT,
|
||||
ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_PSDT,
|
||||
ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, NULL };
|
||||
ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, ACPI_SIG_IORT,
|
||||
NULL };
|
||||
|
||||
#define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)
|
||||
|
||||
|
|
|
@ -399,6 +399,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
|
|||
u32 lvl, void *context, void **rv)
|
||||
{
|
||||
acpi_handle *phandle = (acpi_handle *)context;
|
||||
unsigned long long current_status = 0;
|
||||
acpi_status status;
|
||||
struct acpi_device_info *info;
|
||||
int retval = 0;
|
||||
|
@ -410,7 +411,9 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
|
|||
return retval;
|
||||
}
|
||||
|
||||
if (info->current_status && (info->valid & ACPI_VALID_HID) &&
|
||||
acpi_bus_get_status_handle(handle, ¤t_status);
|
||||
|
||||
if (current_status && (info->valid & ACPI_VALID_HID) &&
|
||||
(!strcmp(info->hardware_id.string, IBM_HARDWARE_ID1) ||
|
||||
!strcmp(info->hardware_id.string, IBM_HARDWARE_ID2))) {
|
||||
pr_debug("found hardware: %s, handle: %p\n",
|
||||
|
|
|
@ -197,25 +197,20 @@ int __init setup_earlycon(char *buf)
|
|||
}
|
||||
|
||||
/*
|
||||
* When CONFIG_ACPI_SPCR_TABLE is defined, "earlycon" without parameters in
|
||||
* command line does not start DT earlycon immediately, instead it defers
|
||||
* starting it until DT/ACPI decision is made. At that time if ACPI is enabled
|
||||
* call parse_spcr(), else call early_init_dt_scan_chosen_stdout()
|
||||
* This defers the initialization of the early console until after ACPI has
|
||||
* been initialized.
|
||||
*/
|
||||
bool earlycon_init_is_deferred __initdata;
|
||||
bool earlycon_acpi_spcr_enable __initdata;
|
||||
|
||||
/* early_param wrapper for setup_earlycon() */
|
||||
static int __init param_setup_earlycon(char *buf)
|
||||
{
|
||||
int err;
|
||||
|
||||
/*
|
||||
* Just 'earlycon' is a valid param for devicetree earlycons;
|
||||
* don't generate a warning from parse_early_params() in that case
|
||||
*/
|
||||
/* Just 'earlycon' is a valid param for devicetree and ACPI SPCR. */
|
||||
if (!buf || !buf[0]) {
|
||||
if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
|
||||
earlycon_init_is_deferred = true;
|
||||
earlycon_acpi_spcr_enable = true;
|
||||
return 0;
|
||||
} else if (!buf) {
|
||||
return early_init_dt_scan_chosen_stdout();
|
||||
|
|
|
@ -1249,9 +1249,12 @@ static inline bool acpi_has_watchdog(void) { return false; }
|
|||
|
||||
#ifdef CONFIG_ACPI_SPCR_TABLE
|
||||
extern bool qdf2400_e44_present;
|
||||
int parse_spcr(bool earlycon);
|
||||
int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
|
||||
#else
|
||||
static inline int parse_spcr(bool earlycon) { return 0; }
|
||||
static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
|
||||
|
|
|
@ -376,10 +376,10 @@ extern int of_setup_earlycon(const struct earlycon_id *match,
|
|||
const char *options);
|
||||
|
||||
#ifdef CONFIG_SERIAL_EARLYCON
|
||||
extern bool earlycon_init_is_deferred __initdata;
|
||||
extern bool earlycon_acpi_spcr_enable __initdata;
|
||||
int setup_earlycon(char *buf);
|
||||
#else
|
||||
static const bool earlycon_init_is_deferred;
|
||||
static const bool earlycon_acpi_spcr_enable;
|
||||
static inline int setup_earlycon(char *buf) { return 0; }
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue