Removing unused code.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@373 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bbahnsen 2006-06-01 18:26:22 +00:00
parent 0950e6cdc9
commit 1322edae9d
26 changed files with 0 additions and 6955 deletions

View File

@ -1,131 +0,0 @@
/*++
Copyright (c) 2004 - 2005, 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:
Debug.c
Abstract:
Support for Debug primatives.
--*/
#include "Tiano.h"
#include "Pei.h"
#include "EfiPrintLib.h"
#include "EfiStatusCode.h"
#include "EfiCommonLib.h"
#include EFI_GUID_DEFINITION (StatusCodeCallerId)
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
VOID
PeiDebugAssert (
IN EFI_PEI_SERVICES **PeiServices,
IN CHAR8 *FileName,
IN INTN LineNumber,
IN CHAR8 *Description
)
/*++
Routine Description:
Worker function for ASSERT(). If Error Logging hub is loaded log ASSERT
information. If Error Logging hub is not loaded DEADLOOP ().
Arguments:
PeiServices - The PEI core services table.
FileName - File name of failing routine.
LineNumber - Line number of failing ASSERT().
Description - Description, usually the assertion,
Returns:
None
--*/
{
UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
EfiDebugAssertWorker (FileName, LineNumber, Description, sizeof (Buffer), Buffer);
//
// We choose NOT to use PEI_REPORT_STATUS_CODE here, because when debug is enable,
// we want get enough information if assert.
//
(**PeiServices).PeiReportStatusCode (
PeiServices,
(EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),
(EFI_SOFTWARE_PEI_MODULE | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),
0,
&gEfiCallerIdGuid,
(EFI_STATUS_CODE_DATA *) Buffer
);
EFI_DEADLOOP ();
}
VOID
PeiDebugPrint (
IN EFI_PEI_SERVICES **PeiServices,
IN UINTN ErrorLevel,
IN CHAR8 *Format,
...
)
/*++
Routine Description:
Worker function for DEBUG(). If Error Logging hub is loaded log ASSERT
information. If Error Logging hub is not loaded do nothing.
Arguments:
PeiServices - The PEI core services table.
ErrorLevel - If error level is set do the debug print.
Format - String to use for the print, followed by Print arguments.
... - Print arguments
Returns:
None
--*/
{
VA_LIST Marker;
UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
VA_START (Marker, Format);
EfiDebugVPrintWorker (ErrorLevel, Format, Marker, sizeof (Buffer), Buffer);
//
// We choose NOT to use PEI_REPORT_STATUS_CODE here, because when debug is enable,
// we want get enough information if assert.
//
(**PeiServices).PeiReportStatusCode (
PeiServices,
EFI_DEBUG_CODE,
(EFI_SOFTWARE_PEI_MODULE | EFI_DC_UNSPECIFIED),
0,
&gEfiCallerIdGuid,
(EFI_STATUS_CODE_DATA *) Buffer
);
return ;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,495 +0,0 @@
/*++
Copyright (c) 2004, 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:
hob.c
Abstract:
PEI Library Functions
--*/
#include "Tiano.h"
#include "Pei.h"
#include "peilib.h"
#include EFI_GUID_DEFINITION (MemoryAllocationHob)
EFI_STATUS
PeiBuildHobModule (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *ModuleName,
IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
IN UINT64 ModuleLength,
IN EFI_PHYSICAL_ADDRESS EntryPoint
)
/*++
Routine Description:
Builds a HOB for a loaded PE32 module
Arguments:
PeiServices - The PEI core services table.
ModuleName - The GUID File Name of the module
MemoryAllocationModule - The 64 bit physical address of the module
ModuleLength - The length of the module in bytes
EntryPoint - The 64 bit physical address of the entry point
to the module
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_GUID_EXTENSION,
sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE),
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
Hob->MemoryAllocationHeader.Name = gEfiHobMemeryAllocModuleGuid;
Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
Hob->MemoryAllocationHeader.MemoryLength = ModuleLength;
Hob->MemoryAllocationHeader.MemoryType = EfiBootServicesCode;
Hob->ModuleName = *ModuleName;
Hob->EntryPoint = EntryPoint;
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobResourceDescriptor (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_RESOURCE_TYPE ResourceType,
IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
IN EFI_PHYSICAL_ADDRESS PhysicalStart,
IN UINT64 NumberOfBytes
)
/*++
Routine Description:
Builds a HOB that describes a chunck of system memory
Arguments:
PeiServices - The PEI core services table.
ResourceType - The type of resource described by this HOB
ResourceAttribute - The resource attributes of the memory described by this HOB
PhysicalStart - The 64 bit physical address of memory described by this HOB
NumberOfBytes - The length of the memoty described by this HOB in bytes
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_RESOURCE_DESCRIPTOR,
sizeof (EFI_HOB_RESOURCE_DESCRIPTOR),
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
Hob->ResourceType = ResourceType;
Hob->ResourceAttribute = ResourceAttribute;
Hob->PhysicalStart = PhysicalStart;
Hob->ResourceLength = NumberOfBytes;
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobGuid (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *Guid,
IN UINTN DataLength,
IN OUT VOID **Hob
)
/*++
Routine Description:
Builds a custom HOB that is tagged with a GUID for identification
Arguments:
PeiServices - The PEI core services table.
Guid - The GUID of the custome HOB type
DataLength - The size of the data payload for the GUIDed HOB
Hob - Pointer to the Hob
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_GUID_EXTENSION,
(UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength),
Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
((EFI_HOB_GUID_TYPE *)(*Hob))->Name = *Guid;
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobGuidData (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *Guid,
IN VOID *Data,
IN UINTN DataLength
)
/*++
Routine Description:
Builds a custom HOB that is tagged with a GUID for identification
Arguments:
PeiServices - The PEI core services table.
Guid - The GUID of the custome HOB type
Data - The data to be copied into the GUIDed HOB data field.
DataLength - The data field length.
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_GUID_TYPE *Hob;
Status = PeiBuildHobGuid (
PeiServices,
Guid,
DataLength,
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
Hob++;
(*PeiServices)->CopyMem (Hob, Data, DataLength);
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobFv (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
/*++
Routine Description:
Builds a Firmware Volume HOB
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The base address of the Firmware Volume
Length - The size of the Firmware Volume in bytes
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_FIRMWARE_VOLUME *Hob;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_FV,
sizeof (EFI_HOB_FIRMWARE_VOLUME),
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
Hob->BaseAddress = BaseAddress;
Hob->Length = Length;
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobCpu (
IN EFI_PEI_SERVICES **PeiServices,
IN UINT8 SizeOfMemorySpace,
IN UINT8 SizeOfIoSpace
)
/*++
Routine Description:
Builds a HOB for the CPU
Arguments:
PeiServices - The PEI core services table.
SizeOfMemorySpace - Identifies the maximum
physical memory addressibility of the processor.
SizeOfIoSpace - Identifies the maximum physical I/O addressibility
of the processor.
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_CPU *Hob;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_CPU,
sizeof (EFI_HOB_CPU),
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
Hob->SizeOfMemorySpace = SizeOfMemorySpace;
Hob->SizeOfIoSpace = SizeOfIoSpace;
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobStack (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
/*++
Routine Description:
Builds a HOB for the Stack
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The 64 bit physical address of the Stack
Length - The length of the stack in bytes
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_MEMORY_ALLOCATION_STACK *Hob;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_MEMORY_ALLOCATION,
sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK),
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
Hob->AllocDescriptor.Name = gEfiHobMemeryAllocStackGuid;
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
Hob->AllocDescriptor.MemoryLength = Length;
Hob->AllocDescriptor.MemoryType = EfiConventionalMemory;
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobBspStore (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_MEMORY_TYPE MemoryType
)
/*++
Routine Description:
Builds a HOB for the bsp store
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The 64 bit physical address of the bsp
Length - The length of the bsp store in bytes
MemoryType - Memory type
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *Hob;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_MEMORY_ALLOCATION,
sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE),
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
Hob->AllocDescriptor.Name = gEfiHobMemeryAllocBspStoreGuid;
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
Hob->AllocDescriptor.MemoryLength = Length;
Hob->AllocDescriptor.MemoryType = MemoryType;
return EFI_SUCCESS;
}
EFI_STATUS
PeiBuildHobMemoryAllocation (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_GUID *Name,
IN EFI_MEMORY_TYPE MemoryType
)
/*++
Routine Description:
Builds a HOB for the memory allocation.
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The 64 bit physical address of the memory
Length - The length of the memory allocation in bytes
Name - Name for Hob
MemoryType - Memory type
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
{
EFI_STATUS Status;
EFI_HOB_MEMORY_ALLOCATION *Hob;
Status = (*PeiServices)->CreateHob (
PeiServices,
EFI_HOB_TYPE_MEMORY_ALLOCATION,
sizeof (EFI_HOB_MEMORY_ALLOCATION),
&Hob
);
if (EFI_ERROR (Status)) {
return Status;
}
if (Name != NULL) {
Hob->AllocDescriptor.Name = *Name;
} else {
(*PeiServices)->SetMem(&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID), 0);
}
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
Hob->AllocDescriptor.MemoryLength = Length;
Hob->AllocDescriptor.MemoryType = MemoryType;
return EFI_SUCCESS;
}

View File

@ -1,244 +0,0 @@
/*++
Copyright (c) 2004, 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:
PeCoffLoaderEx.c
Abstract:
Fixes Intel Itanium(TM) specific relocation types
Revision History
--*/
#include "TianoCommon.h"
#include "EfiImage.h"
#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) \
Value |= (((UINT64)((*(Address) >> InstPos) & (((UINT64)1 << Size) - 1))) << ValPos)
#define INS_IMM64(Value, Address, Size, InstPos, ValPos) \
*(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
#define IMM64_IMM7B_INST_WORD_X 3
#define IMM64_IMM7B_SIZE_X 7
#define IMM64_IMM7B_INST_WORD_POS_X 4
#define IMM64_IMM7B_VAL_POS_X 0
#define IMM64_IMM9D_INST_WORD_X 3
#define IMM64_IMM9D_SIZE_X 9
#define IMM64_IMM9D_INST_WORD_POS_X 18
#define IMM64_IMM9D_VAL_POS_X 7
#define IMM64_IMM5C_INST_WORD_X 3
#define IMM64_IMM5C_SIZE_X 5
#define IMM64_IMM5C_INST_WORD_POS_X 13
#define IMM64_IMM5C_VAL_POS_X 16
#define IMM64_IC_INST_WORD_X 3
#define IMM64_IC_SIZE_X 1
#define IMM64_IC_INST_WORD_POS_X 12
#define IMM64_IC_VAL_POS_X 21
#define IMM64_IMM41a_INST_WORD_X 1
#define IMM64_IMM41a_SIZE_X 10
#define IMM64_IMM41a_INST_WORD_POS_X 14
#define IMM64_IMM41a_VAL_POS_X 22
#define IMM64_IMM41b_INST_WORD_X 1
#define IMM64_IMM41b_SIZE_X 8
#define IMM64_IMM41b_INST_WORD_POS_X 24
#define IMM64_IMM41b_VAL_POS_X 32
#define IMM64_IMM41c_INST_WORD_X 2
#define IMM64_IMM41c_SIZE_X 23
#define IMM64_IMM41c_INST_WORD_POS_X 0
#define IMM64_IMM41c_VAL_POS_X 40
#define IMM64_SIGN_INST_WORD_X 3
#define IMM64_SIGN_SIZE_X 1
#define IMM64_SIGN_INST_WORD_POS_X 27
#define IMM64_SIGN_VAL_POS_X 63
EFI_STATUS
PeCoffLoaderRelocateImageEx (
IN UINT16 *Reloc,
IN OUT CHAR8 *Fixup,
IN OUT CHAR8 **FixupData,
IN UINT64 Adjust
)
/*++
Routine Description:
Performs an Itanium-based specific relocation fixup
Arguments:
Reloc - Pointer to the relocation record
Fixup - Pointer to the address to fix up
FixupData - Pointer to a buffer to log the fixups
Adjust - The offset to adjust the fixup
Returns:
Status code
--*/
{
UINT64 *F64;
UINT64 FixupVal;
switch ((*Reloc) >> 12) {
case EFI_IMAGE_REL_BASED_DIR64:
F64 = (UINT64 *) Fixup;
*F64 = *F64 + (UINT64) Adjust;
if (*FixupData != NULL) {
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
*(UINT64 *)(*FixupData) = *F64;
*FixupData = *FixupData + sizeof(UINT64);
}
break;
case EFI_IMAGE_REL_BASED_IA64_IMM64:
//
// Align it to bundle address before fixing up the
// 64-bit immediate value of the movl instruction.
//
Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
FixupVal = (UINT64)0;
//
// Extract the lower 32 bits of IMM64 from bundle
//
EXT_IMM64(FixupVal,
(UINT32 *)Fixup + IMM64_IMM7B_INST_WORD_X,
IMM64_IMM7B_SIZE_X,
IMM64_IMM7B_INST_WORD_POS_X,
IMM64_IMM7B_VAL_POS_X
);
EXT_IMM64(FixupVal,
(UINT32 *)Fixup + IMM64_IMM9D_INST_WORD_X,
IMM64_IMM9D_SIZE_X,
IMM64_IMM9D_INST_WORD_POS_X,
IMM64_IMM9D_VAL_POS_X
);
EXT_IMM64(FixupVal,
(UINT32 *)Fixup + IMM64_IMM5C_INST_WORD_X,
IMM64_IMM5C_SIZE_X,
IMM64_IMM5C_INST_WORD_POS_X,
IMM64_IMM5C_VAL_POS_X
);
EXT_IMM64(FixupVal,
(UINT32 *)Fixup + IMM64_IC_INST_WORD_X,
IMM64_IC_SIZE_X,
IMM64_IC_INST_WORD_POS_X,
IMM64_IC_VAL_POS_X
);
EXT_IMM64(FixupVal,
(UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X,
IMM64_IMM41a_SIZE_X,
IMM64_IMM41a_INST_WORD_POS_X,
IMM64_IMM41a_VAL_POS_X
);
//
// Update 64-bit address
//
FixupVal += Adjust;
//
// Insert IMM64 into bundle
//
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_IMM7B_INST_WORD_X),
IMM64_IMM7B_SIZE_X,
IMM64_IMM7B_INST_WORD_POS_X,
IMM64_IMM7B_VAL_POS_X
);
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_IMM9D_INST_WORD_X),
IMM64_IMM9D_SIZE_X,
IMM64_IMM9D_INST_WORD_POS_X,
IMM64_IMM9D_VAL_POS_X
);
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_IMM5C_INST_WORD_X),
IMM64_IMM5C_SIZE_X,
IMM64_IMM5C_INST_WORD_POS_X,
IMM64_IMM5C_VAL_POS_X
);
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_IC_INST_WORD_X),
IMM64_IC_SIZE_X,
IMM64_IC_INST_WORD_POS_X,
IMM64_IC_VAL_POS_X
);
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X),
IMM64_IMM41a_SIZE_X,
IMM64_IMM41a_INST_WORD_POS_X,
IMM64_IMM41a_VAL_POS_X
);
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_IMM41b_INST_WORD_X),
IMM64_IMM41b_SIZE_X,
IMM64_IMM41b_INST_WORD_POS_X,
IMM64_IMM41b_VAL_POS_X
);
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_IMM41c_INST_WORD_X),
IMM64_IMM41c_SIZE_X,
IMM64_IMM41c_INST_WORD_POS_X,
IMM64_IMM41c_VAL_POS_X
);
INS_IMM64(FixupVal,
((UINT32 *)Fixup + IMM64_SIGN_INST_WORD_X),
IMM64_SIGN_SIZE_X,
IMM64_SIGN_INST_WORD_POS_X,
IMM64_SIGN_VAL_POS_X
);
F64 = (UINT64 *) Fixup;
if (*FixupData != NULL) {
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
*(UINT64 *)(*FixupData) = *F64;
*FixupData = *FixupData + sizeof(UINT64);
}
break;
default:
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}

