git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@150 6f19259b...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 May 2006 09:14:46 +0000 (09:14 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 May 2006 09:14:46 +0000 (09:14 +0000)
17 files changed:
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
EdkModulePkg/Core/Dxe/DxeMain.mbd
EdkModulePkg/Core/Dxe/DxeMain.msa
EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c
EdkModulePkg/Core/Dxe/Event/event.c
EdkModulePkg/Core/DxeIplPeim/DxeIpl.mbd
EdkModulePkg/Core/DxeIplPeim/DxeIplX64.mbd
EdkModulePkg/Core/DxeIplPeim/DxeIplX64.msa
EdkModulePkg/Core/DxeIplPeim/DxeLoadX64.c
EdkModulePkg/Core/DxeIplPeim/build.xml
EdkModulePkg/Core/DxeIplPeim/x64/LongMode.asm
EdkModulePkg/Core/Pei/Image/Image.c
EdkModulePkg/Core/Pei/PeiMain.mbd
EdkModulePkg/Core/Pei/PeiMain/PeiMain.c
EdkModulePkg/EdkModulePkg.spd
EdkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCode.mbd
EdkModulePkg/Universal/Variable/Pei/Variable.mbd

index 2b8f52a..4cf882e 100644 (file)
@@ -502,15 +502,6 @@ IDEBusDriverBindingStart (
       IdeBlkIoDevicePtr->IdeBusDriverPrivateData = IdeBusDriverPrivateData;\r
       IdeBlkIoDevicePtr->IoPort->BusMasterBaseAddr = IdeRegsBaseAddr[IdeChannel].BusMasterBaseAddr;\r
 \r
-      //\r
-      // Report Status code: is about to detect IDE drive\r
-      //\r
-      REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-        EFI_PROGRESS_CODE,\r
-        (EFI_IO_BUS_ATA_ATAPI | EFI_P_PC_PRESENCE_DETECT),\r
-        IdeBlkIoDevicePtr->DevicePath\r
-        );\r
-\r
       //\r
       // Discover device, now!\r
       //\r
index ec084b5..55967ca 100644 (file)
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">\r
-    <MbdHeader>\r
-        <BaseName>DxeMain</BaseName>\r
-        <Guid>D6A2CB7F-6A18-4e2f-B43B-9920A733700A</Guid>\r
-        <Version>0</Version>\r
-        <Description>FIX ME!</Description>\r
-        <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>\r
-        <License> All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </License>\r
-        <Created>2006-03-12 17:09</Created>\r
-        <Modified>2006-03-19 15:18</Modified>\r
-    </MbdHeader>\r
-    <Libraries>\r
-        <Library>BaseLib</Library>\r
-        <Library>BaseCacheMaintenanceLib</Library>\r
-        <Library>DxeReportStatusCodeLib</Library>\r
-        <Library>BaseDebugLibReportStatusCode</Library>\r
-        <Library>DxeCoreUefiDecompressLibFromHob</Library>\r
-        <Library>DxeCoreTianoDecompressLibFromHob</Library>\r
-        <Library>DxeCoreCustomDecompressLibFromHob</Library>\r
-        <Library>EdkDxePeCoffLoaderFromHobLib</Library>\r
-        <Library>DxeCoreHobLib</Library>\r
-        <Library>DxeCoreEntryPoint</Library>\r
-        <Library>BaseMemoryLib</Library>\r
-        <Library>UefiLib</Library>\r
-        <Library>BasePerformanceLibNull</Library>\r
-    </Libraries>\r
-    <BuildOptions ToolChain="MSFT">\r
-        <ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>\r
-        <Option>C_PROJ_FLAGS = ${C_PROJ_FLAGS} /Ob0</Option>\r
-    </BuildOptions>\r
-</ModuleBuildDescription>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+    <MbdHeader>
+        <BaseName>DxeMain</BaseName>
+        <Guid>D6A2CB7F-6A18-4e2f-B43B-9920A733700A</Guid>
+        <Version>0</Version>
+        <Description>FIX ME!</Description>
+        <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
+        <License> All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </License>
+        <Created>2006-03-12 17:09</Created>
+        <Modified>2006-03-19 15:18</Modified>
+    </MbdHeader>
+    <Libraries>
+        <Library>BaseLib</Library>
+        <Library>BaseCacheMaintenanceLib</Library>
+        <Library>DxeReportStatusCodeLib</Library>
+        <Library>BaseDebugLibReportStatusCode</Library>
+        <Library OverrideID="1111">DxeCoreUefiDecompressLibFromHob</Library>
+        <Library OverrideID="1111">DxeCoreTianoDecompressLibFromHob</Library>
+        <Library OverrideID="3333">DxeCoreCustomDecompressLibFromHob</Library>
+        <Library OverrideID="4444">EdkDxePeCoffLoaderFromHobLib</Library>
+        <Library>DxeCoreHobLib</Library>
+        <Library>DxeCoreEntryPoint</Library>
+        <Library>BaseMemoryLib</Library>
+        <Library>UefiLib</Library>
+        <Library>BasePerformanceLibNull</Library>
+    </Libraries>
+    <BuildOptions ToolChain="MSFT">
+        <ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
+        <Option>C_PROJ_FLAGS = ${C_PROJ_FLAGS} /Ob0</Option>
+    </BuildOptions>
+</ModuleBuildDescription>
index 9f9de4a..991e945 100644 (file)
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">\r
-    <MsaHeader>\r
-        <BaseName>DxeMain</BaseName>\r
-        <ModuleType>DXE_CORE</ModuleType>\r
-        <ComponentType>BS_DRIVER</ComponentType>\r
-        <Guid>D6A2CB7F-6A18-4e2f-B43B-9920A733700A</Guid>\r
-        <Version>0</Version>\r
-        <Abstract>Component description file for DxeMain.</Abstract>\r
-        <Description>FIX ME!</Description>\r
-        <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>\r
-        <License> All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </License>\r
-        <Specification>0</Specification>\r
-        <Created>2006-03-12 17:09</Created>\r
-        <Updated>2006-03-19 15:18</Updated>\r
-    </MsaHeader>\r
-    <LibraryClassDefinitions>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">DxeCoreEntryPoint</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">PerformanceLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">UefiDecompressLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">TianoDecompressLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">CustomDecompressLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">EdkPeCoffLoaderLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">CacheMaintenanceLib</LibraryClass>\r
-        <LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>\r
-    </LibraryClassDefinitions>\r
-    <SourceFiles>\r
-        <Filename>DxeMain/DxeMain.c</Filename>\r
-        <Filename>DxeMain/DxeProtocolNotify.c</Filename>\r
-        <Filename>Dispatcher/Dispatcher.c</Filename>\r
-        <Filename>Dispatcher/Dependency.c</Filename>\r
-        <Filename>Event/ExecData.c</Filename>\r
-        <Filename>Event/Event.c</Filename>\r
-        <Filename>Event/Timer.c</Filename>\r
-        <Filename>Event/Tpl.c</Filename>\r
-        <Filename>FwVol/FwVol.c</Filename>\r
-        <Filename>FwVol/Ffs.c</Filename>\r
-        <Filename>FwVol/FwVolAttrib.c</Filename>\r
-        <Filename>FwVol/FwVolRead.c</Filename>\r
-        <Filename>FwVol/FwVolWrite.c</Filename>\r
-        <Filename>FwVolBlock/FwVolBlock.c</Filename>\r
-        <Filename>Mem/MemData.c</Filename>\r
-        <Filename>Mem/Page.c</Filename>\r
-        <Filename>Mem/Pool.c</Filename>\r
-        <Filename>Gcd/Gcd.c</Filename>\r
-        <Filename>Hand/Handle.c</Filename>\r
-        <Filename>Hand/Locate.c</Filename>\r
-        <Filename>Hand/Notify.c</Filename>\r
-        <Filename>Hand/DriverSupport.c</Filename>\r
-        <Filename>Library/Library.c</Filename>\r
-        <Filename>Misc/InstallConfigurationTable.c</Filename>\r
-        <Filename>Misc/SetWatchdogTimer.c</Filename>\r
-        <Filename>Misc/Stall.c</Filename>\r
-        <Filename>Misc/DebugImageInfo.c</Filename>\r
-        <Filename>Image/Image.c</Filename>\r
-        <Filename>Image/ImageFile.c</Filename>\r
-        <Filename>SectionExtraction/CoreSectionExtraction.c</Filename>\r
-        <Filename>DebugImageInfo.h</Filename>\r
-        <Filename>DebugMask.h</Filename>\r
-        <Filename>DxeMain.h</Filename>\r
-        <Filename>Exec.h</Filename>\r
-        <Filename>FwVolBlock.h</Filename>\r
-        <Filename>FwVolDriver.h</Filename>\r
-        <Filename>Gcd.h</Filename>\r
-        <Filename>Hand.h</Filename>\r
-        <Filename>Image.h</Filename>\r
-        <Filename>Imem.h</Filename>\r
-        <Filename>Library.h</Filename>\r
-    </SourceFiles>\r
-    <Includes>\r
-        <PackageName>MdePkg</PackageName>\r
-        <PackageName>EdkModulePkg</PackageName>\r
-    </Includes>\r
-    <Protocols>\r
-        <Protocol Usage="SOMETIMES_CONSUMED">Ebc</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">LoadedImage</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">DevicePath</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Cpu</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">FirmwareVolume</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">FirmwareVolumeDispatch</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">FirmwareVolumeBlock</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">SectionExtraction</Protocol>\r
-        <Protocol Usage="SOMETIMES_CONSUMED">DriverBinding</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">PlatformDriverOverride</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">BusSpecificDriverOverride</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Timer</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Metronome</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">MonotonicCounter</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">VariableWrite</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Bds</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Variable</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Security</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">WatchdogTimer</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Runtime</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">RealTimeClock</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">Reset</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">LoadFile</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">SimpleFileSystem</Protocol>\r
-        <Protocol Usage="ALWAYS_CONSUMED">LoadPeImage</Protocol>\r
-    </Protocols>\r
-    <Guids>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>MemoryTypeInformation</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>DxeServicesTable</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>HobList</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>DebugImageInfoTable</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>Apriori</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>FirmwareFileSystem</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>FileInfo</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>HobMemoryAllocModule</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>PeiPeCoffLoader</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>LoadPeImage</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>EventExitBootServices</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>EventVirtualAddressChange</C_Name>\r
-        </GuidEntry>\r
-        <GuidEntry Usage="ALWAYS_CONSUMED">\r
-            <C_Name>EventMemoryMapChange</C_Name>\r
-        </GuidEntry>\r
-    </Guids>\r
-    <Externs>\r
-        <Extern>\r
-            <ModuleEntryPoint>DxeMain</ModuleEntryPoint>\r
-        </Extern>\r
-    </Externs>\r
-    <BuildOptions>\r
-        <Option>BUILD_TYPE=DXE_CORE</Option>\r
-    </BuildOptions>\r
-</ModuleSurfaceArea>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+    <MsaHeader>
+        <BaseName>DxeMain</BaseName>
+        <ModuleType>DXE_CORE</ModuleType>
+        <ComponentType>BS_DRIVER</ComponentType>
+        <Guid>D6A2CB7F-6A18-4e2f-B43B-9920A733700A</Guid>
+        <Version>0</Version>
+        <Abstract>Component description file for DxeMain.</Abstract>
+        <Description>FIX ME!</Description>
+        <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
+        <License> All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </License>
+        <Specification>0</Specification>
+        <Created>2006-03-12 17:09</Created>
+        <Updated>2006-03-19 15:18</Updated>
+    </MsaHeader>
+    <LibraryClassDefinitions>
+        <LibraryClass Usage="ALWAYS_CONSUMED">DxeCoreEntryPoint</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">PerformanceLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">UefiDecompressLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">TianoDecompressLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">CustomDecompressLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">EdkPeCoffLoaderLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">CacheMaintenanceLib</LibraryClass>
+        <LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
+    </LibraryClassDefinitions>
+    <SourceFiles>
+        <Filename>DxeMain/DxeMain.c</Filename>
+        <Filename>DxeMain/DxeProtocolNotify.c</Filename>
+        <Filename>Dispatcher/Dispatcher.c</Filename>
+        <Filename>Dispatcher/Dependency.c</Filename>
+        <Filename>Event/ExecData.c</Filename>
+        <Filename>Event/Event.c</Filename>
+        <Filename>Event/Timer.c</Filename>
+        <Filename>Event/Tpl.c</Filename>
+        <Filename>FwVol/FwVol.c</Filename>
+        <Filename>FwVol/Ffs.c</Filename>
+        <Filename>FwVol/FwVolAttrib.c</Filename>
+        <Filename>FwVol/FwVolRead.c</Filename>
+        <Filename>FwVol/FwVolWrite.c</Filename>
+        <Filename>FwVolBlock/FwVolBlock.c</Filename>
+        <Filename>Mem/MemData.c</Filename>
+        <Filename>Mem/Page.c</Filename>
+        <Filename>Mem/Pool.c</Filename>
+        <Filename>Gcd/Gcd.c</Filename>
+        <Filename>Hand/Handle.c</Filename>
+        <Filename>Hand/Locate.c</Filename>
+        <Filename>Hand/Notify.c</Filename>
+        <Filename>Hand/DriverSupport.c</Filename>
+        <Filename>Library/Library.c</Filename>
+        <Filename>Misc/InstallConfigurationTable.c</Filename>
+        <Filename>Misc/SetWatchdogTimer.c</Filename>
+        <Filename>Misc/Stall.c</Filename>
+        <Filename>Misc/DebugImageInfo.c</Filename>
+        <Filename>Image/Image.c</Filename>
+        <Filename>Image/ImageFile.c</Filename>
+        <Filename>SectionExtraction/CoreSectionExtraction.c</Filename>
+        <Filename>DebugImageInfo.h</Filename>
+        <Filename>DebugMask.h</Filename>
+        <Filename>DxeMain.h</Filename>
+        <Filename>Exec.h</Filename>
+        <Filename>FwVolBlock.h</Filename>
+        <Filename>FwVolDriver.h</Filename>
+        <Filename>Gcd.h</Filename>
+        <Filename>Hand.h</Filename>
+        <Filename>Image.h</Filename>
+        <Filename>Imem.h</Filename>
+        <Filename>Library.h</Filename>
+    </SourceFiles>
+    <Includes>
+        <PackageName>MdePkg</PackageName>
+        <PackageName>EdkModulePkg</PackageName>
+    </Includes>
+    <Protocols>
+        <Protocol Usage="SOMETIMES_CONSUMED">Ebc</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">LoadedImage</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">DevicePath</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Cpu</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">FirmwareVolume</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">FirmwareVolumeDispatch</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">FirmwareVolumeBlock</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">SectionExtraction</Protocol>
+        <Protocol Usage="SOMETIMES_CONSUMED">DriverBinding</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">PlatformDriverOverride</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">BusSpecificDriverOverride</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Timer</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Metronome</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">MonotonicCounter</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">VariableWrite</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Bds</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Variable</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Security</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">WatchdogTimer</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Runtime</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">RealTimeClock</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Reset</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">LoadFile</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">SimpleFileSystem</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">LoadPeImage</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">Decompress</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">CustomizedDecompress</Protocol>
+        <Protocol Usage="ALWAYS_CONSUMED">TianoDecompress</Protocol>
+    </Protocols>
+    <Guids>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>MemoryTypeInformation</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>DxeServicesTable</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>HobList</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>DebugImageInfoTable</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>Apriori</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>FirmwareFileSystem</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>FileInfo</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>HobMemoryAllocModule</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>PeiPeCoffLoader</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>LoadPeImage</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>EventExitBootServices</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>EventVirtualAddressChange</C_Name>
+        </GuidEntry>
+        <GuidEntry Usage="ALWAYS_CONSUMED">
+            <C_Name>EventMemoryMapChange</C_Name>
+        </GuidEntry>
+    </Guids>
+    <Externs>
+        <Extern>
+            <ModuleEntryPoint>DxeMain</ModuleEntryPoint>
+        </Extern>
+    </Externs>
+    <BuildOptions>
+        <Option>BUILD_TYPE=DXE_CORE</Option>
+    </BuildOptions>
+</ModuleSurfaceArea>
index f98f054..67a26fe 100644 (file)
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-\r
-Module Name:\r
-\r
-  DxeMain.c\r
-\r
-Abstract:\r
-\r
-  DXE Core Main Entry Point\r
-\r
---*/\r
-\r
-#include <DxeMain.h>\r
-\r
-VOID\r
-EFIAPI\r
-DxeMain (\r
-  IN  VOID *HobStart\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg0 (\r
-  VOID\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg1 (\r
-  UINTN Arg1\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg2 (\r
-  UINTN Arg1,\r
-  UINTN Arg2\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg3 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg4 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3,\r
-  UINTN Arg4\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg5 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3,\r
-  UINTN Arg4,\r
-  UINTN Arg5\r
-  );\r
-\r
-EFI_STATUS\r
-CoreGetPeiProtocol (\r
-  IN EFI_GUID  *ProtocolGuid,\r
-  IN VOID      **Interface\r
-  );\r
-  \r
-EFI_STATUS\r
-DxeMainUefiDecompressGetInfo (\r
-  IN EFI_DECOMPRESS_PROTOCOL            *This,\r
-  IN   VOID                             *Source,\r
-  IN   UINT32                           SourceSize,\r
-  OUT  UINT32                           *DestinationSize,\r
-  OUT  UINT32                           *ScratchSize\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeMainUefiDecompress (\r
-  IN EFI_DECOMPRESS_PROTOCOL              *This,\r
-  IN     VOID                             *Source,\r
-  IN     UINT32                           SourceSize,\r
-  IN OUT VOID                             *Destination,\r
-  IN     UINT32                           DestinationSize,\r
-  IN OUT VOID                             *Scratch,\r
-  IN     UINT32                           ScratchSize\r
-  );\r
-\r
-EFI_STATUS\r
-DxeMainTianoDecompressGetInfo (\r
-  IN EFI_TIANO_DECOMPRESS_PROTOCOL      *This,\r
-  IN   VOID                             *Source,\r
-  IN   UINT32                           SourceSize,\r
-  OUT  UINT32                           *DestinationSize,\r
-  OUT  UINT32                           *ScratchSize\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeMainTianoDecompress (\r
-  IN EFI_TIANO_DECOMPRESS_PROTOCOL        *This,\r
-  IN     VOID                             *Source,\r
-  IN     UINT32                           SourceSize,\r
-  IN OUT VOID                             *Destination,\r
-  IN     UINT32                           DestinationSize,\r
-  IN OUT VOID                             *Scratch,\r
-  IN     UINT32                           ScratchSize\r
-  );\r
-\r
-EFI_STATUS\r
-DxeMainCustomDecompressGetInfo (\r
-  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,\r
-  IN   VOID                              *Source,\r
-  IN   UINT32                            SourceSize,\r
-  OUT  UINT32                            *DestinationSize,\r
-  OUT  UINT32                            *ScratchSize\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeMainCustomDecompress (\r
-  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,\r
-  IN     VOID                            *Source,\r
-  IN     UINT32                          SourceSize,\r
-  IN OUT VOID                            *Destination,\r
-  IN     UINT32                          DestinationSize,\r
-  IN OUT VOID                            *Scratch,\r
-  IN     UINT32                          ScratchSize\r
-  );\r
-\r
-//\r
-// DXE Core Global Variables for Protocols from PEI\r
-//\r
-EFI_HANDLE                                mDecompressHandle = NULL;\r
-EFI_PEI_PE_COFF_LOADER_PROTOCOL           *gEfiPeiPeCoffLoader          = NULL;\r
-\r
-//\r
-// DXE Core globals for Architecture Protocols\r
-//\r
-EFI_SECURITY_ARCH_PROTOCOL        *gSecurity      = NULL;\r
-EFI_CPU_ARCH_PROTOCOL             *gCpu           = NULL;\r
-EFI_METRONOME_ARCH_PROTOCOL       *gMetronome     = NULL;\r
-EFI_TIMER_ARCH_PROTOCOL           *gTimer         = NULL;\r
-EFI_BDS_ARCH_PROTOCOL             *gBds           = NULL;\r
-EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  *gWatchdogTimer = NULL;\r
-EFI_RUNTIME_ARCH_PROTOCOL         *gRuntime       = NULL;\r
-\r
-//\r
-// BugBug: I'n not runtime, but is the PPI?\r
-//\r
-EFI_STATUS_CODE_PROTOCOL     gStatusCodeInstance = {\r
-  NULL\r
-};\r
-\r
-EFI_STATUS_CODE_PROTOCOL     *gStatusCode    = &gStatusCodeInstance;\r
-\r
-\r
-//\r
-// DXE Core Global used to update core loaded image protocol handle\r
-//\r
-EFI_GUID                           *gDxeCoreFileName;\r
-EFI_LOADED_IMAGE_PROTOCOL          *gDxeCoreLoadedImage;\r
-\r
-\r
-\r
-//\r
-// DXE Core Module Variables\r
-//\r
-\r
-EFI_BOOT_SERVICES mBootServices = {\r
-  {\r
-    EFI_BOOT_SERVICES_SIGNATURE,                                                          // Signature\r
-    EFI_BOOT_SERVICES_REVISION,                                                           // Revision\r
-    sizeof (EFI_BOOT_SERVICES),                                                           // HeaderSize\r
-    0,                                                                                    // CRC32\r
-    0                                                                                     // Reserved\r
-  },                                                                                      \r
-  (EFI_RAISE_TPL)                               CoreRaiseTpl,                             // RaiseTPL\r
-  (EFI_RESTORE_TPL)                             CoreRestoreTpl,                           // RestoreTPL\r
-  (EFI_ALLOCATE_PAGES)                          CoreAllocatePages,                        // AllocatePages\r
-  (EFI_FREE_PAGES)                              CoreFreePages,                            // FreePages\r
-  (EFI_GET_MEMORY_MAP)                          CoreGetMemoryMap,                         // GetMemoryMap\r
-  (EFI_ALLOCATE_POOL)                           CoreAllocatePool,                         // AllocatePool\r
-  (EFI_FREE_POOL)                               CoreFreePool,                             // FreePool\r
-  (EFI_CREATE_EVENT)                            CoreCreateEvent,                          // CreateEvent\r
-  (EFI_SET_TIMER)                               CoreSetTimer,                             // SetTimer\r
-  (EFI_WAIT_FOR_EVENT)                          CoreWaitForEvent,                         // WaitForEvent\r
-  (EFI_SIGNAL_EVENT)                            CoreSignalEvent,                          // SignalEvent\r
-  (EFI_CLOSE_EVENT)                             CoreCloseEvent,                           // CloseEvent\r
-  (EFI_CHECK_EVENT)                             CoreCheckEvent,                           // CheckEvent\r
-  (EFI_INSTALL_PROTOCOL_INTERFACE)              CoreInstallProtocolInterface,             // InstallProtocolInterface\r
-  (EFI_REINSTALL_PROTOCOL_INTERFACE)            CoreReinstallProtocolInterface,           // ReinstallProtocolInterface\r
-  (EFI_UNINSTALL_PROTOCOL_INTERFACE)            CoreUninstallProtocolInterface,           // UninstallProtocolInterface\r
-  (EFI_HANDLE_PROTOCOL)                         CoreHandleProtocol,                       // HandleProtocol\r
-  (VOID *)                                      NULL,                                     // Reserved\r
-  (EFI_REGISTER_PROTOCOL_NOTIFY)                CoreRegisterProtocolNotify,               // RegisterProtocolNotify\r
-  (EFI_LOCATE_HANDLE)                           CoreLocateHandle,                         // LocateHandle\r
-  (EFI_LOCATE_DEVICE_PATH)                      CoreLocateDevicePath,                     // LocateDevicePath\r
-  (EFI_INSTALL_CONFIGURATION_TABLE)             CoreInstallConfigurationTable,            // InstallConfigurationTable\r
-  (EFI_IMAGE_LOAD)                              CoreLoadImage,                            // LoadImage\r
-  (EFI_IMAGE_START)                             CoreStartImage,                           // StartImage\r
-  (EFI_EXIT)                                    CoreExit,                                 // Exit\r
-  (EFI_IMAGE_UNLOAD)                            CoreUnloadImage,                          // UnloadImage\r
-  (EFI_EXIT_BOOT_SERVICES)                      CoreExitBootServices,                     // ExitBootServices\r
-  (EFI_GET_NEXT_MONOTONIC_COUNT)                CoreEfiNotAvailableYetArg1,               // GetNextMonotonicCount\r
-  (EFI_STALL)                                   CoreStall,                                // Stall\r
-  (EFI_SET_WATCHDOG_TIMER)                      CoreSetWatchdogTimer,                     // SetWatchdogTimer\r
-  (EFI_CONNECT_CONTROLLER)                      CoreConnectController,                    // ConnectController\r
-  (EFI_DISCONNECT_CONTROLLER)                   CoreDisconnectController,                 // DisconnectController\r
-  (EFI_OPEN_PROTOCOL)                           CoreOpenProtocol,                         // OpenProtocol\r
-  (EFI_CLOSE_PROTOCOL)                          CoreCloseProtocol,                        // CloseProtocol\r
-  (EFI_OPEN_PROTOCOL_INFORMATION)               CoreOpenProtocolInformation,              // OpenProtocolInformation\r
-  (EFI_PROTOCOLS_PER_HANDLE)                    CoreProtocolsPerHandle,                   // ProtocolsPerHandle\r
-  (EFI_LOCATE_HANDLE_BUFFER)                    CoreLocateHandleBuffer,                   // LocateHandleBuffer\r
-  (EFI_LOCATE_PROTOCOL)                         CoreLocateProtocol,                       // LocateProtocol\r
-  (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)    CoreInstallMultipleProtocolInterfaces,    // InstallMultipleProtocolInterfaces\r
-  (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)  CoreUninstallMultipleProtocolInterfaces,  // UninstallMultipleProtocolInterfaces\r
-  (EFI_CALCULATE_CRC32)                         CoreEfiNotAvailableYetArg3,               // CalculateCrc32\r
-  (EFI_COPY_MEM)                                CopyMem,                                  // CopyMem\r
-  (EFI_SET_MEM)                                 SetMem                                    // SetMem\r
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
-  ,                                   \r
-  (EFI_CREATE_EVENT_EX)                          CoreCreateEventEx                         // CreateEventEx\r
-#endif\r
-};\r
-\r
-EFI_DXE_SERVICES mDxeServices = {\r
-  {\r
-    EFI_DXE_SERVICES_SIGNATURE,                                           // Signature\r
-    EFI_DXE_SERVICES_REVISION,                                            // Revision\r
-    sizeof (EFI_DXE_SERVICES),                                            // HeaderSize\r
-    0,                                                                    // CRC32\r
-    0                                                                     // Reserved\r
-  },\r
-  (EFI_ADD_MEMORY_SPACE)             CoreAddMemorySpace,                  // AddMemorySpace\r
-  (EFI_ALLOCATE_MEMORY_SPACE)        CoreAllocateMemorySpace,             // AllocateMemorySpace\r
-  (EFI_FREE_MEMORY_SPACE)            CoreFreeMemorySpace,                 // FreeMemorySpace\r
-  (EFI_REMOVE_MEMORY_SPACE)          CoreRemoveMemorySpace,               // RemoveMemorySpace\r
-  (EFI_GET_MEMORY_SPACE_DESCRIPTOR)  CoreGetMemorySpaceDescriptor,        // GetMemorySpaceDescriptor\r
-  (EFI_SET_MEMORY_SPACE_ATTRIBUTES)  CoreSetMemorySpaceAttributes,        // SetMemorySpaceAttributes\r
-  (EFI_GET_MEMORY_SPACE_MAP)         CoreGetMemorySpaceMap,               // GetMemorySpaceMap\r
-  (EFI_ADD_IO_SPACE)                 CoreAddIoSpace,                      // AddIoSpace\r
-  (EFI_ALLOCATE_IO_SPACE)            CoreAllocateIoSpace,                 // AllocateIoSpace\r
-  (EFI_FREE_IO_SPACE)                CoreFreeIoSpace,                     // FreeIoSpace\r
-  (EFI_REMOVE_IO_SPACE)              CoreRemoveIoSpace,                   // RemoveIoSpace\r
-  (EFI_GET_IO_SPACE_DESCRIPTOR)      CoreGetIoSpaceDescriptor,            // GetIoSpaceDescriptor\r
-  (EFI_GET_IO_SPACE_MAP)             CoreGetIoSpaceMap,                   // GetIoSpaceMap\r
-  (EFI_DISPATCH)                     CoreDispatcher,                      // Dispatch\r
-  (EFI_SCHEDULE)                     CoreSchedule,                        // Schedule\r
-  (EFI_TRUST)                        CoreTrust,                           // Trust\r
-  (EFI_PROCESS_FIRMWARE_VOLUME)      CoreProcessFirmwareVolume,           // ProcessFirmwareVolume\r
-};\r
-\r
-EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {\r
-  {\r
-    EFI_SYSTEM_TABLE_SIGNATURE,                                           // Signature\r
-    EFI_SYSTEM_TABLE_REVISION,                                            // Revision\r
-    sizeof (EFI_SYSTEM_TABLE),                                            // HeaderSize\r
-    0,                                                                    // CRC32\r
-    0                                                                     // Reserved\r
-  },\r
-  NULL,                                                                   // FirmwareVendor\r
-  0,                                                                      // FirmwareRevision\r
-  NULL,                                                                   // ConsoleInHandle\r
-  NULL,                                                                   // ConIn\r
-  NULL,                                                                   // ConsoleOutHandle\r
-  NULL,                                                                   // ConOut\r
-  NULL,                                                                   // StandardErrorHandle\r
-  NULL,                                                                   // StdErr\r
-  NULL,                                                                   // RuntimeServices\r
-  &mBootServices,                                                         // BootServices\r
-  0,                                                                      // NumberOfConfigurationTableEntries\r
-  NULL                                                                    // ConfigurationTable\r
-};\r
-\r
-EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {\r
-  {\r
-    EFI_RUNTIME_SERVICES_SIGNATURE,                               // Signature\r
-    EFI_RUNTIME_SERVICES_REVISION,                                // Revision\r
-    sizeof (EFI_RUNTIME_SERVICES),                                // HeaderSize\r
-    0,                                                            // CRC32\r
-    0                                                             // Reserved\r
-  },\r
-  (EFI_GET_TIME)                 CoreEfiNotAvailableYetArg2,      // GetTime\r
-  (EFI_SET_TIME)                 CoreEfiNotAvailableYetArg1,      // SetTime\r
-  (EFI_GET_WAKEUP_TIME)          CoreEfiNotAvailableYetArg3,      // GetWakeupTime\r
-  (EFI_SET_WAKEUP_TIME)          CoreEfiNotAvailableYetArg2,      // SetWakeupTime\r
-  (EFI_SET_VIRTUAL_ADDRESS_MAP)  CoreEfiNotAvailableYetArg4,      // SetVirtualAddressMap\r
-  (EFI_CONVERT_POINTER)          CoreEfiNotAvailableYetArg2,      // ConvertPointer\r
-  (EFI_GET_VARIABLE)             CoreEfiNotAvailableYetArg5,      // GetVariable\r
-  (EFI_GET_NEXT_VARIABLE_NAME)   CoreEfiNotAvailableYetArg3,      // GetNextVariableName\r
-  (EFI_SET_VARIABLE)             CoreEfiNotAvailableYetArg5,      // SetVariable\r
-  (EFI_GET_NEXT_HIGH_MONO_COUNT) CoreEfiNotAvailableYetArg1,      // GetNextHighMonotonicCount\r
-  (EFI_RESET_SYSTEM)             CoreEfiNotAvailableYetArg4       // ResetSystem \r
-#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION <  0x00020000))\r
-  ,\r
-  (TIANO_REPORT_STATUS_CODE)       CoreEfiNotAvailableYetArg5     // ReportStatusCode\r
-#elif (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
-  ,\r
-  (EFI_UPDATE_CAPSULE)              CoreEfiNotAvailableYetArg3,   // UpdateCapsule\r
-  (EFI_QUERY_CAPSULE_CAPABILITIES)  CoreEfiNotAvailableYetArg4,   // QueryCapsuleCapabilities\r
-  (EFI_QUERY_VARIABLE_INFO)         CoreEfiNotAvailableYetArg4    // QueryVariableInfo\r
-#endif\r
-};\r
-\r
-//\r
-// DXE Core Global Variables for the EFI System Table, Boot Services Table, \r
-// DXE Services Table, and Runtime Services Table\r
-//\r
-EFI_BOOT_SERVICES     *gBS = &mBootServices;\r
-EFI_DXE_SERVICES      *gDS = &mDxeServices;\r
-EFI_SYSTEM_TABLE      *gST = NULL;\r
-\r
-//\r
-// For debug initialize gRT to template. gRT must be allocated from RT memory\r
-//  but gRT is used for ASSERT () and DEBUG () type macros so lets give it\r
-//  a value that will not cause debug infrastructure to crash early on.\r
-//\r
-EFI_RUNTIME_SERVICES  *gRT = &mEfiRuntimeServicesTableTemplate;\r
-EFI_HANDLE            gDxeCoreImageHandle = NULL;\r
-\r
-VOID  *mHobStart;\r
-\r
-//\r
-// EFI Decompress Protocol\r
-//\r
-EFI_DECOMPRESS_PROTOCOL  gEfiDecompress = {\r
-  DxeMainUefiDecompressGetInfo,\r
-  DxeMainUefiDecompress\r
-};\r
-\r
-//\r
-// Tiano Decompress Protocol\r
-//\r
-EFI_TIANO_DECOMPRESS_PROTOCOL  gEfiTianoDecompress = {\r
-  DxeMainTianoDecompressGetInfo,\r
-  DxeMainTianoDecompress\r
-};\r
-\r
-//\r
-// Customized Decompress Protocol\r
-//\r
-EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  gEfiCustomizedDecompress = {\r
-  DxeMainCustomDecompressGetInfo,\r
-  DxeMainCustomDecompress\r
-};\r
-\r
-//\r
-// Main entry point to the DXE Core\r
-//\r
-VOID\r
-EFIAPI\r
-DxeMain (\r
-  IN  VOID *HobStart\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Main entry point to DXE Core.\r
-\r
-Arguments:\r
-\r
-  HobStart - Pointer to the beginning of the HOB List from PEI\r
-\r
-Returns:\r
-\r
-  This function should never return\r
-\r
---*/\r
-{\r
-  EFI_STATUS                         Status;\r
-  EFI_PHYSICAL_ADDRESS               MemoryBaseAddress;\r
-  UINT64                             MemoryLength;\r
-\r
-#ifdef EFI_DXE_PERFORMANCE\r
-  UINT64                             Tick;\r
-\r
-  GetTimerValue (&Tick);\r
-#endif\r
-\r
-  mHobStart = HobStart;\r
-  \r
-  //\r
-  // Initialize Memory Services\r
-  //\r
-  CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength);\r
-\r
-  //\r
-  // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData\r
-  // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table\r
-  //\r
-  gST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);\r
-  ASSERT (gST != NULL);\r
-\r
-  gRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);\r
-  ASSERT (gRT != NULL);\r
-\r
-  gST->RuntimeServices = gRT;\r
-  \r
-  //\r
-  // Start the Image Services.\r
-  //\r
-  Status = CoreInitializeImageServices (HobStart);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Call constructor for all libraries\r
-  //\r
-  ProcessLibraryConstructorList (gDxeCoreImageHandle, gST);\r
-\r
-  //\r
-  // Initialize the Global Coherency Domain Services\r
-  //\r
-  Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Install the DXE Services Table into the EFI System Tables's Configuration Table\r
-  //\r
-  Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDS);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Install the HOB List into the EFI System Tables's Configuration Table\r
-  //\r
-  Status = CoreInstallConfigurationTable (&gEfiHobListGuid, HobStart);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Install Memory Type Information Table into the EFI System Tables's Configuration Table\r
-  //\r
-  Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Initialize the ReportStatusCode with PEI version, if availible\r
-  //\r
-  CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **)&gStatusCode->ReportStatusCode);\r
-#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))\r
-  gRT->ReportStatusCode = gStatusCode->ReportStatusCode;\r
-#endif\r
-\r
-  //\r
-  // Report Status Code here for DXE_ENTRY_POINT once it is available\r
-  //\r
-  CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT));\r
-\r
-  //\r
-  // Create the aligned system table pointer structure that is used by external\r
-  // debuggers to locate the system table...  Also, install debug image info\r
-  // configuration table.\r
-  //\r
-  CoreInitializeDebugImageInfoTable ();\r
-  CoreNewDebugImageInfoEntry (\r
-    EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,\r
-    gDxeCoreLoadedImage,\r
-    gDxeCoreImageHandle\r
-    );\r
-\r
-  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "HOBLIST address in DXE = 0x%08x\n", HobStart));\r
-\r
-  //\r
-  // Initialize the Event Services\r
-  //\r
-  Status = CoreInitializeEventServices ();\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-   \r
-  //\r
-  // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs\r
-  //\r
-  // These Protocols are not architectural. This implementation is sharing code between \r
-  // PEI and DXE in order to save FLASH space. These Protocols could also be implemented \r
-  // as part of the DXE Core. However, that would also require the DXE Core to be ported \r
-  // each time a different CPU is used, a different Decompression algorithm is used, or a \r
-  // different Image type is used. By placing these Protocols in PEI, the DXE Core remains \r
-  // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform, \r
-  // and from CPU to CPU.\r
-  //\r
-\r
-  //\r
-  // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components\r
-  //   \r
-  Status = CoreInstallMultipleProtocolInterfaces (\r
-              &mDecompressHandle,\r
-              &gEfiDecompressProtocolGuid,           &gEfiDecompress,\r
-              &gEfiTianoDecompressProtocolGuid,      &gEfiTianoDecompress,\r
-              &gEfiCustomizedDecompressProtocolGuid, &gEfiCustomizedDecompress,\r
-              NULL\r
-              );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  gEfiPeiPeCoffLoader = GetPeCoffLoaderProtocol ();\r
-  ASSERT (gEfiPeiPeCoffLoader != NULL);\r
-\r
-  //\r
-  // Register for the GUIDs of the Architectural Protocols, so the rest of the\r
-  // EFI Boot Services and EFI Runtime Services tables can be filled in.\r
-  //\r
-  CoreNotifyOnArchProtocolInstallation ();\r
-\r
-  //\r
-  // Produce Firmware Volume Protocols, one for each FV in the HOB list.\r
-  //\r
-  Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gST);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  Status = FwVolDriverInit (gDxeCoreImageHandle, gST);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Produce the Section Extraction Protocol \r
-  //\r
-  Status = InitializeSectionExtraction (gDxeCoreImageHandle, gST);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Initialize the DXE Dispatcher\r
-  //\r
-  PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;\r
-  CoreInitializeDispatcher ();\r
-  PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;\r
-\r
-  //\r
-  // Invoke the DXE Dispatcher\r
-  //\r
-  PERF_START (0, "CoreDispatcher", "DxeMain", 0);\r
-  CoreDispatcher ();\r
-  PERF_END (0, "CoreDispatcher", "DxeMain", 0);\r
-\r
-  //\r
-  // Display Architectural protocols that were not loaded if this is DEBUG build\r
-  //\r
-  DEBUG_CODE (\r
-    CoreDisplayMissingArchProtocols ();\r
-  );\r
-  \r
-  //\r
-  // Assert if the Architectural Protocols are not present.\r
-  //\r
-  ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());\r
-\r
-  //\r
-  // Report Status code before transfer control to BDS\r
-  //\r
-  CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT));\r
-  //\r
-  // Display any drivers that were not dispatched because dependency expression\r
-  // evaluated to false if this is a debug build\r
-  //\r
-  DEBUG_CODE (\r
-    CoreDisplayDiscoveredNotDispatched ();\r
-  );\r
-\r
-  //\r
-  // Transfer control to the BDS Architectural Protocol\r
-  //\r
-  gBds->Entry (gBds);\r
-  \r
-  //\r
-  // BDS should never return\r
-  //\r
-  ASSERT (FALSE);\r
-  CpuDeadLoop ();\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg0 (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Place holder function until all the Boot Services and Runtime Services are available\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  EFI_NOT_AVAILABLE_YET\r
-\r
---*/\r
-{\r
-  //\r
-  // This function should never be executed.  If it does, then the architectural protocols\r
-  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the\r
-  // DXE Core and all the Architectural Protocols are complete.\r
-  //\r
-\r
-  return EFI_NOT_AVAILABLE_YET;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg1 (\r
-  UINTN Arg1\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Place holder function until all the Boot Services and Runtime Services are available\r
-\r
-Arguments:\r
-\r
-  Arg1        - Undefined\r
-\r
-Returns:\r
-\r
-  EFI_NOT_AVAILABLE_YET\r
-\r
---*/\r
-{\r
-  //\r
-  // This function should never be executed.  If it does, then the architectural protocols\r
-  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the\r
-  // DXE Core and all the Architectural Protocols are complete.\r
-  //\r
-\r
-  return EFI_NOT_AVAILABLE_YET;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg2 (\r
-  UINTN Arg1,\r
-  UINTN Arg2\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Place holder function until all the Boot Services and Runtime Services are available\r
-\r
-Arguments:\r
-\r
-  Arg1        - Undefined\r
-  \r
-  Arg2        - Undefined\r
-\r
-Returns:\r
-\r
-  EFI_NOT_AVAILABLE_YET\r
-\r
---*/\r
-{\r
-  //\r
-  // This function should never be executed.  If it does, then the architectural protocols\r
-  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the\r
-  // DXE Core and all the Architectural Protocols are complete.\r
-  //\r
-\r
-  return EFI_NOT_AVAILABLE_YET;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg3 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Place holder function until all the Boot Services and Runtime Services are available\r
-\r
-Arguments:\r
-\r
-  Arg1        - Undefined\r
-  \r
-  Arg2        - Undefined\r
-  \r
-  Arg3        - Undefined\r
-\r
-Returns:\r
-\r
-  EFI_NOT_AVAILABLE_YET\r
-\r
---*/\r
-{\r
-  //\r
-  // This function should never be executed.  If it does, then the architectural protocols\r
-  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the\r
-  // DXE Core and all the Architectural Protocols are complete.\r
-  //\r
-\r
-  return EFI_NOT_AVAILABLE_YET;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg4 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3,\r
-  UINTN Arg4\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Place holder function until all the Boot Services and Runtime Services are available\r
-\r
-Arguments:\r
-\r
-  Arg1        - Undefined\r
-  \r
-  Arg2        - Undefined\r
-  \r
-  Arg3        - Undefined\r
-  \r
-  Arg4        - Undefined\r
-\r
-Returns:\r
-\r
-  EFI_NOT_AVAILABLE_YET\r
-\r
---*/\r
-{\r
-  //\r
-  // This function should never be executed.  If it does, then the architectural protocols\r
-  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the\r
-  // DXE Core and all the Architectural Protocols are complete.\r
-  //\r
-\r
-  return EFI_NOT_AVAILABLE_YET;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreEfiNotAvailableYetArg5 (\r
-  UINTN Arg1,\r
-  UINTN Arg2,\r
-  UINTN Arg3,\r
-  UINTN Arg4,\r
-  UINTN Arg5\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Place holder function until all the Boot Services and Runtime Services are available\r
-\r
-Arguments:\r
-\r
-  Arg1        - Undefined\r
-  \r
-  Arg2        - Undefined\r
-  \r
-  Arg3        - Undefined\r
-  \r
-  Arg4        - Undefined\r
-  \r
-  Arg5        - Undefined\r
-\r
-Returns:\r
-\r
-  EFI_NOT_AVAILABLE_YET\r
-\r
---*/\r
-{\r
-  //\r
-  // This function should never be executed.  If it does, then the architectural protocols\r
-  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the\r
-  // DXE Core and all the Architectural Protocols are complete.\r
-  //\r
-\r
-  return EFI_NOT_AVAILABLE_YET;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-CoreGetPeiProtocol (\r
-  IN EFI_GUID  *ProtocolGuid,\r
-  IN VOID      **Interface\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Searches for a Protocol Interface passed from PEI through a HOB\r
-\r
-Arguments:\r
-\r
-  ProtocolGuid - The Protocol GUID to search for in the HOB List\r
-\r
-  Interface    - A pointer to the interface for the Protocol GUID\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS   - The Protocol GUID was found and its interface is returned in Interface\r
-\r
-  EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List\r
-\r
---*/\r
-{\r
-  EFI_HOB_GUID_TYPE   *GuidHob;\r
-  VOID                *Buffer;\r
-\r
-  GuidHob = GetNextGuidHob (ProtocolGuid, mHobStart);\r
-  if (GuidHob == NULL) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-  \r
-  Buffer = GET_GUID_HOB_DATA (GuidHob);\r
-  ASSERT (Buffer != NULL);\r
-\r
-  *Interface = (VOID *)(*(UINTN *)(Buffer));\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-VOID\r
-CalculateEfiHdrCrc (\r
-  IN  OUT EFI_TABLE_HEADER    *Hdr\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Calcualte the 32-bit CRC in a EFI table using the service provided by the\r
-  gRuntime service.\r
-\r
-Arguments:\r
-\r
-  Hdr  - Pointer to an EFI standard header\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  UINT32 Crc;\r
-\r
-  Hdr->CRC32 = 0;\r
-  \r
-  //\r
-  // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then\r
-  //  Crc will come back as zero if we set it to zero here\r
-  //\r
-  Crc = 0;\r
-  gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);\r
-  Hdr->CRC32 = Crc; \r
-}\r
-\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreExitBootServices (\r
-  IN EFI_HANDLE   ImageHandle,\r
-  IN UINTN        MapKey\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  EFI 1.0 API to terminate Boot Services\r
-\r
-Arguments:\r
-\r
-  ImageHandle  - Handle that represents the identity of the calling image\r
-\r
-  MapKey -Key to the latest memory map.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - Boot Services terminated\r
-  EFI_INVALID_PARAMETER - MapKey is incorrect.\r
-\r
---*/\r
-{\r
-  EFI_STATUS    Status;\r
-\r
-  //\r
-  // Terminate memory services if the MapKey matches\r
-  //\r
-  Status = CoreTerminateMemoryMap (MapKey);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Notify other drivers that we are exiting boot services.\r
-  //\r
-  CoreNotifySignalList (&gEfiEventExitBootServicesGuid);\r
-\r
-  //\r
-  // Disable Timer\r
-  //\r
-  gTimer->SetTimerPeriod (gTimer, 0);\r
-\r
-  //\r
-  // Disable CPU Interrupts\r
-  //\r
-  gCpu->DisableInterrupt (gCpu);\r
-\r
-  //\r
-  // Register Runtime events with the Runtime Architectural Protocol\r
-  //\r
-  CoreShutdownEventServices ();\r
-\r
-  //\r
-  // Register Runtime images with the Runtime Architectural Protocol\r
-  //\r
-  CoreShutdownImageServices ();\r
-\r
-  //\r
-  // Report that ExitBootServices() has been called\r
-  //\r
-  // We are using gEfiDxeServicesTableGuid as the caller ID for Dxe Core\r
-  //\r
-  CoreReportProgressCode ((EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES));\r
-\r
-  //\r
-  // Clear the non-runtime values of the EFI System Table\r
-  //\r
-  gST->BootServices        = NULL;\r
-  gST->ConIn               = NULL;\r
-  gST->ConsoleInHandle     = NULL;\r
-  gST->ConOut              = NULL;\r
-  gST->ConsoleOutHandle    = NULL;\r
-  gST->StdErr              = NULL;\r
-  gST->StandardErrorHandle = NULL;\r
-\r
-  //\r
-  // Recompute the 32-bit CRC of the EFI System Table\r
-  //\r
-  CalculateEfiHdrCrc (&gST->Hdr);\r
-\r
-  //\r
-  // Zero out the Boot Service Table\r
-  //\r
-  SetMem (gBS, sizeof (EFI_BOOT_SERVICES), 0);\r
-  gBS = NULL;\r
-\r
-  return Status;\r
-}\r
-\r
-EFI_STATUS\r
-DxeMainUefiDecompressGetInfo (\r
-  IN EFI_DECOMPRESS_PROTOCOL            *This,\r
-  IN   VOID                             *Source,\r
-  IN   UINT32                           SourceSize,\r
-  OUT  UINT32                           *DestinationSize,\r
-  OUT  UINT32                           *ScratchSize\r
-  )\r
-{\r
-  return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeMainUefiDecompress (\r
-  IN EFI_DECOMPRESS_PROTOCOL              *This,\r
-  IN     VOID                             *Source,\r
-  IN     UINT32                           SourceSize,\r
-  IN OUT VOID                             *Destination,\r
-  IN     UINT32                           DestinationSize,\r
-  IN OUT VOID                             *Scratch,\r
-  IN     UINT32                           ScratchSize\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  UINT32      TestDestinationSize;\r
-  UINT32      TestScratchSize;\r
-\r
-  Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r
-    return RETURN_INVALID_PARAMETER;\r
-  }\r
-\r
-  return UefiDecompress (Source, Destination, Scratch);\r
-}\r
-\r
-EFI_STATUS\r
-DxeMainTianoDecompressGetInfo (\r
-  IN EFI_TIANO_DECOMPRESS_PROTOCOL      *This,\r
-  IN   VOID                             *Source,\r
-  IN   UINT32                           SourceSize,\r
-  OUT  UINT32                           *DestinationSize,\r
-  OUT  UINT32                           *ScratchSize\r
-  )\r
-{\r
-  return TianoDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeMainTianoDecompress (\r
-  IN EFI_TIANO_DECOMPRESS_PROTOCOL        *This,\r
-  IN     VOID                             *Source,\r
-  IN     UINT32                           SourceSize,\r
-  IN OUT VOID                             *Destination,\r
-  IN     UINT32                           DestinationSize,\r
-  IN OUT VOID                             *Scratch,\r
-  IN     UINT32                           ScratchSize\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  UINT32      TestDestinationSize;\r
-  UINT32      TestScratchSize;\r
-\r
-  Status = TianoDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r
-    return RETURN_INVALID_PARAMETER;\r
-  }\r
-\r
-  return TianoDecompress (Source, Destination, Scratch);\r
-}\r
-\r
-EFI_STATUS\r
-DxeMainCustomDecompressGetInfo (\r
-  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,\r
-  IN   VOID                              *Source,\r
-  IN   UINT32                            SourceSize,\r
-  OUT  UINT32                            *DestinationSize,\r
-  OUT  UINT32                            *ScratchSize\r
-  )\r
-{\r
-  return CustomDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeMainCustomDecompress (\r
-  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,\r
-  IN     VOID                            *Source,\r
-  IN     UINT32                          SourceSize,\r
-  IN OUT VOID                            *Destination,\r
-  IN     UINT32                          DestinationSize,\r
-  IN OUT VOID                            *Scratch,\r
-  IN     UINT32                          ScratchSize\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  UINT32      TestDestinationSize;\r
-  UINT32      TestScratchSize;\r
-\r
-  Status = CustomDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r
-    return RETURN_INVALID_PARAMETER;\r
-  }\r
-\r
-  return CustomDecompress (Source, Destination, Scratch);\r
-}\r
-\r
+/*++
+
+Copyright (c) 2006, Intel Corporation                                                         
+All rights reserved. This program and the accompanying materials                          
+are licensed and made available under the terms and conditions of the BSD License         
+which accompanies this distribution.  The full text of the license may be found at        
+http://opensource.org/licenses/bsd-license.php                                            
+                                                                                          
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+Module Name:
+
+  DxeMain.c
+
+Abstract:
+
+  DXE Core Main Entry Point
+
+--*/
+
+#include <DxeMain.h>
+
+VOID
+EFIAPI
+DxeMain (
+  IN  VOID *HobStart
+  );
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg0 (
+  VOID
+  );
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg1 (
+  UINTN Arg1
+  );
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg2 (
+  UINTN Arg1,
+  UINTN Arg2
+  );
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg3 (
+  UINTN Arg1,
+  UINTN Arg2,
+  UINTN Arg3
+  );
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg4 (
+  UINTN Arg1,
+  UINTN Arg2,
+  UINTN Arg3,
+  UINTN Arg4
+  );
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg5 (
+  UINTN Arg1,
+  UINTN Arg2,
+  UINTN Arg3,
+  UINTN Arg4,
+  UINTN Arg5
+  );
+
+EFI_STATUS
+CoreGetPeiProtocol (
+  IN EFI_GUID  *ProtocolGuid,
+  IN VOID      **Interface
+  );
+  
+EFI_STATUS
+DxeMainUefiDecompressGetInfo (
+  IN EFI_DECOMPRESS_PROTOCOL            *This,
+  IN   VOID                             *Source,
+  IN   UINT32                           SourceSize,
+  OUT  UINT32                           *DestinationSize,
+  OUT  UINT32                           *ScratchSize
+  );
+
+EFI_STATUS
+EFIAPI
+DxeMainUefiDecompress (
+  IN EFI_DECOMPRESS_PROTOCOL              *This,
+  IN     VOID                             *Source,
+  IN     UINT32                           SourceSize,
+  IN OUT VOID                             *Destination,
+  IN     UINT32                           DestinationSize,
+  IN OUT VOID                             *Scratch,
+  IN     UINT32                           ScratchSize
+  );
+
+EFI_STATUS
+DxeMainTianoDecompressGetInfo (
+  IN EFI_TIANO_DECOMPRESS_PROTOCOL      *This,
+  IN   VOID                             *Source,
+  IN   UINT32                           SourceSize,
+  OUT  UINT32                           *DestinationSize,
+  OUT  UINT32                           *ScratchSize
+  );
+
+EFI_STATUS
+EFIAPI
+DxeMainTianoDecompress (
+  IN EFI_TIANO_DECOMPRESS_PROTOCOL        *This,
+  IN     VOID                             *Source,
+  IN     UINT32                           SourceSize,
+  IN OUT VOID                             *Destination,
+  IN     UINT32                           DestinationSize,
+  IN OUT VOID                             *Scratch,
+  IN     UINT32                           ScratchSize
+  );
+
+EFI_STATUS
+DxeMainCustomDecompressGetInfo (
+  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,
+  IN   VOID                              *Source,
+  IN   UINT32                            SourceSize,
+  OUT  UINT32                            *DestinationSize,
+  OUT  UINT32                            *ScratchSize
+  );
+
+EFI_STATUS
+EFIAPI
+DxeMainCustomDecompress (
+  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,
+  IN     VOID                            *Source,
+  IN     UINT32                          SourceSize,
+  IN OUT VOID                            *Destination,
+  IN     UINT32                          DestinationSize,
+  IN OUT VOID                            *Scratch,
+  IN     UINT32                          ScratchSize
+  );
+
+//
+// DXE Core Global Variables for Protocols from PEI
+//
+EFI_HANDLE                                mDecompressHandle = NULL;
+EFI_PEI_PE_COFF_LOADER_PROTOCOL           *gEfiPeiPeCoffLoader          = NULL;
+
+//
+// DXE Core globals for Architecture Protocols
+//
+EFI_SECURITY_ARCH_PROTOCOL        *gSecurity      = NULL;
+EFI_CPU_ARCH_PROTOCOL             *gCpu           = NULL;
+EFI_METRONOME_ARCH_PROTOCOL       *gMetronome     = NULL;
+EFI_TIMER_ARCH_PROTOCOL           *gTimer         = NULL;
+EFI_BDS_ARCH_PROTOCOL             *gBds           = NULL;
+EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  *gWatchdogTimer = NULL;
+EFI_RUNTIME_ARCH_PROTOCOL         *gRuntime       = NULL;
+
+//
+// BugBug: I'n not runtime, but is the PPI?
+//
+EFI_STATUS_CODE_PROTOCOL     gStatusCodeInstance = {
+  NULL
+};
+
+EFI_STATUS_CODE_PROTOCOL     *gStatusCode    = &gStatusCodeInstance;
+
+
+//
+// DXE Core Global used to update core loaded image protocol handle
+//
+EFI_GUID                           *gDxeCoreFileName;
+EFI_LOADED_IMAGE_PROTOCOL          *gDxeCoreLoadedImage;
+
+
+
+//
+// DXE Core Module Variables
+//
+
+EFI_BOOT_SERVICES mBootServices = {
+  {
+    EFI_BOOT_SERVICES_SIGNATURE,                                                          // Signature
+    EFI_BOOT_SERVICES_REVISION,                                                           // Revision
+    sizeof (EFI_BOOT_SERVICES),                                                           // HeaderSize
+    0,                                                                                    // CRC32
+    0                                                                                     // Reserved
+  },                                                                                      
+  (EFI_RAISE_TPL)                               CoreRaiseTpl,                             // RaiseTPL
+  (EFI_RESTORE_TPL)                             CoreRestoreTpl,                           // RestoreTPL
+  (EFI_ALLOCATE_PAGES)                          CoreAllocatePages,                        // AllocatePages
+  (EFI_FREE_PAGES)                              CoreFreePages,                            // FreePages
+  (EFI_GET_MEMORY_MAP)                          CoreGetMemoryMap,                         // GetMemoryMap
+  (EFI_ALLOCATE_POOL)                           CoreAllocatePool,                         // AllocatePool
+  (EFI_FREE_POOL)                               CoreFreePool,                             // FreePool
+  (EFI_CREATE_EVENT)                            CoreCreateEvent,                          // CreateEvent
+  (EFI_SET_TIMER)                               CoreSetTimer,                             // SetTimer
+  (EFI_WAIT_FOR_EVENT)                          CoreWaitForEvent,                         // WaitForEvent
+  (EFI_SIGNAL_EVENT)                            CoreSignalEvent,                          // SignalEvent
+  (EFI_CLOSE_EVENT)                             CoreCloseEvent,                           // CloseEvent
+  (EFI_CHECK_EVENT)                             CoreCheckEvent,                           // CheckEvent
+  (EFI_INSTALL_PROTOCOL_INTERFACE)              CoreInstallProtocolInterface,             // InstallProtocolInterface
+  (EFI_REINSTALL_PROTOCOL_INTERFACE)            CoreReinstallProtocolInterface,           // ReinstallProtocolInterface
+  (EFI_UNINSTALL_PROTOCOL_INTERFACE)            CoreUninstallProtocolInterface,           // UninstallProtocolInterface
+  (EFI_HANDLE_PROTOCOL)                         CoreHandleProtocol,                       // HandleProtocol
+  (VOID *)                                      NULL,                                     // Reserved
+  (EFI_REGISTER_PROTOCOL_NOTIFY)                CoreRegisterProtocolNotify,               // RegisterProtocolNotify
+  (EFI_LOCATE_HANDLE)                           CoreLocateHandle,                         // LocateHandle
+  (EFI_LOCATE_DEVICE_PATH)                      CoreLocateDevicePath,                     // LocateDevicePath
+  (EFI_INSTALL_CONFIGURATION_TABLE)             CoreInstallConfigurationTable,            // InstallConfigurationTable
+  (EFI_IMAGE_LOAD)                              CoreLoadImage,                            // LoadImage
+  (EFI_IMAGE_START)                             CoreStartImage,                           // StartImage
+  (EFI_EXIT)                                    CoreExit,                                 // Exit
+  (EFI_IMAGE_UNLOAD)                            CoreUnloadImage,                          // UnloadImage
+  (EFI_EXIT_BOOT_SERVICES)                      CoreExitBootServices,                     // ExitBootServices
+  (EFI_GET_NEXT_MONOTONIC_COUNT)                CoreEfiNotAvailableYetArg1,               // GetNextMonotonicCount
+  (EFI_STALL)                                   CoreStall,                                // Stall
+  (EFI_SET_WATCHDOG_TIMER)                      CoreSetWatchdogTimer,                     // SetWatchdogTimer
+  (EFI_CONNECT_CONTROLLER)                      CoreConnectController,                    // ConnectController
+  (EFI_DISCONNECT_CONTROLLER)                   CoreDisconnectController,                 // DisconnectController
+  (EFI_OPEN_PROTOCOL)                           CoreOpenProtocol,                         // OpenProtocol
+  (EFI_CLOSE_PROTOCOL)                          CoreCloseProtocol,                        // CloseProtocol
+  (EFI_OPEN_PROTOCOL_INFORMATION)               CoreOpenProtocolInformation,              // OpenProtocolInformation
+  (EFI_PROTOCOLS_PER_HANDLE)                    CoreProtocolsPerHandle,                   // ProtocolsPerHandle
+  (EFI_LOCATE_HANDLE_BUFFER)                    CoreLocateHandleBuffer,                   // LocateHandleBuffer
+  (EFI_LOCATE_PROTOCOL)                         CoreLocateProtocol,                       // LocateProtocol
+  (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)    CoreInstallMultipleProtocolInterfaces,    // InstallMultipleProtocolInterfaces
+  (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)  CoreUninstallMultipleProtocolInterfaces,  // UninstallMultipleProtocolInterfaces
+  (EFI_CALCULATE_CRC32)                         CoreEfiNotAvailableYetArg3,               // CalculateCrc32
+  (EFI_COPY_MEM)                                CopyMem,                                  // CopyMem
+  (EFI_SET_MEM)                                 SetMem                                    // SetMem
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+  ,                                   
+  (EFI_CREATE_EVENT_EX)                          CoreCreateEventEx                         // CreateEventEx
+#endif
+};
+
+EFI_DXE_SERVICES mDxeServices = {
+  {
+    EFI_DXE_SERVICES_SIGNATURE,                                           // Signature
+    EFI_DXE_SERVICES_REVISION,                                            // Revision
+    sizeof (EFI_DXE_SERVICES),                                            // HeaderSize
+    0,                                                                    // CRC32
+    0                                                                     // Reserved
+  },
+  (EFI_ADD_MEMORY_SPACE)             CoreAddMemorySpace,                  // AddMemorySpace
+  (EFI_ALLOCATE_MEMORY_SPACE)        CoreAllocateMemorySpace,             // AllocateMemorySpace
+  (EFI_FREE_MEMORY_SPACE)            CoreFreeMemorySpace,                 // FreeMemorySpace
+  (EFI_REMOVE_MEMORY_SPACE)          CoreRemoveMemorySpace,               // RemoveMemorySpace
+  (EFI_GET_MEMORY_SPACE_DESCRIPTOR)  CoreGetMemorySpaceDescriptor,        // GetMemorySpaceDescriptor
+  (EFI_SET_MEMORY_SPACE_ATTRIBUTES)  CoreSetMemorySpaceAttributes,        // SetMemorySpaceAttributes
+  (EFI_GET_MEMORY_SPACE_MAP)         CoreGetMemorySpaceMap,               // GetMemorySpaceMap
+  (EFI_ADD_IO_SPACE)                 CoreAddIoSpace,                      // AddIoSpace
+  (EFI_ALLOCATE_IO_SPACE)            CoreAllocateIoSpace,                 // AllocateIoSpace
+  (EFI_FREE_IO_SPACE)                CoreFreeIoSpace,                     // FreeIoSpace
+  (EFI_REMOVE_IO_SPACE)              CoreRemoveIoSpace,                   // RemoveIoSpace
+  (EFI_GET_IO_SPACE_DESCRIPTOR)      CoreGetIoSpaceDescriptor,            // GetIoSpaceDescriptor
+  (EFI_GET_IO_SPACE_MAP)             CoreGetIoSpaceMap,                   // GetIoSpaceMap
+  (EFI_DISPATCH)                     CoreDispatcher,                      // Dispatch
+  (EFI_SCHEDULE)                     CoreSchedule,                        // Schedule
+  (EFI_TRUST)                        CoreTrust,                           // Trust
+  (EFI_PROCESS_FIRMWARE_VOLUME)      CoreProcessFirmwareVolume,           // ProcessFirmwareVolume
+};
+
+EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
+  {
+    EFI_SYSTEM_TABLE_SIGNATURE,                                           // Signature
+    EFI_SYSTEM_TABLE_REVISION,                                            // Revision
+    sizeof (EFI_SYSTEM_TABLE),                                            // HeaderSize
+    0,                                                                    // CRC32
+    0                                                                     // Reserved
+  },
+  NULL,                                                                   // FirmwareVendor
+  0,                                                                      // FirmwareRevision
+  NULL,                                                                   // ConsoleInHandle
+  NULL,                                                                   // ConIn
+  NULL,                                                                   // ConsoleOutHandle
+  NULL,                                                                   // ConOut
+  NULL,                                                                   // StandardErrorHandle
+  NULL,                                                                   // StdErr
+  NULL,                                                                   // RuntimeServices
+  &mBootServices,                                                         // BootServices
+  0,                                                                      // NumberOfConfigurationTableEntries
+  NULL                                                                    // ConfigurationTable
+};
+
+EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
+  {
+    EFI_RUNTIME_SERVICES_SIGNATURE,                               // Signature
+    EFI_RUNTIME_SERVICES_REVISION,                                // Revision
+    sizeof (EFI_RUNTIME_SERVICES),                                // HeaderSize
+    0,                                                            // CRC32
+    0                                                             // Reserved
+  },
+  (EFI_GET_TIME)                 CoreEfiNotAvailableYetArg2,      // GetTime
+  (EFI_SET_TIME)                 CoreEfiNotAvailableYetArg1,      // SetTime
+  (EFI_GET_WAKEUP_TIME)          CoreEfiNotAvailableYetArg3,      // GetWakeupTime
+  (EFI_SET_WAKEUP_TIME)          CoreEfiNotAvailableYetArg2,      // SetWakeupTime
+  (EFI_SET_VIRTUAL_ADDRESS_MAP)  CoreEfiNotAvailableYetArg4,      // SetVirtualAddressMap
+  (EFI_CONVERT_POINTER)          CoreEfiNotAvailableYetArg2,      // ConvertPointer
+  (EFI_GET_VARIABLE)             CoreEfiNotAvailableYetArg5,      // GetVariable
+  (EFI_GET_NEXT_VARIABLE_NAME)   CoreEfiNotAvailableYetArg3,      // GetNextVariableName
+  (EFI_SET_VARIABLE)             CoreEfiNotAvailableYetArg5,      // SetVariable
+  (EFI_GET_NEXT_HIGH_MONO_COUNT) CoreEfiNotAvailableYetArg1,      // GetNextHighMonotonicCount
+  (EFI_RESET_SYSTEM)             CoreEfiNotAvailableYetArg4       // ResetSystem 
+#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION <  0x00020000))
+  ,
+  (TIANO_REPORT_STATUS_CODE)       CoreEfiNotAvailableYetArg5     // ReportStatusCode
+#elif (EFI_SPECIFICATION_VERSION >= 0x00020000)
+  ,
+  (EFI_UPDATE_CAPSULE)              CoreEfiNotAvailableYetArg3,   // UpdateCapsule
+  (EFI_QUERY_CAPSULE_CAPABILITIES)  CoreEfiNotAvailableYetArg4,   // QueryCapsuleCapabilities
+  (EFI_QUERY_VARIABLE_INFO)         CoreEfiNotAvailableYetArg4    // QueryVariableInfo
+#endif
+};
+
+//
+// DXE Core Global Variables for the EFI System Table, Boot Services Table, 
+// DXE Services Table, and Runtime Services Table
+//
+EFI_BOOT_SERVICES     *gBS = &mBootServices;
+EFI_DXE_SERVICES      *gDS = &mDxeServices;
+EFI_SYSTEM_TABLE      *gST = NULL;
+
+//
+// For debug initialize gRT to template. gRT must be allocated from RT memory
+//  but gRT is used for ASSERT () and DEBUG () type macros so lets give it
+//  a value that will not cause debug infrastructure to crash early on.
+//
+EFI_RUNTIME_SERVICES  *gRT = &mEfiRuntimeServicesTableTemplate;
+EFI_HANDLE            gDxeCoreImageHandle = NULL;
+
+VOID  *mHobStart;
+
+//
+// EFI Decompress Protocol
+//
+EFI_DECOMPRESS_PROTOCOL  gEfiDecompress = {
+  DxeMainUefiDecompressGetInfo,
+  DxeMainUefiDecompress
+};
+
+//
+// Tiano Decompress Protocol
+//
+EFI_TIANO_DECOMPRESS_PROTOCOL  gEfiTianoDecompress = {
+  DxeMainTianoDecompressGetInfo,
+  DxeMainTianoDecompress
+};
+
+//
+// Customized Decompress Protocol
+//
+EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  gEfiCustomizedDecompress = {
+  DxeMainCustomDecompressGetInfo,
+  DxeMainCustomDecompress
+};
+
+//
+// Main entry point to the DXE Core
+//
+VOID
+EFIAPI
+DxeMain (
+  IN  VOID *HobStart
+  )
+/*++
+
+Routine Description:
+
+  Main entry point to DXE Core.
+
+Arguments:
+
+  HobStart - Pointer to the beginning of the HOB List from PEI
+
+Returns:
+
+  This function should never return
+
+--*/
+{
+  EFI_STATUS                         Status;
+  EFI_PHYSICAL_ADDRESS               MemoryBaseAddress;
+  UINT64                             MemoryLength;
+
+#ifdef EFI_DXE_PERFORMANCE
+  UINT64                             Tick;
+
+  GetTimerValue (&Tick);
+#endif
+
+  mHobStart = HobStart;
+
+  //
+  // Initialize Memory Services
+  //
+  CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength);
+
+  //
+  // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
+  // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
+  //
+  gST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
+  ASSERT (gST != NULL);
+
+  gRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
+  ASSERT (gRT != NULL);
+
+  gST->RuntimeServices = gRT;
+  
+  //
+  // Start the Image Services.
+  //
+  Status = CoreInitializeImageServices (HobStart);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Call constructor for all libraries
+  //
+  ProcessLibraryConstructorList (gDxeCoreImageHandle, gST);
+
+  //
+  // Initialize the Global Coherency Domain Services
+  //
+  Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Install the DXE Services Table into the EFI System Tables's Configuration Table
+  //
+  Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDS);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Install the HOB List into the EFI System Tables's Configuration Table
+  //
+  Status = CoreInstallConfigurationTable (&gEfiHobListGuid, HobStart);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Install Memory Type Information Table into the EFI System Tables's Configuration Table
+  //
+  Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Initialize the ReportStatusCode with PEI version, if availible
+  //
+  CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **)&gStatusCode->ReportStatusCode);
+#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))
+  gRT->ReportStatusCode = gStatusCode->ReportStatusCode;
+#endif
+
+  //
+  // Report Status Code here for DXE_ENTRY_POINT once it is available
+  //
+  CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT));
+
+  //
+  // Create the aligned system table pointer structure that is used by external
+  // debuggers to locate the system table...  Also, install debug image info
+  // configuration table.
+  //
+  CoreInitializeDebugImageInfoTable ();
+  CoreNewDebugImageInfoEntry (
+    EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,
+    gDxeCoreLoadedImage,
+    gDxeCoreImageHandle
+    );
+
+  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "HOBLIST address in DXE = 0x%08x\n", HobStart));
+
+  //
+  // Initialize the Event Services
+  //
+  Status = CoreInitializeEventServices ();
+  ASSERT_EFI_ERROR (Status);
+
+   
+  //
+  // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs
+  //
+  // These Protocols are not architectural. This implementation is sharing code between 
+  // PEI and DXE in order to save FLASH space. These Protocols could also be implemented 
+  // as part of the DXE Core. However, that would also require the DXE Core to be ported 
+  // each time a different CPU is used, a different Decompression algorithm is used, or a 
+  // different Image type is used. By placing these Protocols in PEI, the DXE Core remains 
+  // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform, 
+  // and from CPU to CPU.
+  //
+
+  //
+  // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components
+  //   
+  Status = CoreInstallMultipleProtocolInterfaces (
+              &mDecompressHandle,
+              &gEfiDecompressProtocolGuid,           &gEfiDecompress,
+              &gEfiTianoDecompressProtocolGuid,      &gEfiTianoDecompress,
+              &gEfiCustomizedDecompressProtocolGuid, &gEfiCustomizedDecompress,
+              NULL
+              );
+  ASSERT_EFI_ERROR (Status);
+
+  gEfiPeiPeCoffLoader = GetPeCoffLoaderProtocol ();
+  ASSERT (gEfiPeiPeCoffLoader != NULL);
+
+  //
+  // Register for the GUIDs of the Architectural Protocols, so the rest of the
+  // EFI Boot Services and EFI Runtime Services tables can be filled in.
+  //
+  CoreNotifyOnArchProtocolInstallation ();
+
+  //
+  // Produce Firmware Volume Protocols, one for each FV in the HOB list.
+  //
+  Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gST);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = FwVolDriverInit (gDxeCoreImageHandle, gST);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Produce the Section Extraction Protocol 
+  //
+  Status = InitializeSectionExtraction (gDxeCoreImageHandle, gST);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Initialize the DXE Dispatcher
+  //
+  PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
+  CoreInitializeDispatcher ();
+  PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
+
+  //
+  // Invoke the DXE Dispatcher
+  //
+  PERF_START (0, "CoreDispatcher", "DxeMain", 0);
+  CoreDispatcher ();
+  PERF_END (0, "CoreDispatcher", "DxeMain", 0);
+
+  //
+  // Display Architectural protocols that were not loaded if this is DEBUG build
+  //
+  DEBUG_CODE (
+    CoreDisplayMissingArchProtocols ();
+  );
+  
+  //
+  // Assert if the Architectural Protocols are not present.
+  //
+  ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());
+
+  //
+  // Report Status code before transfer control to BDS
+  //
+  CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT));
+  //
+  // Display any drivers that were not dispatched because dependency expression
+  // evaluated to false if this is a debug build
+  //
+  DEBUG_CODE (
+    CoreDisplayDiscoveredNotDispatched ();
+  );
+
+  //
+  // Transfer control to the BDS Architectural Protocol
+  //
+  gBds->Entry (gBds);
+  
+  //
+  // BDS should never return
+  //
+  ASSERT (FALSE);
+  CpuDeadLoop ();
+}
+
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg0 (
+  VOID
+  )
+/*++
+
+Routine Description:
+
+  Place holder function until all the Boot Services and Runtime Services are available
+
+Arguments:
+
+  None
+
+Returns:
+
+  EFI_NOT_AVAILABLE_YET
+
+--*/
+{
+  //
+  // This function should never be executed.  If it does, then the architectural protocols
+  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the
+  // DXE Core and all the Architectural Protocols are complete.
+  //
+
+  return EFI_NOT_AVAILABLE_YET;
+}
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg1 (
+  UINTN Arg1
+  )
+/*++
+
+Routine Description:
+
+  Place holder function until all the Boot Services and Runtime Services are available
+
+Arguments:
+
+  Arg1        - Undefined
+
+Returns:
+
+  EFI_NOT_AVAILABLE_YET
+
+--*/
+{
+  //
+  // This function should never be executed.  If it does, then the architectural protocols
+  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the
+  // DXE Core and all the Architectural Protocols are complete.
+  //
+
+  return EFI_NOT_AVAILABLE_YET;
+}
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg2 (
+  UINTN Arg1,
+  UINTN Arg2
+  )
+/*++
+
+Routine Description:
+
+  Place holder function until all the Boot Services and Runtime Services are available
+
+Arguments:
+
+  Arg1        - Undefined
+  
+  Arg2        - Undefined
+
+Returns:
+
+  EFI_NOT_AVAILABLE_YET
+
+--*/
+{
+  //
+  // This function should never be executed.  If it does, then the architectural protocols
+  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the
+  // DXE Core and all the Architectural Protocols are complete.
+  //
+
+  return EFI_NOT_AVAILABLE_YET;
+}
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg3 (
+  UINTN Arg1,
+  UINTN Arg2,
+  UINTN Arg3
+  )
+/*++
+
+Routine Description:
+
+  Place holder function until all the Boot Services and Runtime Services are available
+
+Arguments:
+
+  Arg1        - Undefined
+  
+  Arg2        - Undefined
+  
+  Arg3        - Undefined
+
+Returns:
+
+  EFI_NOT_AVAILABLE_YET
+
+--*/
+{
+  //
+  // This function should never be executed.  If it does, then the architectural protocols
+  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the
+  // DXE Core and all the Architectural Protocols are complete.
+  //
+
+  return EFI_NOT_AVAILABLE_YET;
+}
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg4 (
+  UINTN Arg1,
+  UINTN Arg2,
+  UINTN Arg3,
+  UINTN Arg4
+  )
+/*++
+
+Routine Description:
+
+  Place holder function until all the Boot Services and Runtime Services are available
+
+Arguments:
+
+  Arg1        - Undefined
+  
+  Arg2        - Undefined
+  
+  Arg3        - Undefined
+  
+  Arg4        - Undefined
+
+Returns:
+
+  EFI_NOT_AVAILABLE_YET
+
+--*/
+{
+  //
+  // This function should never be executed.  If it does, then the architectural protocols
+  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the
+  // DXE Core and all the Architectural Protocols are complete.
+  //
+
+  return EFI_NOT_AVAILABLE_YET;
+}
+
+EFI_STATUS
+EFIAPI
+CoreEfiNotAvailableYetArg5 (
+  UINTN Arg1,
+  UINTN Arg2,
+  UINTN Arg3,
+  UINTN Arg4,
+  UINTN Arg5
+  )
+/*++
+
+Routine Description:
+
+  Place holder function until all the Boot Services and Runtime Services are available
+
+Arguments:
+
+  Arg1        - Undefined
+  
+  Arg2        - Undefined
+  
+  Arg3        - Undefined
+  
+  Arg4        - Undefined
+  
+  Arg5        - Undefined
+
+Returns:
+
+  EFI_NOT_AVAILABLE_YET
+
+--*/
+{
+  //
+  // This function should never be executed.  If it does, then the architectural protocols
+  // have not been designed correctly.  The CpuBreakpoint () is commented out for now until the
+  // DXE Core and all the Architectural Protocols are complete.
+  //
+
+  return EFI_NOT_AVAILABLE_YET;
+}
+
+
+EFI_STATUS
+CoreGetPeiProtocol (
+  IN EFI_GUID  *ProtocolGuid,
+  IN VOID      **Interface
+  )
+/*++
+
+Routine Description:
+
+  Searches for a Protocol Interface passed from PEI through a HOB
+
+Arguments:
+
+  ProtocolGuid - The Protocol GUID to search for in the HOB List
+
+  Interface    - A pointer to the interface for the Protocol GUID
+
+Returns:
+
+  EFI_SUCCESS   - The Protocol GUID was found and its interface is returned in Interface
+
+  EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
+
+--*/
+{
+  EFI_HOB_GUID_TYPE   *GuidHob;
+  VOID                *Buffer;
+
+  GuidHob = GetNextGuidHob (ProtocolGuid, mHobStart);
+  if (GuidHob == NULL) {
+    return EFI_NOT_FOUND;
+  }
+  
+  Buffer = GET_GUID_HOB_DATA (GuidHob);
+  ASSERT (Buffer != NULL);
+
+  *Interface = (VOID *)(*(UINTN *)(Buffer));
+
+  return EFI_SUCCESS;
+}
+
+
+VOID
+CalculateEfiHdrCrc (
+  IN  OUT EFI_TABLE_HEADER    *Hdr
+  )
+/*++
+
+Routine Description:
+
+  Calcualte the 32-bit CRC in a EFI table using the service provided by the
+  gRuntime service.
+
+Arguments:
+
+  Hdr  - Pointer to an EFI standard header
+
+Returns:
+
+  None
+
+--*/
+{
+  UINT32 Crc;
+
+  Hdr->CRC32 = 0;
+  
+  //
+  // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
+  //  Crc will come back as zero if we set it to zero here
+  //
+  Crc = 0;
+  gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
+  Hdr->CRC32 = Crc; 
+}
+
+
+
+EFI_STATUS
+EFIAPI
+CoreExitBootServices (
+  IN EFI_HANDLE   ImageHandle,
+  IN UINTN        MapKey
+  )
+/*++
+
+Routine Description:
+
+  EFI 1.0 API to terminate Boot Services
+
+Arguments:
+
+  ImageHandle  - Handle that represents the identity of the calling image
+
+  MapKey -Key to the latest memory map.
+
+Returns:
+
+  EFI_SUCCESS - Boot Services terminated
+  EFI_INVALID_PARAMETER - MapKey is incorrect.
+
+--*/
+{
+  EFI_STATUS    Status;
+
+  //
+  // Terminate memory services if the MapKey matches
+  //
+  Status = CoreTerminateMemoryMap (MapKey);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  //
+  // Notify other drivers that we are exiting boot services.
+  //
+  CoreNotifySignalList (&gEfiEventExitBootServicesGuid);
+
+  //
+  // Disable Timer
+  //
+  gTimer->SetTimerPeriod (gTimer, 0);
+
+  //
+  // Disable CPU Interrupts
+  //
+  gCpu->DisableInterrupt (gCpu);
+
+  //
+  // Register Runtime events with the Runtime Architectural Protocol
+  //
+  CoreShutdownEventServices ();
+
+  //
+  // Register Runtime images with the Runtime Architectural Protocol
+  //
+  CoreShutdownImageServices ();
+
+  //
+  // Report that ExitBootServices() has been called
+  //
+  // We are using gEfiDxeServicesTableGuid as the caller ID for Dxe Core
+  //
+  CoreReportProgressCode ((EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES));
+
+  //
+  // Clear the non-runtime values of the EFI System Table
+  //
+  gST->BootServices        = NULL;
+  gST->ConIn               = NULL;
+  gST->ConsoleInHandle     = NULL;
+  gST->ConOut              = NULL;
+  gST->ConsoleOutHandle    = NULL;
+  gST->StdErr              = NULL;
+  gST->StandardErrorHandle = NULL;
+
+  //
+  // Recompute the 32-bit CRC of the EFI System Table
+  //
+  CalculateEfiHdrCrc (&gST->Hdr);
+
+  //
+  // Zero out the Boot Service Table
+  //
+  SetMem (gBS, sizeof (EFI_BOOT_SERVICES), 0);
+  gBS = NULL;
+
+  return Status;
+}
+
+EFI_STATUS
+DxeMainUefiDecompressGetInfo (
+  IN EFI_DECOMPRESS_PROTOCOL            *This,
+  IN   VOID                             *Source,
+  IN   UINT32                           SourceSize,
+  OUT  UINT32                           *DestinationSize,
+  OUT  UINT32                           *ScratchSize
+  )
+{
+  return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
+}
+
+EFI_STATUS
+EFIAPI
+DxeMainUefiDecompress (
+  IN EFI_DECOMPRESS_PROTOCOL              *This,
+  IN     VOID                             *Source,
+  IN     UINT32                           SourceSize,
+  IN OUT VOID                             *Destination,
+  IN     UINT32                           DestinationSize,
+  IN OUT VOID                             *Scratch,
+  IN     UINT32                           ScratchSize
+  )
+{
+  EFI_STATUS  Status;
+  UINT32      TestDestinationSize;
+  UINT32      TestScratchSize;
+
+  Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  return UefiDecompress (Source, Destination, Scratch);
+}
+
+EFI_STATUS
+DxeMainTianoDecompressGetInfo (
+  IN EFI_TIANO_DECOMPRESS_PROTOCOL      *This,
+  IN   VOID                             *Source,
+  IN   UINT32                           SourceSize,
+  OUT  UINT32                           *DestinationSize,
+  OUT  UINT32                           *ScratchSize
+  )
+{
+  return TianoDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
+}
+
+EFI_STATUS
+EFIAPI
+DxeMainTianoDecompress (
+  IN EFI_TIANO_DECOMPRESS_PROTOCOL        *This,
+  IN     VOID                             *Source,
+  IN     UINT32                           SourceSize,
+  IN OUT VOID                             *Destination,
+  IN     UINT32                           DestinationSize,
+  IN OUT VOID                             *Scratch,
+  IN     UINT32                           ScratchSize
+  )
+{
+  EFI_STATUS  Status;
+  UINT32      TestDestinationSize;
+  UINT32      TestScratchSize;
+
+  Status = TianoDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  return TianoDecompress (Source, Destination, Scratch);
+}
+
+EFI_STATUS
+DxeMainCustomDecompressGetInfo (
+  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,
+  IN   VOID                              *Source,
+  IN   UINT32                            SourceSize,
+  OUT  UINT32                            *DestinationSize,
+  OUT  UINT32                            *ScratchSize
+  )
+{
+  return CustomDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
+}
+
+EFI_STATUS
+EFIAPI
+DxeMainCustomDecompress (
+  IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL  *This,
+  IN     VOID                            *Source,
+  IN     UINT32                          SourceSize,
+  IN OUT VOID                            *Destination,
+  IN     UINT32                          DestinationSize,
+  IN OUT VOID                            *Scratch,
+  IN     UINT32                          ScratchSize
+  )
+{
+  EFI_STATUS  Status;
+  UINT32      TestDestinationSize;
+  UINT32      TestScratchSize;
+
+  Status = CustomDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  return CustomDecompress (Source, Destination, Scratch);
+}
+
index e839141..6751b18 100644 (file)
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-\r
-Module Name:\r
-\r
-    event.c\r
-\r
-Abstract:\r
-\r
-    EFI Event support\r
\r
---*/\r
-\r
-\r
-#include <DxeMain.h>\r
-\r
-//\r
-// Enumerate the valid types\r
-//\r
-UINT32 mEventTable[] = {\r
-  //\r
-  // 0x80000200       Timer event with a notification function that is\r
-  // queue when the event is signaled with SignalEvent()\r
-  //\r
-  EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_SIGNAL,\r
-  //\r
-  // 0x80000000       Timer event without a notification function. It can be\r
-  // signaled with SignalEvent() and checked with CheckEvent() or WaitForEvent().\r
-  //\r
-  EFI_EVENT_TIMER,\r
-  //\r
-  // 0x00000100       Generic event with a notification function that \r
-  // can be waited on with CheckEvent() or WaitForEvent()\r
-  //\r
-  EFI_EVENT_NOTIFY_WAIT,\r
-  //\r
-  // 0x00000200       Generic event with a notification function that \r
-  // is queue when the event is signaled with SignalEvent()\r
-  //\r
-  EFI_EVENT_NOTIFY_SIGNAL,\r
-  //\r
-  // 0x00000201       ExitBootServicesEvent.  \r
-  //\r
-  EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
-  //\r
-  // 0x60000202       SetVirtualAddressMapEvent.\r
-  //\r
-  EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
-\r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
-  //\r
-  // 0x00000203       ReadyToBootEvent.\r
-  //\r
-  EFI_EVENT_SIGNAL_READY_TO_BOOT,\r
-  //\r
-  // 0x00000204       LegacyBootEvent.\r
-  //\r
-  EFI_EVENT_SIGNAL_LEGACY_BOOT,\r
-  //\r
-  // 0x00000603       Signal all ReadyToBootEvents.\r
-  //\r
-  EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_READY_TO_BOOT,\r
-  //\r
-  // 0x00000604       Signal all LegacyBootEvents.\r
-  //\r
-  EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_LEGACY_BOOT,\r
-#endif\r
-\r
-  //\r
-  // 0x00000000       Generic event without a notification function. \r
-  // It can be signaled with SignalEvent() and checked with CheckEvent() \r
-  // or WaitForEvent().\r
-  //\r
-  0x00000000,\r
-  //\r
-  // 0x80000100       Timer event with a notification function that can be \r
-  // waited on with CheckEvent() or WaitForEvent()\r
-  //\r
-  EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_WAIT,\r
-};\r
-\r
-\r
-VOID\r
-CoreAcquireEventLock (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Enter critical section by acquiring the lock on gEventQueueLock.\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  CoreAcquireLock (&gEventQueueLock);\r
-}\r
-\r
-\r
-VOID\r
-CoreReleaseEventLock (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Exit critical section by releasing the lock on gEventQueueLock.\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  CoreReleaseLock (&gEventQueueLock);\r
-}\r
-\r
-\r
-EFI_STATUS\r
-CoreInitializeEventServices (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initializes "event" support and populates parts of the System and Runtime Table.\r
-\r
-Arguments:\r
-\r
-  None\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS - Always return success\r
-\r
---*/\r
-{\r
-  UINTN        Index;\r
-\r
-  for (Index=0; Index <= EFI_TPL_HIGH_LEVEL; Index++) {\r
-    InitializeListHead (&gEventQueue[Index]);\r
-  }\r
-\r
-  CoreInitializeTimer ();\r
-  \r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-CoreShutdownEventServices (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Register all runtime events to make sure they are still available after ExitBootService.\r
-\r
-Arguments:\r
-\r
-  None\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS - Always return success.\r
-\r
---*/\r
-{\r
-  LIST_ENTRY        *Link;\r
-  IEVENT            *Event;\r
-\r
-  //\r
-  // The Runtime AP is required for the core to function!\r
-  //\r
-  ASSERT (gRuntime != NULL);\r
-\r
-  for (Link = mRuntimeEventList.ForwardLink; Link != &mRuntimeEventList; Link = Link->ForwardLink) {\r
-    Event = CR (Link, IEVENT, RuntimeLink, EVENT_SIGNATURE);\r
-    gRuntime->RegisterEvent (\r
-                gRuntime, \r
-                Event->Type, \r
-                Event->NotifyTpl, \r
-                Event->NotifyFunction, \r
-                Event->NotifyContext, \r
-                (VOID **)Event\r
-                );\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-VOID\r
-CoreDispatchEventNotifies (\r
-  IN EFI_TPL      Priority\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Dispatches all pending events. \r
-\r
-Arguments:\r
-\r
-  Priority - The task priority level of event notifications to dispatch\r
-    \r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  IEVENT          *Event;\r
-  LIST_ENTRY      *Head;\r
-  \r
-  CoreAcquireEventLock ();\r
-  ASSERT (gEventQueueLock.OwnerTpl == Priority);\r
-  Head = &gEventQueue[Priority];\r
-\r
-  //\r
-  // Dispatch all the pending notifications\r
-  //\r
-  while (!IsListEmpty (Head)) {\r
-      \r
-    Event = CR (Head->ForwardLink, IEVENT, NotifyLink, EVENT_SIGNATURE);\r
-    RemoveEntryList (&Event->NotifyLink);\r
-\r
-    Event->NotifyLink.ForwardLink = NULL;\r
-\r
-    //\r
-    // Only clear the SIGNAL status if it is a SIGNAL type event.\r
-    // WAIT type events are only cleared in CheckEvent()\r
-    //\r
-    if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {\r
-      Event->SignalCount = 0;\r
-    }\r
-\r
-    CoreReleaseEventLock ();\r
-      \r
-    //\r
-    // Notify this event\r
-    //\r
-    ASSERT (Event->NotifyFunction != NULL);\r
-    Event->NotifyFunction (Event, Event->NotifyContext);\r
-\r
-    //\r
-    // Check for next pending event\r
-    //\r
-    CoreAcquireEventLock ();\r
-  }\r
-\r
-  gEventPending &= ~(1 << Priority);\r
-  CoreReleaseEventLock ();\r
-}\r
-\r
-\r
-VOID\r
-STATIC\r
-CoreNotifyEvent (\r
-  IN  IEVENT      *Event\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Queues the event's notification function to fire\r
-\r
-Arguments:\r
-\r
-  Event       - The Event to notify\r
-    \r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-\r
-  //\r
-  // Event database must be locked\r
-  //\r
-  ASSERT_LOCKED (&gEventQueueLock);\r
-\r
-  //\r
-  // If the event is queued somewhere, remove it\r
-  //\r
-\r
-  if (Event->NotifyLink.ForwardLink != NULL) {\r
-    RemoveEntryList (&Event->NotifyLink);\r
-    Event->NotifyLink.ForwardLink = NULL;\r
-  }\r
-\r
-  // \r
-  // Queue the event to the pending notification list\r
-  //\r
-\r
-  InsertTailList (&gEventQueue[Event->NotifyTpl], &Event->NotifyLink);\r
-  gEventPending |= (UINTN)(1 << Event->NotifyTpl);\r
-}\r
-\r
-\r
-\r
-VOID\r
-CoreNotifySignalList (\r
-  IN EFI_GUID     *EventGroup\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Signals all events in the EventGroup\r
-\r
-Arguments:\r
-  EventGroup - The list to signal\r
-    \r
-Returns:\r
-\r
-  None\r
-\r
---*/\r
-{\r
-  LIST_ENTRY              *Link;\r
-  LIST_ENTRY              *Head;\r
-  IEVENT                  *Event;\r
-\r
-  CoreAcquireEventLock ();\r
-\r
-  Head = &gEventSignalQueue;\r
-  for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {\r
-    Event = CR (Link, IEVENT, SignalLink, EVENT_SIGNATURE);\r
-    if (CompareGuid (&Event->EventGroup, EventGroup)) {\r
-      CoreNotifyEvent (Event);\r
-    }\r
-  }\r
-\r
-  CoreReleaseEventLock ();\r
-}\r
-\r
-\r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
-\r
-static\r
-VOID\r
-EFIAPI\r
-EventNofitySignalAllNullEvent (\r
-  IN EFI_EVENT                Event,\r
-  IN VOID                     *Context\r
-  )\r
-{\r
-  //\r
-  // This null event is a size efficent way to enusre that \r
-  // EFI_EVENT_NOTIFY_SIGNAL_ALL is error checked correctly.\r
-  // EFI_EVENT_NOTIFY_SIGNAL_ALL is now mapped into \r
-  // CreateEventEx() and this function is used to make the\r
-  // old error checking in CreateEvent() for Tiano extensions\r
-  // function.\r
-  //\r
-  return;\r
-}\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreCreateEvent (\r
-  IN UINT32                   Type,\r
-  IN EFI_TPL                  NotifyTpl,\r
-  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL\r
-  IN VOID                     *NotifyContext, OPTIONAL\r
-  OUT EFI_EVENT               *Event\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Creates a general-purpose event structure\r
-\r
-Arguments:\r
-  Type                - The type of event to create and its mode and attributes\r
-  NotifyTpl           - The task priority level of event notifications\r
-  NotifyFunction      - Pointer to the events notification function\r
-  NotifyContext       - Pointer to the notification functions context; corresponds to\r
-                        parameter "Context" in the notification function\r
-  Event               - Pointer to the newly created event if the call succeeds; undefined otherwise\r
-\r
-Returns:\r
-  EFI_SUCCESS           - The event structure was created\r
-  EFI_INVALID_PARAMETER - One of the parameters has an invalid value\r
-  EFI_OUT_OF_RESOURCES  - The event could not be allocated\r
-\r
---*/\r
-{ \r
-  EFI_GUID            *GuidPtr;\r
-  EFI_EVENT_NOTIFY    Function;\r
-  \r
-  GuidPtr = NULL;\r
-  Function = NotifyFunction;\r
-\r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
-  //\r
-  // Clear EFI_EVENT_NOFITY_SIGNAL_ALL (Tiano extension) as all events in the \r
-  //  EventGroup now have this property. So we need to filter it out.\r
-  //\r
-  if (Type & EFI_EVENT_NOTIFY_SIGNAL_ALL) {\r
-    Type &= ~EFI_EVENT_NOTIFY_SIGNAL_ALL;\r
-    Function = EventNofitySignalAllNullEvent;\r
-  }\r
-\r
-  //\r
-  // Map the Tiano extensions Events to CreateEventEx form\r
-  //\r
-  if (Type == EFI_EVENT_SIGNAL_READY_TO_BOOT) {\r
-    GuidPtr = &gEfiEventReadToBootGuid;\r
-  } else if (Type == EFI_EVENT_SIGNAL_LEGACY_BOOT) {\r
-    GuidPtr = &gEfiEventLegacyBootGuid\r
-  }\r
-#endif\r
-\r
-  //\r
-  // Convert EFI 1.10 Events to thier UEFI 2.0 CreateEventEx mapping\r
-  // \r
-  if (Type == EVENT_SIGNAL_EXIT_BOOT_SERVICES) {\r
-    GuidPtr = &gEfiEventExitBootServicesGuid;\r
-  } else if (Type == EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
-    GuidPtr = &gEfiEventVirtualAddressChangeGuid;\r
-  }\r
-  \r
-  return CoreCreateEventEx (Type, NotifyTpl, Function, NotifyContext, GuidPtr, Event);\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreCreateEventEx (\r
-  IN UINT32                   Type,\r
-  IN EFI_TPL                  NotifyTpl,\r
-  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL\r
-  IN CONST VOID               *NotifyContext, OPTIONAL\r
-  IN CONST EFI_GUID           *EventGroup,    OPTIONAL\r
-  OUT EFI_EVENT               *Event\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Creates a general-purpose event structure\r
-\r
-Arguments:\r
-  Type                - The type of event to create and its mode and attributes\r
-  NotifyTpl           - The task priority level of event notifications\r
-  NotifyFunction      - Pointer to the events notification function\r
-  NotifyContext       - Pointer to the notification functions context; corresponds to\r
-                        parameter "Context" in the notification function\r
-  EventGrout          - GUID for EventGroup if NULL act the same as gBS->CreateEvent().\r
-  Event               - Pointer to the newly created event if the call succeeds; undefined otherwise\r
-\r
-Returns:\r
-  EFI_SUCCESS           - The event structure was created\r
-  EFI_INVALID_PARAMETER - One of the parameters has an invalid value\r
-  EFI_OUT_OF_RESOURCES  - The event could not be allocated\r
-\r
---*/\r
-{\r
-  EFI_STATUS      Status;\r
-  IEVENT          *IEvent;\r
-  INTN            Index;\r
-\r
-\r
-  if ((Event == NULL) || (NotifyTpl == EFI_TPL_APPLICATION)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // Check to make sure no reserved flags are set\r
-  //\r
-  Status = EFI_INVALID_PARAMETER;\r
-  for (Index = 0; Index < (sizeof (mEventTable) / sizeof (UINT32)); Index++) {\r
-     if (Type == mEventTable[Index]) {\r
-       Status = EFI_SUCCESS;\r
-       break;\r
-     }\r
-  }\r
-  if(EFI_ERROR (Status)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // If it's a notify type of event, check its parameters\r
-  //\r
-  if ((Type & (EFI_EVENT_NOTIFY_WAIT | EFI_EVENT_NOTIFY_SIGNAL))) {\r
-    //\r
-    // Check for an invalid NotifyFunction or NotifyTpl\r
-    //\r
-    if ((NotifyFunction == NULL) || \r
-        (NotifyTpl < EFI_TPL_APPLICATION) || \r
-       (NotifyTpl >= EFI_TPL_HIGH_LEVEL)) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-\r
-  } else {\r
-    //\r
-    // No notification needed, zero ignored values\r
-    //\r
-    NotifyTpl = 0;\r
-    NotifyFunction = NULL;\r
-    NotifyContext = NULL;\r
-  }\r
-\r
-  //\r
-  // Allcoate and initialize a new event structure.\r
-  //\r
-  Status = CoreAllocatePool (\r
-             (Type & EFI_EVENT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData, \r
-             sizeof (IEVENT),\r
-             (VOID **)&IEvent\r
-             );\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-\r
-  SetMem (IEvent, sizeof (IEVENT), 0);\r
-\r
-  IEvent->Signature = EVENT_SIGNATURE;\r
-  IEvent->Type = Type;\r
-  \r
-  IEvent->NotifyTpl      = NotifyTpl;\r
-  IEvent->NotifyFunction = NotifyFunction;\r
-  IEvent->NotifyContext  = (VOID *)NotifyContext;\r
-  if (EventGroup != NULL) {\r
-    CopyGuid (&IEvent->EventGroup, EventGroup);\r
-    IEvent->ExFlag = TRUE;\r
-  }\r
-\r
-  *Event = IEvent;\r
-\r
-  if (Type & EFI_EVENT_RUNTIME) {\r
-    //\r
-    // Keep a list of all RT events so we can tell the RT AP.\r
-    //\r
-    InsertTailList (&mRuntimeEventList, &IEvent->RuntimeLink);\r
-  }\r
-\r
-  CoreAcquireEventLock ();\r
-  \r
-  if ((Type & EFI_EVENT_NOTIFY_SIGNAL) != 0x00000000) {\r
-    //\r
-    // The Event's NotifyFunction must be queued whenever the event is signaled\r
-    //\r
-    InsertHeadList (&gEventSignalQueue, &IEvent->SignalLink);\r
-  }\r
-  \r
-  CoreReleaseEventLock ();\r
-  \r
-  //\r
-  // Done\r
-  //\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreSignalEvent (\r
-  IN EFI_EVENT    UserEvent\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Signals the event.  Queues the event to be notified if needed\r
-    \r
-Arguments:\r
-\r
-  UserEvent - The event to signal\r
-    \r
-Returns:\r
-\r
-  EFI_INVALID_PARAMETER - Parameters are not valid.\r
-  \r
-  EFI_SUCCESS - The event was signaled.\r
-\r
---*/\r
-{\r
-  IEVENT          *Event;\r
-\r
-  Event = UserEvent;\r
-\r
-  if (Event == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (Event->Signature != EVENT_SIGNATURE) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  CoreAcquireEventLock ();\r
-\r
-  //\r
-  // If the event is not already signalled, do so\r
-  //\r
-\r
-  if (Event->SignalCount == 0x00000000) {\r
-    Event->SignalCount++;\r
-\r
-    //\r
-    // If signalling type is a notify function, queue it\r
-    //\r
-    if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {\r
-      if (Event->ExFlag) {\r
-        //\r
-        // The CreateEventEx() style requires all members of the Event Group \r
-        //  to be signaled. \r
-        //\r
-        CoreReleaseEventLock ();\r
-        CoreNotifySignalList (&Event->EventGroup);\r
-        CoreAcquireEventLock ();\r
-       } else {\r
-        CoreNotifyEvent (Event);\r
-      }\r
-    }\r
-  }\r
-\r
-  CoreReleaseEventLock ();\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreCheckEvent (\r
-  IN EFI_EVENT        UserEvent\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Check the status of an event\r
-    \r
-Arguments:\r
-\r
-  UserEvent - The event to check\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS           - The event is in the signaled state\r
-  EFI_NOT_READY         - The event is not in the signaled state\r
-  EFI_INVALID_PARAMETER - Event is of type EVT_NOTIFY_SIGNAL\r
-\r
---*/\r
-\r
-{\r
-  IEVENT      *Event;\r
-  EFI_STATUS  Status;\r
-\r
-  Event = UserEvent;\r
-\r
-  if (Event == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (Event->Signature != EVENT_SIGNATURE) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Status = EFI_NOT_READY;\r
-\r
-  if (!Event->SignalCount && (Event->Type & EFI_EVENT_NOTIFY_WAIT)) {\r
-\r
-    //\r
-    // Queue the wait notify function\r
-    //\r
-\r
-    CoreAcquireEventLock ();\r
-    if (!Event->SignalCount) {\r
-      CoreNotifyEvent (Event);\r
-    }\r
-    CoreReleaseEventLock ();\r
-  }\r
-\r
-  //\r
-  // If the even looks signalled, get the lock and clear it\r
-  //\r
-\r
-  if (Event->SignalCount) {\r
-    CoreAcquireEventLock ();\r
-\r
-    if (Event->SignalCount) {\r
-      Event->SignalCount = 0;\r
-      Status = EFI_SUCCESS;\r
-    }\r
-\r
-    CoreReleaseEventLock ();\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreWaitForEvent (\r
-  IN UINTN        NumberOfEvents,\r
-  IN EFI_EVENT    *UserEvents,\r
-  OUT UINTN       *UserIndex\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Stops execution until an event is signaled.\r
-    \r
-Arguments:\r
-\r
-  NumberOfEvents  - The number of events in the UserEvents array\r
-  UserEvents      - An array of EFI_EVENT\r
-  UserIndex       - Pointer to the index of the event which satisfied the wait condition\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS           - The event indicated by Index was signaled.\r
-  EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or \r
-                          Event was not a valid type\r
-  EFI_UNSUPPORTED       - The current TPL is not TPL_APPLICATION\r
-\r
---*/\r
-\r
-{\r
-  EFI_STATUS      Status;\r
-  UINTN           Index;\r
-\r
-  //\r
-  // Can only WaitForEvent at TPL_APPLICATION\r
-  //\r
-  if (gEfiCurrentTpl != EFI_TPL_APPLICATION) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  for(;;) {\r
-      \r
-    for(Index = 0; Index < NumberOfEvents; Index++) {\r
-\r
-      Status = CoreCheckEvent (UserEvents[Index]);\r
-\r
-      //\r
-      // provide index of event that caused problem\r
-      //\r
-      if (Status != EFI_NOT_READY) {\r
-        *UserIndex = Index;\r
-        return Status;\r
-      }\r
-    }\r
-\r
-    //\r
-    // This was the location of the Idle loop callback in EFI 1.x reference\r
-    // code. We don't have that concept in this base at this point.\r
-    // \r
-  }\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-CoreCloseEvent (\r
-  IN EFI_EVENT    UserEvent\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Closes an event and frees the event structure.\r
-    \r
-Arguments:\r
-\r
-  UserEvent - Event to close\r
-    \r
-Returns:\r
-\r
-  EFI_INVALID_PARAMETER - Parameters are not valid.\r
-  \r
-  EFI_SUCCESS - The event has been closed\r
-\r
---*/\r
-\r
-{\r
-  EFI_STATUS  Status;\r
-  IEVENT      *Event;\r
-\r
-  Event = UserEvent;\r
-\r
-  if (Event == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (Event->Signature != EVENT_SIGNATURE) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // If it's a timer event, make sure it's not pending\r
-  //\r
-  if (Event->Type & EFI_EVENT_TIMER) {\r
-    CoreSetTimer (Event, TimerCancel, 0);\r
-  }\r
-\r
-  CoreAcquireEventLock ();\r
-\r
-  //\r
-  // If the event is queued somewhere, remove it\r
-  //\r
-\r
-  if (Event->RuntimeLink.ForwardLink != NULL) {\r
-    RemoveEntryList (&Event->RuntimeLink);\r
-  }\r
-\r
-  if (Event->NotifyLink.ForwardLink != NULL) {\r
-    RemoveEntryList (&Event->NotifyLink);\r
-  }\r
-\r
-  if (Event->SignalLink.ForwardLink != NULL) {\r
-    RemoveEntryList (&Event->SignalLink);\r
-  }\r
-\r
-  CoreReleaseEventLock ();\r
-\r
-  //\r
-  // If the event is registered on a protocol notify, then remove it from the protocol database\r
-  //\r
-  CoreUnregisterProtocolNotify (Event);\r
-\r
-  Status = CoreFreePool (Event);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return Status;\r
-}\r
+/*++
+
+Copyright (c) 2006, Intel Corporation                                                         
+All rights reserved. This program and the accompanying materials                          
+are licensed and made available under the terms and conditions of the BSD License         
+which accompanies this distribution.  The full text of the license may be found at        
+http://opensource.org/licenses/bsd-license.php                                            
+                                                                                          
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+Module Name:
+
+    event.c
+
+Abstract:
+
+    EFI Event support
+--*/
+
+
+#include <DxeMain.h>
+
+//
+// Enumerate the valid types
+//
+UINT32 mEventTable[] = {
+  //
+  // 0x80000200       Timer event with a notification function that is
+  // queue when the event is signaled with SignalEvent()
+  //
+  EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_SIGNAL,
+  //
+  // 0x80000000       Timer event without a notification function. It can be
+  // signaled with SignalEvent() and checked with CheckEvent() or WaitForEvent().
+  //
+  EFI_EVENT_TIMER,
+  //
+  // 0x00000100       Generic event with a notification function that 
+  // can be waited on with CheckEvent() or WaitForEvent()
+  //
+  EFI_EVENT_NOTIFY_WAIT,
+  //
+  // 0x00000200       Generic event with a notification function that 
+  // is queue when the event is signaled with SignalEvent()
+  //
+  EFI_EVENT_NOTIFY_SIGNAL,
+  //
+  // 0x00000201       ExitBootServicesEvent.  
+  //
+  EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,
+  //
+  // 0x60000202       SetVirtualAddressMapEvent.
+  //
+  EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+  //
+  // 0x00000203       ReadyToBootEvent.
+  //
+  EFI_EVENT_SIGNAL_READY_TO_BOOT,
+  //
+  // 0x00000204       LegacyBootEvent.
+  //
+  EFI_EVENT_SIGNAL_LEGACY_BOOT,
+  //
+  // 0x00000603       Signal all ReadyToBootEvents.
+  //
+  EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_READY_TO_BOOT,
+  //
+  // 0x00000604       Signal all LegacyBootEvents.
+  //
+  EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_LEGACY_BOOT,
+#endif
+
+  //
+  // 0x00000000       Generic event without a notification function. 
+  // It can be signaled with SignalEvent() and checked with CheckEvent() 
+  // or WaitForEvent().
+  //
+  0x00000000,
+  //
+  // 0x80000100       Timer event with a notification function that can be 
+  // waited on with CheckEvent() or WaitForEvent()
+  //
+  EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_WAIT,
+};
+
+
+VOID
+CoreAcquireEventLock (
+  VOID
+  )
+/*++
+
+Routine Description:
+
+  Enter critical section by acquiring the lock on gEventQueueLock.
+
+Arguments:
+
+  None
+
+Returns:
+
+  None
+
+--*/
+{
+  CoreAcquireLock (&gEventQueueLock);
+}
+
+
+VOID
+CoreReleaseEventLock (
+  VOID
+  )
+/*++
+
+Routine Description:
+
+  Exit critical section by releasing the lock on gEventQueueLock.
+
+Arguments:
+
+  None
+
+Returns:
+
+  None
+
+--*/
+{
+  CoreReleaseLock (&gEventQueueLock);
+}
+
+
+EFI_STATUS
+CoreInitializeEventServices (
+  VOID
+  )
+/*++
+
+Routine Description:
+
+  Initializes "event" support and populates parts of the System and Runtime Table.
+
+Arguments:
+
+  None
+    
+Returns:
+
+  EFI_SUCCESS - Always return success
+
+--*/
+{
+  UINTN        Index;
+
+  for (Index=0; Index <= EFI_TPL_HIGH_LEVEL; Index++) {
+    InitializeListHead (&gEventQueue[Index]);
+  }
+
+  CoreInitializeTimer ();
+  
+  return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+CoreShutdownEventServices (
+  VOID
+  )
+/*++
+
+Routine Description:
+
+  Register all runtime events to make sure they are still available after ExitBootService.
+
+Arguments:
+
+  None
+    
+Returns:
+
+  EFI_SUCCESS - Always return success.
+
+--*/
+{
+  LIST_ENTRY        *Link;
+  IEVENT            *Event;
+
+  //
+  // The Runtime AP is required for the core to function!
+  //
+  ASSERT (gRuntime != NULL);
+
+  for (Link = mRuntimeEventList.ForwardLink; Link != &mRuntimeEventList; Link = Link->ForwardLink) {
+    Event = CR (Link, IEVENT, RuntimeLink, EVENT_SIGNATURE);
+    gRuntime->RegisterEvent (
+                gRuntime, 
+                Event->Type, 
+                Event->NotifyTpl, 
+                Event->NotifyFunction, 
+                Event->NotifyContext, 
+                (VOID **)Event
+                );
+  }
+
+  return EFI_SUCCESS;
+}
+
+
+VOID
+CoreDispatchEventNotifies (
+  IN EFI_TPL      Priority
+  )
+/*++
+
+Routine Description:
+
+  Dispatches all pending events. 
+
+Arguments:
+
+  Priority - The task priority level of event notifications to dispatch
+    
+Returns:
+
+  None
+
+--*/
+{
+  IEVENT          *Event;
+  LIST_ENTRY      *Head;
+  
+  CoreAcquireEventLock ();
+  ASSERT (gEventQueueLock.OwnerTpl == Priority);
+  Head = &gEventQueue[Priority];
+
+  //
+  // Dispatch all the pending notifications
+  //
+  while (!IsListEmpty (Head)) {
+      
+    Event = CR (Head->ForwardLink, IEVENT, NotifyLink, EVENT_SIGNATURE);
+    RemoveEntryList (&Event->NotifyLink);
+
+    Event->NotifyLink.ForwardLink = NULL;
+
+    //
+    // Only clear the SIGNAL status if it is a SIGNAL type event.
+    // WAIT type events are only cleared in CheckEvent()
+    //
+    if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {
+      Event->SignalCount = 0;
+    }
+
+    CoreReleaseEventLock ();
+      
+    //
+    // Notify this event
+    //
+    ASSERT (Event->NotifyFunction != NULL);
+    Event->NotifyFunction (Event, Event->NotifyContext);
+
+    //
+    // Check for next pending event
+    //
+    CoreAcquireEventLock ();
+  }
+
+  gEventPending &= ~(1 << Priority);
+  CoreReleaseEventLock ();
+}
+
+
+VOID
+STATIC
+CoreNotifyEvent (
+  IN  IEVENT      *Event
+  )
+/*++
+
+Routine Description:
+
+  Queues the event's notification function to fire
+
+Arguments:
+
+  Event       - The Event to notify
+    
+Returns:
+
+  None
+
+--*/
+{
+
+  //
+  // Event database must be locked
+  //
+  ASSERT_LOCKED (&gEventQueueLock);
+
+  //
+  // If the event is queued somewhere, remove it
+  //
+
+  if (Event->NotifyLink.ForwardLink != NULL) {
+    RemoveEntryList (&Event->NotifyLink);
+    Event->NotifyLink.ForwardLink = NULL;
+  }
+
+  // 
+  // Queue the event to the pending notification list
+  //
+
+  InsertTailList (&gEventQueue[Event->NotifyTpl], &Event->NotifyLink);
+  gEventPending |= (UINTN)(1 << Event->NotifyTpl);
+}
+
+
+
+VOID
+CoreNotifySignalList (
+  IN EFI_GUID     *EventGroup
+  )
+/*++
+
+Routine Description:
+  Signals all events in the EventGroup
+
+Arguments:
+  EventGroup - The list to signal
+    
+Returns:
+
+  None
+
+--*/
+{
+  LIST_ENTRY              *Link;
+  LIST_ENTRY              *Head;
+  IEVENT                  *Event;
+
+  CoreAcquireEventLock ();
+
+  Head = &gEventSignalQueue;
+  for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
+    Event = CR (Link, IEVENT, SignalLink, EVENT_SIGNATURE);
+    if (CompareGuid (&Event->EventGroup, EventGroup)) {
+      CoreNotifyEvent (Event);
+    }
+  }
+
+  CoreReleaseEventLock ();
+}
+
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+
+static
+VOID
+EFIAPI
+EventNofitySignalAllNullEvent (
+  IN EFI_EVENT                Event,
+  IN VOID                     *Context
+  )
+{
+  //
+  // This null event is a size efficent way to enusre that 
+  // EFI_EVENT_NOTIFY_SIGNAL_ALL is error checked correctly.
+  // EFI_EVENT_NOTIFY_SIGNAL_ALL is now mapped into 
+  // CreateEventEx() and this function is used to make the
+  // old error checking in CreateEvent() for Tiano extensions
+  // function.
+  //
+  return;
+}
+
+#endif
+
+
+
+
+EFI_STATUS
+EFIAPI
+CoreCreateEvent (
+  IN UINT32                   Type,
+  IN EFI_TPL                  NotifyTpl,
+  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL
+  IN VOID                     *NotifyContext, OPTIONAL
+  OUT EFI_EVENT               *Event
+  )
+/*++
+
+Routine Description:
+  Creates a general-purpose event structure
+
+Arguments:
+  Type                - The type of event to create and its mode and attributes
+  NotifyTpl           - The task priority level of event notifications
+  NotifyFunction      - Pointer to the events notification function
+  NotifyContext       - Pointer to the notification functions context; corresponds to
+                        parameter "Context" in the notification function
+  Event               - Pointer to the newly created event if the call succeeds; undefined otherwise
+
+Returns:
+  EFI_SUCCESS           - The event structure was created
+  EFI_INVALID_PARAMETER - One of the parameters has an invalid value
+  EFI_OUT_OF_RESOURCES  - The event could not be allocated
+
+--*/
+{ 
+  EFI_GUID            *GuidPtr;
+  EFI_EVENT_NOTIFY    Function;
+  
+  GuidPtr = NULL;
+  Function = NotifyFunction;
+
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)
+  //
+  // Clear EFI_EVENT_NOFITY_SIGNAL_ALL (Tiano extension) as all events in the 
+  //  EventGroup now have this property. So we need to filter it out.
+  //
+  if (Type & EFI_EVENT_NOTIFY_SIGNAL_ALL) {
+    Type &= ~EFI_EVENT_NOTIFY_SIGNAL_ALL;
+    Function = EventNofitySignalAllNullEvent;
+  }
+
+  //
+  // Map the Tiano extensions Events to CreateEventEx form
+  //
+  if (Type == EFI_EVENT_SIGNAL_READY_TO_BOOT) {
+    GuidPtr = &gEfiEventReadyToBootGuid;
+  } else if (Type == EFI_EVENT_SIGNAL_LEGACY_BOOT) {
+    GuidPtr = &gEfiEventLegacyBootGuid
+  }
+#endif
+
+  //
+  // Convert EFI 1.10 Events to thier UEFI 2.0 CreateEventEx mapping
+  // 
+  if (Type == EVENT_SIGNAL_EXIT_BOOT_SERVICES) {
+    GuidPtr = &gEfiEventExitBootServicesGuid;
+  } else if (Type == EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {
+    GuidPtr = &gEfiEventVirtualAddressChangeGuid;
+  }
+  
+  return CoreCreateEventEx (Type, NotifyTpl, Function, NotifyContext, GuidPtr, Event);
+}
+
+
+EFI_STATUS
+EFIAPI
+CoreCreateEventEx (
+  IN UINT32                   Type,
+  IN EFI_TPL                  NotifyTpl,
+  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL
+  IN CONST VOID               *NotifyContext, OPTIONAL
+  IN CONST EFI_GUID           *EventGroup,    OPTIONAL
+  OUT EFI_EVENT               *Event
+  )
+/*++
+
+Routine Description:
+  Creates a general-purpose event structure
+
+Arguments:
+  Type                - The type of event to create and its mode and attributes
+  NotifyTpl           - The task priority level of event notifications
+  NotifyFunction      - Pointer to the events notification function
+  NotifyContext       - Pointer to the notification functions context; corresponds to
+                        parameter "Context" in the notification function
+  EventGrout          - GUID for EventGroup if NULL act the same as gBS->CreateEvent().
+  Event               - Pointer to the newly created event if the call succeeds; undefined otherwise
+
+Returns:
+  EFI_SUCCESS           - The event structure was created
+  EFI_INVALID_PARAMETER - One of the parameters has an invalid value
+  EFI_OUT_OF_RESOURCES  - The event could not be allocated
+
+--*/
+{
+  EFI_STATUS      Status;
+  IEVENT          *IEvent;
+  INTN            Index;
+
+
+  if ((Event == NULL) || (NotifyTpl == EFI_TPL_APPLICATION)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Check to make sure no reserved flags are set
+  //
+  Status = EFI_INVALID_PARAMETER;
+  for (Index = 0; Index < (sizeof (mEventTable) / sizeof (UINT32)); Index++) {
+     if (Type == mEventTable[Index]) {
+       Status = EFI_SUCCESS;
+       break;
+     }
+  }
+  if(EFI_ERROR (Status)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // If it's a notify type of event, check its parameters
+  //
+  if ((Type & (EFI_EVENT_NOTIFY_WAIT | EFI_EVENT_NOTIFY_SIGNAL))) {
+    //
+    // Check for an invalid NotifyFunction or NotifyTpl
+    //
+    if ((NotifyFunction == NULL) || 
+        (NotifyTpl < EFI_TPL_APPLICATION) || 
+       (NotifyTpl >= EFI_TPL_HIGH_LEVEL)) {
+      return EFI_INVALID_PARAMETER;
+    }
+
+  } else {
+    //
+    // No notification needed, zero ignored values
+    //
+    NotifyTpl = 0;
+    NotifyFunction = NULL;
+    NotifyContext = NULL;
+  }
+
+  //
+  // Allcoate and initialize a new event structure.
+  //
+  Status = CoreAllocatePool (
+             (Type & EFI_EVENT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData, 
+             sizeof (IEVENT),
+             (VOID **)&IEvent
+             );
+  if (EFI_ERROR (Status)) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  SetMem (IEvent, sizeof (IEVENT), 0);
+
+  IEvent->Signature = EVENT_SIGNATURE;
+  IEvent->Type = Type;
+  
+  IEvent->NotifyTpl      = NotifyTpl;
+  IEvent->NotifyFunction = NotifyFunction;
+  IEvent->NotifyContext  = (VOID *)NotifyContext;
+  if (EventGroup != NULL) {
+    CopyGuid (&IEvent->EventGroup, EventGroup);
+    IEvent->ExFlag = TRUE;
+  }
+
+  *Event = IEvent;
+
+  if (Type & EFI_EVENT_RUNTIME) {
+    //
+    // Keep a list of all RT events so we can tell the RT AP.
+    //
+    InsertTailList (&mRuntimeEventList, &IEvent->RuntimeLink);
+  }
+
+  CoreAcquireEventLock ();
+  
+  if ((Type & EFI_EVENT_NOTIFY_SIGNAL) != 0x00000000) {
+    //
+    // The Event's NotifyFunction must be queued whenever the event is signaled
+    //
+    InsertHeadList (&gEventSignalQueue, &IEvent->SignalLink);
+  }
+  
+  CoreReleaseEventLock ();
+  
+  //
+  // Done
+  //
+  return EFI_SUCCESS;
+}
+
+
+
+EFI_STATUS
+EFIAPI
+CoreSignalEvent (
+  IN EFI_EVENT    UserEvent
+  )
+/*++
+
+Routine Description:
+
+  Signals the event.  Queues the event to be notified if needed
+    
+Arguments:
+
+  UserEvent - The event to signal
+    
+Returns:
+
+  EFI_INVALID_PARAMETER - Parameters are not valid.
+  
+  EFI_SUCCESS - The event was signaled.
+
+--*/
+{
+  IEVENT          *Event;
+
+  Event = UserEvent;
+
+  if (Event == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (Event->Signature != EVENT_SIGNATURE) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  CoreAcquireEventLock ();
+
+  //
+  // If the event is not already signalled, do so
+  //
+
+  if (Event->SignalCount == 0x00000000) {
+    Event->SignalCount++;
+
+    //
+    // If signalling type is a notify function, queue it
+    //
+    if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {
+      if (Event->ExFlag) {
+        //
+        // The CreateEventEx() style requires all members of the Event Group 
+        //  to be signaled. 
+        //
+        CoreReleaseEventLock ();
+        CoreNotifySignalList (&Event->EventGroup);
+        CoreAcquireEventLock ();
+       } else {
+        CoreNotifyEvent (Event);
+      }
+    }
+  }
+
+  CoreReleaseEventLock ();
+  return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+EFIAPI
+CoreCheckEvent (
+  IN EFI_EVENT        UserEvent
+  )
+/*++
+
+Routine Description:
+
+  Check the status of an event
+    
+Arguments:
+
+  UserEvent - The event to check
+    
+Returns:
+
+  EFI_SUCCESS           - The event is in the signaled state
+  EFI_NOT_READY         - The event is not in the signaled state
+  EFI_INVALID_PARAMETER - Event is of type EVT_NOTIFY_SIGNAL
+
+--*/
+
+{
+  IEVENT      *Event;
+  EFI_STATUS  Status;
+
+  Event = UserEvent;
+
+  if (Event == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (Event->Signature != EVENT_SIGNATURE) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Status = EFI_NOT_READY;
+
+  if (!Event->SignalCount && (Event->Type & EFI_EVENT_NOTIFY_WAIT)) {
+
+    //
+    // Queue the wait notify function
+    //
+
+    CoreAcquireEventLock ();
+    if (!Event->SignalCount) {
+      CoreNotifyEvent (Event);
+    }
+    CoreReleaseEventLock ();
+  }
+
+  //
+  // If the even looks signalled, get the lock and clear it
+  //
+
+  if (Event->SignalCount) {
+    CoreAcquireEventLock ();
+
+    if (Event->SignalCount) {
+      Event->SignalCount = 0;
+      Status = EFI_SUCCESS;
+    }
+
+    CoreReleaseEventLock ();
+  }
+
+  return Status;
+}
+
+
+
+EFI_STATUS
+EFIAPI
+CoreWaitForEvent (
+  IN UINTN        NumberOfEvents,
+  IN EFI_EVENT    *UserEvents,
+  OUT UINTN       *UserIndex
+  )
+/*++
+
+Routine Description:
+
+  Stops execution until an event is signaled.
+    
+Arguments:
+
+  NumberOfEvents  - The number of events in the UserEvents array
+  UserEvents      - An array of EFI_EVENT
+  UserIndex       - Pointer to the index of the event which satisfied the wait condition
+    
+Returns:
+
+  EFI_SUCCESS           - The event indicated by Index was signaled.
+  EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or 
+                          Event was not a valid type
+  EFI_UNSUPPORTED       - The current TPL is not TPL_APPLICATION
+
+--*/
+
+{
+  EFI_STATUS      Status;
+  UINTN           Index;
+
+  //
+  // Can only WaitForEvent at TPL_APPLICATION
+  //
+  if (gEfiCurrentTpl != EFI_TPL_APPLICATION) {
+    return EFI_UNSUPPORTED;
+  }
+
+  for(;;) {
+      
+    for(Index = 0; Index < NumberOfEvents; Index++) {
+
+      Status = CoreCheckEvent (UserEvents[Index]);
+
+      //
+      // provide index of event that caused problem
+      //
+      if (Status != EFI_NOT_READY) {
+        *UserIndex = Index;
+        return Status;
+      }
+    }
+
+    //
+    // This was the location of the Idle loop callback in EFI 1.x reference
+    // code. We don't have that concept in this base at this point.
+    // 
+  }
+}
+
+
+EFI_STATUS
+EFIAPI
+CoreCloseEvent (
+  IN EFI_EVENT    UserEvent
+  )
+/*++
+
+Routine Description:
+
+  Closes an event and frees the event structure.
+    
+Arguments:
+
+  UserEvent - Event to close
+    
+Returns:
+
+  EFI_INVALID_PARAMETER - Parameters are not valid.
+  
+  EFI_SUCCESS - The event has been closed
+
+--*/
+
+{
+  EFI_STATUS  Status;
+  IEVENT      *Event;
+
+  Event = UserEvent;
+
+  if (Event == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (Event->Signature != EVENT_SIGNATURE) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // If it's a timer event, make sure it's not pending
+  //
+  if (Event->Type & EFI_EVENT_TIMER) {
+    CoreSetTimer (Event, TimerCancel, 0);
+  }
+
+  CoreAcquireEventLock ();
+
+  //
+  // If the event is queued somewhere, remove it
+  //
+
+  if (Event->RuntimeLink.ForwardLink != NULL) {
+    RemoveEntryList (&Event->RuntimeLink);
+  }
+
+  if (Event->NotifyLink.ForwardLink != NULL) {
+    RemoveEntryList (&Event->NotifyLink);
+  }
+
+  if (Event->SignalLink.ForwardLink != NULL) {
+    RemoveEntryList (&Event->SignalLink);
+  }
+
+  CoreReleaseEventLock ();
+
+  //
+  // If the event is registered on a protocol notify, then remove it from the protocol database
+  //
+  CoreUnregisterProtocolNotify (Event);
+
+  Status = CoreFreePool (Event);
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
index a604fcc..3b5ae36 100644 (file)
@@ -1,63 +1,63 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">\r
-  <MbdHeader>\r
-    <BaseName>DxeIpl</BaseName>\r
-    <Guid>86D70125-BAA3-4296-A62F-602BEBBB9081</Guid>\r
-    <Version>EDK_RELEASE_VERSION        0x00020000</Version>\r
-    <Description>FIX ME!</Description>\r
-    <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>\r
-    <License>\r
-      All rights reserved. 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
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-    </License>\r
-    <Created>2006-03-12 17:09</Created>\r
-    <Modified>2006-03-22 18:54</Modified>\r
-  </MbdHeader>\r
-  <Libraries>\r
-    <Library>PeimEntryPoint</Library>\r
-    <Library>PeiMemoryLib</Library>\r
-    <Library>PeiCoreLib</Library>\r
-    <Library>PeiServicesTablePointerLib</Library>\r
-    <Library>PeiHobLib</Library>\r
-    <Library>BaseCacheMaintenanceLib</Library>\r
-    <Library>BaseUefiTianoDecompressLib</Library>\r
-    <Library>BaseCustomDecompressLibNull</Library>\r
-    <Library>PeiReportStatusCodeLib</Library>\r
-    <Library>BaseDebugLibReportStatusCode</Library>\r
-    <Library>BaseLib</Library>\r
-    <Library>PeiMemoryAllocationLib</Library>\r
-    <Arch ArchType="IA32">\r
-      <Library OverrideID="8888">EdkPeCoffLoaderLib</Library>\r
-      <Library OverrideID="8888">BasePeCoffLib</Library>\r
-    </Arch>\r
-    <Arch ArchType="X64">\r
-      <Library>EdkPeCoffLoaderLib</Library>\r
-      <Library>BasePeCoffLib</Library>\r
-    </Arch>\r
-    <Arch ArchType="IPF">\r
-      <Library>EdkPeCoffLoaderLib</Library>\r
-      <Library>BasePeCoffLib</Library>\r
-    </Arch>\r
-    <Arch ArchType="EBC">\r
-      <Library>EdkPeCoffLoaderLib</Library>\r
-      <Library>BasePeCoffLib</Library>\r
-    </Arch>\r
-  </Libraries>\r
-  <BuildOptions ToolChain="MSFT">\r
-    <ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>\r
-  </BuildOptions>\r
-</ModuleBuildDescription>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+  <MbdHeader>
+    <BaseName>DxeIpl</BaseName>
+    <Guid>86D70125-BAA3-4296-A62F-602BEBBB9081</Guid>
+    <Version>EDK_RELEASE_VERSION        0x00020000</Version>
+    <Description>FIX ME!</Description>
+    <Copyright>Copyright (c) 2004-2006, Intel Corporation</Copyright>
+    <License>
+      All rights reserved. This program and the accompanying materials
+      are licensed and made available under the terms and conditions of the BSD License
+      which accompanies this distribution.  The full text of the license may be found at
+      http://opensource.org/licenses/bsd-license.php
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+    </License>
+    <Created>2006-03-12 17:09</Created>
+    <Modified>2006-03-22 18:54</Modified>
+  </MbdHeader>
+  <Libraries>
+    <Library>PeimEntryPoint</Library>
+    <Library>PeiMemoryLib</Library>
+    <Library>PeiCoreLib</Library>
+    <Library OverrideID="4444">PeiServicesTablePointerLib</Library>
+    <Library>PeiHobLib</Library>
+    <Library>BaseCacheMaintenanceLib</Library>
+    <Library>BaseUefiTianoDecompressLib</Library>
+    <Library>BaseCustomDecompressLibNull</Library>
+    <Library>PeiReportStatusCodeLib</Library>
+    <Library>BaseDebugLibReportStatusCode</Library>
+    <Library>BaseLib</Library>
+    <Library>PeiMemoryAllocationLib</Library>
+    <Arch ArchType="IA32">
+      <Library OverrideID="8888">EdkPeCoffLoaderLib</Library>
+      <Library OverrideID="8888">BasePeCoffLib</Library>
+    </Arch>
+    <Arch ArchType="X64">
+      <Library>EdkPeCoffLoaderLib</Library>
+      <Library>BasePeCoffLib</Library>
+    </Arch>
+    <Arch ArchType="IPF">
+      <Library>EdkPeCoffLoaderLib</Library>
+      <Library>BasePeCoffLib</Library>
+    </Arch>
+    <Arch ArchType="EBC">
+      <Library>EdkPeCoffLoaderLib</Library>
+      <Library>BasePeCoffLib</Library>
+    </Arch>
+  </Libraries>
+  <BuildOptions ToolChain="MSFT">
+    <ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
+  </BuildOptions>
+</ModuleBuildDescription>
index 2df91ec..ef039fc 100644 (file)
@@ -1,49 +1,49 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">\r
-  <MbdHeader>\r
-    <BaseName>DxeIpl</BaseName>\r
-    <Guid>86D70125-BAA3-4296-A62F-602BEBBB9081</Guid>\r
-    <Version>EDK_RELEASE_VERSION        0x00020000</Version>\r
-    <Description>FIX ME!</Description>\r
-    <Copyright>Copyright 2004-2006, Intel Corporation</Copyright>\r
-    <License>\r
-      All rights reserved. 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
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-    </License>\r
-    <Created>2006-04-03 23:58</Created>\r
-  </MbdHeader>\r
-  <Libraries>\r
-    <Library>PeimEntryPoint</Library>\r
-    <Library>PeiMemoryLib</Library>\r
-    <Library>PeiCoreLib</Library>\r
-    <Library>PeiServicesTablePointerLib</Library>\r
-    <Library>PeiHobLib</Library>\r
-    <Library>BaseCacheMaintenanceLib</Library>\r
-    <Library>BaseUefiTianoDecompressLib</Library>\r
-    <Library>BaseCustomDecompressLibNull</Library>\r
-    <Library>PeiReportStatusCodeLib</Library>\r
-    <Library>BaseDebugLibReportStatusCode</Library>\r
-    <Library>BaseLib</Library>\r
-    <Library>PeiMemoryAllocationLib</Library>\r
-    <Library>PeiReportStatusCodeLib</Library>\r
-    <Arch ArchType="IA32" OverrideID="8888">\r
-      <Library>EdkPeCoffLoaderX64Lib</Library>\r
-      <Library>EdkPeCoffLoaderLib</Library>\r
-      <Library>BasePeCoffLib</Library>\r
-    </Arch>\r
-  </Libraries>\r
-</ModuleBuildDescription>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+  <MbdHeader>
+    <BaseName>DxeIplX64</BaseName>
+    <Guid>86D70125-BAA3-4296-A62F-602BEBBB9081</Guid>
+    <Version>EDK_RELEASE_VERSION        0x00020000</Version>
+    <Description>FIX ME!</Description>
+    <Copyright>Copyright 2004-2006, Intel Corporation</Copyright>
+    <License>
+      All rights reserved. This program and the accompanying materials
+      are licensed and made available under the terms and conditions of the BSD License
+      which accompanies this distribution.  The full text of the license may be found at
+      http://opensource.org/licenses/bsd-license.php
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+    </License>
+    <Created>2006-04-03 23:58</Created>
+  </MbdHeader>
+  <Libraries>
+    <Library>PeimEntryPoint</Library>
+    <Library>PeiMemoryLib</Library>
+    <Library>PeiCoreLib</Library>
+    <Library OverrideID="4444">PeiServicesTablePointerLib</Library>
+    <Library>PeiHobLib</Library>
+    <Library>BaseCacheMaintenanceLib</Library>
+    <Library>BaseUefiTianoDecompressLib</Library>
+    <Library>BaseCustomDecompressLibNull</Library>
+    <Library>BaseDebugLibReportStatusCode</Library>
+    <Library>BaseLib</Library>
+    <Library>PeiMemoryAllocationLib</Library>
+    <Library>PeiReportStatusCodeLib</Library>
+    <Library>EdkPeCoffLoaderX64Lib</Library>
+    <Library>EdkPeCoffLoaderLib</Library>
+    <Library>BasePeCoffLib</Library>
+  </Libraries>
+  <BuildOptions ToolChain="MSFT">
+    <ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
+  </BuildOptions>
+</ModuleBuildDescription>
index e69b824..638809d 100644 (file)
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">\r
-  <MsaHeader>\r
-    <BaseName>DxeIpl</BaseName>\r
-    <ModuleType>PEIM</ModuleType>\r
-    <ComponentType>PE32_PEIM</ComponentType>\r
-    <Guid>86D70125-BAA3-4296-A62F-602BEBBB9081</Guid>\r
-    <Version>EDK_RELEASE_VERSION        0x00020000</Version>\r
-    <Abstract>Component description file for DxeIpl module</Abstract>\r
-    <Description>FIX ME!</Description>\r
-    <Copyright>Copyright 2004-2006, Intel Corporation</Copyright>\r
-    <License>\r
-      All rights reserved. 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
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-    </License>\r
-    <Specification>EFI_SPECIFICATION_VERSION    0x00000000</Specification>\r
-    <Created>2006-04-03 23:58</Created>\r
-  </MsaHeader>\r
-  <LibraryClassDefinitions>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">PeimEntryPoint</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">PerformanceLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">PeiCoreLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">CacheMaintenanceLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">EdkPeCoffLoaderLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">UefiDecompressLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">TianoDecompressLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">CustomDecompressLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">PeiServicesTablePointerLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">EdkPeCoffLoaderX64Lib</LibraryClass>\r
-  </LibraryClassDefinitions>\r
-  <SourceFiles>\r
-    <Filename>DxeIpl.dxs</Filename>\r
-    <Filename>DxeLoadX64.c</Filename>\r
-    <Arch ArchType="IA32">\r
-      <Filename>x64/ImageRead.c</Filename>\r
-      <Filename>x64/LongMode.asm</Filename>\r
-      <Filename>x64/DxeLoadFunc.c</Filename>\r
-      <Filename>x64/VirtualMemory.c</Filename>\r
-    </Arch>\r
-  </SourceFiles>\r
-  <Includes>\r
-    <PackageName>MdePkg</PackageName>\r
-    <PackageName>EdkModulePkg</PackageName>\r
-  </Includes>\r
-  <Protocols>\r
-    <Protocol Usage="ALWAYS_CONSUMED">Decompress</Protocol>\r
-    <Protocol Usage="ALWAYS_CONSUMED">TianoDecompress</Protocol>\r
-    <Protocol Usage="ALWAYS_CONSUMED">CustomizedDecompress</Protocol>\r
-  </Protocols>\r
-  <PPIs>\r
-    <Ppi Usage="ALWAYS_CONSUMED">PeiInMemory</Ppi>\r
-    <Ppi Usage="ALWAYS_CONSUMED">RecoveryModule</Ppi>\r
-    <Ppi Usage="ALWAYS_CONSUMED">SectionExtraction</Ppi>\r
-    <Ppi Usage="ALWAYS_CONSUMED">Security</Ppi>\r
-    <Ppi Usage="ALWAYS_CONSUMED">DxeIpl</Ppi>\r
-    <Ppi Usage="ALWAYS_CONSUMED">S3Resume</Ppi>\r
-    <Ppi Usage="ALWAYS_CONSUMED">EndOfPeiSignal</Ppi>\r
-    <Ppi Usage="ALWAYS_CONSUMED">FvFileLoader</Ppi>\r
-  </PPIs>\r
-  <Guids>\r
-    <GuidEntry Usage="ALWAYS_CONSUMED">\r
-      <C_Name>PeiPeCoffLoader</C_Name>\r
-    </GuidEntry>\r
-  </Guids>\r
-</ModuleSurfaceArea>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0  http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+  <MsaHeader>
+    <BaseName>DxeIplX64</BaseName>
+    <ModuleType>PEIM</ModuleType>
+    <ComponentType>PE32_PEIM</ComponentType>
+    <Guid>86D70125-BAA3-4296-A62F-602BEBBB9081</Guid>
+    <Version>EDK_RELEASE_VERSION        0x00020000</Version>
+    <Abstract>Component description file for DxeIpl module</Abstract>
+    <Description>FIX ME!</Description>
+    <Copyright>Copyright 2004-2006, Intel Corporation</Copyright>
+    <License>
+      All rights reserved. This program and the accompanying materials
+      are licensed and made available under the terms and conditions of the BSD License
+      which accompanies this distribution.  The full text of the license may be found at
+      http://opensource.org/licenses/bsd-license.php
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+    </License>
+    <Specification>EFI_SPECIFICATION_VERSION    0x00000000</Specification>
+    <Created>2006-04-03 23:58</Created>
+  </MsaHeader>
+  <LibraryClassDefinitions>
+    <LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">PeimEntryPoint</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">PerformanceLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">PeiCoreLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">CacheMaintenanceLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">EdkPeCoffLoaderLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">UefiDecompressLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">TianoDecompressLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">CustomDecompressLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">PeiServicesTablePointerLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
+    <LibraryClass Usage="ALWAYS_CONSUMED">EdkPeCoffLoaderX64Lib</LibraryClass>
+  </LibraryClassDefinitions>
+  <SourceFiles>
+    <Filename>DxeIpl.dxs</Filename>
+    <Filename>DxeLoadX64.c</Filename>
+    <Arch ArchType="IA32">
+      <Filename>x64/ImageRead.c</Filename>
+      <Filename>x64/LongMode.asm</Filename>
+      <Filename>x64/DxeLoadFunc.c</Filename>
+      <Filename>x64/VirtualMemory.c</Filename>
+    </Arch>
+  </SourceFiles>
+  <Includes>
+    <PackageName>MdePkg</PackageName>
+    <PackageName>EdkModulePkg</PackageName>
+  </Includes>
+  <Protocols>
+    <Protocol Usage="ALWAYS_CONSUMED">Decompress</Protocol>
+    <Protocol Usage="ALWAYS_CONSUMED">TianoDecompress</Protocol>
+    <Protocol Usage="ALWAYS_CONSUMED">CustomizedDecompress</Protocol>
+  </Protocols>
+  <Hobs>
+    <Hob Usage="SOMETIMES_PRODUCED" HobType="MEMORY_ALLOCATION">
+      <C_Name>gEfiHobMemoryAllocBspStoreGuid</C_Name>
+      <Guid>0x564b33cd, 0xc92a, 0x4593, 0x90, 0xbf, 0x24, 0x73, 0xe4, 0x3c, 0x63, 0x22</Guid>
+    </Hob>
+    <Hob Usage="SOMETIMES_PRODUCED" HobType="GUID_EXTENSION">
+      <C_Name>gEfiDecompressProtocolGuid</C_Name>
+      <Guid>0xd8117cfe, 0x94a6, 0x11d4, 0x9a, 0x3a, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d</Guid>
+    </Hob>
+    <Hob Usage="SOMETIMES_PRODUCED" HobType="GUID_EXTENSION">
+      <C_Name>gEfiTianoDecompressProtocolGuid</C_Name>
+      <Guid>0xe84cf29c, 0x191f, 0x4eae, 0x96, 0xe1, 0xf4, 0x6a, 0xec, 0xea, 0xea, 0x0b</Guid>
+    </Hob>
+    <Hob Usage="SOMETIMES_PRODUCED" HobType="GUID_EXTENSION">
+      <C_Name>gEfiCustomizedDecompressProtocolGuid</C_Name>
+      <Guid>0x9a44198e, 0xa4a2, 0x44e6, 0x8a, 0x1f, 0x39, 0xbe, 0xfd, 0xac, 0x89, 0x6f</Guid>
+    </Hob>
+    <Hob Usage="SOMETIMES_PRODUCED" HobType="GUID_EXTENSION">
+      <C_Name>gEfiPeiPeCoffLoaderGuid</C_Name>
+      <Guid>0xd8117cff, 0x94a6, 0x11d4, 0x9a, 0x3a, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d</Guid>
+    </Hob>
+    <Hob Usage="SOMETIMES_PRODUCED" HobType="MEMORY_ALLOCATION">
+      <C_Name>gEfiHobMemoryAllocModuleGuid</C_Name>
+      <Guid>0xf8e21975, 0x0899, 0x4f58, 0xa4, 0xbe, 0x55, 0x25, 0xa9, 0xc6, 0xd7, 0x7a</Guid>
+    </Hob>
+    <Hob Usage="SOMETIMES_PRODUCED" HobType="FIRMWARE_VOLUME">
+      <Name>DecompressedFvmain.fv</Name>
+    </Hob>
+  </Hobs>
+  <PPIs>
+    <Ppi Usage="SOMETIMES_PRODUCED">DxeIpl</Ppi>
+    <Ppi Usage="SOMETIMES_PRODUCED">FvFileLoader</Ppi>
+    <Ppi Usage="SOMETIMES_PRODUCED">EndOfPeiSignal</Ppi>
+    <Ppi Usage="SOMETIMES_CONSUMED">RecoveryModule</Ppi>
+    <Ppi Usage="SOMETIMES_CONSUMED">S3Resume</Ppi>
+    <Ppi Usage="SOMETIMES_CONSUMED">SectionExtraction</Ppi>
+    <Ppi Usage="SOMETIMES_CONSUMED">Security</Ppi>
+    <Ppi Usage="PRIVATE">PeiInMemory</Ppi>
+  </PPIs>
+  <Guids>
+    <GuidEntry Usage="ALWAYS_CONSUMED">
+      <C_Name>PeiPeCoffLoader</C_Name>
+    </GuidEntry>
+  </Guids>
+  <Externs>
+    <Extern>
+      <ModuleEntryPoint>PeimInitializeDxeIpl</ModuleEntryPoint>
+    </Extern>
+  </Externs>
+  <BuildOptions ToolChain="MSFT">
+    <ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
+  </BuildOptions>
+</ModuleSurfaceArea>
index 6727bf4..e0dbe84 100644 (file)
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-\r
-Module Name:\r
-\r
-  DxeLoad.c\r
-\r
-Abstract:\r
-\r
-  Last PEIM.\r
-  Responsibility of this module is to load the DXE Core from a Firmware Volume.\r
-\r
---*/\r
-\r
-#include <DxeIpl.h>\r
-\r
-#pragma warning( disable : 4305 )\r
-\r
-BOOLEAN gInMemory = FALSE;\r
-\r
-//\r
-// GUID for EM64T\r
-//\r
-#define EFI_PPI_NEEDED_BY_DXE \\r
-  { \\r
-    0x4d37da42, 0x3a0c, 0x4eda, 0xb9, 0xeb, 0xbc, 0x0e, 0x1d, 0xb4, 0x71, 0x3b \\r
-  }\r
-EFI_GUID mPpiNeededByDxeGuid = EFI_PPI_NEEDED_BY_DXE;\r
-\r
-//\r
-// Module Globals used in the DXE to PEI handoff\r
-// These must be module globals, so the stack can be switched\r
-//\r
-static EFI_DXE_IPL_PPI mDxeIplPpi = {\r
-  DxeLoadCore\r
-};\r
-\r
-static EFI_PEI_FV_FILE_LOADER_PPI mLoadFilePpi = {\r
-  DxeIplLoadFile\r
-};\r
-\r
-static EFI_PEI_PPI_DESCRIPTOR     mPpiLoadFile = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEfiPeiFvFileLoaderPpiGuid,\r
-  &mLoadFilePpi\r
-};\r
-\r
-static EFI_PEI_PPI_DESCRIPTOR     mPpiList = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEfiDxeIplPpiGuid,\r
-  &mDxeIplPpi\r
-};\r
-\r
-static EFI_PEI_PPI_DESCRIPTOR     mPpiPeiInMemory = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gPeiInMemoryGuid,\r
-  NULL\r
-};\r
-\r
-static EFI_PEI_PPI_DESCRIPTOR     mPpiSignal = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEfiEndOfPeiSignalPpiGuid,\r
-  NULL\r
-};\r
-\r
-DECOMPRESS_LIBRARY  gEfiDecompress = {\r
-  UefiDecompressGetInfo,\r
-  UefiDecompress\r
-};\r
-\r
-DECOMPRESS_LIBRARY  gTianoDecompress = {\r
-  TianoDecompressGetInfo,\r
-  TianoDecompress\r
-};\r
-\r
-DECOMPRESS_LIBRARY  gCustomDecompress = {\r
-  CustomDecompressGetInfo,\r
-  CustomDecompress\r
-};\r
-\r
-STATIC\r
-UINTN\r
-GetOccupiedSize (\r
-  IN UINTN   ActualSize,\r
-  IN UINTN   Alignment\r
-  )\r
-{\r
-  UINTN OccupiedSize;\r
-\r
-  OccupiedSize = ActualSize;\r
-  while ((OccupiedSize & (Alignment - 1)) != 0) {\r
-    OccupiedSize++;\r
-  }\r
-\r
-  return OccupiedSize;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PeimInitializeDxeIpl (\r
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
-  IN EFI_PEI_SERVICES          **PeiServices\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initializes the Dxe Ipl PPI\r
-\r
-Arguments:\r
-\r
-  FfsHeader   - Pointer to FFS file header\r
-  PeiServices - General purpose services available to every PEIM.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS\r
-\r
---*/\r
-{\r
-  EFI_STATUS                                Status;\r
-  EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader;\r
-  EFI_BOOT_MODE                             BootMode;\r
-\r
-  Status = PeiCoreGetBootMode (&BootMode);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  Status = PeiCoreLocatePpi (\r
-             &gPeiInMemoryGuid,\r
-             0,\r
-             NULL,\r
-             NULL\r
-             );\r
-\r
-  if (EFI_ERROR (Status) && (BootMode != BOOT_ON_S3_RESUME)) {   \r
-    //\r
-    // The DxeIpl has not yet been shadowed\r
-    //\r
-    PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();\r
-\r
-    //\r
-    // Shadow DxeIpl and then re-run its entry point\r
-    //\r
-    Status = ShadowDxeIpl (FfsHeader, PeiEfiPeiPeCoffLoader);\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-\r
-  } else {\r
-    if (BootMode != BOOT_ON_S3_RESUME) {\r
-    //\r
-    // The DxeIpl has been shadowed\r
-    //\r
-    gInMemory = TRUE;\r
-\r
-    //\r
-    // Install LoadFile PPI\r
-    //\r
-    Status = PeiCoreInstallPpi (&mPpiLoadFile);\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-      }\r
-    }\r
-    //\r
-    // Install DxeIpl PPI\r
-    //\r
-    PeiCoreInstallPpi (&mPpiList);\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeLoadCore (\r
-  IN EFI_DXE_IPL_PPI       *This,\r
-  IN EFI_PEI_SERVICES      **PeiServices,\r
-  IN EFI_PEI_HOB_POINTERS  HobList\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Main entry point to last PEIM\r
-\r
-Arguments:\r
-\r
-  This         - Entry point for DXE IPL PPI\r
-  PeiServices  - General purpose services available to every PEIM.\r
-  HobList      - Address to the Pei HOB list\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS          - DEX core was successfully loaded.\r
-  EFI_OUT_OF_RESOURCES - There are not enough resources to load DXE core.\r
-\r
---*/\r
-{\r
-  EFI_STATUS                                                Status;\r
-  EFI_PHYSICAL_ADDRESS                                      TopOfStack;\r
-  EFI_PHYSICAL_ADDRESS                                      BaseOfStack;\r
-  EFI_PHYSICAL_ADDRESS                                      BspStore;\r
-  EFI_GUID                                                  DxeCoreFileName;\r
-  VOID                                                      *DxeCorePe32Data;\r
-  EFI_PHYSICAL_ADDRESS                                      DxeCoreAddress;\r
-  UINT64                                                    DxeCoreSize;\r
-  EFI_PHYSICAL_ADDRESS                                      DxeCoreEntryPoint;\r
-  VOID                                                      *PpisNeededByDxePe32Data;\r
-  EFI_PHYSICAL_ADDRESS                                      PpisNeededByDxeAddress;\r
-  UINT64                                                    PpisNeededByDxeSize;\r
-  EFI_PHYSICAL_ADDRESS                                      PpisNeededByDxeEntryPoint;\r
-  EFI_PEI_PE_COFF_LOADER_PROTOCOL                           *PeiEfiPeiPeCoffLoader;\r
-  EFI_BOOT_MODE                                             BootMode;\r
-  EFI_PEI_RECOVERY_MODULE_PPI                               *PeiRecovery;\r
-  EFI_PEI_S3_RESUME_PPI                                     *S3Resume;\r
-  EFI_PHYSICAL_ADDRESS                                      PageTables;\r
-  \r
-  TopOfStack  = 0;\r
-  BaseOfStack = 0;\r
-  BspStore    = 0;\r
-  Status      = EFI_SUCCESS;\r
-\r
-  //\r
-  // if in S3 Resume, restore configure\r
-  //\r
-  Status = PeiCoreGetBootMode (&BootMode);\r
-\r
-  if (!EFI_ERROR (Status) && (BootMode == BOOT_ON_S3_RESUME)) {\r
-    Status = PeiCoreLocatePpi (\r
-               &gEfiPeiS3ResumePpiGuid,\r
-               0,\r
-               NULL,\r
-               (VOID **)&S3Resume\r
-               );\r
-\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    Status = S3Resume->S3RestoreConfig (PeiServices);\r
-\r
-    ASSERT_EFI_ERROR (Status);\r
-  }\r
-\r
-  Status = EFI_SUCCESS;\r
-\r
-  //\r
-  // Install the PEI Protocols that are shared between PEI and DXE\r
-  //\r
-#ifdef EFI_NT_EMULATOR\r
-  PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();\r
-  ASSERT (PeiEfiPeiPeCoffLoader != NULL);\r
-#else\r
-  PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderX64Protocol ();\r
-#endif \r
-\r
-#if 0\r
-  Status = InstallEfiPeiPeCoffLoader64 (PeiServices, &PeiEfiPeiPeCoffLoader, NULL);\r
-  ASSERT_EFI_ERROR (Status);\r
-#endif\r
-  //\r
-  // Allocate 128KB for the Stack\r
-  //\r
-  PeiCoreAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (STACK_SIZE), &BaseOfStack);\r
-  ASSERT (BaseOfStack != 0);\r
-\r
-  //\r
-  // Compute the top of the stack we were allocated. Pre-allocate a 32 bytes\r
-  // for safety (PpisNeededByDxe and DxeCore).\r
-  //\r
-  TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;\r
-\r
-  //\r
-  // Add architecture-specifc HOBs (including the BspStore HOB)\r
-  //\r
-  Status = CreateArchSpecificHobs (&BspStore);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // See if we are in crisis recovery\r
-  //\r
-  Status = PeiCoreGetBootMode (&BootMode);\r
-  if (!EFI_ERROR (Status) && (BootMode == BOOT_IN_RECOVERY_MODE)) {\r
-    Status = PeiCoreLocatePpi (\r
-               &gEfiPeiRecoveryModulePpiGuid,\r
-               0,\r
-               NULL,\r
-               (VOID **)&PeiRecovery\r
-               );\r
-\r
-    ASSERT_EFI_ERROR (Status);\r
-    Status = PeiRecovery->LoadRecoveryCapsule (PeiServices, PeiRecovery);\r
-    ASSERT_EFI_ERROR (Status);\r
-  }\r
-\r
-  //\r
-  // Find the DXE Core in a Firmware Volume\r
-  //\r
-  Status = PeiFindFile (\r
-             EFI_FV_FILETYPE_DXE_CORE,\r
-             EFI_SECTION_PE32,\r
-             &DxeCoreFileName,\r
-             &DxeCorePe32Data\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Find the PpisNeededByDxe in a Firmware Volume\r
-  //\r
-  Status = PeiFindFile (\r
-             EFI_FV_FILETYPE_ALL,\r
-             EFI_SECTION_PE32,\r
-             &mPpiNeededByDxeGuid,\r
-             &PpisNeededByDxePe32Data\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Transfer control to the DXE Core\r
-  // The handoff state is simply a pointer to the HOB list\r
-  //\r
-  // PEI_PERF_END (PeiServices, L"DxeIpl", NULL, 0);\r
-\r
-  Status = PeiCoreInstallPpi (&mPpiSignal);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA \\r
-  // memory, it may be corrupted when copying FV to high-end memory \r
-  LoadGo64Gdt();\r
-\r
-  //\r
-  // Limit to 36 bits of addressing for debug. Should get it from CPU\r
-  //\r
-  PageTables = CreateIdentityMappingPageTables (36);\r
-\r
-  //\r
-  // Load the PpiNeededByDxe from a Firmware Volume\r
-  //\r
-  Status = PeiLoadx64File (\r
-             PeiEfiPeiPeCoffLoader,\r
-             PpisNeededByDxePe32Data,\r
-             EfiBootServicesData,\r
-             &PpisNeededByDxeAddress,\r
-             &PpisNeededByDxeSize,\r
-             &PpisNeededByDxeEntryPoint\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-\r
-  //\r
-  // Load the DXE Core from a Firmware Volume\r
-  //\r
-  Status = PeiLoadx64File (\r
-             PeiEfiPeiPeCoffLoader,\r
-             DxeCorePe32Data,\r
-             EfiBootServicesData,\r
-             &DxeCoreAddress,\r
-             &DxeCoreSize,\r
-             &DxeCoreEntryPoint\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  //\r
-  // Add HOB for the DXE Core\r
-  //\r
-  BuildModuleHob (\r
-    &DxeCoreFileName,\r
-    DxeCoreAddress,\r
-    DxeCoreSize,\r
-    DxeCoreEntryPoint\r
-    );\r
-\r
-  //\r
-  // Report Status Code EFI_SW_PEI_PC_HANDOFF_TO_NEXT\r
-  //\r
-  REPORT_STATUS_CODE (\r
-    EFI_PROGRESS_CODE,\r
-    EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT\r
-    );\r
-\r
-  DEBUG ((EFI_D_INFO, "DXE Core Entry\n"));\r
-  //\r
-  // Go to Long Mode. Interrupts will not get turned on until the CPU AP is loaded.\r
-  // Call x64 drivers passing in single argument, a pointer to the HOBs.\r
-  //\r
-  ActivateLongMode (\r
-    PageTables, \r
-    (EFI_PHYSICAL_ADDRESS)(UINTN)(HobList.Raw), \r
-    TopOfStack,\r
-    PpisNeededByDxeEntryPoint,\r
-    DxeCoreEntryPoint\r
-    );\r
-\r
-  //\r
-  // If we get here, then the DXE Core returned.  This is an error\r
-  //\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return EFI_OUT_OF_RESOURCES;\r
-}\r
-\r
-EFI_STATUS\r
-PeiFindFile (\r
-  IN  UINT8                  Type,\r
-  IN  UINT16                 SectionType,\r
-  OUT EFI_GUID               *FileName,\r
-  OUT VOID                   **Pe32Data\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Finds a PE/COFF of a specific Type and SectionType in the Firmware Volumes\r
-  described in the HOB list. Able to search in a compression set in a FFS file.\r
-  But only one level of compression is supported, that is, not able to search\r
-  in a compression set that is within another compression set.\r
-\r
-Arguments:\r
-\r
-  Type        - The Type of file to retrieve\r
-\r
-  SectionType - The type of section to retrieve from a file\r
-\r
-  FileName    - The name of the file found in the Firmware Volume\r
-\r
-  Pe32Data    - Pointer to the beginning of the PE/COFF file found in the Firmware Volume\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS   - The file was found, and the name is returned in FileName, and a pointer to\r
-                  the PE/COFF image is returned in Pe32Data\r
-\r
-  EFI_NOT_FOUND - The file was not found in the Firmware Volumes present in the HOB List\r
-\r
---*/\r
-{\r
-  EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader;\r
-  EFI_FFS_FILE_HEADER         *FfsFileHeader;\r
-  VOID                        *SectionData;\r
-  EFI_STATUS                  Status;\r
-  EFI_PEI_HOB_POINTERS        Hob;\r
-\r
-\r
-  FwVolHeader   = NULL;\r
-  FfsFileHeader = NULL;\r
-  SectionData   = NULL;\r
-\r
-  //\r
-  // Foreach Firmware Volume, look for a specified type\r
-  // of file and break out when one is found\r
-  //\r
-  Hob.Raw = GetHobList ();\r
-  while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV, Hob.Raw)) != NULL) {\r
-    FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (Hob.FirmwareVolume->BaseAddress);\r
-    Status = PeiCoreFfsFindNextFile (\r
-               Type,\r
-               FwVolHeader,\r
-               &FfsFileHeader\r
-               );\r
-    if (!EFI_ERROR (Status)) {\r
-      CopyMem (FileName, &FfsFileHeader->Name, sizeof (EFI_GUID));\r
-      Status = PeiProcessFile (\r
-                 SectionType,\r
-                 FfsFileHeader,\r
-                 Pe32Data\r
-                 );\r
-      return Status;\r
-    }\r
-    Hob.Raw = GET_NEXT_HOB (Hob);\r
-  }\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
-EFI_STATUS\r
-PeiLoadx64File (\r
-  IN  EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader,\r
-  IN  VOID                                      *Pe32Data,\r
-  IN  EFI_MEMORY_TYPE                           MemoryType,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *ImageAddress,\r
-  OUT UINT64                                    *ImageSize,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *EntryPoint\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Loads and relocates a PE/COFF image into memory.\r
-\r
-Arguments:\r
-\r
-  PeiEfiPeiPeCoffLoader - Pointer to a PE COFF loader protocol\r
-\r
-  Pe32Data         - The base address of the PE/COFF file that is to be loaded and relocated\r
-\r
-  ImageAddress     - The base address of the relocated PE/COFF image\r
-\r
-  ImageSize        - The size of the relocated PE/COFF image\r
-\r
-  EntryPoint       - The entry point of the relocated PE/COFF image\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS                     - The file was loaded and relocated\r
-  EFI_OUT_OF_RESOURCES            - There was not enough memory to load and relocate the PE/COFF file\r
-\r
---*/\r
-{\r
-  EFI_STATUS                            Status;\r
-  PE_COFF_LOADER_IMAGE_CONTEXT          ImageContext;\r
-  EFI_PHYSICAL_ADDRESS                  MemoryBuffer;\r
-\r
-  ZeroMem (&ImageContext, sizeof (ImageContext));\r
-  ImageContext.Handle = Pe32Data;\r
-  Status              = GetImageReadFunction (&ImageContext);\r
-\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  Status = PeiEfiPeiPeCoffLoader->GetImageInfo (PeiEfiPeiPeCoffLoader, &ImageContext);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-  //\r
-  // Allocate Memory for the image\r
-  //\r
-  //\r
-  // Allocate Memory for the image\r
-  //\r
-  PeiCoreAllocatePages (MemoryType, EFI_SIZE_TO_PAGES ((UINT32) ImageContext.ImageSize), &MemoryBuffer);\r
-  ImageContext.ImageAddress = MemoryBuffer;\r
-  ASSERT (ImageContext.ImageAddress != 0);\r
-\r
-  //\r
-  // Load the image to our new buffer\r
-  //\r
-\r
-  Status = PeiEfiPeiPeCoffLoader->LoadImage (PeiEfiPeiPeCoffLoader, &ImageContext);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-  \r
-  //\r
-  // Relocate the image in our new buffer\r
-  //\r
-  Status = PeiEfiPeiPeCoffLoader->RelocateImage (PeiEfiPeiPeCoffLoader, &ImageContext);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Flush the instruction cache so the image data is written before we execute it\r
-  //\r
-  InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);\r
-\r
-  *ImageAddress = ImageContext.ImageAddress;\r
-  *ImageSize    = ImageContext.ImageSize;\r
-  *EntryPoint   = ImageContext.EntryPoint;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-ShadowDxeIpl (\r
-  IN EFI_FFS_FILE_HEADER                       *DxeIplFileHeader,\r
-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Shadow the DXE IPL to a different memory location. This occurs after permanent\r
-  memory has been discovered.\r
-\r
-Arguments:\r
-\r
-  DxeIplFileHeader      - Pointer to the FFS file header of the DXE IPL driver\r
-\r
-  PeiEfiPeiPeCoffLoader - Pointer to a PE COFF loader protocol\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS   - DXE IPL was successfully shadowed to a different memory location.\r
-\r
-  EFI_ ERROR    - The shadow was unsuccessful.\r
-\r
-\r
---*/\r
-{\r
-  UINTN                     SectionLength;\r
-  UINTN                     OccupiedSectionLength;\r
-  EFI_PHYSICAL_ADDRESS      DxeIplAddress;\r
-  UINT64                    DxeIplSize;\r
-  EFI_PHYSICAL_ADDRESS      DxeIplEntryPoint;\r
-  EFI_STATUS                Status;\r
-  EFI_COMMON_SECTION_HEADER *Section;\r
-\r
-  Section = (EFI_COMMON_SECTION_HEADER *) (DxeIplFileHeader + 1);\r
-\r
-  while ((Section->Type != EFI_SECTION_PE32) && (Section->Type != EFI_SECTION_TE)) {\r
-    SectionLength         = *(UINT32 *) (Section->Size) & 0x00ffffff;\r
-    OccupiedSectionLength = GetOccupiedSize (SectionLength, 4);\r
-    Section               = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + OccupiedSectionLength);\r
-  }\r
-  \r
-  //\r
-  // Relocate DxeIpl into memory by using loadfile service\r
-  //\r
-  Status = PeiLoadx64File (\r
-            PeiEfiPeiPeCoffLoader,\r
-            (VOID *) (Section + 1),\r
-            EfiBootServicesData,\r
-            &DxeIplAddress,\r
-            &DxeIplSize,\r
-            &DxeIplEntryPoint\r
-            );\r
\r
-  if (Status == EFI_SUCCESS) {\r
-    //\r
-    // Install PeiInMemory to indicate the Dxeipl is shadowed\r
-    //\r
-    Status = PeiCoreInstallPpi (&mPpiPeiInMemory);\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-\r
-    Status = ((EFI_PEIM_ENTRY_POINT) (UINTN) DxeIplEntryPoint) (DxeIplFileHeader, GetPeiServicesTablePointer());\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-DxeIplLoadFile (\r
-  IN EFI_PEI_FV_FILE_LOADER_PPI                 *This,\r
-  IN  EFI_FFS_FILE_HEADER                       *FfsHeader,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *ImageAddress,\r
-  OUT UINT64                                    *ImageSize,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *EntryPoint\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Given a pointer to an FFS file containing a PE32 image, get the\r
-  information on the PE32 image, and then "load" it so that it\r
-  can be executed.\r
-\r
-Arguments:\r
-\r
-  This  - pointer to our file loader protocol\r
-  FfsHeader - pointer to the FFS file header of the FFS file that\r
-              contains the PE32 image we want to load\r
-  ImageAddress  - returned address where the PE32 image is loaded\r
-  ImageSize     - returned size of the loaded PE32 image\r
-  EntryPoint    - entry point to the loaded PE32 image\r
-\r
-Returns:\r
\r
-  EFI_SUCCESS  - The FFS file was successfully loaded.\r
-  EFI_ERROR    - Unable to load the FFS file.\r
-\r
---*/\r
-{\r
-  EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader;\r
-  EFI_STATUS                                Status;\r
-  VOID                                      *Pe32Data;\r
-\r
-  Pe32Data = NULL;\r
-  PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();\r
-\r
-  //\r
-  // Preprocess the FFS file to get a pointer to the PE32 information\r
-  // in the enclosed PE32 image.\r
-  //\r
-  Status = PeiProcessFile (\r
-            EFI_SECTION_PE32,\r
-            FfsHeader,\r
-            &Pe32Data\r
-            );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-  //\r
-  // Load the PE image from the FFS file\r
-  //\r
-  Status = PeiLoadx64File (\r
-            PeiEfiPeiPeCoffLoader,\r
-            Pe32Data,\r
-            EfiBootServicesData,\r
-            ImageAddress,\r
-            ImageSize,\r
-            EntryPoint\r
-            );\r
-\r
-  return Status;\r
-}\r
-\r
-EFI_STATUS\r
-PeiProcessFile (\r
-  IN  UINT16                 SectionType,\r
-  IN  EFI_FFS_FILE_HEADER    *FfsFileHeader,\r
-  OUT VOID                   **Pe32Data\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-  SectionType       - The type of section in the FFS file to process.\r
-\r
-  FfsFileHeader     - Pointer to the FFS file to process, looking for the\r
-                      specified SectionType\r
-\r
-  Pe32Data          - returned pointer to the start of the PE32 image found\r
-                      in the FFS file.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS       - found the PE32 section in the FFS file\r
-\r
---*/\r
-{\r
-  EFI_STATUS                      Status;\r
-  VOID                            *SectionData;\r
-  DECOMPRESS_LIBRARY              *DecompressLibrary;\r
-  UINT8                           *DstBuffer;\r
-  UINT8                           *ScratchBuffer;\r
-  UINT32                          DstBufferSize;\r
-  UINT32                          ScratchBufferSize;\r
-  EFI_COMMON_SECTION_HEADER       *CmpSection;\r
-  UINTN                           CmpSectionLength;\r
-  UINTN                           OccupiedCmpSectionLength;\r
-  VOID                            *CmpFileData;\r
-  UINTN                           CmpFileSize;\r
-  EFI_COMMON_SECTION_HEADER       *Section;\r
-  UINTN                           SectionLength;\r
-  UINTN                           OccupiedSectionLength;\r
-  UINT64                          FileSize;\r
-  EFI_GUID_DEFINED_SECTION        *GuidedSectionHeader;\r
-  UINT32                          AuthenticationStatus;\r
-  EFI_PEI_SECTION_EXTRACTION_PPI  *SectionExtract;\r
-  UINT32                          BufferSize;\r
-  UINT8                           *Buffer;\r
-  EFI_PEI_SECURITY_PPI            *Security;\r
-  BOOLEAN                         StartCrisisRecovery;\r
-  EFI_GUID                        TempGuid;\r
-  EFI_FIRMWARE_VOLUME_HEADER      *FvHeader;\r
-  EFI_COMPRESSION_SECTION         *CompressionSection;\r
-\r
-  Status = PeiCoreFfsFindSectionData (\r
-             EFI_SECTION_COMPRESSION,\r
-             FfsFileHeader,\r
-             &SectionData\r
-             );\r
-\r
-  //\r
-  // Upon finding a DXE Core file, see if there is first a compression section\r
-  //\r
-  if (!EFI_ERROR (Status)) {\r
-    //\r
-    // Yes, there is a compression section, so extract the contents\r
-    // Decompress the image here\r
-    //\r
-    Section = (EFI_COMMON_SECTION_HEADER *) (UINTN) (VOID *) ((UINT8 *) (FfsFileHeader) + (UINTN) sizeof (EFI_FFS_FILE_HEADER));\r
-\r
-    do {\r
-      SectionLength         = *(UINT32 *) (Section->Size) & 0x00ffffff;\r
-      OccupiedSectionLength = GetOccupiedSize (SectionLength, 4);\r
-\r
-      //\r
-      // Was the DXE Core file encapsulated in a GUID'd section?\r
-      //\r
-      if (Section->Type == EFI_SECTION_GUID_DEFINED) {\r
-        //\r
-        // Locate the GUID'd Section Extractor\r
-        //\r
-        GuidedSectionHeader = (VOID *) (Section + 1);\r
-\r
-        //\r
-        // This following code constitutes the addition of the security model\r
-        // to the DXE IPL.\r
-        //\r
-        //\r
-        // Set a default authenticatino state\r
-        //\r
-        AuthenticationStatus = 0;\r
-\r
-        Status = PeiCoreLocatePpi (\r
-                   &gEfiPeiSectionExtractionPpiGuid,\r
-                   0,\r
-                   NULL,\r
-                   (VOID **)&SectionExtract\r
-                   );\r
-\r
-        if (EFI_ERROR (Status)) {\r
-          return Status;\r
-        }\r
-        //\r
-        // Verify Authentication State\r
-        //\r
-        CopyMem (&TempGuid, Section + 1, sizeof (EFI_GUID));\r
-\r
-        Status = SectionExtract->PeiGetSection (\r
-                                  GetPeiServicesTablePointer(),\r
-                                  SectionExtract,\r
-                                  (EFI_SECTION_TYPE *) &SectionType,\r
-                                  &TempGuid,\r
-                                  0,\r
-                                  (VOID **) &Buffer,\r
-                                  &BufferSize,\r
-                                  &AuthenticationStatus\r
-                                  );\r
-\r
-        if (EFI_ERROR (Status)) {\r
-          return Status;\r
-        }\r
-        //\r
-        // If not ask the Security PPI, if exists, for disposition\r
-        //\r
-        //\r
-        Status = PeiCoreLocatePpi (\r
-                   &gEfiPeiSecurityPpiGuid,\r
-                   0,\r
-                   NULL,\r
-                   (VOID **)&Security\r
-                   );\r
-        if (EFI_ERROR (Status)) {\r
-          return Status;\r
-        }\r
-\r
-        Status = Security->AuthenticationState (\r
-                            GetPeiServicesTablePointer(),\r
-                            (struct _EFI_PEI_SECURITY_PPI *) Security,\r
-                            AuthenticationStatus,\r
-                            FfsFileHeader,\r
-                            &StartCrisisRecovery\r
-                            );\r
-\r
-        if (EFI_ERROR (Status)) {\r
-          return Status;\r
-        }\r
-        //\r
-        // If there is a security violation, report to caller and have\r
-        // the upper-level logic possible engender a crisis recovery\r
-        //\r
-        if (StartCrisisRecovery) {\r
-          return EFI_SECURITY_VIOLATION;\r
-        }\r
-      }\r
-\r
-      if (Section->Type == EFI_SECTION_PE32) {\r
-        //\r
-        // This is what we want\r
-        //\r
-        *Pe32Data = (VOID *) (Section + 1);\r
-        return EFI_SUCCESS;\r
-      } else if (Section->Type == EFI_SECTION_COMPRESSION) {\r
-        //\r
-        // This is a compression set, expand it\r
-        //\r
-        CompressionSection  = (EFI_COMPRESSION_SECTION *) Section;\r
-\r
-        switch (CompressionSection->CompressionType) {\r
-        case EFI_STANDARD_COMPRESSION:\r
-          DecompressLibrary = &gTianoDecompress;\r
-          break;\r
-\r
-        case EFI_CUSTOMIZED_COMPRESSION:\r
-          //\r
-          // Load user customized compression protocol.\r
-          //\r
-          DecompressLibrary = &gCustomDecompress;\r
-          break;\r
-\r
-        case EFI_NOT_COMPRESSED:\r
-        default:\r
-          //\r
-          // Need to support not compressed file\r
-          //\r
-          ASSERT_EFI_ERROR (Status);\r
-          return EFI_NOT_FOUND;\r
-        }\r
-\r
-        Status = DecompressLibrary->GetInfo (\r
-                   (UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),\r
-                   (UINT32) SectionLength - sizeof (EFI_COMPRESSION_SECTION),\r
-                   &DstBufferSize,\r
-                   &ScratchBufferSize\r
-                   );\r
-        if (EFI_ERROR (Status)) {\r
-          //\r
-          // GetInfo failed\r
-          //\r
-          return EFI_NOT_FOUND;\r
-        }\r
-\r
-        //\r
-        // Allocate scratch buffer\r
-        //\r
-        ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));\r
-        if (ScratchBuffer == NULL) {\r
-          return EFI_OUT_OF_RESOURCES;\r
-        }\r
-\r
-        //\r
-        // Allocate destination buffer\r
-        //\r
-        DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));\r
-        if (DstBuffer == NULL) {\r
-          return EFI_OUT_OF_RESOURCES;\r
-        }\r
-\r
-        //\r
-        // Call decompress function\r
-        //\r
-        Status = DecompressLibrary->Decompress (\r
-                    (CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),\r
-                    DstBuffer,\r
-                    ScratchBuffer\r
-                    );\r
-\r
-        CmpSection = (EFI_COMMON_SECTION_HEADER *) DstBuffer;\r
-        if (CmpSection->Type == EFI_SECTION_RAW) {\r
-          //\r
-          // Skip the section header and\r
-          // adjust the pointer alignment to 16\r
-          //\r
-          FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (DstBuffer + 16);\r
-\r
-          if (FvHeader->Signature == EFI_FVH_SIGNATURE) {\r
-            FfsFileHeader = NULL;\r
-            BuildFvHob ((EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader, FvHeader->FvLength);\r
-            Status = PeiCoreFfsFindNextFile (\r
-                       EFI_FV_FILETYPE_DXE_CORE,\r
-                       FvHeader,\r
-                       &FfsFileHeader\r
-                       );\r
-\r
-            if (EFI_ERROR (Status)) {\r
-              return EFI_NOT_FOUND;\r
-            }\r
-\r
-            return PeiProcessFile (SectionType, FfsFileHeader, Pe32Data);\r
-          }\r
-        }\r
-        //\r
-        // Decompress successfully.\r
-        // Loop the decompressed data searching for expected section.\r
-        //\r
-        CmpFileData = (VOID *) DstBuffer;\r
-        CmpFileSize = DstBufferSize;\r
-        do {\r
-          CmpSectionLength = *(UINT32 *) (CmpSection->Size) & 0x00ffffff;\r
-          if (CmpSection->Type == EFI_SECTION_PE32) {\r
-            //\r
-            // This is what we want\r
-            //\r
-            *Pe32Data = (VOID *) (CmpSection + 1);\r
-            return EFI_SUCCESS;\r
-          }\r
-\r
-          OccupiedCmpSectionLength  = GetOccupiedSize (CmpSectionLength, 4);\r
-          CmpSection                = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) CmpSection + OccupiedCmpSectionLength);\r
-        } while (CmpSection->Type != 0 && (UINTN) ((UINT8 *) CmpSection - (UINT8 *) CmpFileData) < CmpFileSize);\r
-      }\r
-\r
-      Section   = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + OccupiedSectionLength);\r
-      FileSize  = FfsFileHeader->Size[0] & 0xFF;\r
-      FileSize += (FfsFileHeader->Size[1] << 8) & 0xFF00;\r
-      FileSize += (FfsFileHeader->Size[2] << 16) & 0xFF0000;\r
-      FileSize &= 0x00FFFFFF;\r
-    } while (Section->Type != 0 && (UINTN) ((UINT8 *) Section - (UINT8 *) FfsFileHeader) < FileSize);\r
-\r
-    //\r
-    // End of the decompression activity\r
-    //\r
-  } else {\r
-\r
-    Status = PeiCoreFfsFindSectionData (\r
-               EFI_SECTION_PE32,\r
-               FfsFileHeader,\r
-               &SectionData\r
-               );\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      Status = PeiCoreFfsFindSectionData (\r
-                 EFI_SECTION_TE,\r
-                 FfsFileHeader,\r
-                 &SectionData\r
-                 );\r
-      if (EFI_ERROR (Status)) {\r
-        return Status;\r
-      }\r
-    }\r
-  }\r
-\r
-  *Pe32Data = SectionData;\r
-\r
-  return EFI_SUCCESS;\r
+/*++
+
+Copyright (c) 2006, Intel Corporation                                                         
+All rights reserved. This program and the accompanying materials                          
+are licensed and made available under the terms and conditions of the BSD License         
+which accompanies this distribution.  The full text of the license may be found at        
+http://opensource.org/licenses/bsd-license.php                                            
+                                                                                          
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+
+Module Name:
+
+  DxeLoad.c
+
+Abstract:
+
+  Last PEIM.
+  Responsibility of this module is to load the DXE Core from a Firmware Volume.
+
+--*/
+
+#include <DxeIpl.h>
+
+#pragma warning( disable : 4305 )
+
+BOOLEAN gInMemory = FALSE;
+
+//
+// GUID for EM64T
+//
+#define EFI_PPI_NEEDED_BY_DXE \
+  { \
+    0x4d37da42, 0x3a0c, 0x4eda, 0xb9, 0xeb, 0xbc, 0x0e, 0x1d, 0xb4, 0x71, 0x3b \
+  }
+EFI_GUID mPpiNeededByDxeGuid = EFI_PPI_NEEDED_BY_DXE;
+
+//
+// Module Globals used in the DXE to PEI handoff
+// These must be module globals, so the stack can be switched
+//
+static EFI_DXE_IPL_PPI mDxeIplPpi = {
+  DxeLoadCore
+};
+
+static EFI_PEI_FV_FILE_LOADER_PPI mLoadFilePpi = {
+  DxeIplLoadFile
+};
+
+static EFI_PEI_PPI_DESCRIPTOR     mPpiLoadFile = {
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  &gEfiPeiFvFileLoaderPpiGuid,
+  &mLoadFilePpi
+};
+
+static EFI_PEI_PPI_DESCRIPTOR     mPpiList = {
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  &gEfiDxeIplPpiGuid,
+  &mDxeIplPpi
+};
+
+static EFI_PEI_PPI_DESCRIPTOR     mPpiPeiInMemory = {
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  &gPeiInMemoryGuid,
+  NULL
+};
+
+static EFI_PEI_PPI_DESCRIPTOR     mPpiSignal = {
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  &gEfiEndOfPeiSignalPpiGuid,
+  NULL
+};
+
+DECOMPRESS_LIBRARY  gEfiDecompress = {
+  UefiDecompressGetInfo,
+  UefiDecompress
+};
+
+DECOMPRESS_LIBRARY  gTianoDecompress = {
+  TianoDecompressGetInfo,
+  TianoDecompress
+};
+
+DECOMPRESS_LIBRARY  gCustomDecompress = {
+  CustomDecompressGetInfo,
+  CustomDecompress
+};
+
+STATIC
+UINTN
+GetOccupiedSize (
+  IN UINTN   ActualSize,
+  IN UINTN   Alignment
+  )
+{
+  UINTN OccupiedSize;
+
+  OccupiedSize = ActualSize;
+  while ((OccupiedSize & (Alignment - 1)) != 0) {
+    OccupiedSize++;
+  }
+
+  return OccupiedSize;
+}
+
+EFI_STATUS
+EFIAPI
+PeimInitializeDxeIpl (
+  IN EFI_FFS_FILE_HEADER       *FfsHeader,
+  IN EFI_PEI_SERVICES          **PeiServices
+  )
+/*++
+
+Routine Description:
+
+  Initializes the Dxe Ipl PPI
+
+Arguments:
+
+  FfsHeader   - Pointer to FFS file header
+  PeiServices - General purpose services available to every PEIM.
+
+Returns:
+
+  EFI_SUCCESS
+
+--*/
+{
+  EFI_STATUS                                Status;
+  EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader;
+  EFI_BOOT_MODE                             BootMode;
+
+  Status = PeiCoreGetBootMode (&BootMode);
+
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PeiCoreLocatePpi (
+             &gPeiInMemoryGuid,
+             0,
+             NULL,
+             NULL
+             );
+
+  if (EFI_ERROR (Status) && (BootMode != BOOT_ON_S3_RESUME)) {   
+    //
+    // The DxeIpl has not yet been shadowed
+    //
+    PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();
+
+    //
+    // Shadow DxeIpl and then re-run its entry point
+    //
+    Status = ShadowDxeIpl (FfsHeader, PeiEfiPeiPeCoffLoader);
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+  } else {
+    if (BootMode != BOOT_ON_S3_RESUME) {
+    //
+    // The DxeIpl has been shadowed
+    //
+    gInMemory = TRUE;
+
+    //
+    // Install LoadFile PPI
+    //
+    Status = PeiCoreInstallPpi (&mPpiLoadFile);
+
+    if (EFI_ERROR (Status)) {
+      return Status;
+      }
+    }
+    //
+    // Install DxeIpl PPI
+    //
+    PeiCoreInstallPpi (&mPpiList);
+
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+  }
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+EFIAPI
+DxeLoadCore (
+  IN EFI_DXE_IPL_PPI       *This,
+  IN EFI_PEI_SERVICES      **PeiServices,
+  IN EFI_PEI_HOB_POINTERS  HobList
+  )
+/*++
+
+Routine Description:
+
+  Main entry point to last PEIM
+
+Arguments:
+
+  This         - Entry point for DXE IPL PPI
+  PeiServices  - General purpose services available to every PEIM.
+  HobList      - Address to the Pei HOB list
+
+Returns:
+
+  EFI_SUCCESS          - DEX core was successfully loaded.
+  EFI_OUT_OF_RESOURCES - There are not enough resources to load DXE core.
+
+--*/
+{
+  EFI_STATUS                                                Status;
+  EFI_PHYSICAL_ADDRESS                                      TopOfStack;
+  EFI_PHYSICAL_ADDRESS                                      BaseOfStack;
+  EFI_PHYSICAL_ADDRESS                                      BspStore;
+  EFI_GUID                                                  DxeCoreFileName;
+  VOID                                                      *DxeCorePe32Data;
+  EFI_PHYSICAL_ADDRESS                                      DxeCoreAddress;
+  UINT64                                                    DxeCoreSize;
+  EFI_PHYSICAL_ADDRESS                                      DxeCoreEntryPoint;
+  EFI_PEI_PE_COFF_LOADER_PROTOCOL                           *PeiEfiPeiPeCoffLoader;
+  EFI_BOOT_MODE                                             BootMode;
+  EFI_PEI_RECOVERY_MODULE_PPI                               *PeiRecovery;
+  EFI_PEI_S3_RESUME_PPI                                     *S3Resume;
+  EFI_PHYSICAL_ADDRESS                                      PageTables;
+  
+  TopOfStack  = 0;
+  BaseOfStack = 0;
+  BspStore    = 0;
+  Status      = EFI_SUCCESS;
+
+  //
+  // if in S3 Resume, restore configure
+  //
+  Status = PeiCoreGetBootMode (&BootMode);
+
+  if (!EFI_ERROR (Status) && (BootMode == BOOT_ON_S3_RESUME)) {
+    Status = PeiCoreLocatePpi (
+               &gEfiPeiS3ResumePpiGuid,
+               0,
+               NULL,
+               (VOID **)&S3Resume
+               );
+
+    ASSERT_EFI_ERROR (Status);
+
+    Status = S3Resume->S3RestoreConfig (PeiServices);
+
+    ASSERT_EFI_ERROR (Status);
+  }
+
+  Status = EFI_SUCCESS;
+
+  //
+  // Install the PEI Protocols that are shared between PEI and DXE
+  //
+#ifdef EFI_NT_EMULATOR
+  PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();
+  ASSERT (PeiEfiPeiPeCoffLoader != NULL);
+#else
+  PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderX64Protocol ();
+#endif 
+
+#if 0
+  Status = InstallEfiPeiPeCoffLoader64 (PeiServices, &PeiEfiPeiPeCoffLoader, NULL);
+  ASSERT_EFI_ERROR (Status);
+#endif
+  //
+  // Allocate 128KB for the Stack
+  //
+  PeiCoreAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (STACK_SIZE), &BaseOfStack);
+  ASSERT (BaseOfStack != 0);
+
+  //
+  // Compute the top of the stack we were allocated. Pre-allocate a 32 bytes
+  // for safety (PpisNeededByDxe and DxeCore).
+  //
+  TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;
+
+  //
+  // Add architecture-specifc HOBs (including the BspStore HOB)
+  //
+  Status = CreateArchSpecificHobs (&BspStore);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // See if we are in crisis recovery
+  //
+  Status = PeiCoreGetBootMode (&BootMode);
+  if (!EFI_ERROR (Status) && (BootMode == BOOT_IN_RECOVERY_MODE)) {
+    Status = PeiCoreLocatePpi (
+               &gEfiPeiRecoveryModulePpiGuid,
+               0,
+               NULL,
+               (VOID **)&PeiRecovery
+               );
+
+    ASSERT_EFI_ERROR (Status);
+    Status = PeiRecovery->LoadRecoveryCapsule (PeiServices, PeiRecovery);
+    ASSERT_EFI_ERROR (Status);
+  }
+
+  //
+  // Find the DXE Core in a Firmware Volume
+  //
+  Status = PeiFindFile (
+             EFI_FV_FILETYPE_DXE_CORE,
+             EFI_SECTION_PE32,
+             &DxeCoreFileName,
+             &DxeCorePe32Data
+             );
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Transfer control to the DXE Core
+  // The handoff state is simply a pointer to the HOB list
+  //
+  // PEI_PERF_END (PeiServices, L"DxeIpl", NULL, 0);
+
+  Status = PeiCoreInstallPpi (&mPpiSignal);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA \
+  // memory, it may be corrupted when copying FV to high-end memory 
+  LoadGo64Gdt();
+
+  //
+  // Limit to 36 bits of addressing for debug. Should get it from CPU
+  //
+  PageTables = CreateIdentityMappingPageTables (36);
+
+
+  //
+  // Load the DXE Core from a Firmware Volume
+  //
+  Status = PeiLoadx64File (
+             PeiEfiPeiPeCoffLoader,
+             DxeCorePe32Data,
+             EfiBootServicesData,
+             &DxeCoreAddress,
+             &DxeCoreSize,
+             &DxeCoreEntryPoint
+             );
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  //
+  // Add HOB for the DXE Core
+  //
+  BuildModuleHob (
+    &DxeCoreFileName,
+    DxeCoreAddress,
+    DxeCoreSize,
+    DxeCoreEntryPoint
+    );
+
+  //
+  // Report Status Code EFI_SW_PEI_PC_HANDOFF_TO_NEXT
+  //
+  REPORT_STATUS_CODE (
+    EFI_PROGRESS_CODE,
+    EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT
+    );
+
+  DEBUG ((EFI_D_INFO, "DXE Core Entry\n"));
+  //
+  // Go to Long Mode. Interrupts will not get turned on until the CPU AP is loaded.
+  // Call x64 drivers passing in single argument, a pointer to the HOBs.
+  //
+  ActivateLongMode (
+    PageTables, 
+    (EFI_PHYSICAL_ADDRESS)(UINTN)(HobList.Raw), 
+    TopOfStack,
+    0x00000000,
+    DxeCoreEntryPoint
+    );
+
+  //
+  // If we get here, then the DXE Core returned.  This is an error
+  //
+  ASSERT_EFI_ERROR (Status);
+
+  return EFI_OUT_OF_RESOURCES;
+}
+
+EFI_STATUS
+PeiFindFile (
+  IN  UINT8                  Type,
+  IN  UINT16                 SectionType,
+  OUT EFI_GUID               *FileName,
+  OUT VOID                   **Pe32Data
+  )
+/*++
+
+Routine Description:
+
+  Finds a PE/COFF of a specific Type and SectionType in the Firmware Volumes
+  described in the HOB list. Able to search in a compression set in a FFS file.
+  But only one level of compression is supported, that is, not able to search
+  in a compression set that is within another compression set.
+
+Arguments:
+
+  Type        - The Type of file to retrieve
+
+  SectionType - The type of section to retrieve from a file
+
+  FileName    - The name of the file found in the Firmware Volume
+
+  Pe32Data    - Pointer to the beginning of the PE/COFF file found in the Firmware Volume
+
+Returns:
+
+  EFI_SUCCESS   - The file was found, and the name is returned in FileName, and a pointer to
+                  the PE/COFF image is returned in Pe32Data
+
+  EFI_NOT_FOUND - The file was not found in the Firmware Volumes present in the HOB List
+
+--*/
+{
+  EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader;
+  EFI_FFS_FILE_HEADER         *FfsFileHeader;
+  VOID                        *SectionData;
+  EFI_STATUS                  Status;
+  EFI_PEI_HOB_POINTERS        Hob;
+
+
+  FwVolHeader   = NULL;
+  FfsFileHeader = NULL;
+  SectionData   = NULL;
+
+  //
+  // Foreach Firmware Volume, look for a specified type
+  // of file and break out when one is found
+  //
+  Hob.Raw = GetHobList ();
+  while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV, Hob.Raw)) != NULL) {
+    FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (Hob.FirmwareVolume->BaseAddress);
+    Status = PeiCoreFfsFindNextFile (
+               Type,
+               FwVolHeader,
+               &FfsFileHeader
+               );
+    if (!EFI_ERROR (Status)) {
+      CopyMem (FileName, &FfsFileHeader->Name, sizeof (EFI_GUID));
+      Status = PeiProcessFile (
+                 SectionType,
+                 FfsFileHeader,
+                 Pe32Data
+                 );
+      return Status;
+    }
+    Hob.Raw = GET_NEXT_HOB (Hob);
+  }
+  return EFI_NOT_FOUND;
+}
+
+EFI_STATUS
+PeiLoadx64File (
+  IN  EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader,
+  IN  VOID                                      *Pe32Data,
+  IN  EFI_MEMORY_TYPE                           MemoryType,
+  OUT EFI_PHYSICAL_ADDRESS                      *ImageAddress,
+  OUT UINT64                                    *ImageSize,
+  OUT EFI_PHYSICAL_ADDRESS                      *EntryPoint
+  )
+/*++
+
+Routine Description:
+
+  Loads and relocates a PE/COFF image into memory.
+
+Arguments:
+
+  PeiEfiPeiPeCoffLoader - Pointer to a PE COFF loader protocol
+
+  Pe32Data         - The base address of the PE/COFF file that is to be loaded and relocated
+
+  ImageAddress     - The base address of the relocated PE/COFF image
+
+  ImageSize        - The size of the relocated PE/COFF image
+
+  EntryPoint       - The entry point of the relocated PE/COFF image
+
+Returns:
+
+  EFI_SUCCESS                     - The file was loaded and relocated
+  EFI_OUT_OF_RESOURCES            - There was not enough memory to load and relocate the PE/COFF file
+
+--*/
+{
+  EFI_STATUS                            Status;
+  PE_COFF_LOADER_IMAGE_CONTEXT          ImageContext;
+  EFI_PHYSICAL_ADDRESS                  MemoryBuffer;
+
+  ZeroMem (&ImageContext, sizeof (ImageContext));
+  ImageContext.Handle = Pe32Data;
+  Status              = GetImageReadFunction (&ImageContext);
+
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PeiEfiPeiPeCoffLoader->GetImageInfo (PeiEfiPeiPeCoffLoader, &ImageContext);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+  //
+  // Allocate Memory for the image
+  //
+  //
+  // Allocate Memory for the image
+  //
+  PeiCoreAllocatePages (MemoryType, EFI_SIZE_TO_PAGES ((UINT32) ImageContext.ImageSize), &MemoryBuffer);
+  ImageContext.ImageAddress = MemoryBuffer;
+  ASSERT (ImageContext.ImageAddress != 0);
+
+  //
+  // Load the image to our new buffer
+  //
+
+  Status = PeiEfiPeiPeCoffLoader->LoadImage (PeiEfiPeiPeCoffLoader, &ImageContext);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+  
+  //
+  // Relocate the image in our new buffer
+  //
+  Status = PeiEfiPeiPeCoffLoader->RelocateImage (PeiEfiPeiPeCoffLoader, &ImageContext);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  //
+  // Flush the instruction cache so the image data is written before we execute it
+  //
+  InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
+
+  *ImageAddress = ImageContext.ImageAddress;
+  *ImageSize    = ImageContext.ImageSize;
+  *EntryPoint   = ImageContext.EntryPoint;
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+ShadowDxeIpl (
+  IN EFI_FFS_FILE_HEADER                       *DxeIplFileHeader,
+  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader
+  )
+/*++
+
+Routine Description:
+
+  Shadow the DXE IPL to a different memory location. This occurs after permanent
+  memory has been discovered.
+
+Arguments:
+
+  DxeIplFileHeader      - Pointer to the FFS file header of the DXE IPL driver
+
+  PeiEfiPeiPeCoffLoader - Pointer to a PE COFF loader protocol
+
+Returns:
+
+  EFI_SUCCESS   - DXE IPL was successfully shadowed to a different memory location.
+
+  EFI_ ERROR    - The shadow was unsuccessful.
+
+
+--*/
+{
+  UINTN                     SectionLength;
+  UINTN                     OccupiedSectionLength;
+  EFI_PHYSICAL_ADDRESS      DxeIplAddress;
+  UINT64                    DxeIplSize;
+  EFI_PHYSICAL_ADDRESS      DxeIplEntryPoint;
+  EFI_STATUS                Status;
+  EFI_COMMON_SECTION_HEADER *Section;
+
+  Section = (EFI_COMMON_SECTION_HEADER *) (DxeIplFileHeader + 1);
+
+  while ((Section->Type != EFI_SECTION_PE32) && (Section->Type != EFI_SECTION_TE)) {
+    SectionLength         = *(UINT32 *) (Section->Size) & 0x00ffffff;
+    OccupiedSectionLength = GetOccupiedSize (SectionLength, 4);
+    Section               = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + OccupiedSectionLength);
+  }
+  
+  //
+  // Relocate DxeIpl into memory by using loadfile service
+  //
+  Status = PeiLoadx64File (
+            PeiEfiPeiPeCoffLoader,
+            (VOID *) (Section + 1),
+            EfiBootServicesData,
+            &DxeIplAddress,
+            &DxeIplSize,
+            &DxeIplEntryPoint
+            );
+  if (Status == EFI_SUCCESS) {
+    //
+    // Install PeiInMemory to indicate the Dxeipl is shadowed
+    //
+    Status = PeiCoreInstallPpi (&mPpiPeiInMemory);
+
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    Status = ((EFI_PEIM_ENTRY_POINT) (UINTN) DxeIplEntryPoint) (DxeIplFileHeader, GetPeiServicesTablePointer());
+  }
+
+  return Status;
+}
+
+EFI_STATUS
+EFIAPI
+DxeIplLoadFile (
+  IN EFI_PEI_FV_FILE_LOADER_PPI                 *This,
+  IN  EFI_FFS_FILE_HEADER                       *FfsHeader,
+  OUT EFI_PHYSICAL_ADDRESS                      *ImageAddress,
+  OUT UINT64                                    *ImageSize,
+  OUT EFI_PHYSICAL_ADDRESS                      *EntryPoint
+  )
+/*++
+
+Routine Description:
+
+  Given a pointer to an FFS file containing a PE32 image, get the
+  information on the PE32 image, and then "load" it so that it
+  can be executed.
+
+Arguments:
+
+  This  - pointer to our file loader protocol
+  FfsHeader - pointer to the FFS file header of the FFS file that
+              contains the PE32 image we want to load
+  ImageAddress  - returned address where the PE32 image is loaded
+  ImageSize     - returned size of the loaded PE32 image
+  EntryPoint    - entry point to the loaded PE32 image
+
+Returns:
+  EFI_SUCCESS  - The FFS file was successfully loaded.
+  EFI_ERROR    - Unable to load the FFS file.
+
+--*/
+{
+  EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader;
+  EFI_STATUS                                Status;
+  VOID                                      *Pe32Data;
+
+  Pe32Data = NULL;
+  PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();
+
+  //
+  // Preprocess the FFS file to get a pointer to the PE32 information
+  // in the enclosed PE32 image.
+  //
+  Status = PeiProcessFile (
+            EFI_SECTION_PE32,
+            FfsHeader,
+            &Pe32Data
+            );
+
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+  //
+  // Load the PE image from the FFS file
+  //
+  Status = PeiLoadx64File (
+            PeiEfiPeiPeCoffLoader,
+            Pe32Data,
+            EfiBootServicesData,
+            ImageAddress,
+            ImageSize,
+            EntryPoint
+            );
+
+  return Status;
+}
+
+EFI_STATUS
+PeiProcessFile (
+  IN  UINT16                 SectionType,
+  IN  EFI_FFS_FILE_HEADER    *FfsFileHeader,
+  OUT VOID                   **Pe32Data
+  )
+/*++
+
+Routine Description:
+
+Arguments:
+
+  SectionType       - The type of section in the FFS file to process.
+
+  FfsFileHeader     - Pointer to the FFS file to process, looking for the
+                      specified SectionType
+
+  Pe32Data          - returned pointer to the start of the PE32 image found
+                      in the FFS file.
+
+Returns:
+
+  EFI_SUCCESS       - found the PE32 section in the FFS file
+
+--*/
+{
+  EFI_STATUS                      Status;
+  VOID                            *SectionData;
+  DECOMPRESS_LIBRARY              *DecompressLibrary;
+  UINT8                           *DstBuffer;
+  UINT8                           *ScratchBuffer;
+  UINT32                          DstBufferSize;
+  UINT32                          ScratchBufferSize;
+  EFI_COMMON_SECTION_HEADER       *CmpSection;
+  UINTN                           CmpSectionLength;
+  UINTN                           OccupiedCmpSectionLength;
+  VOID                            *CmpFileData;
+  UINTN                           CmpFileSize;
+  EFI_COMMON_SECTION_HEADER       *Section;
+  UINTN                           SectionLength;
+  UINTN                           OccupiedSectionLength;
+  UINT64                          FileSize;
+  EFI_GUID_DEFINED_SECTION        *GuidedSectionHeader;
+  UINT32                          AuthenticationStatus;
+  EFI_PEI_SECTION_EXTRACTION_PPI  *SectionExtract;
+  UINT32                          BufferSize;
+  UINT8                           *Buffer;
+  EFI_PEI_SECURITY_PPI            *Security;
+  BOOLEAN                         StartCrisisRecovery;
+  EFI_GUID                        TempGuid;
+  EFI_FIRMWARE_VOLUME_HEADER      *FvHeader;
+  EFI_COMPRESSION_SECTION         *CompressionSection;
+
+  Status = PeiCoreFfsFindSectionData (
+             EFI_SECTION_COMPRESSION,
+             FfsFileHeader,
+             &SectionData
+             );
+
+  //
+  // Upon finding a DXE Core file, see if there is first a compression section
+  //
+  if (!EFI_ERROR (Status)) {
+    //
+    // Yes, there is a compression section, so extract the contents
+    // Decompress the image here
+    //
+    Section = (EFI_COMMON_SECTION_HEADER *) (UINTN) (VOID *) ((UINT8 *) (FfsFileHeader) + (UINTN) sizeof (EFI_FFS_FILE_HEADER));
+
+    do {
+      SectionLength         = *(UINT32 *) (Section->Size) & 0x00ffffff;
+      OccupiedSectionLength = GetOccupiedSize (SectionLength, 4);
+
+      //
+      // Was the DXE Core file encapsulated in a GUID'd section?
+      //
+      if (Section->Type == EFI_SECTION_GUID_DEFINED) {
+        //
+        // Locate the GUID'd Section Extractor
+        //
+        GuidedSectionHeader = (VOID *) (Section + 1);
+
+        //
+        // This following code constitutes the addition of the security model
+        // to the DXE IPL.
+        //
+        //
+        // Set a default authenticatino state
+        //
+        AuthenticationStatus = 0;
+
+        Status = PeiCoreLocatePpi (
+                   &gEfiPeiSectionExtractionPpiGuid,
+                   0,
+                   NULL,
+                   (VOID **)&SectionExtract
+                   );
+
+        if (EFI_ERROR (Status)) {
+          return Status;
+        }
+        //
+        // Verify Authentication State
+        //
+        CopyMem (&TempGuid, Section + 1, sizeof (EFI_GUID));
+
+        Status = SectionExtract->PeiGetSection (
+                                  GetPeiServicesTablePointer(),
+                                  SectionExtract,
+                                  (EFI_SECTION_TYPE *) &SectionType,
+                                  &TempGuid,
+                                  0,
+                                  (VOID **) &Buffer,
+                                  &BufferSize,
+                                  &AuthenticationStatus
+                                  );
+
+        if (EFI_ERROR (Status)) {
+          return Status;
+        }
+        //
+        // If not ask the Security PPI, if exists, for disposition
+        //
+        //
+        Status = PeiCoreLocatePpi (
+                   &gEfiPeiSecurityPpiGuid,
+                   0,
+                   NULL,
+                   (VOID **)&Security
+                   );
+        if (EFI_ERROR (Status)) {
+          return Status;
+        }
+
+        Status = Security->AuthenticationState (
+                            GetPeiServicesTablePointer(),
+                            (struct _EFI_PEI_SECURITY_PPI *) Security,
+                            AuthenticationStatus,
+                            FfsFileHeader,
+                            &StartCrisisRecovery
+                            );
+
+        if (EFI_ERROR (Status)) {
+          return Status;
+        }
+        //
+        // If there is a security violation, report to caller and have
+        // the upper-level logic possible engender a crisis recovery
+        //
+        if (StartCrisisRecovery) {
+          return EFI_SECURITY_VIOLATION;
+        }
+      }
+
+      if (Section->Type == EFI_SECTION_PE32) {
+        //
+        // This is what we want
+        //
+        *Pe32Data = (VOID *) (Section + 1);
+        return EFI_SUCCESS;
+      } else if (Section->Type == EFI_SECTION_COMPRESSION) {
+        //
+        // This is a compression set, expand it
+        //
+        CompressionSection  = (EFI_COMPRESSION_SECTION *) Section;
+
+        switch (CompressionSection->CompressionType) {
+        case EFI_STANDARD_COMPRESSION:
+          DecompressLibrary = &gTianoDecompress;
+          break;
+
+        case EFI_CUSTOMIZED_COMPRESSION:
+          //
+          // Load user customized compression protocol.
+          //
+          DecompressLibrary = &gCustomDecompress;
+          break;
+
+        case EFI_NOT_COMPRESSED:
+        default:
+          //
+          // Need to support not compressed file
+          //
+          ASSERT_EFI_ERROR (Status);
+          return EFI_NOT_FOUND;
+        }
+
+        Status = DecompressLibrary->GetInfo (
+                   (UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
+                   (UINT32) SectionLength - sizeof (EFI_COMPRESSION_SECTION),
+                   &DstBufferSize,
+                   &ScratchBufferSize
+                   );
+        if (EFI_ERROR (Status)) {
+          //
+          // GetInfo failed
+          //
+          return EFI_NOT_FOUND;
+        }
+
+        //
+        // Allocate scratch buffer
+        //
+        ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));
+        if (ScratchBuffer == NULL) {
+          return EFI_OUT_OF_RESOURCES;
+        }
+
+        //
+        // Allocate destination buffer
+        //
+        DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
+        if (DstBuffer == NULL) {
+          return EFI_OUT_OF_RESOURCES;
+        }
+
+        //
+        // Call decompress function
+        //
+        Status = DecompressLibrary->Decompress (
+                    (CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
+                    DstBuffer,
+                    ScratchBuffer
+                    );
+
+        CmpSection = (EFI_COMMON_SECTION_HEADER *) DstBuffer;
+        if (CmpSection->Type == EFI_SECTION_RAW) {
+          //
+          // Skip the section header and
+          // adjust the pointer alignment to 16
+          //
+          FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (DstBuffer + 16);
+
+          if (FvHeader->Signature == EFI_FVH_SIGNATURE) {
+            FfsFileHeader = NULL;
+            BuildFvHob ((EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader, FvHeader->FvLength);
+            Status = PeiCoreFfsFindNextFile (
+                       EFI_FV_FILETYPE_DXE_CORE,
+                       FvHeader,
+                       &FfsFileHeader
+                       );
+
+            if (EFI_ERROR (Status)) {
+              return EFI_NOT_FOUND;
+            }
+
+            return PeiProcessFile (SectionType, FfsFileHeader, Pe32Data);
+          }
+        }
+        //
+        // Decompress successfully.
+        // Loop the decompressed data searching for expected section.
+        //
+        CmpFileData = (VOID *) DstBuffer;
+        CmpFileSize = DstBufferSize;
+        do {
+          CmpSectionLength = *(UINT32 *) (CmpSection->Size) & 0x00ffffff;
+          if (CmpSection->Type == EFI_SECTION_PE32) {
+            //
+            // This is what we want
+            //
+            *Pe32Data = (VOID *) (CmpSection + 1);
+            return EFI_SUCCESS;
+          }
+
+          OccupiedCmpSectionLength  = GetOccupiedSize (CmpSectionLength, 4);
+          CmpSection                = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) CmpSection + OccupiedCmpSectionLength);
+        } while (CmpSection->Type != 0 && (UINTN) ((UINT8 *) CmpSection - (UINT8 *) CmpFileData) < CmpFileSize);
+      }
+
+      Section   = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + OccupiedSectionLength);
+      FileSize  = FfsFileHeader->Size[0] & 0xFF;
+      FileSize += (FfsFileHeader->Size[1] << 8) & 0xFF00;
+      FileSize += (FfsFileHeader->Size[2] << 16) & 0xFF0000;
+      FileSize &= 0x00FFFFFF;
+    } while (Section->Type != 0 && (UINTN) ((UINT8 *) Section - (UINT8 *) FfsFileHeader) < FileSize);
+
+    //
+    // End of the decompression activity
+    //
+  } else {
+
+    Status = PeiCoreFfsFindSectionData (
+               EFI_SECTION_PE32,
+               FfsFileHeader,
+               &SectionData
+               );
+
+    if (EFI_ERROR (Status)) {
+      Status = PeiCoreFfsFindSectionData (
+                 EFI_SECTION_TE,
+                 FfsFileHeader,
+                 &SectionData
+                 );
+      if (EFI_ERROR (Status)) {
+        return Status;
+      }
+    }
+  }
+
+  *Pe32Data = SectionData;
+
+  return EFI_SUCCESS;
 }
\ No newline at end of file
index bb88e8a..158d088 100644 (file)
@@ -1,47 +1,74 @@
-<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation \r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->\r
-<project basedir="." default="DxeIpl"><!--Apply external ANT tasks-->\r
-   <taskdef resource="GenBuild.tasks"/>\r
-   <taskdef resource="net/sf/antcontrib/antlib.xml"/>\r
-   <property environment="env"/>\r
-   <property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>\r
-   <import file="${WORKSPACE_DIR}/Tools/Conf/BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->\r
-   <property name="MODULE_RELATIVE_PATH" value="Core/DxeIplPeim"/>\r
-   <property name="MODULE_DIR" value="${PACKAGE_DIR}/${MODULE_RELATIVE_PATH}"/>\r
-   <property name="COMMON_FILE" value="${WORKSPACE_DIR}/Tools/Conf/Common.xml"/>\r
-   <target name="DxeIpl">\r
-      <GenBuild baseName="DxeIpl" mbdFilename="${MODULE_DIR}/DxeIpl.mbd" msaFilename="${MODULE_DIR}/DxeIpl.msa"/>\r
-   </target>\r
-   <target depends="DxeIpl_clean" name="clean"/>\r
-   <target depends="DxeIpl_cleanall" name="cleanall"/>\r
-   <target name="DxeIpl_clean">\r
-      <OutputDirSetup baseName="DxeIpl" mbdFilename="${MODULE_DIR}/DxeIpl.mbd" msaFilename="${MODULE_DIR}/DxeIpl.msa"/>\r
-      <if>\r
-         <available file="${DEST_DIR_OUTPUT}/DxeIpl_build.xml"/>\r
-         <then>\r
-            <ant antfile="${DEST_DIR_OUTPUT}/DxeIpl_build.xml" target="clean"/>\r
-         </then>\r
-      </if>\r
-      <delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>\r
-   </target>\r
-   <target name="DxeIpl_cleanall">\r
-      <OutputDirSetup baseName="DxeIpl" mbdFilename="${MODULE_DIR}/DxeIpl.mbd" msaFilename="${MODULE_DIR}/DxeIpl.msa"/>\r
-      <if>\r
-         <available file="${DEST_DIR_OUTPUT}/DxeIpl_build.xml"/>\r
-         <then>\r
-            <ant antfile="${DEST_DIR_OUTPUT}/DxeIpl_build.xml" target="cleanall"/>\r
-         </then>\r
-      </if>\r
-      <delete dir="${DEST_DIR_OUTPUT}"/>\r
-      <delete dir="${DEST_DIR_DEBUG}"/>\r
-      <delete>\r
-         <fileset dir="${BIN_DIR}" includes="**DxeIpl*"/>\r
-      </delete>\r
-   </target>\r
+<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation 
+All rights reserved. This program and the accompanying materials 
+are licensed and made available under the terms and conditions of the BSD License 
+which accompanies this distribution.  The full text of the license may be found at  
+http://opensource.org/licenses/bsd-license.php 
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
+<project basedir="." default="DxeIpl"><!--Apply external ANT tasks-->
+   <taskdef resource="GenBuild.tasks"/>
+   <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+   <property environment="env"/>
+   <property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
+   <import file="${WORKSPACE_DIR}/Tools/Conf/BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
+   <property name="MODULE_RELATIVE_PATH" value="Core/DxeIplPeim"/>
+   <property name="MODULE_DIR" value="${PACKAGE_DIR}/${MODULE_RELATIVE_PATH}"/>
+   <property name="COMMON_FILE" value="${WORKSPACE_DIR}/Tools/Conf/Common.xml"/>
+   <target name="DxeIplX64">
+      <GenBuild baseName="DxeIplX64" mbdFilename="${MODULE_DIR}/DxeIplX64.mbd" msaFilename="${MODULE_DIR}/DxeIplX64.msa"/>
+   </target>
+   <target name="DxeIpl">
+      <GenBuild baseName="DxeIpl" mbdFilename="${MODULE_DIR}/DxeIpl.mbd" msaFilename="${MODULE_DIR}/DxeIpl.msa"/>
+   </target>
+   <target depends="DxeIpl_clean" name="clean"/>
+   <target depends="DxeIpl_cleanall" name="cleanall"/>
+   <target name="DxeIplX64_clean">
+      <OutputDirSetup baseName="DxeIplX64" mbdFilename="${MODULE_DIR}/DxeIplX64.mbd" msaFilename="${MODULE_DIR}/DxeIplX64.msa"/>
+      <if>
+         <available file="${DEST_DIR_OUTPUT}/DxeIplX64_build.xml"/>
+         <then>
+            <ant antfile="${DEST_DIR_OUTPUT}/DxeIplX64_build.xml" target="clean"/>
+         </then>
+      </if>
+      <delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
+   </target>
+   <target name="DxeIpl_clean">
+      <OutputDirSetup baseName="DxeIpl" mbdFilename="${MODULE_DIR}/DxeIpl.mbd" msaFilename="${MODULE_DIR}/DxeIpl.msa"/>
+      <if>
+         <available file="${DEST_DIR_OUTPUT}/DxeIpl_build.xml"/>
+         <then>
+            <ant antfile="${DEST_DIR_OUTPUT}/DxeIpl_build.xml" target="clean"/>
+         </then>
+      </if>
+      <delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
+   </target>
+   <target name="DxeIplX64_cleanall">
+      <OutputDirSetup baseName="DxeIplX64" mbdFilename="${MODULE_DIR}/DxeIplX64.mbd" msaFilename="${MODULE_DIR}/DxeIplX64.msa"/>
+      <if>
+         <available file="${DEST_DIR_OUTPUT}/DxeIplX64_build.xml"/>
+         <then>
+            <ant antfile="${DEST_DIR_OUTPUT}/DxeIplX64_build.xml" target="cleanall"/>
+         </then>
+      </if>
+      <delete dir="${DEST_DIR_OUTPUT}"/>
+      <delete dir="${DEST_DIR_DEBUG}"/>
+      <delete>
+         <fileset dir="${BIN_DIR}" includes="**DxeIplX64*"/>
+      </delete>
+   </target>
+   <target name="DxeIpl_cleanall">
+      <OutputDirSetup baseName="DxeIpl" mbdFilename="${MODULE_DIR}/DxeIpl.mbd" msaFilename="${MODULE_DIR}/DxeIpl.msa"/>
+      <if>
+         <available file="${DEST_DIR_OUTPUT}/DxeIpl_build.xml"/>
+         <then>
+            <ant antfile="${DEST_DIR_OUTPUT}/DxeIpl_build.xml" target="cleanall"/>
+         </then>
+      </if>
+      <delete dir="${DEST_DIR_OUTPUT}"/>
+      <delete dir="${DEST_DIR_DEBUG}"/>
+      <delete>
+         <fileset dir="${BIN_DIR}" includes="**DxeIpl*"/>
+      </delete>
+   </target>
 </project>
\ No newline at end of file
index a9c4e77..ae87bd8 100644 (file)
-      TITLE   LongMode.asm: Assembly code for the entering long mode\r
-\r
-;------------------------------------------------------------------------------\r
-;*\r
-;*   Copyright (c) 2006, Intel Corporation                                                         \r
-;*   All rights reserved. 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
-;*                                                                                             \r
-;*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-;*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-;*   \r
-;*    LongMode.asm\r
-;*  \r
-;*   Abstract:\r
-;*\r
-;*    Transition from 32-bit protected mode EFI environment into x64 \r
-;*    64-bit bit long mode.\r
-;*  \r
-;------------------------------------------------------------------------------\r
-\r
-.686p\r
-.model  flat        \r
-\r
-;\r
-; Create the exception handler code in IA32 C code\r
-;\r
-\r
-.code\r
-.stack\r
-.MMX\r
-.XMM\r
-\r
-_LoadGo64Gdt   PROC Near Public\r
-    push    ebp               ; C prolog\r
-    push    edi\r
-    mov     ebp, esp\r
-    ;\r
-    ; Disable interrupts\r
-    ;\r
-    cli\r
-    ;\r
-    ; Reload the selectors\r
-    ; Note:\r
-    ;      Make the Selectors 64-bit ready\r
-    ;\r
-    mov     edi, OFFSET gdtr    ; Load GDT register\r
-    mov     ax,cs               ; Get the selector data from our code image          \r
-    mov     es,ax\r
-    lgdt    FWORD PTR es:[edi]  ; and update the GDTR   \r
-\r
-    db      067h\r
-    db      0eah              ; Far Jump Offset:Selector to reload CS\r
-    dd      OFFSET DataSelectorRld;   Offset is ensuing instruction boundary\r
-    dw      LINEAR_CODE_SEL   ;   Selector is our code selector, 10h\r
-DataSelectorRld::\r
-    mov     ax, SYS_DATA_SEL ; Update the Base for the new selectors, too\r
-    mov     ds, ax\r
-    mov     es, ax\r
-    mov     fs, ax\r
-    mov     gs, ax\r
-    mov     ss, ax  \r
-    \r
-    pop     edi\r
-    pop     ebp\r
-    ret\r
-_LoadGo64Gdt endp   \r
-    \r
-\r
-; VOID\r
-; ActivateLongMode (\r
-;   IN  EFI_PHYSICAL_ADDRESS  PageTables,  \r
-;   IN  EFI_PHYSICAL_ADDRESS  HobStart,\r
-;   IN  EFI_PHYSICAL_ADDRESS  Stack,\r
-;   IN  EFI_PHYSICAL_ADDRESS  PpisNeededByDxeIplEntryPoint,\r
-;   IN  EFI_PHYSICAL_ADDRESS  DxeCoreEntryPoint\r
-;   )\r
-;\r
-; Input:  [ebp][0h]  = Original ebp\r
-;         [ebp][4h]  = Return address\r
-;         [ebp][8h]  = PageTables\r
-;         [ebp][10h] = HobStart\r
-;         [ebp][18h] = Stack\r
-;         [ebp][20h] = CodeEntryPoint1 <--- Call this first (for each call, pass HOB pointer)\r
-;         [ebp][28h] = CodeEntryPoint2 <--- Call this second\r
-;\r
-;\r
-_ActivateLongMode  PROC Near Public\r
-    push    ebp               ; C prolog\r
-    mov     ebp, esp\r
-\r
-    ;\r
-    ; Use CPUID to determine if the processor supports long mode.\r
-    ;\r
-    mov     eax, 80000000h  ; Extended-function code 8000000h.\r
-    cpuid                   ; Is largest extended function\r
-    cmp     eax, 80000000h  ; any function > 80000000h?\r
-    jbe     no_long_mode    ; If not, no long mode.\r
-    mov     eax, 80000001h  ; Extended-function code 8000001h.\r
-    cpuid                   ; Now EDX = extended-features flags.\r
-    bt      edx, 29         ; Test if long mode is supported.\r
-    jnc     no_long_mode    ; Exit if not supported.\r
-\r
-    ;\r
-    ; Enable the 64-bit page-translation-table entries by\r
-    ; setting CR4.PAE=1 (this is _required_ before activating\r
-    ; long mode). Paging is not enabled until after long mode\r
-    ; is enabled.\r
-    ;\r
-    mov eax, cr4\r
-    bts eax, 5\r
-    mov cr4, eax\r
-\r
-    ;\r
-    ; Get the long-mode page tables, and initialize the\r
-    ; 64-bit CR3 (page-table base address) to point to the base\r
-    ; of the PML4 page table. The PML4 page table must be located\r
-    ; below 4 Gbytes because only 32 bits of CR3 are loaded when\r
-    ; the processor is not in 64-bit mode.\r
-    ;\r
-    mov eax, [ebp+8h]       ; Get Page Tables\r
-    mov cr3, eax            ; Initialize CR3 with PML4 base.\r
-\r
-    ;\r
-    ; Enable long mode (set EFER.LME=1).\r
-    ;\r
-    mov ecx, 0c0000080h ; EFER MSR number.\r
-    rdmsr               ; Read EFER.\r
-    bts eax, 8          ; Set LME=1.\r
-    wrmsr               ; Write EFER.\r
-\r
-    ;\r
-    ; Enable paging to activate long mode (set CR0.PG=1)\r
-    ;\r
-   \r
-   \r
-    mov eax, cr0 ; Read CR0.\r
-    bts eax, 31  ; Set PG=1.\r
-    mov cr0, eax ; Write CR0.\r
-    jmp   go_to_long_mode\r
-go_to_long_mode:\r
-\r
-    ;\r
-    ; This is the next instruction after enabling paging.  Jump to long mode\r
-    ;\r
-    db      067h\r
-    db      0eah              ; Far Jump Offset:Selector to reload CS\r
-    dd      OFFSET in_long_mode;   Offset is ensuing instruction boundary\r
-    dw      SYS_CODE64_SEL    ;   Selector is our code selector, 10h\r
-in_long_mode::\r
-    mov     ax, SYS_DATA64_SEL\r
-    mov     es, ax\r
-    mov     ss, ax\r
-    mov     ds, ax\r
-;;    jmp     $\r
-    \r
-           \r
-    ;\r
-    ; We're in long mode, so marshall the arguments to call the\r
-    ; passed in function pointers\r
-    ; Recall\r
-    ;         [ebp][10h] = HobStart\r
-    ;         [ebp][18h] = Stack\r
-    ;         [ebp][20h] = PpisNeededByDxeIplEntryPoint <--- Call this first (for each call, pass HOB pointer)\r
-    ;         [ebp][28h] = DxeCoreEntryPoint            <--- Call this second\r
-    ;\r
-    db  48h\r
-    mov ebx, [ebp+18h]        ; Setup the stack\r
-    db  48h\r
-    mov esp, ebx              ; On a new stack now\r
-\r
-    db  48h\r
-    mov ecx, [ebp+10h]        ; Pass Hob Start in RCX\r
-    db  48h\r
-    mov eax, [ebp+20h]        ; Get the function pointer for \r
-                              ; PpisNeededByDxeIplEntryPoint into EAX\r
-\r
-;; 00000905  FF D0                 call rax\r
-    db 0ffh\r
-    db 0d0h\r
-\r
-    db  48h\r
-    mov ecx, [ebp+10h]        ; Pass Hob Start in RCX\r
-    db  48h\r
-    mov eax, [ebp+28h]        ; Get the function pointer for \r
-                              ; DxeCoreEntryPoint into EAX\r
-\r
-;; 00000905  FF D0                 call rax\r
-    db 0ffh\r
-    db 0d0h\r
-\r
-    ;\r
-    ; WE SHOULD NEVER GET HERE!!!!!!!!!!!!!\r
-    ;\r
-no_long_mode:\r
-    jmp   no_long_mode\r
-_ActivateLongMode endp\r
-\r
-        align 16\r
-\r
-gdtr    dw GDT_END - GDT_BASE - 1   ; GDT limit\r
-        dd OFFSET GDT_BASE          ; (GDT base gets set above)\r
-\r
-;-----------------------------------------------------------------------------;\r
-;   global descriptor table (GDT)\r
-;-----------------------------------------------------------------------------;\r
-\r
-        align 16\r
-\r
-public GDT_BASE\r
-GDT_BASE:\r
-; null descriptor\r
-NULL_SEL            equ $-GDT_BASE    ; Selector [0]\r
-        dw 0            ; limit 15:0\r
-        dw 0            ; base 15:0\r
-        db 0            ; base 23:16\r
-        db 0            ; type\r
-        db 0            ; limit 19:16, flags\r
-        db 0            ; base 31:24\r
-\r
-; linear data segment descriptor\r
-LINEAR_SEL      equ $-GDT_BASE        ; Selector [0x8]\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 092h         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; linear code segment descriptor\r
-LINEAR_CODE_SEL equ $-GDT_BASE        ; Selector [0x10]\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 09Fh         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; system data segment descriptor\r
-SYS_DATA_SEL    equ $-GDT_BASE        ; Selector [0x18]\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 093h         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; system code segment descriptor\r
-SYS_CODE_SEL    equ $-GDT_BASE        ; Selector [0x20]\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 09Ah         ; present, ring 0, data, expand-up, writable\r
-        db 0CFh                 ; page-granular, 32-bit\r
-        db 0\r
-\r
-; spare segment descriptor\r
-SPARE3_SEL  equ $-GDT_BASE            ; Selector [0x28]\r
-        dw 0            ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 0            ; present, ring 0, data, expand-up, writable\r
-        db 0            ; page-granular, 32-bit\r
-        db 0\r
-\r
-;\r
-; system data segment descriptor\r
-;\r
-SYS_DATA64_SEL    equ $-GDT_BASE          ; Selector [0x30]\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 092h         ; P | DPL [1..2] | 1   | 1   | C | R | A\r
-        db 0CFh         ; G | D   | L    | AVL | Segment [19..16]\r
-        db 0\r
-\r
-;\r
-; system code segment descriptor\r
-;\r
-SYS_CODE64_SEL    equ $-GDT_BASE          ; Selector [0x38]\r
-        dw 0FFFFh       ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 09Ah         ; P | DPL [1..2] | 1   | 1   | C | R | A\r
-        db 0AFh         ; G | D   | L    | AVL | Segment [19..16]\r
-        db 0\r
-\r
-; spare segment descriptor\r
-SPARE4_SEL  equ $-GDT_BASE            ; Selector [0x40]\r
-        dw 0            ; limit 0xFFFFF\r
-        dw 0            ; base 0\r
-        db 0\r
-        db 0            ; present, ring 0, data, expand-up, writable\r
-        db 0            ; page-granular, 32-bit\r
-        db 0\r
-\r
-GDT_END:\r
-\r
-;\r
-;\r
-;------------------------------------------------------------------------------\r
-;  Generic IDT Vector Handlers for the Host. They are all the same so they\r
-;  will compress really well.\r
-;\r
-;  By knowing the return address for Vector 00 you can can calculate the\r
-;  vector number by looking at the call CommonInterruptEntry return address.\r
-;  (return address - AsmIdtVector00Base)/8 == IDT index\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-_AsmIdtVector00 PROC NEAR PUBLIC\r
-    call  CommonInterruptEntry\r
-_AsmIdtVector00 ENDP\r
-AsmIdtVector00Base PROC NEAR PUBLIC\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-    call  CommonInterruptEntry\r
-       nop\r
-       nop\r
-       nop\r
-AsmIdtVector00Base ENDP\r
-\r
-\r
-;---------------------------------------;\r
-; CommonInterruptEntry                  ;\r
-;---------------------------------------;\r
-; The follow algorithm is used for the common interrupt routine.\r
-; TBD: Save EFI_SYSTEM_CONTEXT_x64 on the stack per AP definition\r
-;\r
-;\r
-CommonInterruptEntry PROC NEAR PUBLIC\r
-  cli\r
-  jmp   $  \r
-  iret\r
-\r
-CommonInterruptEntry ENDP\r
-\r
-END\r
-\r
+      TITLE   LongMode.asm: Assembly code for the entering long mode
+
+;------------------------------------------------------------------------------
+;*
+;*   Copyright (c) 2006, Intel Corporation                                                         
+;*   All rights reserved. This program and the accompanying materials                          
+;*   are licensed and made available under the terms and conditions of the BSD License         
+;*   which accompanies this distribution.  The full text of the license may be found at        
+;*   http://opensource.org/licenses/bsd-license.php                                            
+;*                                                                                             
+;*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
+;*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+;*   
+;*    LongMode.asm
+;*  
+;*   Abstract:
+;*
+;*    Transition from 32-bit protected mode EFI environment into x64 
+;*    64-bit bit long mode.
+;*  
+;------------------------------------------------------------------------------
+
+.686p
+.model  flat        
+
+;
+; Create the exception handler code in IA32 C code
+;
+
+.code
+.stack
+.MMX
+.XMM
+
+_LoadGo64Gdt   PROC Near Public
+    push    ebp               ; C prolog
+    push    edi
+    mov     ebp, esp
+    ;
+    ; Disable interrupts
+    ;
+    cli
+    ;
+    ; Reload the selectors
+    ; Note:
+    ;      Make the Selectors 64-bit ready
+    ;
+    mov     edi, OFFSET gdtr    ; Load GDT register
+    mov     ax,cs               ; Get the selector data from our code image          
+    mov     es,ax
+    lgdt    FWORD PTR es:[edi]  ; and update the GDTR   
+
+    db      067h
+    db      0eah              ; Far Jump Offset:Selector to reload CS
+    dd      OFFSET DataSelectorRld;   Offset is ensuing instruction boundary
+    dw      LINEAR_CODE_SEL   ;   Selector is our code selector, 10h
+DataSelectorRld::
+    mov     ax, SYS_DATA_SEL ; Update the Base for the new selectors, too
+    mov     ds, ax
+    mov     es, ax
+    mov     fs, ax
+    mov     gs, ax
+    mov     ss, ax  
+    
+    pop     edi
+    pop     ebp
+    ret
+_LoadGo64Gdt endp   
+    
+
+; VOID
+; ActivateLongMode (
+;   IN  EFI_PHYSICAL_ADDRESS  PageTables,  
+;   IN  EFI_PHYSICAL_ADDRESS  HobStart,
+;   IN  EFI_PHYSICAL_ADDRESS  Stack,
+;   IN  EFI_PHYSICAL_ADDRESS  PpisNeededByDxeIplEntryPoint,
+;   IN  EFI_PHYSICAL_ADDRESS  DxeCoreEntryPoint
+;   )
+;
+; Input:  [ebp][0h]  = Original ebp
+;         [ebp][4h]  = Return address
+;         [ebp][8h]  = PageTables
+;         [ebp][10h] = HobStart
+;         [ebp][18h] = Stack
+;         [ebp][20h] = CodeEntryPoint1 <--- Call this first (for each call, pass HOB pointer)
+;         [ebp][28h] = CodeEntryPoint2 <--- Call this second
+;
+;
+_ActivateLongMode  PROC Near Public
+    push    ebp               ; C prolog
+    mov     ebp, esp
+
+    ;
+    ; Use CPUID to determine if the processor supports long mode.
+    ;
+    mov     eax, 80000000h  ; Extended-function code 8000000h.
+    cpuid                   ; Is largest extended function
+    cmp     eax, 80000000h  ; any function > 80000000h?
+    jbe     no_long_mode    ; If not, no long mode.
+    mov     eax, 80000001h  ; Extended-function code 8000001h.
+    cpuid                   ; Now EDX = extended-features flags.
+    bt      edx, 29         ; Test if long mode is supported.
+    jnc     no_long_mode    ; Exit if not supported.
+
+    ;
+    ; Enable the 64-bit page-translation-table entries by
+    ; setting CR4.PAE=1 (this is _required_ before activating
+    ; long mode). Paging is not enabled until after long mode
+    ; is enabled.
+    ;
+    mov eax, cr4
+    bts eax, 5
+    mov cr4, eax
+
+    ;