-/* $OpenBSD: amd64errata.c,v 1.13 2022/09/20 07:54:27 jsg Exp $ */
+/* $OpenBSD: amd64errata.c,v 1.14 2022/09/23 01:25:39 jsg Exp $ */
/* $NetBSD: errata.c,v 1.6 2007/02/05 21:05:45 ad Exp $ */
/*-
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
-
typedef struct errata {
u_short e_num;
u_short e_reported;
int found = 0;
int corrected = 0;
u_int32_t regs[4];
+ static int printed = 0;
cpuid(0x80000001, regs);
int first = 1;
/* Print out found and corrected */
- printf("%s: AMD %s", ci->ci_dev->dv_xname,
- (corrected == 1) ? "erratum" : "errata");
+ if (!printed) {
+ printf("%s: AMD %s", ci->ci_dev->dv_xname,
+ (corrected == 1) ? "erratum" : "errata");
+ }
for (e = errata; e < ex; e++) {
if (e->e_reported == 2) {
- if (! first)
- printf(",");
- printf(" %d", e->e_num);
+ if (!printed) {
+ if (! first)
+ printf(",");
+ printf(" %d", e->e_num);
+ }
first = 0;
}
}
- printf(" detected and fixed\n");
+ if (!printed)
+ printf(" detected and fixed\n");
}
#endif
int first = 1;
/* Print out found but not corrected */
- printf("%s: AMD %s", ci->ci_dev->dv_xname,
- (found == 1) ? "erratum" : "errata");
+ if (!printed) {
+ printf("%s: AMD %s", ci->ci_dev->dv_xname,
+ (found == 1) ? "erratum" : "errata");
+ }
for (e = errata; e < ex; e++) {
if (e->e_reported == 1) {
- if (! first)
- printf(",");
- printf(" %d", e->e_num);
+ if (!printed) {
+ if (! first)
+ printf(",");
+ printf(" %d", e->e_num);
+ }
first = 0;
}
}
- printf(" present, BIOS upgrade may be required\n");
+ if (!printed)
+ printf(" present, BIOS upgrade may be required\n");
}
+
+ /* Print only one time for the first CPU */
+ printed = 1;
}