View File

@ -1,67 +0,0 @@
/*++
Copyright (c) 2004, 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:
PeCoffLoaderEx.h
Abstract:
Fixes Intel Itanium(TM) specific relocation types
Revision History
--*/
#ifndef _PE_COFF_LOADER_EX_H_
#define _PE_COFF_LOADER_EX_H_
//
// Define macro to determine if the machine type is supported.
// Returns 0 if the machine is not supported, Not 0 otherwise.
//
#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
((Machine) == EFI_IMAGE_MACHINE_IA64 || \
(Machine) == EFI_IMAGE_MACHINE_EBC)
EFI_STATUS
PeCoffLoaderRelocateImageEx (
IN UINT16 *Reloc,
IN OUT CHAR8 *Fixup,
IN OUT CHAR8 **FixupData,
IN UINT64 Adjust
)
/*++
Routine Description:
Performs an Itanium-based specific relocation fixup
Arguments:
Reloc - Pointer to the relocation record
Fixup - Pointer to the address to fix up
FixupData - Pointer to a buffer to log the fixups
Adjust - The offset to adjust the fixup
Returns:
Status code
--*/
;
#endif

View File

@ -1,61 +0,0 @@
//++
// Copyright (c) 2004, 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:
//
// PerformancePrimitives.s
//
// Abstract:
//
//
// Revision History:
//
//--
.file "PerformancePrimitives.s"
#include "IpfMacro.i"
//-----------------------------------------------------------------------------
//++
// GetTimerValue
//
// Implementation of CPU-based time service
//
// On Entry :
// EFI_STATUS
// GetTimerValue (
// OUT UINT64 *TimerValue
// )
//
// Return Value:
// r8 = Status
// r9 = 0
// r10 = 0
// r11 = 0
//
// As per static calling conventions.
//
//--
//---------------------------------------------------------------------------
PROCEDURE_ENTRY (GetTimerValue)
NESTED_SETUP (1,8,0,0)
mov r8 = ar.itc;;
st8 [r32]= r8
mov r8 = r0
mov r9 = r0
mov r10 = r0
mov r11 = r0
NESTED_RETURN
PROCEDURE_EXIT (GetTimerValue)
//---------------------------------------------------------------------------

View File

@ -1,122 +0,0 @@
//++
// Copyright (c) 2004, 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:
//
// SwitchStack.s
//
// Abstract:
//
// Contains an implementation of a stack switch for the Itanium-based architecture.
//
//
//
// Revision History:
//
//--
.file "SwitchStack.s"
#include <asm.h>
#include <ia_64gen.h>
// Define hardware RSE Configuration Register
//
// RS Configuration (RSC) bit field positions
#define RSC_MODE 0
#define RSC_PL 2
#define RSC_BE 4
// RSC bits 5-15 reserved
#define RSC_MBZ0 5
#define RSC_MBZ0_V 0x3ff
#define RSC_LOADRS 16
#define RSC_LOADRS_LEN 14
// RSC bits 30-63 reserved
#define RSC_MBZ1 30
#define RSC_MBZ1_V 0x3ffffffffULL
// RSC modes
// Lazy
#define RSC_MODE_LY (0x0)
// Store intensive
#define RSC_MODE_SI (0x1)
// Load intensive
#define RSC_MODE_LI (0x2)
// Eager
#define RSC_MODE_EA (0x3)
// RSC Endian bit values
#define RSC_BE_LITTLE 0
#define RSC_BE_BIG 1
// RSC while in kernel: enabled, little endian, pl = 0, eager mode
#define RSC_KERNEL ((RSC_MODE_EA<<RSC_MODE) | (RSC_BE_LITTLE<<RSC_BE))
// Lazy RSC in kernel: enabled, little endian, pl = 0, lazy mode
#define RSC_KERNEL_LAZ ((RSC_MODE_LY<<RSC_MODE) | (RSC_BE_LITTLE<<RSC_BE))
// RSE disabled: disabled, pl = 0, little endian, eager mode
#define RSC_KERNEL_DISABLED ((RSC_MODE_LY<<RSC_MODE) | (RSC_BE_LITTLE<<RSC_BE))
//VOID
//SwitchStacks (
// VOID *ContinuationFunction,
// UINTN Parameter,
// UINTN NewTopOfStack,
// UINTN NewBSPStore OPTIONAL
//)
///*++
//
//Input Arguments
//
// ContinuationFunction - This is a pointer to the PLABEL of the function that should be called once the
// new stack has been created.
// Parameter - The parameter to pass to the continuation function
// NewTopOfStack - This is the new top of the memory stack for ensuing code. This is mandatory and
// should be non-zero
// NewBSPStore - This is the new BSP store for the ensuing code. It is optional on IA-32 and mandatory on Itanium-based platform.
//
//--*/
PROCEDURE_ENTRY(SwitchStacks)
mov r16 = -0x10;;
and r16 = r34, r16;; // get new stack value in R16, 0 the last nibble.
mov r15 = r35;; // Get new BspStore into R15
mov r13 = r32;; // this is a pointer to the PLABEL of the continuation function.
mov r17 = r33;; // this is the parameter to pass to the continuation function
alloc r11=0,0,0,0 // Set 0-size frame
;;
flushrs;;
mov r21 = RSC_KERNEL_DISABLED // for rse disable
;;
mov ar.rsc = r21 // turn off RSE
add sp = r0, r16;; // transfer to the EFI stack
mov ar.bspstore = r15 // switch to EFI BSP
invala // change of ar.bspstore needs invala.
mov r18 = RSC_KERNEL_LAZ // RSC enabled, Lazy mode
;;
mov ar.rsc = r18 // turn rse on, in kernel mode
;;
alloc r11=0,0,1,0;; // alloc 0 outs going to ensuing DXE IPL service
mov out0 = r17
ld8 r16 = [r13],8;; // r16 = address of continuation function from the PLABEL
ld8 gp = [r13] // gp = gp of continuation function from the PLABEL
mov b6 = r16
;;
br.call.sptk.few b0=b6;; // Call the continuation function
;;
PROCEDURE_EXIT(SwitchStacks)

View File

@ -1,35 +0,0 @@
//
//
// Copyright (c) 2004, 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:
//
// asm.h
//
// Abstract:
//
// This module contains generic macros for an assembly writer.
//
//
// Revision History
//
#ifndef _ASM_H
#define _ASM_H
#define TRUE 1
#define FALSE 0
#define PROCEDURE_ENTRY(name) .##text; \
.##type name, @function; \
.##proc name; \
name::
#define PROCEDURE_EXIT(name) .##endp name
#endif // _ASM_H

View File

