]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/DxeIpl/DxeInit.c
Change DUET DxeIpl to use SerialPort instead of manipulating serial port directly.
[mirror_edk2.git] / DuetPkg / DxeIpl / DxeInit.c
index b10e273f0ce968442374990e163cf3ffbaf5c8d0..223cbcd49e7010fa2f0ffcb0781e648b4f29ec07 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -137,55 +137,42 @@ Returns:
   VOID                  *MemoryTopOnDescriptor;\r
   VOID                  *MemoryDescriptor;\r
   VOID                  *NvStorageBase;\r
-  CHAR8                 PrintBuffer[256];\r
   EFILDRHANDOFF         HandoffCopy;\r
 \r
   CopyMem ((VOID*) &HandoffCopy, (VOID*) Handoff, sizeof (EFILDRHANDOFF));\r
   Handoff = &HandoffCopy;\r
 \r
   ClearScreen();\r
-  PrintString("Enter DxeIpl ...\n");\r
-  \r
-/*\r
-  ClearScreen();\r
-  PrintString("handoff:\n");\r
-  PrintString("Handoff.BfvBase = ");   \r
-  PrintValue64((UINT64)(UINTN)Handoff->BfvBase);\r
-  PrintString(", ");   \r
-  PrintString("BfvLength = ");   \r
-  PrintValue64(Handoff->BfvSize);\r
-  PrintString("\n");   \r
-  PrintString("Handoff.DxeIplImageBase = ");   \r
-  PrintValue64((UINT64)(UINTN)Handoff->DxeIplImageBase);\r
-  PrintString(", ");   \r
-  PrintString("DxeIplImageSize = ");   \r
-  PrintValue64(Handoff->DxeIplImageSize);\r
-  PrintString("\n");   \r
-  PrintString("Handoff.DxeCoreImageBase = ");   \r
-  PrintValue64((UINT64)(UINTN)Handoff->DxeCoreImageBase);\r
-  PrintString(", ");   \r
-  PrintString("DxeCoreImageSize = ");   \r
-  PrintValue64(Handoff->DxeCoreImageSize);\r
-  PrintString("\n");   \r
-*/\r
+\r
+  PrintString (\r
+    "Enter DxeIpl ...\n"\r
+    "Handoff:\n"\r
+    "Handoff.BfvBase = %p, BfvLength = %x\n"\r
+    "Handoff.DxeIplImageBase = %p, DxeIplImageSize = %x\n"\r
+    "Handoff.DxeCoreImageBase = %p, DxeCoreImageSize = %x\n",\r
+    Handoff->BfvBase, Handoff->BfvSize,\r
+    Handoff->DxeIplImageBase, Handoff->DxeIplImageSize,\r
+    Handoff->DxeCoreImageBase, Handoff->DxeCoreImageSize\r
+    );\r
+\r
   //\r
   // Hob Generation Guild line:\r
   //   * Don't report FV as physical memory\r
   //   * MemoryAllocation Hob should only cover physical memory\r
   //   * Use ResourceDescriptor Hob to report physical memory or Firmware Device and they shouldn't be overlapped\r
-  PrintString("Prepare Cpu HOB information ...\n");\r
+  PrintString ("Prepare Cpu HOB information ...\n");\r
   PrepareHobCpu ();\r
 \r
   //\r
   // 1. BFV\r
   //\r
-  PrintString("Prepare BFV HOB information ...\n");\r
+  PrintString ("Prepare BFV HOB information ...\n");\r
   PrepareHobBfv (Handoff->BfvBase, Handoff->BfvSize);\r
 \r
   //\r
   // 2. Updates Memory information, and get the top free address under 4GB\r
   //\r
-  PrintString("Prepare Memory HOB information ...\n");\r
+  PrintString ("Prepare Memory HOB information ...\n");\r
   MemoryTopOnDescriptor = PrepareHobMemory (Handoff->MemDescCount, Handoff->MemDesc);\r
   \r
   //\r
@@ -193,17 +180,13 @@ Returns:
   //\r
   \r
   //   3.1 NV data\r
