Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Jul 2021 15:16:52 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1472117a1e1c - main - Support fixed size, variable location acpi resources
Message-ID:  <202107091516.169FGqte011851@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=1472117a1e1c40f10b9c3a48788fbf8355588ee8

commit 1472117a1e1c40f10b9c3a48788fbf8355588ee8
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-07-08 15:25:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2021-07-09 01:31:19 +0000

    Support fixed size, variable location acpi resources
    
    These have been found in some Arm ACPI tables generated by edk2, e.g.
    when describing the pl011 uart on the Arm AEMv8 model.
    
    Reviewed by:    imp, jkim
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D31110
---
 sys/dev/acpica/acpi_resource.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c
index fbd0baaa7d37..2e813276af8f 100644
--- a/sys/dev/acpica/acpi_resource.c
+++ b/sys/dev/acpica/acpi_resource.c
@@ -421,6 +421,27 @@ acpi_parse_resource(ACPI_RESOURCE *res, void *context)
 		    (uintmax_t)min, (uintmax_t)length));
 		set->set_ioport(dev, arc->context, min, length);
 	    }
+	} else if (res->Data.Address.MinAddressFixed != ACPI_ADDRESS_FIXED &&
+	    res->Data.Address.MaxAddressFixed != ACPI_ADDRESS_FIXED) {
+	    /* Fixed size, variable location resource descriptor */
+	    min = roundup(min, gran + 1);
+	    if ((min + length - 1) > max) {
+		device_printf(dev,
+		    "invalid memory range: start: %jx end: %jx max: %jx\n",
+		    (uintmax_t)min, (uintmax_t)(min + length - 1),
+		    (uintmax_t)max);
+	    } else {
+		if (res->Data.Address.ResourceType == ACPI_MEMORY_RANGE) {
+		    ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+			"%s/Memory 0x%jx/%ju\n", name, (uintmax_t)min,
+			(uintmax_t)length));
+		    set->set_memory(dev, arc->context, min, length);
+		} else {
+		    ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s/IO 0x%jx/%ju\n",
+			name, (uintmax_t)min, (uintmax_t)length));
+		    set->set_ioport(dev, arc->context, min, length);
+		}
+	    }
 	} else {
 	    if (res->Data.Address32.ResourceType == ACPI_MEMORY_RANGE) {
 		ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107091516.169FGqte011851>