aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-10 18:19:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-10 18:19:40 -0400
commit322618684353315e14f586b33d8a016286ffa700 (patch)
treea4698a2bb539db49dab81f126f34486164dcdf29
parent1633b396105b69efe8bfc83e33662276cc8a7675 (diff)
parentf19e80b394808ed763e2669b08aea480adcc46be (diff)
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
-rw-r--r--drivers/acpi/acpi_lpss.c2
-rw-r--r--drivers/acpi/bgrt.c2
-rw-r--r--drivers/acpi/bus.c8
-rw-r--r--drivers/acpi/dptf/dptf_power.c2
-rw-r--r--drivers/acpi/osi.c3
-rw-r--r--drivers/acpi/power.c10
-rw-r--r--drivers/acpi/scan.c18
-rw-r--r--drivers/acpi/spcr.c40
-rw-r--r--include/acpi/acrestyp.h7
9 files changed, 74 insertions, 18 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 10347e3d73ad..e51a1e98e62f 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -576,7 +576,7 @@ static struct attribute *lpss_attrs[] = {
576 NULL, 576 NULL,
577}; 577};
578 578
579static struct attribute_group lpss_attr_group = { 579static const struct attribute_group lpss_attr_group = {
580 .attrs = lpss_attrs, 580 .attrs = lpss_attrs,
581 .name = "lpss_ltr", 581 .name = "lpss_ltr",
582}; 582};
diff --git a/drivers/acpi/bgrt.c b/drivers/acpi/bgrt.c
index df1c629205e7..75af78361ce5 100644
--- a/drivers/acpi/bgrt.c
+++ b/drivers/acpi/bgrt.c
@@ -76,7 +76,7 @@ static struct bin_attribute *bgrt_bin_attributes[] = {
76 NULL, 76 NULL,
77}; 77};
78 78
79static struct attribute_group bgrt_attribute_group = { 79static const struct attribute_group bgrt_attribute_group = {
80 .attrs = bgrt_attributes, 80 .attrs = bgrt_attributes,
81 .bin_attrs = bgrt_bin_attributes, 81 .bin_attrs = bgrt_bin_attributes,
82}; 82};
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 5a6fbe0fcaf2..af74b420ec83 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -409,11 +409,15 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
409 (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) 409 (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
410 driver->ops.notify(adev, type); 410 driver->ops.notify(adev, type);
411 411
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)))
413 return; 418 return;
414 419
415 acpi_bus_put_acpi_device(adev); 420 acpi_bus_put_acpi_device(adev);
416 return;
417 421
418 err: 422 err:
419 acpi_evaluate_ost(handle, type, ost_code, NULL); 423 acpi_evaluate_ost(handle, type, ost_code, NULL);
diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c
index 734642dc5008..e1c242568341 100644
--- a/drivers/acpi/dptf/dptf_power.c
+++ b/drivers/acpi/dptf/dptf_power.c
@@ -65,7 +65,7 @@ static struct attribute *dptf_power_attrs[] = {
65 NULL 65 NULL
66}; 66};
67 67
68static struct attribute_group dptf_power_attribute_group = { 68static const struct attribute_group dptf_power_attribute_group = {
69 .attrs = dptf_power_attrs, 69 .attrs = dptf_power_attrs,
70 .name = "dptf_power" 70 .name = "dptf_power"
71}; 71};
diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c
index 849f9d2245ca..723bee58bbcf 100644
--- a/drivers/acpi/osi.c
+++ b/drivers/acpi/osi.c
@@ -265,7 +265,8 @@ static void __init acpi_osi_dmi_darwin(bool enable,
265 __acpi_osi_setup_darwin(enable); 265 __acpi_osi_setup_darwin(enable);
266} 266}
267 267
268void __init acpi_osi_dmi_linux(bool enable, const struct dmi_system_id *d) 268static void __init acpi_osi_dmi_linux(bool enable,
269 const struct dmi_system_id *d)
269{ 270{
270 pr_notice("DMI detected to setup _OSI(\"Linux\"): %s\n", d->ident); 271 pr_notice("DMI detected to setup _OSI(\"Linux\"): %s\n", d->ident);
271 osi_config.linux_dmi = 1; 272 osi_config.linux_dmi = 1;
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 3a6c9b741b23..1b475bc1ae16 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -352,7 +352,7 @@ static struct attribute *attrs[] = {
352 NULL, 352 NULL,
353}; 353};
354 354
355static struct attribute_group attr_groups[] = { 355static const struct attribute_group attr_groups[] = {
356 [ACPI_STATE_D0] = { 356 [ACPI_STATE_D0] = {
357 .name = "power_resources_D0", 357 .name = "power_resources_D0",
358 .attrs = attrs, 358 .attrs = attrs,
@@ -371,14 +371,14 @@ static struct attribute_group attr_groups[] = {
371 }, 371 },
372}; 372};
373 373
374static struct attribute_group wakeup_attr_group = { 374static const struct attribute_group wakeup_attr_group = {
375 .name = "power_resources_wakeup", 375 .name = "power_resources_wakeup",
376 .attrs = attrs, 376 .attrs = attrs,
377}; 377};
378 378
379static void acpi_power_hide_list(struct acpi_device *adev, 379static void acpi_power_hide_list(struct acpi_device *adev,
380 struct list_head *resources, 380 struct list_head *resources,
381 struct attribute_group *attr_group) 381 const struct attribute_group *attr_group)
382{ 382{
383 struct acpi_power_resource_entry *entry; 383 struct acpi_power_resource_entry *entry;
384 384
@@ -397,7 +397,7 @@ static void acpi_power_hide_list(struct acpi_device *adev,
397 397
398static void acpi_power_expose_list(struct acpi_device *adev, 398static void acpi_power_expose_list(struct acpi_device *adev,
399 struct list_head *resources, 399 struct list_head *resources,
400 struct attribute_group *attr_group) 400 const struct attribute_group *attr_group)
401{ 401{
402 struct acpi_power_resource_entry *entry; 402 struct acpi_power_resource_entry *entry;
403 int ret; 403 int ret;
@@ -425,7 +425,7 @@ static void acpi_power_expose_list(struct acpi_device *adev,
425 425
426static void acpi_power_expose_hide(struct acpi_device *adev, 426static void acpi_power_expose_hide(struct acpi_device *adev,
427 struct list_head *resources, 427 struct list_head *resources,
428 struct attribute_group *attr_group, 428 const struct attribute_group *attr_group,
429 bool expose) 429 bool expose)
430{ 430{
431 if (expose) 431 if (expose)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 09f65f57bebe..59ebbd5f7b83 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -404,10 +404,6 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
404 error = dock_notify(adev, src); 404 error = dock_notify(adev, src);
405 } else if (adev->flags.hotplug_notify) { 405 } else if (adev->flags.hotplug_notify) {
406 error = acpi_generic_hotplug_event(adev, src); 406 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 }
411 } else { 407 } else {
412 int (*notify)(struct acpi_device *, u32); 408 int (*notify)(struct acpi_device *, u32);
413 409
@@ -423,8 +419,20 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
423 else 419 else
424 goto out; 420 goto out;
425 } 421 }
426 if (!error) 422 switch (error) {
423 case 0:
427 ost_code = ACPI_OST_SC_SUCCESS; 424 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 }
428 436
429 err_out: 437 err_out:
430 acpi_evaluate_ost(adev->handle, src, ost_code, NULL); 438 acpi_evaluate_ost(adev->handle, src, ost_code, NULL);
diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 3afa8c1fa127..4ac3e06b41d8 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -36,6 +36,26 @@ static bool qdf2400_erratum_44_present(struct acpi_table_header *h)
36 return false; 36 return false;
37} 37}
38 38
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 */
44static 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
39/** 59/**
40 * parse_spcr() - parse ACPI SPCR table and add preferred console 60 * parse_spcr() - parse ACPI SPCR table and add preferred console
41 * 61 *
@@ -74,8 +94,22 @@ int __init parse_spcr(bool earlycon)
74 goto done; 94 goto done;
75 } 95 }
76 96
77 iotype = table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY ? 97 if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
78 "mmio" : "io"; 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";
79 113
80 switch (table->interface_type) { 114 switch (table->interface_type) {
81 case ACPI_DBG2_ARM_SBSA_32BIT: 115 case ACPI_DBG2_ARM_SBSA_32BIT:
@@ -115,6 +149,8 @@ int __init parse_spcr(bool earlycon)
115 149
116 if (qdf2400_erratum_44_present(&table->header)) 150 if (qdf2400_erratum_44_present(&table->header))
117 uart = "qdf2400_e44"; 151 uart = "qdf2400_e44";
152 if (xgene_8250_erratum_present(table))
153 iotype = "mmio32";
118 154
119 snprintf(opts, sizeof(opts), "%s,%s,0x%llx,%d", uart, iotype, 155 snprintf(opts, sizeof(opts), "%s,%s,0x%llx,%d", uart, iotype,
120 table->serial_port.address, baud_rate); 156 table->serial_port.address, baud_rate);
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 343dbdcef20c..4f7f39a02820 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -377,6 +377,13 @@ struct acpi_resource_generic_register {
377 u64 address; 377 u64 address;
378}; 378};
379 379
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
380struct acpi_resource_gpio { 387struct acpi_resource_gpio {
381 u8 revision_id; 388 u8 revision_id;
382 u8 connection_type; 389 u8 connection_type;