Skip to content

Commit 8a9bd50

Browse files
committed
Merge branches 'acpi-soc', 'acpi-video' and 'acpi-apei'
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()
4 parents 24b2b09 + 620c803 + c844d22 + a2a591f commit 8a9bd50

18 files changed

Lines changed: 273 additions & 41 deletions

File tree

drivers/acpi/acpi_lpss.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/pm_domain.h>
2222
#include <linux/pm_runtime.h>
2323
#include <linux/pwm.h>
24+
#include <linux/pxa2xx_ssp.h>
2425
#include <linux/suspend.h>
2526
#include <linux/delay.h>
2627

@@ -82,7 +83,7 @@ struct lpss_device_desc {
8283
const char *clk_con_id;
8384
unsigned int prv_offset;
8485
size_t prv_size_override;
85-
struct property_entry *properties;
86+
const struct property_entry *properties;
8687
void (*setup)(struct lpss_private_data *pdata);
8788
bool resume_from_noirq;
8889
};
@@ -219,10 +220,16 @@ static void bsw_pwm_setup(struct lpss_private_data *pdata)
219220
pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));
220221
}
221222

222-
static const struct lpss_device_desc lpt_dev_desc = {
223+
static const struct property_entry lpt_spi_properties[] = {
224+
PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_LPT_SSP),
225+
{ }
226+
};
227+
228+
static const struct lpss_device_desc lpt_spi_dev_desc = {
223229
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR
224230
| LPSS_SAVE_CTX,
225231
.prv_offset = 0x800,
232+
.properties = lpt_spi_properties,
226233
};
227234

228235
static const struct lpss_device_desc lpt_i2c_dev_desc = {
@@ -282,9 +289,15 @@ static const struct lpss_device_desc bsw_uart_dev_desc = {
282289
.properties = uart_properties,
283290
};
284291

292+
static const struct property_entry byt_spi_properties[] = {
293+
PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_BYT_SSP),
294+
{ }
295+
};
296+
285297
static const struct lpss_device_desc byt_spi_dev_desc = {
286298
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX,
287299
.prv_offset = 0x400,
300+
.properties = byt_spi_properties,
288301
};
289302

290303
static const struct lpss_device_desc byt_sdio_dev_desc = {
@@ -305,11 +318,17 @@ static const struct lpss_device_desc bsw_i2c_dev_desc = {
305318
.resume_from_noirq = true,
306319
};
307320

321+
static const struct property_entry bsw_spi_properties[] = {
322+
PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_BSW_SSP),
323+
{ }
324+
};
325+
308326
static const struct lpss_device_desc bsw_spi_dev_desc = {
309327
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX
310328
| LPSS_NO_D3_DELAY,
311329
.prv_offset = 0x400,
312330
.setup = lpss_deassert_reset,
331+
.properties = bsw_spi_properties,
313332
};
314333

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

331350
/* Lynxpoint LPSS devices */
332-
{ "INT33C0", LPSS_ADDR(lpt_dev_desc) },
333-
{ "INT33C1", LPSS_ADDR(lpt_dev_desc) },
351+
{ "INT33C0", LPSS_ADDR(lpt_spi_dev_desc) },
352+
{ "INT33C1", LPSS_ADDR(lpt_spi_dev_desc) },
334353
{ "INT33C2", LPSS_ADDR(lpt_i2c_dev_desc) },
335354
{ "INT33C3", LPSS_ADDR(lpt_i2c_dev_desc) },
336355
{ "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) },
@@ -356,8 +375,8 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
356375
{ "808622C1", LPSS_ADDR(bsw_i2c_dev_desc) },
357376

358377
/* Broadwell LPSS devices */
359-
{ "INT3430", LPSS_ADDR(lpt_dev_desc) },
360-
{ "INT3431", LPSS_ADDR(lpt_dev_desc) },
378+
{ "INT3430", LPSS_ADDR(lpt_spi_dev_desc) },
379+
{ "INT3431", LPSS_ADDR(lpt_spi_dev_desc) },
361380
{ "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
362381
{ "INT3433", LPSS_ADDR(lpt_i2c_dev_desc) },
363382
{ "INT3434", LPSS_ADDR(lpt_uart_dev_desc) },
@@ -366,7 +385,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
366385
{ "INT3437", },
367386

368387
/* Wildcat Point LPSS devices */
369-
{ "INT3438", LPSS_ADDR(lpt_dev_desc) },
388+
{ "INT3438", LPSS_ADDR(lpt_spi_dev_desc) },
370389

371390
{ }
372391
};

drivers/acpi/acpi_platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static void acpi_platform_fill_resource(struct acpi_device *adev,
9595
* Name of the platform device will be the same as @adev's.
9696
*/
9797
struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
98-
struct property_entry *properties)
98+
const struct property_entry *properties)
9999
{
100100
struct platform_device *pdev = NULL;
101101
struct platform_device_info pdevinfo;

drivers/acpi/apei/bert.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#undef pr_fmt
3131
#define pr_fmt(fmt) "BERT: " fmt
32+
#define ACPI_BERT_PRINT_MAX_LEN 1024
3233

3334
static int bert_disable;
3435

@@ -58,8 +59,11 @@ static void __init bert_print_all(struct acpi_bert_region *region,
5859
}
5960

6061
pr_info_once("Error records from previous boot:\n");
61-
62-
cper_estatus_print(KERN_INFO HW_ERR, estatus);
62+
if (region_len < ACPI_BERT_PRINT_MAX_LEN)
63+
cper_estatus_print(KERN_INFO HW_ERR, estatus);
64+
else
65+
pr_info_once("Max print length exceeded, table data is available at:\n"
66+
"/sys/firmware/acpi/tables/data/BERT");
6367

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

80-
return 0;
84+
return 1;
8185
}
8286
__setup("bert_disable", setup_bert_disable);
8387

