Skip to content

Commit 3226186

Browse files
committed
Merge tag 'acpi-extra-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more ACPI updates from Rafael Wysocki: "These fix the ACPI SPCR table handling and add a workaround for APM X-Gene 8250 UART on top of that, fix two ACPI hotplug issues related to hot-remove failures, add a missing "static" to one function and constify some attribute_group structures. Specifics: - Fix the ACPI code handling the SPCR table to check access width of MMIO regions and add a workaround for APM X-Gene 8250 UART to use 32-bit MMIO accesses with its register (Loc Ho). - Fix two ACPI-based hotplug issues related to the handling of hot-remove failures on the OS side (Chun-Yi Lee). - Constify attribute_group structures in a few places (Arvind Yadav). - Make one local function static (Colin Ian King)" * tag 'acpi-extra-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / DPTF: constify attribute_group structures ACPI / LPSS: constify attribute_group structures ACPI: BGRT: constify attribute_group structures ACPI / power: constify attribute_group structures ACPI / scan: Indicate to platform when hot remove returns busy ACPI / bus: handle ACPI hotplug schedule errors completely ACPI / osi: Make local function acpi_osi_dmi_linux() static ACPI: SPCR: Workaround for APM X-Gene 8250 UART 32-alignment errata ACPI: SPCR: Use access width to determine mmio usage
2 parents 1633b39 + f19e80b commit 3226186

File tree

9 files changed

+74
-18
lines changed

9 files changed

+74
-18
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static struct attribute *lpss_attrs[] = {
576576
NULL,
577577
};
578578

