History log of /freebsd-current/lib/libefivar/efivar-dp-format.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# d30a1689 03-Oct-2022 John Baldwin <jhb@FreeBSD.org>

libefivar: Fix a buffer overread.

DevPathToTextUsbWWID allocates a separate copy of the SerialNumber
string to append a null terminator if the original string is not
null terminated. However, by using AllocateCopyPool, it tries to
copy 'Length + 1' words from the existing string containing 'Length'
characters into the target string. Split the copy out to only
copy 'Length' characters instead.

Reviewed by: imp, emaste
Reported by: GCC 12 -Wstringop-overread
Differential Revision: https://reviews.freebsd.org/D36826


# 5754f582 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Apply uncrustify changes

Apply uncrustify changes to .c/.h files.

Reduce the diffs with EDK2 to aid with future merges. The
unconventional way we've imported this code makes using a vendor branch
to manage it at the very least tricky. Update FreeBSD-update to reflect
the slight shift in advise.

Reviewed by: imp
Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Obtained from: https://github.com/tianocore/edk2/commit/2f88bd3a1296c522317f1c21377876de63de5be7
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# 11a9ff5b 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Replace BSD License with BSD+Patent License

Replace BSD 2-Clause License with BSD+Patent License. This change is
based on the following emails:

https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html
https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html

RFCs with detailed process for the license change:

V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html
V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html
V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1373
Obtained from: https://github.com/tianocore/edk2/commit/9344f0921518309295da89c221d10cbead8531aa
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# e871598a 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Check Length para before use in DevPathToTextUsbWWID

In function DevPathToTextUsbWWID, the Length parameter is used
without check. This patch is to add check before using it.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1336
Obtained from: https://github.com/tianocore/edk2/commit/d8e702693a8c292220131dc4234a36e2c9fff614
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# c1fa6f4c 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Fix incorrect check for DisplayOnly text format in AcpiEx

Text format for AcpiEx device path in UEFI Spec:
AcpiEx(HID,CID,UID,HIDSTR,CIDSTR,UIDSTR)
AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR))(Display Only)

When convert device path to text for AcpiEx device path,
current code check AllowShortcuts parameter to convert
the device path to DisplayOnly text format(shorter text
representation) by mistake.
It should check DisplayOnly parameter.

This commit is to fix this issue.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1312
Obtained from: https://github.com/tianocore/edk2/commit/e9ab1635a2cfa1cb588996dcd5cc157fb44decb1
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# 492d9953 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Handle AcpiExp device path when optional para is not specified

AcpiExp text device path: AcpiExp(HID,CID,UIDSTR)
And according to UEFI spec, the CID parameter is optional
and has a default value of 0. But current implementation
miss to check following cases for the AcpiExp.
FromText: when text device is AcpiExp(HID,,UIDSTR)/AcpiExp(HID,0,UIDSTR)
ToText: when the CID is 0 in the node structure

This commit is to do the enhancement.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1243
Obtained from: https://github.com/tianocore/edk2/commit/a8b5750901faa63ff5570634851e648b8e335e5a
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# a51ae721 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Add PciRoot/PcieRoot text for ACPI Expanded Device Path

According to UEFI spec,for ACPI Expanded Device Path
when HID=PNP0A03 or CID=PNP0A03 and HID != PNP0A08,
the device path node can be displayed as: PciRoot(UID|UIDSTR)
When HID=PNP0A08 or CID=PNP0A08, the device path node can be
displayed as: PcieRoot(UID|UIDSTR). But current code miss the
code logic.

This commit is to do the enhancement.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1228
Obtained from: https://github.com/tianocore/edk2/commit/78af0984b45a780e45d57c22c85a1f594b969212
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# ac2b16d3 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Correct condition check for AcpiExp text format

According to UEFI Spec, for ACPI Expanded Device Path,
when HIDSTR=empty, CIDSTR=empty, UID STR!=empty,
the ACPI Expanded Device Path node can be displayed as
AcpiExp(HID,CID,UIDSTR) format.
And if UID is 0 and UIDSTR is empty, then use AcpiEx format.

This patch is to correct the condition check to follow UEFI
Spec when convert the device path node to the AcpiExp text
format.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1226
Obtained from: https://github.com/tianocore/edk2/commit/fb4bea551e5b7e16e54676bca3d1ccde65f57c77
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# 8278071a 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Correct the string order of ACPI Expanded Device Path

According to UEFI Spec, ACPI Expanded Device Path can be display
AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR)), but current code display
UID|UIDSTR before CID|CIDSTR.
This patch is to fix this issue.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1227
Obtained from: https://github.com/tianocore/edk2/commit/05fe7525896cee197cfed98154955dbaa60d6357
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# 49951297 25-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Clean up source files

1. Do not use tab characters
2. No trailing white space in one line
3. All files must end with CRLF

Adapted according to FreeBSD-update instructions, with the sole purpose
of reducing the differences with upstream sources.

Obtained from: https://github.com/tianocore/edk2/commit/9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# 50668299 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Fix iSCSI.Lun byte order issue

