Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Raul E Rangel | 21db6cc | 2018-03-29 10:18:14 -0600 | [diff] [blame] | 2 | |
| 3 | #ifndef _DIMM_INFO_UTIL_H_ |
| 4 | #define _DIMM_INFO_UTIL_H_ |
| 5 | |
| 6 | #include <smbios.h> |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | /** |
| 10 | * Convert the SMBIOS bit widths into an SPD encoded width. |
| 11 | * |
| 12 | * Use this when setting dimm_info.bus_width if the raw SPD values are not |
| 13 | * available. |
| 14 | */ |
Subrata Banik | 3306f37 | 2021-10-26 13:19:20 +0530 | [diff] [blame] | 15 | uint8_t smbios_bus_width_to_spd_width(uint8_t ddr_type, uint16_t total_width, |
Raul E Rangel | 21db6cc | 2018-03-29 10:18:14 -0600 | [diff] [blame] | 16 | uint16_t data_width); |
| 17 | |
| 18 | /** |
| 19 | * Convert the SMBIOS size values into the total number of MiB. |
| 20 | * |
| 21 | * Use this when setting dimm_info.dimm_size. |
| 22 | */ |
| 23 | uint32_t smbios_memory_size_to_mib(uint16_t memory_size, |
| 24 | uint32_t extended_size); |
| 25 | |
| 26 | /** |
| 27 | * Convert the SMBIOS form factor to the SPD module type. |
| 28 | * |
| 29 | * Use this when setting dimm_info.mod_type. |
| 30 | */ |
Subrata Banik | 6de8b42 | 2021-10-26 20:46:21 +0530 | [diff] [blame] | 31 | uint8_t smbios_form_factor_to_spd_mod_type(smbios_memory_type memory_type, |
| 32 | smbios_memory_form_factor form_factor); |
Raul E Rangel | 21db6cc | 2018-03-29 10:18:14 -0600 | [diff] [blame] | 33 | |
| 34 | #endif |