]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Sec/SecMain.c
sync comments, fix function header, rename variable name to follow coding style.
[mirror_edk2.git] / Nt32Pkg / Sec / SecMain.c
index ccfc6bb3f8e0c679ca68ea8edeff434d1f74c9f1..56753fd421da583b5975f7fefac0ad80cd8004c5 100644 (file)
@@ -1,4 +1,4 @@
-/*++\r
+/**@file\r
 \r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -26,7 +26,7 @@ Abstract:
   This code produces 128 K of temporary memory for the PEI stack by directly\r
   allocate memory space with ReadWrite and Execute attribute.\r
 \r
---*/\r
+**/\r
 \r
 #include "SecMain.h"\r
 \r
@@ -158,7 +158,6 @@ Returns:
   UINTN                 Index;\r
   UINTN                 Index1;\r
   UINTN                 Index2;\r
-  UINTN                 PeiIndex;\r
   CHAR16                *FileName;\r
   CHAR16                *FileNamePtr;\r
   BOOLEAN               Done;\r
@@ -185,7 +184,7 @@ Returns:
   gSystemMemoryCount  = CountSeperatorsInString (MemorySizeStr, '!') + 1;\r
   gSystemMemory       = calloc (gSystemMemoryCount, sizeof (NT_SYSTEM_MEMORY));\r
   if (gSystemMemory == NULL) {\r
-    printf ("ERROR : Can not allocate memory for %s.  Exiting.\n", MemorySizeStr);\r
+    wprintf (L"ERROR : Can not allocate memory for %s.  Exiting.\n", MemorySizeStr);\r
     exit (1);\r
   }\r
   //\r
@@ -194,7 +193,7 @@ Returns:
   gFdInfoCount  = CountSeperatorsInString (FirmwareVolumesStr, '!') + 1;\r
   gFdInfo       = calloc (gFdInfoCount, sizeof (NT_FD_INFO));\r
   if (gFdInfo == NULL) {\r
-    printf ("ERROR : Can not allocate memory for %s.  Exiting.\n", FirmwareVolumesStr);\r
+    wprintf (L"ERROR : Can not allocate memory for %s.  Exiting.\n", FirmwareVolumesStr);\r
     exit (1);\r
   }\r
   //\r
@@ -220,7 +219,7 @@ Returns:
     *StackPointer = 0x5AA55AA5;\r
   }\r
   \r
-  printf ("  SEC passing in %d bytes of temp RAM to PEI\n", InitialStackMemorySize);\r
+  wprintf (L"  SEC passing in %d bytes of temp RAM to PEI\n", InitialStackMemorySize);\r
 \r
   //\r
   // Open All the firmware volumes and remember the info in the gFdInfo global\r
@@ -233,7 +232,7 @@ Returns:
 \r
   StrCpy (FileNamePtr, (CHAR16*)FirmwareVolumesStr);\r
 \r
-  for (Done = FALSE, Index = 0, PeiIndex = 0, PeiCoreFile = NULL; !Done; Index++) {\r
+  for (Done = FALSE, Index = 0, PeiCoreFile = NULL; !Done; Index++) {\r
     FileName = FileNamePtr;\r
     for (Index1 = 0; (FileNamePtr[Index1] != '!') && (FileNamePtr[Index1] != 0); Index1++)\r
       ;\r
@@ -255,7 +254,7 @@ Returns:
               &gFdInfo[Index].Size\r
               );\r
     if (EFI_ERROR (Status)) {\r
-      printf ("ERROR : Can not open Firmware Device File %S (%r).  Exiting.\n", FileName, Status);\r
+      printf ("ERROR : Can not open Firmware Device File %S (0x%X).  Exiting.\n", FileName, Status);\r
       exit (1);\r
     }\r
 \r
@@ -275,7 +274,6 @@ Returns:
       //\r
       Status = SecFfsFindPeiCore ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) gFdInfo[Index].Address, &PeiCoreFile);\r
       if (!EFI_ERROR (Status)) {\r
-        PeiIndex = Index;\r
         printf (" contains SEC Core");\r
       }\r
     }\r
@@ -476,7 +474,7 @@ Returns:
     //\r
     // Processes ASSERT ()\r
     //\r
-    printf ("ASSERT %s(%d): %s\n", Filename, LineNumber, Description);\r
+    printf ("ASSERT %s(%d): %s\n", Filename, (int)LineNumber, Description);\r
 \r
   } else if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
     //\r
@@ -571,7 +569,6 @@ Returns:
 --*/\r
 {\r
   EFI_STATUS                  Status;\r
-  EFI_PHYSICAL_ADDRESS        TopOfMemory;\r
   VOID                        *TopOfStack;\r
   UINT64                      PeiCoreSize;\r
   EFI_PHYSICAL_ADDRESS        PeiCoreEntryPoint;\r
@@ -582,7 +579,6 @@ Returns:
   //\r
   // Compute Top Of Memory for Stack and PEI Core Allocations\r
   //\r
-  TopOfMemory  = LargestRegion + LargestRegionSize;\r
   PeiStackSize = (UINTN)RShiftU64((UINT64)STACK_SIZE,1);\r
 \r
   //\r
@@ -595,7 +591,6 @@ Returns:
   // |-----------| <---- TemporaryRamBase\r
   // \r
   TopOfStack  = (VOID *)(LargestRegion + PeiStackSize);\r
-  TopOfMemory = LargestRegion + PeiStackSize;\r
 \r
   //\r
   // Reservet space for storing PeiCore's parament in stack.\r
@@ -617,9 +612,9 @@ Returns:
   SecCoreData->BootFirmwareVolumeSize = FixedPcdGet32(PcdWinNtFirmwareFdSize);\r
   SecCoreData->TemporaryRamBase       = (VOID*)(UINTN)LargestRegion; \r
   SecCoreData->TemporaryRamSize       = STACK_SIZE;\r
-  SecCoreData->StackBase              = (VOID*) ((UINTN) SecCoreData->TemporaryRamBase + PeiStackSize);\r
+  SecCoreData->StackBase              = SecCoreData->TemporaryRamBase;\r
   SecCoreData->StackSize              = PeiStackSize;\r
-  SecCoreData->PeiTemporaryRamBase    = SecCoreData->StackBase;\r
+  SecCoreData->PeiTemporaryRamBase    = (VOID*) ((UINTN) SecCoreData->TemporaryRamBase + PeiStackSize);\r
   SecCoreData->PeiTemporaryRamSize    = STACK_SIZE - PeiStackSize;\r
 \r
   //\r
@@ -918,7 +913,7 @@ Returns:
 \r
 UINTN\r
 CountSeperatorsInString (\r
-  IN  const CHAR16   *String,\r
+  IN  CONST CHAR16   *String,\r
   IN  CHAR16         Seperator\r
   )\r
 /*++\r