summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2018-07-11 14:48:41 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2018-07-11 14:48:41 +0000
commit6f094cd3d00797e7dcc943c035bdcef4139d71db (patch)
tree6095087f0dfd034b03be4ee57bf38c9994b0293d /sys/arch
parent6ce0ecbb4eebfeb6dd3bf32a315b737f916a033a (diff)
Detect vmm(4) in the bootloader and automatically switch to the serial
console at 115200 baud. tested by phessler and myself, ok deraadt
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/stand/boot/conf.c4
-rw-r--r--sys/arch/amd64/stand/cdboot/conf.c4
-rw-r--r--sys/arch/amd64/stand/libsa/machdep.c26
-rw-r--r--sys/arch/amd64/stand/pxeboot/conf.c4
4 files changed, 30 insertions, 8 deletions
diff --git a/sys/arch/amd64/stand/boot/conf.c b/sys/arch/amd64/stand/boot/conf.c
index 0154b0b389b..37c1ffea52c 100644
--- a/sys/arch/amd64/stand/boot/conf.c
+++ b/sys/arch/amd64/stand/boot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.40 2018/04/18 16:34:58 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.41 2018/07/11 14:48:40 mlarkin Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -40,7 +40,7 @@
#include <biosdev.h>
#include <dev/cons.h>
-const char version[] = "3.39";
+const char version[] = "3.40";
int debug = 1;
diff --git a/sys/arch/amd64/stand/cdboot/conf.c b/sys/arch/amd64/stand/cdboot/conf.c
index 7eaae57d984..41f976fc5b7 100644
--- a/sys/arch/amd64/stand/cdboot/conf.c
+++ b/sys/arch/amd64/stand/cdboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.35 2018/04/18 16:34:58 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.36 2018/07/11 14:48:40 mlarkin Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -41,7 +41,7 @@
#include <biosdev.h>
#include <dev/cons.h>
-const char version[] = "3.39";
+const char version[] = "3.40";
int debug = 1;
diff --git a/sys/arch/amd64/stand/libsa/machdep.c b/sys/arch/amd64/stand/libsa/machdep.c
index c6664ba33a9..246cda51cd8 100644
--- a/sys/arch/amd64/stand/libsa/machdep.c
+++ b/sys/arch/amd64/stand/libsa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.6 2015/09/18 13:30:56 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.7 2018/07/11 14:48:40 mlarkin Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -31,6 +31,8 @@
#include "biosdev.h"
#include <machine/apmvar.h>
#include <machine/biosvar.h>
+#include <machine/specialreg.h>
+#include <machine/vmmvar.h>
#ifdef EFIBOOT
#include "efiboot.h"
@@ -44,11 +46,15 @@ volatile struct BIOS_regs BIOS_regs;
#define CKPT(c) /* c */
#endif
+const char *vmm_hv_signature = VMM_HV_SIGNATURE;
+
void
machdep(void)
{
- int i, j;
+ int i, j, vmm = 0;
struct i386_boot_probes *pr;
+ uint32_t dummy, ebx, ecx, edx;
+ dev_t dev;
/*
* The list of probe routines is now in conf.c.
@@ -65,6 +71,22 @@ machdep(void)
printf("\n");
}
}
+
+ CPUID(0x1, dummy, dummy, ecx, dummy);
+ if (ecx & CPUIDECX_HV) {
+ CPUID(0x40000000, dummy, ebx, ecx, edx);
+ if (memcmp(&ebx, &vmm_hv_signature[0], sizeof(uint32_t)) == 0 &&
+ memcmp(&ecx, &vmm_hv_signature[4], sizeof(uint32_t)) == 0 &&
+ memcmp(&edx, &vmm_hv_signature[8], sizeof(uint32_t)) == 0)
+ vmm = 1;
+ }
+
+ /* Set console to com0/115200 by default in vmm */
+ if (vmm) {
+ dev = ttydev("com0");
+ cnspeed(dev, 115200);
+ cnset(dev);
+ }
}
int
diff --git a/sys/arch/amd64/stand/pxeboot/conf.c b/sys/arch/amd64/stand/pxeboot/conf.c
index fd4103a3ddb..4d40f45d7fc 100644
--- a/sys/arch/amd64/stand/pxeboot/conf.c
+++ b/sys/arch/amd64/stand/pxeboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.39 2018/04/18 16:34:58 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.40 2018/07/11 14:48:40 mlarkin Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -43,7 +43,7 @@
#include "pxeboot.h"
#include "pxe_net.h"
-const char version[] = "3.39";
+const char version[] = "3.40";
int debug = 0;
void (*sa_cleanup)(void) = pxe_shutdown;