| 1 | /** @file\r |
| 2 | \r |
| 3 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
| 4 | \r |
| 5 | This program and the accompanying materials\r |
| 6 | are licensed and made available under the terms and conditions of the BSD License\r |
| 7 | which accompanies this distribution. The full text of the license may be found at\r |
| 8 | http://opensource.org/licenses/bsd-license.php\r |
| 9 | \r |
| 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
| 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
| 12 | \r |
| 13 | **/\r |
| 14 | \r |
| 15 | #include <PiPei.h>\r |
| 16 | \r |
| 17 | #include <Library/DebugLib.h>\r |
| 18 | #include <Library/PrePiLib.h>\r |
| 19 | #include <Library/PcdLib.h>\r |
| 20 | \r |
| 21 | #include <Ppi/GuidedSectionExtraction.h>\r |
| 22 | \r |
| 23 | VOID\r |
| 24 | _ModuleEntryPoint (\r |
| 25 | VOID\r |
| 26 | )\r |
| 27 | {\r |
| 28 | }\r |
| 29 | \r |
| 30 | VOID\r |
| 31 | CEntryPoint (\r |
| 32 | VOID *MemoryBase,\r |
| 33 | UINTN MemorySize,\r |
| 34 | VOID *StackBase,\r |
| 35 | UINTN StackSize\r |
| 36 | )\r |
| 37 | {\r |
| 38 | EFI_PHYSICAL_ADDRESS MemoryBegin;\r |
| 39 | UINT64 MemoryLength;\r |
| 40 | VOID *HobBase;\r |
| 41 | \r |
| 42 | //\r |
| 43 | // Boot strap the C environment so the other library services will work properly.\r |
| 44 | //\r |
| 45 | MemoryBegin = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryBase;\r |
| 46 | MemoryLength = (UINT64)MemorySize;\r |
| 47 | HobBase = (VOID *)(UINTN)(FixedPcdGet32(PcdEmbeddedFdBaseAddress) + FixedPcdGet32(PcdEmbeddedFdSize));\r |
| 48 | CreateHobList (MemoryBase, MemorySize, HobBase, StackBase);\r |
| 49 | \r |
| 50 | MemoryBegin = (EFI_PHYSICAL_ADDRESS)(UINTN)StackBase;\r |
| 51 | MemoryLength = (UINT64)StackSize;\r |
| 52 | UpdateStackHob (MemoryBegin, MemoryLength);\r |
| 53 | \r |
| 54 | DEBUG ((DEBUG_ERROR, "CEntryPoint (%x,%x,%x,%x)\n", MemoryBase, MemorySize, StackBase, StackSize));\r |
| 55 | \r |
| 56 | //\r |
| 57 | // Add your C code stuff here....\r |
| 58 | //\r |
| 59 | \r |
| 60 | \r |
| 61 | //\r |
| 62 | // Load the DXE Core and transfer control to it\r |
| 63 | //\r |
| 64 | \r |
| 65 | // Give the DXE Core access to our DEBUG and ASSERT infrastructure so this will work prior\r |
| 66 | // to the DXE version being loaded. Thus we close the debugging gap between phases.\r |
| 67 | AddDxeCoreReportStatusCodeCallback ();\r |
| 68 | \r |
| 69 | //BuildFvHobs (PcdBfvBase, PcdBfvSize, NULL);\r |
| 70 | \r |
| 71 | LoadDxeCoreFromFv (NULL, 0);\r |
| 72 | \r |
| 73 | // DXE Core should always load and never return\r |
| 74 | ASSERT (FALSE);\r |
| 75 | }\r |
| 76 | \r |