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 It seems that there are three 16550 types ...



details:   https://anonhg.NetBSD.org/src/rev/1f01986cf632
branches:  trunk
changeset: 1024430:1f01986cf632
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Oct 23 17:45:55 2021 +0000

description:
It seems that there are three 16550 types for SPCR:

 - 0x0000: Fully 16550-compatible (1-byte I/O)
 - 0x0001: 16550 subset compatible with DBGP Revision 1 (4-byte MMIO)
 - 0x0012: 16550-compatible with parameters defined in GAS

So assume reg_width for types 0 and 1, and only look at GAS for type 12h.

diffstat:

 sys/arch/arm/acpi/acpi_platform.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r fe1057788c6b -r 1f01986cf632 sys/arch/arm/acpi/acpi_platform.c
--- a/sys/arch/arm/acpi/acpi_platform.c Sat Oct 23 17:43:08 2021 +0000
+++ b/sys/arch/arm/acpi/acpi_platform.c Sat Oct 23 17:45:55 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.30 2021/10/21 00:09:28 jmcneill Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.31 2021/10/23 17:45:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.30 2021/10/21 00:09:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.31 2021/10/23 17:45:55 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -83,6 +83,8 @@
 
 #include <libfdt.h>
 
+#define        ACPI_DBG2_16550_GAS                     0x0012
+
 #define        SPCR_BAUD_DEFAULT                       0
 #define        SPCR_BAUD_9600                          3
 #define        SPCR_BAUD_19200                         4
@@ -188,11 +190,18 @@
 #if NCOM > 0
        case ACPI_DBG2_16550_COMPATIBLE:
        case ACPI_DBG2_16550_SUBSET:
+       case ACPI_DBG2_16550_GAS:
                memset(&dummy_bsh, 0, sizeof(dummy_bsh));
-               if (ACPI_ACCESS_BIT_WIDTH(spcr->SerialPort.AccessWidth) == 8) {
+               if (spcr->InterfaceType == ACPI_DBG2_16550_COMPATIBLE) {
                        reg_shift = 0;
+               } else if (spcr->InterfaceType == ACPI_DBG2_16550_SUBSET) {
+                       reg_shift = 2;
                } else {
-                       reg_shift = 2;
+                       if (ACPI_ACCESS_BIT_WIDTH(spcr->SerialPort.AccessWidth) == 8) {
+                               reg_shift = 0;
+                       } else {
+                               reg_shift = 2;
+                       }
                }
                com_init_regs_stride(&regs, &arm_generic_bs_tag, dummy_bsh,
                    le64toh(spcr->SerialPort.Address), reg_shift);



Home | Main Index | Thread Index | Old Index