aboutsummaryrefslogtreecommitdiff
path: root/lib/libefivar/FreeBSD-update
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-03-09 00:31:31 +0000
committerWarner Losh <imp@FreeBSD.org>2017-03-09 00:31:31 +0000
commit7270962aa54e4647b841f9ae2fd1989de8048a76 (patch)
tree46c401b7c23f80c6198276f5a4c34919a89520c5 /lib/libefivar/FreeBSD-update
parentbea9d78b2d4f2581b0d707a3635856cc8b931f88 (diff)
downloadsrc-7270962aa54e4647b841f9ae2fd1989de8048a76.tar.gz
src-7270962aa54e4647b841f9ae2fd1989de8048a76.zip
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
Notes
Notes: svn path=/head/; revision=314926
Diffstat (limited to 'lib/libefivar/FreeBSD-update')
-rw-r--r--lib/libefivar/FreeBSD-update39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/libefivar/FreeBSD-update b/lib/libefivar/FreeBSD-update
new file mode 100644
index 000000000000..8b45dce8c3a0
--- /dev/null
+++ b/lib/libefivar/FreeBSD-update
@@ -0,0 +1,39 @@
+$FreeBSD$
+
+For the printing and parsing functionalit, we use the Tianocore routines directly.
+
+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'
+
+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 svn. 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.
+
+efi-osdep.h shims the EDK2 types to FreeBSD's types. It's included by
+ProcessorBind.h which EDK2 uses to define the CPU. We keep it separate
+from uefi-dplib.h to allow better sharing.
+
+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.
+
+RESIST THE URGE TO CLEAN UP THESE FILES.