1## @file
2# process FFS generation
3#
4#  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
5#
6#  This program and the accompanying materials
7#  are licensed and made available under the terms and conditions of the BSD License
8#  which accompanies this distribution.  The full text of the license may be found at
9#  http://opensource.org/licenses/bsd-license.php
10#
11#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13#
14
15##
16# Import Modules
17#
18from CommonDataClass.FdfClass import FDClassObject
19
20## generate FFS
21#
22#
23class Ffs(FDClassObject):
24
25    # mapping between MODULE type in FDF (from INF) and file type for GenFfs
26    ModuleTypeToFileType = {
27        'SEC'               : 'EFI_FV_FILETYPE_SECURITY_CORE',
28        'PEI_CORE'          : 'EFI_FV_FILETYPE_PEI_CORE',
29        'PEIM'              : 'EFI_FV_FILETYPE_PEIM',
30        'DXE_CORE'          : 'EFI_FV_FILETYPE_DXE_CORE',
31        'DXE_DRIVER'        : 'EFI_FV_FILETYPE_DRIVER',
32        'DXE_SAL_DRIVER'    : 'EFI_FV_FILETYPE_DRIVER',
33        'DXE_SMM_DRIVER'    : 'EFI_FV_FILETYPE_DRIVER',
34        'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER',
35        'UEFI_DRIVER'       : 'EFI_FV_FILETYPE_DRIVER',
36        'UEFI_APPLICATION'  : 'EFI_FV_FILETYPE_APPLICATION',
37        'SMM_CORE'          : 'EFI_FV_FILETYPE_SMM_CORE'
38    }
39
40    # mapping between FILE type in FDF and file type for GenFfs
41    FdfFvFileTypeToFileType = {
42        'SEC'               : 'EFI_FV_FILETYPE_SECURITY_CORE',
43        'PEI_CORE'          : 'EFI_FV_FILETYPE_PEI_CORE',
44        'PEIM'              : 'EFI_FV_FILETYPE_PEIM',
45        'DXE_CORE'          : 'EFI_FV_FILETYPE_DXE_CORE',
46        'FREEFORM'          : 'EFI_FV_FILETYPE_FREEFORM',
47        'DRIVER'            : 'EFI_FV_FILETYPE_DRIVER',
48        'APPLICATION'       : 'EFI_FV_FILETYPE_APPLICATION',
49        'FV_IMAGE'          : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE',
50        'RAW'               : 'EFI_FV_FILETYPE_RAW',
51        'PEI_DXE_COMBO'     : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',
52        'SMM'               : 'EFI_FV_FILETYPE_SMM',
53        'SMM_CORE'          : 'EFI_FV_FILETYPE_SMM_CORE'
54    }
55
56    # mapping between section type in FDF and file suffix
57    SectionSuffix = {
58        'PE32'                 : '.pe32',
59        'PIC'                  : '.pic',
60        'TE'                   : '.te',
61        'DXE_DEPEX'            : '.dpx',
62        'VERSION'              : '.ver',
63        'UI'                   : '.ui',
64        'COMPAT16'             : '.com16',
65        'RAW'                  : '.raw',
66        'FREEFORM_SUBTYPE_GUID': '.guid',
67        'SUBTYPE_GUID'         : '.guid',
68        'FV_IMAGE'             : 'fv.sec',
69        'COMPRESS'             : '.com',
70        'GUIDED'               : '.guided',
71        'PEI_DEPEX'            : '.dpx',
72        'SMM_DEPEX'            : '.dpx'
73    }
74
75    ## The constructor
76    #
77    #   @param  self        The object pointer
78    #
79    def __init__(self):
80        FfsClassObject.__init__(self)
81