soc/intel/xeon_sp: Advertise DIMMs on skylake_sp as well
[coreboot.git] / src / drivers / vpd / vpd.h
bloba6631aab5568c8bf4c27c798a719401776f6c205
1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #ifndef __VPD_H__
4 #define __VPD_H__
6 #include <types.h>
8 #define GOOGLE_VPD_2_0_OFFSET 0x600
10 enum vpd_region {
11 VPD_RO,
12 VPD_RW,
13 VPD_RO_THEN_RW,
14 VPD_RW_THEN_RO
18 * Reads VPD string value by key.
20 * Reads in at most one less than size characters from VPD and stores them
21 * into buffer. A terminating null byte ('\0') is stored after the last
22 * character in the buffer.
24 * Returns NULL if key is not found, otherwise buffer.
26 char *vpd_gets(const char *key, char *buffer, int size, enum vpd_region region);
29 * Find VPD value by key.
31 * Searches for a VPD entry in the VPD cache. If found, places the size of the
32 * entry into '*size' and returns the pointer to the entry data.
34 * This function presumes that VPD is cached in DRAM (which is the case in the
35 * current implementation) and as such returns the pointer into the cache. The
36 * user is not supposed to modify the data, and does not have to free the
37 * memory.
39 * Returns NULL if key is not found.
42 const void *vpd_find(const char *key, int *size, enum vpd_region region);
45 * Find value of boolean type vpd key.
47 * During the process, necessary checking is done, such as making
48 * sure the value length is 1, and value is either '1' or '0'.
50 bool vpd_get_bool(const char *key, enum vpd_region region,
51 uint8_t *val);
54 * Find value of integer type by vpd key.
56 * Expects to find a decimal string, trailing chars are ignored.
57 * Returns true if the key is found and the value is not too long and
58 * starts with a decimal digit.
60 bool vpd_get_int(const char *key, enum vpd_region region, int *val);
63 * Extracts the "feature_level" from the "feature_device_info" VPD key.
64 * This key holds a base64-encoded protobuf where "feature_level" is the first entry.
66 uint8_t vpd_get_feature_level(void);
68 #endif /* __VPD_H__ */