mirror of https://github.com/acidanthera/audk.git
Add version check in both PCD database generation and service driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@292 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
24dba7f3c1
commit
4acf8ce7da
|
@ -18,197 +18,20 @@ Module Name: Service.h
|
|||
#ifndef _SERVICE_H
|
||||
#define _SERVICE_H
|
||||
|
||||
#define USE_AUTOGEN
|
||||
|
||||
#ifndef USE_AUTOGEN
|
||||
//
|
||||
// The following definition will be generated by build tool
|
||||
// Please make sure the PCD Serivce PEIM Version is consistent with
|
||||
// the version of PCD Database generation tool
|
||||
//
|
||||
#define PCD_DXE_SERVICE_DRIVER_VERSION 1
|
||||
|
||||
//
|
||||
// Common definitions
|
||||
//
|
||||
#define PCD_TYPE_SHIFT 24
|
||||
|
||||
|
||||
#define PCD_TYPE_DATA (0x00 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_HII (0x80 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_VPD (0x40 << PCD_TYPE_SHIFT)
|
||||
#define PCD_TYPE_SKU_ENABLED (0x20 << PCD_TYPE_SHIFT)
|
||||
|
||||
|
||||
#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED))
|
||||
|
||||
typedef struct {
|
||||
UINT32 ExTokenNumber;
|
||||
UINT32 LocalTokenNumber; // PCD Number of this particular platform build
|
||||
UINT16 ExGuidIndex; // Index of GuidTable
|
||||
} DYNAMICEX_MAPPING;
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT32 SkuDataStartOffset; //We have to use offsetof MACRO as we don't know padding done by compiler
|
||||
UINT32 SkuIdTableOffset; //Offset from the PCD_DB
|
||||
} SKU_HEAD;
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.
|
||||
UINT16 StringIndex; // Offset in String Table in units of UINT16.
|
||||
UINT16 Offset; // Offset in Variable
|
||||
} VARIABLE_HEAD ;
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT32 Offset;
|
||||
} VPD_HEAD;
|
||||
|
||||
typedef struct {
|
||||
UINT32 LocalTokenNumber;
|
||||
UINT16 TokenNumber;
|
||||
UINT16 Size;
|
||||
} SIZEINFO;
|
||||
|
||||
#define offsetof(s,m) (UINT32)&(((s *)0)->m)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// C Structure generate for PEI PCD Database
|
||||
//
|
||||
#define PEI_EXMAPPING_TABLE_SIZE 1
|
||||
#define PEI_GUID_TABLE_SIZE 1
|
||||
#define PEI_LOCAL_TOKEN_NUMBER 1
|
||||
#define PEI_EXTOKEN_NUMBER 1
|
||||
#define PEI_STRING_TABLE_SIZE 2
|
||||
#define PEI_SKUID_TABLE_SIZE 3
|
||||
#define PEI_SIZE_TABLE_SIZE 1
|
||||
|
||||
#define PEI_DATABASE_EMPTRY FALSE
|
||||
#define PEI_DYNAMICEX_MAPPING_EMPTY FALSE
|
||||
#define PEI_GUID_TABLE_EMPTY FALSE
|
||||
#define PEI_STRINGTABLE_EMPTY FALSE
|
||||
#define PEI_SIZETABLE_EMPTY FALSE
|
||||
#define PEI_SKUID_TABLE_EMPTY FALSE
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
DYNAMICEX_MAPPING ExMapTable[PEI_EXMAPPING_TABLE_SIZE];
|
||||
EFI_GUID GuidTable[PEI_GUID_TABLE_SIZE];
|
||||
|
||||
UINT32 LocalTokenNumberTable[PEI_LOCAL_TOKEN_NUMBER];
|
||||
|
||||
|
||||
UINT16 StringTable[PEI_STRING_TABLE_SIZE];
|
||||
UINT16 SizeTable[PEI_LOCAL_TOKEN_NUMBER];
|
||||
|
||||
SKU_ID SkuIdTable[PEI_SKUID_TABLE_SIZE];
|
||||
|
||||
SKU_ID SystemSkuId;
|
||||
|
||||
} PEI_PCD_DATABASE_INIT;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Dummy;
|
||||
} PEI_PCD_DATABASE_UNINIT;
|
||||
|
||||
//
|
||||
// Following code should be generated for PCD DXE driver
|
||||
//
|
||||
|
||||
#define DXE_EXMAPPING_TABLE_SIZE 1
|
||||
#define DXE_GUID_TABLE_SIZE 1
|
||||
#define DXE_TOKEN_NUMBER 1
|
||||
#define DXE_EXTOKEN_NUMBER 1
|
||||
#define DXE_STRING_TABLE_SIZE 2
|
||||
#define DXE_SKUID_TABLE_SIZE 3
|
||||
#define DXE_SIZE_TABLE_SIZE 1
|
||||
|
||||
#define DXE_DATABASE_EMPTRY FALSE
|
||||
#define DXE_DYNAMICEX_MAPPING_EMPTY FALSE
|
||||
#define DXE_GUID_TABLE_EMPTY FALSE
|
||||
#define DXE_STRINGTABLE_EMPTY FALSE
|
||||
#define DXE_SIZETABLE_EMPTY FALSE
|
||||
#define DXE_SKUID_TABLE_EMPTY FALSE
|
||||
|
||||
typedef struct {
|
||||
DYNAMICEX_MAPPING ExMapTable[DXE_EXMAPPING_TABLE_SIZE];
|
||||
EFI_GUID GuidTable[DXE_GUID_TABLE_SIZE];
|
||||
|
||||
UINT32 LocalTokenNumberTable[DXE_TOKEN_NUMBER];
|
||||
|
||||
|
||||
UINT16 StringTable[DXE_STRING_TABLE_SIZE];
|
||||
UINT16 SizeTable[DXE_TOKEN_NUMBER];
|
||||
|
||||
SKU_ID SkuIdTable[DXE_SKUID_TABLE_SIZE];
|
||||
|
||||
} DXE_PCD_DATABASE_INIT;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Dummy;
|
||||
} DXE_PCD_DATABASE_UNINIT;
|
||||
|
||||
|
||||
#define DXE_PCD_DB_INIT_VALUE \
|
||||
/* ExMapTable */ \
|
||||
{ \
|
||||
{ /* ExTokenNumber */ 0x00000001, /* LocalTokenNumberIndex */ 0, /* ExGuidIndex */ 0} \
|
||||
}, \
|
||||
\
|
||||
/* GuidTable */ \
|
||||
{ \
|
||||
{ 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD }} \
|
||||
}, \
|
||||
\
|
||||
/* LocalTokenNumberTable */ \
|
||||
{ \
|
||||
0 \
|
||||
}, \
|
||||
\
|
||||
/* StringTable */ \
|
||||
{ \
|
||||
L"\0" \
|
||||
}, \
|
||||
\
|
||||
/* SizeTable */ \
|
||||
{ \
|
||||
4 \
|
||||
}, \
|
||||
\
|
||||
/* SkuIdTable */ \
|
||||
{ \
|
||||
/*MaxSku*/ 2, /*SkuId*/ 100, /*SkuId*/200 \
|
||||
},\
|
||||
\
|
||||
|
||||
//
|
||||
// End of Autogen Code
|
||||
// PCD_DXE_DATABASE_GENTOOL_VERSION is defined in Autogen.h
|
||||
// and generated by PCD Database generation tool.
|
||||
//
|
||||
#if (PCD_DXE_SERVICE_PEIM_VERSION != PCD_DXE_DATABASE_GENTOOL_VERSION)
|
||||
#error "Please make sure the version of PCD Service DXE Driver and PCD DXE Database Generation Tool matches"
|
||||
#endif
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
PEI_PCD_DATABASE_INIT Init;
|
||||
PEI_PCD_DATABASE_UNINIT Uninit;
|
||||
} PEI_PCD_DATABASE;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
DXE_PCD_DATABASE_INIT Init;
|
||||
DXE_PCD_DATABASE_UNINIT Uninit;
|
||||
} DXE_PCD_DATABASE;
|
||||
|
||||
|
||||
typedef struct {
|
||||
PEI_PCD_DATABASE PeiDb;
|
||||
DXE_PCD_DATABASE DxeDb;
|
||||
} PCD_DATABASE;
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// Internal Functions
|
||||
//
|
||||
|
|
|
@ -18,6 +18,20 @@ Module Name: Service.h
|
|||
#ifndef _SERVICE_H
|
||||
#define _SERVICE_H
|
||||
|
||||
//
|
||||
// Please make sure the PCD Serivce PEIM Version is consistent with
|
||||
// the version of PCD Database generation tool
|
||||
//
|
||||
#define PCD_PEI_SERVICE_DRIVER_VERSION 1
|
||||
|
||||
//
|
||||
// PCD_PEI_DATABASE_GENTOOL_VERSION is defined in Autogen.h
|
||||
// and generated by PCD Database generation tool.
|
||||
//
|
||||
#if (PCD_PEI_SERVICE_PEIM_VERSION != PCD_PEI_DATABASE_GENTOOL_VERSION)
|
||||
#error "Please make sure the version of PCD Service PEIM and PCD PEI Database Generation Tool matches"
|
||||
#endif
|
||||
|
||||
/* Internal Function definitions */
|
||||
|
||||
PEI_PCD_DATABASE *
|
||||
|
|
|
@ -675,6 +675,15 @@ class PcdDatabase {
|
|||
private String phase;
|
||||
private int assignedTokenNumber;
|
||||
|
||||
//
|
||||
// After Major changes done to the PCD
|
||||
// database generation class PcdDatabase
|
||||
// Please increment the version and please
|
||||
// also update the version number in PCD
|
||||
// service PEIM and DXE driver accordingly.
|
||||
//
|
||||
private final int version = 1;
|
||||
|
||||
private String hString;
|
||||
private String cString;
|
||||
|
||||
|
@ -754,10 +763,8 @@ class PcdDatabase {
|
|||
public void genCode () {
|
||||
|
||||
final String newLine = "\r\n";
|
||||
final String instNewLine = "\\\r\n";
|
||||
final String declNewLine = ";\r\n";
|
||||
final String tab = "\t";
|
||||
final String commaInstNewLine = "\t,\\\r\n";
|
||||
final String commaNewLine = ", \r\n";
|
||||
|
||||
int i;
|
||||
|
@ -790,7 +797,8 @@ class PcdDatabase {
|
|||
// Generate Structure Declaration for PcdTokens without Default Value
|
||||
// PEI_PCD_DATABASE_UNINIT
|
||||
//
|
||||
java.util.Collections.sort(uninitTokens, comparator);
|
||||
list = uninitTokens;
|
||||
java.util.Collections.sort(list, comparator);
|
||||
uninitCode = processTokens(uninitTokens);
|
||||
|
||||
//
|
||||
|
@ -851,12 +859,6 @@ class PcdDatabase {
|
|||
initInstStr += tab + genInstantiationStr(exMapTable.getInstantiation()) + commaNewLine;
|
||||
initInstStr += tab + genInstantiationStr(guidTable.getInstantiation()) + commaNewLine;
|
||||
initInstStr += tab + genInstantiationStr(localTokenNumberTable.getInstantiation()) + commaNewLine;
|
||||
/*
|
||||
inst = stringTable.getInstantiation();
|
||||
for (i = 0; i < inst.size(); i++ ) {
|
||||
initInstStr += tab + inst.get(i) + commaNewLine;
|
||||
}
|
||||
*/
|
||||
initInstStr += tab + genInstantiationStr(stringTable.getInstantiation()) + commaNewLine;
|
||||
initInstStr += tab + genInstantiationStr(sizeTable.getInstantiation()) + commaNewLine;
|
||||
initInstStr += tab + genInstantiationStr(skuIdTable.getInstantiation()) + commaNewLine;
|
||||
|
@ -908,6 +910,8 @@ class PcdDatabase {
|
|||
+ uninitDeclStr + newLine
|
||||
+ newLine;
|
||||
|
||||
hString += String.format("#define PCD_%s_SERVICE_DRIVER_VERSION %d", phase, version);
|
||||
|
||||
}
|
||||
|
||||
private String genInstantiationStr (ArrayList<String> alStr) {
|
||||
|
@ -924,7 +928,6 @@ class PcdDatabase {
|
|||
|
||||
private HashMap<String, ArrayList<String>> processTokens (List<Token> alToken) {
|
||||
|
||||
ArrayList[] output = new ArrayList[4];
|
||||
HashMap <String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
ArrayList<String> decl = new ArrayList<String>();
|
||||
|
@ -1039,8 +1042,6 @@ class PcdDatabase {
|
|||
|
||||
private String getDataTypeInstantiation (Token token) {
|
||||
|
||||
String typeStr = "";
|
||||
|
||||
if (token.datumType == Token.DATUM_TYPE.POINTER) {
|
||||
return String.format("%s /* %s */", token.datum.toString(), token.getPrimaryKeyString());
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue