"Module type = 'PEI_CORE', can have only one module entry point!");\r
} else {\r
fileBuffer.append("EFI_STATUS\r\n");\r
- //fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[0]);\r
fileBuffer.append(" (\r\n");\r
fileBuffer\r
} else {\r
\r
fileBuffer.append("VOID\r\n");\r
- //fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[0]);\r
fileBuffer.append(" (\n");\r
fileBuffer.append(" IN VOID *HobStart\r\n");\r
}\r
for (int i = 0; i < entryPointList.length; i++) {\r
fileBuffer.append("EFI_STATUS\r\n");\r
- //fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[i]);\r
fileBuffer.append(" (\r\n");\r
fileBuffer\r
} else {\r
for (int i = 0; i < entryPointList.length; i++) {\r
fileBuffer.append("EFI_STATUS\r\n");\r
- //fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[i]);\r
fileBuffer.append(" (\r\n");\r
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
if (unloadImageList != null) {\r
for (int i = 0; i < unloadImageList.length; i++) {\r
fileBuffer.append("EFI_STATUS\r\n");\r
- //fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(unloadImageList[i]);\r
fileBuffer.append(" (\r\n");\r
fileBuffer\r
for (int i = 0; i < entryPointList.length; i++) {\r
\r
fileBuffer.append("EFI_STATUS\r\n");\r
- //fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[i]);\r
fileBuffer.append(" (\r\n");\r
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
//\r
// Add ModuleUnloadImage for DxeDriver and UefiDriver module type.\r
//\r
- \r
+ //entryPointList = SurfaceAreaQuery.getModuleUnloadImageArray();\r
+ //\r
+ // Remover duplicate unload entry point.\r
+ //\r
+ //entryPointList = CommonDefinition.remDupString(entryPointList);\r
+ //entryPointCount = 0;\r
unloadImageCount = 0;\r
if (unloadImageList != null) {\r
for (int i = 0; i < unloadImageList.length; i++) {\r
fileBuffer.append("EFI_STATUS\r\n");\r
- //fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(unloadImageList[i]);\r
fileBuffer.append(" (\r\n");\r
fileBuffer\r
throws EdkException {\r
\r
//\r
- // Check what <extern> contains. And the number of following elements\r
- // under <extern> should be same. 1. DRIVER_BINDING 2. COMPONENT_NAME\r
- // 3.DRIVER_CONFIGURATION 4. DRIVER_DIAGNOSTIC\r
- //\r
-\r
- String[] drvBindList = saq.getDriverBindingArray();\r
+ // Get the arry of extern. The driverBindingGroup is a 2 dimension array.\r
+ // The second dimension is include following element: DriverBinding, \r
+ // ComponentName, DriverConfiguration, DriverDiag;\r
+ // \r
+ String[][] driverBindingGroup = this.saq.getExternProtocolGroup();\r
\r
//\r
- // If component name protocol,component configuration protocol,\r
- // component diagnostic protocol is not null or empty, check\r
- // if every one have the same number of the driver binding protocol.\r
- //\r
- if (drvBindList == null || drvBindList.length == 0) {\r
- return;\r
- }\r
-\r
- String[] compNamList = saq.getComponentNameArray();\r
- String[] compConfList = saq.getDriverConfigArray();\r
- String[] compDiagList = saq.getDriverDiagArray();\r
-\r
+ // inital BitMask;\r
+ // \r
int BitMask = 0;\r
\r
//\r
// Write driver binding protocol extern to autogen.c\r
//\r
- for (int i = 0; i < drvBindList.length; i++) {\r
- fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");\r
- fileBuffer.append(drvBindList[i]);\r
- fileBuffer.append(";\r\n");\r
+ for (int i = 0; i < driverBindingGroup.length; i++) {\r
+ if (driverBindingGroup[i][0] != null) {\r
+ fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");\r
+ fileBuffer.append(driverBindingGroup[i][0]);\r
+ fileBuffer.append(";\r\n");\r
+ } \r
}\r
\r
//\r
// Write component name protocol extern to autogen.c\r
//\r
- if (compNamList != null && compNamList.length != 0) {\r
- if (drvBindList.length != compNamList.length) {\r
- throw new AutoGenException(\r
- "Different number of Driver Binding and Component Name protocols!");\r
- }\r
-\r
- BitMask |= 0x01;\r
- for (int i = 0; i < compNamList.length; i++) {\r
- fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");\r
- fileBuffer.append(compNamList[i]);\r
- fileBuffer.append(";\r\n");\r
- }\r
- }\r
+ for (int i = 0; i < driverBindingGroup.length; i++) {\r
+ if (driverBindingGroup[i][1]!= null) {\r
+ if (driverBindingGroup[i][0] != null) {\r
+ BitMask |= 0x01;\r
+ fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");\r
+ fileBuffer.append(driverBindingGroup[i][1]);\r
+ fileBuffer.append(";\r\n");\r
+ } else {\r
+ throw new AutoGenException("DriverBinding can't be empty!!");\r
+ }\r
+ }\r
+ }\r
\r
//\r
// Write driver configration protocol extern to autogen.c\r
//\r
- if (compConfList != null && compConfList.length != 0) {\r
- if (drvBindList.length != compConfList.length) {\r
- throw new AutoGenException(\r
- "Different number of Driver Binding and Driver Configuration protocols!");\r
- }\r
-\r
- BitMask |= 0x02;\r
- for (int i = 0; i < compConfList.length; i++) {\r
- fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");\r
- fileBuffer.append(compConfList[i]);\r
- fileBuffer.append(";\r\n");\r
- }\r
- }\r
-\r
+ for (int i = 0; i < driverBindingGroup.length; i++) {\r
+ if (driverBindingGroup[i][2] != null) {\r
+ if (driverBindingGroup[i][0] != null) {\r
+ BitMask |= 0x02;\r
+ fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");\r
+ fileBuffer.append(driverBindingGroup[i][2]);\r
+ fileBuffer.append(";\r\n");\r
+ } else {\r
+ throw new AutoGenException("DriverBinding can't be empty!!");\r
+ }\r
+ }\r
+ }\r
+ \r
//\r
// Write driver dignastic protocol extern to autogen.c\r
//\r
- if (compDiagList != null && compDiagList.length != 0) {\r
- if (drvBindList.length != compDiagList.length) {\r
- throw new AutoGenException(\r
- "Different number of Driver Binding and Driver Diagnosis protocols!");\r
- }\r
-\r
- BitMask |= 0x04;\r
- for (int i = 0; i < compDiagList.length; i++) {\r
- fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");\r
- fileBuffer.append(compDiagList[i]);\r
- fileBuffer.append(";\r\n");\r
- }\r
- }\r
-\r
+ for (int i = 0; i < driverBindingGroup.length; i++) {\r
+ if (driverBindingGroup[i][3] != null) {\r
+ if (driverBindingGroup[i][0] != null) {\r
+ BitMask |= 0x04;\r
+ fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");\r
+ fileBuffer.append(driverBindingGroup[i][3]);\r
+ fileBuffer.append(";\r\n");\r
+ } else {\r
+ throw new AutoGenException("DriverBinding can't be empty!!");\r
+ }\r
+ }\r
+ }\r
+ \r
//\r
// Write driver module protocol bitmask.\r
//\r
fileBuffer\r
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");\r
\r
- fileBuffer.append(Integer.toString(drvBindList.length));\r
+ fileBuffer.append(Integer.toString(driverBindingGroup.length));\r
fileBuffer.append(";\r\n");\r
\r
//\r
// Write drive module protocol list to autogen.c\r
//\r
- fileBuffer\r
+ if (driverBindingGroup.length > 0) {\r
+ fileBuffer\r
.append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {");\r
- for (int i = 0; i < drvBindList.length; i++) {\r
+ }\r
+ \r
+ \r
+ for (int i = 0; i < driverBindingGroup.length; i++) {\r
if (i != 0) {\r
fileBuffer.append(",");\r
}\r
- fileBuffer.append("\r\n {\r\n");\r
+ \r
+ fileBuffer.append("\r\n {\r\n");\r
fileBuffer.append(" &");\r
- fileBuffer.append(drvBindList[i]);\r
+ fileBuffer.append(driverBindingGroup[i][0]);\r
fileBuffer.append(", \r\n");\r
+ \r
\r
- if (compNamList != null) {\r
+ if (driverBindingGroup[i][1] != null) {\r
fileBuffer.append(" &");\r
- fileBuffer.append(compNamList[i]);\r
+ fileBuffer.append(driverBindingGroup[i][1]);\r
fileBuffer.append(", \r\n");\r
} else {\r
fileBuffer.append(" NULL, \r\n");\r
}\r
\r
- if (compConfList != null) {\r
+ if (driverBindingGroup[i][2] != null) {\r
fileBuffer.append(" &");\r
- fileBuffer.append(compConfList[i]);\r
+ fileBuffer.append(driverBindingGroup[i][2]);\r
fileBuffer.append(", \r\n");\r
} else {\r
fileBuffer.append(" NULL, \r\n");\r
}\r
\r
- if (compDiagList != null) {\r
+ if (driverBindingGroup[i][3] != null) {\r
fileBuffer.append(" &");\r
- fileBuffer.append(compDiagList[i]);\r
+ fileBuffer.append(driverBindingGroup[i][3]);\r
fileBuffer.append(", \r\n");\r
} else {\r
fileBuffer.append(" NULL, \r\n");\r
}\r
fileBuffer.append(" }");\r
}\r
- fileBuffer.append("\r\n};\r\n");\r
+\r
+ if (driverBindingGroup.length > 0) {\r
+ fileBuffer.append("\r\n};\r\n");\r
+ }\r
}\r
\r
/**\r