From da262a6388dec9a943052823203a44e4e5b69e5f Mon Sep 17 00:00:00 2001 From: Stephen Barber Date: Wed, 11 Mar 2015 15:48:08 -0700 Subject: libpayload: cros: add serial number from coreboot table Add serial number to lib_sysinfo from coreboot table. BRANCH=none BUG=chrome-os-partner:37813 TEST=ryu boots and /proc/device-tree/firmware/android is populated with "compatible", "hardware", and "serialno" properties Change-Id: I565b332a16b177c51907ffab7976ebd7a665aaaf Signed-off-by: Patrick Georgi Original-Commit-Id: 5535119f5d499b04bdc178c3040241d2872c4e13 Original-Change-Id: Ie2e222780d1577689a1cbf76ae8514c74fc469f4 Original-Signed-off-by: Stephen Barber Original-Reviewed-on: https://chromium-review.googlesource.com/259140 Original-Reviewed-by: Furquan Shaikh Reviewed-on: http://review.coreboot.org/9881 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/include/coreboot_tables.h | 3 +++ payloads/libpayload/include/sysinfo.h | 1 + payloads/libpayload/libc/coreboot.c | 3 +++ 3 files changed, 7 insertions(+) (limited to 'payloads/libpayload') diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index c46fbf9227..649cc2bb07 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -256,6 +256,9 @@ struct cb_spi_flash { uint32_t erase_cmd; }; +#define CB_TAG_SERIALNO 0x002a +#define CB_MAX_SERIALNO_LENGTH 32 + #define CB_TAG_CMOS_OPTION_TABLE 0x00c8 struct cb_cmos_option_table { u32 tag; diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h index ec8a31c6b6..de8b0feaea 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -91,6 +91,7 @@ struct sysinfo_t { struct cb_gpio gpios[SYSINFO_MAX_GPIOS]; int num_macs; struct mac_address macs[SYSINFO_MAX_MACS]; + char *serialno; #endif unsigned long *mbtable; /** Pointer to the multiboot table */ diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c index 5999e86856..999465cb82 100644 --- a/payloads/libpayload/libc/coreboot.c +++ b/payloads/libpayload/libc/coreboot.c @@ -333,6 +333,9 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info) case CB_TAG_MAC_ADDRS: cb_parse_mac_addresses(ptr, info); break; + case CB_TAG_SERIALNO: + cb_parse_string(ptr, &info->serialno); + break; #endif case CB_TAG_TIMESTAMPS: cb_parse_tstamp(ptr, info); -- cgit v1.2.3