e336be
From dbdda4277cf0422a9ccb7ea98d0263c3cdbecdf6 Mon Sep 17 00:00:00 2001
e336be
From: Mark Salter <msalter@redhat.com>
e336be
Date: Tue, 8 May 2018 21:54:39 -0400
e336be
Subject: [PATCH] ACPI / irq: Workaround firmware issue on X-Gene based
e336be
 m400
e336be
e336be
The ACPI firmware on the xgene-based m400 platorms erroneously
e336be
describes its UART interrupt as ACPI_PRODUCER rather than
e336be
ACPI_CONSUMER. This leads to the UART driver being unable to
e336be
find its interrupt and the kernel unable find a console.
e336be
Work around this by avoiding the producer/consumer check
e336be
for X-Gene UARTs.
e336be
e336be
Signed-off-by: Mark Salter <msalter@redhat.com>
e336be
---
e336be
 drivers/acpi/irq.c | 17 +++++++++++++++--
e336be
 1 file changed, 15 insertions(+), 2 deletions(-)
e336be
e336be
diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
e336be
index 7c352cba0528..028c1a564cff 100644
e336be
--- a/drivers/acpi/irq.c
e336be
+++ b/drivers/acpi/irq.c
e336be
@@ -129,6 +129,7 @@ struct acpi_irq_parse_one_ctx {
e336be
 	unsigned int index;
e336be
 	unsigned long *res_flags;
e336be
 	struct irq_fwspec *fwspec;
e336be
+	bool skip_producer_check;
e336be
 };
e336be
 
e336be
 /**
e336be
@@ -200,7 +201,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
e336be
 		return AE_CTRL_TERMINATE;
e336be
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
e336be
 		eirq = &ares->data.extended_irq;
e336be
-		if (eirq->producer_consumer == ACPI_PRODUCER)
e336be
+		if (!ctx->skip_producer_check &&
e336be
+		    eirq->producer_consumer == ACPI_PRODUCER)
e336be
 			return AE_OK;
e336be
 		if (ctx->index >= eirq->interrupt_count) {
e336be
 			ctx->index -= eirq->interrupt_count;
e336be
@@ -235,8 +237,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
e336be
 static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
e336be
 			      struct irq_fwspec *fwspec, unsigned long *flags)
e336be
 {
e336be
-	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
e336be
+	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false };
e336be
 
e336be
+	/*
e336be
+	 * Firmware on arm64-based HPE m400 platform incorrectly marks
e336be
+	 * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER.
e336be
+	 * Don't do the producer/consumer check for that device.
e336be
+	 */
e336be
+	if (IS_ENABLED(CONFIG_ARM64)) {
e336be
+		struct acpi_device *adev = acpi_bus_get_acpi_device(handle);
e336be
+
e336be
+		if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08"))
e336be
+			ctx.skip_producer_check = true;
e336be
+	}
e336be
 	acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx;;
e336be
 	return ctx.rc;
e336be
 }
e336be
-- 
e336be
2.17.0
e336be