History log of /u-boot/include/uuid.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 8d6337e6 24-Aug-2023 Simon Glass <sjg@chromium.org>

uuid: Move function comments to header file

These should be in the header file for easy browsing, not in the source
code. Move them and add a missing Return on one of the functions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7048f26c 04-Aug-2023 Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>

lib: uuid: introduce uuid_str_to_le_bin function

convert UUID string to little endian binary data

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>

# 94e7cb18 24-Jul-2023 Tom Rini <trini@konsulko.com>

Revert "Merge branch '2023-07-24-introduce-FF-A-suppport'"

This reverts commit d927d1a80843e1c3e2a3f0b8f6150790bef83da1, reversing
changes made to c07ad9520c6190070513016fdb495d4703a4a853.

These changes do not pass CI currently.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 5d24a435 13-Jul-2023 Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>

lib: uuid: introduce uuid_str_to_le_bin function

convert UUID string to little endian binary data

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>

# f8a2d191 13-Jan-2021 Simon Glass <sjg@chromium.org>

uuid: Add a comment for UUID_STR_LEN

This macro is the length of the string but excludes the terminator. Users
must add 1 when declaring a large-enough string. Add a comment to make
this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31ce367c 20-Nov-2020 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

lib/uuid.c: change prototype of uuid_guid_get_str()

There's no reason to require an appropriately sized output parameter
for the string, that's error-prone should the table ever grow an
element with a longer string. We can just return the const char*
pointer directly.

Update the only caller accordingly, and get rid of pointless ifdeffery
in the header so that the compiler always sees a declaration and can
thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled
or not.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

# 2c2ca207 08-Apr-2020 Simon Glass <sjg@chromium.org>

uuid: Use const char * where possible

Update the arguments of these functions so they can be called from code
which uses constant strings.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3bad256f 29-Apr-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcb41dca 27-Oct-2015 Patrick Delaunay <patrick.delaunay73@gmail.com>

uuid: add selection by string for known partition type GUID

short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

partitions = name=boot,size=0x6bc00,type=data; \
name=root,size=0x7538ba00,type=linux;
gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

Partition Map for MMC device 0 -- Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x0000037f "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
2 0x00000380 0x003a9fdc "root"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
type: linux
guid: 25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>

# 4e4815fe 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: add functions to generate UUID version 4

This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- new configs:
- CONFIG_LIB_UUID for compile lib/uuid.c
- CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
- add configs dependency to include/config_fallbacks.h for lib uuid.

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
of UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
[trini: Add CONFIG_EFI_PARTITION to fallbacks]
Signed-off-by: Tom Rini <trini@ti.com>

# d718ded0 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: code refactor for proper maintain between uuid bin and string

Changes in lib/uuid.c to:
- uuid_str_to_bin()
- uuid_bin_to_str()

New parameter is added to specify input/output string format in listed functions
This change allows easy recognize which UUID type is or should be stored in given
string array. Binary data of UUID and GUID is always stored in big endian, only
string representations are different as follows.

String byte: 0 36
String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string UUID: be be be be be
string GUID: le le le be be

This patch also updates functions calls and declarations in a whole code.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: trini@ti.com

# 7048f26c 04-Aug-2023 Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>

lib: uuid: introduce uuid_str_to_le_bin function

convert UUID string to little endian binary data

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>

# 94e7cb18 24-Jul-2023 Tom Rini <trini@konsulko.com>

Revert "Merge branch '2023-07-24-introduce-FF-A-suppport'"

This reverts commit d927d1a80843e1c3e2a3f0b8f6150790bef83da1, reversing
changes made to c07ad9520c6190070513016fdb495d4703a4a853.

These changes do not pass CI currently.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 5d24a435 13-Jul-2023 Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>

lib: uuid: introduce uuid_str_to_le_bin function

convert UUID string to little endian binary data

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jens Wiklander <jens.wiklander@linaro.org>

# f8a2d191 13-Jan-2021 Simon Glass <sjg@chromium.org>

uuid: Add a comment for UUID_STR_LEN

This macro is the length of the string but excludes the terminator. Users
must add 1 when declaring a large-enough string. Add a comment to make
this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31ce367c 20-Nov-2020 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

lib/uuid.c: change prototype of uuid_guid_get_str()

There's no reason to require an appropriately sized output parameter
for the string, that's error-prone should the table ever grow an
element with a longer string. We can just return the const char*
pointer directly.

Update the only caller accordingly, and get rid of pointless ifdeffery
in the header so that the compiler always sees a declaration and can
thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled
or not.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

# 2c2ca207 08-Apr-2020 Simon Glass <sjg@chromium.org>

uuid: Use const char * where possible

Update the arguments of these functions so they can be called from code
which uses constant strings.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3bad256f 29-Apr-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcb41dca 27-Oct-2015 Patrick Delaunay <patrick.delaunay73@gmail.com>

uuid: add selection by string for known partition type GUID

short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

partitions = name=boot,size=0x6bc00,type=data; \
name=root,size=0x7538ba00,type=linux;
gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

Partition Map for MMC device 0 -- Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x0000037f "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
2 0x00000380 0x003a9fdc "root"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
type: linux
guid: 25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>

# 4e4815fe 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: add functions to generate UUID version 4

This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- new configs:
- CONFIG_LIB_UUID for compile lib/uuid.c
- CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
- add configs dependency to include/config_fallbacks.h for lib uuid.

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
of UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
[trini: Add CONFIG_EFI_PARTITION to fallbacks]
Signed-off-by: Tom Rini <trini@ti.com>

# d718ded0 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: code refactor for proper maintain between uuid bin and string

Changes in lib/uuid.c to:
- uuid_str_to_bin()
- uuid_bin_to_str()

New parameter is added to specify input/output string format in listed functions
This change allows easy recognize which UUID type is or should be stored in given
string array. Binary data of UUID and GUID is always stored in big endian, only
string representations are different as follows.

String byte: 0 36
String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string UUID: be be be be be
string GUID: le le le be be

This patch also updates functions calls and declarations in a whole code.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: trini@ti.com

# f8a2d191 13-Jan-2021 Simon Glass <sjg@chromium.org>

uuid: Add a comment for UUID_STR_LEN

This macro is the length of the string but excludes the terminator. Users
must add 1 when declaring a large-enough string. Add a comment to make
this clear.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 31ce367c 20-Nov-2020 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

lib/uuid.c: change prototype of uuid_guid_get_str()

There's no reason to require an appropriately sized output parameter
for the string, that's error-prone should the table ever grow an
element with a longer string. We can just return the const char*
pointer directly.

Update the only caller accordingly, and get rid of pointless ifdeffery
in the header so that the compiler always sees a declaration and can
thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled
or not.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

# 2c2ca207 08-Apr-2020 Simon Glass <sjg@chromium.org>

uuid: Use const char * where possible

Update the arguments of these functions so they can be called from code
which uses constant strings.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3bad256f 29-Apr-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcb41dca 27-Oct-2015 Patrick Delaunay <patrick.delaunay73@gmail.com>

uuid: add selection by string for known partition type GUID

short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

partitions = name=boot,size=0x6bc00,type=data; \
name=root,size=0x7538ba00,type=linux;
gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

Partition Map for MMC device 0 -- Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x0000037f "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
2 0x00000380 0x003a9fdc "root"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
type: linux
guid: 25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>

# 4e4815fe 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: add functions to generate UUID version 4

This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- new configs:
- CONFIG_LIB_UUID for compile lib/uuid.c
- CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
- add configs dependency to include/config_fallbacks.h for lib uuid.

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
of UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
[trini: Add CONFIG_EFI_PARTITION to fallbacks]
Signed-off-by: Tom Rini <trini@ti.com>

