Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/acpi Always map ACPI table memory as normal mem...



details:   https://anonhg.NetBSD.org/src/rev/53c594a2d76d
branches:  trunk
changeset: 453200:53c594a2d76d
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Aug 01 18:59:10 2019 +0000

description:
Always map ACPI table memory as normal memory. Always map device memory as device memory.

diffstat:

 sys/arch/arm/acpi/acpi_machdep.c |  30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diffs (58 lines):

diff -r ddd85ba5c2a2 -r 53c594a2d76d sys/arch/arm/acpi/acpi_machdep.c
--- a/sys/arch/arm/acpi/acpi_machdep.c  Thu Aug 01 17:50:16 2019 +0000
+++ b/sys/arch/arm/acpi/acpi_machdep.c  Thu Aug 01 18:59:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.7 2019/08/01 13:13:51 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.8 2019/08/01 18:59:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "pci.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.7 2019/08/01 13:13:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.8 2019/08/01 18:59:10 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,21 +74,31 @@
                return 0;
 
        while (len >= 28) {
+               const uint32_t type = be32dec(&map[0]);
                const uint64_t phys_start = be64dec(&map[1]);
                const uint64_t num_pages = be64dec(&map[3]);
                const uint64_t attr = be64dec(&map[5]);
 
                if (pa >= phys_start && pa < phys_start + (num_pages * EFI_PAGE_SIZE)) {
-                       if ((attr & EFI_MD_ATTR_UC) != 0)
-                               return PMAP_DEV;        /* Not cacheable means Device-nGnRnE */
-                       else if ((attr & EFI_MD_ATTR_WC) != 0)
-                               return PMAP_WRITE_COMBINE;
-                       else if ((attr & EFI_MD_ATTR_WT) != 0)
-                               return 0;       /* XXX */
-                       else if ((attr & EFI_MD_ATTR_WB) != 0)
+                       switch (type) {
+                       case EFI_MD_TYPE_RECLAIM:
+                               /* ACPI table memory */
                                return PMAP_WRITE_BACK;
-                       else
+
+                       case EFI_MD_TYPE_IOMEM:
+                       case EFI_MD_TYPE_IOPORT:
                                return PMAP_DEV;
+
+                       default:
+                               if ((attr & EFI_MD_ATTR_WB) != 0)
+                                       return PMAP_WRITE_BACK;
+                               else if ((attr & EFI_MD_ATTR_WC) != 0)
+                                       return PMAP_WRITE_COMBINE;
+                               else if ((attr & EFI_MD_ATTR_WT) != 0)
+                                       return 0;       /* XXX */
+
+                               return PMAP_DEV;
+                       }
                }
 
                map += 7;



Home | Main Index | Thread Index | Old Index