@ -1,112 +0,0 @@
/*++
Copyright (c) 2004, 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:
EfiJump.h
Abstract:
This is the Setjump/Longjump pair for an IA32 processor.
--*/
#ifndef _EFI_JUMP_H_
#define _EFI_JUMP_H_
#include EFI_GUID_DEFINITION (PeiTransferControl)
//
// NOTE:Set/LongJump needs to have this buffer start
// at 16 byte boundary. Either fix the structure
// which call this buffer or fix inside SetJump/LongJump
// Choosing 1K buffer storage for now
//
typedef struct {
CHAR8 Buffer[1024];
} EFI_JUMP_BUFFER;
EFI_STATUS
SetJump (
IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
IN EFI_JUMP_BUFFER *Jump
)
/*++
Routine Description:
SetJump stores the current register set in the area pointed to
by "save". It returns zero. Subsequent calls to "LongJump" will
restore the registers and return non-zero to the same location.
On entry, r32 contains the pointer to the jmp_buffer
Arguments:
This - Calling context
Jump - Jump buffer
Returns:
Status code
--*/
;
EFI_STATUS
LongJump (
IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
IN EFI_JUMP_BUFFER *Jump
)
/*++
Routine Description:
LongJump initializes the register set to the values saved by a
previous 'SetJump' and jumps to the return location saved by that
'SetJump'. This has the effect of unwinding the stack and returning
for a second time to the 'SetJump'.
Arguments:
This - Calling context
Jump - Jump buffer
Returns:
Status code
--*/
;
VOID
RtPioICacheFlush (
IN VOID *StartAddress,
IN UINTN SizeInBytes
)
/*++
Routine Description:
Flushing the CPU instruction cache.
Arguments:
StartAddress - Start address to flush
SizeInBytes - Length in bytes to flush
Returns:
None
--*/
;
#endif

View File

@ -1,214 +0,0 @@
//
//
//
// Copyright (c) 2004, 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: ia_64gen.h
//
//
//Abstract:
//
//
//
//
//Revision History
//
//
#ifndef _IA64GEN_H
#define _IA64GEN_H
#define TT_UNAT 0
#define C_PSR 0
#define J_UNAT 0
#define T_TYPE 0
#define T_IPSR 0x8
#define T_ISR 0x10
#define T_IIP 0x18
#define T_IFA 0x20
#define T_IIPA 0x28
#define T_IFS 0x30
#define T_IIM 0x38
#define T_RSC 0x40
#define T_BSP 0x48
#define T_BSPSTORE 0x50
#define T_RNAT 0x58
#define T_PFS 0x60
#define T_KBSPSTORE 0x68
#define T_UNAT 0x70
#define T_CCV 0x78
#define T_DCR 0x80
#define T_PREDS 0x88
#define T_NATS 0x90
#define T_R1 0x98
#define T_GP 0x98
#define T_R2 0xa0
#define T_R3 0xa8
#define T_R4 0xb0
#define T_R5 0xb8
#define T_R6 0xc0
#define T_R7 0xc8
#define T_R8 0xd0
#define T_R9 0xd8
#define T_R10 0xe0
#define T_R11 0xe8
#define T_R12 0xf0
#define T_SP 0xf0
#define T_R13 0xf8
#define T_R14 0x100
#define T_R15 0x108
#define T_R16 0x110
#define T_R17 0x118
#define T_R18 0x120
#define T_R19 0x128
#define T_R20 0x130
#define T_R21 0x138
#define T_R22 0x140
#define T_R23 0x148
#define T_R24 0x150
#define T_R25 0x158
#define T_R26 0x160
#define T_R27 0x168
#define T_R28 0x170
#define T_R29 0x178
#define T_R30 0x180
#define T_R31 0x188
#define T_F2 0x1f0
#define T_F3 0x200
#define T_F4 0x210
#define T_F5 0x220
#define T_F6 0x230
#define T_F7 0x240
#define T_F8 0x250
#define T_F9 0x260
#define T_F10 0x270
#define T_F11 0x280
#define T_F12 0x290
#define T_F13 0x2a0
#define T_F14 0x2b0
#define T_F15 0x2c0
#define T_F16 0x2d0
#define T_F17 0x2e0
#define T_F18 0x2f0
#define T_F19 0x300
#define T_F20 0x310
#define T_F21 0x320
#define T_F22 0x330
#define T_F23 0x340
#define T_F24 0x350
#define T_F25 0x360
#define T_F26 0x370
#define T_F27 0x380
#define T_F28 0x390
#define T_F29 0x3a0
#define T_F30 0x3b0
#define T_F31 0x3c0
#define T_FPSR 0x1e0
#define T_B0 0x190
#define T_B1 0x198
#define T_B2 0x1a0
#define T_B3 0x1a8
#define T_B4 0x1b0
#define T_B5 0x1b8
#define T_B6 0x1c0
#define T_B7 0x1c8
#define T_EC 0x1d0
#define T_LC 0x1d8
#define J_NATS 0x8
#define J_PFS 0x10
#define J_BSP 0x18
#define J_RNAT 0x20
#define J_PREDS 0x28
#define J_LC 0x30
#define J_R4 0x38
#define J_R5 0x40
#define J_R6 0x48
#define J_R7 0x50
#define J_SP 0x58
#define J_F2 0x60
#define J_F3 0x70
#define J_F4 0x80
#define J_F5 0x90
#define J_F16 0xa0
#define J_F17 0xb0
#define J_F18 0xc0
#define J_F19 0xd0
#define J_F20 0xe0
#define J_F21 0xf0
#define J_F22 0x100
#define J_F23 0x110
#define J_F24 0x120
#define J_F25 0x130
#define J_F26 0x140
#define J_F27 0x150
#define J_F28 0x160
#define J_F29 0x170
#define J_F30 0x180
#define J_F31 0x190
#define J_FPSR 0x1a0
#define J_B0 0x1a8
#define J_B1 0x1b0
#define J_B2 0x1b8
#define J_B3 0x1c0
#define J_B4 0x1c8
#define J_B5 0x1d0
#define TRAP_FRAME_LENGTH 0x3d0
#define C_UNAT 0x28
#define C_NATS 0x30
#define C_PFS 0x8
#define C_BSPSTORE 0x10
#define C_RNAT 0x18
#define C_RSC 0x20
#define C_PREDS 0x38
#define C_LC 0x40
#define C_DCR 0x48
#define C_R1 0x50
#define C_GP 0x50
#define C_R4 0x58
#define C_R5 0x60
#define C_R6 0x68
#define C_R7 0x70
#define C_SP 0x78
#define C_R13 0x80
#define C_F2 0x90
#define C_F3 0xa0
#define C_F4 0xb0
#define C_F5 0xc0
#define C_F16 0xd0
#define C_F17 0xe0
#define C_F18 0xf0
#define C_F19 0x100
#define C_F20 0x110
#define C_F21 0x120
#define C_F22 0x130
#define C_F23 0x140
#define C_F24 0x150
#define C_F25 0x160
#define C_F26 0x170
#define C_F27 0x180
#define C_F28 0x190
#define C_F29 0x1a0
#define C_F30 0x1b0
#define C_F31 0x1c0
#define C_FPSR 0x1d0
#define C_B0 0x1d8
#define C_B1 0x1e0
#define C_B2 0x1e8
#define C_B3 0x1f0
#define C_B4 0x1f8
#define C_B5 0x200
#define TT_R2 0x8
#define TT_R3 0x10
#define TT_R8 0x18
#define TT_R9 0x20
#define TT_R10 0x28
#define TT_R11 0x30
#define TT_R14 0x38
#endif _IA64GEN_H

View File

@ -1,139 +0,0 @@
/*++
Copyright (c) 2004, 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:
math.c
Abstract:
64-bit Math worker functions for Intel Itanium(TM) processors.
--*/
#include "Tiano.h"
#include "Pei.h"
#include "PeiLib.h"
UINT64
LShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
/*++
Routine Description:
This routine allows a 64 bit value to be left shifted by 32 bits and
returns the shifted value.
Count is valid up 63. (Only Bits 0-5 is valid for Count)
Arguments:
Operand - Value to be shifted
Count - Number of times to shift left.
Returns:
Value shifted left identified by the Count.
--*/
{
return Operand << Count;
}
UINT64
RShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
/*++
Routine Description:
This routine allows a 64 bit value to be right shifted by 32 bits and returns the
shifted value.
Count is valid up 63. (Only Bits 0-5 is valid for Count)
Arguments:
Operand - Value to be shifted
Count - Number of times to shift right.
Returns:
Value shifted right identified by the Count.
--*/
{
return Operand >> Count;
}
UINT64
MultU64x32 (
IN UINT64 Multiplicand,
IN UINTN Multiplier
)
/*++
Routine Description:
This routine allows a 64 bit value to be multiplied with a 32 bit
value returns 64bit result.
No checking if the result is greater than 64bits
Arguments:
Multiplicand - multiplicand
Multiplier - multiplier
Returns:
Multiplicand * Multiplier
--*/
{
return Multiplicand * Multiplier;
}
UINT64
DivU64x32 (
IN UINT64 Dividend,
IN UINTN Divisor,
OUT UINTN *Remainder OPTIONAL
)
/*++
Routine Description:
This routine allows a 64 bit value to be divided with a 32 bit value returns
64bit result and the Remainder.
N.B. only works for 31bit divisors!!
Arguments:
Dividend - dividend
Divisor - divisor
Remainder - buffer for remainder
Returns:
Dividend / Divisor
Remainder = Dividend mod Divisor
--*/
{
if (Remainder) {
*Remainder = Dividend % Divisor;
}
return Dividend / Divisor;
}

View File

@ -1,106 +0,0 @@
//++
// Copyright (c) 2004, 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:
//
// pioflush.s
//
// Abstract:
//
//
// Revision History:
//
//--
.file "pioflush.c"
.radix D
.section .text, "ax", "progbits"
.align 32
.section .pdata, "a", "progbits"
.align 4
.section .xdata, "a", "progbits"
.align 8
.section .data, "wa", "progbits"
.align 16
.section .rdata, "a", "progbits"
.align 16
.section .bss, "wa", "nobits"
.align 16
.section .tls$, "was", "progbits"
.align 16
.section .sdata, "was", "progbits"
.align 16
.section .sbss, "was", "nobits"
.align 16
.section .srdata, "as", "progbits"
.align 16
.section .rdata, "a", "progbits"
.align 16
.section .rtcode, "ax", "progbits"
.align 32
.type RtPioICacheFlush# ,@function
.global RtPioICacheFlush#
// Function compile flags: /Ogsy
.section .rtcode
// Begin code for function: RtPioICacheFlush:
.proc RtPioICacheFlush#
.align 32
RtPioICacheFlush:
// File e:\tmp\pioflush.c
{ .mii //R-Addr: 0X00
alloc r3=2, 0, 0, 0 //11, 00000002H
cmp4.leu p0,p6=32, r33;; //15, 00000020H
(p6) mov r33=32;; //16, 00000020H
}
{ .mii //R-Addr: 0X010
nop.m 0
zxt4 r29=r33;; //21
dep.z r30=r29, 0, 5;; //21, 00000005H
}
{ .mii //R-Addr: 0X020
cmp4.eq p0,p7=r0, r30 //21
shr.u r28=r29, 5;; //19, 00000005H
(p7) adds r28=1, r28;; //22, 00000001H
}
{ .mii //R-Addr: 0X030
nop.m 0
shl r27=r28, 5;; //25, 00000005H
zxt4 r26=r27;; //25
}
{ .mfb //R-Addr: 0X040
add r31=r26, r32 //25
nop.f 0
nop.b 0
}
$L143:
{ .mii //R-Addr: 0X050
fc r32 //27
adds r32=32, r32;; //28, 00000020H
cmp.ltu p14,p15=r32, r31 //29
}
{ .mfb //R-Addr: 0X060
nop.m 0
nop.f 0
(p14) br.cond.dptk.few $L143#;; //29, 880000/120000
}
{ .mmi
sync.i;;
srlz.i
nop.i 0;;
}
{ .mfb //R-Addr: 0X070
nop.m 0
nop.f 0
br.ret.sptk.few b0;; //31
}
// End code for function:
.endp RtPioICacheFlush#
// END

View File

