Skip to content

Commit

Permalink
Merge tag 'acpi-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "The majority of this is an update of the ACPICA kernel code to
  upstream revision 20171215 with a cosmetic change and a maintainers
  information update on top of it.

  The rest is mostly some minor fixes and cleanups in the ACPI drivers
  and cleanups to initialization on x86.

  Specifics:

   - Update the ACPICA kernel code to upstream revision 20171215 including:
      * Support for ACPI 6.0A changes in the NFIT table (Bob Moore)
      * Local 64-bit divide in string conversions (Bob Moore)
      * Fix for a regression in acpi_evaluate_object_type() (Bob Moore)
      * Fixes for memory leaks during package object resolution (Bob
        Moore)
      * Deployment of safe version of strncpy() (Bob Moore)
      * Debug and messaging updates (Bob Moore)
      * Support for PDTT, SDEV, TPM2 tables in iASL and tools (Bob
        Moore)
      * Null pointer dereference avoidance in Op and cleanups (Colin Ian
        King)
      * Fix for memory leak from building prefixed pathname (Erik
        Schmauss)
      * Coding style fixes, disassembler and compiler updates (Hanjun
        Guo, Erik Schmauss)
      * Additional PPTT flags from ACPI 6.2 (Jeremy Linton)
      * Fix for an off-by-one error in acpi_get_timer_duration()
        (Jung-uk Kim)
      * Infinite loop detection timeout and utilities cleanups (Lv
        Zheng)
      * Windows 10 version 1607 and 1703 OSI strings (Mario
        Limonciello)

   - Update ACPICA information in MAINTAINERS to reflect the current
     status of ACPICA maintenance and rename a local variable in one
     function to match the corresponding upstream code (Rafael Wysocki)

   - Clean up ACPI-related initialization on x86 (Andy Shevchenko)

   - Add support for Intel Merrifield to the ACPI GPIO code (Andy
     Shevchenko)

   - Clean up ACPI PMIC drivers (Andy Shevchenko, Arvind Yadav)

   - Fix the ACPI Generic Event Device (GED) driver to free IRQs on
     shutdown and clean up the PCI IRQ Link driver (Sinan Kaya)

   - Make the GHES code call into the AER driver on all errors and clean
     up the ACPI APEI code (Colin Ian King, Tyler Baicar)

   - Make the IA64 ACPI NUMA code parse all SRAT entries (Ganapatrao
     Kulkarni)

   - Add a lid switch blacklist to the ACPI button driver and make it
     print extra debug messages on lid events (Hans de Goede)

   - Add quirks for Asus GL502VSK and UX305LA to the ACPI battery driver
     and clean it up somewhat (Bjørn Mork, Kai-Heng Feng)

   - Add device link for CHT SD card dependency on I2C to the ACPI LPSS
     (Intel SoCs) driver and make it avoid creating platform device
     objects for devices without MMIO resources (Adrian Hunter, Hans de
     Goede)

   - Fix the ACPI GPE mask kernel command line parameter handling
     (Prarit Bhargava)

   - Fix the handling of (incorrectly exposed) backlight interfaces
     without LCD (Hans de Goede)

   - Fix the usage of debugfs_create_*() in the ACPI EC driver (Geert
     Uytterhoeven)"

* tag 'acpi-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (62 commits)
  ACPI/PCI: pci_link: reduce verbosity when IRQ is enabled
  ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources
  ACPI / PMIC: Convert to use builtin_platform_driver() macro
  ACPI / x86: boot: Propagate error code in acpi_gsi_to_irq()
  ACPICA: Update version to 20171215
  ACPICA: trivial style fix, no functional change
  ACPICA: Fix a couple memory leaks during package object resolution
  ACPICA: Recognize the Windows 10 version 1607 and 1703 OSI strings
  ACPICA: DT compiler: prevent error if optional field at the end of table is not present
  ACPICA: Rename a global variable, no functional change
  ACPICA: Create and deploy safe version of strncpy
  ACPICA: Cleanup the global variables and update comments
  ACPICA: Debugger: fix slight indentation issue
  ACPICA: Fix a regression in the acpi_evaluate_object_type() interface
  ACPICA: Update for a few debug output statements
  ACPICA: Debug output, no functional change
  ACPI: EC: Fix debugfs_create_*() usage
  ACPI / video: Default lcd_only to true on Win8-ready and newer machines
  ACPI / x86: boot: Don't setup SCI on HW-reduced platforms
  ACPI / x86: boot: Use INVALID_ACPI_IRQ instead of 0 for acpi_sci_override_gsi
  ...
  • Loading branch information
torvalds committed Jan 29, 2018
2 parents 7f3fdd4 + a7f2766 commit 1a9a126
Show file tree
Hide file tree
Showing 69 changed files with 1,210 additions and 408 deletions.
1 change: 0 additions & 1 deletion Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
This facility can be used to prevent such uncontrolled
GPE floodings.
Format: <int>
Support masking of GPEs numbered from 0x00 to 0x7f.

acpi_no_auto_serialize [HW,ACPI]
Disable auto-serialization of AML methods
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ F: drivers/acpi/apei/