# d718ded0 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: code refactor for proper maintain between uuid bin and string

Changes in lib/uuid.c to:
- uuid_str_to_bin()
- uuid_bin_to_str()

New parameter is added to specify input/output string format in listed functions
This change allows easy recognize which UUID type is or should be stored in given
string array. Binary data of UUID and GUID is always stored in big endian, only
string representations are different as follows.

String byte: 0 36
String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string UUID: be be be be be
string GUID: le le le be be

This patch also updates functions calls and declarations in a whole code.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: trini@ti.com

# 31ce367c 20-Nov-2020 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

lib/uuid.c: change prototype of uuid_guid_get_str()

There's no reason to require an appropriately sized output parameter
for the string, that's error-prone should the table ever grow an
element with a longer string. We can just return the const char*
pointer directly.

Update the only caller accordingly, and get rid of pointless ifdeffery
in the header so that the compiler always sees a declaration and can
thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled
or not.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

# 2c2ca207 08-Apr-2020 Simon Glass <sjg@chromium.org>

uuid: Use const char * where possible

Update the arguments of these functions so they can be called from code
which uses constant strings.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3bad256f 29-Apr-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcb41dca 27-Oct-2015 Patrick Delaunay <patrick.delaunay73@gmail.com>

uuid: add selection by string for known partition type GUID

short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

partitions = name=boot,size=0x6bc00,type=data; \
name=root,size=0x7538ba00,type=linux;
gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

Partition Map for MMC device 0 -- Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x0000037f "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
2 0x00000380 0x003a9fdc "root"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
type: linux
guid: 25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>

# 4e4815fe 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: add functions to generate UUID version 4

This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- new configs:
- CONFIG_LIB_UUID for compile lib/uuid.c
- CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
- add configs dependency to include/config_fallbacks.h for lib uuid.

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
of UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
[trini: Add CONFIG_EFI_PARTITION to fallbacks]
Signed-off-by: Tom Rini <trini@ti.com>

# d718ded0 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: code refactor for proper maintain between uuid bin and string

Changes in lib/uuid.c to:
- uuid_str_to_bin()
- uuid_bin_to_str()

New parameter is added to specify input/output string format in listed functions
This change allows easy recognize which UUID type is or should be stored in given
string array. Binary data of UUID and GUID is always stored in big endian, only
string representations are different as follows.

String byte: 0 36
String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string UUID: be be be be be
string GUID: le le le be be

This patch also updates functions calls and declarations in a whole code.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: trini@ti.com

# 2c2ca207 08-Apr-2020 Simon Glass <sjg@chromium.org>

uuid: Use const char * where possible

Update the arguments of these functions so they can be called from code
which uses constant strings.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3bad256f 29-Apr-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcb41dca 27-Oct-2015 Patrick Delaunay <patrick.delaunay73@gmail.com>

uuid: add selection by string for known partition type GUID

short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

partitions = name=boot,size=0x6bc00,type=data; \
name=root,size=0x7538ba00,type=linux;
gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

Partition Map for MMC device 0 -- Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x0000037f "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
2 0x00000380 0x003a9fdc "root"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
type: linux
guid: 25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>

# 4e4815fe 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: add functions to generate UUID version 4

This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- new configs:
- CONFIG_LIB_UUID for compile lib/uuid.c
- CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
- add configs dependency to include/config_fallbacks.h for lib uuid.

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
of UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
[trini: Add CONFIG_EFI_PARTITION to fallbacks]
Signed-off-by: Tom Rini <trini@ti.com>

# d718ded0 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: code refactor for proper maintain between uuid bin and string

Changes in lib/uuid.c to:
- uuid_str_to_bin()
- uuid_bin_to_str()

New parameter is added to specify input/output string format in listed functions
This change allows easy recognize which UUID type is or should be stored in given
string array. Binary data of UUID and GUID is always stored in big endian, only
string representations are different as follows.