-  PrintString("Prepare NV Storage information ...\n");\r
+  PrintString ("Prepare NV Storage information ...\n");\r
   NvStorageBase = PrepareHobNvStorage (MemoryTopOnDescriptor);\r
-  AsciiSPrint (PrintBuffer, 256, "NV Storage Base=0x%x\n", (UINTN)NvStorageBase);\r
-  PrintString (PrintBuffer);\r
-  \r
+  PrintString ("NV Storage Base = %p\n", NvStorageBase);\r
   //   3.2 Stack\r
   StackTop = NvStorageBase;\r
   StackBottom = PrepareHobStack (StackTop);\r
-  AsciiSPrint (PrintBuffer, 256, "Stack Top=0x%x, Stack Bottom=0x%x\n", \r
-              (UINTN)StackTop, (UINTN)StackBottom);\r
-  PrintString (PrintBuffer);\r
+  PrintString ("Stack Top=0x%x, Stack Bottom=0x%x\n", StackTop, StackBottom);\r
   //   3.3 Page Table\r
   PageTableBase = PreparePageTable (StackBottom, gHob->Cpu.SizeOfMemorySpace);\r
   //   3.4 MemDesc (will be used in PlatformBds)\r
@@ -214,7 +197,7 @@ Returns:
   //\r
   // 4. Register the memory occupied by DxeCore and DxeIpl together as DxeCore\r
   //\r
