Skip to content

Commit

Permalink
Merge branches 'acpi-soc', 'acpi-video' and 'acpi-apei'
Browse files Browse the repository at this point in the history
Merge ACPI SoC drivers changes, ACPI backlight driver changes and APEI
changes for 5.18-rc1:

 - Make the ACPI driver for Intel SoCs (LPSS) let the SPI driver know
   the exact type of the controller (Andy Shevchenko).

 - Force native backlight mode on Clevo NL5xRU and NL5xNU (Werner
   Sembach).

 - Fix return value of __setup handlers in the APEI code (Randy
   Dunlap).

 - Add Arm Generic Diagnostic Dump and Reset device driver (Ilkka
   Koskinen).

 - Limit printable size of BERT table data (Darren Hart).

 - Fix up HEST and GHES initialization (Shuai Xue).

* acpi-soc:
  ACPI: LPSS: Provide an SSP type to the driver
  ACPI: LPSS: Constify properties member in struct lpss_device_desc
  ACPI: platform: Constify properties parameter in acpi_create_platform_device()

* acpi-video:
  ACPI: video: Force backlight native for Clevo NL5xRU and NL5xNU

* acpi-apei:
  ACPI: AGDI: Add driver for Arm Generic Diagnostic Dump and Reset device
  ACPI/APEI: Limit printable size of BERT table data
  ACPI: APEI: fix return value of __setup handlers
  ACPI: APEI: rename ghes_init() with an "acpi_" prefix
  ACPI: APEI: explicit init of HEST and GHES in apci_init()
  • Loading branch information
Rafael J. Wysocki committed Mar 18, 2022
4 parents 24b2b09 + 620c803 + c844d22 + a2a591f commit 8a9bd50
Show file tree
Hide file tree
Showing 18 changed files with 273 additions and 41 deletions.
33 changes: 26 additions & 7 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/pwm.h>
#include <linux/pxa2xx_ssp.h>
#include <linux/suspend.h>
#include <linux/delay.h>

Expand Down Expand Up @@ -82,7 +83,7 @@ struct lpss_device_desc {
const char *clk_con_id;
unsigned int prv_offset;
size_t prv_size_override;
struct property_entry *properties;
const struct property_entry *properties;
void (*setup)(struct lpss_private_data *pdata);
bool resume_from_noirq;
};
Expand Down Expand Up @@ -219,10 +220,16 @@ static void bsw_pwm_setup(struct lpss_private_data *pdata)
pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));
}

static const struct lpss_device_desc lpt_dev_desc = {
static const struct property_entry lpt_spi_properties[] = {
PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_LPT_SSP),
{ }
};

static const struct lpss_device_desc lpt_spi_dev_desc = {
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR
| LPSS_SAVE_CTX,
.prv_offset = 0x800,
.properties = lpt_spi_properties,
};

static const struct lpss_device_desc lpt_i2c_dev_desc = {
Expand Down Expand Up @@ -282,9 +289,15 @@ static const struct lpss_device_desc bsw_uart_dev_desc = {
.properties = uart_properties,
};

static const struct property_entry byt_spi_properties[] = {
PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_BYT_SSP),
{ }
};

static const struct lpss_device_desc byt_spi_dev_desc = {
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX,
.prv_offset = 0x400,
.properties = byt_spi_properties,
};

static const struct lpss_device_desc byt_sdio_dev_desc = {
Expand All @@ -305,11 +318,17 @@ static const struct lpss_device_desc bsw_i2c_dev_desc = {
.resume_from_noirq = true,
};

static const struct property_entry bsw_spi_properties[] = {
PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_BSW_SSP),
{ }
};

static const struct lpss_device_desc bsw_spi_dev_desc = {
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX
| LPSS_NO_D3_DELAY,
.prv_offset = 0x400,
.setup = lpss_deassert_reset,
.properties = bsw_spi_properties,
};

static const struct x86_cpu_id lpss_cpu_ids[] = {
Expand All @@ -329,8 +348,8 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "INTL9C60", LPSS_ADDR(lpss_dma_desc) },

/* Lynxpoint LPSS devices */
{ "INT33C0", LPSS_ADDR(lpt_dev_desc) },
{ "INT33C1", LPSS_ADDR(lpt_dev_desc) },
{ "INT33C0", LPSS_ADDR(lpt_spi_dev_desc) },
{ "INT33C1", LPSS_ADDR(lpt_spi_dev_desc) },
{ "INT33C2", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT33C3", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) },
Expand All @@ -356,8 +375,8 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "808622C1", LPSS_ADDR(bsw_i2c_dev_desc) },

