]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/DxeIpl/DxeInit.c
MdeModulePkg/PciSioSerial: Fix bad EOL
[mirror_edk2.git] / DuetPkg / DxeIpl / DxeInit.c
index 9cce964ae2beb6da33f05b82ddce1c08b2376ba6..b9a40a8209c1788a6460aa342ccd3e4a5337d49a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \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
 http://opensource.org/licenses/bsd-license.php                                            \r
@@ -78,14 +78,16 @@ MemoryAbove1MB.PhysicalStart <--------------------------------------------------
                         <------------------------------+           |               |\r
         Permament Stack (0x20 Pages = 128K)                        |               |\r
                         <- Phit.EfiMemoryTop ----------+-----------+---------------+\r
-        DxeCore                                                                    |\r
-                                                                                DxeCore\r
-        DxeIpl                                                                     |\r
-                        <----------------------------------------------------------+\r
-        NvFV + FtwFV                                                               |\r
+        NvFV (64K)                                                                 |\r
                                                                                  MMIO\r
-        BFV                                                                        |\r
-                        <- Top of Free Memory reported by E820 --------------------+\r
+        FtwFV (128K)                                                               |  \r
+                        <----------------------------------------------------------+<---------+\r
+        DxeCore                                                                    |          |\r
+                                                                                DxeCore       |\r
+        DxeIpl                                                                     |   Allocated in EfiLdr\r
+                        <----------------------------------------------------------+          |\r
+        BFV                                                                      MMIO         |\r
+                        <- Top of Free Memory reported by E820 --------------------+<---------+\r
         ACPINVS        or\r
         ACPIReclaim    or\r
         Reserved\r
@@ -135,56 +137,56 @@ Returns:
   VOID                  *MemoryTopOnDescriptor;\r
   VOID                  *MemoryDescriptor;\r
   VOID                  *NvStorageBase;\r
-  \r
-  PrintString("Enter DxeIpl ...\n");\r
-/*\r
+  EFILDRHANDOFF         HandoffCopy;\r
+\r
+  CopyMem ((VOID*) &HandoffCopy, (VOID*) Handoff, sizeof (EFILDRHANDOFF));\r
+  Handoff = &HandoffCopy;\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
-  \r
+  PrintString ("Prepare Cpu HOB information ...\n");\r
   PrepareHobCpu ();\r
+\r
   //\r
   // 1. BFV\r
   //\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
   MemoryTopOnDescriptor = PrepareHobMemory (Handoff->MemDescCount, Handoff->MemDesc);\r
-\r
+  \r
   //\r
   // 3. Put [NV], [Stack], [PageTable], [MemDesc], [HOB] just below the [top free address under 4GB]\r
   //\r
   \r
   //   3.1 NV data\r
+  PrintString ("Prepare NV Storage information ...\n");\r
   NvStorageBase = PrepareHobNvStorage (MemoryTopOnDescriptor);\r
+  PrintString ("NV Storage Base = %p\n", NvStorageBase);\r
   //   3.2 Stack\r
   StackTop = NvStorageBase;\r
   StackBottom = PrepareHobStack (StackTop);\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
@@ -195,6 +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
   PrepareHobDxeCore (\r
     Handoff->DxeCoreEntryPoint,\r
     (EFI_PHYSICAL_ADDRESS)(UINTN)Handoff->DxeCoreImageBase,\r
@@ -202,83 +205,74 @@ Returns:
     );\r
 \r
   PrepareHobLegacyTable (gHob);\r
+  \r
   PreparePpisNeededByDxeCore (gHob);\r
 \r
   CompleteHobGeneration ();\r
 \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("Stack = ");   \r
-  PrintValue64(gHob->Stack.AllocDescriptor.MemoryBaseAddress);\r
-  PrintString(" StackLength = ");   \r
-  PrintValue64(gHob->Stack.AllocDescriptor.MemoryLength);\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 = %lx, Length = %lx\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, 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
-\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
-\r
+  PrintString ("Fail to enter DXE main!\n");\r
\r
   //\r
   // Should never get here\r
   //\r
   CpuDeadLoop ();\r
 }\r
 \r
+EFI_STATUS\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+  IN EFILDRHANDOFF  *Handoff\r
+  )\r
+{\r
+  DxeInit(Handoff);\r
+  return EFI_SUCCESS;\r
+}\r