-  PrintString("Prepare DxeCore memory Hob ...\n");\r
+  PrintString ("Prepare DxeCore memory Hob ...\n");\r
   PrepareHobDxeCore (\r
     Handoff->DxeCoreEntryPoint,\r
     (EFI_PHYSICAL_ADDRESS)(UINTN)Handoff->DxeCoreImageBase,\r
@@ -227,125 +210,57 @@ Returns:
 \r
   CompleteHobGeneration ();\r
 \r
-  AsciiSPrint (PrintBuffer, 256, "HobStart=0x%x\n", (UINTN)gHob);\r
-  PrintString (PrintBuffer);\r
-\r
-  AsciiSPrint (PrintBuffer, 256, "Memory Top=0x%x, Bottom=0x%x\n", \r
-              (UINTN)gHob->Phit.EfiMemoryTop, (UINTN)gHob->Phit.EfiMemoryBottom);\r
-  PrintString (PrintBuffer);\r
-\r
-  AsciiSPrint (PrintBuffer, 256, "Free Memory Top=0x%x, Bottom=0x%x\n", \r
-              (UINTN)gHob->Phit.EfiFreeMemoryTop, (UINTN)gHob->Phit.EfiFreeMemoryBottom);\r
-  PrintString (PrintBuffer);\r
-\r
-  AsciiSPrint (PrintBuffer, 256, "Nv Base=0x%x, Length=0x%x\n", \r
-              (UINTN)gHob->NvStorageFvb.FvbInfo.Entries[0].Base, \r
-              (UINTN)gHob->NvFtwFvb.FvbInfo.Entries[0].Length);\r
-  PrintString (PrintBuffer);\r
-/*\r
   //\r
   // Print Hob Info\r
   //\r
   ClearScreen();\r
-  PrintString("Hob Info\n");\r
-  PrintString("Phit.EfiMemoryTop = ");   \r
-  PrintValue64(gHob->Phit.EfiMemoryTop);\r
-  PrintString(" Phit.EfiMemoryBottom = ");   \r
-  PrintValue64(gHob->Phit.EfiMemoryBottom);\r
-  PrintString("\n");   \r
-  PrintString("Phit.EfiFreeMemoryTop = ");   \r
-  PrintValue64(gHob->Phit.EfiFreeMemoryTop);\r
-  PrintString(" Phit.EfiFreeMemoryBottom = ");   \r
-  PrintValue64(gHob->Phit.EfiFreeMemoryBottom);\r
-  PrintString("\n");   \r
-  PrintString("Bfv = ");   \r
-  PrintValue64(gHob->Bfv.BaseAddress);\r
-  PrintString(" BfvLength = ");   \r
-  PrintValue64(gHob->Bfv.Length);\r
-  PrintString("\n");\r
-  PrintString("NvStorageFvb = ");\r
-  PrintValue64(gHob->NvStorageFvb.FvbInfo.Entries[0].Base);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->NvStorageFvb.FvbInfo.Entries[0].Length);\r
-  PrintString("\n");\r
-  PrintString("NvFtwFvb = ");\r
-  PrintValue64(gHob->NvFtwFvb.FvbInfo.Entries[0].Base);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->NvFtwFvb.FvbInfo.Entries[0].Length);\r
-  PrintString("\n");\r
-  PrintString("BfvResource = ");\r
-  PrintValue64(gHob->BfvResource.PhysicalStart);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->BfvResource.ResourceLength);\r
-  PrintString("\n");\r
-  PrintString("NvStorageFvResource = ");\r
-  PrintValue64(gHob->NvStorageFvResource.PhysicalStart);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->NvStorageFvResource.ResourceLength);\r
-  PrintString("\n");\r
-  PrintString("NvStorage = ");\r
-  PrintValue64(gHob->NvStorage.FvbInfo.Entries[0].Base);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->NvStorage.FvbInfo.Entries[0].Length);\r
-  PrintString("\n");\r
-  PrintString("NvFtwFvResource = ");\r
-  PrintValue64(gHob->NvFtwFvResource.PhysicalStart);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->NvFtwFvResource.ResourceLength);\r
-  PrintString("\n");\r
-  PrintString("NvFtwWorking = ");\r
-  PrintValue64(gHob->NvFtwWorking.FvbInfo.Entries[0].Base);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->NvFtwWorking.FvbInfo.Entries[0].Length);\r
-  PrintString("\n");\r
-  PrintString("NvFtwSpare = ");\r
-  PrintValue64(gHob->NvFtwSpare.FvbInfo.Entries[0].Base);\r
-  PrintString(" Length = ");\r
-  PrintValue64(gHob->NvFtwSpare.FvbInfo.Entries[0].Length);\r
-  PrintString("\n");\r
-  PrintString("Stack = ");   \r
-  PrintValue64(gHob->Stack.AllocDescriptor.MemoryBaseAddress);\r
-  PrintString(" StackLength = ");   \r
-  PrintValue64(gHob->Stack.AllocDescriptor.MemoryLength);\r
-  PrintString("\n");   \r
-  PrintString("PageTable = ");   \r
-  PrintValue64((UINTN)PageTableBase);\r
-  PrintString("\n");     \r
-  PrintString("MemoryFreeUnder1MB = ");   \r
-  PrintValue64(gHob->MemoryFreeUnder1MB.PhysicalStart);\r
-  PrintString(" MemoryFreeUnder1MBLength = ");   \r
-  PrintValue64(gHob->MemoryFreeUnder1MB.ResourceLength);\r
-  PrintString("\n");   \r
-  PrintString("MemoryAbove1MB = ");   \r
-  PrintValue64(gHob->MemoryAbove1MB.PhysicalStart);\r
-  PrintString(" MemoryAbove1MBLength = ");   \r
-  PrintValue64(gHob->MemoryAbove1MB.ResourceLength);\r
-  PrintString("\n");   \r
-  PrintString("MemoryAbove4GB = ");   \r
-  PrintValue64(gHob->MemoryAbove4GB.PhysicalStart);\r
-  PrintString(" MemoryAbove4GBLength = ");   \r
-  PrintValue64(gHob->MemoryAbove4GB.ResourceLength);\r
-  PrintString("\n");   \r
-  PrintString("DxeCore = ");   \r
-  PrintValue64(gHob->DxeCore.MemoryAllocationHeader.MemoryBaseAddress);\r
-  PrintString(" DxeCoreLength = ");   \r
-  PrintValue64(gHob->DxeCore.MemoryAllocationHeader.MemoryLength);\r
-  PrintString("\n");   \r
-  PrintString("MemoryAllocation = ");   \r
-  PrintValue64(gHob->MemoryAllocation.AllocDescriptor.MemoryBaseAddress);\r
-  PrintString(" MemoryLength = ");   \r
-  PrintValue64(gHob->MemoryAllocation.AllocDescriptor.MemoryLength);\r
-  PrintString("\n");   \r
-  EFI_DEADLOOP();\r
-*/\r
+  PrintString (\r
+    "HobStart = %p\n"\r
+    "Memory Top = %lx, Bottom = %lx\n"\r
+    "Free Memory Top = %lx, Bottom = %lx\n"\r
+    "NvStorageFvb = %p, Length = %x\n"\r
+    "BfvResource = %lx, Length = %lx\n"\r
+    "NvStorageFvResource = %lx, Length = %lx\n"\r
+    "NvStorage = %lx, Length = %lx\n"\r
+    "NvFtwFvResource = %lx, Length = %lx\n"\r
+    "NvFtwWorking = %lx, Length = %lx\n"\r
+    "NvFtwSpare = %lx, Length = %lx\n"\r
+    "Stack = %lx, StackLength = %lx\n"\r
+    "PageTable = %p\n"\r
+    "MemoryFreeUnder1MB = %lx, MemoryFreeUnder1MBLength = %lx\n"\r
+    "MemoryAbove1MB = %lx, MemoryAbove1MBLength = %lx\n"\r
+    "MemoryAbove4GB = %lx, MemoryAbove4GBLength = %lx\n"\r
+    "DxeCore = %lx, DxeCoreLength = %lx\n"\r
+    "MemoryAllocation = %lx, MemoryLength = %lx\n"\r
+    "$",\r
+    gHob,\r
+    gHob->Phit.EfiMemoryTop, gHob->Phit.EfiMemoryBottom,\r
+    gHob->Phit.EfiFreeMemoryTop, gHob->Phit.EfiFreeMemoryBottom,\r
+    gHob->NvStorageFvb.FvbInfo.Entries[0].Base, (UINTN) gHob->NvFtwFvb.FvbInfo.Entries[0].Length,\r
+    gHob->BfvResource.PhysicalStart, gHob->BfvResource.ResourceLength,\r
+    gHob->NvStorageFvResource.PhysicalStart, gHob->NvStorageFvResource.ResourceLength,\r
+    gHob->NvStorage.FvbInfo.Entries[0].Base, gHob->NvStorage.FvbInfo.Entries[0].Length,\r
+    gHob->NvFtwFvResource.PhysicalStart, gHob->NvFtwFvResource.ResourceLength,\r
+    gHob->NvFtwWorking.FvbInfo.Entries[0].Base, gHob->NvFtwWorking.FvbInfo.Entries[0].Length,\r
+    gHob->NvFtwSpare.FvbInfo.Entries[0].Base, gHob->NvFtwSpare.FvbInfo.Entries[0].Length,\r
+    gHob->Stack.AllocDescriptor.MemoryBaseAddress, gHob->Stack.AllocDescriptor.MemoryLength,\r
+    PageTableBase,\r
+    gHob->MemoryFreeUnder1MB.PhysicalStart, gHob->MemoryFreeUnder1MB.ResourceLength,\r
+    gHob->MemoryAbove1MB.PhysicalStart, gHob->MemoryAbove1MB.ResourceLength,\r
+    gHob->MemoryAbove4GB.PhysicalStart, gHob->MemoryAbove4GB.ResourceLength,\r
+    gHob->DxeCore.MemoryAllocationHeader.MemoryBaseAddress, gHob->DxeCore.MemoryAllocationHeader.MemoryLength,\r
+    gHob->MemoryAllocation.AllocDescriptor.MemoryBaseAddress, gHob->MemoryAllocation.AllocDescriptor.MemoryLength\r
+    );\r
 \r
   ClearScreen();\r
-  PrintString("\n\n\n\n\n\n\n\n\n\n");\r
-  PrintString("                         WELCOME TO EFI WORLD!\n");\r
+  PrintString (\r
+    "\n\n\n\n\n\n\n\n\n\n"\r
+    "                         WELCOME TO EFI WORLD!\n"\r
+    );\r
   \r
   EnterDxeMain (StackTop, Handoff->DxeCoreEntryPoint, gHob, PageTableBase);\r
+  PrintString ("Fail to enter DXE main!\n");\r
  \r
-  PrintString("Fail to enter DXE main!\n");\r
   //\r
   // Should never get here\r
   //\r