Name of user not set #1002789 has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44005 )
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
drivers/generic/cbfs-serial: Update driver to read UUID from CBFS
Modify the existing cbfs-serial driver to also read the UUID from a text file in CBFS, just as a serial number is done today. When driver is selected and a system_uuid exists in the CBFS the UUID is read from the file and populated in the SMBIOS table. Note that in order to work there must be no newline character at the end of the file, this is also true of the serial_number.
Tested on a Google Tricky (Dell 3010 Chromebox).
Change-Id: I140a61670cec1318c095e18815c6bc7c1bf78cd6 Signed-off-by: Chris Morgan macromorgan@hotmail.com --- M src/drivers/generic/cbfs-serial/Kconfig M src/drivers/generic/cbfs-serial/cbfs-serial.c 2 files changed, 34 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/44005/1
diff --git a/src/drivers/generic/cbfs-serial/Kconfig b/src/drivers/generic/cbfs-serial/Kconfig index 209c242..d0cce14 100644 --- a/src/drivers/generic/cbfs-serial/Kconfig +++ b/src/drivers/generic/cbfs-serial/Kconfig @@ -2,5 +2,8 @@ bool "Serial number in CBFS" default n help - Enable this option to read the board serial number from a - text file located in CBFS. + Enable this option to read the board serial number or + system UUID from a text file located in CBFS. The text + file should be named serial_number or system_uuid + respectively and include only the serial number or + UUID (with dashes) with no newline characters. diff --git a/src/drivers/generic/cbfs-serial/cbfs-serial.c b/src/drivers/generic/cbfs-serial/cbfs-serial.c index 2e3e37d..6ee3c26 100644 --- a/src/drivers/generic/cbfs-serial/cbfs-serial.c +++ b/src/drivers/generic/cbfs-serial/cbfs-serial.c @@ -4,9 +4,10 @@ #include <device/device.h> #include <smbios.h> #include <string.h> - +#include <uuid.h>
#define MAX_SERIAL_LENGTH 0x100 +#define UUID_LENGTH 0x128
const char *smbios_mainboard_serial_number(void) { @@ -37,3 +38,30 @@
return serial_number; } + +void smbios_system_set_uuid(u8 *uuid) +{ + static char system_uuid[UUID_LENGTH + 1] = {0}; + struct cbfsf file; + + if (system_uuid[0] != 0) + parse_uuid(uuid, system_uuid); + + if (cbfs_boot_locate(&file, "system_uuid", NULL) == 0) { + struct region_device cbfs_region; + size_t uuid_len; + + cbfs_file_data(&cbfs_region, &file); + + uuid_len = region_device_sz(&cbfs_region); + if (uuid_len <= UUID_LENGTH) { + if (rdev_readat(&cbfs_region, system_uuid, 0, + uuid_len) == uuid_len) { + system_uuid[uuid_len] = 0; + parse_uuid(uuid, system_uuid); + } + } + } + + parse_uuid(uuid, system_uuid); +}
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44005 )
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
Patch Set 1:
(4 comments)
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... File src/drivers/generic/cbfs-serial/cbfs-serial.c:
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 44: UUID_LENGTH Please use UUID_STRLEN from `uuid.h` instead. The length has to match exactly, otherwise it won't parse.
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 47: if (system_uuid[0] != 0) Nit, it could be 0 by coincidence. Also, I doubt this function is called more than once.
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 57: uuid_len <= UUID_LENGTH `uuid_len == sizeof(system_uuid) - 1` would make it most safe.
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 66: parse_uuid(uuid, system_uuid); This line seems quite redundant.
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44005
to look at the new patch set (#2).
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
drivers/generic/cbfs-serial: Update driver to read UUID from CBFS
Modify the existing cbfs-serial driver to also read the UUID from a text file in CBFS, just as a serial number is done today. When driver is selected and a system_uuid exists in the CBFS the UUID is read from the file and populated in the SMBIOS table. Note that in order to work there must be no newline character at the end of the file, this is also true of the serial_number.
Tested on a Google Tricky (Dell 3010 Chromebox).
Change-Id: I140a61670cec1318c095e18815c6bc7c1bf78cd6 Signed-off-by: Chris Morgan macromorgan@hotmail.com --- M src/drivers/generic/cbfs-serial/Kconfig M src/drivers/generic/cbfs-serial/cbfs-serial.c 2 files changed, 32 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/44005/2
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44005
to look at the new patch set (#3).
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
drivers/generic/cbfs-serial: Update driver to read UUID from CBFS
Modify the existing cbfs-serial driver to also read the UUID from a text file in CBFS, just as a serial number is done today. When driver is selected and a system_uuid exists in the CBFS the UUID is read from the file and populated in the SMBIOS table. Note that in order to work there must be no newline character at the end of the file, this is also true of the serial_number.
Tested on a Google Tricky (Dell 3010 Chromebox).
Change-Id: I140a61670cec1318c095e18815c6bc7c1bf78cd6 Signed-off-by: Chris Morgan macromorgan@hotmail.com --- M src/drivers/generic/cbfs-serial/Kconfig M src/drivers/generic/cbfs-serial/cbfs-serial.c 2 files changed, 29 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/44005/3
Name of user not set #1002789 has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44005 )
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
Patch Set 3:
(4 comments)
Made changes as requested. Thank you for your feedback.
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... File src/drivers/generic/cbfs-serial/cbfs-serial.c:
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 44: UUID_LENGTH
Please use UUID_STRLEN from `uuid.h` instead. The length has to match […]
Ack
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 47: if (system_uuid[0] != 0)
Nit, it could be 0 by coincidence. Also, I doubt this function is called […]
Sorry, I missed this in patchset 2. Pushing set 3 now...
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 57: uuid_len <= UUID_LENGTH
`uuid_len == sizeof(system_uuid) - 1` would make it most safe.
Ack
https://review.coreboot.org/c/coreboot/+/44005/1/src/drivers/generic/cbfs-se... PS1, Line 66: parse_uuid(uuid, system_uuid);
This line seems quite redundant.
Ack
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44005
to look at the new patch set (#4).
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
drivers/generic/cbfs-serial: Update driver to read UUID from CBFS
Modify the existing cbfs-serial driver to also read the UUID from a text file in CBFS, just as a serial number is done today. When driver is selected and a system_uuid exists in the CBFS the UUID is read from the file and populated in the SMBIOS table. Note that in order to work there must be no newline character at the end of the file, this is also true of the serial_number.
Tested on a Google Tricky (Dell 3010 Chromebox).
Change-Id: I140a61670cec1318c095e18815c6bc7c1bf78cd6 Signed-off-by: Chris Morgan macromorgan@hotmail.com --- M src/drivers/generic/cbfs-serial/Kconfig M src/drivers/generic/cbfs-serial/cbfs-serial.c 2 files changed, 28 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/44005/4
Attention is currently required from: Name of user not set #1002789. Benjamin Doron has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44005 )
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
Patch Set 6:
(1 comment)
Patchset:
PS6: Update this to newer CBFS API?
I can do it if you have no time.
Attention is currently required from: Name of user not set #1002789. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44005 )
Change subject: drivers/generic/cbfs-serial: Update driver to read UUID from CBFS ......................................................................
Patch Set 6:
(1 comment)
Patchset:
PS6: Oooh, sorry, don't know why I didn't follow up on this. The latest PS looks good actually, but as Benjamin suggested, it needs a bump.