xref: /rk3399_ARM-atf/include/tools_share/uuid.h (revision edee0430d42c92cdb5119f950aee506012b327a6)
12a6c1a8fSMasahiro Yamada /*-
22a6c1a8fSMasahiro Yamada  * Copyright (c) 2002 Marcel Moolenaar
32a6c1a8fSMasahiro Yamada  * All rights reserved.
42a6c1a8fSMasahiro Yamada  *
52a6c1a8fSMasahiro Yamada  * Redistribution and use in source and binary forms, with or without
62a6c1a8fSMasahiro Yamada  * modification, are permitted provided that the following conditions
72a6c1a8fSMasahiro Yamada  * are met:
82a6c1a8fSMasahiro Yamada  *
92a6c1a8fSMasahiro Yamada  * 1. Redistributions of source code must retain the above copyright
102a6c1a8fSMasahiro Yamada  *    notice, this list of conditions and the following disclaimer.
112a6c1a8fSMasahiro Yamada  * 2. Redistributions in binary form must reproduce the above copyright
122a6c1a8fSMasahiro Yamada  *    notice, this list of conditions and the following disclaimer in the
132a6c1a8fSMasahiro Yamada  *    documentation and/or other materials provided with the distribution.
142a6c1a8fSMasahiro Yamada  *
152a6c1a8fSMasahiro Yamada  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
162a6c1a8fSMasahiro Yamada  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
172a6c1a8fSMasahiro Yamada  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
182a6c1a8fSMasahiro Yamada  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
192a6c1a8fSMasahiro Yamada  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
202a6c1a8fSMasahiro Yamada  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
212a6c1a8fSMasahiro Yamada  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
222a6c1a8fSMasahiro Yamada  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
232a6c1a8fSMasahiro Yamada  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
242a6c1a8fSMasahiro Yamada  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
252a6c1a8fSMasahiro Yamada  *
262a6c1a8fSMasahiro Yamada  * $FreeBSD$
272a6c1a8fSMasahiro Yamada  */
282a6c1a8fSMasahiro Yamada 
292a6c1a8fSMasahiro Yamada /*
30*12562af3SChris Kay  * Portions copyright (c) 2014-2023, Arm Limited and Contributors.
312a6c1a8fSMasahiro Yamada  * All rights reserved.
322a6c1a8fSMasahiro Yamada  */
332a6c1a8fSMasahiro Yamada 
34c3cf06f1SAntonio Nino Diaz #ifndef UUID_H
35c3cf06f1SAntonio Nino Diaz #define UUID_H
362a6c1a8fSMasahiro Yamada 
37*12562af3SChris Kay #include <stdint.h>
38*12562af3SChris Kay 
392a6c1a8fSMasahiro Yamada /* Length of a node address (an IEEE 802 address). */
402a6c1a8fSMasahiro Yamada #define	_UUID_NODE_LEN		6
412a6c1a8fSMasahiro Yamada 
422a6c1a8fSMasahiro Yamada /* Length of UUID string including dashes. */
432a6c1a8fSMasahiro Yamada #define _UUID_STR_LEN		36
442a6c1a8fSMasahiro Yamada 
452a6c1a8fSMasahiro Yamada /*
462a6c1a8fSMasahiro Yamada  * See also:
472a6c1a8fSMasahiro Yamada  *      http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
482a6c1a8fSMasahiro Yamada  *      http://www.opengroup.org/onlinepubs/009629399/apdxa.htm
492a6c1a8fSMasahiro Yamada  *
502a6c1a8fSMasahiro Yamada  * A DCE 1.1 compatible source representation of UUIDs.
512a6c1a8fSMasahiro Yamada  */
522a6c1a8fSMasahiro Yamada struct uuid {
5303364865SRoberto Vargas 	uint8_t		time_low[4];
5403364865SRoberto Vargas 	uint8_t		time_mid[2];
5503364865SRoberto Vargas 	uint8_t		time_hi_and_version[2];
562a6c1a8fSMasahiro Yamada 	uint8_t		clock_seq_hi_and_reserved;
572a6c1a8fSMasahiro Yamada 	uint8_t		clock_seq_low;
582a6c1a8fSMasahiro Yamada 	uint8_t		node[_UUID_NODE_LEN];
592a6c1a8fSMasahiro Yamada };
602a6c1a8fSMasahiro Yamada 
61e831923fSTomas Pilar struct efi_guid {
62e831923fSTomas Pilar 	uint32_t time_low;
63e831923fSTomas Pilar 	uint16_t time_mid;
64e831923fSTomas Pilar 	uint16_t time_hi_and_version;
65e831923fSTomas Pilar 	uint8_t clock_seq_and_node[8];
66e831923fSTomas Pilar };
67e831923fSTomas Pilar 
680a6e7e3bSLouis Mayencourt union uuid_helper_t {
690a6e7e3bSLouis Mayencourt 	struct uuid uuid_struct;
70e831923fSTomas Pilar 	struct efi_guid efi_guid;
710a6e7e3bSLouis Mayencourt };
720a6e7e3bSLouis Mayencourt 
732a6c1a8fSMasahiro Yamada /* XXX namespace pollution? */
742a6c1a8fSMasahiro Yamada typedef struct uuid uuid_t;
752a6c1a8fSMasahiro Yamada 
76c3cf06f1SAntonio Nino Diaz #endif /* UUID_H */
77