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