summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-07-22 10:11:21 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-07-22 10:11:21 +0000
commit50b1095355876f61705aaeb2048e69e7bbf48f2b (patch)
tree716e160b13d78dc7e9437542f2c17c4930fdeb35
parent32c0cf3c571a2eb4f84a2de066dd18294fc5304f (diff)
BOOTARG_UCODE for AMD
ok deraadt@
-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/efiboot/conf.c4
-rw-r--r--sys/arch/amd64/stand/efiboot/exec_i386.c23
-rw-r--r--sys/arch/amd64/stand/libsa/exec_i386.c23
-rw-r--r--sys/arch/amd64/stand/pxeboot/conf.c4
-rw-r--r--sys/arch/i386/stand/boot/conf.c4
-rw-r--r--sys/arch/i386/stand/cdboot/conf.c4
-rw-r--r--sys/arch/i386/stand/libsa/exec_i386.c23
-rw-r--r--sys/arch/i386/stand/pxeboot/conf.c4
10 files changed, 71 insertions, 26 deletions
diff --git a/sys/arch/amd64/stand/boot/conf.c b/sys/arch/amd64/stand/boot/conf.c
index 00176599d62..9e8a4a70d4b 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.56 2023/04/25 10:06:12 kn Exp $ */
+/* $OpenBSD: conf.c,v 1.57 2023/07/22 10:11:19 jsg Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -41,7 +41,7 @@
#include <biosdev.h>
#include <dev/cons.h>
-const char version[] = "3.56";
+const char version[] = "3.65";
int debug = 1;
diff --git a/sys/arch/amd64/stand/cdboot/conf.c b/sys/arch/amd64/stand/cdboot/conf.c
index 654825fd64c..e8272bc42d4 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.50 2023/04/25 10:06:12 kn Exp $ */
+/* $OpenBSD: conf.c,v 1.51 2023/07/22 10:11:19 jsg Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -42,7 +42,7 @@
#include <biosdev.h>
#include <dev/cons.h>
-const char version[] = "3.56";
+const char version[] = "3.65";
int debug = 1;
diff --git a/sys/arch/amd64/stand/efiboot/conf.c b/sys/arch/amd64/stand/efiboot/conf.c
index ff714754c91..a7d10203bf3 100644
--- a/sys/arch/amd64/stand/efiboot/conf.c
+++ b/sys/arch/amd64/stand/efiboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.41 2023/04/25 10:11:20 kn Exp $ */
+/* $OpenBSD: conf.c,v 1.42 2023/07/22 10:11:19 jsg Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -40,7 +40,7 @@
#include "efidev.h"
#include "efipxe.h"
-const char version[] = "3.64";
+const char version[] = "3.65";
#ifdef EFI_DEBUG
int debug = 0;
diff --git a/sys/arch/amd64/stand/efiboot/exec_i386.c b/sys/arch/amd64/stand/efiboot/exec_i386.c
index e5b410472c1..b84476a2288 100644
--- a/sys/arch/amd64/stand/efiboot/exec_i386.c
+++ b/sys/arch/amd64/stand/efiboot/exec_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_i386.c,v 1.10 2023/02/23 19:48:21 miod Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.11 2023/07/22 10:11:19 jsg Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
@@ -180,7 +180,8 @@ ucode_load(void)
CPUID(0, dummy, vendor[0], vendor[2], vendor[1]);
vendor[3] = 0; /* NULL-terminate */
- if (strcmp((char *)vendor, "GenuineIntel") != 0)
+ if (strcmp((char *)vendor, "GenuineIntel") != 0 &&
+ strcmp((char *)vendor, "AuthenticAMD") != 0)
return;
CPUID(1, signature, dummy, dummy, dummy);
@@ -192,8 +193,22 @@ ucode_load(void)
}
stepping = (signature >> 0) & 0x0f;
- snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
- cmd.bootdev, family, model, stepping);
+ if (strcmp((char *)vendor, "GenuineIntel") == 0) {
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/intel/%02x-%02x-%02x",
+ cmd.bootdev, family, model, stepping);
+ } else if (strcmp((char *)vendor, "AuthenticAMD") == 0) {
+ if (family < 0x10)
+ return;
+ else if (family <= 0x14)
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/amd/microcode_amd.bin",
+ cmd.bootdev);
+ else
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/amd/microcode_amd_fam%02xh.bin",
+ cmd.bootdev, family);
+ }
fd = open(path, O_RDONLY);
if (fd == -1)
diff --git a/sys/arch/amd64/stand/libsa/exec_i386.c b/sys/arch/amd64/stand/libsa/exec_i386.c
index 1d2e14bf929..8dc0b924fb7 100644
--- a/sys/arch/amd64/stand/libsa/exec_i386.c
+++ b/sys/arch/amd64/stand/libsa/exec_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_i386.c,v 1.37 2022/07/11 19:45:02 kettenis Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.38 2023/07/22 10:11:19 jsg Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
@@ -202,7 +202,8 @@ ucode_load(void)
CPUID(0, dummy, vendor[0], vendor[2], vendor[1]);
vendor[3] = 0; /* NULL-terminate */
- if (strcmp((char *)vendor, "GenuineIntel") != 0)
+ if (strcmp((char *)vendor, "GenuineIntel") != 0 &&
+ strcmp((char *)vendor, "AuthenticAMD") != 0)
return;
CPUID(1, signature, dummy, dummy, dummy);
@@ -214,8 +215,22 @@ ucode_load(void)
}
stepping = (signature >> 0) & 0x0f;
- snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
- cmd.bootdev, family, model, stepping);
+ if (strcmp((char *)vendor, "GenuineIntel") == 0) {
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/intel/%02x-%02x-%02x",
+ cmd.bootdev, family, model, stepping);
+ } else if (strcmp((char *)vendor, "AuthenticAMD") == 0) {
+ if (family < 0x10)
+ return;
+ else if (family <= 0x14)
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/amd/microcode_amd.bin",
+ cmd.bootdev);
+ else
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/amd/microcode_amd_fam%02xh.bin",
+ cmd.bootdev, family);
+ }
fd = open(path, O_RDONLY);
if (fd == -1)
diff --git a/sys/arch/amd64/stand/pxeboot/conf.c b/sys/arch/amd64/stand/pxeboot/conf.c
index 290d50f001f..791ba5f6b1e 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.55 2023/04/25 10:06:12 kn Exp $ */
+/* $OpenBSD: conf.c,v 1.56 2023/07/22 10:11:20 jsg Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -44,7 +44,7 @@
#include "pxeboot.h"
#include "pxe_net.h"
-const char version[] = "3.56";
+const char version[] = "3.65";
int debug = 0;
void (*sa_cleanup)(void) = pxe_shutdown;
diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c
index f76ffad2c53..b6cb3946275 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.77 2023/04/25 14:48:16 kn Exp $ */
+/* $OpenBSD: conf.c,v 1.78 2023/07/22 10:11:20 jsg Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -42,7 +42,7 @@
#include <dev/cons.h>
#include "debug.h"
-const char version[] = "3.45";
+const char version[] = "3.65";
int debug = 1;
diff --git a/sys/arch/i386/stand/cdboot/conf.c b/sys/arch/i386/stand/cdboot/conf.c
index e18d8ba325f..5995647650f 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.44 2023/04/25 14:48:17 kn Exp $ */
+/* $OpenBSD: conf.c,v 1.45 2023/07/22 10:11:20 jsg Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -43,7 +43,7 @@
#include <dev/cons.h>
#include "debug.h"
-const char version[] = "3.45";
+const char version[] = "3.65";
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 d9e4da9db28..9bf8463edf4 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.52 2022/07/07 00:56:47 daniel Exp $ */
+/* $OpenBSD: exec_i386.c,v 1.53 2023/07/22 10:11:20 jsg Exp $ */
/*
* Copyright (c) 1997-1998 Michael Shalayeff
@@ -190,7 +190,8 @@ ucode_load(void)
CPUID(0, dummy, vendor[0], vendor[2], vendor[1]);
vendor[3] = 0; /* NULL-terminate */
- if (strcmp((char *)vendor, "GenuineIntel") != 0)
+ if (strcmp((char *)vendor, "GenuineIntel") != 0 &&
+ strcmp((char *)vendor, "AuthenticAMD") != 0)
return;
CPUID(1, signature, dummy, dummy, dummy);
@@ -202,8 +203,22 @@ ucode_load(void)
}
stepping = (signature >> 0) & 0x0f;
- snprintf(path, sizeof(path), "%s:/etc/firmware/intel/%02x-%02x-%02x",
- cmd.bootdev, family, model, stepping);
+ if (strcmp((char *)vendor, "GenuineIntel") == 0) {
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/intel/%02x-%02x-%02x",
+ cmd.bootdev, family, model, stepping);
+ } else if (strcmp((char *)vendor, "AuthenticAMD") == 0) {
+ if (family < 0x10)
+ return;
+ else if (family <= 0x14)
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/amd/microcode_amd.bin",
+ cmd.bootdev);
+ else
+ snprintf(path, sizeof(path),
+ "%s:/etc/firmware/amd/microcode_amd_fam%02xh.bin",
+ cmd.bootdev, family);
+ }
fd = open(path, O_RDONLY);
if (fd == -1)
diff --git a/sys/arch/i386/stand/pxeboot/conf.c b/sys/arch/i386/stand/pxeboot/conf.c
index f022641757b..4958b7e3441 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.49 2023/04/25 14:48:17 kn Exp $ */
+/* $OpenBSD: conf.c,v 1.50 2023/07/22 10:11:20 jsg Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@@ -45,7 +45,7 @@
#include "pxeboot.h"
#include "pxe_net.h"
-const char version[] = "3.45";
+const char version[] = "3.65";
int debug = 1;
void (*sa_cleanup)(void) = pxe_shutdown;