@ -1,118 +0,0 @@
/*++
Copyright (c) 2004, 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:
Processor.c
Abstract:
--*/
#include "Tiano.h"
#include "EfiJump.h"
#include "PeiHob.h"
#include EFI_GUID_DEFINITION (PeiFlushInstructionCache)
#include EFI_GUID_DEFINITION (PeiTransferControl)
EFI_STATUS
WinNtFlushInstructionCacheFlush (
IN EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL *This,
IN EFI_PHYSICAL_ADDRESS Start,
IN UINT64 Length
);
EFI_PEI_TRANSFER_CONTROL_PROTOCOL mTransferControl = {
SetJump,
LongJump,
sizeof (EFI_JUMP_BUFFER)
};
EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL mFlushInstructionCache = {
WinNtFlushInstructionCacheFlush
};
EFI_STATUS
InstallEfiPeiTransferControl (
IN OUT EFI_PEI_TRANSFER_CONTROL_PROTOCOL **This
)
/*++
Routine Description:
Installs the pointer to the transfer control mechanism
Arguments:
This - Pointer to transfer control mechanism.
Returns:
EFI_SUCCESS - Successfully installed.
--*/
{
*This = &mTransferControl;
return EFI_SUCCESS;
}
EFI_STATUS
InstallEfiPeiFlushInstructionCache (
IN OUT EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL **This
)
/*++
Routine Description:
Installs the pointer to the flush instruction cache mechanism
Arguments:
This - Pointer to flush instruction cache mechanism.
Returns:
EFI_SUCCESS - Successfully installed
--*/
{
*This = &mFlushInstructionCache;
return EFI_SUCCESS;
}
EFI_STATUS
WinNtFlushInstructionCacheFlush (
IN EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL *This,
IN EFI_PHYSICAL_ADDRESS Start,
IN UINT64 Length
)
/*++
Routine Description:
This routine would provide support for flushing the CPU instruction cache.
Arguments:
This - Pointer to CPU Architectural Protocol interface
Start - Start adddress in memory to flush
Length - Length of memory to flush
Returns:
Status
EFI_SUCCESS
--*/
{
RtPioICacheFlush ((UINT8 *) Start, (UINTN) Length);
return EFI_SUCCESS;
}

View File

@ -1,325 +0,0 @@
//++
// Copyright (c) 2004, 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:
//
// setjmp.s
//
// Abstract:
//
// Contains an implementation of setjmp and longjmp for the
// Itanium-based architecture.
//
//
//
// Revision History:
//
//--
.file "setjmp.s"
#include <asm.h>
#include <ia_64gen.h>
// int SetJump(struct jmp_buffer save)
//
// Setup a non-local goto.
//
// Description:
//
// SetJump stores the current register set in the area pointed to
// by "save". It returns zero. Subsequent calls to "LongJump" will
// restore the registers and return non-zero to the same location.
//
// On entry, r32 contains the pointer to the jmp_buffer
//
PROCEDURE_ENTRY(SetJump)
//
// Make sure buffer is aligned at 16byte boundary
//
mov r32 = r33
add r10 = -0x10,r0 ;; // mask the lower 4 bits
and r32 = r32, r10;;
add r32 = 0x10, r32;; // move to next 16 byte boundary
add r10 = J_PREDS, r32 // skip Unats & pfs save area
add r11 = J_BSP, r32
//
// save immediate context
//
mov r2 = ar.bsp // save backing store pointer
mov r3 = pr // save predicates
;;
//
// save user Unat register
//
mov r16 = ar.lc // save loop count register
mov r14 = ar.unat // save user Unat register
st8 [r10] = r3, J_LC-J_PREDS
st8 [r11] = r2, J_R4-J_BSP
;;
st8 [r10] = r16, J_R5-J_LC
st8 [r32] = r14, J_NATS // Note: Unat at the
// beginning of the save area
mov r15 = ar.pfs
;;
//
// save preserved general registers & NaT's
//
st8.spill [r11] = r4, J_R6-J_R4
;;
st8.spill [r10] = r5, J_R7-J_R5
;;
st8.spill [r11] = r6, J_SP-J_R6
;;
st8.spill [r10] = r7, J_F3-J_R7
;;
st8.spill [r11] = sp, J_F2-J_SP
;;
//
// save spilled Unat and pfs registers
//
mov r2 = ar.unat // save Unat register after spill
;;
st8 [r32] = r2, J_PFS-J_NATS // save unat for spilled regs
;;
st8 [r32] = r15 // save pfs
//
// save floating registers
//
stf.spill [r11] = f2, J_F4-J_F2
stf.spill [r10] = f3, J_F5-J_F3
;;
stf.spill [r11] = f4, J_F16-J_F4
stf.spill [r10] = f5, J_F17-J_F5
;;
stf.spill [r11] = f16, J_F18-J_F16
stf.spill [r10] = f17, J_F19-J_F17
;;
stf.spill [r11] = f18, J_F20-J_F18
stf.spill [r10] = f19, J_F21-J_F19
;;
stf.spill [r11] = f20, J_F22-J_F20
stf.spill [r10] = f21, J_F23-J_F21
;;
stf.spill [r11] = f22, J_F24-J_F22
stf.spill [r10] = f23, J_F25-J_F23
;;
stf.spill [r11] = f24, J_F26-J_F24
stf.spill [r10] = f25, J_F27-J_F25
;;
stf.spill [r11] = f26, J_F28-J_F26
stf.spill [r10] = f27, J_F29-J_F27
;;
stf.spill [r11] = f28, J_F30-J_F28
stf.spill [r10] = f29, J_F31-J_F29
;;
stf.spill [r11] = f30, J_FPSR-J_F30
stf.spill [r10] = f31, J_B0-J_F31 // size of f31 + fpsr
//
// save FPSR register & branch registers
//
mov r2 = ar.fpsr // save fpsr register
mov r3 = b0
;;
st8 [r11] = r2, J_B1-J_FPSR
st8 [r10] = r3, J_B2-J_B0
mov r2 = b1
mov r3 = b2
;;
st8 [r11] = r2, J_B3-J_B1
st8 [r10] = r3, J_B4-J_B2
mov r2 = b3
mov r3 = b4
;;
st8 [r11] = r2, J_B5-J_B3
st8 [r10] = r3
mov r2 = b5
;;
st8 [r11] = r2
;;
//
// return
//
mov r8 = r0 // return 0 from setjmp
mov ar.unat = r14 // restore unat
br.ret.sptk b0
PROCEDURE_EXIT(SetJump)
//
// void LongJump(struct jmp_buffer *)
//
// Perform a non-local goto.
//
// Description:
//
// LongJump initializes the register set to the values saved by a
// previous 'SetJump' and jumps to the return location saved by that
// 'SetJump'. This has the effect of unwinding the stack and returning
// for a second time to the 'SetJump'.
//
PROCEDURE_ENTRY(LongJump)
//
// Make sure buffer is aligned at 16byte boundary
//
mov r32 = r33
add r10 = -0x10,r0 ;; // mask the lower 4 bits
and r32 = r32, r10;;
add r32 = 0x10, r32;; // move to next 16 byte boundary
//
// caching the return value as we do invala in the end
//
/// mov r8 = r33 // return value
mov r8 = 1 // For now return hard coded 1
//
// get immediate context
//
mov r14 = ar.rsc // get user RSC conf
add r10 = J_PFS, r32 // get address of pfs
add r11 = J_NATS, r32
;;
ld8 r15 = [r10], J_BSP-J_PFS // get pfs
ld8 r2 = [r11], J_LC-J_NATS // get unat for spilled regs
;;
mov ar.unat = r2
;;
ld8 r16 = [r10], J_PREDS-J_BSP // get backing store pointer
mov ar.rsc = r0 // put RSE in enforced lazy
mov ar.pfs = r15
;;
//
// while returning from longjmp the BSPSTORE and BSP needs to be
// same and discard all the registers allocated after we did
// setjmp. Also, we need to generate the RNAT register since we
// did not flushed the RSE on setjmp.
//
mov r17 = ar.bspstore // get current BSPSTORE
;;
cmp.ltu p6,p7 = r17, r16 // is it less than BSP of
(p6) br.spnt.few .flush_rse
mov r19 = ar.rnat // get current RNAT
;;
loadrs // invalidate dirty regs
br.sptk.many .restore_rnat // restore RNAT
.flush_rse:
flushrs
;;
mov r19 = ar.rnat // get current RNAT
mov r17 = r16 // current BSPSTORE
;;
.restore_rnat:
//
// check if RNAT is saved between saved BSP and curr BSPSTORE
//
dep r18 = 1,r16,3,6 // get RNAT address
;;
cmp.ltu p8,p9 = r18, r17 // RNAT saved on RSE
;;
(p8) ld8 r19 = [r18] // get RNAT from RSE
;;
mov ar.bspstore = r16 // set new BSPSTORE
;;
mov ar.rnat = r19 // restore RNAT
mov ar.rsc = r14 // restore RSC conf
ld8 r3 = [r11], J_R4-J_LC // get lc register
ld8 r2 = [r10], J_R5-J_PREDS // get predicates
;;
mov pr = r2, -1
mov ar.lc = r3
//
// restore preserved general registers & NaT's
//
ld8.fill r4 = [r11], J_R6-J_R4
;;
ld8.fill r5 = [r10], J_R7-J_R5
ld8.fill r6 = [r11], J_SP-J_R6
;;
ld8.fill r7 = [r10], J_F2-J_R7
ld8.fill sp = [r11], J_F3-J_SP
;;
//
// restore floating registers
//
ldf.fill f2 = [r10], J_F4-J_F2
ldf.fill f3 = [r11], J_F5-J_F3
;;
ldf.fill f4 = [r10], J_F16-J_F4
ldf.fill f5 = [r11], J_F17-J_F5
;;
ldf.fill f16 = [r10], J_F18-J_F16
ldf.fill f17 = [r11], J_F19-J_F17
;;
ldf.fill f18 = [r10], J_F20-J_F18
ldf.fill f19 = [r11], J_F21-J_F19
;;
ldf.fill f20 = [r10], J_F22-J_F20
ldf.fill f21 = [r11], J_F23-J_F21
;;
ldf.fill f22 = [r10], J_F24-J_F22
ldf.fill f23 = [r11], J_F25-J_F23
;;
ldf.fill f24 = [r10], J_F26-J_F24
ldf.fill f25 = [r11], J_F27-J_F25
;;
ldf.fill f26 = [r10], J_F28-J_F26
ldf.fill f27 = [r11], J_F29-J_F27
;;
ldf.fill f28 = [r10], J_F30-J_F28
ldf.fill f29 = [r11], J_F31-J_F29
;;
ldf.fill f30 = [r10], J_FPSR-J_F30
ldf.fill f31 = [r11], J_B0-J_F31 ;;
//
// restore branch registers and fpsr
//
ld8 r16 = [r10], J_B1-J_FPSR // get fpsr
ld8 r17 = [r11], J_B2-J_B0 // get return pointer
;;
mov ar.fpsr = r16
mov b0 = r17
ld8 r2 = [r10], J_B3-J_B1
ld8 r3 = [r11], J_B4-J_B2
;;
mov b1 = r2
mov b2 = r3
ld8 r2 = [r10], J_B5-J_B3
ld8 r3 = [r11]
;;
mov b3 = r2
mov b4 = r3
ld8 r2 = [r10]
ld8 r21 = [r32] // get user unat
;;
mov b5 = r2
mov ar.unat = r21
//
// invalidate ALAT
//
invala ;;
br.ret.sptk b0
PROCEDURE_EXIT(LongJump)

File diff suppressed because it is too large Load Diff

View File

