]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/GenSec/GenSec.c
Sync basetools' source and binary files with r1707 of the basetools project.
[mirror_edk2.git] / BaseTools / Source / C / GenSec / GenSec.c
index 952034ad5f3e465e75a224c7104b69ac7b42abed..32b8cfd5a0c5ad40cba785abf648a8828180025b 100644 (file)
@@ -160,7 +160,8 @@ Returns:
                         EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION,\n\\r
                         EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW,\n\\r
                         EFI_SECTION_FREEFORM_SUBTYPE_GUID,\n\\r
-                        EFI_SECTION_PEI_DEPEX. if -s option is not given, \n\\r
+                        EFI_SECTION_PEI_DEPEX, EFI_SECTION_SMM_DEPEX.\n\\r
+                        if -s option is not given, \n\\r
                         EFI_SECTION_ALL is default section type.\n");\r
   fprintf (stdout, "  -c [Type], --compress [Type]\n\\r
                         Compress method type can be PI_NONE or PI_STD.\n\\r
@@ -282,16 +283,16 @@ Returns:
   fseek (InFile, 0, SEEK_END);\r
   InputFileLength = ftell (InFile);\r
   fseek (InFile, 0, SEEK_SET);\r
-  DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %d bytes", InputFileName[0], InputFileLength);\r
+  DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %u bytes", InputFileName[0], (unsigned) InputFileLength);\r
   TotalLength     = sizeof (EFI_COMMON_SECTION_HEADER) + InputFileLength;\r
   //\r
   // Size must fit in 3 bytes\r
   //\r
   if (TotalLength >= MAX_SECTION_SIZE) {\r
-    Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%dM).", InputFileName[0], TotalLength, MAX_SECTION_SIZE>>20);\r
+    Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%uM).", InputFileName[0], (unsigned) TotalLength, MAX_SECTION_SIZE>>20);\r
     goto Done;\r
   }\r
-  VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
+  VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);\r
   //\r
   // Fill in the fields in the local section header structure\r
   //\r
@@ -404,7 +405,7 @@ Returns:
     fseek (InFile, 0, SEEK_END);\r
     FileSize = ftell (InFile);\r
     fseek (InFile, 0, SEEK_SET);\r
-    DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %d bytes", InputFileName[Index], FileSize); \r
+    DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize); \r
     //\r
     // Now read the contents of the file into the buffer\r
     // Buffer must be enough to contain the file content.\r
@@ -561,10 +562,10 @@ Returns:
   }\r
 \r
   DebugMsg (NULL, 0, 9, "comprss file size", \r
-            "the original section size is %d bytes and the compressed section size is %d bytes", InputLength, CompressedLength);\r
+            "the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);\r
   TotalLength = CompressedLength + sizeof (EFI_COMPRESSION_SECTION);\r
   if (TotalLength >= MAX_SECTION_SIZE) {\r
-    Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);\r
+    Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);\r
     if (FileBuffer != NULL) {\r
       free (FileBuffer);\r
     }\r
@@ -573,7 +574,7 @@ Returns:
     }\r
     return STATUS_ERROR;\r
   }\r
-  VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
+  VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);\r
 \r
   //\r
   // Add the section header for the compressed data\r
@@ -708,7 +709,7 @@ Returns:
 \r
     TotalLength = InputLength + sizeof (CRC32_SECTION_HEADER);\r
     if (TotalLength >= MAX_SECTION_SIZE) {\r
-      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);\r
+      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);\r
       free (FileBuffer);\r
       return STATUS_ERROR;\r
     }\r
@@ -722,12 +723,12 @@ Returns:
     Crc32GuidSect->GuidSectionHeader.Attributes  = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;\r
     Crc32GuidSect->GuidSectionHeader.DataOffset  = sizeof (CRC32_SECTION_HEADER);\r
     Crc32GuidSect->CRC32Checksum                 = Crc32Checksum;\r
-    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", Crc32GuidSect->GuidSectionHeader.DataOffset);\r
+    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", Crc32GuidSect->GuidSectionHeader.DataOffset);\r
 \r
   } else {\r
     TotalLength = InputLength + sizeof (EFI_GUID_DEFINED_SECTION);\r
     if (TotalLength >= MAX_SECTION_SIZE) {\r
-      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);\r
+      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);\r
       free (FileBuffer);\r
       return STATUS_ERROR;\r
     }\r
@@ -739,10 +740,10 @@ Returns:
     VendorGuidSect->CommonHeader.Size[2]  = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
     memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));\r
     VendorGuidSect->Attributes  = DataAttribute;\r
