Module Name:    src
Committed By:   jmcneill
Date:           Sat Oct 23 17:45:55 UTC 2021

Modified Files:
        src/sys/arch/arm/acpi: acpi_platform.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/acpi/acpi_platform.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.30 src/sys/arch/arm/acpi/acpi_platform.c:1.31
--- src/sys/arch/arm/acpi/acpi_platform.c:1.30	Thu Oct 21 00:09:28 2021
+++ src/sys/arch/arm/acpi/acpi_platform.c	Sat Oct 23 17:45:55 2021
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_platfor
 
 #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 @@ acpi_platform_attach_uart(ACPI_TABLE_SPC
 #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 {
+		} else if (spcr->InterfaceType == ACPI_DBG2_16550_SUBSET) {
 			reg_shift = 2;
+		} else {
+			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);

Reply via email to