1
0
Fork 0

More ACPI updates for v4.13-rc1

- 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).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJZY/M4AAoJEILEb/54YlRxwf4QAJph6HYzSUlOWdiY6ufGZ9Ff
 XmR0xUt6VAol6Kj8otZzlf3txBejn6ABMtdeneEulHYQKT3SXlQFcRz2rm9Ggp22
 i5B/Tdg1dHCRCxha4YZouXX8NnioKn/VsgXKRHoPrHaQZPNU6RNW8LS4UvsQbuxQ
 qx+7Le1lZN9bgMmaw/Hl1HW6QIVe4VCnl0fwYo/BgXCWEfnL+kotmCCywPivpSK4
 9t8uyFLHGLZwXcZsyibawl32X5mON/QNbUC4fKp35Z0xJ7Gl2/9+KhsUot6wXnFs
 BTfC5rJcI8CpWzlftPe9p5uZ2W4NGsLqW1osu8p4HXliY8vAACa3GqNa0fe5cU/g
 SOR+hxEO9DbwG+SuINxbmIYZxYwAT5TrQo76+jkmmbpQymtD52N0L24CWqU55FPn
 WAIP39FQUQqMVtYqxh29c2LbDvvzXH2BXk0O4RZl6sATInMESrX4FFp0hOOfJrtl
 2i27He05EZDAtM55i2/eNjmsG5j8eMux+30c1JsybNidM9ukvbztfO+Pt7oR+02c
 r975bzX3Uu8NObIDswzfVSnMpcdisdJ2grqJu2H8MTDgCt4ttBeMMpp8Y+i/k7qf
 yGyzA0rd+wuQenwH9BqZiWVSaWflK3OrvrrOPlYJcvTsmIGzj3nCTsD94rqqkD2x
 2i8BCl3IiX3JSy+lu6Xn
 =cdK6
 -----END PGP SIGNATURE-----

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
hifive-unleashed-5.1
Linus Torvalds 2017-07-10 15:19:40 -07:00
commit 3226186843
9 changed files with 74 additions and 18 deletions

View File

