Skip to content

Commit

Permalink
16754 libjedec support for LPDDR3-5, DDR3
Browse files Browse the repository at this point in the history
16753 update libjedec for DDR5 SPD 1.2
16755 Overhaul and improve SPD tests, fallout
16756 Rename libjedec_test to better reflect vendor nature
Reviewed by: Toomas Soome <[email protected]>
Approved by: Dan McDonald <[email protected]>
  • Loading branch information
rmustacc committed Sep 21, 2024
1 parent 2833423 commit 8119dad
Show file tree
Hide file tree
Showing 43 changed files with 9,324 additions and 504 deletions.
3 changes: 2 additions & 1 deletion exception_lists/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011 by Delphix. All rights reserved.
# Copyright (c) 2018, Joyent, Inc.
# Copyright 2020 Oxide Computer Company
# Copyright 2024 Oxide Computer Company
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
#

Expand Down Expand Up @@ -397,6 +397,7 @@ usr/src/test/util-tests/tests/grep_xpg4/files/gout*
usr/src/test/util-tests/tests/grep_xpg4/files/test*
usr/src/test/util-tests/tests/head/*.in
usr/src/test/util-tests/tests/head/*.out
usr/src/test/util-tests/tests/libjedec/hex2spd/data/*/*.spd
usr/src/test/util-tests/tests/libsff/*.out
usr/src/test/util-tests/tests/pcieadm/*.out
usr/src/test/util-tests/tests/pcieadm/*.pci
Expand Down
101 changes: 98 additions & 3 deletions usr/src/lib/fm/topo/modules/common/dimm/topo_dimm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/*
* Copyright 2023 Oxide Computer Company
* Copyright 2024 Oxide Computer Company
*/

