diff options
Diffstat (limited to 'sys/arch/i386/stand')
-rw-r--r-- | sys/arch/i386/stand/boot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/cdboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/exec_i386.c | 64 | ||||
-rw-r--r-- | sys/arch/i386/stand/pxeboot/conf.c | 4 |
4 files changed, 69 insertions, 7 deletions
diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c index b1ef8d8ea57..4bb6d6ba32e 100644 --- a/sys/arch/i386/stand/boot/conf.c +++ b/sys/arch/i386/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.64 2018/08/10 16:43:54 jsing Exp $ */ +/* $OpenBSD: conf.c,v 1.65 2018/08/23 14:47:52 jsg Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -41,7 +41,7 @@ #include <dev/cons.h> #include "debug.h" -const char version[] = "3.33"; +const char version[] = "3.34"; int debug = 1; diff --git a/sys/arch/i386/stand/cdboot/conf.c b/sys/arch/i386/stand/cdboot/conf.c index df50d2e23e0..909fd604f0a 100644 --- a/sys/arch/i386/stand/cdboot/conf.c +++ b/sys/arch/i386/stand/cdboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.32 2018/07/11 18:08:05 mlarkin Exp $ */ +/* $OpenBSD: conf.c,v 1.33 2018/08/23 14:47:52 jsg Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -42,7 +42,7 @@ #include <dev/cons.h> #include "debug.h" -const char version[] = "3.29"; +const char version[] = "3.30"; int debug = 1; void (*sa_cleanup)(void) = NULL; diff --git a/sys/arch/i386/stand/libsa/exec_i386.c b/sys/arch/i386/stand/libsa/exec_i386.c index 4364a3c0295..4049f8b74f0 100644 --- a/sys/arch/i386/stand/libsa/exec_i386.c +++ b/sys/arch/i386/stand/libsa/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.44 2016/09/11 17:52:47 jsing Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.45 2018/08/23 14:47:52 jsg Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -33,8 +33,10 @@ #include <dev/cons.h> #include <lib/libsa/loadfile.h> #include <machine/biosvar.h> +#include <machine/specialreg.h> #include <stand/boot/bootarg.h> +#include "cmd.h" #include "disk.h" #include "libsa.h" @@ -51,6 +53,9 @@ typedef void (*startfuncp)(int, int, int, int, int, int, int, int) __attribute__ ((noreturn)); +void ucode_load(void); +extern struct cmd_state cmd; + char *bootmac = NULL; void @@ -99,6 +104,8 @@ run_loadfile(u_long *marks, int howto) bcopy(bootdev_dip->disklabel.d_uid, &bootduid.duid, sizeof(bootduid)); addbootarg(BOOTARG_BOOTDUID, sizeof(bootduid), &bootduid); + ucode_load(); + #ifdef SOFTRAID if (bootdev_dip->sr_vol != NULL) { bv = bootdev_dip->sr_vol; @@ -144,3 +151,58 @@ run_loadfile(u_long *marks, int howto) /* not reached */ #endif } + +void +ucode_load(void) +{ + uint32_t model, family, stepping; + uint32_t dummy, signature; + uint32_t vendor[4]; + bios_ucode_t uc; + struct stat sb; + char path[128]; + size_t buflen; + char *buf; + int fd; + + CPUID(0, dummy, vendor[0], vendor[2], vendor[1]); + vendor[3] = 0; /* NULL-terminate */ + if (strcmp((char *)vendor, "GenuineIntel") != 0) + return; + + CPUID(1, signature, dummy, dummy, dummy); + family = (signature >> 8) & 0x0f; + model = (signature >> 4) & 0x0f; + if (family == 0x6 || family == 0xf) { + family += (signature >> 20) & 0xff; + model += ((signature >> 16) & 0x0f) << 4; + } + stepping = (signature >> 0) & 0x0f; + + snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x", + cmd.bootdev, family, model, stepping); + + fd = open(path, 0); + if (fd == -1) + return; + + if (fstat(fd, &sb) == -1) + return; + + buflen = sb.st_size; + if (buflen > 128*1024) { + printf("ucode too large\n"); + return; + } + + buf = (char *)(1*1024*1024); + + if (read(fd, buf, buflen) != buflen) { + free(buf, buflen); + return; + } + + uc.uc_addr = (uint64_t)buf; + uc.uc_size = (uint64_t)buflen; + addbootarg(BOOTARG_UCODE, sizeof(uc), &uc); +} diff --git a/sys/arch/i386/stand/pxeboot/conf.c b/sys/arch/i386/stand/pxeboot/conf.c index 2ffe11c1adc..8872e6a281a 100644 --- a/sys/arch/i386/stand/pxeboot/conf.c +++ b/sys/arch/i386/stand/pxeboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.37 2018/07/11 18:08:05 mlarkin Exp $ */ +/* $OpenBSD: conf.c,v 1.38 2018/08/23 14:47:52 jsg Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -44,7 +44,7 @@ #include "pxeboot.h" #include "pxe_net.h" -const char version[] = "3.29"; +const char version[] = "3.30"; int debug = 1; void (*sa_cleanup)(void) = pxe_shutdown; |