summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2020-06-30 20:09:37 +0000
committerkettenis <kettenis@openbsd.org>2020-06-30 20:09:37 +0000
commitfbddd1eca62a3f250d31e9bb337f697e042056c4 (patch)
treed6a3594d6969236056c3b2fff5c2b8dbd15f668f /sys
parentFix two minor issues in snmpc_parseagent. (diff)
downloadwireguard-openbsd-fbddd1eca62a3f250d31e9bb337f697e042056c4.tar.xz
wireguard-openbsd-fbddd1eca62a3f250d31e9bb337f697e042056c4.zip
Flush OPAL console when writing kernel messages. Removes annoying delay
before kernel messages show up on the serial console.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/powerpc64/include/opal.h4
-rw-r--r--sys/arch/powerpc64/powerpc64/locore.S3
-rw-r--r--sys/arch/powerpc64/powerpc64/machdep.c9
3 files changed, 13 insertions, 3 deletions
diff --git a/sys/arch/powerpc64/include/opal.h b/sys/arch/powerpc64/include/opal.h
index af0e92f0298..67fcc35bd46 100644
--- a/sys/arch/powerpc64/include/opal.h
+++ b/sys/arch/powerpc64/include/opal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: opal.h,v 1.11 2020/06/26 19:06:35 kettenis Exp $ */
+/* $OpenBSD: opal.h,v 1.12 2020/06/30 20:09:37 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -42,6 +42,7 @@
#define OPAL_GET_MSI_64 40
#define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45
#define OPAL_PCI_RESET 49
+#define OPAL_CONSOLE_FLUSH 117
#define OPAL_XIVE_RESET 128
#define OPAL_XIVE_GET_IRQ_INFO 129
#define OPAL_XIVE_GET_IRQ_CONFIG 131
@@ -167,6 +168,7 @@ int64_t opal_get_msi_64(uint64_t, uint32_t, uint32_t, uint8_t,
int64_t opal_pci_map_pe_dma_window_real(uint64_t, uint64_t, uint16_t,
uint64_t, uint64_t);
int64_t opal_pci_reset(uint64_t, uint8_t, uint8_t);
+int64_t opal_console_flush(uint64_t);
int64_t opal_xive_reset(uint64_t);
int64_t opal_xive_get_irq_info(uint32_t, uint64_t *, uint64_t *,
uint64_t *, uint32_t *, uint32_t *);
diff --git a/sys/arch/powerpc64/powerpc64/locore.S b/sys/arch/powerpc64/powerpc64/locore.S
index 1be8e5bab32..8328d71ae09 100644
--- a/sys/arch/powerpc64/powerpc64/locore.S
+++ b/sys/arch/powerpc64/powerpc64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.25 2020/06/28 00:07:22 kettenis Exp $ */
+/* $OpenBSD: locore.S,v 1.26 2020/06/30 20:09:37 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -252,6 +252,7 @@ OPAL_CALL(OPAL_GET_MSI_32, opal_get_msi_32)
OPAL_CALL(OPAL_GET_MSI_64, opal_get_msi_64)
OPAL_CALL(OPAL_PCI_MAP_PE_DMA_WINDOW_REAL, opal_pci_map_pe_dma_window_real)
OPAL_CALL(OPAL_PCI_RESET, opal_pci_reset)
+OPAL_CALL(OPAL_CONSOLE_FLUSH, opal_console_flush)
OPAL_CALL(OPAL_XIVE_RESET, opal_xive_reset)
OPAL_CALL(OPAL_XIVE_GET_IRQ_INFO, opal_xive_get_irq_info)
OPAL_CALL(OPAL_XIVE_GET_IRQ_CONFIG, opal_xive_get_irq_config)
diff --git a/sys/arch/powerpc64/powerpc64/machdep.c b/sys/arch/powerpc64/powerpc64/machdep.c
index 54c0f041e40..4103b282d1e 100644
--- a/sys/arch/powerpc64/powerpc64/machdep.c
+++ b/sys/arch/powerpc64/powerpc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.37 2020/06/28 00:07:22 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.38 2020/06/30 20:09:37 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -385,8 +385,15 @@ opal_cnputc(dev_t dev, int c)
{
uint64_t len = 1;
char ch = c;
+ int64_t error;
opal_console_write(0, opal_phys(&len), opal_phys(&ch));
+ while (1) {
+ error = opal_console_flush(0);
+ if (error != OPAL_BUSY && error != OPAL_PARTIAL)
+ break;
+ delay(1);
+ }
}
void