drivers/acpi/apei/erst.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ EXPORT_SYMBOL_GPL(erst_clear);
891891
static int __init setup_erst_disable(char *str)
892892
{
893893
erst_disable = 1;
894-
return 0;
894+
return 1;
895895
}
896896

897897
__setup("erst_disable", setup_erst_disable);

drivers/acpi/apei/ghes.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,33 +1457,35 @@ static struct platform_driver ghes_platform_driver = {
14571457
.remove = ghes_remove,
14581458
};
14591459

1460-
static int __init ghes_init(void)
1460+
void __init acpi_ghes_init(void)
14611461
{
14621462
int rc;
14631463

1464+
sdei_init();
1465+
14641466
if (acpi_disabled)
1465-
return -ENODEV;
1467+
return;
14661468

14671469
switch (hest_disable) {
14681470
case HEST_NOT_FOUND:
1469-
return -ENODEV;
1471+
return;
14701472
case HEST_DISABLED:
14711473
pr_info(GHES_PFX "HEST is not enabled!\n");
1472-
return -EINVAL;
1474+
return;
14731475
default:
14741476
break;
14751477
}
14761478

14771479
if (ghes_disable) {
14781480
pr_info(GHES_PFX "GHES is not enabled!\n");
1479-
return -EINVAL;
1481+
return;
14801482
}
14811483

14821484
ghes_nmi_init_cxt();
14831485

14841486
rc = platform_driver_register(&ghes_platform_driver);
14851487
if (rc)
1486-
goto err;
1488+
return;
14871489

14881490
rc = apei_osc_setup();
14891491
if (rc == 0 && osc_sb_apei_support_acked)
@@ -1494,9 +1496,4 @@ static int __init ghes_init(void)
14941496
pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit.\n");
14951497
else
14961498
pr_info(GHES_PFX "Failed to enable APEI firmware first mode.\n");
1497-
1498-
return 0;
1499-
err:
1500-
return rc;
15011499
}
1502-
device_initcall(ghes_init);

drivers/acpi/apei/hest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static int __init hest_ghes_dev_register(unsigned int ghes_count)
224224
static int __init setup_hest_disable(char *str)
225225
{
226226
hest_disable = HEST_DISABLED;
227-
return 0;
227+
return 1;
228228
}
229229

230230
__setup("hest_disable", setup_hest_disable);

drivers/acpi/arm64/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@ config ACPI_IORT
88

99
config ACPI_GTDT
1010
bool
11+
12+
config ACPI_AGDI
13+
bool "Arm Generic Diagnostic Dump and Reset Device Interface"
14+
depends on ARM_SDE_INTERFACE
15+
help
16+
Arm Generic Diagnostic Dump and Reset Device Interface (AGDI) is
17+
a standard that enables issuing a non-maskable diagnostic dump and
18+
reset command.
19+
20+
If set, the kernel parses AGDI table and listens for the command.

drivers/acpi/arm64/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2+
obj-$(CONFIG_ACPI_AGDI) += agdi.o
23
obj-$(CONFIG_ACPI_IORT) += iort.o
34
obj-$(CONFIG_ACPI_GTDT) += gtdt.o
45
obj-y += dma.o

