18.7.2 Using INF File to Generate PCI Option ROM Image

Use the INF file to specify the information required to package a UEFI Driver into a PCI Option ROM image without having to manually run the EfiRom utility. Chapter 7 covers Driver Entry Points and includes a number of example INF files. The following example shows an expanded version of the AbcDriverMinimum from Chapter 7 and also shows how the PCI Option ROM related information can be specified. The only changes are the addition of the PCI statements in the [Defines] section. These PCI statements allow the Vendor ID, Device ID, Class Code, and Revision values to be specified and they are used to fill in the PCI Option ROM headers. The PCI_COMPRESS statement specifies whether the UEFI Driver should be compressed using the UEFI compression algorithm or not. If a statement is not present, the value is assumed to be 0 If the PCI statements are present, and if the UEFI Driver is successfully built, the PCI Option ROM image is then automatically generated. The one limitation of this method is that the PCI Option ROMs are allowed to contain only a single UEFI Driver.

Example 199-UEFI Driver INF File for PCI Option ROM
[Defines]
  INF_VERSION    = 0x00010005
  BASE_NAME      = AbcDriverPciOptionRom
  FILE_GUID      = DA87D340-15C0-4824-9BF3-D52286674BEF
  MODULE_TYPE    = CAE55A8A-4307-4ae1-824E-326EE24928D7
  VERSION_STRING = 1.0
  ENTRY_POINT    = AbcDriverEntryPoint
  PCI_VENDOR_ID  = 0xABCD
  PCI_DEVICE_ID  = 0x1234
  PCI_CLASS_CODE = 0x56789A
  PCI_REVISION   = 0x0003
  PCI_COMPRESS   = TRUE

[Sources]
  Abc.c

[Packages]
  MdePkg/MdePkg.dec

[LibraryClasses]
  UefiDriverEntryPoint