1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <boot/coreboot_tables.h>
4 #include <console/console.h>
8 #include <drivers/vpd/vpd.h>
10 void lb_table_add_serialno_from_vpd(struct lb_header
*header
)
12 struct lb_string
*serialno_rec
= NULL
;
13 const char serialno_key
[] = "serial_number";
17 if (!vpd_gets(serialno_key
, serialno
,
18 sizeof(serialno
), VPD_RO_THEN_RW
)) {
19 printk(BIOS_ERR
, "no serial number in vpd\n");
22 printk(BIOS_DEBUG
, "serial number is %s\n", serialno
);
23 len
= strlen(serialno
) + 1;
26 serialno_rec
= (struct lb_string
*)lb_new_record(header
);
27 serialno_rec
->tag
= LB_TAG_SERIALNO
;
29 serialno_rec
->size
= ALIGN_UP(sizeof(*serialno_rec
) + len
, 8);
30 memcpy(&serialno_rec
->string
, serialno
, len
);