You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'acpi-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki:
"First off, the ACPICA code in the kernel is updated to upstream
revision 20160831 that brings in a few bug fixes and cleanups. In
particular, it is possible to mask GPEs now (and the sysfs interface
for GPE control is fixed on top of that), problems related to the
table loading mechanism are fixed and all code related to FADT version
2 (which has never been part of the ACPI specification) is dropped.
On the new features front, there is a new watchdog driver based on the
ACPI WDAT (ACPI Watchdog Action Table), needed on some platforms to
replace the iTCO watchdog that doesn't work there, and some UART
devices get new definitions of built-in properties (to be accessed via
the generic device properties API).
Also, included is a fix for an ACPI-related PCI resorces allocation
issue and a few problems in the EC driver and in the button and
battery drivers are fixed.
In addition to that, the ACPI CPPC library is updated to make batching
of requests sent over the PCC channel possible (which reduces the PCC
usage overhead substantially in some cases) and to support functional
fixed hardware (FFH) type of CPPC registers access (which will allow
CPPC to be used on x86 too in the future).
As usual, there are some assorted fixes and cleanups too.
Specifics:
- Update of the ACPICA code in the kernel to upstream revision
20160831 with the following major changes:
* New mechanism for GPE masking.
* Fixes for issues related to the LoadTable operator and table
loading.
* Fixes for issues related to so-called module-level code (MLC),
that is AML that doesn't belong to any methods.
* Change of the return value of the _OSI method to reflect the
Windows behavior.
* GAS (Generic Address Structure) support fix related to 32-bit
FADT addresses.
* Elimination of unnecessary FADT version 2 support.
* ACPI tools fixes and cleanups.
From Bob Moore, Lv Zheng, and Jung-uk Kim.
- ACPI sysfs interface updates to fix GPE handling (on top of the new
GPE masking mechanism in ACPICA) and issues related to table
loading (Lv Zheng).
- New watchdog driver based on the ACPI WDAT (ACPI Watchdog Action
Table), needed on some platforms to replace the iTCO watchdog that
doesn't work there and related updates of the intel_pmc_ipc,
i2c/i801 and MFD/lcp_ich drivers (Mika Westerberg).
- Driver core fix to prevent it from leaking secondary fwnode objects
during device removal (Lukas Wunner).
- New definitions of built-in properties for UART in ACPI-based x86
SoC drivers and a 8250_dw driver quirk for the APM X-Gene SoC
(Heikki Krogerus).
- New device ID for the Vulcan SPI controller and constification of
local strucures in the AMD SoC (APD) ACPI driver (Kamlakant Patel,
Julia Lawall).
- Fix for a bug causing the allocation of PCI resorces to fail if
ACPI-enumerated child platform devices are registered below the PCI
devices in question (Mika Westerberg).
- Change of the default polarity for PCI legacy IRQs to high on
systems booting wth ACPI on platforms with a GIC interrupt
controller model fixing the discrepancy between the specification
and HW behavior (Lorenzo Pieralisi).
- Fixes for the handling of system suspend/resume in the ACPI EC
driver and update of that driver to make it cope with the cases
when the EC device defined in the ECDT has to be used throughout
the entire system life cycle (Lv Zheng).
- Update of the ACPI CPPC library to allow it to batch requests sent
over the PCC channel (to reduce overhead), to support the fixed
functional hardware (FFH) CPPC registers access type, to notify the
mailbox framework about TX completions when the interrupt flag is
set for the PCC mailbox, and to support HW-Reduced Communication
Subspace type 2 (Ashwin Chaugule, Prashanth Prakash, Srinivas
Pandruvada, Hoan Tran).
- ACPI button driver fix and documentation update related to the
handling of laptop lids (Lv Zheng).
- ACPI battery driver initialization fix (Carlos Garnacho).
- ACPI GPIO enumeration documentation update (Mika Westerberg).
- Assorted updates of the core ACPI bus type code (Lukas Wunner, Lv
Zheng).
- Assorted cleanups of the ACPI table parsing code and the
x86-specific ACPI code (Al Stone).
- Fixes for assorted ACPI-related issues found in linux-next (Wei
Yongjun)"
* tag 'acpi-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (98 commits)
ACPI / documentation: Use recommended name in GPIO property names
watchdog: wdat_wdt: Fix warning for using 0 as NULL
watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
platform/x86: intel_pmc_ipc: Do not create iTCO watchdog when WDAT table exists
i2c: i801: Do not create iTCO watchdog when WDAT table exists
mfd: lpc_ich: Do not create iTCO watchdog when WDAT table exists
ACPI / bus: Adjust ACPI subsystem initialization for new table loading mode
ACPICA: Parser: Fix a regression in LoadTable support
ACPICA: Tables: Fix "UNLOAD" code path lock issues
ACPI / watchdog: Add support for WDAT hardware watchdog
ACPI / platform: Pay attention to parent device's resources
PCI: Add pci_find_resource()
ACPI / CPPC: Support PCC with interrupt flag
ACPI / sysfs: Update sysfs signature handling code
ACPI / sysfs: Fix an issue for LoadTable opcode
ACPICA: Tables: Fix a regression in acpi_tb_find_table()
ACPI / tables: Remove duplicated include from tables.c
ACPI / APD: constify local structures
x86: ACPI: make variable names clearer in acpi_parse_madt_lapic_entries()
x86: ACPI: remove extraneous white space after semicolon
...
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
Special Usage Model of the ACPI Control Method Lid Device
|
||||
|
||||
Copyright (C) 2016, Intel Corporation
|
||||
Author: Lv Zheng <lv.zheng@intel.com>
|
||||
|
||||
|
||||
Abstract:
|
||||
|
||||
Platforms containing lids convey lid state (open/close) to OSPMs using a
|
||||
control method lid device. To implement this, the AML tables issue
|
||||
Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has
|
||||
changed. The _LID control method for the lid device must be implemented to
|
||||
report the "current" state of the lid as either "opened" or "closed".
|
||||
|
||||
For most platforms, both the _LID method and the lid notifications are
|
||||
reliable. However, there are exceptions. In order to work with these
|
||||
exceptional buggy platforms, special restrictions and expections should be
|
||||
taken into account. This document describes the restrictions and the
|
||||
expections of the Linux ACPI lid device driver.
|
||||
|
||||
|
||||
1. Restrictions of the returning value of the _LID control method
|
||||
|
||||
The _LID control method is described to return the "current" lid state.
|
||||
However the word of "current" has ambiguity, some buggy AML tables return
|
||||
the lid state upon the last lid notification instead of returning the lid
|
||||
state upon the last _LID evaluation. There won't be difference when the
|
||||
_LID control method is evaluated during the runtime, the problem is its
|
||||
initial returning value. When the AML tables implement this control method
|
||||
with cached value, the initial returning value is likely not reliable.
|
||||
There are platforms always retun "closed" as initial lid state.
|
||||
|
||||
2. Restrictions of the lid state change notifications
|
||||
|
||||
There are buggy AML tables never notifying when the lid device state is
|
||||
changed to "opened". Thus the "opened" notification is not guaranteed. But
|
||||
it is guaranteed that the AML tables always notify "closed" when the lid
|
||||
state is changed to "closed". The "closed" notification is normally used to
|
||||
trigger some system power saving operations on Windows. Since it is fully
|
||||
tested, it is reliable from all AML tables.
|
||||
|
||||
3. Expections for the userspace users of the ACPI lid device driver
|
||||
|
||||
The ACPI button driver exports the lid state to the userspace via the
|
||||
following file:
|
||||
/proc/acpi/button/lid/LID0/state
|
||||
This file actually calls the _LID control method described above. And given
|
||||
the previous explanation, it is not reliable enough on some platforms. So
|
||||
it is advised for the userspace program to not to solely rely on this file
|
||||
to determine the actual lid state.
|
||||
|
||||
The ACPI button driver emits the following input event to the userspace:
|
||||
SW_LID
|
||||
The ACPI lid device driver is implemented to try to deliver the platform
|
||||
triggered events to the userspace. However, given the fact that the buggy
|
||||
firmware cannot make sure "opened"/"closed" events are paired, the ACPI
|
||||
button driver uses the following 3 modes in order not to trigger issues.
|
||||
|
||||
If the userspace hasn't been prepared to ignore the unreliable "opened"
|
||||
events and the unreliable initial state notification, Linux users can use
|
||||
the following kernel parameters to handle the possible issues:
|
||||
A. button.lid_init_state=method:
|
||||
When this option is specified, the ACPI button driver reports the
|
||||
initial lid state using the returning value of the _LID control method
|
||||
and whether the "opened"/"closed" events are paired fully relies on the
|
||||
firmware implementation.
|
||||
This option can be used to fix some platforms where the returning value
|
||||
of the _LID control method is reliable but the initial lid state
|
||||
notification is missing.
|
||||
This option is the default behavior during the period the userspace
|
||||
isn't ready to handle the buggy AML tables.
|
||||
B. button.lid_init_state=open:
|
||||
When this option is specified, the ACPI button driver always reports the
|
||||
initial lid state as "opened" and whether the "opened"/"closed" events
|
||||
are paired fully relies on the firmware implementation.
|
||||
This may fix some platforms where the returning value of the _LID
|
||||
control method is not reliable and the initial lid state notification is
|
||||
missing.
|
||||
|
||||
If the userspace has been prepared to ignore the unreliable "opened" events
|
||||
and the unreliable initial state notification, Linux users should always
|
||||
use the following kernel parameter:
|
||||
C. button.lid_init_state=ignore:
|
||||
When this option is specified, the ACPI button driver never reports the
|
||||
initial lid state and there is a compensation mechanism implemented to
|
||||
ensure that the reliable "closed" notifications can always be delievered
|
||||
to the userspace by always pairing "closed" input events with complement
|
||||
"opened" input events. But there is still no guarantee that the "opened"
|
||||
notifications can be delivered to the userspace when the lid is actually
|
||||
opens given that some AML tables do not send "opened" notifications
|
||||
reliably.
|
||||
In this mode, if everything is correctly implemented by the platform
|
||||
firmware, the old userspace programs should still work. Otherwise, the
|
||||
new userspace programs are required to work with the ACPI button driver.
|
||||
This option will be the default behavior after the userspace is ready to
|
||||
handle the buggy AML tables.
|
||||
@@ -28,8 +28,8 @@ index, like the ASL example below shows:
|
||||
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
|
||||
Package ()
|
||||
{
|
||||
Package () {"reset-gpio", Package() {^BTH, 1, 1, 0 }},
|
||||
Package () {"shutdown-gpio", Package() {^BTH, 0, 0, 0 }},
|
||||
Package () {"reset-gpios", Package() {^BTH, 1, 1, 0 }},
|
||||
Package () {"shutdown-gpios", Package() {^BTH, 0, 0, 0 }},
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -48,7 +48,7 @@ Since ACPI GpioIo() resource does not have a field saying whether it is
|
||||
active low or high, the "active_low" argument can be used here. Setting
|
||||
it to 1 marks the GPIO as active low.
|
||||
|
||||
In our Bluetooth example the "reset-gpio" refers to the second GpioIo()
|
||||
In our Bluetooth example the "reset-gpios" refers to the second GpioIo()
|
||||
resource, second pin in that resource with the GPIO number of 31.
|
||||
|
||||
ACPI GPIO Mappings Provided by Drivers
|
||||
@@ -83,8 +83,8 @@ static const struct acpi_gpio_params reset_gpio = { 1, 1, false };
|
||||
static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false };
|
||||
|
||||
static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = {
|
||||
{ "reset-gpio", &reset_gpio, 1 },
|
||||
{ "shutdown-gpio", &shutdown_gpio, 1 },
|
||||
{ "reset-gpios", &reset_gpio, 1 },
|
||||
{ "shutdown-gpios", &shutdown_gpio, 1 },
|
||||
{ },
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
obj-$(CONFIG_ACPI) += boot.o
|
||||
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o
|
||||
obj-$(CONFIG_ACPI_APEI) += apei.o
|
||||
obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_msr.o
|
||||
|
||||
ifneq ($(CONFIG_ACPI_PROCESSOR),)
|
||||
obj-y += cstate.o
|
||||
|
||||
@@ -1031,8 +1031,8 @@ static int __init acpi_parse_madt_lapic_entries(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
x2count = madt_proc[0].count;
|
||||
count = madt_proc[1].count;
|
||||
count = madt_proc[0].count;
|
||||
x2count = madt_proc[1].count;
|
||||
}
|
||||
if (!count && !x2count) {
|
||||
printk(KERN_ERR PREFIX "No LAPIC entries present\n");
|
||||
@@ -1513,7 +1513,7 @@ void __init acpi_boot_table_init(void)
|
||||
* If acpi_disabled, bail out
|
||||
*/
|
||||
if (acpi_disabled)
|
||||
return;
|
||||
return;
|
||||
|
||||
/*
|
||||
* Initialize the ACPI boot-time table parser.
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* cppc_msr.c: MSR Interface for CPPC
|
||||
* Copyright (c) 2016, Intel Corporation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <acpi/cppc_acpi.h>
|
||||
#include <asm/msr.h>
|
||||
|
||||
/* Refer to drivers/acpi/cppc_acpi.c for the description of functions */
|
||||
|
||||
bool cpc_ffh_supported(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = rdmsrl_safe_on_cpu(cpunum, reg->address, val);
|
||||
if (!err) {
|
||||
u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
|
||||
reg->bit_offset);
|
||||
|
||||
*val &= mask;
|
||||
*val >>= reg->bit_offset;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
|
||||
{
|
||||
u64 rd_val;
|
||||
int err;
|
||||
|
||||
err = rdmsrl_safe_on_cpu(cpunum, reg->address, &rd_val);
|
||||
if (!err) {
|
||||
u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
|
||||
reg->bit_offset);
|
||||
|
||||
val <<= reg->bit_offset;
|
||||
val &= mask;
|
||||
rd_val &= ~mask;
|
||||
rd_val |= val;
|
||||
err = wrmsrl_safe_on_cpu(cpunum, reg->address, rd_val);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@@ -227,7 +227,6 @@ config ACPI_MCFG
|
||||
config ACPI_CPPC_LIB
|
||||
bool
|
||||
depends on ACPI_PROCESSOR
|
||||
depends on !ACPI_CPU_FREQ_PSS
|
||||
select MAILBOX
|
||||
select PCC
|
||||
help
|
||||
@@ -462,6 +461,9 @@ source "drivers/acpi/nfit/Kconfig"
|
||||
source "drivers/acpi/apei/Kconfig"
|
||||
source "drivers/acpi/dptf/Kconfig"
|
||||
|
||||
config ACPI_WATCHDOG
|
||||
bool
|
||||
|
||||
config ACPI_EXTLOG
|
||||
tristate "Extended Error Log support"
|
||||
depends on X86_MCE && X86_LOCAL_APIC
|
||||
|
||||
@@ -56,6 +56,7 @@ acpi-$(CONFIG_ACPI_NUMA) += numa.o
|
||||
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
|
||||
acpi-y += acpi_lpat.o
|
||||
acpi-$(CONFIG_ACPI_GENERIC_GSI) += gsi.o
|
||||
acpi-$(CONFIG_ACPI_WATCHDOG) += acpi_watchdog.o
|
||||
|
||||
# These are (potentially) separate modules
|
||||
|
||||
|
||||
+24
-3
@@ -42,6 +42,7 @@ struct apd_private_data;
|
||||
struct apd_device_desc {
|
||||
unsigned int flags;
|
||||
unsigned int fixed_clk_rate;
|
||||
struct property_entry *properties;
|
||||
int (*setup)(struct apd_private_data *pdata);
|
||||
};
|
||||
|
||||
@@ -71,22 +72,35 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
|
||||
static struct apd_device_desc cz_i2c_desc = {
|
||||
static const struct apd_device_desc cz_i2c_desc = {
|
||||
.setup = acpi_apd_setup,
|
||||
.fixed_clk_rate = 133000000,
|
||||
};
|
||||
|
||||
static struct apd_device_desc cz_uart_desc = {
|
||||
static struct property_entry uart_properties[] = {
|
||||
PROPERTY_ENTRY_U32("reg-io-width", 4),
|
||||
PROPERTY_ENTRY_U32("reg-shift", 2),
|
||||
PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
|
||||
{ },
|
||||
};
|
||||
|
||||
static const struct apd_device_desc cz_uart_desc = {
|
||||
.setup = acpi_apd_setup,
|
||||
.fixed_clk_rate = 48000000,
|
||||
.properties = uart_properties,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARM64
|
||||
static struct apd_device_desc xgene_i2c_desc = {
|
||||
static const struct apd_device_desc xgene_i2c_desc = {
|
||||
.setup = acpi_apd_setup,
|
||||
.fixed_clk_rate = 100000000,
|
||||
};
|
||||
|
||||
static const struct apd_device_desc vulcan_spi_desc = {
|
||||
.setup = acpi_apd_setup,
|
||||
.fixed_clk_rate = 133000000,
|
||||
};
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -125,6 +139,12 @@ static int acpi_apd_create_device(struct acpi_device *adev,
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
if (dev_desc->properties) {
|
||||
ret = device_add_properties(&adev->dev, dev_desc->properties);
|
||||
if (ret)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
adev->driver_data = pdata;
|
||||
pdev = acpi_create_platform_device(adev);
|
||||
if (!IS_ERR_OR_NULL(pdev))
|
||||
@@ -149,6 +169,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
|
||||
#endif
|
||||
#ifdef CONFIG_ARM64
|
||||
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
|
||||
{ "BRCM900D", APD_ADDR(vulcan_spi_desc) },
|
||||
#endif
|
||||
{ }
|
||||
};
|
||||
|
||||
@@ -75,6 +75,7 @@ struct lpss_device_desc {
|
||||
const char *clk_con_id;
|
||||
unsigned int prv_offset;
|
||||
size_t prv_size_override;
|
||||
struct property_entry *properties;
|
||||
void (*setup)(struct lpss_private_data *pdata);
|
||||
};
|
||||
|
||||
@@ -163,11 +164,19 @@ static const struct lpss_device_desc lpt_i2c_dev_desc = {
|
||||
.prv_offset = 0x800,
|
||||
};
|
||||
|
||||
static struct property_entry uart_properties[] = {
|
||||
PROPERTY_ENTRY_U32("reg-io-width", 4),
|
||||
PROPERTY_ENTRY_U32("reg-shift", 2),
|
||||
PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
|
||||
{ },
|
||||
};
|
||||
|
||||
static const struct lpss_device_desc lpt_uart_dev_desc = {
|
||||
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
|
||||
.clk_con_id = "baudclk",
|
||||
.prv_offset = 0x800,
|
||||
.setup = lpss_uart_setup,
|
||||
.properties = uart_properties,
|
||||
};
|
||||
|
||||
static const struct lpss_device_desc lpt_sdio_dev_desc = {
|
||||
@@ -189,6 +198,7 @@ static const struct lpss_device_desc byt_uart_dev_desc = {
|
||||
.clk_con_id = "baudclk",
|
||||
.prv_offset = 0x800,
|
||||
.setup = lpss_uart_setup,
|
||||
.properties = uart_properties,
|
||||
};
|
||||
|
||||
static const struct lpss_device_desc bsw_uart_dev_desc = {
|
||||
@@ -197,6 +207,7 @@ static const struct lpss_device_desc bsw_uart_dev_desc = {
|
||||
.clk_con_id = "baudclk",
|
||||
.prv_offset = 0x800,
|
||||
.setup = lpss_uart_setup,
|
||||
.properties = uart_properties,
|
||||
};
|
||||
|
||||
static const struct lpss_device_desc byt_spi_dev_desc = {
|
||||
@@ -440,6 +451,12 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
if (dev_desc->properties) {
|
||||
ret = device_add_properties(&adev->dev, dev_desc->properties);
|
||||
if (ret)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
adev->driver_data = pdata;
|
||||
pdev = acpi_create_platform_device(adev);
|
||||
if (!IS_ERR_OR_NULL(pdev)) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "internal.h"
|
||||
@@ -30,6 +31,22 @@ static const struct acpi_device_id forbidden_id_list[] = {
|
||||
{"", 0},
|
||||
};
|
||||
|
||||
static void acpi_platform_fill_resource(struct acpi_device *adev,
|
||||
const struct resource *src, struct resource *dest)
|
||||
{
|
||||
struct device *parent;
|
||||
|
||||
*dest = *src;
|
||||
|
||||
/*
|
||||
* If the device has parent we need to take its resources into
|
||||
* account as well because this device might consume part of those.
|
||||
*/
|
||||
parent = acpi_get_first_physical_node(adev->parent);
|
||||
if (parent && dev_is_pci(parent))
|
||||
dest->parent = pci_find_resource(to_pci_dev(parent), dest);
|
||||
}
|
||||
|
||||
/**
|
||||
* acpi_create_platform_device - Create platform device for ACPI device node
|
||||
* @adev: ACPI device node to create a platform device for.
|
||||
@@ -70,7 +87,8 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
|
||||
}
|
||||
count = 0;
|
||||
list_for_each_entry(rentry, &resource_list, node)
|
||||
resources[count++] = *rentry->res;
|
||||
acpi_platform_fill_resource(adev, rentry->res,
|
||||
&resources[count++]);
|
||||
|
||||
acpi_dev_free_resource_list(&resource_list);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* ACPI watchdog table parsing support.
|
||||
*
|
||||
* Copyright (C) 2016, Intel Corporation
|
||||
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "ACPI: watchdog: " fmt
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/**
|
||||
* Returns true if this system should prefer ACPI based watchdog instead of
|
||||
* the native one (which are typically the same hardware).
|
||||
*/
|
||||
bool acpi_has_watchdog(void)
|
||||
{
|
||||
struct acpi_table_header hdr;
|
||||
|
||||
if (acpi_disabled)
|
||||
return false;
|
||||
|
||||
return ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_WDAT, 0, &hdr));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_has_watchdog);
|
||||
|
||||
void __init acpi_watchdog_init(void)
|
||||
{
|
||||
const struct acpi_wdat_entry *entries;
|
||||
const struct acpi_table_wdat *wdat;
|
||||
struct list_head resource_list;
|
||||
struct resource_entry *rentry;
|
||||
struct platform_device *pdev;
|
||||
struct resource *resources;
|
||||
size_t nresources = 0;
|
||||
acpi_status status;
|
||||
int i;
|
||||
|
||||
status = acpi_get_table(ACPI_SIG_WDAT, 0,
|
||||
(struct acpi_table_header **)&wdat);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
/* It is fine if there is no WDAT */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Watchdog disabled by BIOS */
|
||||
if (!(wdat->flags & ACPI_WDAT_ENABLED))
|
||||
return;
|
||||
|
||||
/* Skip legacy PCI WDT devices */
|
||||
if (wdat->pci_segment != 0xff || wdat->pci_bus != 0xff ||
|
||||
wdat->pci_device != 0xff || wdat->pci_function != 0xff)
|
||||
return;
|
||||
|
||||
INIT_LIST_HEAD(&resource_list);
|
||||
|
||||
entries = (struct acpi_wdat_entry *)(wdat + 1);
|
||||
for (i = 0; i < wdat->entries; i++) {
|
||||
const struct acpi_generic_address *gas;
|
||||
struct resource_entry *rentry;
|
||||
struct resource res;
|
||||
bool found;
|
||||
|
||||
gas = &entries[i].register_region;
|
||||
|
||||
res.start = gas->address;
|
||||
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
|
||||
res.flags = IORESOURCE_MEM;
|
||||
res.end = res.start + ALIGN(gas->access_width, 4);
|
||||
} else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
|
||||
res.flags = IORESOURCE_IO;
|
||||
res.end = res.start + gas->access_width;
|
||||
} else {
|
||||
pr_warn("Unsupported address space: %u\n",
|
||||
gas->space_id);
|
||||
goto fail_free_resource_list;
|
||||
}
|
||||
|
||||
found = false;
|
||||
resource_list_for_each_entry(rentry, &resource_list) {
|
||||
if (resource_contains(rentry->res, &res)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
rentry = resource_list_create_entry(NULL, 0);
|
||||
if (!rentry)
|
||||
goto fail_free_resource_list;
|
||||
|
||||
*rentry->res = res;
|
||||
resource_list_add_tail(rentry, &resource_list);
|
||||
nresources++;
|
||||
}
|
||||
}
|
||||
|
||||
resources = kcalloc(nresources, sizeof(*resources), GFP_KERNEL);
|
||||
if (!resources)
|
||||
goto fail_free_resource_list;
|
||||
|
||||
i = 0;
|
||||
resource_list_for_each_entry(rentry, &resource_list)
|
||||
resources[i++] = *rentry->res;
|
||||
|
||||
pdev = platform_device_register_simple("wdat_wdt", PLATFORM_DEVID_NONE,
|
||||
resources, nresources);
|
||||
if (IS_ERR(pdev))
|
||||
pr_err("Failed to create platform device\n");
|
||||
|
||||
kfree(resources);
|
||||
|
||||
fail_free_resource_list:
|
||||
resource_list_free(&resource_list);
|
||||
}
|
||||
@@ -175,6 +175,7 @@ acpi-y += \
|
||||
utresrc.o \
|
||||
utstate.o \
|
||||
utstring.o \
|
||||
utstrtoul64.o \
|
||||
utxface.o \
|
||||
utxfinit.o \
|
||||
utxferror.o \
|
||||
|
||||
@@ -44,7 +44,9 @@
|
||||
#ifndef _ACAPPS
|
||||
#define _ACAPPS
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef ACPI_USE_STANDARD_HEADERS
|
||||
#include <sys/stat.h>
|
||||
#endif /* ACPI_USE_STANDARD_HEADERS */
|
||||
|
||||
/* Common info for tool signons */
|
||||
|
||||
@@ -81,13 +83,13 @@
|
||||
/* Macros for usage messages */
|
||||
|
||||
#define ACPI_USAGE_HEADER(usage) \
|
||||
acpi_os_printf ("Usage: %s\nOptions:\n", usage);
|
||||
printf ("Usage: %s\nOptions:\n", usage);
|
||||
|
||||
#define ACPI_USAGE_TEXT(description) \
|
||||
acpi_os_printf (description);
|
||||
printf (description);
|
||||
|
||||
#define ACPI_OPTION(name, description) \
|
||||
acpi_os_printf (" %-20s%s\n", name, description);
|
||||
printf (" %-20s%s\n", name, description);
|
||||
|
||||
/* Check for unexpected exceptions */
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ acpi_status acpi_db_disassemble_method(char *name);
|
||||
|
||||
void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
|
||||
|
||||
void acpi_db_batch_execute(char *count_arg);
|
||||
void acpi_db_evaluate_predefined_names(void);
|
||||
|
||||
/*
|
||||
* dbnames - namespace commands
|
||||
|
||||
@@ -85,6 +85,9 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
|
||||
|
||||
acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
|
||||
|
||||
acpi_status
|
||||
acpi_ev_mask_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 is_masked);
|
||||
|
||||
acpi_status
|
||||
acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
|
||||
|
||||
|
||||
@@ -317,6 +317,7 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE);
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_cstyle_disassembly, TRUE);
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_force_aml_disassembly, FALSE);
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_dm_opt_verbose, TRUE);
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_dm_emit_external_opcodes, FALSE);
|
||||
|
||||
ACPI_GLOBAL(u8, acpi_gbl_dm_opt_disasm);
|
||||
ACPI_GLOBAL(u8, acpi_gbl_dm_opt_listing);
|
||||
@@ -382,6 +383,7 @@ ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
|
||||
|
||||
ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL);
|
||||
ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL);
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
|
||||
|
||||
/* Print buffer */
|
||||
|
||||
|
||||
@@ -484,6 +484,7 @@ struct acpi_gpe_event_info {
|
||||
u8 flags; /* Misc info about this GPE */
|
||||
u8 gpe_number; /* This GPE */
|
||||
u8 runtime_count; /* References to a run GPE */
|
||||
u8 disable_for_dispatch; /* Masked during dispatching */
|
||||
};
|
||||
|
||||
/* Information about a GPE register pair, one per each status/enable pair in an array */
|
||||
@@ -494,6 +495,7 @@ struct acpi_gpe_register_info {
|
||||
u16 base_gpe_number; /* Base GPE number for this register */
|
||||
u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
|
||||
u8 enable_for_run; /* GPEs to keep enabled when running */
|
||||
u8 mask_for_run; /* GPEs to keep masked when running */
|
||||
u8 enable_mask; /* Current mask of enabled GPEs */
|
||||
};
|
||||
|
||||
|
||||
@@ -129,6 +129,9 @@ struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
|
||||
acpi_status
|
||||
acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
|
||||
|
||||
acpi_status
|
||||
acpi_ns_execute_table(u32 table_index, struct acpi_namespace_node *start_node);
|
||||
|
||||
acpi_status
|
||||
acpi_ns_one_complete_parse(u32 pass_number,
|
||||
u32 table_index,
|
||||
@@ -295,6 +298,11 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
|
||||
u8
|
||||
acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
|
||||
|
||||
acpi_status
|
||||
acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node,
|
||||
const char *external_pathname,
|
||||
u32 flags, struct acpi_namespace_node **out_node);
|
||||
|
||||
acpi_status
|
||||
acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
|
||||
const char *external_pathname,
|
||||
|
||||
@@ -78,6 +78,8 @@ extern const u8 acpi_gbl_long_op_index[];
|
||||
*/
|
||||
acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info);
|
||||
|
||||
acpi_status acpi_ps_execute_table(struct acpi_evaluate_info *info);
|
||||
|
||||
/*
|
||||
* psargs - Parse AML opcode arguments
|
||||
*/
|
||||
|
||||
@@ -123,6 +123,14 @@ acpi_tb_install_standard_table(acpi_physical_address address,
|
||||
|
||||
void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc);
|
||||
|
||||
acpi_status
|
||||
acpi_tb_load_table(u32 table_index, struct acpi_namespace_node *parent_node);
|
||||
|
||||
acpi_status
|
||||
acpi_tb_install_and_load_table(struct acpi_table_header *table,
|
||||
acpi_physical_address address,
|
||||
u8 flags, u8 override, u32 *table_index);
|
||||
|
||||
void acpi_tb_terminate(void);
|
||||
|
||||
acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index);
|
||||
@@ -155,10 +163,6 @@ void
|
||||
acpi_tb_install_table_with_override(struct acpi_table_desc *new_table_desc,
|
||||
u8 override, u32 *table_index);
|
||||
|
||||
acpi_status
|
||||
acpi_tb_install_fixed_table(acpi_physical_address address,
|
||||
char *signature, u32 *table_index);
|
||||
|
||||
acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
|
||||
|
||||
/*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user