ACPI COMPONENT ARCHITECTURE (ACPICA)
M: Robert Moore <[email protected]>
M: Lv Zheng <lv.zheng@intel.com>
M: Erik Schmauss <erik.schmauss@intel.com>
M: "Rafael J. Wysocki" <[email protected]>
L: [email protected]
L: [email protected]
Expand Down
5 changes: 5 additions & 0 deletions arch/ia64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
return -1;

if (num_node_memblks >= NR_NODE_MEMBLKS) {
pr_err("NUMA: too many memblk ranges\n");
return -EINVAL;
}

/* record this node in proximity bitmap */
pxm_bit_set(pxm);

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern int acpi_fix_pin2_polarity;
extern int acpi_disable_cmcff;

extern u8 acpi_sci_flags;
extern int acpi_sci_override_gsi;
extern u32 acpi_sci_override_gsi;
void acpi_pic_sci_set_trigger(unsigned int, u16);

struct device;
Expand Down
35 changes: 17 additions & 18 deletions arch/x86/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ int acpi_ioapic;
int acpi_strict;
int acpi_disable_cmcff;

/* ACPI SCI override configuration */
u8 acpi_sci_flags __initdata;
int acpi_sci_override_gsi __initdata;
u32 acpi_sci_override_gsi __initdata = INVALID_ACPI_IRQ;
int acpi_skip_timer_override __initdata;
int acpi_use_timer_override __initdata;
int acpi_fix_pin2_polarity __initdata;
Expand Down Expand Up @@ -112,8 +113,6 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};

#define ACPI_INVALID_GSI INT_MIN

/*
* This is just a simple wrapper around early_memremap(),
* with sanity checks for phys == 0 and size == 0.
Expand Down Expand Up @@ -372,7 +371,7 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
* and acpi_isa_irq_to_gsi() may give wrong result.
*/
if (gsi < nr_legacy_irqs() && isa_irq_to_gsi[gsi] == gsi)
isa_irq_to_gsi[gsi] = ACPI_INVALID_GSI;
isa_irq_to_gsi[gsi] = INVALID_ACPI_IRQ;
isa_irq_to_gsi[bus_irq] = gsi;
}

Expand Down Expand Up @@ -620,24 +619,24 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
}

rc = acpi_get_override_irq(gsi, &trigger, &polarity);
if (rc == 0) {
trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
if (irq >= 0) {
*irqp = irq;
return 0;
}
}
if (rc)
return rc;

return -1;
trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
if (irq < 0)
return irq;

*irqp = irq;
return 0;
}
EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);

int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
{
if (isa_irq < nr_legacy_irqs() &&
isa_irq_to_gsi[isa_irq] != ACPI_INVALID_GSI) {
isa_irq_to_gsi[isa_irq] != INVALID_ACPI_IRQ) {
*gsi = isa_irq_to_gsi[isa_irq];
return 0;
}
Expand Down Expand Up @@ -676,8 +675,7 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
mutex_lock(&acpi_ioapic_lock);
irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info);
/* Don't set up the ACPI SCI because it's already set up */
if (irq >= 0 && enable_update_mptable &&
acpi_gbl_FADT.sci_interrupt != gsi)
if (irq >= 0 && enable_update_mptable && gsi != acpi_gbl_FADT.sci_interrupt)
mp_config_acpi_gsi(dev, gsi, trigger, polarity);
mutex_unlock(&acpi_ioapic_lock);
#endif
Expand Down Expand Up @@ -1211,8 +1209,9 @@ static int __init acpi_parse_madt_ioapic_entries(void)
/*
* If BIOS did not supply an INT_SRC_OVR for the SCI
* pretend we got one so we can set the SCI flags.
* But ignore setting up SCI on hardware reduced platforms.
*/
if (!acpi_sci_override_gsi)
if (acpi_sci_override_gsi == INVALID_ACPI_IRQ && !acpi_gbl_reduced_hardware)
acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0,
acpi_gbl_FADT.sci_interrupt);

Expand Down
139 changes: 139 additions & 0 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,142 @@ static int register_device_clock(struct acpi_device *adev,
return 0;
}

struct lpss_device_links {
const char *supplier_hid;
const char *supplier_uid;
const char *consumer_hid;
const char *consumer_uid;
u32 flags;
};

/*
* The _DEP method is used to identify dependencies but instead of creating
* device links for every handle in _DEP, only links in the following list are
* created. That is necessary because, in the general case, _DEP can refer to
* devices that might not have drivers, or that are on different buses, or where
* the supplier is not enumerated until after the consumer is probed.
*/
static const struct lpss_device_links lpss_device_links[] = {
{"808622C1", "7", "80860F14", "3", DL_FLAG_PM_RUNTIME},
};

static bool hid_uid_match(const char *hid1, const char *uid1,
const char *hid2, const char *uid2)
{
return !strcmp(hid1, hid2) && uid1 && uid2 && !strcmp(uid1, uid2);
}

static bool acpi_lpss_is_supplier(struct acpi_device *adev,
const struct lpss_device_links *link)
{
return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
link->supplier_hid, link->supplier_uid);
}

