summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@fingolfin.org>2020-04-29 22:46:57 -0700
committerRobert Mustacchi <rm@fingolfin.org>2020-04-30 18:53:20 -0700
commit9f9cceb6f1158940244c35cecdbc93f9a386a4b8 (patch)
tree4f90d6cb9318c4ca09823badc245bcec5cbdeec9 /usr/src
parentf343451914d0efaf2d6fc84d8818a16246b223dc (diff)
downloadillumos-joyent-9f9cceb6f1158940244c35cecdbc93f9a386a4b8.tar.gz
12662 smbios(1M) interprets jedec IDs incorrectly
12664 fix smbios memory technology operating mode capabilities Reviewed by: Yuri Pankov <ypankov@fastmail.com> Reviewed by: Toomas Soome <toomas@me.com> Reviewed by: Paul Winder <paul@winders.demon.co.uk> Reviewed by: Gergo Doma <domag02@gmail.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/smbios/smbios.c20
-rw-r--r--usr/src/uts/common/sys/smbios.h11
2 files changed, 21 insertions, 10 deletions
diff --git a/usr/src/cmd/smbios/smbios.c b/usr/src/cmd/smbios/smbios.c
index 0d3f110961..5597e04fc5 100644
--- a/usr/src/cmd/smbios/smbios.c
+++ b/usr/src/cmd/smbios/smbios.c
@@ -177,13 +177,23 @@ jedec_print(FILE *fp, const char *desc, uint_t id)
const char *name;
uint_t cont, vendor;
- vendor = id & 0xff;
- cont = (id >> 8) & 0xff;
+ /*
+ * SMBIOS encodes data in the way that the underlying memory standard
+ * does. In this case, the upper byte indicates the vendor that we care
+ * about while the lower byte indicates the number of continuations that
+ * are needed. libjedec indexes this based on zero (e.g. table 1 is zero
+ * continuations), which is how the spec encodes it. We add one so that
+ * we can match how the spec describes it.
+ */
+ vendor = id >> 8;
+ cont = id & 0x7f;
name = libjedec_vendor_string(cont, vendor);
if (name == NULL) {
- oprintf(fp, " %s: 0x%x\n", desc, id);
+ oprintf(fp, " %s: Bank: 0x%x Vendor: 0x%x\n", desc, cont + 1,
+ vendor);
} else {
- oprintf(fp, " %s: 0x%x (%s)\n", desc, id, name);
+ oprintf(fp, " %s: Bank: 0x%x Vendor: 0x%x (%s)\n", desc,
+ cont + 1, vendor, name);
}
}
@@ -994,7 +1004,7 @@ print_memdevice(smbios_hdl_t *shp, id_t id, FILE *fp)
}
if (md.smbmd_opcap_flags != 0) {
- flag_printf(fp, " Operating Mode Capabilities",
+ flag_printf(fp, "Operating Mode Capabilities",
md.smbmd_opcap_flags, sizeof (md.smbmd_opcap_flags) * NBBY,
smbios_memdevice_op_capab_name,
smbios_memdevice_op_capab_desc);
diff --git a/usr/src/uts/common/sys/smbios.h b/usr/src/uts/common/sys/smbios.h
index 34281898e0..55048d549d 100644
--- a/usr/src/uts/common/sys/smbios.h
+++ b/usr/src/uts/common/sys/smbios.h
@@ -1315,11 +1315,12 @@ typedef struct smbios_memdevice {
#define SMB_MTECH_NVDIMM_P 0x06 /* NVDIMM-P */
#define SMB_MTECH_INTCPM 0x07 /* Intel Optane DC Persistent Memory */
-#define SMB_MOMC_OTHER 0x01 /* other */
-#define SMB_MOMC_UNKNOWN 0x02 /* unknown */
-#define SMB_MOMC_VOLATILE 0x04 /* Volatile memory */
-#define SMB_MOMC_BYTE_PM 0x08 /* Byte-accessible persistent memory */
-#define SMB_MOMC_BLOCK_PM 0x10 /* Block-accessible persistent memory */
+#define SMB_MOMC_RESERVED 0x01 /* reserved */
+#define SMB_MOMC_OTHER 0x02 /* other */
+#define SMB_MOMC_UNKNOWN 0x04 /* unknown */
+#define SMB_MOMC_VOLATILE 0x08 /* Volatile memory */
+#define SMB_MOMC_BYTE_PM 0x10 /* Byte-accessible persistent memory */
+#define SMB_MOMC_BLOCK_PM 0x20 /* Block-accessible persistent memory */
/*
* SMBIOS Memory Array Mapped Address. See DSP0134 Section 7.20 for more