xref: /freebsd/lib/libefivar/FreeBSD-update (revision 5754f582)
15754f582SJose Luis DuranFor the printing and parsing functionality, we use the Tianocore routines
25754f582SJose Luis Durandirectly.
37270962aSWarner Losh
47270962aSWarner Loshefivar-dp-format.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
57270962aSWarner Loshefivar-dp-parse.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
67270962aSWarner Losh
77270962aSWarner LoshThese files are first mechnaically processed with
87270962aSWarner Losh
97270962aSWarner Loshsed -e "s/L'/'/;"'s/L"/"/g;s/%g/%36s/g;s/%a/%s/g;s/^VOID/static VOID/g;s/ *$//g'
107270962aSWarner Losh
115754f582SJose Luis Duranfor several reasons. We're moving from wide rotuines to narrow routines. The
125754f582SJose Luis DuranUTC-2 this code is written for is a bad match for wchar_t which is an int. It's
135754f582SJose Luis Durana much better match for plain narrow characters on FreeBSD. So we pretend that
145754f582SJose Luis DuranCHAR16 for these files is really char * (ASCII).
157270962aSWarner Losh
165754f582SJose Luis DuranNext, we have have to convert the Unicode printf that this code expects to
175754f582SJose Luis DuranFreeBSD's printf. %g means "Print the GUID" and %a means "print the ASCII
185754f582SJose Luis Duranstring." so we mechanically convert them. Once we've done that we can compare
195754f582SJose Luis Duranefivar-dp-*.c to its source to see what's changed. Because we go through this
205754f582SJose Luis Duranindirection, I've done that outside of git. To upgrade you have to do these
215754f582SJose Luis Duranfiles by hand. You have to go through and make routines static.
227270962aSWarner Losh
235754f582SJose Luis Duranuefi-*.[ch] are internal routines to support this. They've been copied from EDK2
245754f582SJose Luis Duranas well, but in a more hap-hazard manner. This was a trade off between ease of
255754f582SJose Luis Duranimplementation / upgrade vs pulling in too much since less than half of any file
265754f582SJose Luis Duranwas needed.
277270962aSWarner Losh
287270962aSWarner Loshefi-osdep.h shims the EDK2 types to FreeBSD's types. It's included by
295754f582SJose Luis DuranProcessorBind.h which EDK2 uses to define the CPU. We keep it separate from
305754f582SJose Luis Duranuefi-dplib.h to allow better sharing.
317270962aSWarner Losh
325754f582SJose Luis Duranuefi-dplib.h shims the EDK2 routines that are needed to FreeBSD's routines. This
335754f582SJose Luis Duranis relatively easy since we map all the UCS-2 routines to simple char *
345754f582SJose Luis Duranroutines.
357270962aSWarner Losh
365754f582SJose Luis DuranRESIST THE URGE TO CLEAN UP THESE FILES. Except when such cleanups help with the
375754f582SJose Luis Durangoal of keeping them in sync with EDK2.
38