@ -1,169 +0,0 @@
/*++
Copyright (c) 2004, 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:
PeiLib.c
Abstract:
PEI Library Functions
--*/
#include "TianoCommon.h"
#include "PeiHob.h"
#include "Pei.h"
VOID
PeiCopyMem (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
);
VOID
ZeroMem (
IN VOID *Buffer,
IN UINTN Size
)
/*++
Routine Description:
Set Buffer to zero for Size bytes.
Arguments:
Buffer - Memory to set.
Size - Number of bytes to set
Returns:
None
--*/
{
INT8 *Ptr;
Ptr = Buffer;
while (Size--) {
*(Ptr++) = 0;
}
}
VOID
PeiCopyMem (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
)
/*++
Routine Description:
Copy Length bytes from Source to Destination.
Arguments:
Destination - Target of copy
Source - Place to copy from
Length - Number of bytes to copy
Returns:
None
--*/
{
CHAR8 *Destination8;
CHAR8 *Source8;
Destination8 = Destination;
Source8 = Source;
while (Length--) {
*(Destination8++) = *(Source8++);
}
}
VOID
CopyMem (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
)
/*++
Routine Description:
Copy Length bytes from Source to Destination.
Arguments:
Destination - Target of copy
Source - Place to copy from
Length - Number of bytes to copy
Returns:
None
--*/
{
CHAR8 *Destination8;
CHAR8 *Source8;
Destination8 = Destination;
Source8 = Source;
while (Length--) {
*(Destination8++) = *(Source8++);
}
}
BOOLEAN
CompareGuid (
IN EFI_GUID *Guid1,
IN EFI_GUID *Guid2
)
/*++
Routine Description:
Compares two GUIDs
Arguments:
Guid1 - guid to compare
Guid2 - guid to compare
Returns:
= TRUE if Guid1 == Guid2
= FALSE if Guid1 != Guid2
--*/
{
if ((((INT32 *) Guid1)[0] - ((INT32 *) Guid2)[0]) == 0) {
if ((((INT32 *) Guid1)[1] - ((INT32 *) Guid2)[1]) == 0) {
if ((((INT32 *) Guid1)[2] - ((INT32 *) Guid2)[2]) == 0) {
if ((((INT32 *) Guid1)[3] - ((INT32 *) Guid2)[3]) == 0) {
return TRUE;
}
}
}
}
return FALSE;
}

View File

@ -1,762 +0,0 @@
/*++
Copyright (c) 2004, 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:
PeiLib.h
Abstract:
PEI Library Functions
--*/
#ifndef _PEI_LIB_H_
#define _PEI_LIB_H_
#include "Tiano.h"
#include "Pei.h"
#include "peiHobLib.h"
#include EFI_PROTOCOL_DEFINITION (Decompress)
#include EFI_PROTOCOL_DEFINITION (TianoDecompress)
#include EFI_GUID_DEFINITION (PeiPeCoffLoader)
VOID
PeiCopyMem (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
)
/*++
Routine Description:
Copy Length bytes from Source to Destination.
Arguments:
Destination - Target of copy
Source - Place to copy from
Length - Number of bytes to copy
Returns:
None
--*/
;
VOID
ZeroMem (
IN VOID *Buffer,
IN UINTN Size
)
/*++
Routine Description:
Set Buffer to zero for Size bytes.
Arguments:
Buffer - Memory to set.
Size - Number of bytes to set
Returns:
None
--*/
;
VOID
CopyMem (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
)
/*++
Routine Description:
Copy Length bytes from Source to Destination.
Arguments:
Destination - Target of copy
Source - Place to copy from
Length - Number of bytes to copy
Returns:
None
--*/
;
BOOLEAN
CompareGuid (
IN EFI_GUID *Guid1,
IN EFI_GUID *Guid2
)
/*++
Routine Description:
Compares two GUIDs
Arguments:
Guid1 - guid to compare
Guid2 - guid to compare
Returns:
= TRUE if Guid1 == Guid2
= FALSE if Guid1 != Guid2
--*/
;
EFI_STATUS
InstallEfiPeiPeCoffLoader (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PE_COFF_LOADER_PROTOCOL **This,
IN EFI_PEI_PPI_DESCRIPTOR *ThisPpi
)
/*++
Routine Description:
Install EFI Pei PE coff loader protocol.
Arguments:
PeiServices - The PEI core services table.
This - Pointer to get Pei PE coff loader protocol as output
ThisPpi - Passed in as EFI_NT_LOAD_AS_DLL_PPI on NT_EMULATOR platform
Returns:
EFI_SUCCESS
--*/
;
EFI_STATUS
InstallEfiDecompress (
EFI_DECOMPRESS_PROTOCOL **This
)
/*++
Routine Description:
Install EFI decompress protocol.
Arguments:
This - Pointer to get decompress protocol as output
Returns:
EFI_SUCCESS - EFI decompress protocol successfully installed.
--*/
;
EFI_STATUS
InstallTianoDecompress (
EFI_TIANO_DECOMPRESS_PROTOCOL **This
)
/*++
Routine Description:
Install Tiano decompress protocol.
Arguments:
This - Pointer to get decompress protocol as output
Returns:
EFI_SUCCESS - Tiano decompress protocol successfully installed.
--*/
;
VOID
PeiPerfMeasure (
EFI_PEI_SERVICES **PeiServices,
IN UINT16 *Token,
IN EFI_FFS_FILE_HEADER *FileHeader,
IN BOOLEAN EntryExit,
IN UINT64 Value
)
/*++
Routine Description:
Log a timestamp count.
Arguments:
PeiServices - Pointer to the PEI Core Services table
Token - Pointer to Token Name
FileHeader - Pointer to the file header
EntryExit - Indicates start or stop measurement
Value - The start time or the stop time
Returns:
--*/
;
EFI_STATUS
GetTimerValue (
OUT UINT64 *TimerValue
)
/*++
Routine Description:
Get timer value.
Arguments:
TimerValue - Pointer to the returned timer value
Returns:
EFI_SUCCESS - Successfully got timer value
--*/
;
#ifdef EFI_PEI_PERFORMANCE
#define PEI_PERF_START(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, FALSE, Value)
#define PEI_PERF_END(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, TRUE, Value)
#else
#define PEI_PERF_START(Ps, Token, FileHeader, Value)
#define PEI_PERF_END(Ps, Token, FileHeader, Value)
#endif
//
// hob.c
//
EFI_STATUS
PeiBuildHobModule (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *ModuleName,
IN EFI_PHYSICAL_ADDRESS Module,
IN UINT64 ModuleLength,
IN EFI_PHYSICAL_ADDRESS EntryPoint
)
/*++
Routine Description:
Builds a HOB for a loaded PE32 module
Arguments:
PeiServices - The PEI core services table.
ModuleName - The GUID File Name of the module
Memory - The 64 bit physical address of the module
ModuleLength - The length of the module in bytes
EntryPoint - The 64 bit physical address of the entry point
to the module
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobResourceDescriptor (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_RESOURCE_TYPE ResourceType,
IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
IN EFI_PHYSICAL_ADDRESS PhysicalStart,
IN UINT64 NumberOfBytes
)
/*++
Routine Description:
Builds a HOB that describes a chunck of system memory
Arguments:
PeiServices - The PEI core services table.
ResourceType - The type of resource described by this HOB
ResourceAttribute - The resource attributes of the memory described by this HOB
PhysicalStart - The 64 bit physical address of memory described by this HOB
NumberOfBytes - The length of the memoty described by this HOB in bytes
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobGuid (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *Guid,
IN UINTN DataLength,
IN OUT VOID **Hob
)
/*++
Routine Description:
Builds a custom HOB that is tagged with a GUID for identification
Arguments:
PeiServices - The PEI core services table.
Guid - The GUID of the custome HOB type
DataLength - The size of the data payload for the GUIDed HOB
Hob - Pointer to the Hob
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobGuidData (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *Guid,
IN VOID *Data,
IN UINTN DataLength
)
/*++
Routine Description:
Builds a custom HOB that is tagged with a GUID for identification
Arguments:
PeiServices - The PEI core services table.
Guid - The GUID of the custome HOB type
Data - The data to be copied into the GUIDed HOB data field.
DataLength - The data field length.
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobFv (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
/*++
Routine Description:
Builds a Firmware Volume HOB
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The base address of the Firmware Volume
Length - The size of the Firmware Volume in bytes
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobCpu (
IN EFI_PEI_SERVICES **PeiServices,
IN UINT8 SizeOfMemorySpace,
IN UINT8 SizeOfIoSpace
)
/*++
Routine Description:
Builds a HOB for the CPU
Arguments:
PeiServices - The PEI core services table.
SizeOfMemorySpace - Identifies the maximum
physical memory addressibility of the processor.
SizeOfIoSpace - Identifies the maximum physical I/O addressibility
of the processor.
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobStack (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
/*++
Routine Description:
Builds a HOB for the Stack
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The 64 bit physical address of the Stack
Length - The length of the stack in bytes
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobBspStore (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_MEMORY_TYPE MemoryType
)
/*++
Routine Description:
Builds a HOB for the bsp store
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The 64 bit physical address of the bsp store
Length - The length of the bsp store in bytes
MemoryType - Memory type
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
EFI_STATUS
PeiBuildHobMemoryAllocation (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_GUID *Name,
IN EFI_MEMORY_TYPE MemoryType
)
/*++
Routine Description:
Builds a HOB for the memory allocation
Arguments:
PeiServices - The PEI core services table.
BaseAddress - The 64 bit physical address of the memory
Length - The length of the memory allocation in bytes
Name - Name for Hob
MemoryType - Memory type
Returns:
EFI_SUCCESS - Hob is successfully built.
Others - Errors occur while creating new Hob
--*/
;
//
// print.c
//
UINTN
AvSPrint (
OUT CHAR8 *StartOfBuffer,
IN UINTN StrSize,
IN CONST CHAR8 *Format,
IN VA_LIST Marker
)
/*++
Routine Description:
AvSPrint function to process format and place the results in Buffer. Since a
VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
this is the main print working routine
Arguments:
StartOfBuffer - Ascii buffer to print the results of the parsing of Format into.
StrSize - Maximum number of characters to put into buffer. Zero means
no limit.
FormatString - Ascii format string see file header for more details.
Marker - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
;
UINTN
ASPrint (
OUT CHAR8 *Buffer,
IN UINTN BufferSize,
IN CONST CHAR8 *Format,
...
)
/*++
Routine Description:
ASPrint function to process format and place the results in Buffer.
Arguments:
Buffer - Ascii buffer to print the results of the parsing of Format into.
BufferSize - Maximum number of characters to put into buffer. Zero means no
limit.
Format - Ascii format string see file header for more details.
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
;
//
// math.c
//
UINT64
MultU64x32 (
IN UINT64 Multiplicand,
IN UINTN Multiplier
)
/*++
Routine Description:
This routine allows a 64 bit value to be multiplied with a 32 bit
value returns 64bit result.
No checking if the result is greater than 64bits
Arguments:
Multiplicand - multiplicand
Multiplier - multiplier
Returns:
Multiplicand * Multiplier
--*/
;
UINT64
DivU64x32 (
IN UINT64 Dividend,
IN UINTN Divisor,
OUT UINTN *Remainder OPTIONAL
)
/*++
Routine Description:
This routine allows a 64 bit value to be divided with a 32 bit value returns
64bit result and the Remainder.
N.B. only works for 31bit divisors!!
Arguments:
Dividend - dividend
Divisor - divisor
Remainder - buffer for remainder
Returns:
Dividend / Divisor
Remainder = Dividend mod Divisor
--*/
;
UINT64
RShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
/*++
Routine Description:
This routine allows a 64 bit value to be right shifted by 32 bits and returns the
shifted value.
Count is valid up 63. (Only Bits 0-5 is valid for Count)
Arguments:
Operand - Value to be shifted
Count - Number of times to shift right.
Returns:
Value shifted right identified by the Count.
--*/
;
UINT64
LShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
/*++
Routine Description:
This routine allows a 64 bit value to be left shifted by 32 bits and
returns the shifted value.
Count is valid up 63. (Only Bits 0-5 is valid for Count)
Arguments:
Operand - Value to be shifted
Count - Number of times to shift left.
Returns:
Value shifted left identified by the Count.
--*/
;
VOID
RegisterNativeCpuIo (
IN EFI_PEI_SERVICES **PeiServices,
IN VOID *CpuIo
)
/*++
Routine Description:
Register a native Cpu IO
Arguments:
PeiServices - Calling context
CpuIo - CpuIo instance to register
Returns:
None
--*/
;
VOID
GetNativeCpuIo (
IN EFI_PEI_SERVICES **PeiServices,
OUT VOID **CpuIo
)
/*++
Routine Description:
Get registered Cpu IO.
Arguments:
PeiServices - Calling context
CpuIo - CpuIo instance registered before
Returns:
None
--*/
;
#endif

