]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/DxeIpl/DxeInit.c
DuetPkg: Move EfiLdr Handoff data to stack
[mirror_edk2.git] / DuetPkg / DxeIpl / DxeInit.c
index 6bc3170bc5bb2ba866c6ff53ed695d7eb7e07dc6..b10e273f0ce968442374990e163cf3ffbaf5c8d0 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 - 2007, 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
@@ -136,9 +138,14 @@ Returns:
   VOID                  *MemoryDescriptor;\r
   VOID                  *NvStorageBase;\r
   CHAR8                 PrintBuffer[256];\r
-  \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
@@ -166,27 +173,31 @@ Returns:
   //   * 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
   AsciiSPrint (PrintBuffer, 256, "NV Storage Base=0x%x\n", (UINTN)NvStorageBase);\r
   PrintString (PrintBuffer);\r
-\r
+  \r
   //   3.2 Stack\r
   StackTop = NvStorageBase;\r
   StackBottom = PrepareHobStack (StackTop);\r
@@ -203,6 +214,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
@@ -210,6 +222,7 @@ Returns:
     );\r
 \r
   PrepareHobLegacyTable (gHob);\r
+  \r
   PreparePpisNeededByDxeCore (gHob);\r
 \r
   CompleteHobGeneration ();\r
@@ -260,11 +273,44 @@ Returns:
   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
@@ -292,12 +338,14 @@ Returns:
   PrintString("\n");   \r
   EFI_DEADLOOP();\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
+  \r
   EnterDxeMain (StackTop, Handoff->DxeCoreEntryPoint, gHob, PageTableBase);\r
-\r
\r
+  PrintString("Fail to enter DXE main!\n");\r
   //\r
   // Should never get here\r
   //\r