summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-09-19 21:30:45 +0000
committeremaste <emaste@FreeBSD.org>2014-09-19 21:30:45 +0000
commitb462b88810e3c403b0297489af2b79f055a26640 (patch)
tree9522ed82b02d6bc987a743f157ac07be267db11f /sys/boot
parentae99ef305ca80c243675a4966c4eae09490ab644 (diff)
downloadFreeBSD-src-b462b88810e3c403b0297489af2b79f055a26640.zip
FreeBSD-src-b462b88810e3c403b0297489af2b79f055a26640.tar.gz
MFC r271475 by ambrisko:
Add support for serial and null console to UEFI boot loader. Approved by: re
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/amd64/efi/bootinfo.c9
-rw-r--r--sys/boot/amd64/efi/conf.c4
-rw-r--r--sys/boot/efi/libefi/Makefile4
-rw-r--r--sys/boot/i386/libi386/comconsole.c8
4 files changed, 25 insertions, 0 deletions
diff --git a/sys/boot/amd64/efi/bootinfo.c b/sys/boot/amd64/efi/bootinfo.c
index bf11f5b..2d45dd0 100644
--- a/sys/boot/amd64/efi/bootinfo.c
+++ b/sys/boot/amd64/efi/bootinfo.c
@@ -60,6 +60,7 @@ bi_getboothowto(char *kargs)
{
const char *sw;
char *opts;
+ char *console;
int howto, i;
howto = 0;
@@ -70,6 +71,14 @@ bi_getboothowto(char *kargs)
howto |= howto_names[i].mask;
}
+ console = getenv("console");
+ if (console != NULL) {
+ if (strcmp(console, "comconsole") == 0)
+ howto |= RB_SERIAL;
+ if (strcmp(console, "nullconsole") == 0)
+ howto |= RB_MUTE;
+ }
+
/* Parse kargs */
if (kargs == NULL)
return (howto);
diff --git a/sys/boot/amd64/efi/conf.c b/sys/boot/amd64/efi/conf.c
index 0e67b6b..f9984a3 100644
--- a/sys/boot/amd64/efi/conf.c
+++ b/sys/boot/amd64/efi/conf.c
@@ -62,8 +62,12 @@ struct file_format *file_formats[] = {
};
extern struct console efi_console;
+extern struct console comconsole;
+extern struct console nullconsole;
struct console *consoles[] = {
&efi_console,
+ &comconsole,
+ &nullconsole,
NULL
};
diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile
index 60cb43f..3edeb22 100644
--- a/sys/boot/efi/libefi/Makefile
+++ b/sys/boot/efi/libefi/Makefile
@@ -5,6 +5,8 @@ INTERNALLIB=
SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
libefi.c time.c
+.PATH: ${.CURDIR}/../../i386/libi386
+SRCS+= nullconsole.c comconsole.c
.if ${MACHINE_ARCH} == "amd64"
CFLAGS+= -fPIC
@@ -16,6 +18,8 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${.CURDIR}/../../common
+CFLAGS+= -DNO_PCI
+
# Suppress warning from clang for FreeBSD %b and %D formats
CFLAGS+= -fformat-extensions
diff --git a/sys/boot/i386/libi386/comconsole.c b/sys/boot/i386/libi386/comconsole.c
index 76a6240..bd2a2e8 100644
--- a/sys/boot/i386/libi386/comconsole.c
+++ b/sys/boot/i386/libi386/comconsole.c
@@ -214,6 +214,9 @@ comc_port_set(struct env_var *ev, int flags, const void *value)
static uint32_t
comc_parse_pcidev(const char *string)
{
+#ifdef NO_PCI
+ return (0);
+#else
char *p, *p1;
uint8_t bus, dev, func, bar;
uint32_t locator;
@@ -247,11 +250,15 @@ comc_parse_pcidev(const char *string)
locator = (bar << 16) | biospci_locator(bus, dev, func);
return (locator);
+#endif
}
static int
comc_pcidev_handle(uint32_t locator)
{
+#ifdef NO_PCI
+ return (CMD_ERROR);
+#else
char intbuf[64];
uint32_t port;
@@ -275,6 +282,7 @@ comc_pcidev_handle(uint32_t locator)
comc_locator = locator;
return (CMD_OK);
+#endif
}
static int
OpenPOWER on IntegriCloud