1 /* types.h
2 
3 Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 */
13 
14 #ifndef TYPES_H
15 #define TYPES_H
16 
17 #include "basetypes.h"
18 
19 // Actions
20 namespace Actions
21 {
22     enum ActionTypes {
23         NoAction = 50,
24         Erase,
25         Create,
26         Insert,
27         Replace,
28         Remove,
29         Rebuild,
30         Rebase
31     };
32 }
33 
34 // Types
35 namespace Types {
36     enum ItemTypes {
37         Root = 60,
38         Capsule,
39         Image,
40         Region,
41         Padding,
42         Volume,
43         File,
44         Section,
45         FreeSpace,
46         VssStore,
47         Vss2Store,
48         FtwStore,
49         FdcStore,
50         FsysStore,
51         EvsaStore,
52         FlashMapStore,
53         CmdbStore,
54         NvarEntry,
55         VssEntry,
56         FsysEntry,
57         EvsaEntry,
58         FlashMapEntry,
59         Microcode,
60         SlicData,
61         // ME-specific
62         IfwiHeader,
63         IfwiPartition,
64         FptStore,
65         FptEntry,
66         FptPartition,
67         BpdtStore,
68         BpdtEntry,
69         BpdtPartition,
70         CpdStore,
71         CpdEntry,
72         CpdPartition,
73         CpdExtension,
74         CpdSpiEntry
75     };
76 }
77 
78 namespace Subtypes {
79     enum ImageSubtypes{
80         IntelImage = 90,
81         UefiImage
82     };
83 
84     enum CapsuleSubtypes {
85         AptioSignedCapsule = 100,
86         AptioUnsignedCapsule,
87         UefiCapsule,
88         ToshibaCapsule
89     };
90 
91     enum VolumeSubtypes {
92         UnknownVolume = 110,
93         Ffs2Volume,
94         Ffs3Volume,
95         NvramVolume,
96         MicrocodeVolume
97     };
98 
99     enum RegionSubtypes {
100         DescriptorRegion = 0,
101         BiosRegion,
102         MeRegion,
103         GbeRegion,
104         PdrRegion,
105         DevExp1Region,
106         Bios2Region,
107         MicrocodeRegion,
108         EcRegion,
109         DevExp2Region,
110         IeRegion,
111         Tgbe1Region,
112         Tgbe2Region,
113         Reserved1Region,
114         Reserved2Region,
115         PttRegion
116     };
117 
118     enum PaddingSubtypes {
119         ZeroPadding = 120,
120         OnePadding,
121         DataPadding
122     };
123 
124     enum NvarEntrySubtypes {
125         InvalidNvarEntry = 130,
126         InvalidLinkNvarEntry,
127         LinkNvarEntry,
128         DataNvarEntry,
129         FullNvarEntry
130     };
131 
132     enum VssEntrySubtypes {
133         InvalidVssEntry = 140,
134         StandardVssEntry,
135         AppleVssEntry,
136         AuthVssEntry,
137         IntelVssEntry
138     };
139 
140     enum FsysEntrySubtypes {
141         InvalidFsysEntry = 150,
142         NormalFsysEntry
143     };
144 
145     enum EvsaEntrySubtypes {
146         InvalidEvsaEntry = 160,
147         UnknownEvsaEntry,
148         GuidEvsaEntry,
149         NameEvsaEntry,
150         DataEvsaEntry,
151     };
152 
153     enum FlashMapEntrySubtypes {
154         VolumeFlashMapEntry = 170,
155         DataFlashMapEntry
156     };
157 
158     enum MicrocodeSubtypes {
159         IntelMicrocode = 180,
160         AmdMicrocode
161     };
162 
163     enum SlicDataSubtypes {
164         PubkeySlicData = 190,
165         MarkerSlicData
166     };
167 
168     // ME-specific
169     enum IfwiPartitionSubtypes {
170         DataIfwiPartition = 200,
171         BootIfwiPartition
172     };
173 
174     enum FptEntrySubtypes {
175         ValidFptEntry = 210,
176         InvalidFptEntry
177     };
178 
179     enum FptPartitionSubtypes {
180         CodeFptPartition = 220,
181         DataFptPartition,
182         GlutFptPartition
183     };
184 
185     enum CpdPartitionSubtypes {
186         ManifestCpdPartition = 230,
187         MetadataCpdPartition,
188         KeyCpdPartition,
189         CodeCpdPartition
190     };
191 }
192 
193 // *ToUString conversion routines
194 extern UString actionTypeToUString(const UINT8 action);
195 extern UString itemTypeToUString(const UINT8 type);
196 extern UString itemSubtypeToUString(const UINT8 type, const UINT8 subtype);
197 extern UString compressionTypeToUString(const UINT8 algorithm);
198 extern UString regionTypeToUString(const UINT8 type);
199 extern UString fitEntryTypeToUString(const UINT8 type);
200 
201 #endif // TYPES_H
202