Currently my mini-PC with AMD Ryzen CPU shows: spdmem0 at iic0 addr 0x50: 0MB DDR4 SDRAM PC4-21300 SO-DIMM
problem here is in the calculation of the DIMM size: dimm_size = datawidth - (chipwidth + 2); dimm_size = ddr4_chipsize[chipsize] * (1 << dimm_size) * (physbanks + 1) * (diecount + 1); In my case datawidth is 3 and chipwidth is 2. So the result of the first line is negative. Then the second line tries to do a left shift of a negitive nunmber of bits. That doesn't really work... Diff below fixes the issue. The "datawidth + 3" is intentional as that is log2 of the actual bus width just like "chipwidth + 2" is log2 of the actual device width. And the former should never be smaller than the latter. With this I get: spdmem0 at iic0 addr 0x50: 4GB DDR4 SDRAM PC4-21300 SO-DIMM which looks correct as this machine has: real mem = 3672100864 (3501MB) avail mem = 3548086272 (3383MB) (some memory is reserved for the GPU). ok? Index: dev/spdmem.c =================================================================== RCS file: /cvs/src/sys/dev/spdmem.c,v retrieving revision 1.6 diff -u -p -r1.6 spdmem.c --- dev/spdmem.c 17 Dec 2019 08:01:36 -0000 1.6 +++ dev/spdmem.c 21 Dec 2019 11:06:11 -0000 @@ -770,8 +770,8 @@ spdmem_ddr4_decode(struct spdmem_softc * SPDMEM_DDR4_PACK_TYPE_DIE_COUNT_MASK; } - dimm_size = datawidth - (chipwidth + 2); - dimm_size = ddr4_chipsize[chipsize] * (1 << dimm_size) * + dimm_size = (datawidth + 3) - (chipwidth + 2); + dimm_size = (ddr4_chipsize[chipsize] / 8) * (1 << dimm_size) * (physbanks + 1) * (diecount + 1); if (dimm_size < 1024)