6b621f9 OvmfPkg: Add public headers from Xen Project.

13 files Authored by anthonyper 9 years ago, Committed by jljusten 9 years ago,
    OvmfPkg: Add public headers from Xen Project.
    
    This patch imports publics headers in order to use features from Xen
    like XenStore, PV Block... There is only the necessary header files and
    there are only a few modifications in order to facilitate future merge of
    more recent header (that would be necessary to access new features).
    
    There is little modification compared to the original files:
    - Removed most of the unused part of the headers
    - Use of ZeroMem() instead of memset()
    - using #pragma pack(4) for IA32 compilation.
    - Replace types to be more UEFI compliant using a script.
    
    OVMF, when built for IA32 arch, uses the gcc switch -malign-double. This
    change the alignment of fields in some struct compare to what is
    espected by Xen and any backends. To fix the alignment, the #pragma pack(4)
    directive is used around the struct that need it.
    
    Command to run to change types:
    find OvmfPkg/Include/IndustryStandard/Xen -type f -name '*.h' -exec sed
      --regexp-extended --file=fix_type_in_xen_includes.sed --in-place {} \;
    
    Avoid changing the 'long' that is not a type (with the first line).
    $ cat fix_type_in_xen_includes.sed
    /as long as/b
    
    s/([^a-zA-Z0-9_]|^)uint8_t([^a-zA-Z0-9_]|$)/\1UINT8\2/g
    s/([^a-zA-Z0-9_]|^)uint16_t([^a-zA-Z0-9_]|$)/\1UINT16\2/g
    s/([^a-zA-Z0-9_]|^)uint32_t([^a-zA-Z0-9_]|$)/\1UINT32\2/g
    s/([^a-zA-Z0-9_]|^)uint64_t([^a-zA-Z0-9_]|$)/\1UINT64\2/g
    
    s/([^a-zA-Z0-9_]|^)int8_t([^a-zA-Z0-9_]|$)/\1INT8\2/g
    s/([^a-zA-Z0-9_]|^)int16_t([^a-zA-Z0-9_]|$)/\1INT16\2/g
    s/([^a-zA-Z0-9_]|^)int32_t([^a-zA-Z0-9_]|$)/\1INT32\2/g
    s/([^a-zA-Z0-9_]|^)int64_t([^a-zA-Z0-9_]|$)/\1INT64\2/g
    
    s/([^a-zA-Z0-9_]|^)void([^a-zA-Z0-9_]|$)/\1VOID\2/g
    s/([^a-zA-Z0-9_]|^)unsigned int([^a-zA-Z0-9_]|$)/\1UINT32\2/g
    s/([^a-zA-Z0-9_]|^)int([^a-zA-Z0-9_]|$)/\1INT32\2/g
    s/([^a-zA-Z0-9_]|^)unsigned char([^a-zA-Z0-9_]|$)/\1UINT8\2/g
    s/([^a-zA-Z0-9_]|^)char([^a-zA-Z0-9_]|$)/\1CHAR8\2/g
    s/([^a-zA-Z0-9_]|^)unsigned long([^a-zA-Z0-9_]|$)/\1UINTN\2/g
    s/([^a-zA-Z0-9_]|^)long([^a-zA-Z0-9_]|$)/\1INTN\2/g
    
    Change in V4:
    - Add a README in Xen headers directory to explain what have been done
      to it. It is mostly a copy/past from the commit description with some
      rewording.
    - replace unsigned char by UINT8 as there is no unsigned char in UEFI
      types.
    
    Change in V3:
    - Remove unused header sched.h
    - moving xs_wire.h in a later patch, where it's first needed
    - moving io/blkif.h in a later patch (XenPvBlkDxe: Add BlockFront client)
    - moving event_channel.h in a later patch (XenBusDxe: Add Event Channel Notify)
    - using #pragma pack(4) for IA32
    - headers trimed down, removed most of the unused struct/define/...
    
    License: This patch adds many files under the MIT licence.
    Contributed-under: TianoCore Contribution Agreement 1.0
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Jordan Justen <jordan.l.justen@intel.com>
    
    git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16257 6f19259b-4bc3-4df7-8a09-765794883524