View File

@ -1,233 +0,0 @@
/*++
Copyright (c) 2004 - 2005, 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:
Perf.c
Abstract:
Support for performance primitives.
--*/
#include "Tiano.h"
#include "Pei.h"
#include "PeiLib.h"
#include "PeiHob.h"
#include EFI_GUID_DEFINITION (PeiPerformanceHob)
//
// Perfomance HOB data definitions
//
#define MAX_PEI_PERF_LOG_ENTRIES 28
//
// Prototype functions
//
EFI_STATUS
GetTimerValue (
OUT UINT64 *TimerValue
);
VOID
PeiPerfMeasure (
EFI_PEI_SERVICES **PeiServices,
IN UINT16 *Token,
IN EFI_FFS_FILE_HEADER *FileHeader,
IN BOOLEAN EntryExit,
IN UINT64 Value
)
/*++
Routine Description:
Log a timestamp count.
Arguments:
PeiServices - Pointer to the PEI Core Services table
Token - Pointer to Token Name
FileHeader - Pointer to the file header
EntryExit - Indicates start or stop measurement
Value - The start time or the stop time
Returns:
--*/
{
EFI_STATUS Status;
EFI_HOB_GUID_TYPE *Hob;
EFI_HOB_GUID_DATA_PERFORMANCE_LOG *PerfHobData;
PEI_PERFORMANCE_MEASURE_LOG_ENTRY *Log;
EFI_PEI_PPI_DESCRIPTOR *PerfHobDescriptor;
UINT64 TimeCount;
INTN Index;
UINTN Index2;
EFI_GUID *Guid;
EFI_GUID *CheckGuid;
TimeCount = 0;
//
// Get the END time as early as possible to make it more accurate.
//
if (EntryExit) {
GetTimerValue (&TimeCount);
}
//
// Locate the Pei Performance Log Hob.
//
Status = (*PeiServices)->LocatePpi (
PeiServices,
&gEfiPeiPerformanceHobGuid,
0,
&PerfHobDescriptor,
NULL
);
//
// If the Performance Hob was not found, build and install one.
//
if (EFI_ERROR(Status)) {
Status = PeiBuildHobGuid (
PeiServices,
&gEfiPeiPerformanceHobGuid,
(sizeof(EFI_HOB_GUID_DATA_PERFORMANCE_LOG) +
((MAX_PEI_PERF_LOG_ENTRIES-1) *
sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY)) +
sizeof(EFI_PEI_PPI_DESCRIPTOR)
),
&Hob
);
ASSERT_PEI_ERROR(PeiServices, Status);
PerfHobData = (EFI_HOB_GUID_DATA_PERFORMANCE_LOG *)(Hob+1);
PerfHobData->NumberOfEntries = 0;
PerfHobDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)((UINT8 *)(PerfHobData+1) +
(sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY) *
(MAX_PEI_PERF_LOG_ENTRIES-1)
)
);
PerfHobDescriptor->Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
PerfHobDescriptor->Guid = &gEfiPeiPerformanceHobGuid;
PerfHobDescriptor->Ppi = NULL;
(*PeiServices)->InstallPpi (
PeiServices,
PerfHobDescriptor
);
}
PerfHobData = (EFI_HOB_GUID_DATA_PERFORMANCE_LOG *)(((UINT8 *)(PerfHobDescriptor)) -
((sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY) *
(MAX_PEI_PERF_LOG_ENTRIES-1)
)
+ sizeof(EFI_HOB_GUID_DATA_PERFORMANCE_LOG)
)
);
if (PerfHobData->NumberOfEntries >= MAX_PEI_PERF_LOG_ENTRIES) {
return;
}
if (!EntryExit) {
Log = &(PerfHobData->Log[PerfHobData->NumberOfEntries]);
(*PeiServices)->SetMem (Log, sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY), 0);
//
// If not NULL pointer, copy the file name
//
if (FileHeader != NULL) {
Log->Name = FileHeader->Name;
}
//
// Copy the description string
//
(*PeiServices)->CopyMem (
&(Log->DescriptionString),
Token,
(PEI_PERF_MAX_DESC_STRING-1) * sizeof(UINT16)
);
//
// Get the start time as late as possible to make it more accurate.
//
GetTimerValue (&TimeCount);
//
// Record the time stamp.
//
if (Value != 0) {
Log->StartTimeCount = Value;
} else {
Log->StartTimeCount = TimeCount;
}
Log->StopTimeCount = 0;
//
// Increment the number of valid log entries.
//
PerfHobData->NumberOfEntries++;
} else {
for (Index = PerfHobData->NumberOfEntries-1; Index >= 0; Index--) {
Log = NULL;
for (Index2 = 0; Index2 < PEI_PERF_MAX_DESC_STRING; Index2++) {
if (PerfHobData->Log[Index].DescriptionString[Index2] == 0) {
Log = &(PerfHobData->Log[Index]);
break;
}
if (PerfHobData->Log[Index].DescriptionString[Index2] !=
Token[Index2]) {
break;
}
}
if (Log != NULL) {
if (FileHeader != NULL) {
Guid = &(Log->Name);
CheckGuid = &(FileHeader->Name);
if ((((INT32 *)Guid)[0] == ((INT32 *)CheckGuid)[0]) &&
(((INT32 *)Guid)[1] == ((INT32 *)CheckGuid)[1]) &&
(((INT32 *)Guid)[2] == ((INT32 *)CheckGuid)[2]) &&
(((INT32 *)Guid)[3] == ((INT32 *)CheckGuid)[3])) {
if (Value != 0) {
Log->StopTimeCount = Value;
} else {
Log->StopTimeCount = TimeCount;
}
break;
}
} else {
if (Value != 0) {
Log->StopTimeCount = Value;
} else {
Log->StopTimeCount = TimeCount;
}
break;
}
}
}
}
return;
}

View File

@ -1,736 +0,0 @@
/*++
Copyright (c) 2004, 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:
Print.c
Abstract:
Basic Ascii AvSPrintf() function named AvSPrint(). AvSPrint() enables very
simple implemenation of debug prints.
You can not Print more than PEI_LIB_MAX_PRINT_BUFFER characters at a
time. This makes the implementation very simple.
AvSPrint format specification has the follwoing form
%[flags][width]type
flags:
'-' - Left justify
'+' - Prefix a sign
' ' - Prefix a blank
',' - Place commas in numberss
'0' - Prefix for width with zeros
'l' - UINT64
'L' - UINT64
width:
'*' - Get width from a UINTN argumnet from the argument list
Decimal number that represents width of print
type:
'X' - argument is a UINTN hex number, prefix '0'
'x' - argument is a hex number
'd' - argument is a decimal number
'a' - argument is an ascii string
'S', 's' - argument is an Unicode string
'g' - argument is a pointer to an EFI_GUID
't' - argument is a pointer to an EFI_TIME structure
'c' - argument is an ascii character
'r' - argument is EFI_STATUS
'%' - Print a %
--*/
#include "Tiano.h"
#include "Pei.h"
#include "PeiLib.h"
#include "Print.h"
STATIC
CHAR8 *
GetFlagsAndWidth (
IN CHAR8 *Format,
OUT UINTN *Flags,
OUT UINTN *Width,
IN OUT VA_LIST *Marker
);
STATIC
UINTN
ValueToString (
IN OUT CHAR8 *Buffer,
IN INT64 Value,
IN UINTN Flags,
IN UINTN Width
);
STATIC
UINTN
ValueTomHexStr (
IN OUT CHAR8 *Buffer,
IN UINT64 Value,
IN UINTN Flags,
IN UINTN Width
);
STATIC
UINTN
GuidToString (
IN EFI_GUID *Guid,
IN OUT CHAR8 *Buffer,
IN UINTN BufferSize
);
STATIC
UINTN
TimeToString (
IN EFI_TIME *Time,
IN OUT CHAR8 *Buffer,
IN UINTN BufferSize
);
STATIC
UINTN
EfiStatusToString (
IN EFI_STATUS Status,
OUT CHAR8 *Buffer,
IN UINTN BufferSize
);
UINTN
ASPrint (
OUT CHAR8 *Buffer,
IN UINTN BufferSize,
IN CONST CHAR8 *Format,
...
)
/*++
Routine Description:
ASPrint function to process format and place the results in Buffer.
Arguments:
Buffer - Ascii buffer to print the results of the parsing of Format into.
BufferSize - Maximum number of characters to put into buffer. Zero means no
limit.
Format - Ascii format string see file header for more details.
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
{
UINTN Return;
VA_LIST Marker;
VA_START(Marker, Format);
Return = AvSPrint(Buffer, BufferSize, Format, Marker);
VA_END (Marker);
return Return;
}
UINTN
AvSPrint (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
IN VA_LIST Marker
)
/*++
Routine Description:
AvSPrint function to process format and place the results in Buffer. Since a
VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
this is the main print working routine
Arguments:
StartOfBuffer - Ascii buffer to print the results of the parsing of Format into.
BufferSize - Maximum number of characters to put into buffer. Zero means
no limit.
FormatString - Ascii format string see file header for more details.
Marker - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
{
CHAR8 *Buffer;
CHAR8 *AsciiStr;
CHAR16 *UnicodeStr;
CHAR8 *Format;
UINTN Index;
UINTN Flags;
UINTN Width;
UINT64 Value;
//
// Process the format string. Stop if Buffer is over run.
//
Buffer = StartOfBuffer;
Format = (CHAR8 *)FormatString;
for (Index = 0; (*Format != '\0') && (Index < BufferSize); Format++) {
if (*Format != '%') {
if (*Format == '\n') {
//
// If carage return add line feed
//
Buffer[Index++] = '\r';
}
Buffer[Index++] = *Format;
} else {
//
// Now it's time to parse what follows after %
//
Format = GetFlagsAndWidth (Format, &Flags, &Width, &Marker);
switch (*Format) {
case 'X':
Flags |= PREFIX_ZERO;
Width = sizeof (UINT64) * 2;
//
// break skiped on purpose
//
case 'x':
if ((Flags & LONG_TYPE) == LONG_TYPE) {
Value = VA_ARG (Marker, UINT64);
} else {
Value = VA_ARG (Marker, UINTN);
}
Index += ValueTomHexStr (&Buffer[Index], Value, Flags, Width);
break;
case 'd':
if ((Flags & LONG_TYPE) == LONG_TYPE) {
Value = VA_ARG (Marker, UINT64);
} else {
Value = (UINTN)VA_ARG (Marker, UINTN);
}
Index += ValueToString (&Buffer[Index], Value, Flags, Width);
break;
case 's':
case 'S':
UnicodeStr = (CHAR16 *)VA_ARG (Marker, CHAR16 *);
if (UnicodeStr == NULL) {
UnicodeStr = L"<null string>";
}
for ( ;*UnicodeStr != '\0'; UnicodeStr++) {
Buffer[Index++] = (CHAR8)*UnicodeStr;
}
break;
case 'a':
AsciiStr = (CHAR8 *)VA_ARG (Marker, CHAR8 *);
if (AsciiStr == NULL) {
AsciiStr = "<null string>";
}
while (*AsciiStr != '\0') {
Buffer[Index++] = *AsciiStr++;
}
break;
case 'c':
Buffer[Index++] = (CHAR8)VA_ARG (Marker, UINTN);
break;
case 'g':
Index += GuidToString (
VA_ARG (Marker, EFI_GUID *),
&Buffer[Index],
BufferSize
);
break;
case 't':
Index += TimeToString (
VA_ARG (Marker, EFI_TIME *),
&Buffer[Index],
BufferSize
);
break;
case 'r':
Index += EfiStatusToString (
VA_ARG (Marker, EFI_STATUS),
&Buffer[Index],
BufferSize
);
break;
case '%':
Buffer[Index++] = *Format;
break;
default:
//
// if the type is unknown print it to the screen
//
Buffer[Index++] = *Format;
}
}
}
Buffer[Index++] = '\0';
return &Buffer[Index] - StartOfBuffer;
}
STATIC
CHAR8 *
GetFlagsAndWidth (
IN CHAR8 *Format,
OUT UINTN *Flags,
OUT UINTN *Width,
IN OUT VA_LIST *Marker
)
/*++
Routine Description:
AvSPrint worker function that parses flag and width information from the
Format string and returns the next index into the Format string that needs
to be parsed. See file headed for details of Flag and Width.
Arguments:
Format - Current location in the AvSPrint format string.
Flags - Returns flags
Width - Returns width of element
Marker - Vararg list that may be paritally consumed and returned.
Returns:
Pointer indexed into the Format string for all the information parsed
by this routine.
--*/
{
UINTN Count;
BOOLEAN Done;
*Flags = 0;
*Width = 0;
for (Done = FALSE; !Done; ) {
Format++;
switch (*Format) {
case '-': *Flags |= LEFT_JUSTIFY; break;
case '+': *Flags |= PREFIX_SIGN; break;
case ' ': *Flags |= PREFIX_BLANK; break;
case ',': *Flags |= COMMA_TYPE; break;
case 'L':
case 'l': *Flags |= LONG_TYPE; break;
case '*':
*Width = VA_ARG (*Marker, UINTN);
break;
case '0':
*Flags |= PREFIX_ZERO;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
Count = 0;
do {
Count = (Count * 10) + *Format - '0';
Format++;
} while ((*Format >= '0') && (*Format <= '9'));
Format--;
*Width = Count;
break;
default:
Done = TRUE;
}
}
return Format;
}
static CHAR8 mHexStr[] = { '0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F' };
STATIC
UINTN
ValueTomHexStr (
IN OUT CHAR8 *Buffer,
IN UINT64 Value,
IN UINTN Flags,
IN UINTN Width
)
/*++
Routine Description:
AvSPrint worker function that prints a Value as a hex number in Buffer
Arguments:
Buffer - Location to place ascii hex string of Value.
Value - Hex value to convert to a string in Buffer.
Flags - Flags to use in printing Hex string, see file header for details.
Width - Width of hex value.
Returns:
Number of characters printed.
--*/
{
CHAR8 TempBuffer[30];
CHAR8 *TempStr;
CHAR8 Prefix;
CHAR8 *BufferPtr;
UINTN Count;
UINTN Index;
TempStr = TempBuffer;
BufferPtr = Buffer;
//
// Count starts at one since we will null terminate. Each iteration of the
// loop picks off one nibble. Oh yea TempStr ends up backwards
//
Count = 0;
do {
*(TempStr++) = mHexStr[Value & 0x0f];
Value = RShiftU64 (Value, 4);
Count++;
} while (Value != 0);
if (Flags & PREFIX_ZERO) {
Prefix = '0';
} else if (!(Flags & LEFT_JUSTIFY)) {
Prefix = ' ';
} else {
Prefix = 0x00;
}
for (Index = Count; Index < Width; Index++) {
*(TempStr++) = Prefix;
}
//
// Reverse temp string into Buffer.
//
while (TempStr != TempBuffer) {
*(BufferPtr++) = *(--TempStr);
}
*BufferPtr = 0;
return Index;
}
STATIC
UINTN
ValueToString (
IN OUT CHAR8 *Buffer,
IN INT64 Value,
IN UINTN Flags,
IN UINTN Width
)
/*++
Routine Description:
AvSPrint worker function that prints a Value as a decimal number in Buffer
Arguments:
Buffer - Location to place ascii decimal number string of Value.
Value - Decimal value to convert to a string in Buffer.
Flags - Flags to use in printing decimal string, see file header for details.
Width - Width of hex value.
Returns:
Number of characters printed.
--*/
{
CHAR8 TempBuffer[30];
CHAR8 *TempStr;
CHAR8 *BufferPtr;
UINTN Count;
UINTN Remainder;
TempStr = TempBuffer;
BufferPtr = Buffer;
Count = 0;
if (Value < 0) {
*(BufferPtr++) = '-';
Value = -Value;
Count++;
}
do {
Value = (INT64)DivU64x32 ((UINT64)Value, 10, &Remainder);
*(TempStr++) = (CHAR8)(Remainder + '0');
Count++;
if ((Flags & COMMA_TYPE) == COMMA_TYPE) {
if (Count % 3 == 0) {
*(TempStr++) = ',';
}
}
} while (Value != 0);
//
// Reverse temp string into Buffer.
//
while (TempStr != TempBuffer) {
*(BufferPtr++) = *(--TempStr);
}
*BufferPtr = 0;
return Count;
}
STATIC
UINTN
GuidToString (
IN EFI_GUID *Guid,
IN CHAR8 *Buffer,
IN UINTN BufferSize
)
/*++
Routine Description:
AvSPrint worker function that prints an EFI_GUID.
Arguments:
Guid - Pointer to GUID to print.
Buffer - Buffe to print Guid into.
BufferSize - Size of Buffer.
Returns:
Number of characters printed.
--*/
{
UINTN Size;
Size = ASPrint (
Buffer,
BufferSize,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
Guid->Data4[1],
Guid->Data4[2],
Guid->Data4[3],
Guid->Data4[4],
Guid->Data4[5],
Guid->Data4[6],
Guid->Data4[7]
);
//
// ASPrint will null terminate the string. The -1 skips the null
//
return Size - 1;
}
STATIC
UINTN
TimeToString (
IN EFI_TIME *Time,
OUT CHAR8 *Buffer,
IN UINTN BufferSize
)
/*++
Routine Description:
AvSPrint worker function that prints EFI_TIME.
Arguments:
Time - Pointer to EFI_TIME sturcture to print.
Buffer - Buffer to print Time into.
BufferSize - Size of Buffer.
Returns:
Number of characters printed.
--*/
{
UINTN Size;
Size = ASPrint (
Buffer,
BufferSize,
"%02d/%02d/%04d %02d:%02d",
Time->Month,
Time->Day,
Time->Year,
Time->Hour,
Time->Minute
);
//
// ASPrint will null terminate the string. The -1 skips the null
//
return Size - 1;
}
STATIC
UINTN
EfiStatusToString (
IN EFI_STATUS Status,
OUT CHAR8 *Buffer,
IN UINTN BufferSize
)
/*++
Routine Description:
AvSPrint worker function that prints EFI_STATUS as a string. If string is
not known a hex value will be printed.
Arguments:
Status - EFI_STATUS sturcture to print.
Buffer - Buffer to print EFI_STATUS message string into.
BufferSize - Size of Buffer.
Returns:
Number of characters printed.
--*/
{
UINTN Size;
CHAR8 *Desc;
if (Status == EFI_SUCCESS) {
Desc = "Success";
} else if (Status == EFI_LOAD_ERROR) {
Desc = "Load Error";
} else if (Status == EFI_INVALID_PARAMETER) {
Desc = "Invalid Parameter";
} else if (Status == EFI_UNSUPPORTED) {
Desc = "Unsupported";
} else if (Status == EFI_BAD_BUFFER_SIZE) {
Desc = "Bad Buffer Size";
} else if (Status == EFI_BUFFER_TOO_SMALL) {
Desc = "Buffer Too Small";
} else if (Status == EFI_NOT_READY) {
Desc = "Not Ready";
} else if (Status == EFI_DEVICE_ERROR) {
Desc = "Device Error";
} else if (Status == EFI_WRITE_PROTECTED) {
Desc = "Write Protected";
} else if (Status == EFI_OUT_OF_RESOURCES) {
Desc = "Out of Resources";
} else if (Status == EFI_VOLUME_CORRUPTED) {
Desc = "Volume Corrupt";
} else if (Status == EFI_VOLUME_FULL) {
Desc = "Volume Full";
} else if (Status == EFI_NO_MEDIA) {
Desc = "No Media";
} else if (Status == EFI_MEDIA_CHANGED) {
Desc = "Media changed";
} else if (Status == EFI_NOT_FOUND) {
Desc = "Not Found";
} else if (Status == EFI_ACCESS_DENIED) {
Desc = "Access Denied";
} else if (Status == EFI_NO_RESPONSE) {
Desc = "No Response";
} else if (Status == EFI_NO_MAPPING) {
Desc = "No mapping";
} else if (Status == EFI_TIMEOUT) {
Desc = "Time out";
} else if (Status == EFI_NOT_STARTED) {
Desc = "Not started";
} else if (Status == EFI_ALREADY_STARTED) {
Desc = "Already started";
} else if (Status == EFI_ABORTED) {
Desc = "Aborted";
} else if (Status == EFI_ICMP_ERROR) {
Desc = "ICMP Error";
} else if (Status == EFI_TFTP_ERROR) {
Desc = "TFTP Error";
} else if (Status == EFI_PROTOCOL_ERROR) {
Desc = "Protocol Error";
} else if (Status == EFI_WARN_UNKNOWN_GLYPH) {
Desc = "Warning Unknown Glyph";
} else if (Status == EFI_WARN_DELETE_FAILURE) {
Desc = "Warning Delete Failure";
} else if (Status == EFI_WARN_WRITE_FAILURE) {
Desc = "Warning Write Failure";
} else if (Status == EFI_WARN_BUFFER_TOO_SMALL) {
Desc = "Warning Buffer Too Small";
} else {
Desc = NULL;
}
//
// If we found a match, copy the message to the user's buffer. Otherwise
// sprint the hex status code to their buffer.
//
if (Desc != NULL) {
Size = ASPrint (Buffer, BufferSize, "%a", Desc);
} else {
Size = ASPrint (Buffer, BufferSize, "%X", Status);
}
return Size - 1;
}

View File

@ -1,37 +0,0 @@
/*++
Copyright (c) 2004, 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:
Print.h
Abstract:
Private data for Print.c
--*/
#ifndef _PRINT_H_
#define _PRINT_H_
#define LEFT_JUSTIFY 0x01
#define PREFIX_SIGN 0x02
#define PREFIX_BLANK 0x04
#define COMMA_TYPE 0x08
#define LONG_TYPE 0x10
#define PREFIX_ZERO 0x20
//
// Largest number of characters that can be printed out.
//
#define PEI_LIB_MAX_PRINT_BUFFER (80 * 4)
#endif