String byte: 0 36
String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string UUID: be be be be be
string GUID: le le le be be

This patch also updates functions calls and declarations in a whole code.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: trini@ti.com

# 3bad256f 29-Apr-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bcb41dca 27-Oct-2015 Patrick Delaunay <patrick.delaunay73@gmail.com>

uuid: add selection by string for known partition type GUID

short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

partitions = name=boot,size=0x6bc00,type=data; \
name=root,size=0x7538ba00,type=linux;
gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

Partition Map for MMC device 0 -- Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x0000037f "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
2 0x00000380 0x003a9fdc "root"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
type: linux
guid: 25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>

# 4e4815fe 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: add functions to generate UUID version 4

This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- new configs:
- CONFIG_LIB_UUID for compile lib/uuid.c
- CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
- add configs dependency to include/config_fallbacks.h for lib uuid.

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
of UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
[trini: Add CONFIG_EFI_PARTITION to fallbacks]
Signed-off-by: Tom Rini <trini@ti.com>

# d718ded0 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: code refactor for proper maintain between uuid bin and string

Changes in lib/uuid.c to:
- uuid_str_to_bin()
- uuid_bin_to_str()

New parameter is added to specify input/output string format in listed functions
This change allows easy recognize which UUID type is or should be stored in given
string array. Binary data of UUID and GUID is always stored in big endian, only
string representations are different as follows.

String byte: 0 36
String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string UUID: be be be be be
string GUID: le le le be be

This patch also updates functions calls and declarations in a whole code.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: trini@ti.com

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# bcb41dca 27-Oct-2015 Patrick Delaunay <patrick.delaunay73@gmail.com>

uuid: add selection by string for known partition type GUID

short strings can be used in type parameter of gpt command
to replace the guid string for the types known by u-boot

partitions = name=boot,size=0x6bc00,type=data; \
name=root,size=0x7538ba00,type=linux;
gpt write mmc 0 $partitions

and they are also used to display the type of partition
in "part list" command

Partition Map for MMC device 0 -- Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000022 0x0000037f "boot"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type: data
guid: d117f98e-6f2c-d04b-a5b2-331a19f91cb2
2 0x00000380 0x003a9fdc "root"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
type: linux
guid: 25718777-d0ad-7443-9e60-02cb591c9737

Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>


# 4e4815fe 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: add functions to generate UUID version 4

This patch adds support to generate UUID (Universally Unique Identifier)
in version 4 based on RFC4122, which is randomly.

Source: https://www.ietf.org/rfc/rfc4122.txt

Changes:
- new configs:
- CONFIG_LIB_UUID for compile lib/uuid.c
- CONFIG_RANDOM_UUID for functions gen_rand_uuid() and gen_rand_uuid_str()
- add configs dependency to include/config_fallbacks.h for lib uuid.

lib/uuid.c:
- add gen_rand_uuid() - this function writes 16 bytes len binary representation
of UUID v4 to the memory at given address.

- add gen_rand_uuid_str() - this function writes 37 bytes len hexadecimal
ASCII string representation of UUID v4 to the memory at given address.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
[trini: Add CONFIG_EFI_PARTITION to fallbacks]
Signed-off-by: Tom Rini <trini@ti.com>


# d718ded0 02-Apr-2014 Przemyslaw Marczak <p.marczak@samsung.com>

lib: uuid: code refactor for proper maintain between uuid bin and string

Changes in lib/uuid.c to:
- uuid_str_to_bin()
- uuid_bin_to_str()

New parameter is added to specify input/output string format in listed functions
This change allows easy recognize which UUID type is or should be stored in given
string array. Binary data of UUID and GUID is always stored in big endian, only
string representations are different as follows.

String byte: 0 36
String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
string UUID: be be be be be
string GUID: le le le be be

This patch also updates functions calls and declarations in a whole code.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: trini@ti.com