blob: d6603ed60f32f37055f9ece724b139512dee4590 [file] [log] [blame]
Raul E Rangel21db6cc2018-03-29 10:18:14 -06001/*
2 * This file is part of the coreboot project.
3 *
Raul E Rangel21db6cc2018-03-29 10:18:14 -06004 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License version
7 * 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _DIMM_INFO_UTIL_H_
16#define _DIMM_INFO_UTIL_H_
17
18#include <smbios.h>
19#include <stdint.h>
20
21/**
22 * Convert the SMBIOS bit widths into an SPD encoded width.
23 *
24 * Use this when setting dimm_info.bus_width if the raw SPD values are not
25 * available.
26 */
27uint8_t smbios_bus_width_to_spd_width(uint16_t total_width,
28 uint16_t data_width);
29
30/**
31 * Convert the SMBIOS size values into the total number of MiB.
32 *
33 * Use this when setting dimm_info.dimm_size.
34 */
35uint32_t smbios_memory_size_to_mib(uint16_t memory_size,
36 uint32_t extended_size);
37
38/**
39 * Convert the SMBIOS form factor to the SPD module type.
40 *
41 * Use this when setting dimm_info.mod_type.
42 */
43uint8_t
44smbios_form_factor_to_spd_mod_type(smbios_memory_form_factor form_factor);
45
46#endif