View File

@ -1,56 +0,0 @@
/*++
Copyright (c) 2004, 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:
PeCoffLoaderEx.c
Abstract:
IA-32 Specific relocation fixups
Revision History
--*/
#include "TianoCommon.h"
EFI_STATUS
PeCoffLoaderRelocateImageEx (
IN UINT16 *Reloc,
IN OUT CHAR8 *Fixup,
IN OUT CHAR8 **FixupData,
IN UINT64 Adjust
)
/*++
Routine Description:
Performs an IA-32 specific relocation fixup
Arguments:
Reloc - Pointer to the relocation record
Fixup - Pointer to the address to fix up
FixupData - Pointer to a buffer to log the fixups
Adjust - The offset to adjust the fixup
Returns:
EFI_UNSUPPORTED - Unsupported now
--*/
{
return EFI_UNSUPPORTED;
}

View File

@ -1,65 +0,0 @@
/*++
Copyright (c) 2004, 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:
PeCoffLoaderEx.h
Abstract:
IA-32 Specific relocation fixups
Revision History
--*/
#ifndef _PE_COFF_LOADER_EX_H_
#define _PE_COFF_LOADER_EX_H_
//
// Define macro to determine if the machine type is supported.
// Returns 0 if the machine is not supported, Not 0 otherwise.
//
#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
((Machine) == EFI_IMAGE_MACHINE_IA32 || \
(Machine) == EFI_IMAGE_MACHINE_EBC)
EFI_STATUS
PeCoffLoaderRelocateImageEx (
IN UINT16 *Reloc,
IN OUT CHAR8 *Fixup,
IN OUT CHAR8 **FixupData,
IN UINT64 Adjust
)
/*++
Routine Description:
Performs an IA-32 specific relocation fixup
Arguments:
Reloc - Pointer to the relocation record
Fixup - Pointer to the address to fix up
FixupData - Pointer to a buffer to log the fixups
Adjust - The offset to adjust the fixup
Returns:
EFI_UNSUPPORTED - Unsupported now
--*/
;
#endif

View File

@ -1,47 +0,0 @@
/*++
Copyright (c) 2004, 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:
PerformancePrimitives.c
Abstract:
Support for Performance library
--*/
#include "TianoCommon.h"
#include "CpuIA32.h"
EFI_STATUS
GetTimerValue (
OUT UINT64 *TimerValue
)
/*++
Routine Description:
Get timer value.
Arguments:
TimerValue - Pointer to the returned timer value
Returns:
EFI_SUCCESS - Successfully got timer value
--*/
{
*TimerValue = EfiReadTsc ();
return EFI_SUCCESS;
}

View File

@ -1,140 +0,0 @@
/*++
Copyright (c) 2004 - 2005, 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:
Processor.c
Abstract:
--*/
#include "Tiano.h"
#include "EfiJump.h"
#include EFI_GUID_DEFINITION (PeiFlushInstructionCache)
#include EFI_GUID_DEFINITION (PeiTransferControl)
//
// Prototypes
//
EFI_STATUS
EFIAPI
TransferControlSetJump (
IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
IN EFI_JUMP_BUFFER *Jump
);
EFI_STATUS
EFIAPI
TransferControlLongJump (
IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
IN EFI_JUMP_BUFFER *Jump
);
EFI_STATUS
EFIAPI
FlushInstructionCacheFlush (
IN EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL *This,
IN EFI_PHYSICAL_ADDRESS Start,
IN UINT64 Length
);
//
// Table declarations
//
EFI_PEI_TRANSFER_CONTROL_PROTOCOL mTransferControl = {
TransferControlSetJump,
TransferControlLongJump,
sizeof (EFI_JUMP_BUFFER)
};
EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL mFlushInstructionCache = {
FlushInstructionCacheFlush
};
EFI_STATUS
InstallEfiPeiTransferControl (
IN OUT EFI_PEI_TRANSFER_CONTROL_PROTOCOL **This
)
/*++
Routine Description:
Installs the pointer to the transfer control mechanism
Arguments:
This - Pointer to transfer control mechanism.
Returns:
EFI_SUCCESS - Successfully installed.
--*/
{
*This = &mTransferControl;
return EFI_SUCCESS;
}
EFI_STATUS
InstallEfiPeiFlushInstructionCache (
IN OUT EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL **This
)
/*++
Routine Description:
Installs the pointer to the flush instruction cache mechanism
Arguments:
This - Pointer to flush instruction cache mechanism.
Returns:
EFI_SUCCESS - Successfully installed
--*/
{
*This = &mFlushInstructionCache;
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
FlushInstructionCacheFlush (
IN EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL *This,
IN EFI_PHYSICAL_ADDRESS Start,
IN UINT64 Length
)
/*++
Routine Description:
This routine would provide support for flushing the CPU instruction cache.
In the case of IA32, this flushing is not necessary and is thus not implemented.
Arguments:
This - Pointer to CPU Architectural Protocol interface
Start - Start adddress in memory to flush
Length - Length of memory to flush
Returns:
Status
EFI_SUCCESS
--*/
{
return EFI_SUCCESS;
}

View File

@ -1,223 +0,0 @@
;
; Copyright (c) 2004, 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:
;
; ProcessorAsms.Asm
;
; Abstract:
; This is separated from processor.c to allow this functions to be built with /O1
;
; Notes:
; - Masm uses "This", "ebx", etc as a directive.
; - H2INC is still not embedded in our build process so I translated the struc manually.
; - Unreferenced variables/arguments (This, NewBsp, NewStack) were causing compile errors and
; did not know of "pragma" mechanism in MASM and I did not want to reduce the warning level.
; Instead, I did a dummy referenced.
;
.686P
.MMX
.MODEL SMALL
.CODE
EFI_SUCCESS equ 0
EFI_WARN_RETURN_FROM_LONG_JUMP equ 5
;
; Generated by h2inc run manually
;
_EFI_JUMP_BUFFER STRUCT 2t
_ebx DWORD ?
_esi DWORD ?
_edi DWORD ?
_ebp DWORD ?
_esp DWORD ?
_eip DWORD ?
_EFI_JUMP_BUFFER ENDS
EFI_JUMP_BUFFER TYPEDEF _EFI_JUMP_BUFFER
TransferControlSetJump PROTO C \
_This:PTR EFI_PEI_TRANSFER_CONTROL_PROTOCOL, \
Jump:PTR EFI_JUMP_BUFFER
TransferControlLongJump PROTO C \
_This:PTR EFI_PEI_TRANSFER_CONTROL_PROTOCOL, \
Jump:PTR EFI_JUMP_BUFFER
SwitchStacks PROTO C \
EntryPoint:PTR DWORD, \
Parameter:DWORD, \
NewStack:PTR DWORD, \
NewBsp:PTR DWORD
SwitchIplStacks PROTO C \
EntryPoint:PTR DWORD, \
Parameter1:DWORD, \
Parameter2:DWORD, \
NewStack:PTR DWORD, \
NewBsp:PTR DWORD
;
;Routine Description:
;
; This routine implements the IA32 variant of the SetJump call. Its
; responsibility is to store system state information for a possible
; subsequent LongJump.
;
;Arguments:
;
; Pointer to CPU context save buffer.
;
;Returns:
;
; EFI_SUCCESS
;
TransferControlSetJump PROC C \
_This:PTR EFI_PEI_TRANSFER_CONTROL_PROTOCOL, \
Jump:PTR EFI_JUMP_BUFFER
mov eax, _This
mov ecx, Jump
mov (EFI_JUMP_BUFFER PTR [ecx])._ebx, ebx
mov (EFI_JUMP_BUFFER PTR [ecx])._esi, esi
mov (EFI_JUMP_BUFFER PTR [ecx])._edi, edi
mov eax, [ebp]
mov (EFI_JUMP_BUFFER PTR [ecx])._ebp, eax
lea eax, [ebp+4]
mov (EFI_JUMP_BUFFER PTR [ecx])._esp, eax
mov eax, [ebp+4]
mov (EFI_JUMP_BUFFER PTR [ecx])._eip, eax
mov eax, EFI_SUCCESS
ret
TransferControlSetJump ENDP
;
; Routine Description:
;
; This routine implements the IA32 variant of the LongJump call. Its
; responsibility is restore the system state to the Context Buffer and
; pass control back.
;
; Arguments:
;
; Pointer to CPU context save buffer.
;
; Returns:
;
; EFI_WARN_RETURN_FROM_LONG_JUMP
;
TransferControlLongJump PROC C \
_This:PTR EFI_PEI_TRANSFER_CONTROL_PROTOCOL, \
Jump:PTR EFI_JUMP_BUFFER
push ebx
push esi
push edi
mov eax, _This
; set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP
mov eax, EFI_WARN_RETURN_FROM_LONG_JUMP
mov ecx, Jump
mov ebx, (EFI_JUMP_BUFFER PTR [ecx])._ebx
mov esi, (EFI_JUMP_BUFFER PTR [ecx])._esi
mov edi, (EFI_JUMP_BUFFER PTR [ecx])._edi
mov ebp, (EFI_JUMP_BUFFER PTR [ecx])._ebp
mov esp, (EFI_JUMP_BUFFER PTR [ecx])._esp
add esp, 4 ;pop the eip
jmp DWORD PTR (EFI_JUMP_BUFFER PTR [ecx])._eip
mov eax, EFI_WARN_RETURN_FROM_LONG_JUMP
pop edi
pop esi
pop ebx
ret
TransferControlLongJump ENDP
;
; Routine Description:
; This allows the caller to switch the stack and goes to the new entry point
;
; Arguments:
; EntryPoint - Pointer to the location to enter
; Parameter - Parameter to pass in
; NewStack - New Location of the stack
; NewBsp - New BSP
;
; Returns:
;
; Nothing. Goes to the Entry Point passing in the new parameters
;
SwitchStacks PROC C \
EntryPoint:PTR DWORD, \
Parameter:DWORD, \
NewStack:PTR DWORD, \
NewBsp:PTR DWORD
push ebx
mov eax, NewBsp
mov ebx, Parameter
mov ecx, EntryPoint
mov eax, NewStack
mov esp, eax
push ebx
push 0
jmp ecx
pop ebx
ret
SwitchStacks ENDP
;
; Routine Description:
; This allows the caller to switch the stack and goes to the new entry point
;
; Arguments:
; EntryPoint - Pointer to the location to enter
; Parameter1/Parameter2 - Parameter to pass in
; NewStack - New Location of the stack
; NewBsp - New BSP
;
; Returns:
;
; Nothing. Goes to the Entry Point passing in the new parameters
;
SwitchIplStacks PROC C \
EntryPoint:PTR DWORD, \
Parameter1:DWORD, \
Parameter2:DWORD, \
NewStack:PTR DWORD, \
NewBsp:PTR DWORD
push ebx
mov eax, NewBsp
mov ebx, Parameter1
mov edx, Parameter2
mov ecx, EntryPoint
mov eax, NewStack
mov esp, eax
push edx
push ebx
call ecx
pop ebx
ret
SwitchIplStacks ENDP
END

View File

@ -1,34 +0,0 @@
/*++
Copyright (c) 2004, 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:
EfiJump.h
Abstract:
This is the Setjump/Longjump pair for an IA32 processor.
--*/
#ifndef _EFI_JUMP_H_
#define _EFI_JUMP_H_
typedef struct {
UINT32 ebx;
UINT32 esi;
UINT32 edi;
UINT32 ebp;
UINT32 esp;
UINT32 eip;
} EFI_JUMP_BUFFER;
#endif