Obtained from: https://github.com/tianocore/edk2/commit/19f21ed91652d2a5160426ad8ca9219728d85aec
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# d9d1a1e7 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Add DevPathFromTextDns and DevPathToTextDns libraries

V3:
* Fix the bug in DevPathFromTextDns()

V2:
* Add no IP instance case check.

Obtained from: https://github.com/tianocore/edk2/commit/9b9d0655c1547384c2b34cea94eab4b8b83bd1b9
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# e8fc7f11 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Add BluetoothLe device path node support

Obtained from: https://github.com/tianocore/edk2/commit/ff5623e990782ad62c5f6943087ebafb17afe8ba
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# 00816383 23-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Reverse the byte order of BD_ADDR for Bluetooth

For the following two functions:
DevPathFromTextBluetooth()
DevPathToTextBluetooth()

The Bluetooth device address "UINT8 Address[6]" is displayed with the
order from Address[5] to Address[0]. This commit reverses the order.

Obtained from: https://github.com/tianocore/edk2/commit/4fc8277133fb011d028b4e0a42444ab6f552d0b9
Pull Request: https://github.com/freebsd/freebsd-src/pull/581


# 91a35e58 22-Feb-2022 Jose Luis Duran <jlduran@gmail.com>

libefivar: Correct the string expression of UTF8 vendor device path

According to UEFI spec, the string expression of UTF8 vendor
device node should be displayed as: VenUtf8(). Current code
display it as: VenUft8() by mistake when convert device
path node to text.

This commit is to fix this bug.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1225
Obtained from: https://github.com/tianocore/edk2/commit/959be180e185869b71db9dad34c3f4bba660d724
Pull Request: https://github.com/freebsd/freebsd-src/pull/580


# 52467047 04-Feb-2019 Warner Losh <imp@FreeBSD.org>

Regularize the Netflix copyright

Use recent best practices for Copyright form at the top of
the license:
1. Remove all the All Rights Reserved clauses on our stuff. Where we
piggybacked others, use a separate line to make things clear.
2. Use "Netflix, Inc." everywhere.
3. Use a single line for the copyright for grep friendliness.
4. Use date ranges in all places for our stuff.

Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files)


# 366a7b3d 26-Oct-2018 Warner Losh <imp@FreeBSD.org>

Ensure that the device path is sane before trying to decode and print
it.

Sponsored by: Netflix, Inc


# 6decf2cc 02-Mar-2018 Ed Maste <emaste@FreeBSD.org>

libefivar: use standard 2-Clause FreeBSD license

Approved by: imp
Sponsored by: The FreeBSD Foundation


# 09ee5d8a 02-Dec-2017 Warner Losh <imp@FreeBSD.org>

Create a function to translate UEFI paths to unix paths

efivar_device_path_to_unix_path translates from UEFI to Unix
efivar_unix_path_to_device_path translates from Unix to UEFI

At present, only HD() device types are supported (both GPT and
MBR). CdRom and floppy devices aren't supported. ZFS isn't supported
because there's no way in the UEFI standard to specify a ZFS datastore.
Network devices aren't supported either.

Three forms of Unix path are accepted: /path/to/file (for a mounted
filesystem), //path/to/file (uses the EFI partition on the same disk
as /), and dev:/path/to/file (for unmounted filesystem). Two forms are
produced (the first and last).

Sponsored by: Netflix


# 5320ef6a 26-Nov-2017 Warner Losh <imp@FreeBSD.org>

Add efidp_format_device_path_node to format a single node in a device
path, much like efidp_format_device_path will format the entire path.

Sponsored by: Netflix


# 1028a2d4 07-Sep-2017 Warner Losh <imp@FreeBSD.org>

Implement efidp_size

efidp_size will return the size, in bytes, of a EFI device path
structure. This is a convenience wrapper in the same style as the
other linux routines. It's implemented by GetDevicePathSize from EDK2
we already needed for other things.

Sponsored by: Netflix


# 0d802f5a 31-Aug-2017 Warner Losh <imp@FreeBSD.org>

Fix printing File() nodes in device paths.

Device paths encoded into the FILEPATH_DEVICE_PATH are UCS2 not
ASCII/UTF8. Convert to utf8 and print that when printing File
paths. Also, since File may be at the end of a long device path,
output File() around the path so it doesn't just show up as random
nodes that might accidentally match real node paths names and cause
errors.


# 7270962a 08-Mar-2017 Warner Losh <imp@FreeBSD.org>

Bring in EDK2 routines for printing and parsing device paths.

This commit implements the (mostly?) Linux compatible
efidp_format_device_path and efidp_parse_device_path APIs. These are
the only APIs exposed through this library. However, they are built on
code from Tianocore's EDK2 MdePkg. They are brought in as new files
here for reasons described in FreeBSD-update.

Symbol versioning will be introduced to control what's exported from
the EDK2 code.

Some structural changes may be necessary when we move to sharing with
sys/boot/efi.

Sponsored by: Netflix