aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Simek2022-07-21 16:19:17 +0200
committerMichal Simek2022-07-26 08:25:16 +0200
commitee5a4b87a1a57607db28fafa2692dabf92c64570 (patch)
tree7bce63297018c103ee897ce56e5964c1ac259ac3
parentc6bceb4e360d704fb9746541c18a1a08f49353fc (diff)
xilinx: Wire uuid reading from FRU
UUID is already recorded when FRU is parsed but it is not copied to local structures and exported to variable that's why simply add it. Data is saved in binary format but there must be conversion to string for exporting it to variable and string should be in uuid format too. One way how to use it directly is to setup pxeuuid based on it. For example via preboot with "setenv pxeuuid ${board_uuid}" Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/1dfa4b4220a508abc05351da2119880811b77612.1658413156.git.michal.simek@amd.com
-rw-r--r--board/xilinx/common/board.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 5f2afb9def4..b0c11aaa425 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -23,6 +23,7 @@
#include <soc.h>
#include <linux/ctype.h>
#include <linux/kernel.h>
+#include <uuid.h>
#include "fru.h"
@@ -86,6 +87,7 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
#define EEPROM_HDR_SERIAL_LEN 20
#define EEPROM_HDR_NO_OF_MAC_ADDR 4
#define EEPROM_HDR_ETH_ALEN ETH_ALEN
+#define EEPROM_HDR_UUID_LEN 16
struct xilinx_board_description {
u32 header;
@@ -94,6 +96,7 @@ struct xilinx_board_description {
char revision[EEPROM_HDR_REV_LEN + 1];
char serial[EEPROM_HDR_SERIAL_LEN + 1];
u8 mac_addr[EEPROM_HDR_NO_OF_MAC_ADDR][EEPROM_HDR_ETH_ALEN + 1];
+ char uuid[EEPROM_HDR_UUID_LEN + 1];
};
static int highest_id = -1;
@@ -237,6 +240,8 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
/* It is clear that FRU was captured and structures were filled */
strncpy(desc->manufacturer, (char *)fru_data.brd.manufacturer_name,
sizeof(desc->manufacturer));
+ strncpy(desc->uuid, (char *)fru_data.brd.uuid,
+ sizeof(desc->uuid));
strncpy(desc->name, (char *)fru_data.brd.product_name,
sizeof(desc->name));
for (i = 0; i < sizeof(desc->name); i++) {
@@ -452,6 +457,19 @@ int board_late_init_xilinx(void)
ret |= env_set_by_index("serial", id,
desc->serial);
+ if (desc->uuid[0]) {
+ char uuid[UUID_STR_LEN + 1];
+ char *t = desc->uuid;
+
+ memset(uuid, 0, UUID_STR_LEN + 1);
+
+ sprintf(uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ t[0], t[1], t[2], t[3], t[4], t[5],
+ t[6], t[7], t[8], t[9], t[10], t[11],
+ t[12], t[13], t[14], t[15]);
+ ret |= env_set_by_index("uuid", id, uuid);
+ }
+
if (!CONFIG_IS_ENABLED(NET))
continue;