3 Copyright (c) 1999 - 2008 Intel Corporation. All rights reserved
\r
4 This software and associated documentation (if any) is furnished
\r
5 under a license and may only be used or copied in accordance
\r
6 with the terms of the license. Except as permitted by such
\r
7 license, no part of this software or documentation may be
\r
8 reproduced, stored in a retrieval system, or transmitted in any
\r
9 form or by any means without the express written consent of
\r
19 This file contains the relevant declarations required
\r
20 to generate Option Rom File
\r
24 #ifndef __EFI_ROM_H__
\r
25 #define __EFI_ROM_H__
\r
31 #include <Common/UefiBaseTypes.h>
\r
32 #include <IndustryStandard/PeImage.h> // for PE32 structure definitions
\r
34 #include <IndustryStandard/pci22.h> // for option ROM header structures
\r
35 #include <IndustryStandard/pci30.h>
\r
37 #include "Compress.h"
\r
38 #include "CommonLib.h"
\r
41 // Version of this utility
\r
43 #define UTILITY_NAME "EfiRom"
\r
44 #define UTILITY_MAJOR_VERSION 0
\r
45 #define UTILITY_MINOR_VERSION 1
\r
48 // Define the max length of a filename
\r
50 #define MAX_PATH 200
\r
53 // Define the default file extension name
\r
55 #define DEFAULT_OUTPUT_EXTENSION ".rom"
\r
58 // Max size for an option ROM image
\r
60 #define MAX_OPTION_ROM_SIZE (1024 * 1024 * 16) // 16MB
\r
63 // Values for the indicator field in the PCI data structure
\r
65 #define INDICATOR_LAST 0x80 // last file in series of files
\r
68 // Masks for the FILE_LIST.FileFlags field
\r
70 #define FILE_FLAG_BINARY 0x01
\r
71 #define FILE_FLAG_EFI 0x02
\r
72 #define FILE_FLAG_COMPRESS 0x04
\r
75 // Use this linked list structure to keep track of all the filenames
\r
76 // specified on the command line.
\r
78 typedef struct _FILE_LIST {
\r
79 struct _FILE_LIST *Next;
\r
83 UINT16 CodeRevision;
\r
87 // Use this to track our command-line options
\r
90 CHAR8 OutFileName[MAX_PATH];
\r
106 FILE_LIST *FileList;
\r
110 // Make a global structure to keep track of command-line options
\r
112 static OPTIONS mOptions;
\r
115 // Use these to convert from machine type value to a named type
\r
125 static STRING_LOOKUP mMachineTypes[] = {
\r
126 { EFI_IMAGE_MACHINE_IA32, "IA32" },
\r
127 { EFI_IMAGE_MACHINE_IA64, "IA64" },
\r
128 { EFI_IMAGE_MACHINE_EBC, "EBC" },
\r
135 static STRING_LOOKUP mSubsystemTypes[] = {
\r
136 { EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION, "EFI application" },
\r
137 { EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER, "EFI boot service driver" },
\r
138 { EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER, "EFI runtime driver" },
\r
143 // Function prototypes
\r
152 Routine Description:
\r
154 Displays the utility version to STDOUT
\r
174 Routine Description:
\r
176 Displays the utility usage syntax to STDOUT
\r
198 Routine Description:
\r
200 Given the Argc/Argv program arguments, and a pointer to an options structure,
\r
201 parse the command-line options and check their validity.
\r
205 Argc - standard C main() argument count
\r
206 Argv[] - standard C main() argument list
\r
207 Options - pointer to a structure to store the options in
\r
211 STATUS_SUCCESS success
\r
221 UINT16 *MachineType,
\r
226 Routine Description:
\r
228 Given the Argc/Argv program arguments, and a pointer to an options structure,
\r
229 parse the command-line options and check their validity.
\r
233 Argc - standard C main() argument count
\r
234 Argv[] - standard C main() argument list
\r
235 Options - pointer to a structure to store the options in
\r
239 STATUS_SUCCESS success
\r
256 Routine Description:
\r
258 Process a PE32 EFI file.
\r
262 OutFptr - file pointer to output binary ROM image file we're creating
\r
263 InFile - structure contains information on the PE32 file to process
\r
264 VendId - vendor ID as required in the option ROM header
\r
265 DevId - device ID as required in the option ROM header
\r
266 Size - pointer to where to return the size added to the output file
\r
284 Routine Description:
\r
286 Process a binary input file.
\r
290 OutFptr - file pointer to output binary ROM image file we're creating
\r
291 InFile - structure contains information on the binary file to process
\r
292 Size - pointer to where to return the size added to the output file
\r
308 Routine Description:
\r
310 Dump the headers of an existing option ROM image
\r
314 InFile - the file name of an existing option ROM image
\r
324 GetMachineTypeStr (
\r
329 Routine Description:
\r
331 GC_TODO: Add function description
\r
335 MachineType - GC_TODO: add argument description
\r
339 GC_TODO: add return values
\r
346 GetSubsystemTypeStr (
\r
347 UINT16 SubsystemType
\r
351 Routine Description:
\r
353 GC_TODO: Add function description
\r
357 SubsystemType - GC_TODO: add argument description
\r
361 GC_TODO: add return values
\r