soc/intel/xeon_sp/spr: Create CXL ACPI resources only for
[coreboot.git] / src / include / uuid.h
blobc38b0fe46972e38f916c4fc3dfebdf876fdf1a88
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef _UUID_H_
4 #define _UUID_H_
6 #include <string.h>
7 #include <stdint.h>
9 #define UUID_LEN 16
10 #define UUID_STRLEN 36
13 * Parses a canonical UUID string into the common byte representation
14 * where the first three words are interpreted as little endian:
16 * The UUID
17 * "00112233-4455-6677-8899-aabbccddeeff"
18 * is stored as
19 * 33 22 11 00 55 44 77 66 88 99 aa bb cc dd ee ff
21 * Returns negative value on error, 0 on success.
23 int parse_uuid(uint8_t *uuid, const char *uuid_str);
25 typedef struct {
26 uint8_t b[16];
27 } __packed guid_t;
29 #define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
30 ((guid_t) \
31 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
32 (b) & 0xff, ((b) >> 8) & 0xff, \
33 (c) & 0xff, ((c) >> 8) & 0xff, \
34 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } })
36 static inline int guidcmp(const guid_t *guid1, const guid_t *guid2)
38 return memcmp(guid1, guid2, sizeof(guid_t));
41 static inline guid_t *guidcpy(guid_t *dest, const guid_t *src)
43 return (guid_t *)memcpy(dest, src, sizeof(guid_t));
46 #endif /* _UUID_H_ */