/*
Expand Down Expand Up @@ -102,6 +102,10 @@ topo_dimm_temp2str(uint32_t val)
return ("TS5111");
case SPD_TEMP_T_TS5110:
return ("TS5110");
case SPD_TEMP_T_TS5210:
return ("TS5210");
case SPD_TEMP_T_TS5211:
return ("TS5211");
default:
return ("unknown");
}
Expand All @@ -117,6 +121,14 @@ topo_dimm_pmic2str(uint32_t val)
return ("PMIC5010");
case SPD_PMIC_T_PMIC5100:
return ("PMIC5100");
case SPD_PMIC_T_PMIC5020:
return ("PMIC5020");
case SPD_PMIC_T_PMIC5120:
return ("PMIC5120");
case SPD_PMIC_T_PMIC5200:
return ("PMIC5200");
case SPD_PMIC_T_PMIC5030:
return ("PMIC5030");
default:
return ("unknown");
}
Expand Down Expand Up @@ -149,6 +161,10 @@ topo_dimm_rcd2str(uint32_t val)
return ("DDR5RCD02");
case SPD_RCD_T_DDR5RCD03:
return ("DDR5RCD03");
case SPD_RCD_T_DDR5RCD04:
return ("DDR5RCD04");
case SPD_RCD_T_DDR5RCD05:
return ("DDR5RCD05");
default:
return ("unknown");
}
Expand All @@ -166,6 +182,8 @@ topo_dimm_db2str(uint32_t val)
return ("DDR5DB01");
case SPD_DB_T_DDR5DB02:
return ("DDR5DB02");
case SPD_DB_T_DDR3MB:
return ("DDR3MB");
default:
return ("unknown");
}
Expand All @@ -177,6 +195,8 @@ topo_dimm_mrcd2str(uint32_t val)
switch (val) {
case SPD_MRCD_T_DDR5MRCD01:
return ("DDR5MRCD01");
case SPD_MRCD_T_DDR5MRCD02:
return ("DDR5MRCD02");
default:
return ("unknown");
}
Expand All @@ -188,6 +208,8 @@ topo_dimm_mdb2str(uint32_t val)
switch (val) {
case SPD_MDB_T_DDR5MDB01:
return ("DDR5MDB01");
case SPD_MDB_T_DDR5MDB02:
return ("DDR5MDB02");
default:
return ("unknown");
}
Expand All @@ -208,6 +230,8 @@ static const char *
topo_dimm_spd2str(uint32_t val)
{
switch (val) {
case SPD_SPD_T_EE1002:
return ("EE1002");
case SPD_SPD_T_EE1004:
return ("EE1004");
case SPD_SPD_T_SPD5118:
Expand Down Expand Up @@ -259,14 +283,28 @@ topo_dimm_mod_type2str(spd_module_type_t type)
return ("Mini-RDIMM");
case SPD_MOD_TYPE_MINI_UDIMM:
return ("Mini-UDIMM");
case SPD_MOD_TYPE_MINI_CDIMM:
return ("Mini-CDIMM");
case SPD_MOD_TYPE_72b_SO_RDIMM:
return ("72b-SO-RDIMM");
case SPD_MOD_TYPE_72b_SO_UDIMM:
return ("72b-SO-UDIMM");
case SPD_MOD_TYPE_72b_SO_CDIMM:
return ("72b-SO-CDIMM");
case SPD_MOD_TYPE_16b_SO_DIMM:
return ("16b-SO-DIMM");
case SPD_MOD_TYPE_32b_SO_DIMM:
return ("32b-SO-DIMM");
case SPD_MOD_TYPE_CUDIMM:
return ("CUDIMM");
case SPD_MOD_TYPE_CSODIMM:
return ("CSODIMM");
case SPD_MOD_TYPE_CAMM2:
return ("CAMM2");
case SPD_MOD_TYPE_LPDIMM:
return ("LP-DIMM");
case SPD_MOD_TYPE_MICRO_DIMM:
return ("Micro-DIMM");
default:
return (NULL);
}
Expand Down Expand Up @@ -1053,6 +1091,62 @@ dimm_comp_mfg_pmic(topo_mod_t *mod, tnode_t *dimm, const dimm_comp_t *comp,
topo_mod_free(mod, rev_keys, alen);
return (ret);
}

static bool
dimm_comp_mfg_cd(topo_mod_t *mod, tnode_t *dimm, const dimm_comp_t *comp,
const spd_cache_t *cache, nvlist_t *spd, void *arg)
{
const char **mfg_keys = NULL, **mfg_str_keys = NULL, **type_keys = NULL;
const char **rev_keys = NULL;
bool ret = false;
uint32_t nents = 0, curent = 0;
size_t alen;

if ((cache->sc_devices & SPD_DEVICE_CD_0) != 0)
nents++;
if ((cache->sc_devices & SPD_DEVICE_CD_1) != 0)
nents++;

if (nents == 0) {
return (true);
}

alen = sizeof (char *) * nents;

if ((mfg_keys = topo_mod_zalloc(mod, alen)) == NULL ||
(mfg_str_keys = topo_mod_zalloc(mod, alen)) == NULL ||
(type_keys = topo_mod_zalloc(mod, alen)) == NULL ||
(rev_keys = topo_mod_zalloc(mod, alen)) == NULL) {
goto done;
}

if ((cache->sc_devices & SPD_DEVICE_CD_0) != 0) {
mfg_keys[curent] = SPD_KEY_DEV_CD0_MFG;
mfg_str_keys[curent] = SPD_KEY_DEV_CD0_MFG_NAME;
type_keys[curent] = SPD_KEY_DEV_CD0_TYPE;
rev_keys[curent] = SPD_KEY_DEV_CD0_REV;
curent++;
}

if ((cache->sc_devices & SPD_DEVICE_CD_1) != 0) {
mfg_keys[curent] = SPD_KEY_DEV_CD1_MFG;
mfg_str_keys[curent] = SPD_KEY_DEV_CD1_MFG_NAME;
type_keys[curent] = SPD_KEY_DEV_CD1_TYPE;
rev_keys[curent] = SPD_KEY_DEV_CD1_REV;
curent++;
}

ret = dimm_comp_mfg_common(mod, dimm, comp, spd, mfg_keys,
mfg_str_keys, type_keys, rev_keys, nents);

done:
topo_mod_free(mod, mfg_keys, alen);
topo_mod_free(mod, mfg_str_keys, alen);
topo_mod_free(mod, type_keys, alen);
topo_mod_free(mod, rev_keys, alen);
return (ret);
}

static const dimm_comp_t dimm_comps[] = {
{ .dc_comp = TOPO_PROP_DIMM_COMP_DIE, .dc_always = true,
.dc_count = dimm_comp_count_dies, .dc_mfg = dimm_comp_mfg_die },
Expand All @@ -1067,8 +1161,9 @@ static const dimm_comp_t dimm_comps[] = {
{ .dc_comp = TOPO_PROP_DIMM_COMP_PMIC, .dc_mask = SPD_DEVICE_PMIC_0 |
SPD_DEVICE_PMIC_1 | SPD_DEVICE_PMIC_2, .dc_mfg = dimm_comp_mfg_pmic,
.dc_type2str = topo_dimm_pmic2str },
{ .dc_comp = TOPO_PROP_DIMM_COMP_CD, .dc_mask = SPD_DEVICE_CD,
.dc_mfg = dimm_comp_mfg_single, .dc_type2str = topo_dimm_cd2str },
{ .dc_comp = TOPO_PROP_DIMM_COMP_CD, .dc_mask = SPD_DEVICE_CD_0 |
SPD_DEVICE_CD_1, .dc_mfg = dimm_comp_mfg_cd,
.dc_type2str = topo_dimm_cd2str },
{ .dc_comp = TOPO_PROP_DIMM_COMP_RCD, .dc_mask = SPD_DEVICE_RCD,
.dc_count = dimm_comp_count_regs, .dc_mfg = dimm_comp_mfg_single,
.dc_type2str = topo_dimm_rcd2str },
Expand Down
13 changes: 10 additions & 3 deletions usr/src/lib/libjedec/Makefile.com
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@

#
# Copyright 2020 Joyent, Inc.
# Copyright 2023 Oxide Computer Company
# Copyright 2024 Oxide Computer Company
#

LIBRARY = libjedec.a
VERS = .1
OBJECTS = libjedec.o libjedec_spd.o libjedec_spd_ddr4.o bitext.o \
libjedec_spd_ddr5.o libjedec_temp.o
OBJECTS = libjedec.o \
libjedec_spd.o \
libjedec_spd_ddr3.o \
libjedec_spd_ddr4.o \
libjedec_spd_ddr5.o \
libjedec_spd_lp4.o \
libjedec_spd_lp5.o \
libjedec_temp.o \
bitext.o

include ../../Makefile.lib

Expand Down
Loading

0 comments on commit 8119dad

Please sign in to comment.