vpd: populate coreboot table with serialno
BRANCH=none BUG=chrome-os-partner:37813 TEST=devicetree is populated with with "compatible", "hardware", and "serialno" properties Change-Id: Ibe84aa05702d2a33456c6c33d15a4c7d4a6d45d7 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 61408d969f5d6e1e40f919b3defd5f1622391c9e Original-Change-Id: I02f360f4e5385042f56eb2b2f29072e393a24fc9 Original-Signed-off-by: Stephen Barber <smbarber@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/259141 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9882 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
da262a6388
commit
b396a66031
|
@ -296,6 +296,9 @@ struct lb_spi_flash {
|
||||||
uint32_t erase_cmd;
|
uint32_t erase_cmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define LB_TAG_SERIALNO 0x002a
|
||||||
|
#define MAX_SERIALNO_LENGTH 32
|
||||||
|
|
||||||
/* The following structures are for the cmos definitions table */
|
/* The following structures are for the cmos definitions table */
|
||||||
#define LB_TAG_CMOS_OPTION_TABLE 200
|
#define LB_TAG_CMOS_OPTION_TABLE 200
|
||||||
/* cmos header record */
|
/* cmos header record */
|
||||||
|
@ -392,6 +395,8 @@ void lb_board(struct lb_header *header);
|
||||||
*/
|
*/
|
||||||
void lb_table_add_macs_from_vpd(struct lb_header *header);
|
void lb_table_add_macs_from_vpd(struct lb_header *header);
|
||||||
|
|
||||||
|
void lb_table_add_serialno_from_vpd(struct lb_header *header);
|
||||||
|
|
||||||
struct lb_record *lb_new_record(struct lb_header *header);
|
struct lb_record *lb_new_record(struct lb_header *header);
|
||||||
|
|
||||||
#endif /* COREBOOT_TABLES_H */
|
#endif /* COREBOOT_TABLES_H */
|
||||||
|
|
|
@ -41,7 +41,7 @@ ramstage-y += fmap.c
|
||||||
ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c
|
ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c
|
||||||
smm-y += fmap.c
|
smm-y += fmap.c
|
||||||
romstage-y += vpd_decode.c cros_vpd.c
|
romstage-y += vpd_decode.c cros_vpd.c
|
||||||
ramstage-y += vpd_decode.c cros_vpd.c vpd_mac.c vpd_calibration.c
|
ramstage-y += vpd_decode.c cros_vpd.c vpd_mac.c vpd_serialno.c vpd_calibration.c
|
||||||
ifeq ($(CONFIG_ARCH_X86)$(CONFIG_ARCH_MIPS),)
|
ifeq ($(CONFIG_ARCH_X86)$(CONFIG_ARCH_MIPS),)
|
||||||
bootblock-y += watchdog.c
|
bootblock-y += watchdog.c
|
||||||
ramstage-y += watchdog.c
|
ramstage-y += watchdog.c
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the coreboot project.
|
||||||
|
*
|
||||||
|
* Copyright 2015 Google Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <boot/coreboot_tables.h>
|
||||||
|
#include <console/console.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <vendorcode/google/chromeos/cros_vpd.h>
|
||||||
|
|
||||||
|
void lb_table_add_serialno_from_vpd(struct lb_header *header)
|
||||||
|
{
|
||||||
|
struct lb_string *serialno_rec = NULL;
|
||||||
|
const char serialno_key[] = "serial_number";
|
||||||
|
char serialno[32];
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (!cros_vpd_gets(serialno_key, serialno,
|
||||||
|
sizeof(serialno))) {
|
||||||
|
printk(BIOS_ERR, "no serial number in vpd\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printk(BIOS_DEBUG, "serial number is %s\n", serialno);
|
||||||
|
len = strlen(serialno) + 1;
|
||||||
|
ASSERT(len <= 32);
|
||||||
|
|
||||||
|
serialno_rec = (struct lb_string *)lb_new_record(header);
|
||||||
|
serialno_rec->tag = LB_TAG_SERIALNO;
|
||||||
|
|
||||||
|
serialno_rec->size = ALIGN_UP(sizeof(*serialno_rec) + len, 8);
|
||||||
|
memcpy(&serialno_rec->string, serialno, len);
|
||||||
|
}
|
Loading…
Reference in New Issue