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 Force a matching com@puc by seg/bus/dev/fu...
details: https://anonhg.NetBSD.org/src/rev/de0965a16059
branches: trunk
changeset: 994942:de0965a16059
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Nov 28 22:29:36 2018 +0000
description:
Force a matching com@puc by seg/bus/dev/func to be the console device if specified in SPCR
diffstat:
sys/arch/arm/acpi/acpi_platform.c | 39 +++++++++++++++++++++++++++++++++++++--
1 files changed, 37 insertions(+), 2 deletions(-)
diffs (67 lines):
diff -r 85371fbc60a4 -r de0965a16059 sys/arch/arm/acpi/acpi_platform.c
--- a/sys/arch/arm/acpi/acpi_platform.c Wed Nov 28 22:28:46 2018 +0000
+++ b/sys/arch/arm/acpi/acpi_platform.c Wed Nov 28 22:29:36 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.9 2018/11/28 03:17:13 jmcneill Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.10 2018/11/28 22:29:36 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include "opt_efi.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.9 2018/11/28 03:17:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.10 2018/11/28 22:29:36 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -64,6 +64,12 @@
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
+#if NCOM > 0
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pucvar.h>
+#endif
+
#ifdef EFI_RUNTIME
#include <arm/arm/efi_runtime.h>
#endif
@@ -223,6 +229,35 @@
static void
acpi_platform_device_register(device_t self, void *aux)
{
+#if NCOM > 0
+ prop_dictionary_t prop = device_properties(self);
+
+ if (device_is_a(self, "com") && device_is_a(device_parent(self), "puc")) {
+ const struct puc_attach_args * const paa = aux;
+ ACPI_TABLE_SPCR *spcr;
+ int b, d, f;
+
+ const int s = pci_get_segment(paa->pc);
+ pci_decompose_tag(paa->pc, paa->tag, &b, &d, &f);
+
+ if (ACPI_FAILURE(acpi_table_find(ACPI_SIG_SPCR, (void **)&spcr)))
+ return;
+ if (spcr->SerialPort.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY)
+ goto spcr_unmap;
+ if (spcr->SerialPort.Address == 0)
+ goto spcr_unmap;
+ if (spcr->InterfaceType != ACPI_DBG2_16550_COMPATIBLE &&
+ spcr->InterfaceType != ACPI_DBG2_16550_SUBSET)
+ goto spcr_unmap;
+
+ if (spcr->PciSegment == s && spcr->PciBus == b &&
+ spcr->PciDevice == d && spcr->PciFunction == f)
+ prop_dictionary_set_bool(prop, "force_console", true);
+
+spcr_unmap:
+ acpi_table_unmap((ACPI_TABLE_HEADER *)spcr);
+ }
+#endif
}
static void
Home |
Main Index |
Thread Index |
Old Index