1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <drivers/vpd/vpd.h>
10 #define DSM_BUF_LEN 128
11 #define DSM_PREFIX "dsm_calib_"
13 enum cb_err
get_dsm_calibration_from_key(const char *key
, uint64_t *value
)
15 static char buf
[DSM_BUF_LEN
];
19 if (strncmp(key
, DSM_PREFIX
, strlen(DSM_PREFIX
))) {
20 printk(BIOS_ERR
, "got invalid dsm_calib key: %s\n", key
);
24 ret
= vpd_gets(key
, buf
, DSM_BUF_LEN
, VPD_RO
);
26 printk(BIOS_ERR
, "failed to find key in VPD: %s\n", key
);
30 value_from_vpd
= atol(buf
);
31 if (value_from_vpd
<= 0) {
32 printk(BIOS_ERR
, "got invalid dsm_calib from VPD: %ld\n", value_from_vpd
);
36 *value
= value_from_vpd
;