static bool acpi_lpss_is_consumer(struct acpi_device *adev,
const struct lpss_device_links *link)
{
return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
link->consumer_hid, link->consumer_uid);
}

struct hid_uid {
const char *hid;
const char *uid;
};

static int match_hid_uid(struct device *dev, void *data)
{
struct acpi_device *adev = ACPI_COMPANION(dev);
struct hid_uid *id = data;

if (!adev)
return 0;

return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
id->hid, id->uid);
}

static struct device *acpi_lpss_find_device(const char *hid, const char *uid)
{
struct hid_uid data = {
.hid = hid,
.uid = uid,
};

return bus_find_device(&platform_bus_type, NULL, &data, match_hid_uid);
}

static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle)
{
struct acpi_handle_list dep_devices;
acpi_status status;
int i;

if (!acpi_has_method(adev->handle, "_DEP"))
return false;

status = acpi_evaluate_reference(adev->handle, "_DEP", NULL,
&dep_devices);
if (ACPI_FAILURE(status)) {
dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n");
return false;
}

for (i = 0; i < dep_devices.count; i++) {
if (dep_devices.handles[i] == handle)
return true;
}

return false;
}

static void acpi_lpss_link_consumer(struct device *dev1,
const struct lpss_device_links *link)
{
struct device *dev2;

dev2 = acpi_lpss_find_device(link->consumer_hid, link->consumer_uid);
if (!dev2)
return;

if (acpi_lpss_dep(ACPI_COMPANION(dev2), ACPI_HANDLE(dev1)))
device_link_add(dev2, dev1, link->flags);

put_device(dev2);
}

static void acpi_lpss_link_supplier(struct device *dev1,
const struct lpss_device_links *link)
{
struct device *dev2;

dev2 = acpi_lpss_find_device(link->supplier_hid, link->supplier_uid);
if (!dev2)
return;

if (acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2)))
device_link_add(dev1, dev2, link->flags);

put_device(dev2);
}

static void acpi_lpss_create_device_links(struct acpi_device *adev,
struct platform_device *pdev)
{
int i;

for (i = 0; i < ARRAY_SIZE(lpss_device_links); i++) {
const struct lpss_device_links *link = &lpss_device_links[i];

if (acpi_lpss_is_supplier(adev, link))
acpi_lpss_link_consumer(&pdev->dev, link);

if (acpi_lpss_is_consumer(adev, link))
acpi_lpss_link_supplier(&pdev->dev, link);
}
}

static int acpi_lpss_create_device(struct acpi_device *adev,
const struct acpi_device_id *id)
{
Expand Down Expand Up @@ -465,6 +601,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
acpi_dev_free_resource_list(&resource_list);

if (!pdata->mmio_base) {
/* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
adev->pnp.type.platform_id = 0;
/* Skip the device, but continue the namespace scan. */
ret = 0;
goto err_out;
Expand Down Expand Up @@ -500,6 +638,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
adev->driver_data = pdata;
pdev = acpi_create_platform_device(adev, dev_desc->properties);
if (!IS_ERR_OR_NULL(pdev)) {
acpi_lpss_create_device_links(adev, pdev);
return 1;
}

Expand Down
14 changes: 12 additions & 2 deletions drivers/acpi/acpi_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ MODULE_PARM_DESC(report_key_events,
static bool device_id_scheme = false;
module_param(device_id_scheme, bool, 0444);

static bool only_lcd = false;
module_param(only_lcd, bool, 0444);
static int only_lcd = -1;
module_param(only_lcd, int, 0444);

static int register_count;
static DEFINE_MUTEX(register_count_mutex);
Expand Down Expand Up @@ -2136,6 +2136,16 @@ int acpi_video_register(void)
goto leave;
}

/*
* We're seeing a lot of bogus backlight interfaces on newer machines
* without a LCD such as desktops, servers and HDMI sticks. Checking
* the lcd flag fixes this, so enable this on any machines which are
* win8 ready (where we also prefer the native backlight driver, so
* normally the acpi_video code should not register there anyways).
*/
if (only_lcd == -1)
only_lcd = acpi_osi_is_win8();

dmi_check_system(video_dmi_table);

ret = acpi_bus_register_driver(&acpi_video_bus);
Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/acpica/acapps.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
prefix, ACPICA_COPYRIGHT, \
prefix

#define ACPI_COMMON_BUILD_TIME \
"Build date/time: %s %s\n", __DATE__, __TIME__

/* Macros for usage messages */

#define ACPI_USAGE_HEADER(usage) \
Expand Down
4 changes: 4 additions & 0 deletions drivers/acpi/acpica/acdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ ACPI_DBR_DEPENDENT_RETURN_VOID(void
void
acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);

void
acpi_db_create_execution_thread(char *method_name_arg,
char **arguments, acpi_object_type *types);

void
acpi_db_create_execution_threads(char *num_threads_arg,
char *num_loops_arg, char *method_name_arg);
Expand Down
Loading

0 comments on commit 1a9a126

Please sign in to comment.