From 19d63df1af72b312109b827cca793625ba6fcd16 Mon Sep 17 00:00:00 2001 From: Sughosh Ganu Date: Fri, 2 Jul 2021 16:00:40 +0530 Subject: [PATCH] feat(fwu): add basic definitions for GUID handling The FWU metadata structure uses GUID's to identify the updatable firmware images. Add some basic helper functions and macros that would be used for working with the GUID datatype. With the FWU feature enabled, these would then be used for image identification and booting of images from a particular bank(partition). Signed-off-by: Sughosh Ganu Change-Id: Ia54c0402d72b503d6abd1d94bc751cc14602cd39 --- include/drivers/partition/efi.h | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/drivers/partition/efi.h diff --git a/include/drivers/partition/efi.h b/include/drivers/partition/efi.h new file mode 100644 index 000000000..e463f9657 --- /dev/null +++ b/include/drivers/partition/efi.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021, Linaro Limited + * + * SPDX-License-Identifier: BSD-3-Clause + * + */ + +#ifndef DRIVERS_PARTITION_EFI_H +#define DRIVERS_PARTITION_EFI_H + +#include + +#include + +#define EFI_NAMELEN 36 + +static inline int guidcmp(const void *g1, const void *g2) +{ + return memcmp(g1, g2, sizeof(struct efi_guid)); +} + +static inline void *guidcpy(void *dst, const void *src) +{ + return memcpy(dst, src, sizeof(struct efi_guid)); +} + +#define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ + { (a) & 0xffffffff, \ + (b) & 0xffff, \ + (c) & 0xffff, \ + { (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } } + +#define NULL_GUID \ + EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) + +#endif /* DRIVERS_PARTITION_EFI_H */