xref: /rk3399_ARM-atf/include/tools_share/uuid.h (revision e831923f95df13310af3c4cf0bbdb4d9e683a559)
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 /*
300a6e7e3bSLouis Mayencourt  * Portions copyright (c) 2014-2020, 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 
372a6c1a8fSMasahiro Yamada /* Length of a node address (an IEEE 802 address). */
382a6c1a8fSMasahiro Yamada #define	_UUID_NODE_LEN		6
392a6c1a8fSMasahiro Yamada 
402a6c1a8fSMasahiro Yamada /* Length of UUID string including dashes. */
412a6c1a8fSMasahiro Yamada #define _UUID_STR_LEN		36
422a6c1a8fSMasahiro Yamada 
432a6c1a8fSMasahiro Yamada /*
442a6c1a8fSMasahiro Yamada  * See also:
452a6c1a8fSMasahiro Yamada  *      http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
462a6c1a8fSMasahiro Yamada  *      http://www.opengroup.org/onlinepubs/009629399/apdxa.htm
472a6c1a8fSMasahiro Yamada  *
482a6c1a8fSMasahiro Yamada  * A DCE 1.1 compatible source representation of UUIDs.
492a6c1a8fSMasahiro Yamada  */
502a6c1a8fSMasahiro Yamada struct uuid {
5103364865SRoberto Vargas 	uint8_t		time_low[4];
5203364865SRoberto Vargas 	uint8_t		time_mid[2];
5303364865SRoberto Vargas 	uint8_t		time_hi_and_version[2];
542a6c1a8fSMasahiro Yamada 	uint8_t		clock_seq_hi_and_reserved;
552a6c1a8fSMasahiro Yamada 	uint8_t		clock_seq_low;
562a6c1a8fSMasahiro Yamada 	uint8_t		node[_UUID_NODE_LEN];
572a6c1a8fSMasahiro Yamada };
582a6c1a8fSMasahiro Yamada 
59*e831923fSTomas Pilar struct efi_guid {
60*e831923fSTomas Pilar 	uint32_t time_low;
61*e831923fSTomas Pilar 	uint16_t time_mid;
62*e831923fSTomas Pilar 	uint16_t time_hi_and_version;
63*e831923fSTomas Pilar 	uint8_t clock_seq_and_node[8];
64*e831923fSTomas Pilar };
65*e831923fSTomas Pilar 
660a6e7e3bSLouis Mayencourt union uuid_helper_t {
670a6e7e3bSLouis Mayencourt 	struct uuid uuid_struct;
68*e831923fSTomas Pilar 	struct efi_guid efi_guid;
690a6e7e3bSLouis Mayencourt 	uint32_t word[4];
700a6e7e3bSLouis Mayencourt };
710a6e7e3bSLouis Mayencourt 
722a6c1a8fSMasahiro Yamada /* XXX namespace pollution? */
732a6c1a8fSMasahiro Yamada typedef struct uuid uuid_t;
742a6c1a8fSMasahiro Yamada 
75c3cf06f1SAntonio Nino Diaz #endif /* UUID_H */
76