mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2025-02-25 18:55:23 -06:00
Replace SPD SKU reading code repeated multiple times across
all the parse_spd_* functions with a dedicated read_sku function.
Convert spd_infos.sku from len+data into classic NULL-terminated C-string.
Takes the same space, but simplifies handling. Also, use char instead of
uint8_t so no conversion is needed when printing.
Change the way how the end of part number is handled. Stop on the first
non-ASCII character and then trim all trailing spaces. This allows SKUs
with two (or more) spaces inside the name to be handled properly.
Finally, fix incorrect / inconsistent part number length handling, with
the following end result:
- parse_spd_sdram: 18 [73-90] (no change)
- parse_spd_rdram: 18 [73-90] (no change)
- parse_spd_ddr: 18 [73-90] (no change)
- parse_spd_ddr2: 18 [73-90] (no change)
- parse_spd_ddr3: 20+1=21 -> 18 [128-145]
- parse_spd_ddr4: 20+1=21 -> 20 [329-348]
- parse_spd_ddr5: 29+1=30 -> 30 [521-550] (technicaly no change)
Before:
text data bss total filename
13143 3795 18 16956 build32/system/smbus.o
11735 4359 18 16112 build64/system/smbus.o
81705 51133 13088 145926 build32/memtest_shared
79686 58109 294432 432227 build64/memtest_shared
After:
text data bss total filename
10784 3887 18 14689 build32/system/smbus.o
10486 4399 18 14903 build64/system/smbus.o
79353 51101 13088 143542 build32/memtest_shared
78438 58077 294432 430947 build64/memtest_shared
gcc-11.3.0.