On Sat, Mar 10, 2018 at 02:22:17PM +0100, Jean Delvare wrote:
Note that it is possible to store MB values (up to 16 MB) using kB
the unit. The specification allows for it, and a few systems use that
option. For example , the DMI data of a Supermicro X8STi board looks
Handle 0x0038, DMI type 17, 28 bytes
Size: 4096 kB
and it is encoded as 0x9000.
I understand you don't care about such "small" memory modules for
persistent DIMMs, however the API is not specific to these, and it
could be confusing for callers that modules between 1 MB and 16 MB are
sometimes reported as 0 and sometimes not. So I believe that your code
should handle this case.
Then I might as well go with a fully standards compliant version
(just in case somebody in the future has a 512KB module encoded as
0x8200, they would also be confused by a return of 0 MB).
That means I should stick with u64 as the type of the "size" field
(using KB in a u32 would max out with 4TB modules, which may happen
before I retire).