Add in the 1st version of ECP.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2832 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12
2007-06-28 07:00:39 +00:00
parent 30d4a0c7ec
commit 3eb9473ea9
1433 changed files with 266617 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/*++
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:
ProcDep.h
Abstract:
EBC- specific runtime lib. Only used to get a clean build of
EFI libraries.
--*/
#ifndef _PROC_DEP_H_
#define _PROC_DEP_H_
#endif

View File

@@ -0,0 +1,294 @@
/*++
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:
EfiCombinationLib.h
Abstract:
Library functions that can be called in both PEI and DXE phase
--*/
#ifndef _EFI_COMBINATION_LIB_H_
#define _EFI_COMBINATION_LIB_H_
EFI_STATUS
EfiInitializeCommonDriverLib (
IN EFI_HANDLE ImageHandle,
IN VOID *SystemTable
)
/*++
Routine Description:
Initialize lib function calling phase: PEI or DXE
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
Returns:
EFI_STATUS always returns EFI_SUCCESS
--*/
;
EFI_STATUS
EfiCommonIoRead (
IN UINT8 Width,
IN UINTN Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Io read operation.
Arguments:
Width - Width of read operation
Address - Start IO address to read
Count - Read count
Buffer - Buffer to store result
Returns:
Status code
--*/
;
EFI_STATUS
EfiCommonIoWrite (
IN UINT8 Width,
IN UINTN Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Io write operation.
Arguments:
Width - Width of write operation
Address - Start IO address to write
Count - Write count
Buffer - Buffer to write to the address
Returns:
Status code
--*/
;
EFI_STATUS
EfiCommonPciRead (
IN UINT8 Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Pci read operation
Arguments:
Width - Width of PCI read
Address - PCI address to read
Count - Read count
Buffer - Output buffer for the read
Returns:
Status code
--*/
;
EFI_STATUS
EfiCommonPciWrite (
IN UINT8 Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
)
/*++
Routine Description:
Pci write operation
Arguments:
Width - Width of PCI write
Address - PCI address to write
Count - Write count
Buffer - Buffer to write to the address
Returns:
Status code
--*/
;
EFI_STATUS
EfiCommonStall (
IN UINTN Microseconds
)
/*++
Routine Description:
Induces a fine-grained stall.
Arguments:
Microseconds - The number of microseconds to stall execution.
Returns:
Status code
--*/
;
EFI_STATUS
EfiCommonCopyMem (
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:
Status code
--*/
;
EFI_STATUS
EfiCommonAllocatePages (
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
IN OUT EFI_PHYSICAL_ADDRESS *Memory
)
/*++
Routine Description:
Allocates memory pages from the system.
Arguments:
Type - The type of allocation to perform.
MemoryType - The type of memory to allocate.
Pages - The number of contiguous pages to allocate.
Memory - Pointer to a physical address.
Returns:
EFI_OUT_OF_RESOURCES - The pages could not be allocated.
EFI_INVALID_PARAMETER - Invalid parameter
EFI_NOT_FOUND - The requested pages could not be found.
EFI_SUCCESS - The requested pages were allocated.
--*/
;
EFI_STATUS
EfiCommonLocateInterface (
IN EFI_GUID *Guid,
OUT VOID **Interface
)
/*++
Routine Description:
Returns the first protocol instance that matches the given protocol.
Arguments:
Guid - Provides the protocol to search for.
Interface - On return, a pointer to the first interface that matches Protocol
Returns:
Status code
--*/
;
EFI_STATUS
EfiCommonReportStatusCode (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID * CallerId,
IN EFI_STATUS_CODE_DATA * Data OPTIONAL
)
/*++
Routine Description:
Status Code reporter
Arguments:
CodeType - Type of Status Code.
Value - Value to output for Status Code.
Instance - Instance Number of this status code.
CallerId - ID of the caller of this status code.
Data - Optional data associated with this status code.
Returns:
Status code
--*/
;
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,298 @@
/*++
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:
EfiHobLib.h
Abstract:
--*/
#ifndef _EFI_HOB_LIB_H_
#define _EFI_HOB_LIB_H_
#include "PeiHob.h"
VOID *
GetHob (
IN UINT16 Type,
IN VOID *HobStart
)
/*++
Routine Description:
This function returns the first instance of a HOB type in a HOB list.
Arguments:
Type The HOB type to return.
HobStart The first HOB in the HOB list.
Returns:
HobStart There were no HOBs found with the requested type.
else Returns the first HOB with the matching type.
--*/
;
UINTN
GetHobListSize (
IN VOID *HobStart
)
/*++
Routine Description:
Get size of hob list.
Arguments:
HobStart - Start pointer of hob list
Returns:
Size of hob list.
--*/
;
UINT32
GetHobVersion (
IN VOID *HobStart
)
/*++
Routine Description:
Get hob version.
Arguments:
HobStart - Start pointer of hob list
Returns:
Hob version.
--*/
;
EFI_STATUS
GetHobBootMode (
IN VOID *HobStart,
OUT EFI_BOOT_MODE *BootMode
)
/*++
Routine Description:
Get current boot mode.
Arguments:
HobStart - Start pointer of hob list
BootMode - Current boot mode recorded in PHIT hob
Returns:
EFI_NOT_FOUND - Invalid hob header
EFI_SUCCESS - Boot mode found
--*/
;
EFI_STATUS
GetCpuHobInfo (
IN VOID *HobStart,
OUT UINT8 *SizeOfMemorySpace,
OUT UINT8 *SizeOfIoSpace
)
/*++
Routine Description:
Get information recorded in CPU hob (Memory space size, Io space size)
Arguments:
HobStart - Start pointer of hob list
SizeOfMemorySpace - Size of memory size
SizeOfIoSpace - Size of IO size
Returns:
EFI_NOT_FOUND - CPU hob not found
EFI_SUCCESS - CPU hob found and information got.
--*/
;
EFI_STATUS
GetDxeCoreHobInfo (
IN VOID *HobStart,
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
OUT UINT64 *Length,
OUT VOID **EntryPoint,
OUT EFI_GUID **FileName
)
/*++
Routine Description:
Get memory allocation hob created for DXE core and extract its information
Arguments:
HobStart - Start pointer of the hob list
BaseAddress - Start address of memory allocated for DXE core
Length - Length of memory allocated for DXE core
EntryPoint - DXE core file name
FileName - FileName
Returns:
EFI_NOT_FOUND - DxeCoreHob not found
EFI_SUCCESS - DxeCoreHob found and information got
--*/
;
EFI_STATUS
GetNextFirmwareVolumeHob (
IN OUT VOID **HobStart,
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
OUT UINT64 *Length
)
/*++
Routine Description:
Get next firmware volume hob from HobStart
Arguments:
HobStart - Start pointer of hob list
BaseAddress - Start address of next firmware volume
Length - Length of next firmware volume
Returns:
EFI_NOT_FOUND - Next firmware volume not found
EFI_SUCCESS - Next firmware volume found with address information
--*/
;
#if (PI_SPECIFICATION_VERSION >= 0x00010000)
EFI_STATUS
GetNextFirmwareVolume2Hob (
IN OUT VOID **HobStart,
OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
OUT UINT64 *Length,
OUT EFI_GUID *FileName
)
;
#endif
EFI_STATUS
GetNextGuidHob (
IN OUT VOID **HobStart,
IN EFI_GUID * Guid,
OUT VOID **Buffer,
OUT UINTN *BufferSize OPTIONAL
)
/*++
Routine Description:
Get the next guid hob.
Arguments:
HobStart A pointer to the start hob.
Guid A pointer to a guid.
Buffer A pointer to the buffer.
BufferSize Buffer size.
Returns:
Status code.
EFI_NOT_FOUND - Next Guid hob not found
EFI_SUCCESS - Next Guid hob found and data for this Guid got
--*/
;
EFI_STATUS
GetPalEntryHobInfo (
IN VOID *HobStart,
OUT EFI_PHYSICAL_ADDRESS *PalEntry
)
/*++
Routine Description:
Get PAL entry from PalEntryHob
Arguments:
HobStart - Start pointer of hob list
PalEntry - Pointer to PAL entry
Returns:
Status code.
--*/
;
EFI_STATUS
GetIoPortSpaceAddressHobInfo (
IN VOID *HobStart,
OUT EFI_PHYSICAL_ADDRESS *IoPortSpaceAddress
)
/*++
Routine Description:
Get IO port space address from IoBaseHob.
Arguments:
HobStart - Start pointer of hob list
IoPortSpaceAddress - IO port space address
Returns:
Status code
--*/
;
#endif

View File

@@ -0,0 +1,429 @@
/*++
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:
EfiMgmtModeRuntimeLib.h
Abstract:
Light weight lib to support EFI drivers.
--*/
#ifndef _EFI_RT_SUPPORT_LIB_H_
#define _EFI_RT_SUPPORT_LIB_H_
#ifndef EFI_LOAD_IMAGE_SMM
#define EFI_LOAD_DRIVER_SMM FALSE
#else
#define EFI_LOAD_DRIVER_SMM TRUE
#endif
#ifndef EFI_NO_LOAD_IMAGE_RT
#define EFI_NO_LOAD_DRIVER_RT FALSE
#else
#define EFI_NO_LOAD_DRIVER_RT TRUE
#endif
#include "EfiCommonLib.h"
#include "LinkedList.h"
#include "ProcDep.h"
#include EFI_PROTOCOL_DEFINITION (CpuIo)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)
//
// Driver Lib Globals.
//
extern EFI_BOOT_SERVICES *gBS;
extern EFI_SYSTEM_TABLE *gST;
extern UINTN gRtErrorLevel;
extern BOOLEAN mEfiLoadDriverSmm;
extern BOOLEAN mEfiNoLoadDriverRt;
extern EFI_DEVICE_PATH_PROTOCOL *mFilePath;
//
// Runtime Memory Allocation/De-Allocation tools (Should be used in Boot Phase only)
//
EFI_STATUS
EfiAllocateRuntimeMemoryPool (
IN UINTN Size,
OUT VOID **Buffer
)
/*++
Routine Description:
Allocate EfiRuntimeServicesData pool of specified size.
Arguments:
Size - Pool size
Buffer - Memory pointer for output
Returns:
Status code
--*/
;
EFI_STATUS
EfiFreeRuntimeMemoryPool (
IN VOID *Buffer
)
/*++
Routine Description:
Free allocated pool
Arguments:
Buffer - Pool to be freed
Returns:
Status code
--*/
;
EFI_STATUS
EfiLocateProtocolHandleBuffers (
IN EFI_GUID *Protocol,
IN OUT UINTN *NumberHandles,
OUT EFI_HANDLE **Buffer
)
/*++
Routine Description:
Returns an array of handles that support the requested protocol in a buffer allocated from pool.
Arguments:
Protocol - Provides the protocol to search by.
NumberHandles - The number of handles returned in Buffer.
Buffer - A pointer to the buffer to return the requested array of handles that
support Protocol.
Returns:
Status code
--*/
;
EFI_STATUS
EfiHandleProtocol (
IN EFI_HANDLE Handle,
IN EFI_GUID *Protocol,
OUT VOID **Interface
)
/*++
Routine Description:
Queries a handle to determine if it supports a specified protocol.
Arguments:
Handle - The handle being queried.
Protocol - The published unique identifier of the protocol.
Interface - Supplies the address where a pointer to the corresponding Protocol
Interface is returned. NULL will be returned in *Interface if a
structure is not associated with Protocol.
Returns:
Status code
--*/
;
EFI_STATUS
EfiInstallProtocolInterface (
IN OUT EFI_HANDLE *Handle,
IN EFI_GUID *Protocol,
IN EFI_INTERFACE_TYPE InterfaceType,
IN VOID *Interface
)
/*++
Routine Description:
Installs a protocol interface on a device handle. If the handle does not exist, it is created and added
to the list of handles in the system.
Arguments:
Handle - A pointer to the EFI_HANDLE on which the interface is to be installed.
Protocol - The numeric ID of the protocol interface.
InterfaceType - Indicates whether Interface is supplied in native form.
Interface - A pointer to the protocol interface.
Returns:
Status code
--*/
;
EFI_STATUS
EfiReinstallProtocolInterface (
IN EFI_HANDLE SmmProtocolHandle,
IN EFI_GUID *Protocol,
IN VOID *OldInterface,
IN VOID *NewInterface
)
/*++
Routine Description:
Reinstalls a protocol interface on a device handle.
Arguments:
SmmProtocolHandle - Handle on which the interface is to be reinstalled.
Protocol - The numeric ID of the interface.
OldInterface - A pointer to the old interface.
NewInterface - A pointer to the new interface.
Returns:
Status code
--*/
;
EFI_STATUS
EfiLocateProtocolInterface (
EFI_GUID *Protocol,
VOID *Registration, OPTIONAL
VOID **Interface
)
/*++
Routine Description:
Returns the first protocol instance that matches the given protocol.
Arguments:
Protocol - Provides the protocol to search for.
Registration - Optional registration key returned from
RegisterProtocolNotify(). If Registration is NULL, then
it is ignored.
Interface - On return, a pointer to the first interface that matches Protocol and
Registration.
Returns:
Status code
--*/
;
EFI_STATUS
UninstallProtocolInterface (
IN EFI_HANDLE SmmProtocolHandle,
IN EFI_GUID *Protocol,
IN VOID *Interface
)
/*++
Routine Description:
Removes a protocol interface from a device handle.
Arguments:
SmmProtocolHandle - The handle on which the interface was installed.
Protocol - The numeric ID of the interface.
Interface - A pointer to the interface.
Returns:
Status code
--*/
;
EFI_STATUS
EfiRegisterProtocolCallback (
IN EFI_EVENT_NOTIFY CallbackFunction,
IN VOID *Context,
IN EFI_GUID *ProtocolGuid,
IN EFI_TPL NotifyTpl,
OUT VOID **Registeration,
OUT EFI_EVENT *Event
)
/*++
Routine Description:
Register a callback function to be signaled whenever an interface is installed for
a specified protocol.
Arguments:
CallbackFunction - Call back function
Context - Context of call back function
ProtocolGuid - The numeric ID of the protocol for which the callback function
is to be registered.
NotifyTpl - Notify tpl of callback function
Registeration - A pointer to a memory location to receive the registration value.
Event - Event that is to be signaled whenever a protocol interface is registered
for Protocol.
Returns:
Status code
--*/
;
EFI_STATUS
EfiSignalProtocolEvent (
EFI_EVENT Event
)
/*++
Routine Description:
Signals an event.
Arguments:
Event - The event to signal.
Returns:
Status code
--*/
;
EFI_STATUS
EfiInstallVendorConfigurationTable (
IN EFI_GUID *Guid,
IN VOID *Table
)
/*++
Routine Description:
Adds, updates, or removes a configuration table entry from the EFI System Table.
Arguments:
Guid - A pointer to the GUID for the entry to add, update, or remove.
Table - A pointer to the configuration table for the entry to add, update, or
remove. May be NULL.
Returns:
Status code
--*/
;
EFI_STATUS
EfiGetVendorConfigurationTable (
IN EFI_GUID *Guid,
OUT VOID **Table
)
/*++
Routine Description:
Return the EFI 1.0 System Tabl entry with TableGuid
Arguments:
Guid - Name of entry to return in the system table
Table - Pointer in EFI system table associated with TableGuid
Returns:
EFI_SUCCESS - Table returned;
EFI_NOT_FOUND - TableGuid not in EFI system table
--*/
;
EFI_STATUS
EfiInitializeUtilsRuntimeDriverLib (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_EVENT_NOTIFY GoVirtualChildEvent
)
/*++
Routine Description:
Intialize runtime Driver Lib if it has not yet been initialized.
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
GoVirtualChildEvent - Caller can register a virtual notification event.
Returns:
EFI_STATUS always returns EFI_SUCCESS
--*/
;
BOOLEAN
EfiInManagementInterrupt (
VOID
)
/*++
Routine Description:
Indicate whether the caller is already in SMM or not.
Arguments:
None
Returns:
TRUE - In SMM
FALSE - Not in SMM
--*/
;
//
// This MACRO initializes the RUNTIME invironment and optionally loads Image to SMM or Non-SMM space
// based upon the presence of build flags EFI_LOAD_DRIVER_SMM and EFI_NO_LOAD_DRIVER_RT.
//
#define EFI_INITIALIZE_RUNTIME_DRIVER_LIB(ImageHandle, SystemTable, GoVirtualChildEvent, FilePath) \
mEfiLoadDriverSmm = EFI_LOAD_DRIVER_SMM; \
mEfiNoLoadDriverRt = EFI_NO_LOAD_DRIVER_RT; \
mFilePath = (EFI_DEVICE_PATH_PROTOCOL*) FilePath; \
EfiInitializeUtilsRuntimeDriverLib ((EFI_HANDLE) ImageHandle, (EFI_SYSTEM_TABLE*) SystemTable, (EFI_EVENT_NOTIFY) GoVirtualChildEvent); \
if (!EfiInManagementInterrupt()) { \
if (mEfiNoLoadDriverRt) { \
return EFI_SUCCESS; \
} \
}
#endif

View File

@@ -0,0 +1,326 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
EfiPrintLib.h
Abstract:
Light weight lib to support EFI drivers.
--*/
#ifndef _EFI_PRINT_LIB_H_
#define _EFI_PRINT_LIB_H_
#include EFI_PROTOCOL_DEFINITION(GraphicsOutput)
#include EFI_PROTOCOL_DEFINITION(UgaDraw)
#include EFI_PROTOCOL_DEFINITION(Print)
UINTN
ErrorPrint (
IN CONST CHAR16 *ErrorString,
IN CONST CHAR8 *Format,
...
)
/*++
Routine Description:
Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
characters.
Arguments:
ErrorString - Error message printed first
Format - Ascii format string see file header for more details.
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
;
VOID
ErrorDumpHex (
IN UINTN Indent,
IN UINTN Offset,
IN UINTN DataSize,
IN VOID *UserData
)
/*++
Routine Description:
Dump error info by hex.
Arguments:
Indent - Indent number
Offset - Offset number
DataSize - Size of user data
UserData - User data to dump
Returns:
None
--*/
;
UINTN
Print (
IN CONST CHAR16 *Format,
...
)
/*++
Routine Description:
Prints a formatted unicode string to the default console
Arguments:
fmt - Format string
Returns:
Length of string printed to the console
--*/
;
UINTN
PrintXY (
IN UINTN X,
IN UINTN Y,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground, OPTIONAL
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background, OPTIONAL
IN CHAR16 *Fmt,
...
)
/*++
Routine Description:
Prints a formatted unicode string to the default console
Arguments:
X - X coordinate to start printing
Y - Y coordinate to start printing
ForeGround - Foreground color
BackGround - Background color
Fmt - Format string
... - Print arguments
Returns:
Length of string printed to the console
--*/
;
UINTN
Aprint (
IN CONST CHAR8 *Format,
...
)
/*++
Routine Description:
Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
characters.
Arguments:
Format - Ascii format string see file header for more details.
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
;
UINTN
UPrint (
IN CONST CHAR16 *Format,
...
)
/*++
Routine Description:
Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
characters.
Arguments:
Format - Ascii format string see file header for more details.
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
;
UINTN
VSPrint (
OUT CHAR16 *StartOfBuffer,
IN UINTN StrLen,
IN CONST CHAR16 *Format,
IN VA_LIST Marker
)
/*++
Routine Description:
Prints a formatted unicode string to a buffer
Arguments:
StartOfBuffer - Output buffer to print the formatted string into
StrLen - Size of Str. String is truncated to this size.
A size of 0 means there is no limit
Format - The format string
Marker - Vararg list consumed by processing Format.
Returns:
String length returned in buffer
--*/
;
UINTN
SPrint (
OUT CHAR16 *Buffer,
IN UINTN BufferSize,
IN CONST CHAR16 *Format,
...
)
/*++
Routine Description:
SPrint function to process format and place the results in Buffer.
Arguments:
Buffer - Wide char 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 - Format string see file header for more details.
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
;
//
// BoxDraw support
//
BOOLEAN
IsValidEfiCntlChar (
IN CHAR16 CharC
)
/*++
Routine Description:
Test whether a wide char is a valid control char.
Arguments:
CharC - A char
Returns:
TRUE - A control char
FALSE - Not a control char
--*/
;
BOOLEAN
IsValidAscii (
IN CHAR16 Ascii
)
/*++
Routine Description:
Test whether a wide char is a normal printable char
Arguments:
Ascii - A char
Returns:
True - A normal, printable char
FALSE - Not a normal, printable char
--*/
;
BOOLEAN
LibIsValidTextGraphics (
IN CHAR16 Graphic,
OUT CHAR8 *PcAnsi, OPTIONAL
OUT CHAR8 *Ascii OPTIONAL
)
/*++
Routine Description:
Detects if a Unicode char is for Box Drawing text graphics.
Arguments:
Graphic - Unicode char to test.
PcAnsi - Optional pointer to return PCANSI equivalent of Graphic.
Ascii - Optional pointer to return Ascii equivalent of Graphic.
Returns:
TRUE if Gpaphic is a supported Unicode Box Drawing character.
--*/
;
#endif

View File

@@ -0,0 +1,205 @@
/*++
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:
EfiRegTableLib.h
Abstract:
Definitions and macros for building register tables for chipset
initialization..
Components linking this lib must include CpuIo, PciRootBridgeIo, and
BootScriptSave protocols in their DPX.
Revision History:
--*/
#ifndef EFI_REG_TABLE_H
#define EFI_REG_TABLE_H
#include "Tiano.h"
#include "EfiScriptLib.h"
#include EFI_PROTOCOL_CONSUMER (CpuIo)
#include EFI_PROTOCOL_CONSUMER (PciRootBridgeIo)
//
// RegTable OpCodes are encoded as follows:
//
// |31----------------------------16|15---------8|7-------0|
// \ \ \
// \ \ \
// 31:16 defined by Base OpCode---+ \ \
// Opcode Flags---+ \
// Base OpCode---+
//
#define OPCODE_BASE(OpCode) ((UINT8)((OpCode) & 0xFF))
#define OPCODE_FLAGS(OpCode) ((UINT8)(((OpCode) >> 8) & 0xFF))
#define OPCODE_EXTRA_DATA(OpCode) ((UINT16)((OpCode) >> 16))
//
// RegTable Base OpCodes
//
#define OP_TERMINATE_TABLE 0
#define OP_MEM_WRITE 1
#define OP_MEM_READ_MODIFY_WRITE 2
#define OP_IO_WRITE 3
#define OP_IO_READ_MODIFY_WRITE 4
#define OP_PCI_WRITE 5
#define OP_PCI_READ_MODIFY_WRITE 6
#define OP_STALL 7
//
// RegTable OpCode Flags
//
#define OPCODE_FLAG_S3SAVE 1
#define TERMINATE_TABLE { (UINT32) OP_TERMINATE_TABLE, (UINT32) 0, (UINT32) 0 }
//
// REG_TABLE_ENTRY_PCI_WRITE encodes the width in the upper bits of the OpCode
// as one of the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH values
//
typedef struct {
UINT32 OpCode;
UINT32 PciAddress;
UINT32 Data;
} EFI_REG_TABLE_PCI_WRITE;
#define PCI_WRITE(Bus, Dev, Fnc, Reg, Width, Data, S3Flag) \
{ \
(UINT32) (OP_PCI_WRITE | ((S3Flag) << 8) | ((Width) << 16)), \
(UINT32) (EFI_PCI_ADDRESS ((Bus), (Dev), (Fnc), (Reg))), \
(UINT32) (Data), \
(UINT32) (0) \
}
typedef struct {
UINT32 OpCode;
UINT32 PciAddress;
UINT32 OrMask;
UINT32 AndMask;
} EFI_REG_TABLE_PCI_READ_MODIFY_WRITE;
#define PCI_READ_MODIFY_WRITE(Bus, Dev, Fnc, Reg, Width, OrMask, AndMask, S3Flag) \
{ \
(UINT32) (OP_PCI_READ_MODIFY_WRITE | ((S3Flag) << 8) | ((Width) << 16)), \
(UINT32) (EFI_PCI_ADDRESS ((Bus), (Dev), (Fnc), (Reg))), \
(UINT32) (OrMask), \
(UINT32) (AndMask) \
}
typedef struct {
UINT32 OpCode;
UINT32 MemAddress;
UINT32 OrMask;
UINT32 AndMask;
} EFI_REG_TABLE_MEM_READ_MODIFY_WRITE;
#define MEM_READ_MODIFY_WRITE(Address, Width, OrMask, AndMask, S3Flag) \
{ \
(UINT32) (OP_MEM_READ_MODIFY_WRITE | ((S3Flag) << 8) | ((Width) << 16)), \
(UINT32) (Address), \
(UINT32) (OrMask), \
(UINT32) (AndMask) \
}
typedef struct {
UINT32 OpCode;
UINT32 Field2;
UINT32 Field3;
UINT32 Field4;
} EFI_REG_TABLE_GENERIC;
typedef union {
EFI_REG_TABLE_GENERIC Generic;
EFI_REG_TABLE_PCI_WRITE PciWrite;
EFI_REG_TABLE_PCI_READ_MODIFY_WRITE PciReadModifyWrite;
EFI_REG_TABLE_MEM_READ_MODIFY_WRITE MemReadModifyWrite;
} EFI_REG_TABLE;
VOID
ProcessRegTablePci (
EFI_REG_TABLE * RegTableEntry,
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL * PciRootBridgeIo,
EFI_CPU_IO_PROTOCOL * CpuIo
)
/*++
Routine Description:
Processes register table assuming which may contain PCI, IO, MEM, and STALL
entries.
No parameter checking is done so the caller must be careful about omitting
values for PciRootBridgeIo or CpuIo parameters. If the regtable does
not contain any PCI accesses, it is safe to omit the PciRootBridgeIo (supply
NULL). If the regtable does not contain any IO or Mem entries, it is safe to
omit the CpuIo (supply NULL).
The RegTableEntry parameter is not checked, but is required.
gBS is assumed to have been defined and is used when processing stalls.
The function processes each entry sequentially until an OP_TERMINATE_TABLE
entry is encountered.
Arguments:
RegTableEntry - A pointer to the register table to process
PciRootBridgeIo - A pointer to the instance of PciRootBridgeIo that is used
when processing PCI table entries
CpuIo - A pointer to the instance of CpuIo that is used when processing IO and
MEM table entries
Returns:
Nothing.
--*/
;
VOID
ProcessRegTableCpu (
EFI_REG_TABLE * RegTableEntry,
EFI_CPU_IO_PROTOCOL * CpuIo
)
/*++
Routine Description:
Processes register table assuming which may contain IO, MEM, and STALL
entries, but must NOT contain any PCI entries. Any PCI entries cause an
ASSERT in a DEBUG build and are skipped in a free build.
No parameter checking is done. Both RegTableEntry and CpuIo parameters are
required.
gBS is assumed to have been defined and is used when processing stalls.
The function processes each entry sequentially until an OP_TERMINATE_TABLE
entry is encountered.
Arguments:
RegTableEntry - A pointer to the register table to process
CpuIo - A pointer to the instance of CpuIo that is used when processing IO and
MEM table entries
Returns:
Nothing.
--*/
;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,517 @@
/*++
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:
EfiScriptLib.h
Abstract:
--*/
#ifndef _EFI_SCRIPT_LIB_H_
#define _EFI_SCRIPT_LIB_H_
#include "Tiano.h"
#include "EfiCommonLib.h"
#include "EfiBootScript.h"
#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
EFI_STATUS
BootScriptSaveInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Intialize Boot Script Lib if it has not yet been initialized.
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
Returns:
EFI_STATUS always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSaveIoWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN VOID *Buffer
)
/*++
Routine Description:
Save I/O write to boot script with opcode EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
Arguments:
TableName - Desired boot script table
Width - The width of the I/O operations.
Address - The base address of the I/O operations.
Count - The number of I/O operations to perform.
Buffer - The source buffer from which to write data.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSaveIoReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
IN UINT64 Address,
IN VOID *Data,
IN VOID *DataMask
)
/*++
Routine Description:
Save I/O modify to boot script with opcode EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
Arguments:
TableName - Desired boot script table
Width - The width of the I/O operations.
Address - The base address of the I/O operations.
Data - A pointer to the data to be OR-ed.
DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSaveMemWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN VOID *Buffer
)
/*++
Routine Description:
Save memory write to boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
Arguments:
TableName - Desired boot script table
Width - The width of the memory operations.
Address - The base address of the memory operations.
Count - The number of memory operations to perform.
Buffer - The source buffer from which to write the data.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSaveMemReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
IN UINT64 Address,
IN VOID *Data,
IN VOID *DataMask
)
/*++
Routine Description:
Save memory modify to boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
Arguments:
TableName - Desired boot script table
Width - The width of the memory operations.
Address - The base address of the memory operations.
Data - A pointer to the data to be OR-ed.
DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSavePciCfgWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN VOID *Buffer
)
/*++
Routine Description:
Save PCI configuration space write operation to boot script with opcode
EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
Arguments:
TableName - Desired boot script table
Width - The width of the PCI operations
Address - The address within the PCI configuration space.
Count - The number of PCI operations to perform.
Buffer - The source buffer from which to write the data.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSavePciCfgReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
IN UINT64 Address,
IN VOID *Data,
IN VOID *DataMask
)
/*++
Routine Description:
Save PCI configuration space modify operation to boot script with opcode
EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
Arguments:
TableName - Desired boot script table
Width - The width of the PCI operations
Address - The address within the PCI configuration space.
Data - A pointer to the data to be OR-ed.
DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
;
EFI_STATUS
BootScriptSaveSmbusExecute (
IN UINT16 TableName,
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
IN EFI_SMBUS_DEVICE_COMMAND Command,
IN EFI_SMBUS_OPERATION Operation,
IN BOOLEAN PecCheck,
IN UINTN *Length,
IN VOID *Buffer
)
/*++
Routine Description:
Save SMBus command execution to boot script with opcode
EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
Arguments:
TableName - Desired boot script table
SlaveAddress - The SMBus address for the slave device that the operation is targeting.
Command - The command that is transmitted by the SMBus host controller to the
SMBus slave device.
Operation - Indicates which particular SMBus protocol it will use to execute the
SMBus transactions.
PecCheck - Defines if Packet Error Code (PEC) checking is required for this operation.
Length - A pointer to signify the number of bytes that this operation will do.
Buffer - Contains the value of data to execute to the SMBUS slave device.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSaveStall (
IN UINT16 TableName,
IN UINTN Duration
)
/*++
Routine Description:
Save execution stall on the processor to boot script with opcode
EFI_BOOT_SCRIPT_STALL_OPCODE
Arguments:
TableName - Desired boot script table
Duration - Duration in microseconds of the stall.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
BootScriptSaveDispatch (
IN UINT16 TableName,
IN EFI_PHYSICAL_ADDRESS EntryPoint
)
/*++
Routine Description:
Save dispatching specified arbitrary code to boot script with opcode
EFI_BOOT_SCRIPT_DISPATCH_OPCODE
Arguments:
TableName - Desired boot script table
EntryPoint - Entry point of the code to be dispatched.
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
EFIAPI
BootScriptSaveInformation (
IN UINT16 TableName,
IN UINT32 Length,
IN EFI_PHYSICAL_ADDRESS Buffer
)
/*++
Routine Description:
Save a Information Opcode record in table specified with TableName
Arguments:
TableName - Desired boot script table
Length - Length of information in bytes
Buffer - Content of information that will be saved in script table
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
EFIAPI
BootScriptSaveInformationUnicodeString (
IN UINT16 TableName,
IN CHAR16 *String
)
/*++
Routine Description:
Save a Information Opcode record in table specified with TableName, the information
is a unicode string.
Arguments:
TableName - Desired boot script table
String - The string that will be saved in script table
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
EFI_STATUS
EFIAPI
BootScriptSaveInformationAsciiString (
IN UINT16 TableName,
IN CHAR8 *String
)
/*++
Routine Description:
Save a Information Opcode record in table specified with TableName, the information
is a ascii string.
Arguments:
TableName - Desired boot script table
String - The string that will be saved in script table
Returns:
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
--*/
;
#ifdef EFI_S3_RESUME
#define INITIALIZE_SCRIPT(ImageHandle, SystemTable) \
BootScriptSaveInitialize(ImageHandle, SystemTable)
#define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer) \
BootScriptSaveIoWrite(TableName, Width, Address, Count, Buffer)
#define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask) \
BootScriptSaveIoReadWrite(TableName, Width, Address, Data, DataMask)
#define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer) \
BootScriptSaveMemWrite(TableName, Width, Address, Count, Buffer)
#define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count) \
BootScriptSaveMemWrite(TableName, Width, Address, Count, (VOID*)(UINTN)Address)
#define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask) \
BootScriptSaveMemReadWrite(TableName, Width, Address, Data, DataMask)
#define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer) \
BootScriptSavePciCfgWrite(TableName, Width, Address, Count, Buffer)
#define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask) \
BootScriptSavePciCfgReadWrite(TableName, Width, Address, Data, DataMask)
#define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer) \
BootScriptSaveSmbusExecute(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
#define SCRIPT_STALL(TableName, Duration) \
BootScriptSaveStall(TableName, Duration)
#define SCRIPT_DISPATCH(TableName, EntryPoint) \
BootScriptSaveDispatch(TableName, EntryPoint)
#define SCRIPT_INOFRMATION(TableName, Length, Buffer) \
BootScriptSaveInformation(TableName, Length, Buffer)
#define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String) \
BootScriptSaveInformationUnicodeString(TableName, String)
#define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String) \
BootScriptSaveInformationAsciiString(TableName, String)
#else
#define INITIALIZE_SCRIPT(ImageHandle, SystemTable)
#define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer)
#define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask)
#define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer)
#define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count)
#define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask)
#define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer)
#define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask)
#define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
#define SCRIPT_STALL(TableName, Duration)
#define SCRIPT_DISPATCH(TableName, EntryPoint)
#define SCRIPT_INOFRMATION(TableName, Length, Buffer)
#define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String)
#define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String)
#endif
#endif

View File

@@ -0,0 +1,220 @@
/*++
Copyright (c) 2004 - 2007, 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:
EfiSmmDriverLib.h
Abstract:
Light weight lib to support EFI Smm drivers.
--*/
#ifndef _EFI_SMM_DRIVER_LIB_H_
#define _EFI_SMM_DRIVER_LIB_H_
#include "Tiano.h"
#include "GetImage.h"
#include "EfiCommonLib.h"
#include EFI_GUID_DEFINITION (EventLegacyBios)
#include EFI_GUID_DEFINITION (EventGroup)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)
#include EFI_PROTOCOL_DEFINITION (SmmBase)
#include EFI_PROTOCOL_DEFINITION (SmmStatusCode)
//
// Driver Lib Globals.
//
extern EFI_BOOT_SERVICES *gBS;
extern EFI_SYSTEM_TABLE *gST;
extern EFI_RUNTIME_SERVICES *gRT;
extern EFI_SMM_BASE_PROTOCOL *gSMM;
extern EFI_SMM_STATUS_CODE_PROTOCOL *mSmmDebug;
extern UINTN gErrorLevel;
#define EfiCopyMem EfiCommonLibCopyMem
#define EfiSetMem EfiCommonLibSetMem
#define EfiZeroMem EfiCommonLibZeroMem
EFI_STATUS
EfiInitializeSmmDriverLib (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
IN OUT BOOLEAN *InSmm
)
/*++
Routine Description:
Intialize Smm Driver Lib if it has not yet been initialized.
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
InSmm - If InSmm is NULL, it will not register Image to SMM.
If InSmm is not NULL, it will register Image to SMM and
return information on currently in SMM mode or not.
Returns:
EFI_STATUS always returns EFI_SUCCESS
--*/
;
VOID
EfiDebugAssert (
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:
FileName - File name of failing routine.
LineNumber - Line number of failing ASSERT().
Description - Description, usually the assertion,
Returns:
None
--*/
;
VOID
EfiDebugVPrint (
IN UINTN ErrorLevel,
IN CHAR8 *Format,
IN VA_LIST Marker
)
/*++
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:
ErrorLevel - If error level is set do the debug print.
Format - String to use for the print, followed by Print arguments.
Marker - VarArgs
Returns:
None
--*/
;
VOID
EfiDebugPrint (
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:
ErrorLevel - If error level is set do the debug print.
Format - String to use for the print, followed by Print arguments.
... - VAR args for Format
Returns:
None
--*/
;
EFI_STATUS
EFIAPI
SmmEfiCreateEventLegacyBoot (
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN VOID *NotifyContext,
OUT EFI_EVENT *LegacyBootEvent
)
/*++
Routine Description:
Create a Legacy Boot Event.
Tiano extended the CreateEvent Type enum to add a legacy boot event type.
This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
added and now it's possible to not voilate the UEFI specification by
declaring a GUID for the legacy boot event class. This library supports
the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to
work both ways.
Arguments:
LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)
Returns:
EFI_SUCCESS Event was created.
Other Event was not created.
--*/
;
EFI_STATUS
EFIAPI
SmmEfiCreateEventReadyToBoot (
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN VOID *NotifyContext,
OUT EFI_EVENT *ReadyToBootEvent
)
/*++
Routine Description:
Create a Read to Boot Event.
Tiano extended the CreateEvent Type enum to add a ready to boot event type.
This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
added and now it's possible to not voilate the UEFI specification and use
the ready to boot event class defined in UEFI 2.0. This library supports
the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to
work both ways.
Arguments:
ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)
Return:
EFI_SUCCESS - Event was created.
Other - Event was not created.
--*/
;
#endif

View File

@@ -0,0 +1,205 @@
/*++
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:
EfiUiLib.h
Abstract:
Collection of usefull UI functions.
Revision History:
--*/
#ifndef _EFI_UI_LIB_H_
#define _EFI_UI_LIB_H_
#include "Tiano.h"
#include "TianoTypes.h"
#include "EfiDriverLib.h"
CHAR16 *
StrHzToString (
OUT CHAR16 *String,
IN UINT64 Val
)
/*++
Routine Description:
Converts frequency in Hz to Unicode string.
Three significant digits are delivered. Used for processor info display.
Arguments:
String - string that will contain the frequency.
Val - value to convert, minimum is 100000 i.e., 0.1 MHz.
Returns:
String that contains the frequency.
--*/
;
CHAR16 *
StrBytesToString (
OUT CHAR16 *String,
IN UINT64 Val
)
/*++
Routine Description:
Converts size in bytes to Unicode string.
Used for memory/cache size display.
Arguments:
String - string that will contain the value
Val - value to convert in bytes
Returns:
String that contains the value.
--*/
;
CHAR16 *
StrVersionToString (
OUT CHAR16 *String,
IN UINT8 Version
)
/*++
Routine Description:
Converts 8 bit version value to Unicode string.
The upper nibble contains the upper part, the lower nibble contains the minor part.
The output format is <major>.<minor>.
Arguments:
String - string that will contain the version value
Version - Version value to convert
Returns:
String that contains the version value.
--*/
;
CHAR16 *
StrMacToString (
OUT CHAR16 *String,
IN EFI_MAC_ADDRESS *MacAddr,
IN UINT32 AddrSize
)
/*++
Routine Description:
Converts MAC address to Unicode string.
The value is 64-bit and the resulting string will be 12
digit hex number in pairs of digits separated by dashes.
Arguments:
String - string that will contain the value
MacAddr - MAC address to convert
AddrSize - Size of address
Returns:
String that contains the value.
--*/
;
CHAR16 *
StrIp4AdrToString (
OUT CHAR16 *String,
IN EFI_IPv4_ADDRESS *Ip4Addr
)
/*++
Routine Description:
Converts IP v4 address to Unicode string.
The value is 64-bit and the resulting string will
be four decimal values 0-255 separated by dots.
Arguments:
String - string that will contain the value
Ip4Addr - IP v4 address to convert from
Returns:
String that contain the value
--*/
;
EFI_STATUS
StrStringToIp4Adr (
OUT EFI_IPv4_ADDRESS *Ip4Addr,
IN CHAR16 *String
)
/*++
Routine Description:
Parses and converts Unicode string to IP v4 address.
The value will 64-bit.
The string must be four decimal values 0-255 separated by dots.
The string is parsed and format verified.
Arguments:
Ip4Addr - pointer to the variable to store the value to
String - string that contains the value to parse and convert
Returns:
EFI_SUCCESS - if successful
EFI_INVALID_PARAMETER - if String contains invalid IP v4 format
--*/
;
CHAR16 *
Ascii2Unicode (
OUT CHAR16 *UnicodeStr,
IN CHAR8 *AsciiStr
)
/*++
Routine Description:
Converts ASCII characters to Unicode.
Arguments:
UnicodeStr - the Unicode string to be written to. The buffer must be large enough.
AsciiStr - The ASCII string to be converted.
Returns:
The address to the Unicode string - same as UnicodeStr.
--*/
;
CHAR8 *
Unicode2Ascii (
OUT CHAR8 *AsciiStr,
IN CHAR16 *UnicodeStr
)
/*++
Routine Description:
Converts ASCII characters to Unicode.
Assumes that the Unicode characters are only these defined in the ASCII set.
Arguments:
AsciiStr - The ASCII string to be written to. The buffer must be large enough.
UnicodeStr - the Unicode string to be converted.
Returns:
The address to the ASCII string - same as AsciiStr.
--*/
;
#endif

View File

@@ -0,0 +1,75 @@
/*++
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:
EfiWinNtLib.h
Abstract:
Set up gWinNt pointer so we can call WinNT APIs.
--*/
#ifndef _EFI_WIN_NT_LIB_H_
#define _EFI_WIN_NT_LIB_H_
extern EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;
EFI_STATUS
EfiInitializeWinNtDriverLib (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Intialize gWinNt and initialize debug console.
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
Returns:
Status code
--*/
;
//
// NTDebugConsole Prototypes
//
VOID
NtDebugConsoleInit (
VOID
)
/*++
Routine Description:
Nt debug console initialize.
Arguments:
None
Returns:
None
--*/
;
#endif

View File

@@ -0,0 +1,104 @@
/*++
Copyright (c) 2006 - 2007, 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:
GetImage.h
Abstract:
Image data retrieval support for common use.
--*/
#ifndef _GET_IMAGE_H_
#define _GET_IMAGE_H_
#include "EfiImageFormat.h"
EFI_STATUS
GetImage (
IN EFI_GUID *NameGuid,
IN EFI_SECTION_TYPE SectionType,
OUT VOID **Buffer,
OUT UINTN *Size
)
/*++
Routine Description:
Enumerate all the FVs, and fill Buffer with the SectionType section content in NameGuid file.
Note:
1. when SectionType is EFI_SECTION_PE32, it tries to read NameGuid file after failure on
reading EFI_SECTION_PE32 section.
2. when SectionType is EFI_SECTION_TE, it tries to get EFI_SECTION_PE32 section after failure on
reading EFI_SECTION_TE section. If it's failed again, it tries to read NameGuid file.
3. Callee allocates memory, which caller is responsible to free.
Arguments:
NameGuid - Pointer to EFI_GUID, which is file name.
SectionType - Required section type.
Buffer - Pointer to a pointer in which the read content is returned.
Caller is responsible to free Buffer.
Size - Pointer to a UINTN, which indicates the size of returned *Buffer.
Returns:
EFI_NOT_FOUND - Required content can not be found.
EFI_SUCCESS - Required content can be found, but whether the Buffer is filled
with section content or not depends on the Buffer and Size.
--*/
;
EFI_STATUS
GetImageEx (
IN EFI_HANDLE ImageHandle,
IN EFI_GUID *NameGuid,
IN EFI_SECTION_TYPE SectionType,
OUT VOID **Buffer,
OUT UINTN *Size,
BOOLEAN WithinImageFv
)
/*++
Routine Description:
Search FVs, and fill Buffer with the SectionType section content in NameGuid file.
If ImageHandle is not NULL, the FV from which the ImageHandle is loaded is searched
first. If WithinImageFv is TRUE, only the FV from which the ImageHandle is loaded
is searched. If ImageHandle is NULL or WithinImageFv is FALSE, all FVs in the system
is searched.
Note:
1. when SectionType is EFI_SECTION_PE32, it tries to read NameGuid file after failure on
reading EFI_SECTION_PE32 section.
2. when SectionType is EFI_SECTION_TE, it tries to get EFI_SECTION_PE32 section after failure on
reading EFI_SECTION_TE section. If it's failed again, it tries to read NameGuid file.
3. Callee allocates memory, which caller is responsible to free.
Arguments:
ImageHandle - The caller's driver image handle.
NameGuid - Pointer to EFI_GUID, which is file name.
SectionType - Required section type.
Buffer - Pointer to a pointer in which the read content is returned.
Caller is responsible to free Buffer.
Size - Pointer to a UINTN, which indicates the size of returned *Buffer.
WithinImageFv - Whether the search only performs on the FV from which the caller's
driver image is loaded.
Returns:
EFI_INVALID_PARAMETER - ImageHandle is NULL and WithinImageFv is TRUE.
EFI_NOT_FOUND - Required content can not be found.
EFI_SUCCESS - Required content can be found, but whether the Buffer is filled
with section content or not depends on the Buffer and Size.
--*/
;
#endif //_GET_IMAGE_H_

View File

@@ -0,0 +1,250 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
GraphicsLib.h
Abstract:
--*/
#ifndef _EFI_GRAPHICS_LIB_H_
#define _EFI_GRAPHICS_LIB_H_
#include EFI_PROTOCOL_DEFINITION (ConsoleControl)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)
#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)
#include EFI_PROTOCOL_DEFINITION (UgaDraw)
#include EFI_PROTOCOL_DEFINITION (EfiOEMBadging)
#include EFI_GUID_DEFINITION (Bmp)
EFI_STATUS
GetGraphicsBitMapFromFV (
IN EFI_GUID *FileNameGuid,
OUT VOID **Image,
OUT UINTN *ImageSize
)
/*++
Routine Description:
Return the graphics image file named FileNameGuid into Image and return it's
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
file name.
Arguments:
FileNameGuid - File Name of graphics file in the FV(s).
Image - Pointer to pointer to return graphics image. If NULL, a
buffer will be allocated.
ImageSize - Size of the graphics Image in bytes. Zero if no image found.
Returns:
EFI_SUCCESS - Image and ImageSize are valid.
EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
EFI_NOT_FOUND - FileNameGuid not found
--*/
;
EFI_STATUS
GetGraphicsBitMapFromFVEx (
IN EFI_HANDLE ImageHandle,
IN EFI_GUID *FileNameGuid,
OUT VOID **Image,
OUT UINTN *ImageSize
)
/*++
Routine Description:
Return the graphics image file named FileNameGuid into Image and return it's
size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
file name.
Arguments:
ImageHandle - The driver image handle of the caller. The parameter is used to
optimize the loading of the image file so that the FV from which
the driver image is loaded will be tried first.
FileNameGuid - File Name of graphics file in the FV(s).
Image - Pointer to pointer to return graphics image. If NULL, a
buffer will be allocated.
ImageSize - Size of the graphics Image in bytes. Zero if no image found.
Returns:
EFI_SUCCESS - Image and ImageSize are valid.
EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
EFI_NOT_FOUND - FileNameGuid not found
--*/
;
EFI_STATUS
ConvertBmpToGopBlt (
IN VOID *BmpImage,
IN UINTN BmpImageSize,
IN OUT VOID **GopBlt,
IN OUT UINTN *GopBltSize,
OUT UINTN *PixelHeight,
OUT UINTN *PixelWidth
)
/*++
Routine Description:
Convert a *.BMP graphics image to a GOP/UGA blt buffer. If a NULL Blt buffer
is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
buffer is passed in it will be used if it is big enough.
Arguments:
BmpImage - Pointer to BMP file
BmpImageSize - Number of bytes in BmpImage
GopBlt - Buffer containing GOP version of BmpImage.
GopBltSize - Size of GopBlt in bytes.
PixelHeight - Height of GopBlt/BmpImage in pixels
PixelWidth - Width of GopBlt/BmpImage in pixels
Returns:
EFI_SUCCESS - GopBlt and GopBltSize are returned.
EFI_UNSUPPORTED - BmpImage is not a valid *.BMP image
EFI_BUFFER_TOO_SMALL - The passed in GopBlt buffer is not big enough.
GopBltSize will contain the required size.
EFI_OUT_OF_RESOURCES - No enough buffer to allocate
--*/
;
EFI_STATUS
EnableQuietBoot (
IN EFI_GUID *LogoFile
)
/*++
Routine Description:
Use Console Control to turn off UGA based Simple Text Out consoles from going
to the UGA device. Put up LogoFile on every UGA device that is a console
Arguments:
LogoFile - File name of logo to display on the center of the screen.
Returns:
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
displayed.
EFI_UNSUPPORTED - Logo not found
--*/
;
EFI_STATUS
EnableQuietBootEx (
IN EFI_GUID *LogoFile,
IN EFI_HANDLE ImageHandle
)
/*++
Routine Description:
Use Console Control to turn off UGA based Simple Text Out consoles from going
to the UGA device. Put up LogoFile on every UGA device that is a console
Arguments:
LogoFile - File name of logo to display on the center of the screen.
ImageHandle - The driver image handle of the caller. The parameter is used to
optimize the loading of the logo file so that the FV from which
the driver image is loaded will be tried first.
Returns:
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
displayed.
EFI_UNSUPPORTED - Logo not found
--*/
;
EFI_STATUS
DisableQuietBoot (
VOID
)
/*++
Routine Description:
Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
Simple Text Out screens will now be synced up with all non UGA output devices
Arguments:
NONE
Returns:
EFI_SUCCESS - UGA devices are back in text mode and synced up.
EFI_UNSUPPORTED - Logo not found
--*/
;
EFI_STATUS
LockKeyboards (
IN CHAR16 *Password
)
/*++
Routine Description:
Use Console Control Protocol to lock the Console In Spliter virtual handle.
This is the ConInHandle and ConIn handle in the EFI system table. All key
presses will be ignored until the Password is typed in. The only way to
disable the password is to type it in to a ConIn device.
Arguments:
Password - Password used to lock ConIn device
Returns:
EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
displayed.
EFI_UNSUPPORTED - Logo not found
--*/
;
#endif

View File

@@ -0,0 +1,260 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
CpuFuncs.h
Abstract:
--*/
#ifndef _CPU_FUNCS_H_
#define _CPU_FUNCS_H_
#define EFI_CPUID_SIGNATURE 0x0
#define EFI_CPUID_VERSION_INFO 0x1
#define EFI_CPUID_CACHE_INFO 0x2
#define EFI_CPUID_SERIAL_NUMBER 0x3
#define EFI_CPUID_EXTENDED_FUNCTION 0x80000000
#define EFI_CPUID_EXTENDED_CPU_SIG 0x80000001
#define EFI_CPUID_BRAND_STRING1 0x80000002
#define EFI_CPUID_BRAND_STRING2 0x80000003
#define EFI_CPUID_BRAND_STRING3 0x80000004
//
// CPUID version information masks
// Note: leaving masks here is for the compatibility
// use EfiCpuVersion (...) instead
//
#define EFI_CPUID_FAMILY 0x0F00
#define EFI_CPUID_MODEL 0x00F0
#define EFI_CPUID_STEPPING 0x000F
#define EFI_CPUID_PENTIUM_M 0x0600
#define EFI_CPUID_BANIAS 0x0090
#define EFI_CPUID_DOTHAN 0x00D0
#define EFI_CPUID_NETBURST 0x0F00
#define EFI_MSR_IA32_PLATFORM_ID 0x17
#define EFI_MSR_IA32_APIC_BASE 0x1B
#define EFI_MSR_EBC_HARD_POWERON 0x2A
#define EFI_MSR_EBC_SOFT_POWERON 0x2B
#define BINIT_DRIVER_DISABLE 0x40
#define INTERNAL_MCERR_DISABLE 0x20
#define INITIATOR_MCERR_DISABLE 0x10
#define EFI_MSR_EBC_FREQUENCY_ID 0x2C
#define EFI_MSR_IA32_BIOS_UPDT_TRIG 0x79
#define EFI_MSR_IA32_BIOS_SIGN_ID 0x8B
#define EFI_MSR_PSB_CLOCK_STATUS 0xCD
#define EFI_APIC_GLOBAL_ENABLE 0x800
#define EFI_MSR_IA32_MISC_ENABLE 0x1A0
#define LIMIT_CPUID_MAXVAL_ENABLE_BIT 0x00400000
#define AUTOMATIC_THERMAL_CONTROL_ENABLE_BIT 0x00000008
#define COMPATIBLE_FPU_OPCODE_ENABLE_BIT 0x00000004
#define LOGICAL_PROCESSOR_PRIORITY_ENABLE_BIT 0x00000002
#define FAST_STRING_ENABLE_BIT 0x00000001
#define EFI_CACHE_VARIABLE_MTRR_BASE 0x200
#define EFI_CACHE_VARIABLE_MTRR_END 0x20F
#define EFI_CACHE_IA32_MTRR_DEF_TYPE 0x2FF
#define EFI_CACHE_VALID_ADDRESS 0xFFFFFF000
#define EFI_CACHE_MTRR_VALID 0x800
#define EFI_CACHE_FIXED_MTRR_VALID 0x400
#define EFI_MSR_VALID_MASK 0xFFFFFFFFF
#define EFI_IA32_MTRR_FIX64K_00000 0x250
#define EFI_IA32_MTRR_FIX16K_80000 0x258
#define EFI_IA32_MTRR_FIX16K_A0000 0x259
#define EFI_IA32_MTRR_FIX4K_C0000 0x268
#define EFI_IA32_MTRR_FIX4K_C8000 0x269
#define EFI_IA32_MTRR_FIX4K_D0000 0x26A
#define EFI_IA32_MTRR_FIX4K_D8000 0x26B
#define EFI_IA32_MTRR_FIX4K_E0000 0x26C
#define EFI_IA32_MTRR_FIX4K_E8000 0x26D
#define EFI_IA32_MTRR_FIX4K_F0000 0x26E
#define EFI_IA32_MTRR_FIX4K_F8000 0x26F
#define EFI_IA32_MCG_CAP 0x179
#define EFI_IA32_MCG_CTL 0x17B
#define EFI_IA32_MC0_CTL 0x400
#define EFI_IA32_MC0_STATUS 0x401
#define EFI_CACHE_UNCACHEABLE 0
#define EFI_CACHE_WRITECOMBINING 1
#define EFI_CACHE_WRITETHROUGH 4
#define EFI_CACHE_WRITEPROTECTED 5
#define EFI_CACHE_WRITEBACK 6
//
// Combine f(FamilyId), m(Model), s(SteppingId) to a single 32 bit number
//
#define EfiMakeCpuVersion(f, m, s) \
(((UINT32) (f) << 16) | ((UINT32) (m) << 8) | ((UINT32) (s)))
typedef struct {
UINT32 HeaderVersion;
UINT32 UpdateRevision;
UINT32 Date;
UINT32 ProcessorId;
UINT32 Checksum;
UINT32 LoaderRevision;
UINT32 ProcessorFlags;
UINT32 DataSize;
UINT32 TotalSize;
UINT8 Reserved[12];
} EFI_CPU_MICROCODE_HEADER;
typedef struct {
UINT32 ExtSigCount;
UINT32 ExtChecksum;
UINT8 Reserved[12];
UINT32 ProcessorId;
UINT32 ProcessorFlags;
UINT32 Checksum;
} EFI_CPU_MICROCODE_EXT_HEADER;
typedef struct {
UINT32 RegEax;
UINT32 RegEbx;
UINT32 RegEcx;
UINT32 RegEdx;
} EFI_CPUID_REGISTER;
VOID
EfiWriteMsr (
IN UINT32 Input,
IN UINT64 Value
)
/*++
Routine Description:
Write Cpu MSR
Arguments:
Input -The index value to select the register
Value -The value to write to the selected register
Returns:
None
--*/
;
UINT64
EfiReadMsr (
IN UINT32 Input
)
/*++
Routine Description:
Read Cpu MSR.
Arguments:
Input: -The index value to select the register
Returns:
Return the read data
--*/
;
VOID
EfiCpuid (
IN UINT32 RegEax,
OUT EFI_CPUID_REGISTER *Reg
)
/*++
Routine Description:
Get the Cpu info by excute the CPUID instruction.
Arguments:
RegEax -The input value to put into register EAX
Reg -The Output value
Returns:
None
--*/
;
VOID
EfiCpuVersion (
IN UINT16 *FamilyId, OPTIONAL
IN UINT8 *Model, OPTIONAL
IN UINT8 *SteppingId, OPTIONAL
IN UINT8 *Processor OPTIONAL
)
/*++
Routine Description:
Extract CPU detail version infomation
Arguments:
FamilyId - FamilyId, including ExtendedFamilyId
Model - Model, including ExtendedModel
SteppingId - SteppingId
Processor - Processor
--*/
;
UINT64
EfiReadTsc (
VOID
)
/*++
Routine Description:
Read Time stamp.
Arguments:
None
Returns:
Return the read data
--*/
;
VOID
EfiCpuidExt (
IN UINT32 RegisterInEax,
IN UINT32 CacheLevel,
OUT EFI_CPUID_REGISTER *Regs
)
/*++
Routine Description:
When RegisterInEax != 4, the functionality is the same as EfiCpuid.
When RegisterInEax == 4, the function return the deterministic cache
parameters by excuting the CPUID instruction
Arguments:
RegisterInEax: - The input value to put into register EAX
CacheLevel: - The deterministic cache level
Regs: - The Output value
Returns:
None
--*/
;
#endif

View File

@@ -0,0 +1,26 @@
/*++
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:
ProcDep.h
Abstract:
IA-32 specific Runtime Lib code. At this time there is non.
IPF has different code due to extra API requirements.
--*/
#ifndef _PROC_DEP_H_
#define _PROC_DEP_H_
#endif

View File

@@ -0,0 +1,111 @@
/*++
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:
Ia32EfiRuntimeDriverLib.h
Abstract:
Light weight lib to support IA32 EFI Libraries.
--*/
#ifndef _IA32_EFI_RUNTIME_LIB_H_
#define _IA32_EFI_RUNTIME_LIB_H_
#include "Tiano.h"
#include "EfiRuntimeLib.h"
#include EFI_PROTOCOL_DEFINITION (ExtendedSalGuid)
typedef
EFI_STATUS
(EFIAPI *COMMON_PROC_ENTRY) (
IN UINTN FunctionId,
IN UINTN Arg2,
IN UINTN Arg3,
IN UINTN Arg4,
IN UINTN Arg5,
IN UINTN Arg6,
IN UINTN Arg7,
IN UINTN Arg8
);
typedef struct {
COMMON_PROC_ENTRY CommonProcEntry;
} COMMON_PROC_ENTRY_STRUCT;
EFI_STATUS
InstallPlatformRuntimeLib (
IN EFI_GUID *Guid,
IN COMMON_PROC_ENTRY_STRUCT *CommonEntry
)
/*++
Routine Description:
Install platform runtime lib.
Arguments:
Guid - Guid for runtime lib
CommonEntry - Common entry
Returns:
Status code
--*/
;
EFI_STATUS
GetPlatformRuntimeLib (
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Get platform runtime lib.
Arguments:
SystemTable - Pointer to system table
Returns:
Status code
--*/
;
EFI_STATUS
ConvertPlatformRuntimeLibPtr (
IN EFI_RUNTIME_SERVICES *mRT
)
/*++
Routine Description:
Convert platform runtime lib pointer.
Arguments:
mRT - Pointer to runtime service table.
Returns:
Status code
--*/
;
#endif

View File

@@ -0,0 +1,93 @@
/*++
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:
CpuFuncs.h
Abstract:
--*/
#ifndef _CPU_FUNCS_H
#define _CPU_FUNCS_H
#define EFI_CPUID_SIGNATURE 0x0
#define EFI_CPUID_VERSION_INFO 0x1
#define EFI_CPUID_CACHE_INFO 0x2
#define EFI_CPUID_SERIAL_NUMBER 0x3
#define EFI_CPUID_EXTENDED_FUNCTION 0x80000000
#define EFI_CPUID_EXTENDED_CPU_SIG 0x80000001
#define EFI_CPUID_BRAND_STRING1 0x80000002
#define EFI_CPUID_BRAND_STRING2 0x80000003
#define EFI_CPUID_BRAND_STRING3 0x80000004
#define EFI_MSR_IA32_APIC_BASE 0x1B
#define EFI_MSR_EBC_HARD_POWERON 0x2A
#define EFI_MSR_EBC_SOFT_POWERON 0x2B
#define EFI_MSR_EBC_FREQUENCY_ID 0x2C
#define EFI_MSR_IA32_BIOS_UPDT_TRIG 0x79
#define EFI_MSR_IA32_BIOS_SIGN_ID 0x8B
#define EFI_APIC_GLOBAL_ENABLE 0x800
#define EFI_CACHE_VARIABLE_MTRR_BASE 0x200
#define EFI_CACHE_VARIABLE_MTRR_END 0x20F
#define EFI_CACHE_IA32_MTRR_DEF_TYPE 0x2FF
#define EFI_CACHE_VALID_ADDRESS 0xFFFFFF000
#define EFI_CACHE_MTRR_VALID 0x800
#define EFI_CACHE_FIXED_MTRR_VALID 0x400
#define EFI_MSR_VALID_MASK 0xFFFFFFFFF
#define EFI_IA32_MTRR_FIX64K_00000 0x250
#define EFI_IA32_MTRR_FIX16K_80000 0x258
#define EFI_IA32_MTRR_FIX16K_A0000 0x259
#define EFI_IA32_MTRR_FIX4K_C0000 0x268
#define EFI_IA32_MTRR_FIX4K_C8000 0x269
#define EFI_IA32_MTRR_FIX4K_D0000 0x26A
#define EFI_IA32_MTRR_FIX4K_D8000 0x26B
#define EFI_IA32_MTRR_FIX4K_E0000 0x26C
#define EFI_IA32_MTRR_FIX4K_E8000 0x26D
#define EFI_IA32_MTRR_FIX4K_F0000 0x26E
#define EFI_IA32_MTRR_FIX4K_F8000 0x26F
#define EFI_IA32_MCG_CAP 0x179
#define EFI_IA32_MCG_CTL 0x17B
#define EFI_IA32_MC0_CTL 0x400
#define EFI_IA32_MC0_STATUS 0x401
#define EFI_CACHE_UNCACHEABLE 0
#define EFI_CACHE_WRITECOMBINING 1
#define EFI_CACHE_WRITETHROUGH 4
#define EFI_CACHE_WRITEPROTECTED 5
#define EFI_CACHE_WRITEBACK 6
UINT64
EfiReadTsc (
VOID
)
/*++
Routine Description:
Read Time stamp.
Arguments:
None
Returns:
Return the read data
--*/
;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,119 @@
/*++
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:
ProcDep.h
Abstract:
IPF specific Runtime Lib code. IPF has a SAL API that does not
exit on IA-32. Thus
--*/
#ifndef _PROC_DEP_H_
#define _PROC_DEP_H_
#include EFI_PROTOCOL_DEFINITION (ExtendedSalGuid)
#include EFI_PROTOCOL_DEFINITION (ExtendedSalBootService)
#include "SalApi.h"
EFI_STATUS
RegisterEsalFunction (
IN UINT64 FunctionId,
IN EFI_GUID *ClassGuid,
IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,
IN VOID *ModuleGlobal
)
/*++
Routine Description:
Register ESAL Class Function and it's asociated global.
This function is boot service only!
Arguments:
FunctionId - ID of function to register
ClassGuid - GUID of function class
Function - Function to register under ClassGuid/FunctionId pair
ModuleGlobal - Module global for Function.
Returns:
EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
--*/
;
EFI_STATUS
RegisterEsalClass (
IN EFI_GUID *ClassGuid,
IN VOID *ModuleGlobal,
...
)
/*++
Routine Description:
Register ESAL Class and it's asociated global.
This function is boot service only!
Arguments:
ClassGuid - GUID of function class
ModuleGlobal - Module global for Function.
.. - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
indicates the end of the list.
Returns:
EFI_SUCCESS - All members of ClassGuid registered
--*/
;
SAL_RETURN_REGS
EfiCallEsalService (
IN EFI_GUID *ClassGuid,
IN UINT64 FunctionId,
IN UINT64 Arg2,
IN UINT64 Arg3,
IN UINT64 Arg4,
IN UINT64 Arg5,
IN UINT64 Arg6,
IN UINT64 Arg7,
IN UINT64 Arg8
)
/*++
Routine Description:
Call module that is not linked direclty to this module. This code is IP
relative and hides the binding issues of virtual or physical calling. The
function that gets dispatched has extra arguments that include the registered
module global and a boolean flag to indicate if the system is in virutal mode.
Arguments:
ClassGuid - GUID of function
FunctionId - Function in ClassGuid to call
Arg2 - Argument 2 ClassGuid/FunctionId defined
Arg3 - Argument 3 ClassGuid/FunctionId defined
Arg4 - Argument 4 ClassGuid/FunctionId defined
Arg5 - Argument 5 ClassGuid/FunctionId defined
Arg6 - Argument 6 ClassGuid/FunctionId defined
Arg7 - Argument 7 ClassGuid/FunctionId defined
Arg8 - Argument 8 ClassGuid/FunctionId defined
Returns:
Status of ClassGuid/FuncitonId
--*/
;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,310 @@
/*++
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:
LinkedList.h
Abstract:
This implementation of a linked list provides data structures for the
list itself and for list nodes. It provides operations for initializing
the list, modifying the list, and walking the list.
--*/
//
// Prevent multiple includes in the same source file
//
#ifndef _LINKED_LIST_H_
#define _LINKED_LIST_H_
typedef struct _EFI_LIST_ENTRY {
struct _EFI_LIST_ENTRY *ForwardLink;
struct _EFI_LIST_ENTRY *BackLink;
} EFI_LIST_ENTRY;
typedef EFI_LIST_ENTRY EFI_LIST;
typedef EFI_LIST_ENTRY EFI_LIST_NODE;
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&ListHead, &ListHead}
//
// EFI_FIELD_OFFSET - returns the byte offset to a field within a structure
//
#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
//
// A lock structure
//
typedef struct {
EFI_TPL Tpl;
EFI_TPL OwnerTpl;
UINTN Lock;
} FLOCK;
VOID
InitializeListHead (
EFI_LIST_ENTRY *List
)
/*++
Routine Description:
Initialize the head of the List. The caller must allocate the memory
for the EFI_LIST. This function must be called before the other linked
list macros can be used.
Arguments:
List - Pointer to list head to initialize
Returns:
None.
--*/
;
BOOLEAN
IsListEmpty (
EFI_LIST_ENTRY *List
)
/*++
Routine Description:
Return TRUE is the list contains zero nodes. Otherzise return FALSE.
The list must have been initialized with InitializeListHead () before using
this function.
Arguments:
List - Pointer to list head to test
Returns:
Return TRUE is the list contains zero nodes. Otherzise return FALSE.
--*/
;
VOID
RemoveEntryList (
EFI_LIST_ENTRY *Entry
)
/*++
Routine Description:
Remove Node from the doubly linked list. It is the caller's responsibility
to free any memory used by the entry if needed. The list must have been
initialized with InitializeListHead () before using this function.
Arguments:
Entry - Element to remove from the list.
Returns:
None
--*/
;
VOID
InsertTailList (
EFI_LIST_ENTRY *ListHead,
EFI_LIST_ENTRY *Entry
)
/*++
Routine Description:
Insert a Node into the end of a doubly linked list. The list must have
been initialized with InitializeListHead () before using this function.
Arguments:
ListHead - Head of doubly linked list
Entry - Element to insert at the end of the list.
Returns:
None
--*/
;
VOID
InsertHeadList (
EFI_LIST_ENTRY *ListHead,
EFI_LIST_ENTRY *Entry
)
/*++
Routine Description:
Insert a Node into the start of a doubly linked list. The list must have
been initialized with InitializeListHead () before using this function.
Arguments:
ListHead - Head of doubly linked list
Entry - Element to insert to beginning of list
Returns:
None
--*/
;
VOID
SwapListEntries (
EFI_LIST_ENTRY *Entry1,
EFI_LIST_ENTRY *Entry2
)
/*++
Routine Description:
Swap the location of the two elements of a doubly linked list. Node2
is placed in front of Node1. The list must have been initialized with
InitializeListHead () before using this function.
Arguments:
Entry1 - Element in the doubly linked list in front of Node2.
Entry2 - Element in the doubly linked list behind Node1.
Returns:
None
--*/
;
EFI_LIST_ENTRY *
GetFirstNode (
EFI_LIST_ENTRY *List
)
/*++
Routine Description:
Return the first node pointed to by the list head. The list must
have been initialized with InitializeListHead () before using this
function and must contain data.
Arguments:
List - The head of the doubly linked list.
Returns:
Pointer to the first node, if the list contains nodes. The list will
return a null value--that is, the value of List--when the list is empty.
See the description of IsNull for more information.
--*/
;
EFI_LIST_ENTRY *
GetNextNode (
EFI_LIST_ENTRY *List,
EFI_LIST_ENTRY *Node
)
/*++
Routine Description:
Returns the node following Node in the list. The list must
have been initialized with InitializeListHead () before using this
function and must contain data.
Arguments:
List - The head of the list. MUST NOT be the literal value NULL.
Node - The node in the list. This value MUST NOT be the literal value NULL.
See the description of IsNull for more information.
Returns:
Pointer to the next node, if one exists. Otherwise, returns a null value,
which is actually a pointer to List.
See the description of IsNull for more information.
--*/
;
BOOLEAN
IsNull (
EFI_LIST_ENTRY *List,
EFI_LIST_ENTRY *Node
)
/*++
Routine Description:
Determines whether the given node is null. Note that Node is null
when its value is equal to the value of List. It is an error for
Node to be the literal value NULL [(VOID*)0x0].
Arguments:
List - The head of the list. MUST NOT be the literal value NULL.
Node - The node to test. MUST NOT be the literal value NULL. See
the description above.
Returns:
Returns true if the node is null.
--*/
;
BOOLEAN
IsNodeAtEnd (
EFI_LIST_ENTRY *List,
EFI_LIST_ENTRY *Node
)
/*++
Routine Description:
Determines whether the given node is at the end of the list. Used
to walk the list. The list must have been initialized with
InitializeListHead () before using this function and must contain
data.
Arguments:
List - The head of the list. MUST NOT be the literal value NULL.
Node - The node to test. MUST NOT be the literal value NULL.
See the description of IsNull for more information.
Returns:
Returns true if the list is the tail.
--*/
;
#endif

View File

@@ -0,0 +1,231 @@
/*++
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
RtDevicePath.h
Abstract:
Device Path services. The thing to remember is device paths are built out of
nodes. The device path is terminated by an end node that is length
sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)
all over this file.
The only place where multi-instance device paths are supported is in
environment varibles. Multi-instance device paths should never be placed
on a Handle.
--*/
#ifndef _RT_DEVICE_PATH_H_
#define _RT_DEVICE_PATH_H_
BOOLEAN
RtEfiIsDevicePathMultiInstance (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
Routine Description:
Return TRUE is this is a multi instance device path.
Arguments:
DevicePath - A pointer to a device path data structure.
Returns:
TRUE - If DevicePath is multi instance.
FALSE - If DevicePath is not multi instance.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
RtEfiDevicePathInstance (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT UINTN *Size
)
/*++
Routine Description:
Function retrieves the next device path instance from a device path data structure.
Arguments:
DevicePath - A pointer to a device path data structure.
Size - A pointer to the size of a device path instance in bytes.
Returns:
This function returns a pointer to the current device path instance.
In addition, it returns the size in bytes of the current device path instance in Size,
and a pointer to the next device path instance in DevicePath.
If there are no more device path instances in DevicePath, then DevicePath will be set to NULL.
--*/
;
UINTN
RtEfiDevicePathSize (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
)
/*++
Routine Description:
Calculate the size of a whole device path.
Arguments:
DevPath - The pointer to the device path data.
Returns:
Size of device path data structure..
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
RtEfiAppendDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *Src1,
IN EFI_DEVICE_PATH_PROTOCOL *Src2
)
/*++
Routine Description:
Function is used to append a Src1 and Src2 together.
Arguments:
Src1 - A pointer to a device path data structure.
Src2 - A pointer to a device path data structure.
Returns:
A pointer to the new device path is returned.
NULL is returned if space for the new device path could not be allocated from pool.
It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
RtEfiDevicePathFromHandle (
IN EFI_HANDLE Handle
)
/*++
Routine Description:
Locate device path protocol interface on a device handle.
Arguments:
Handle - The device handle
Returns:
Device path protocol interface located.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
RtEfiDuplicateDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
)
/*++
Routine Description:
Duplicate a new device path data structure from the old one.
Arguments:
DevPath - A pointer to a device path data structure.
Returns:
A pointer to the new allocated device path data.
Caller must free the memory used by DevicePath if it is no longer needed.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
RtEfiAppendDevicePathNode (
IN EFI_DEVICE_PATH_PROTOCOL *Src1,
IN EFI_DEVICE_PATH_PROTOCOL *Src2
)
/*++
Routine Description:
Function is used to append a device path node to the end of another device path.
Arguments:
Src1 - A pointer to a device path data structure.
Src2 - A pointer to a device path data structure.
Returns:
This function returns a pointer to the new device path.
If there is not enough temporary pool memory available to complete this function,
then NULL is returned.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
RtEfiFileDevicePath (
IN EFI_HANDLE Device OPTIONAL,
IN CHAR16 *FileName
)
/*++
Routine Description:
Create a device path that appends a MEDIA_DEVICE_PATH with
FileNameGuid to the device path of DeviceHandle.
Arguments:
Device - Optional Device Handle to use as Root of the Device Path
FileName - FileName
Returns:
EFI_DEVICE_PATH_PROTOCOL that was allocated from dynamic memory
or NULL pointer.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
RtEfiAppendDevicePathInstance (
IN EFI_DEVICE_PATH_PROTOCOL *Src,
IN EFI_DEVICE_PATH_PROTOCOL *Instance
)
/*++
Routine Description:
Append a device path instance to another.
Arguments:
Src - The device path instance to be appended with.
Instance - The device path instance appending the other.
Returns:
The contaction of these two.
--*/
;
#endif

View File

@@ -0,0 +1,75 @@
/*++
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:
SmmRuntimeLib.h
Abstract:
SMM Related prototypes that can be referenced for Preboot Configuration only.
--*/
#ifndef _SMM_RUNTIME_LIB_H_
#define _SMM_RUNTIME_LIB_H_
#include "Tiano.h"
#include "EfiRuntimeLib.h"
BOOLEAN
EfiInSmm (
VOID
)
/*++
Routine Description:
Test whether in Smm mode currently.
Arguments:
None
Returns:
TRUE - In Smm mode
FALSE - Not in Smm mode
--*/
;
EFI_STATUS
RegisterSmmRuntimeDriver (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable,
OUT EFI_HANDLE *SmmImageHandle
)
/*++
Routine Description:
Registers a Driver with the SMM.
Arguments:
ImageHandle - The firmware allocated handle for the EFI image.
SystemTable - A pointer to the EFI System Table.
SmmImageHandle - Image handle returned by the SMM driver.
Returns:
Status code
--*/
;
#endif

View File

@@ -0,0 +1,262 @@
/*++
Copyright (c) 2005 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
CpuFuncs.h
Abstract:
--*/
#ifndef _CPU_FUNCS_H_
#define _CPU_FUNCS_H_
#define EFI_CPUID_SIGNATURE 0x0
#define EFI_CPUID_VERSION_INFO 0x1
#define EFI_CPUID_CACHE_INFO 0x2
#define EFI_CPUID_SERIAL_NUMBER 0x3
#define EFI_CPUID_EXTENDED_FUNCTION 0x80000000
#define EFI_CPUID_EXTENDED_CPU_SIG 0x80000001
#define EFI_CPUID_BRAND_STRING1 0x80000002
#define EFI_CPUID_BRAND_STRING2 0x80000003
#define EFI_CPUID_BRAND_STRING3 0x80000004
//
// CPUID version information masks
// Note: leaving masks here is for the compatibility
// use EfiCpuVersion (...) instead
//
#define EFI_CPUID_FAMILY 0x0F00
#define EFI_CPUID_MODEL 0x00F0
#define EFI_CPUID_STEPPING 0x000F
#define EFI_CPUID_PENTIUM_M 0x0600
#define EFI_CPUID_BANIAS 0x0090
#define EFI_CPUID_DOTHAN 0x00D0
#define EFI_CPUID_NETBURST 0x0F00
#define EFI_MSR_IA32_PLATFORM_ID 0x17
#define EFI_MSR_IA32_APIC_BASE 0x1B
#define EFI_MSR_EBC_HARD_POWERON 0x2A
#define EFI_MSR_EBC_SOFT_POWERON 0x2B
#define BINIT_DRIVER_DISABLE 0x40
#define INTERNAL_MCERR_DISABLE 0x20
#define INITIATOR_MCERR_DISABLE 0x10
#define EFI_MSR_EBC_FREQUENCY_ID 0x2C
#define EFI_MSR_IA32_BIOS_UPDT_TRIG 0x79
#define EFI_MSR_IA32_BIOS_SIGN_ID 0x8B
#define EFI_MSR_PSB_CLOCK_STATUS 0xCD
#define EFI_APIC_GLOBAL_ENABLE 0x800
#define EFI_MSR_IA32_MISC_ENABLE 0x1A0
#define LIMIT_CPUID_MAXVAL_ENABLE_BIT 0x00400000
#define AUTOMATIC_THERMAL_CONTROL_ENABLE_BIT 0x00000008
#define COMPATIBLE_FPU_OPCODE_ENABLE_BIT 0x00000004
#define LOGICAL_PROCESSOR_PRIORITY_ENABLE_BIT 0x00000002
#define FAST_STRING_ENABLE_BIT 0x00000001
#define EFI_CACHE_VARIABLE_MTRR_BASE 0x200
#define EFI_CACHE_VARIABLE_MTRR_END 0x20F
#define EFI_CACHE_IA32_MTRR_DEF_TYPE 0x2FF
#define EFI_CACHE_VALID_ADDRESS 0xFFFFFF000
#define EFI_CACHE_MTRR_VALID 0x800
#define EFI_CACHE_FIXED_MTRR_VALID 0x400
#define EFI_MSR_VALID_MASK 0xFFFFFFFFF
#define EFI_IA32_MTRR_FIX64K_00000 0x250
#define EFI_IA32_MTRR_FIX16K_80000 0x258
#define EFI_IA32_MTRR_FIX16K_A0000 0x259
#define EFI_IA32_MTRR_FIX4K_C0000 0x268
#define EFI_IA32_MTRR_FIX4K_C8000 0x269
#define EFI_IA32_MTRR_FIX4K_D0000 0x26A
#define EFI_IA32_MTRR_FIX4K_D8000 0x26B
#define EFI_IA32_MTRR_FIX4K_E0000 0x26C
#define EFI_IA32_MTRR_FIX4K_E8000 0x26D
#define EFI_IA32_MTRR_FIX4K_F0000 0x26E
#define EFI_IA32_MTRR_FIX4K_F8000 0x26F
#define EFI_IA32_MCG_CAP 0x179
#define EFI_IA32_MCG_CTL 0x17B
#define EFI_IA32_MC0_CTL 0x400
#define EFI_IA32_MC0_STATUS 0x401
#define EFI_CACHE_UNCACHEABLE 0
#define EFI_CACHE_WRITECOMBINING 1
#define EFI_CACHE_WRITETHROUGH 4
#define EFI_CACHE_WRITEPROTECTED 5
#define EFI_CACHE_WRITEBACK 6
//
// Combine f(FamilyId), m(Model), s(SteppingId) to a single 32 bit number
//
#define EfiMakeCpuVersion(f, m, s) \
(((UINT32) (f) << 16) | ((UINT32) (m) << 8) | ((UINT32) (s)))
typedef struct {
UINT32 HeaderVersion;
UINT32 UpdateRevision;
UINT32 Date;
UINT32 ProcessorId;
UINT32 Checksum;
UINT32 LoaderRevision;
UINT32 ProcessorFlags;
UINT32 DataSize;
UINT32 TotalSize;
UINT8 Reserved[12];
} EFI_CPU_MICROCODE_HEADER;
typedef struct {
UINT32 ExtSigCount;
UINT32 ExtChecksum;
UINT8 Reserved[12];
UINT32 ProcessorId;
UINT32 ProcessorFlags;
UINT32 Checksum;
} EFI_CPU_MICROCODE_EXT_HEADER;
typedef struct {
UINT32 RegEax;
UINT32 RegEbx;
UINT32 RegEcx;
UINT32 RegEdx;
} EFI_CPUID_REGISTER;
VOID
EfiWriteMsr (
IN UINT32 Input,
IN UINT64 Value
)
/*++
Routine Description:
Write Cpu MSR
Arguments:
Input -The index value to select the register
Value -The value to write to the selected register
Returns:
None
--*/
;
UINT64
EfiReadMsr (
IN UINT32 Input
)
/*++
Routine Description:
Read Cpu MSR.
Arguments:
Input: -The index value to select the register
Returns:
Return the read data
--*/
;
VOID
EfiCpuid (
IN UINT32 RegEax,
OUT EFI_CPUID_REGISTER *Reg
)
/*++
Routine Description:
Get the Cpu info by excute the CPUID instruction.
Arguments:
RegEax -The input value to put into register EAX
Reg -The Output value
Returns:
None
--*/
;
VOID
EfiCpuVersion (
IN UINT16 *FamilyId, OPTIONAL
IN UINT8 *Model, OPTIONAL
IN UINT8 *SteppingId, OPTIONAL
IN UINT8 *Processor OPTIONAL
)
/*++
Routine Description:
Extract CPU detail version infomation
Arguments:
FamilyId - FamilyId, including ExtendedFamilyId
Model - Model, including ExtendedModel
SteppingId - SteppingId
Processor - Processor
--*/
;
UINT64
EfiReadTsc (
VOID
)
/*++
Routine Description:
Read Time stamp.
Arguments:
None
Returns:
Return the read data
--*/
;
VOID
EfiCpuidExt (
IN UINT32 RegisterInEax,
IN UINT32 CacheLevel,
OUT EFI_CPUID_REGISTER *Regs
)
/*++
Routine Description:
When RegisterInEax != 4, the functionality is the same as EfiCpuid.
When RegisterInEax == 4, the function return the deterministic cache
parameters by excuting the CPUID instruction
Arguments:
RegisterInEax: - The input value to put into register EAX
CacheLevel: - The deterministic cache level
Regs: - The Output value
Returns:
None
--*/
;
#endif

View File

@@ -0,0 +1,29 @@
/*++
Copyright (c) 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:
ProcDep.h
Abstract:
x64 specific Runtime Lib code. At this time there is non.
IPF has different code due to extra API requirements.
--*/
#ifndef _PROC_DEP_H_
#define _PROC_DEP_H_
#endif