<Filename>Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa</Filename>\r
<Filename>Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa</Filename>\r
<Filename>Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa</Filename>\r
+ <Filename>Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa</Filename>\r
<Filename>Library/EdkDxeDebugLibReportStatusCode/EdkDxeDebugLibReportStatusCode.msa</Filename>\r
<Filename>Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa</Filename>\r
<Filename>Library/DxePerformanceLib/DxePerformanceLib.msa</Filename>\r
<Filename>Library/EdkDxePrintLib/EdkDxePrintLib.msa</Filename>\r
<Filename>Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa</Filename>\r
<Filename>Library/EdkDxeSalLib/EdkDxeSalLib.msa</Filename>\r
+ <Filename>Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa</Filename>\r
<Filename>Library/EdkFvbServiceLib/EdkFvbServiceLib.msa</Filename>\r
<Filename>Library/EdkGraphicsLib/EdkGraphicsLib.msa</Filename>\r
<Filename>Library/EdkIfrSupportLib/EdkIfrSupportLib.msa</Filename>\r
--- /dev/null
+/** @file\r
+ UEFI Debug Library that uses PrintLib to send messages to CONOUT.\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\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
+**/\r
+\r
+//\r
+// Define the maximum debug and assert message length that this library supports \r
+//\r
+#define MAX_DEBUG_MESSAGE_LENGTH 0x100\r
+\r
+\r
+/**\r
+\r
+ Prints a debug message to the debug output device if the specified error level is enabled.\r
+\r
+ If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print \r
+ the message specified by Format and the associated variable argument list to \r
+ the debug output device.\r
+\r
+ If Format is NULL, then ASSERT().\r
+\r
+ @param ErrorLevel The error level of the debug message.\r
+ @param Format Format string for the debug message to print.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DebugPrint (\r
+ IN UINTN ErrorLevel,\r
+ IN CONST CHAR8 *Format,\r
+ ...\r
+ )\r
+{\r
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
+ VA_LIST Marker;\r
+\r
+ //\r
+ // If Format is NULL, then ASSERT().\r
+ //\r
+ ASSERT (Format != NULL);\r
+\r
+ //\r
+ // Check driver debug mask value and global mask\r
+ //\r
+ if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) {\r
+ return;\r
+ }\r
+\r
+ //\r
+ // Convert the DEBUG() message to an ASCII String\r
+ //\r
+ VA_START (Marker, Format);\r
+ AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);\r
+ VA_END (Marker);\r
+\r
+ //\r
+ // Send the print string to a Serial Port \r
+ //\r
+ SerialPortWrite (Buffer, AsciiStrLen(Buffer));\r
+}\r
+\r
+\r
+/**\r
+\r
+ Prints an assert message containing a filename, line number, and description. \r
+ This may be followed by a breakpoint or a dead loop.\r
+\r
+ Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n" \r
+ to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of \r
+ PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if \r
+ DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then \r
+ CpuDeadLoop() is called. If neither of these bits are set, then this function \r
+ returns immediately after the message is printed to the debug output device.\r
+ DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while\r
+ processing another DebugAssert(), then DebugAssert() must return immediately.\r
+\r
+ If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.\r
+\r
+ If Description is NULL, then a <Description> string of "(NULL) Description" is printed.\r
+\r
+ @param FileName Pointer to the name of the source file that generated the assert condition.\r
+ @param LineNumber The line number in the source file that generated the assert condition\r
+ @param Description Pointer to the description of the assert condition.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DebugAssert (\r
+ IN CONST CHAR8 *FileName,\r
+ IN UINTN LineNumber,\r
+ IN CONST CHAR8 *Description\r
+ )\r
+{\r
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
+\r
+ //\r
+ // Generate the ASSERT() message in Unicode format\r
+ //\r
+ AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, LineNumber, Description);\r
+\r
+ //\r
+ // Send the print string to the Console Output device\r
+ //\r
+ SerialPortWrite (Buffer, AsciiStrLen(Buffer));\r
+\r
+ //\r
+ // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
+ //\r
+ if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
+ CpuBreakpoint ();\r
+ } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
+ CpuDeadLoop ();\r
+ }\r
+}\r
+\r
+\r
+/**\r
+\r
+ Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.\r
+\r
+ This function fills Length bytes of Buffer with the value specified by \r
+ PcdDebugClearMemoryValue, and returns Buffer.\r
+\r
+ If Buffer is NULL, then ASSERT().\r
+\r
+ If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+ @param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue.\r
+ @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
+\r
+ @return Buffer\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+DebugClearMemory (\r
+ OUT VOID *Buffer,\r
+ IN UINTN Length\r
+ )\r
+{\r
+ //\r
+ // If Buffer is NULL, then ASSERT().\r
+ //\r
+ ASSERT (Buffer != NULL);\r
+\r
+ //\r
+ // SetMem() checks for the the ASSERT() condition on Length and returns Buffer\r
+ //\r
+ return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if ASSERT() macros are enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugAssertEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if DEBUG()macros are enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugPrintEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if DEBUG_CODE()macros are enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugCodeEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugClearMemoryEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>DxeDebugLibSerialPort</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>BB83F95F-EDBC-4884-A520-CD42AF388FAE</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Debug Library for UEFI drivers</Abstract>\r
+ <Description>Library to abstract Framework extensions that conflict with UEFI 2.0 Specification</Description>\r
+ <Copyright>Copyright (c) 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>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>UefiDebugLibConOut</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PrintLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PcdLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseMemoryLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>SerialPortLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>DebugLib.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+ <PcdCoded>\r
+ <PcdEntry PcdItemType="FIXED_AT_BUILD">\r
+ <C_Name>PcdDebugPropertyMask</C_Name>\r
+ <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <HelpText>The bitmask of flags that specify the enable/disable of Debug
+ Assert, Debug Print, Debug Code, Clear Memory, Assert
+ Breakpoint and Assert Deadloop.</HelpText>\r
+ </PcdEntry>\r
+ <PcdEntry PcdItemType="FIXED_AT_BUILD">\r
+ <C_Name>PcdDebugClearMemoryValue</C_Name>\r
+ <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <HelpText>The value used by DebugClearMemory () to fill a certain range
+ of memory.</HelpText>\r
+ </PcdEntry>\r
+ <PcdEntry PcdItemType="DYNAMIC">\r
+ <C_Name>PcdDebugPrintErrorLevel</C_Name>\r
+ <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <HelpText>The bitmask of flags that specify the kind of debug message
+ output when Debug Print is enabled.</HelpText>\r
+ </PcdEntry>\r
+ </PcdCoded>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
+ <MsaHeader>\r
+ <ModuleName>EdkDxeRuntimeSalLib</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>61999c3c-72a5-4506-a4ff-4271d18a1d14</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>SAL library for BS/RT drivers</Abstract>\r
+ <Description>Contains APIs to register/invoke SAL functions.</Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+ <License>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.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>EdkDxeSalLib</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED">\r
+ <Keyword>EdkDxeSalLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiBootServicesTableLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename>\r
+ <Filename SupArchList="IPF">Ipf/AsmEsalServiceLib.s</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ </PackageDependencies>\r
+ <Protocols>\r
+ <Protocol Usage="ALWAYS_CONSUMED">\r
+ <ProtocolCName>gEfiExtendedSalBootServiceProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ </Protocols>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ <Extern>\r
+ <Constructor>DxeSalLibConstructor</Constructor>\r
+ </Extern>\r
+ <Extern>\r
+ <SetVirtualAddressMapCallBack>DxeSalVirtualNotifyEvent</SetVirtualAddressMapCallBack>\r
+ </Extern>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+//++\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
+// EsalLib.s\r
+//\r
+// Abstract:\r
+//\r
+//\r
+// Revision History:\r
+//\r
+//--\r
+\r
+.file "EsalLib.s"\r
+\r
+#include "IpfMacro.i"\r
+\r
+//\r
+// Exports\r
+//\r
+.globl GetEsalEntryPoint\r
+\r
+\r
+//-----------------------------------------------------------------------------\r
+//++\r
+// GetEsalEntryPoint\r
+//\r
+// Return Esal global and PSR register.\r
+//\r
+// On Entry :\r
+//\r
+//\r
+// Return Value:\r
+// r8 = EFI_SAL_SUCCESS\r
+// r9 = Physical Plabel\r
+// r10 = Virtual Plabel\r
+// r11 = psr\r
+// \r
+// As per static calling conventions. \r
+// \r
+//--\r
+//---------------------------------------------------------------------------\r
+PROCEDURE_ENTRY (GetEsalEntryPoint)\r
+\r
+ NESTED_SETUP (0,8,0,0)\r
+\r
+EsalCalcStart:\r
+ mov r8 = ip;;\r
+ add r8 = (EsalEntryPoint - EsalCalcStart), r8;;\r
+ mov r9 = r8;;\r
+ add r10 = 0x10, r8;;\r
+ mov r11 = psr;;\r
+ mov r8 = r0;;\r
+\r
+ NESTED_RETURN\r
+\r
+PROCEDURE_EXIT (GetEsalEntryPoint)\r
+\r
+\r
+\r
+\r
+\r
+//-----------------------------------------------------------------------------\r
+//++\r
+// SetEsalPhysicalEntryPoint\r
+//\r
+// Set the dispatcher entry point\r
+//\r
+// On Entry:\r
+// in0 = Physical address of Esal Dispatcher\r
+// in1 = Physical GP\r
+//\r
+// Return Value: \r
+// r8 = EFI_SAL_SUCCESS\r
+// \r
+// As per static calling conventions. \r
+// \r
+//--\r
+//---------------------------------------------------------------------------\r
+PROCEDURE_ENTRY (SetEsalPhysicalEntryPoint)\r
+\r
+ NESTED_SETUP (2,8,0,0)\r
+\r
+EsalCalcStart1:\r
+ mov r8 = ip;;\r
+ add r8 = (EsalEntryPoint - EsalCalcStart1), r8;;\r
+ st8 [r8] = in0;;\r
+ add r8 = 0x08, r8;;\r
+ st8 [r8] = in1;;\r
+ mov r8 = r0;;\r
+\r
+ NESTED_RETURN\r
+\r
+PROCEDURE_EXIT (SetEsalPhysicalEntryPoint)\r
+\r
+\r
+//-----------------------------------------------------------------------------\r
+//++\r
+// SetEsalVirtualEntryPoint\r
+//\r
+// Register physical address of Esal globals.\r
+//\r
+// On Entry :\r
+// in0 = Virtual address of Esal Dispatcher\r
+// in1 = Virtual GP\r
+//\r
+// Return Value: \r
+// r8 = EFI_SAL_ERROR\r
+// \r
+// As per static calling conventions. \r
+// \r
+//--\r
+//---------------------------------------------------------------------------\r
+PROCEDURE_ENTRY (SetEsalVirtualEntryPoint)\r
+\r
+ NESTED_SETUP (2,8,0,0)\r
+\r
+EsalCalcStart2:\r
+ mov r8 = ip;;\r
+ add r8 = (EsalEntryPoint - EsalCalcStart2), r8;;\r
+ add r8 = 0x10, r8;;\r
+ st8 [r8] = in0;;\r
+ add r8 = 0x08, r8;;\r
+ st8 [r8] = in1;;\r
+ mov r8 = r0;;\r
+\r
+ NESTED_RETURN\r
+\r
+PROCEDURE_EXIT (SetEsalVirtualEntryPoint)\r
+\r
+\r
+\r
+\r
+.align 32\r
+EsalEntryPoint: \r
+ data8 0 // Physical Entry\r
+ data8 0 // GP\r
+ data8 0 // Virtual Entry\r
+ data8 0 // GP\r
+\r
+\r
--- /dev/null
+/*++\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
+ EsalServiceLib.c\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+#include <Ipf/IpfDefines.h>\r
+\r
+EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService = NULL;\r
+EFI_PLABEL mPlabel;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+DxeSalLibInitialize (\r
+ VOID\r
+ )\r
+{\r
+ EFI_PLABEL *Plabel;\r
+ EFI_STATUS Status;\r
+\r
+ if (mEsalBootService != NULL) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ //\r
+ // The protocol contains a function pointer, which is an indirect procedure call.\r
+ // An indirect procedure call goes through a plabel, and pointer to a function is\r
+ // a pointer to a plabel. To implement indirect procedure calls that can work in\r
+ // both physical and virtual mode, two plabels are required (one physical and one\r
+ // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it\r
+ // away. We cache it in a module global, so we can register the vitrual version.\r
+ //\r
+ Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);\r
+ if (EFI_ERROR (Status)) {\r
+ mEsalBootService = NULL;\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;\r
+\r
+ mPlabel.EntryPoint = Plabel->EntryPoint;\r
+ mPlabel.GP = Plabel->GP;\r
+ SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+DxeSalLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ return DxeSalLibInitialize ();\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+DxeSalVirtualNotifyEvent (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Fixup virtual address pointer of label.\r
+\r
+Arguments:\r
+\r
+ Event - The Event that is being processed\r
+ \r
+ Context - Event Context\r
+\r
+Returns: \r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ EfiConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);\r
+ EfiConvertPointer (EFI_IPF_GP_POINTER, (VOID **) &mPlabel.GP);\r
+\r
+ SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterEsalFunction (\r
+ IN UINT64 FunctionId,\r
+ IN EFI_GUID *ClassGuid,\r
+ IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,\r
+ IN VOID *ModuleGlobal\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Register ESAL Class Function and it's asociated global.\r
+ This function is boot service only!\r
+\r
+Arguments:\r
+ FunctionId - ID of function to register\r
+ ClassGuid - GUID of function class \r
+ Function - Function to register under ClassGuid/FunctionId pair\r
+ ModuleGlobal - Module global for Function.\r
+\r
+Returns: \r
+ EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.\r
+\r
+--*/\r
+{\r
+ DxeSalLibInitialize ();\r
+ return mEsalBootService->AddExtendedSalProc (\r
+ mEsalBootService,\r
+ ClassGuid,\r
+ FunctionId,\r
+ Function,\r
+ ModuleGlobal\r
+ );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RegisterEsalClass (\r
+ IN EFI_GUID *ClassGuid,\r
+ IN VOID *ModuleGlobal,\r
+ ...\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Register ESAL Class and it's asociated global.\r
+ This function is boot service only!\r
+\r
+Arguments:\r
+ ClassGuid - GUID of function class \r
+ ModuleGlobal - Module global for Function.\r
+ ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL \r
+ indicates the end of the list.\r
+\r
+Returns: \r
+ EFI_SUCCESS - All members of ClassGuid registered\r
+\r
+--*/\r
+{\r
+ VA_LIST Args;\r
+ EFI_STATUS Status;\r
+ SAL_INTERNAL_EXTENDED_SAL_PROC Function;\r
+ UINT64 FunctionId;\r
+ EFI_HANDLE NewHandle;\r
+\r
+ VA_START (Args, ModuleGlobal);\r
+\r
+ Status = EFI_SUCCESS;\r
+ while (!EFI_ERROR (Status)) {\r
+ Function = (SAL_INTERNAL_EXTENDED_SAL_PROC) VA_ARG (Args, SAL_INTERNAL_EXTENDED_SAL_PROC);\r
+ if (Function == NULL) {\r
+ break;\r
+ }\r
+\r
+ FunctionId = VA_ARG (Args, UINT64);\r
+\r
+ Status = RegisterEsalFunction (FunctionId, ClassGuid, Function, ModuleGlobal);\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ NewHandle = NULL;\r
+ return gBS->InstallProtocolInterface (\r
+ &NewHandle,\r
+ ClassGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ NULL\r
+ );\r
+}\r
+\r
+SAL_RETURN_REGS\r
+EFIAPI\r
+EfiCallEsalService (\r
+ IN EFI_GUID *ClassGuid,\r
+ IN UINT64 FunctionId,\r
+ IN UINT64 Arg2,\r
+ IN UINT64 Arg3,\r
+ IN UINT64 Arg4,\r
+ IN UINT64 Arg5,\r
+ IN UINT64 Arg6,\r
+ IN UINT64 Arg7,\r
+ IN UINT64 Arg8\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Call module that is not linked direclty to this module. This code is IP \r
+ relative and hides the binding issues of virtual or physical calling. The\r
+ function that gets dispatched has extra arguments that include the registered\r
+ module global and a boolean flag to indicate if the system is in virutal mode.\r
+\r
+Arguments:\r
+ ClassGuid - GUID of function\r
+ FunctionId - Function in ClassGuid to call\r
+ Arg2 - Argument 2 ClassGuid/FunctionId defined\r
+ Arg3 - Argument 3 ClassGuid/FunctionId defined\r
+ Arg4 - Argument 4 ClassGuid/FunctionId defined\r
+ Arg5 - Argument 5 ClassGuid/FunctionId defined\r
+ Arg6 - Argument 6 ClassGuid/FunctionId defined\r
+ Arg7 - Argument 7 ClassGuid/FunctionId defined\r
+ Arg8 - Argument 8 ClassGuid/FunctionId defined\r
+\r
+Returns: \r
+ Status of ClassGuid/FuncitonId\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+ SAL_EXTENDED_SAL_PROC EsalProc;\r
+\r
+ ReturnReg = GetEsalEntryPoint ();\r
+ if (ReturnReg.Status != EFI_SAL_SUCCESS) {\r
+ return ReturnReg;\r
+ }\r
+\r
+ //\r
+ // Look at the physical mode ESAL entry point to determine of the ESAL entry point has been initialized\r
+ //\r
+ if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {\r
+ //\r
+ // Both the function ponter and the GP value are zero, so attempt to initialize the ESAL Entry Point\r
+ //\r
+ DxeSalLibInitialize ();\r
+ ReturnReg = GetEsalEntryPoint ();\r
+ if (ReturnReg.Status != EFI_SAL_SUCCESS) {\r
+ return ReturnReg;\r
+ }\r
+ if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {\r
+ //\r
+ // The ESAL Entry Point could not be initialized\r
+ //\r
+ ReturnReg.Status = EFI_SAL_ERROR;\r
+ return ReturnReg;\r
+ }\r
+ }\r
+\r
+ if (ReturnReg.r11 & PSR_IT_MASK) {\r
+ //\r
+ // Virtual mode plabel to entry point\r
+ //\r
+ EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r10;\r
+ } else {\r
+ //\r
+ // Physical mode plabel to entry point\r
+ //\r
+ EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r9;\r
+ }\r
+\r
+ return EsalProc (\r
+ ClassGuid,\r
+ FunctionId,\r
+ Arg2,\r
+ Arg3,\r
+ Arg4,\r
+ Arg5,\r
+ Arg6,\r
+ Arg7,\r
+ Arg8\r
+ );\r
+}\r
<MsaHeader>\r
<ModuleName>EdkDxeSalLib</ModuleName>\r
<ModuleType>DXE_DRIVER</ModuleType>\r
- <GuidValue>61999c3c-72a5-4506-a4ff-4271d18a1d14</GuidValue>\r
+ <GuidValue>F0AC8548-34DE-45bd-9B0A-A5A2DE819E65</GuidValue>\r
<Version>1.0</Version>\r
<Abstract>SAL library for BS/RT drivers</Abstract>\r
<Description>Contains APIs to register/invoke SAL functions.</Description>\r
<Extern>\r
<Constructor>DxeSalLibConstructor</Constructor>\r
</Extern>\r
- <Extern>\r
- <SetVirtualAddressMapCallBack>DxeSalVirtualNotifyEvent</SetVirtualAddressMapCallBack>\r
- </Extern>\r
</Externs>\r
</ModuleSurfaceArea>
\ No newline at end of file
// Driver Lib Module Globals\r
//\r
\r
-STATIC EFI_EVENT mRuntimeNotifyEvent;\r
STATIC EFI_EVENT mEfiVirtualNotifyEvent;\r
STATIC BOOLEAN mEfiGoneVirtual = FALSE;\r
STATIC BOOLEAN mEfiAtRuntime = FALSE;\r
-\r
EFI_RUNTIME_SERVICES *mRT;\r
\r
-STATIC\r
VOID\r
EFIAPI\r
RuntimeDriverExitBootServices (\r
\r
--*/\r
{\r
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
- UINTN Index;\r
-\r
- for (Index = 0; \r
- _gDriverExitBootServicesEvent[Index] != NULL;\r
- Index++) {\r
- ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];\r
- ChildNotifyEventHandler (Event, NULL);\r
- }\r
-\r
//\r
// Clear out BootService globals\r
//\r
\r
mRT = SystemTable->RuntimeServices;\r
\r
- //\r
- // Register our ExitBootServices () notify function\r
- //\r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
- EFI_TPL_NOTIFY,\r
- RuntimeDriverExitBootServices,\r
- NULL,\r
- &mRuntimeNotifyEvent\r
- );\r
-\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Register SetVirtualAddressMap () notify function\r
// \r
+ if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
Status = gBS->CreateEvent (\r
EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
EFI_TPL_NOTIFY,\r
);\r
\r
ASSERT_EFI_ERROR (Status);\r
+ }\r
\r
return EFI_SUCCESS;\r
}\r
{\r
EFI_STATUS Status;\r
\r
- //\r
- // Close our ExitBootServices () notify function\r
- //\r
- Status = gBS->CloseEvent (mRuntimeNotifyEvent);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Close SetVirtualAddressMap () notify function\r
//\r
+ if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
ASSERT_EFI_ERROR (Status);\r
+ }\r
\r
return EFI_SUCCESS;\r
}\r
<Constructor>RuntimeDriverLibConstruct</Constructor>\r
<Destructor>RuntimeDriverLibDeconstruct</Destructor>\r
</Extern>\r
+ <Extern>\r
+ <ExitBootServicesCallBack>RuntimeDriverExitBootServices</ExitBootServicesCallBack>\r
+ </Extern>\r
</Externs>\r
</ModuleSurfaceArea>
\ No newline at end of file
//\r
// Driver Lib Module Globals\r
//\r
+static EFI_EVENT mEfiVirtualNotifyEvent;\r
+EFI_RUNTIME_SERVICES *mRT;\r
\r
-STATIC EFI_EVENT mRuntimeNotifyEvent;\r
-STATIC EFI_EVENT mEfiVirtualNotifyEvent;\r
-\r
-EFI_RUNTIME_SERVICES *mRT;\r
-\r
-STATIC\r
VOID\r
EFIAPI\r
RuntimeDriverExitBootServices (\r
\r
--*/\r
{\r
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
- UINTN Index;\r
-\r
- for (Index = 0; _gDriverExitBootServicesEvent[Index] != NULL; Index++) {\r
- ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];\r
- ChildNotifyEventHandler (Event, NULL);\r
+ if (EfiAtRuntime()) {\r
+ return;\r
}\r
-\r
- //\r
- // Clear out BootService globals\r
- //\r
- gBS = NULL;\r
}\r
\r
-STATIC\r
VOID\r
EFIAPI\r
RuntimeLibVirtualNotifyEvent (\r
\r
--*/\r
{\r
- UINTN Index;\r
+ UINTN Index;\r
EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
\r
for (Index = 0; _gDriverSetVirtualAddressMapEvent[Index] != NULL; Index++) {\r
\r
mRT = SystemTable->RuntimeServices;\r
\r
- //\r
- // Register our ExitBootServices () notify function\r
- //\r
-\r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
- EFI_TPL_NOTIFY,\r
- RuntimeDriverExitBootServices,\r
- NULL,\r
- &mRuntimeNotifyEvent\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Register SetVirtualAddressMap () notify function\r
//\r
- \r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
- EFI_TPL_NOTIFY,\r
- RuntimeLibVirtualNotifyEvent,\r
- NULL,\r
- &mEfiVirtualNotifyEvent\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
+ if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
+ Status = gBS->CreateEvent (\r
+ EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
+ EFI_TPL_NOTIFY,\r
+ RuntimeLibVirtualNotifyEvent,\r
+ NULL,\r
+ &mEfiVirtualNotifyEvent\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
\r
return EFI_SUCCESS;\r
}\r
{\r
EFI_STATUS Status;\r
\r
- //\r
- // Close our ExitBootServices () notify function\r
- //\r
- Status = gBS->CloseEvent (mRuntimeNotifyEvent);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Close SetVirtualAddressMap () notify function\r
//\r
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
- ASSERT_EFI_ERROR (Status);\r
+ if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {\r
+ Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
\r
return EFI_SUCCESS;\r
}\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>CacheMaintenanceLib</Keyword>\r
</LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PeCoffLib</Keyword>\r
+ </LibraryClass>\r
</LibraryClassDefinitions>\r
<SourceFiles>\r
<Filename>Runtime.dxs</Filename>\r