aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/devices/spd-decode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/devices/spd-decode.c b/modules/devices/spd-decode.c
index ae304a4f..c734ea63 100644
--- a/modules/devices/spd-decode.c
+++ b/modules/devices/spd-decode.c
@@ -1266,7 +1266,12 @@ static void decode_ddr3_module_speed(unsigned char *bytes, float *ddr_clock, int
}
static void decode_ddr3_module_size(unsigned char *bytes, int *size) {
- *size = 512 << bytes[4];
+ unsigned int sdr_capacity = 256 << (bytes[4] & 0xF);
+ unsigned int sdr_width = 4 << (bytes[7] & 0x7);
+ unsigned int bus_width = 8 << (bytes[8] & 0x7);
+ unsigned int ranks = 1 + ((bytes[7] >> 3) & 0x7);
+
+ *size = sdr_capacity / 8 * bus_width / sdr_width * ranks;
}
static void decode_ddr3_module_timings(unsigned char *bytes, float *trcd, float *trp, float *tras,