/* Broadwell LPSS devices */
{ "INT3430", LPSS_ADDR(lpt_dev_desc) },
{ "INT3431", LPSS_ADDR(lpt_dev_desc) },
{ "INT3430", LPSS_ADDR(lpt_spi_dev_desc) },
{ "INT3431", LPSS_ADDR(lpt_spi_dev_desc) },
{ "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT3433", LPSS_ADDR(lpt_i2c_dev_desc) },
{ "INT3434", LPSS_ADDR(lpt_uart_dev_desc) },
Expand All @@ -366,7 +385,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "INT3437", },

/* Wildcat Point LPSS devices */
{ "INT3438", LPSS_ADDR(lpt_dev_desc) },
{ "INT3438", LPSS_ADDR(lpt_spi_dev_desc) },

{ }
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpi_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static void acpi_platform_fill_resource(struct acpi_device *adev,
* Name of the platform device will be the same as @adev's.
*/
struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
struct property_entry *properties)
const struct property_entry *properties)
{
struct platform_device *pdev = NULL;
struct platform_device_info pdevinfo;
Expand Down
10 changes: 7 additions & 3 deletions drivers/acpi/apei/bert.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#undef pr_fmt
#define pr_fmt(fmt) "BERT: " fmt
#define ACPI_BERT_PRINT_MAX_LEN 1024

static int bert_disable;

Expand Down Expand Up @@ -58,8 +59,11 @@ static void __init bert_print_all(struct acpi_bert_region *region,
}

pr_info_once("Error records from previous boot:\n");

cper_estatus_print(KERN_INFO HW_ERR, estatus);
if (region_len < ACPI_BERT_PRINT_MAX_LEN)
cper_estatus_print(KERN_INFO HW_ERR, estatus);
else
pr_info_once("Max print length exceeded, table data is available at:\n"
"/sys/firmware/acpi/tables/data/BERT");

/*
* Because the boot error source is "one-time polled" type,
Expand All @@ -77,7 +81,7 @@ static int __init setup_bert_disable(char *str)
{
bert_disable = 1;

return 0;
return 1;
}
__setup("bert_disable", setup_bert_disable);

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/apei/erst.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ EXPORT_SYMBOL_GPL(erst_clear);
static int __init setup_erst_disable(char *str)
{
erst_disable = 1;
return 0;
return 1;
}

__setup("erst_disable", setup_erst_disable);
Expand Down
19 changes: 8 additions & 11 deletions drivers/acpi/apei/ghes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1457,33 +1457,35 @@ static struct platform_driver ghes_platform_driver = {
.remove = ghes_remove,
};

static int __init ghes_init(void)
void __init acpi_ghes_init(void)
{
int rc;

sdei_init();

if (acpi_disabled)
return -ENODEV;
return;

switch (hest_disable) {
case HEST_NOT_FOUND:
return -ENODEV;
return;
case HEST_DISABLED:
pr_info(GHES_PFX "HEST is not enabled!\n");
return -EINVAL;
return;
default:
break;
}

if (ghes_disable) {
pr_info(GHES_PFX "GHES is not enabled!\n");
return -EINVAL;
return;
}

ghes_nmi_init_cxt();

rc = platform_driver_register(&ghes_platform_driver);
if (rc)
goto err;
return;

rc = apei_osc_setup();
if (rc == 0 && osc_sb_apei_support_acked)
Expand All @@ -1494,9 +1496,4 @@ static int __init ghes_init(void)
pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit.\n");
else
pr_info(GHES_PFX "Failed to enable APEI firmware first mode.\n");

return 0;
err:
return rc;
}
device_initcall(ghes_init);
2 changes: 1 addition & 1 deletion drivers/acpi/apei/hest.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static int __init hest_ghes_dev_register(unsigned int ghes_count)
static int __init setup_hest_disable(char *str)
{
hest_disable = HEST_DISABLED;
return 0;
return 1;
}

__setup("hest_disable", setup_hest_disable);
Expand Down
10 changes: 10 additions & 0 deletions drivers/acpi/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ config ACPI_IORT

config ACPI_GTDT
bool

config ACPI_AGDI
bool "Arm Generic Diagnostic Dump and Reset Device Interface"
depends on ARM_SDE_INTERFACE
help
Arm Generic Diagnostic Dump and Reset Device Interface (AGDI) is
a standard that enables issuing a non-maskable diagnostic dump and
reset command.

If set, the kernel parses AGDI table and listens for the command.
1 change: 1 addition & 0 deletions drivers/acpi/arm64/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_ACPI_AGDI) += agdi.o
obj-$(CONFIG_ACPI_IORT) += iort.o
obj-$(CONFIG_ACPI_GTDT) += gtdt.o
obj-y += dma.o
116 changes: 116 additions & 0 deletions drivers/acpi/arm64/agdi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* This file implements handling of
* Arm Generic Diagnostic Dump and Reset Interface table (AGDI)
*
* Copyright (c) 2022, Ampere Computing LLC
*/

#define pr_fmt(fmt) "ACPI: AGDI: " fmt

#include <linux/acpi.h>
#include <linux/arm_sdei.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>

struct agdi_data {
int sdei_event;
};

static int agdi_sdei_handler(u32 sdei_event, struct pt_regs *regs, void *arg)
{
nmi_panic(regs, "Arm Generic Diagnostic Dump and Reset SDEI event issued");
return 0;
}

static int agdi_sdei_probe(struct platform_device *pdev,
struct agdi_data *adata)
{
int err;

err = sdei_event_register(adata->sdei_event, agdi_sdei_handler, pdev);
if (err) {
dev_err(&pdev->dev, "Failed to register for SDEI event %d",
adata->sdei_event);
return err;
}

err = sdei_event_enable(adata->sdei_event);
if (err) {
sdei_event_unregister(adata->sdei_event);
dev_err(&pdev->dev, "Failed to enable event %d\n",
adata->sdei_event);
return err;
}

return 0;
}

static int agdi_probe(struct platform_device *pdev)
{
struct agdi_data *adata = dev_get_platdata(&pdev->dev);

if (!adata)
return -EINVAL;

return agdi_sdei_probe(pdev, adata);
}

static int agdi_remove(struct platform_device *pdev)
{
struct agdi_data *adata = dev_get_platdata(&pdev->dev);
int err, i;

err = sdei_event_disable(adata->sdei_event);
if (err)
return err;

for (i = 0; i < 3; i++) {
err = sdei_event_unregister(adata->sdei_event);
if (err != -EINPROGRESS)
break;

schedule();
}

return err;
}

static struct platform_driver agdi_driver = {
.driver = {
.name = "agdi",
},
.probe = agdi_probe,
.remove = agdi_remove,
};

void __init acpi_agdi_init(void)
{
struct acpi_table_agdi *agdi_table;
struct agdi_data pdata;
struct platform_device *pdev;
acpi_status status;

status = acpi_get_table(ACPI_SIG_AGDI, 0,
(struct acpi_table_header **) &agdi_table);
if (ACPI_FAILURE(status))
return;

if (agdi_table->flags & ACPI_AGDI_SIGNALING_MODE) {
pr_warn("Interrupt signaling is not supported");
goto err_put_table;
}

pdata.sdei_event = agdi_table->sdei_event;

pdev = platform_device_register_data(NULL, "agdi", 0, &pdata, sizeof(pdata));
if (IS_ERR(pdev))
goto err_put_table;

if (platform_driver_register(&agdi_driver))
platform_device_unregister(pdev);

err_put_table:
acpi_put_table((struct acpi_table_header *)agdi_table);
}
4 changes: 4 additions & 0 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <asm/mpspec.h>
#include <linux/dmi.h>
#endif
#include <linux/acpi_agdi.h>
#include <linux/acpi_iort.h>
#include <linux/acpi_viot.h>
#include <linux/pci.h>
Expand Down Expand Up @@ -1355,6 +1356,8 @@ static int __init acpi_init(void)

pci_mmcfg_late_init();
acpi_iort_init();
acpi_hest_init();
acpi_ghes_init();
acpi_scan_init();
acpi_ec_init();
acpi_debugfs_init();
Expand All @@ -1363,6 +1366,7 @@ static int __init acpi_init(void)
acpi_debugger_init();
acpi_setup_sb_notify_handler();
acpi_viot_init();
acpi_agdi_init();
return 0;
}

Expand Down
3 changes: 0 additions & 3 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include <linux/slab.h>
#include <linux/dmi.h>
#include <linux/platform_data/x86/apple.h>
#include <acpi/apei.h> /* for acpi_hest_init() */

#include "internal.h"

#define ACPI_PCI_ROOT_CLASS "pci_bridge"
Expand Down Expand Up @@ -943,7 +941,6 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,

void __init acpi_pci_root_init(void)
{
acpi_hest_init();
if (acpi_pci_disabled)
return;

Expand Down
Loading

0 comments on commit 8a9bd50

Please sign in to comment.