@ -576,7 +576,7 @@ static struct attribute *lpss_attrs[] = {
NULL,
};
static struct attribute_group lpss_attr_group = {
static const struct attribute_group lpss_attr_group = {
.attrs = lpss_attrs,
.name = "lpss_ltr",
};

View File

@ -76,7 +76,7 @@ static struct bin_attribute *bgrt_bin_attributes[] = {
NULL,
};
static struct attribute_group bgrt_attribute_group = {
static const struct attribute_group bgrt_attribute_group = {
.attrs = bgrt_attributes,
.bin_attrs = bgrt_bin_attributes,
};

View File

@ -409,11 +409,15 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
(driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
driver->ops.notify(adev, type);
if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
if (!hotplug_event) {
acpi_bus_put_acpi_device(adev);
return;
}
if (ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
return;
acpi_bus_put_acpi_device(adev);
return;
err:
acpi_evaluate_ost(handle, type, ost_code, NULL);

View File

@ -65,7 +65,7 @@ static struct attribute *dptf_power_attrs[] = {
NULL
};
static struct attribute_group dptf_power_attribute_group = {
static const struct attribute_group dptf_power_attribute_group = {
.attrs = dptf_power_attrs,
.name = "dptf_power"
};

View File

@ -265,7 +265,8 @@ static void __init acpi_osi_dmi_darwin(bool enable,
__acpi_osi_setup_darwin(enable);
}
void __init acpi_osi_dmi_linux(bool enable, const struct dmi_system_id *d)
static void __init acpi_osi_dmi_linux(bool enable,
const struct dmi_system_id *d)
{
pr_notice("DMI detected to setup _OSI(\"Linux\"): %s\n", d->ident);
osi_config.linux_dmi = 1;

View File

@ -352,7 +352,7 @@ static struct attribute *attrs[] = {
NULL,
};
static struct attribute_group attr_groups[] = {
static const struct attribute_group attr_groups[] = {
[ACPI_STATE_D0] = {
.name = "power_resources_D0",
.attrs = attrs,
@ -371,14 +371,14 @@ static struct attribute_group attr_groups[] = {
},
};
static struct attribute_group wakeup_attr_group = {
static const struct attribute_group wakeup_attr_group = {
.name = "power_resources_wakeup",
.attrs = attrs,
};
static void acpi_power_hide_list(struct acpi_device *adev,
struct list_head *resources,
struct attribute_group *attr_group)
const struct attribute_group *attr_group)
{
struct acpi_power_resource_entry *entry;
@ -397,7 +397,7 @@ static void acpi_power_hide_list(struct acpi_device *adev,
static void acpi_power_expose_list(struct acpi_device *adev,
struct list_head *resources,
struct attribute_group *attr_group)
const struct attribute_group *attr_group)
{
struct acpi_power_resource_entry *entry;
int ret;
@ -425,7 +425,7 @@ static void acpi_power_expose_list(struct acpi_device *adev,
static void acpi_power_expose_hide(struct acpi_device *adev,
struct list_head *resources,
struct attribute_group *attr_group,
const struct attribute_group *attr_group,
bool expose)
{
if (expose)

View File

@ -404,10 +404,6 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
error = dock_notify(adev, src);
} else if (adev->flags.hotplug_notify) {
error = acpi_generic_hotplug_event(adev, src);
if (error == -EPERM) {
ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
goto err_out;
}
} else {
int (*notify)(struct acpi_device *, u32);
@ -423,8 +419,20 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
else
goto out;
}
if (!error)
switch (error) {
case 0:
ost_code = ACPI_OST_SC_SUCCESS;
break;
case -EPERM:
ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
break;
case -EBUSY:
ost_code = ACPI_OST_SC_DEVICE_BUSY;
break;
default:
ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
break;
}
err_out:
acpi_evaluate_ost(adev->handle, src, ost_code, NULL);

View File

@ -36,6 +36,26 @@ static bool qdf2400_erratum_44_present(struct acpi_table_header *h)
return false;
}
/*
* APM X-Gene v1 and v2 UART hardware is an 16550 like device but has its
* register aligned to 32-bit. In addition, the BIOS also encoded the
* access width to be 8 bits. This function detects this errata condition.
*/
static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
{
if (tb->interface_type != ACPI_DBG2_16550_COMPATIBLE)
return false;
if (memcmp(tb->header.oem_id, "APMC0D", ACPI_OEM_ID_SIZE))
return false;
if (!memcmp(tb->header.oem_table_id, "XGENESPC",
ACPI_OEM_TABLE_ID_SIZE) && tb->header.oem_revision == 0)
return true;
return false;
}
/**
* parse_spcr() - parse ACPI SPCR table and add preferred console
*
@ -74,8 +94,22 @@ int __init parse_spcr(bool earlycon)
goto done;
}
iotype = table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY ?
"mmio" : "io";
if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
switch (table->serial_port.access_width) {
default:
pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n");
case ACPI_ACCESS_SIZE_BYTE:
iotype = "mmio";
break;
case ACPI_ACCESS_SIZE_WORD:
iotype = "mmio16";
break;
case ACPI_ACCESS_SIZE_DWORD:
iotype = "mmio32";
break;
}
} else
iotype = "io";
switch (table->interface_type) {
case ACPI_DBG2_ARM_SBSA_32BIT:
@ -115,6 +149,8 @@ int __init parse_spcr(bool earlycon)
if (qdf2400_erratum_44_present(&table->header))
uart = "qdf2400_e44";
if (xgene_8250_erratum_present(table))
iotype = "mmio32";
snprintf(opts, sizeof(opts), "%s,%s,0x%llx,%d", uart, iotype,
table->serial_port.address, baud_rate);

View File

@ -377,6 +377,13 @@ struct acpi_resource_generic_register {
u64 address;
};
/* Generic Address Space Access Sizes */
#define ACPI_ACCESS_SIZE_UNDEFINED 0
#define ACPI_ACCESS_SIZE_BYTE 1
#define ACPI_ACCESS_SIZE_WORD 2
#define ACPI_ACCESS_SIZE_DWORD 3
#define ACPI_ACCESS_SIZE_QWORD 4
struct acpi_resource_gpio {
u8 revision_id;
u8 connection_type;