-    VendorGuidSect->DataOffset  = sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize;\r
-    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", VendorGuidSect->DataOffset);\r
+    VendorGuidSect->DataOffset  = (UINT16) (sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize);\r
+    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", VendorGuidSect->DataOffset);\r
   }\r
-  VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
+  VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);\r
   \r
   //\r
   // Set OutFileBuffer \r
@@ -785,7 +786,7 @@ Returns:
   CHAR8                     *CompressionName;\r
   CHAR8                     *StringBuffer;\r
   EFI_GUID                  VendorGuid = mZeroGuid;\r
-  INT32                     VersionNumber;\r
+  int                       VersionNumber;\r
   UINT8                     SectType;\r
   UINT8                     SectCompSubType;\r
   UINT16                    SectGuidAttribute; \r
@@ -972,7 +973,7 @@ Returns:
         goto Finish;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", (int) LogLevel);\r
         goto Finish;\r
       }\r
       SetPrintLevel (LogLevel);\r
@@ -1059,7 +1060,7 @@ Returns:
       SectGuidAttribute = 0;\r
     }\r
     VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
-                VendorGuid.Data1,\r
+                (unsigned) VendorGuid.Data1,\r
                 VendorGuid.Data2,\r
                 VendorGuid.Data3,\r
                 VendorGuid.Data4[0],\r
@@ -1077,7 +1078,7 @@ Returns:
       VerboseMsg ("Guid Attribute is %s", mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]);\r
     }\r
     if (SectGuidHeaderLength != 0) {\r
-      VerboseMsg ("Guid Data Header size is 0x%x", SectGuidHeaderLength);\r
+      VerboseMsg ("Guid Data Header size is 0x%llx", (unsigned long long) SectGuidHeaderLength);\r
     }\r
   } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PE32]) == 0) {\r
     SectType = EFI_SECTION_PE32;\r
@@ -1087,6 +1088,8 @@ Returns:
     SectType = EFI_SECTION_TE;\r
   } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_DXE_DEPEX]) == 0) {\r
     SectType = EFI_SECTION_DXE_DEPEX;\r
+  } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_SMM_DEPEX]) == 0) {\r
+    SectType = EFI_SECTION_SMM_DEPEX;\r
   } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_VERSION]) == 0) {\r
     SectType = EFI_SECTION_VERSION;\r
     if (VersionNumber < 0 || VersionNumber > 9999) {\r
@@ -1139,7 +1142,7 @@ Returns:
   // Check whether there is output file\r
   //\r
   for (Index = 0; Index < InputFileNum; Index ++) {\r
-    VerboseMsg ("the %dth input file name is %s", Index, InputFileName[Index]);\r
+    VerboseMsg ("the %uth input file name is %s", (unsigned) Index, InputFileName[Index]);\r
   }\r
   if (OutputFileName == NULL) {\r
     Error (NULL, 0, 1001, "Missing options", "Output file");\r
@@ -1199,7 +1202,7 @@ Returns:
     VersionSect->CommonHeader.Size[2]  = (UINT8) ((Index & 0xff0000) >> 16);\r
     VersionSect->BuildNumber           = (UINT16) VersionNumber;\r
     Ascii2UnicodeString (StringBuffer, VersionSect->VersionString);\r
-    VerboseMsg ("the size of the created section file is %d bytes", Index);\r
+    VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);\r
     break;\r
 \r
   case EFI_SECTION_USER_INTERFACE:\r
@@ -1219,7 +1222,7 @@ Returns:
     UiSect->CommonHeader.Size[1]  = (UINT8) ((Index & 0xff00) >> 8);\r
     UiSect->CommonHeader.Size[2]  = (UINT8) ((Index & 0xff0000) >> 16);\r
     Ascii2UnicodeString (StringBuffer, UiSect->FileNameString);\r
-    VerboseMsg ("the size of the created section file is %d bytes", Index);\r
+    VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);\r
    break;\r
 \r
   case EFI_SECTION_ALL:\r
@@ -1250,7 +1253,7 @@ Returns:
                 &InputLength\r
                 );\r
     }\r
-    VerboseMsg ("the size of the created section file is %d bytes", InputLength);\r
+    VerboseMsg ("the size of the created section file is %u bytes", (unsigned) InputLength);\r
     break;\r
   default:\r
     //\r
@@ -1266,7 +1269,7 @@ Returns:
   }\r
   \r
   if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {\r
-    Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (UINTN) Status);\r
+    Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);\r
          goto Finish;\r
   }\r
 \r