A.5.2 GUID File Template

GUIDs and their associated data structures are declared just like protocols. The only difference is that GUIDs are typically placed in a different subdirectory of an EDK II package. The typical path to a protocol .h file is <<PackageName>>/Include/Guid/<<GuidName>>.h. For example, all the GUIDs defined in the UEFI Specification can be found in the EDK II MdePg in /MdePkg/Include/Guid. When a new GUID is defined and added to an include directory of an EDK II package, the GUID must also be added to the [Guids] section of a package's .dec file. The .dec file is where the C variable name for the GUID is declared and mapped to GUID value for the protocol. Defining a new GUID is not commonly required when implementing a new UEFI Driver. If a UEFI Driver implementation does require a new GUID definition, then the new GUID is usually added to the same EDK II package that contains the UEFI Driver implementation.

The following example shows a template for adding a new GUID to the [Guids] section of an EDK II package .dec file. Following that, Example A-29 shows the template for the .h files for GUIDs placed in the include directory of an EDK II package.

Example A-28-Add GUID to an EDK II package

gEfi<<GuidName>>Guid = <<GUID_STRUCT>>

Example A-29-GUID include file template

/** @file
#ifndef __<<GUID_NAME>>_H__
#define __<<GUID_NAME>>_H__
#define EFI_<<GUID_NAME>>_GUID \
/// GUID specific defines
/// GUID specific structures
typedef struct {
// Place GUID specific data fields here
extern EFI_GUID gEfi <<GuidName>>Guid;