BOOTARG_UCODE for AMD
authorjsg <jsg@openbsd.org>
Sat, 22 Jul 2023 10:11:19 +0000 (10:11 +0000)
committerjsg <jsg@openbsd.org>
Sat, 22 Jul 2023 10:11:19 +0000 (10:11 +0000)
ok deraadt@

sys/arch/amd64/stand/boot/conf.c
sys/arch/amd64/stand/cdboot/conf.c
sys/arch/amd64/stand/efiboot/conf.c
sys/arch/amd64/stand/efiboot/exec_i386.c
sys/arch/amd64/stand/libsa/exec_i386.c
sys/arch/amd64/stand/pxeboot/conf.c
sys/arch/i386/stand/boot/conf.c
sys/arch/i386/stand/cdboot/conf.c
sys/arch/i386/stand/libsa/exec_i386.c
sys/arch/i386/stand/pxeboot/conf.c

index 0017659..9e8a4a7 100644 (file)
@@ -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;
 
 
index 654825f..e8272bc 100644 (file)
@@ -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;
 
 
index ff71475..a7d1020 100644 (file)
@@ -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;
index e5b4104..b84476a 100644 (file)
@@ -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)
index 1d2e14b..8dc0b92 100644 (file)
@@ -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)
index 290d50f..791ba5f 100644 (file)
@@ -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;
index f76ffad..b6cb394 100644 (file)
@@ -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;
 
 
index e18d8ba..5995647 100644 (file)
@@ -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;
index d9e4da9..9bf8463 100644 (file)
@@ -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)
index f022641..4958b7e 100644 (file)
@@ -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;