drivers/acpi/arm64/agdi.c

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* This file implements handling of
4+
* Arm Generic Diagnostic Dump and Reset Interface table (AGDI)
5+
*
6+
* Copyright (c) 2022, Ampere Computing LLC
7+
*/
8+
9+
#define pr_fmt(fmt) "ACPI: AGDI: " fmt
10+
11+
#include <linux/acpi.h>
12+
#include <linux/arm_sdei.h>
13+
#include <linux/io.h>
14+
#include <linux/kernel.h>
15+
#include <linux/platform_device.h>
16+
17+
struct agdi_data {
18+
int sdei_event;
19+
};
20+
21+
static int agdi_sdei_handler(u32 sdei_event, struct pt_regs *regs, void *arg)
22+
{
23+
nmi_panic(regs, "Arm Generic Diagnostic Dump and Reset SDEI event issued");
24+
return 0;
25+
}
26+
27+
static int agdi_sdei_probe(struct platform_device *pdev,
28+
struct agdi_data *adata)
29+
{
30+
int err;
31+
32+
err = sdei_event_register(adata->sdei_event, agdi_sdei_handler, pdev);
33+
if (err) {
34+
dev_err(&pdev->dev, "Failed to register for SDEI event %d",
35+
adata->sdei_event);
36+
return err;
37+
}
38+
39+
err = sdei_event_enable(adata->sdei_event);
40+
if (err) {
41+
sdei_event_unregister(adata->sdei_event);
42+
dev_err(&pdev->dev, "Failed to enable event %d\n",
43+
adata->sdei_event);
44+
return err;
45+
}
46+
47+
return 0;
48+
}
49+
50+
static int agdi_probe(struct platform_device *pdev)
51+
{
52+
struct agdi_data *adata = dev_get_platdata(&pdev->dev);
53+
54+
if (!adata)
55+
return -EINVAL;
56+
57+
return agdi_sdei_probe(pdev, adata);
58+
}
59+
60+
static int agdi_remove(struct platform_device *pdev)
61+
{
62+
struct agdi_data *adata = dev_get_platdata(&pdev->dev);
63+
int err, i;
64+
65+
err = sdei_event_disable(adata->sdei_event);
66+
if (err)
67+
return err;
68+
69+
for (i = 0; i < 3; i++) {
70+
err = sdei_event_unregister(adata->sdei_event);
71+
if (err != -EINPROGRESS)
72+
break;
73+
74+
schedule();
75+
}
76+
77+
return err;
78+
}
79+
80+
static struct platform_driver agdi_driver = {
81+
.driver = {
82+
.name = "agdi",
83+
},
84+
.probe = agdi_probe,
85+
.remove = agdi_remove,
86+
};
87+
88+
void __init acpi_agdi_init(void)
89+
{
90+
struct acpi_table_agdi *agdi_table;
91+
struct agdi_data pdata;
92+
struct platform_device *pdev;
93+
acpi_status status;
94+
95+
status = acpi_get_table(ACPI_SIG_AGDI, 0,
96+
(struct acpi_table_header **) &agdi_table);
97+
if (ACPI_FAILURE(status))
98+
return;
99+
100+
if (agdi_table->flags & ACPI_AGDI_SIGNALING_MODE) {
101+
pr_warn("Interrupt signaling is not supported");
102+
goto err_put_table;
103+
}
104+
105+
pdata.sdei_event = agdi_table->sdei_event;
106+
107+
pdev = platform_device_register_data(NULL, "agdi", 0, &pdata, sizeof(pdata));
108+
if (IS_ERR(pdev))
109+
goto err_put_table;
110+
111+
if (platform_driver_register(&agdi_driver))
112+
platform_device_unregister(pdev);
113+
114+
err_put_table:
115+
acpi_put_table((struct acpi_table_header *)agdi_table);
116+
}

drivers/acpi/bus.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <asm/mpspec.h>
2727
#include <linux/dmi.h>
2828
#endif
29+
#include <linux/acpi_agdi.h>
2930
#include <linux/acpi_iort.h>
3031
#include <linux/acpi_viot.h>
3132
#include <linux/pci.h>
@@ -1355,6 +1356,8 @@ static int __init acpi_init(void)
13551356

13561357
pci_mmcfg_late_init();
13571358
acpi_iort_init();
1359+
acpi_hest_init();
1360+
acpi_ghes_init();
13581361
acpi_scan_init();
13591362
acpi_ec_init();
13601363
acpi_debugfs_init();
@@ -1363,6 +1366,7 @@ static int __init acpi_init(void)
13631366
acpi_debugger_init();
13641367
acpi_setup_sb_notify_handler();
13651368
acpi_viot_init();
1369+
acpi_agdi_init();
13661370
return 0;
13671371
}
13681372

0 commit comments

Comments
 (0)