579-
static struct attribute_group lpss_attr_group = {
579+
static const struct attribute_group lpss_attr_group = {
580580
.attrs = lpss_attrs,
581581
.name = "lpss_ltr",
582582
};

drivers/acpi/bgrt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static struct bin_attribute *bgrt_bin_attributes[] = {
7676
NULL,
7777
};
7878

79-
static struct attribute_group bgrt_attribute_group = {
79+
static const struct attribute_group bgrt_attribute_group = {
8080
.attrs = bgrt_attributes,
8181
.bin_attrs = bgrt_bin_attributes,
8282
};

drivers/acpi/bus.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,11 +409,15 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
409409
(driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
410410
driver->ops.notify(adev, type);
411411

412-
if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
412+
if (!hotplug_event) {
413+
acpi_bus_put_acpi_device(adev);
414+
return;
415+
}
416+
417+
if (ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
413418
return;
414419

415420
acpi_bus_put_acpi_device(adev);
416-
return;
417421

418422
err:
419423
acpi_evaluate_ost(handle, type, ost_code, NULL);

drivers/acpi/dptf/dptf_power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static struct attribute *dptf_power_attrs[] = {
6565
NULL
6666
};
6767

68-
static struct attribute_group dptf_power_attribute_group = {
68+
static const struct attribute_group dptf_power_attribute_group = {
6969
.attrs = dptf_power_attrs,
7070
.name = "dptf_power"
7171
};

drivers/acpi/osi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ static void __init acpi_osi_dmi_darwin(bool enable,
265265
__acpi_osi_setup_darwin(enable);
266266
}
267267

268-
void __init acpi_osi_dmi_linux(bool enable, const struct dmi_system_id *d)
268+
static void __init acpi_osi_dmi_linux(bool enable,
269+
const struct dmi_system_id *d)
269270
{
270271
pr_notice("DMI detected to setup _OSI(\"Linux\"): %s\n", d->ident);
271272
osi_config.linux_dmi = 1;

drivers/acpi/power.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static struct attribute *attrs[] = {
352352
NULL,
353353
};
354354

355-
static struct attribute_group attr_groups[] = {
355+
static const struct attribute_group attr_groups[] = {
356356
[ACPI_STATE_D0] = {
357357
.name = "power_resources_D0",
358358
.attrs = attrs,
@@ -371,14 +371,14 @@ static struct attribute_group attr_groups[] = {
371371
},
372372
};
373373

374-
static struct attribute_group wakeup_attr_group = {
374+
static const struct attribute_group wakeup_attr_group = {
375375
.name = "power_resources_wakeup",
376376
.attrs = attrs,
377377
};
378378

379379
static void acpi_power_hide_list(struct acpi_device *adev,
380380
struct list_head *resources,
381-
struct attribute_group *attr_group)
381+
const struct attribute_group *attr_group)
382382
{
383383
struct acpi_power_resource_entry *entry;
384384

@@ -397,7 +397,7 @@ static void acpi_power_hide_list(struct acpi_device *adev,
397397

398398
static void acpi_power_expose_list(struct acpi_device *adev,
399399
struct list_head *resources,
400-
struct attribute_group *attr_group)
400+
const struct attribute_group *attr_group)
401401
{
402402
struct acpi_power_resource_entry *entry;
403403
int ret;
@@ -425,7 +425,7 @@ static void acpi_power_expose_list(struct acpi_device *adev,
425425

426426
static void acpi_power_expose_hide(struct acpi_device *adev,
427427
struct list_head *resources,
428-
struct attribute_group *attr_group,
428+
const struct attribute_group *attr_group,
429429
bool expose)
430430
{
431431
if (expose)

drivers/acpi/scan.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,6 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
404404
error = dock_notify(adev, src);
405405
} else if (adev->flags.hotplug_notify) {
406406
error = acpi_generic_hotplug_event(adev, src);
407-
if (error == -EPERM) {
408-
ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
409-
goto err_out;
410-
}
411407
} else {
412408
int (*notify)(struct acpi_device *, u32);
413409

@@ -423,8 +419,20 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
423419
else
424420
goto out;
425421
}
426-
if (!error)
422+
switch (error) {
423+
case 0:
427424
ost_code = ACPI_OST_SC_SUCCESS;
425+
break;
426+
case -EPERM:
427+
ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
428+
break;
429+
case -EBUSY:
430+
ost_code = ACPI_OST_SC_DEVICE_BUSY;
431+
break;
432+
default:
433+
ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
434+
break;
435+
}
428436

429437
err_out:
430438
acpi_evaluate_ost(adev->handle, src, ost_code, NULL);

drivers/acpi/spcr.c

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ static bool qdf2400_erratum_44_present(struct acpi_table_header *h)
3636
return false;
3737
}
3838

39+
/*
40+
* APM X-Gene v1 and v2 UART hardware is an 16550 like device but has its
41+
* register aligned to 32-bit. In addition, the BIOS also encoded the
42+
* access width to be 8 bits. This function detects this errata condition.
43+
*/
44+
static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
45+
{
46+
if (tb->interface_type != ACPI_DBG2_16550_COMPATIBLE)
47+
return false;
48+
49+
if (memcmp(tb->header.oem_id, "APMC0D", ACPI_OEM_ID_SIZE))
50+
return false;
51+
52+
if (!memcmp(tb->header.oem_table_id, "XGENESPC",
53+
ACPI_OEM_TABLE_ID_SIZE) && tb->header.oem_revision == 0)
54+
return true;
55+
56+
return false;
57+
}
58+
3959
/**
4060
* parse_spcr() - parse ACPI SPCR table and add preferred console
4161
*
@@ -74,8 +94,22 @@ int __init parse_spcr(bool earlycon)
7494
goto done;
7595
}
7696

77-
iotype = table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY ?
78-
"mmio" : "io";
97+
if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
98+
switch (table->serial_port.access_width) {
99+
default:
100+
pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n");
101+
case ACPI_ACCESS_SIZE_BYTE:
102+
iotype = "mmio";
103+
break;
104+
case ACPI_ACCESS_SIZE_WORD:
105+
iotype = "mmio16";
106+
break;
107+
case ACPI_ACCESS_SIZE_DWORD:
108+
iotype = "mmio32";
109+
break;
110+
}
111+
} else
112+
iotype = "io";
79113

80114
switch (table->interface_type) {
81115
case ACPI_DBG2_ARM_SBSA_32BIT:
@@ -115,6 +149,8 @@ int __init parse_spcr(bool earlycon)
115149

116150
if (qdf2400_erratum_44_present(&table->header))
117151
uart = "qdf2400_e44";
152+
if (xgene_8250_erratum_present(table))
153+
iotype = "mmio32";
118154

119155
snprintf(opts, sizeof(opts), "%s,%s,0x%llx,%d", uart, iotype,
120156
table->serial_port.address, baud_rate);

include/acpi/acrestyp.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,13 @@ struct acpi_resource_generic_register {
377377
u64 address;
378378
};
379379

380+
/* Generic Address Space Access Sizes */
381+
#define ACPI_ACCESS_SIZE_UNDEFINED 0
382+
#define ACPI_ACCESS_SIZE_BYTE 1
383+
#define ACPI_ACCESS_SIZE_WORD 2
384+
#define ACPI_ACCESS_SIZE_DWORD 3
385+
#define ACPI_ACCESS_SIZE_QWORD 4
386+
380387
struct acpi_resource_gpio {
381388
u8 revision_id;
382389
u8 connection_type;

0 commit comments

Comments
 (0)