--- /dev/null
+//++\r
+//\r
+// Copyright (c) 2006 Intel Corporation. All rights reserved\r
+// This software and associated documentation (if any) is furnished\r
+// under a license and may only be used or copied in accordance\r
+// with the terms of the license. Except as permitted by such\r
+// license, no part of this software or documentation may be\r
+// reproduced, stored in a retrieval system, or transmitted in any\r
+// form or by any means without the express written consent of\r
+// Intel Corporation.\r
+//\r
+//\r
+// Module Name:\r
+//\r
+// ReadKr1.s\r
+//\r
+// Abstract:\r
+//\r
+// Contains assembly code for read Kr1.\r
+//\r
+//--\r
+\r
+ .file "ReadKr1.s"\r
+\r
+#include "IpfMacro.i"\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadKr1\r
+//\r
+// This routine is used to get KR1. KR1 is used to store Pei Service Table\r
+// Pointer in archeture.\r
+//\r
+// Arguments : \r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: Pei Services Table.\r
+// \r
+//--\r
+//----------------------------------------------------------------------------------\r
+PROCEDURE_ENTRY (AsmReadKr1)\r
+ \r
+ mov r8 = ar.k1;; // Pei Services Table Pointer\r
+ br.ret.dpnt b0;;\r
+\r
+PROCEDURE_EXIT (AsmReadKr1)\r
--- /dev/null
+//++\r
+//\r
+// Copyright (c) 2006 Intel Corporation. All rights reserved\r
+// This software and associated documentation (if any) is furnished\r
+// under a license and may only be used or copied in accordance\r
+// with the terms of the license. Except as permitted by such\r
+// license, no part of this software or documentation may be\r
+// reproduced, stored in a retrieval system, or transmitted in any\r
+// form or by any means without the express written consent of\r
+// Intel Corporation.\r
+//\r
+//\r
+// Module Name:\r
+//\r
+// WriteKr1.s\r
+//\r
+// Abstract:\r
+//\r
+// Contains assembly code for write Kr1.\r
+//\r
+//--\r
+\r
+ .file "WriteKr1.s"\r
+\r
+#include "IpfMacro.i"\r
+\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmWriteKr1\r
+//\r
+// This routine is used to Write KR1. KR1 is used to store Pei Service Table\r
+// Pointer in archeture.\r
+//\r
+// Arguments : r32 Pei Services Table Pointer\r
+//\r
+// On Entry : None.\r
+//\r
+// Return Value: None.\r
+// \r
+//--\r
+//----------------------------------------------------------------------------------\r
+PROCEDURE_ENTRY (AsmWriteKr1)\r
+ \r
+ mov ar.k1 = r32;; // Pei Services Table Pointer\r
+ br.ret.dpnt b0;;\r
+\r
+PROCEDURE_EXIT (AsmWriteKr1)\r
+
\ No newline at end of file
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006 Intel Corporation. All rights reserved\r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+\r
+Module Name:\r
+\r
+ PeiServicesTablePointer.c\r
+\r
+Abstract:\r
+\r
+ PEI Services Table Pointer Library.\r
+ \r
+--*/\r
+\r
+\r
+/**\r
+ Reads the current value of Kr1.\r
+\r
+ @return The current value of Kr1.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmReadKr1 (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Writes the current value of Kr1.\r
+\r
+ @param Value The 64-bit value to write to Kr1.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmWriteKr1 (\r
+ IN UINT64 Value\r
+ );\r
+\r
+/**\r
+ The function returns the pointer to PeiServices.\r
+\r
+ The function returns the pointer to PeiServices.\r
+ It will ASSERT() if the pointer to PeiServices is NULL.\r
+\r
+ @retval The pointer to PeiServices.\r
+\r
+**/\r
+EFI_PEI_SERVICES **\r
+EFIAPI\r
+GetPeiServicesTablePointer (\r
+ VOID\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadKr1 ();\r
+ ASSERT (PeiServices != NULL);\r
+ return PeiServices;\r
+}\r
+\r
+/**\r
+ The constructor function caches the pointer to PEI services.\r
+\r
+ The constructor function caches the pointer to PEI services.\r
+ It will always return EFI_SUCCESS.\r
+\r
+ @param FfsHeader Pointer to FFS header the loaded driver.\r
+ @param PeiServices Pointer to the PEI services.\r
+\r
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesTablePointerLibConstructor (\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ IN EFI_PEI_SERVICES **PeiServices\r
+ )\r
+{\r
+ AsmWriteKr1 ((UINT64)(UINTN)PeiServices);\r
+ return EFI_SUCCESS;\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
+ <MsaHeader>\r
+ <ModuleName>PeiServicesTablePointerLibKr1</ModuleName>\r
+ <ModuleType>PEIM</ModuleType>\r
+ <GuidValue>C5F16B67-888F-44ba-ABDB-C2354FB63C49</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Component description file for IPF KR1 Pei Services Table Pointer Library</Abstract>\r
+ <Description>PEI Services Table Library implementation that retrieves a pointer to the PEI\r
+ Services Table from the KR1 register on IPF.</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>IPF</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>PeiServicesTablePointerLibKr1</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED">\r
+ <Keyword>PeiServicesTablePointerLib</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
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>PeiServicesTablePointer.c</Filename>\r
+ <Filename SupArchList="IPF">Ipf/ReadKr1.s</Filename>\r
+ <Filename SupArchList="IPF">Ipf/WriteKr1.s</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ <Extern>\r
+ <Constructor>PeiServicesTablePointerLibConstructor</Constructor>\r
+ </Extern>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file