2022-02-24 01:23:57 +00:00
|
|
|
For the printing and parsing functionality, we use the Tianocore routines
|
|
|
|
directly.
|
2017-03-09 00:31:31 +00:00
|
|
|
|
|
|
|
efivar-dp-format.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
|
|
|
|
efivar-dp-parse.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
|
|
|
|
|
|
|
|
These files are first mechnaically processed with
|
|
|
|
|
|
|
|
sed -e "s/L'/'/;"'s/L"/"/g;s/%g/%36s/g;s/%a/%s/g;s/^VOID/static VOID/g;s/ *$//g'
|
|
|
|
|
2022-02-24 01:23:57 +00:00
|
|
|
for several reasons. We're moving from wide rotuines to narrow routines. The
|
|
|
|
UTC-2 this code is written for is a bad match for wchar_t which is an int. It's
|
|
|
|
a much better match for plain narrow characters on FreeBSD. So we pretend that
|
|
|
|
CHAR16 for these files is really char * (ASCII).
|
|
|
|
|
|
|
|
Next, we have have to convert the Unicode printf that this code expects to
|
|
|
|
FreeBSD's printf. %g means "Print the GUID" and %a means "print the ASCII
|
|
|
|
string." so we mechanically convert them. Once we've done that we can compare
|
|
|
|
efivar-dp-*.c to its source to see what's changed. Because we go through this
|
|
|
|
indirection, I've done that outside of git. To upgrade you have to do these
|
|
|
|
files by hand. You have to go through and make routines static.
|
|
|
|
|
|
|
|
uefi-*.[ch] are internal routines to support this. They've been copied from EDK2
|
|
|
|
as well, but in a more hap-hazard manner. This was a trade off between ease of
|
|
|
|
implementation / upgrade vs pulling in too much since less than half of any file
|
|
|
|
was needed.
|
2017-03-09 00:31:31 +00:00
|
|
|
|
|
|
|
efi-osdep.h shims the EDK2 types to FreeBSD's types. It's included by
|
2022-02-24 01:23:57 +00:00
|
|
|
ProcessorBind.h which EDK2 uses to define the CPU. We keep it separate from
|
|
|
|
uefi-dplib.h to allow better sharing.
|
2017-03-09 00:31:31 +00:00
|
|
|
|
2022-02-24 01:23:57 +00:00
|
|
|
uefi-dplib.h shims the EDK2 routines that are needed to FreeBSD's routines. This
|
|
|
|
is relatively easy since we map all the UCS-2 routines to simple char *
|
|
|
|
routines.
|
2017-03-09 00:31:31 +00:00
|
|
|
|
2022-02-24 01:23:57 +00:00
|
|
|
RESIST THE URGE TO CLEAN UP THESE FILES. Except when such cleanups help with the
|
|
|
|
goal of keeping them in sync with EDK2.
|