diff options
author | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
---|---|---|
committer | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
commit | b7c51c9cf4864df6aabb99a1ae843becd577237c (patch) | |
tree | eebe9b0d0ca03062955223097e57da84dd618b9a /EDK/Foundation/Core/Dxe/ArchProtocol | |
download | zprj-master.tar.xz |
Diffstat (limited to 'EDK/Foundation/Core/Dxe/ArchProtocol')
32 files changed, 2216 insertions, 0 deletions
diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.cif b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.cif new file mode 100644 index 0000000..de96301 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.cif @@ -0,0 +1,38 @@ +<component> + name = "ArchProtocolLib" + category = ModulePart + LocalRoot = "EDK\Foundation\Core\Dxe\ArchProtocol" + RefName = "ArchProtocolLib" +[files] +"ArchProtocolLib.sdl" +"ArchProtocolLib.mak" +"Bds\Bds.c" +"Bds\Bds.h" +"Capsule\Capsule.c" +"Capsule\Capsule.h" +"Cpu\Cpu.c" +"Cpu\Cpu.h" +"Metronome\Metronome.c" +"Metronome\Metronome.h" +"MonotonicCounter\MonotonicCounter.c" +"MonotonicCounter\MonotonicCounter.h" +"RealTimeClock\RealTimeClock.c" +"RealTimeClock\RealTimeClock.h" +"Reset\Reset.c" +"Reset\Reset.h" +"Runtime\Runtime.c" +"Runtime\Runtime.h" +"Security\Security.c" +"Security\Security.h" +"StatusCode\StatusCode.c" +"StatusCode\StatusCode.h" +"Timer\Timer.c" +"Timer\Timer.h" +"Variable\Variable.c" +"Variable\Variable.h" +"VariableWrite\VariableWrite.c" +"VariableWrite\VariableWrite.h" +"WatchdogTimer\WatchdogTimer.c" +"WatchdogTimer\WatchdogTimer.h" +"ArchProtocolLib.inf" +<endComponent> diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.inf b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.inf new file mode 100644 index 0000000..705c606 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.inf @@ -0,0 +1,65 @@ +#/*++ +# +# 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: +# +# ArchProtocolLib.inf +# +# Abstract: +# +# Component description file for the Architectural Protocol Library. +# +#--*/ + +[defines] +BASE_NAME = ArchProtocolLib +COMPONENT_TYPE = LIBRARY + +[sources.common] + Bds\Bds.c + Bds\Bds.h + Capsule\Capsule.c + Capsule\Capsule.h + Cpu\Cpu.c + Cpu\Cpu.h + Metronome\Metronome.c + Metronome\Metronome.h + MonotonicCounter\MonotonicCounter.c + MonotonicCounter\MonotonicCounter.h + RealTimeClock\RealTimeClock.c + RealTimeClock\RealTimeClock.h + Reset\Reset.c + Reset\Reset.h + Runtime\Runtime.c + Runtime\Runtime.h + Security\Security.c + Security\Security.h + StatusCode\StatusCode.c + StatusCode\StatusCode.h + Timer\Timer.c + Timer\Timer.h + Variable\Variable.c + Variable\Variable.h + VariableWrite\VariableWrite.c + VariableWrite\VariableWrite.h + WatchdogTimer\WatchdogTimer.c + WatchdogTimer\WatchdogTimer.h + +[includes.common] + $(EDK_SOURCE)\Foundation\Efi + $(EDK_SOURCE)\Foundation\Include + $(EDK_SOURCE)\Foundation\Efi\Include + $(EDK_SOURCE)\Foundation\Framework\Include + $(EDK_SOURCE)\Foundation\Include\IndustryStandard + $(EDK_SOURCE)\Foundation\Core\Dxe + $(EDK_SOURCE)\Foundation\Library\Dxe\Include + +[nmake.common] diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.mak b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.mak new file mode 100644 index 0000000..5a37110 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.mak @@ -0,0 +1,69 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2009, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelEDK/ArchProtocolLib/ArchProtocolLib.mak 1 1/20/12 4:12a Jeffch $ +# +# $Revision: 1 $ +# +# $Date: 1/20/12 4:12a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/IntelEDK/ArchProtocolLib/ArchProtocolLib.mak $ +# +# 1 1/20/12 4:12a Jeffch +# Create Intel EDK 1117 Patch 7. +# +# 1 9/27/11 6:34a Wesleychen +# Intel EDK initially releases. +# +# 2 9/02/09 3:06a Iminglin +# EIP24919 +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: ArchProtocolLib.mak +# +# Description: +# +#<AMI_FHDR_END> +#********************************************************************** +$(ARCHPROTOCOLLIB) : ArchProtocolLib + +$(BUILD_DIR)\ArchProtocolLib.lib : ArchProtocolLib + +ArchProtocolLib : $(BUILD_DIR)\ArchProtocolLib.mak ArchProtocolLibBin + +$(BUILD_DIR)\ArchProtocolLib.mak : $(ArchProtocolLib_DIR)\$(@B).cif $(ArchProtocolLib_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(ArchProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +ArchProtocolLibBin : + $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\ + /f $(BUILD_DIR)\ArchProtocolLib.mak all\ + TYPE=LIBRARY \ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2009, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#**********************************************************************
\ No newline at end of file diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.sdl b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.sdl new file mode 100644 index 0000000..f758364 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.sdl @@ -0,0 +1,26 @@ +TOKEN + Name = "ArchProtocolLib_SUPPORT" + Value = "1" + Help = "Main switch to enable ArchProtocolLib support in Project" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes +End + +TOKEN + Name = "ARCHPROTOCOLLIB" + Value = "$(BUILD_DIR)\ArchProtocolLib.lib" + TokenType = Expression + TargetMAK = Yes +End + +PATH + Name = "ArchProtocolLib_DIR" +End + +MODULE + Help = "Includes ArchProtocolLib.mak to Project" + File = "ArchProtocolLib.mak" +End + diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Bds/Bds.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Bds/Bds.c new file mode 100644 index 0000000..5bd71bf --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Bds/Bds.c @@ -0,0 +1,27 @@ +/*++ + +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: + + Bds.c + +Abstract: + + Boot Device Selection Architectural Protocol GUID as defined in Tiano + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Bds) + +EFI_GUID gEfiBdsArchProtocolGuid = EFI_BDS_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiBdsArchProtocolGuid, "BDS", "BDS Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Bds/Bds.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Bds/Bds.h new file mode 100644 index 0000000..a1282df --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Bds/Bds.h @@ -0,0 +1,100 @@ +/*++ + +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: + + Bds.h + +Abstract: + + Boot Device Selection Architectural Protocol as defined in Tiano + + When the DXE core is done it calls the BDS via this protocol. + +--*/ + +#ifndef _ARCH_PROTOCOL_BDS_H_ +#define _ARCH_PROTOCOL_BDS_H_ + +// +// Global ID for the BDS Architectural Protocol +// +#define EFI_BDS_ARCH_PROTOCOL_GUID \ + { 0x665E3FF6, 0x46CC, 0x11d4, 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } + +// +// Declare forward reference for the BDS Architectural Protocol +// +EFI_FORWARD_DECLARATION (EFI_BDS_ARCH_PROTOCOL); + +typedef +VOID +(EFIAPI *EFI_BDS_ENTRY) ( + IN EFI_BDS_ARCH_PROTOCOL * This + ); +/*++ + +Routine Description: + + This function uses policy data from the platform to determine what operating + system or system utility should be loaded and invoked. This function call + also optionally make the use of user input to determine the operating system + or system utility to be loaded and invoked. When the DXE Core has dispatched + all the drivers on the dispatch queue, this function is called. This + function will attempt to connect the boot devices required to load and invoke + the selected operating system or system utility. During this process, + additional firmware volumes may be discovered that may contain addition DXE + drivers that can be dispatched by the DXE Core. If a boot device cannot be + fully connected, this function calls the DXE Service Dispatch() to allow the + DXE drivers from any newly discovered firmware volumes to be dispatched. + Then the boot device connection can be attempted again. If the same boot + device connection operation fails twice in a row, then that boot device has + failed, and should be skipped. This function should never return. + +Arguments: + + This - The EFI_BDS_ARCH_PROTOCOL instance. + +Returns: + + None. + +--*/ + +// +// Interface stucture for the BDS Architectural Protocol +// +typedef struct _EFI_BDS_ARCH_PROTOCOL { + EFI_BDS_ENTRY Entry; +} EFI_BDS_ARCH_PROTOCOL; + +/*++ + + Protocol Description: + The EFI_BDS_ARCH_PROTOCOL transfers control from DXE to an operating + system or a system utility. If there are not enough drivers initialized + when this protocol is used to access the required boot device(s), then + this protocol should add drivers to the dispatch queue and return control + back to the dispatcher. Once the required boot devices are available, then + the boot device can be used to load and invoke an OS or a system utility. + + Parameters: + + Entry - The entry point to BDS. This call does not take any parameters, + and the return value can be ignored. If it returns, then the + dispatcher must be invoked again, if it never returns, then an + operating system or a system utility have been invoked. + +--*/ + +extern EFI_GUID gEfiBdsArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Capsule/Capsule.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Capsule/Capsule.c new file mode 100644 index 0000000..42673a2 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Capsule/Capsule.c @@ -0,0 +1,27 @@ +/*++ + +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: + + Capsule.c + +Abstract: + + Capsule Architectural Protocol is used to produce the UEFI 2.0 capsule runtime services + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Capsule) + +EFI_GUID gEfiCapsuleArchProtocolGuid = EFI_CAPSULE_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiCapsuleArchProtocolGuid, "Capsule", "Capsule Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Capsule/Capsule.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Capsule/Capsule.h new file mode 100644 index 0000000..2e11f83 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Capsule/Capsule.h @@ -0,0 +1,33 @@ +/*++ + +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: + + Capsule.h + +Abstract: + + Capsule Architectural Protocol is newly added to produce UEFI2.0 capsule runtime services. + +--*/ + +#ifndef _ARCH_PROTOCOL_CAPSULE_ARCH_H_ +#define _ARCH_PROTOCOL_CAPSULE_ARCH_H_ + +// +// Global ID for the Capsule Architectural Protocol +// +#define EFI_CAPSULE_ARCH_PROTOCOL_GUID \ + { 0x5053697e, 0x2cbc, 0x4819, 0x90, 0xd9, 0x5, 0x80, 0xde, 0xee, 0x57, 0x54 } + +extern EFI_GUID gEfiCapsuleArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Cpu/Cpu.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Cpu/Cpu.c new file mode 100644 index 0000000..40dbb06 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Cpu/Cpu.c @@ -0,0 +1,28 @@ +/*++ + +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: + + Cpu.c + +Abstract: + + CPU Architectural Protocol GUID as defined in Tiano + + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Cpu) + +EFI_GUID gEfiCpuArchProtocolGuid = EFI_CPU_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiCpuArchProtocolGuid, "CPU", "CPU Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Cpu/Cpu.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Cpu/Cpu.h new file mode 100644 index 0000000..fdc426b --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Cpu/Cpu.h @@ -0,0 +1,361 @@ +/*++ + +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: + + Cpu.h + +Abstract: + + CPU Architectural Protocol as defined in Tiano + + This code abstracts the DXE core from processor implementation details. + +--*/ + +#ifndef _ARCH_PROTOCOL_CPU_H_ +#define _ARCH_PROTOCOL_CPU_H_ + +#include EFI_PROTOCOL_DEFINITION (DebugSupport) + +#define EFI_CPU_ARCH_PROTOCOL_GUID \ + { 0x26baccb1, 0x6f42, 0x11d4, 0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } + +EFI_FORWARD_DECLARATION (EFI_CPU_ARCH_PROTOCOL); + +typedef enum { + EfiCpuFlushTypeWriteBackInvalidate, + EfiCpuFlushTypeWriteBack, + EfiCpuFlushTypeInvalidate, + EfiCpuMaxFlushType +} EFI_CPU_FLUSH_TYPE; + +typedef enum { + EfiCpuInit, + EfiCpuMaxInitType +} EFI_CPU_INIT_TYPE; + +typedef +VOID +(*EFI_CPU_INTERRUPT_HANDLER) ( + IN EFI_EXCEPTION_TYPE InterruptType, + IN EFI_SYSTEM_CONTEXT SystemContext + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_FLUSH_DATA_CACHE) ( + IN EFI_CPU_ARCH_PROTOCOL * This, + IN EFI_PHYSICAL_ADDRESS Start, + IN UINT64 Length, + IN EFI_CPU_FLUSH_TYPE FlushType + ); + +/*++ + +Routine Description: + + This function flushes the range of addresses from Start to Start+Length + from the processor's data cache. If Start is not aligned to a cache line + boundary, then the bytes before Start to the preceding cache line boundary + are also flushed. If Start+Length is not aligned to a cache line boundary, + then the bytes past Start+Length to the end of the next cache line boundary + are also flushed. The FlushType of EfiCpuFlushTypeWriteBackInvalidate must be + supported. If the data cache is fully coherent with all DMA operations, then + this function can just return EFI_SUCCESS. If the processor does not support + flushing a range of the data cache, then the entire data cache can be flushed. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + Start - The beginning physical address to flush from the processor's data + cache. + Length - The number of bytes to flush from the processor's data cache. This + function may flush more bytes than Length specifies depending upon + the granularity of the flush operation that the processor supports. + FlushType - Specifies the type of flush operation to perform. + +Returns: + + EFI_SUCCESS - The address range from Start to Start+Length was flushed from + the processor's data cache. + EFI_UNSUPPORTEDT - The processor does not support the cache flush type specified + by FlushType. + EFI_DEVICE_ERROR - The address range from Start to Start+Length could not be flushed + from the processor's data cache. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_ENABLE_INTERRUPT) ( + IN EFI_CPU_ARCH_PROTOCOL * This + ); + +/*++ + +Routine Description: + + This function enables interrupt processing by the processor. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + +Returns: + + EFI_SUCCESS - Interrupts are enabled on the processor. + EFI_DEVICE_ERROR - Interrupts could not be enabled on the processor. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_DISABLE_INTERRUPT) ( + IN EFI_CPU_ARCH_PROTOCOL * This + ); + +/*++ + +Routine Description: + + This function disables interrupt processing by the processor. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + +Returns: + + EFI_SUCCESS - Interrupts are disabled on the processor. + EFI_DEVICE_ERROR - Interrupts could not be disabled on the processor. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_GET_INTERRUPT_STATE) ( + IN EFI_CPU_ARCH_PROTOCOL * This, + OUT BOOLEAN *State + ); + +/*++ + +Routine Description: + + This function retrieves the processor's current interrupt state a returns it in + State. If interrupts are currently enabled, then TRUE is returned. If interrupts + are currently disabled, then FALSE is returned. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + State - A pointer to the processor's current interrupt state. Set to TRUE if + interrupts are enabled and FALSE if interrupts are disabled. +Returns: + + EFI_SUCCESS - The processor's current interrupt state was returned in State. + EFI_INVALID_PARAMETER - State is NULL. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_INIT) ( + IN EFI_CPU_ARCH_PROTOCOL * This, + IN EFI_CPU_INIT_TYPE InitType + ); + +/*++ + +Routine Description: + + This function generates an INIT on the processor. If this function succeeds, then the + processor will be reset, and control will not be returned to the caller. If InitType is + not supported by this processor, or the processor cannot programmatically generate an + INIT without help from external hardware, then EFI_UNSUPPORTED is returned. If an error + occurs attempting to generate an INIT, then EFI_DEVICE_ERROR is returned. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + InitType - The type of processor INIT to perform. + +Returns: + + EFI_SUCCESS - The processor INIT was performed. This return code should never be seen. + EFI_UNSUPPORTED - The processor INIT operation specified by InitType is not supported + by this processor. + EFI_DEVICE_ERROR - The processor INIT failed. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_REGISTER_INTERRUPT_HANDLER) ( + IN EFI_CPU_ARCH_PROTOCOL * This, + IN EFI_EXCEPTION_TYPE InterruptType, + IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler + ); + +/*++ + +Routine Description: + + This function registers and enables the handler specified by InterruptHandler for a processor + interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the + handler for the processor interrupt or exception type specified by InterruptType is uninstalled. + The installed handler is called once for each processor interrupt or exception. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + InterruptType - A pointer to the processor's current interrupt state. Set to TRUE if interrupts + are enabled and FALSE if interrupts are disabled. + InterruptHandler - A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called + when a processor interrupt occurs. If this parameter is NULL, then the handler + will be uninstalled. +Returns: + + EFI_SUCCESS - The handler for the processor interrupt was successfully installed or uninstalled. + EFI_ALREADY_STARTED - InterruptHandler is not NULL, and a handler for InterruptType was + previously installed. + EFI_INVALID_PARAMETER - InterruptHandler is NULL, and a handler for InterruptType was not + previously installed. + EFI_UNSUPPORTED - The interrupt specified by InterruptType is not supported. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_GET_TIMER_VALUE) ( + IN EFI_CPU_ARCH_PROTOCOL * This, + IN UINT32 TimerIndex, + OUT UINT64 *TimerValue, + OUT UINT64 *TimerPeriod OPTIONAL + ); + +/*++ + +Routine Description: + + This function reads the processor timer specified by TimerIndex and returns it in TimerValue. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + TimerIndex - Specifies which processor timer is to be returned in TimerValue. This parameter + must be between 0 and NumberOfTimers-1. + TimerValue - Pointer to the returned timer value. + TimerPeriod - A pointer to the amount of time that passes in femtoseconds for each increment + of TimerValue. +Returns: + + EFI_SUCCESS - The processor timer value specified by TimerIndex was returned in TimerValue. + EFI_DEVICE_ERROR - An error occurred attempting to read one of the processor's timers. + EFI_INVALID_PARAMETER - TimerValue is NULL or TimerIndex is not valid. + EFI_UNSUPPORTED - The processor does not have any readable timers. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_CPU_SET_MEMORY_ATTRIBUTES) ( + IN EFI_CPU_ARCH_PROTOCOL * This, + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT64 Attributes + ); + +/*++ + +Routine Description: + + This function modifies the attributes for the memory region specified by BaseAddress and + Length from their current attributes to the attributes specified by Attributes. + +Arguments: + + This - The EFI_CPU_ARCH_PROTOCOL instance. + BaseAddress - The physical address that is the start address of a memory region. + Length - The size in bytes of the memory region. + Attributes - The bit mask of attributes to set for the memory region. + +Returns: + + EFI_SUCCESS - The attributes were set for the memory region. + EFI_ACCESS_DENIED - The attributes for the memory resource range specified by + BaseAddress and Length cannot be modified. + EFI_INVALID_PARAMETER - Length is zero. + EFI_OUT_OF_RESOURCES - There are not enough system resources to modify the attributes of + the memory resource range. + EFI_UNSUPPORTED - The processor does not support one or more bytes of the memory + resource range specified by BaseAddress and Length. + The bit mask of attributes is not support for the memory resource + range specified by BaseAddress and Length. + +--*/ + +typedef struct _EFI_CPU_ARCH_PROTOCOL { + EFI_CPU_FLUSH_DATA_CACHE FlushDataCache; + EFI_CPU_ENABLE_INTERRUPT EnableInterrupt; + EFI_CPU_DISABLE_INTERRUPT DisableInterrupt; + EFI_CPU_GET_INTERRUPT_STATE GetInterruptState; + EFI_CPU_INIT Init; + EFI_CPU_REGISTER_INTERRUPT_HANDLER RegisterInterruptHandler; + EFI_CPU_GET_TIMER_VALUE GetTimerValue; + EFI_CPU_SET_MEMORY_ATTRIBUTES SetMemoryAttributes; + UINT32 NumberOfTimers; + UINT32 DmaBufferAlignment; +} EFI_CPU_ARCH_PROTOCOL; + +/*++ + +Protocol Description: + + The EFI_CPU_ARCH_PROTOCOL is used to abstract processor-specific functions from the DXE + Foundation. This includes flushing caches, enabling and disabling interrupts, hooking interrupt + vectors and exception vectors, reading internal processor timers, resetting the processor, and + determining the processor frequency. + +Parameters: + + FlushDataCache - Flushes a range of the processor's data cache. If the processor does + not contain a data cache, or the data cache is fully coherent, then this + function can just return EFI_SUCCESS. If the processor does not support + flushing a range of addresses from the data cache, then the entire data + cache must be flushed. + EnableInterrupt - Enables interrupt processing by the processor. + DisableInterrupt - Disables interrupt processing by the processor. + GetInterruptState - Retrieves the processor's current interrupt state. + Init - Generates an INIT on the processor. If a processor cannot programmatically + generate an INIT without help from external hardware, then this function + returns EFI_UNSUPPORTED. + RegisterInterruptHandler - Associates an interrupt service routine with one of the processor's interrupt + vectors. This function is typically used by the EFI_TIMER_ARCH_PROTOCOL to + hook the timer interrupt in a system. It can also be used by the debugger to + hook exception vectors. + GetTimerValue - Returns the value of one of the processor's internal timers. + SetMemoryAttributes - Attempts to set the attributes of a memory region. + NumberOfTimers - The number of timers that are available in a processor. The value in this + field is a constant that must not be modified after the CPU Architectural + Protocol is installed. All consumers must treat this as a read-only field. + DmaBufferAlignment - The size, in bytes, of the alignment required for DMA buffer allocations. + This is typically the size of the largest data cache line in the platform. + The value in this field is a constant that must not be modified after the + CPU Architectural Protocol is installed. All consumers must treat this as + a read-only field. + +--*/ + +extern EFI_GUID gEfiCpuArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Metronome/Metronome.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Metronome/Metronome.c new file mode 100644 index 0000000..a09a0d5 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Metronome/Metronome.c @@ -0,0 +1,27 @@ +/*++ + +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: + + Metronome.c + +Abstract: + + Metronome Architectural Protocol as defined in Tiano + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome) + +EFI_GUID gEfiMetronomeArchProtocolGuid = EFI_METRONOME_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiMetronomeArchProtocolGuid, "Metronome", "Metronome Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Metronome/Metronome.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Metronome/Metronome.h new file mode 100644 index 0000000..c254d9b --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Metronome/Metronome.h @@ -0,0 +1,109 @@ +/*++ + +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: + + Metronome.h + +Abstract: + + Metronome Architectural Protocol as defined in DXE CIS + + This code abstracts the DXE core to provide delay services. + +--*/ + +#ifndef _ARCH_PROTOCOL_METRONOME_H_ +#define _ARCH_PROTOCOL_METRONOME_H_ + +// +// Global ID for the Metronome Architectural Protocol +// +#define EFI_METRONOME_ARCH_PROTOCOL_GUID \ + { 0x26baccb2, 0x6f42, 0x11d4, 0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } + +// +// Declare forward reference for the Metronome Architectural Protocol +// +EFI_FORWARD_DECLARATION (EFI_METRONOME_ARCH_PROTOCOL); + +typedef +EFI_STATUS +(EFIAPI *EFI_METRONOME_WAIT_FOR_TICK) ( + IN EFI_METRONOME_ARCH_PROTOCOL *This, + IN UINT32 TickNumber + ); +/*++ + +Routine Description: + + The WaitForTick() function waits for the number of ticks specified by + TickNumber from a known time source in the platform. If TickNumber of + ticks are detected, then EFI_SUCCESS is returned. The actual time passed + between entry of this function and the first tick is between 0 and + TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod + time has elapsed, wait for two ticks. This function waits for a hardware + event to determine when a tick occurs. It is possible for interrupt + processing, or exception processing to interrupt the execution of the + WaitForTick() function. Depending on the hardware source for the ticks, it + is possible for a tick to be missed. This function cannot guarantee that + ticks will not be missed. If a timeout occurs waiting for the specified + number of ticks, then EFI_TIMEOUT is returned. + +Arguments: + + This - The EFI_METRONOME_ARCH_PROTOCOL instance. + + TickNumber - Number of ticks to wait. + +Returns: + + EFI_SUCCESS - The wait for the number of ticks specified by TickNumber + succeeded. + + EFI_TIMEOUT - A timeout occurred waiting for the specified number of ticks. + +--*/ + +// +// Interface stucture for the Metronome Architectural Protocol +// +typedef struct _EFI_METRONOME_ARCH_PROTOCOL { + EFI_METRONOME_WAIT_FOR_TICK WaitForTick; + UINT32 TickPeriod; +} EFI_METRONOME_ARCH_PROTOCOL; + +/*++ + + Protocol Description: + This protocol provides access to a known time source in the platform to the + core. The core uses this known time source to produce core services that + require calibrated delays. + + Parameters: + + WaitForTick - Waits for a specified number of ticks from a known time source + in the platform. The actual time passed between entry of this + function and the first tick is between 0 and TickPeriod 100 nS + units. If you want to guarantee that at least TickPeriod time + has elapsed, wait for two ticks. + + TickPeriod - The period of platform's known time source in 100 nS units. + This value on any platform must be at least 10 uS, and must not + exceed 200 uS. The value in this field is a constant that must + not be modified after the Metronome architectural protocol is + installed. All consumers must treat this as a read-only field. + +--*/ + +extern EFI_GUID gEfiMetronomeArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/MonotonicCounter/MonotonicCounter.c b/EDK/Foundation/Core/Dxe/ArchProtocol/MonotonicCounter/MonotonicCounter.c new file mode 100644 index 0000000..54d9ca4 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/MonotonicCounter/MonotonicCounter.c @@ -0,0 +1,27 @@ +/*++ + +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: + + MonotonicCounter.c + +Abstract: + + Monotonic Counter Architectural Protocol GUID as defined in the DXE CIS + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION(MonotonicCounter) + +EFI_GUID gEfiMonotonicCounterArchProtocolGuid = EFI_MONTONIC_COUNTER_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiMonotonicCounterArchProtocolGuid, "Monotonic Counter", "Monotonic Counter Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/MonotonicCounter/MonotonicCounter.h b/EDK/Foundation/Core/Dxe/ArchProtocol/MonotonicCounter/MonotonicCounter.h new file mode 100644 index 0000000..39e68aa --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/MonotonicCounter/MonotonicCounter.h @@ -0,0 +1,35 @@ +/*++ + +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: + + MonotonicCounter.h + +Abstract: + + Monotonic Counter Architectural Protocol as defined in DXE CIS + + This code provides the services required to access the systems monotonic counter + +--*/ + +#ifndef _ARCH_PROTOCOL_MONTONIC_COUNTER_H_ +#define _ARCH_PROTOCOL_MONTONIC_COUNTER_H_ + +// +// Global ID for the Monotonic Counter Architectural Protocol +// +#define EFI_MONTONIC_COUNTER_ARCH_PROTOCOL_GUID \ + {0x1da97072, 0xbddc, 0x4b30, 0x99, 0xf1, 0x72, 0xa0, 0xb5, 0x6f, 0xff, 0x2a} + +extern EFI_GUID gEfiMonotonicCounterArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/RealTimeClock/RealTimeClock.c b/EDK/Foundation/Core/Dxe/ArchProtocol/RealTimeClock/RealTimeClock.c new file mode 100644 index 0000000..1109957 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/RealTimeClock/RealTimeClock.c @@ -0,0 +1,27 @@ +/*++ + +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: + + RealTimeClock.c + +Abstract: + + Real Time clock Architectural Protocol GUID as defined in Tiano + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (RealTimeClock) + +EFI_GUID gEfiRealTimeClockArchProtocolGuid = EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiRealTimeClockArchProtocolGuid, "RTC", "Real Time Clock Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/RealTimeClock/RealTimeClock.h b/EDK/Foundation/Core/Dxe/ArchProtocol/RealTimeClock/RealTimeClock.h new file mode 100644 index 0000000..9b98c15 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/RealTimeClock/RealTimeClock.h @@ -0,0 +1,43 @@ +/*++ + +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: + + RealTimeClock.h + +Abstract: + + Real Time clock Architectural Protocol as defined in Tiano + + This code abstracts time and data functions. Used to provide + Time and date related EFI runtime services. + + The GetTime (), SetTime (), GetWakeupTime (), and SetWakeupTime () EFI 1.0 + services are added to the EFI system table and the + EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL_GUID protocol is registered with a NULL + pointer. + + No CRC of the EFI system table is required, as it is done in the DXE core. + +--*/ + +#ifndef _ARCH_PROTOCOL_REAL_TIME_CLOCK_H_ +#define _ARCH_PROTOCOL_REAL_TIME_CLOCK_H_ + +// +// Global ID for the Real Time Clock Architectural Protocol +// +#define EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL_GUID \ + { 0x27CFAC87, 0x46CC, 0x11d4, 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } + +extern EFI_GUID gEfiRealTimeClockArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Reset/Reset.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Reset/Reset.c new file mode 100644 index 0000000..13896f6 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Reset/Reset.c @@ -0,0 +1,27 @@ +/*++ + +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: + + Reset.c + +Abstract: + + Reset Architectural Protocol GUID as defined in Tiano + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Reset) + +EFI_GUID gEfiResetArchProtocolGuid = EFI_RESET_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiResetArchProtocolGuid, "Reset", "Reset Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Reset/Reset.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Reset/Reset.h new file mode 100644 index 0000000..d26b661 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Reset/Reset.h @@ -0,0 +1,40 @@ +/*++ + +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: + + Reset.h + +Abstract: + + Reset Architectural Protocol as defined in the DXE CIS + + Used to provide ResetSystem runtime services + + The ResetSystem () EFI 1.0 service is added to the EFI system table and the + EFI_RESET_ARCH_PROTOCOL_GUID protocol is registered with a NULL pointer. + + No CRC of the EFI system table is required, as it is done in the DXE core. + +--*/ + +#ifndef _ARCH_PROTOCOL_RESET_H_ +#define _ARCH_PROTOCOL_RESET_H_ + +// +// Global ID for the Reset Architectural Protocol +// +#define EFI_RESET_ARCH_PROTOCOL_GUID \ + { 0x27CFAC88, 0x46CC, 0x11d4, 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } + +extern EFI_GUID gEfiResetArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Runtime/Runtime.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Runtime/Runtime.c new file mode 100644 index 0000000..4f58708 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Runtime/Runtime.c @@ -0,0 +1,29 @@ +/*++ + +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: + + Runtime.c + +Abstract: + + Runtime Architectural Protocol as defined in Tiano + + This code is used to produce the EFI 1.0 runtime virtual switch over + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Runtime) + +EFI_GUID gEfiRuntimeArchProtocolGuid = EFI_RUNTIME_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiRuntimeArchProtocolGuid, "Runtime", "Runtime Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Runtime/Runtime.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Runtime/Runtime.h new file mode 100644 index 0000000..28f0b41 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Runtime/Runtime.h @@ -0,0 +1,114 @@ +/*++ + +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: + + Runtime.h + +Abstract: + + Runtime Architectural Protocol as defined in DXE CIS. + + + This code is used to produce the EFI runtime services that are callable + only in physical mode. + + This driver must add SetVirtualAddressMap () and ConvertPointer () to + the EFI system table. This driver is not responcible for CRCing the + EFI system table. + + This driver will add EFI_RUNTIME_ARCH_PROTOCOL_GUID protocol with a + pointer to the Runtime Arch Protocol instance structure. The protocol + member functions are used by the DXE core to export information needed + by this driver to produce the runtime transition of runtime drivers from + physical mode calling to virtual mode calling. + +--*/ + +#ifndef _ARCH_PROTOCOL_RUNTIME_H_ +#define _ARCH_PROTOCOL_RUNTIME_H_ + +#include "LinkedList.h" + +// +// Global ID for the Runtime Architectural Protocol +// +#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \ + { 0xb7dfb4e1, 0x52f, 0x449f, 0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 } + +EFI_FORWARD_DECLARATION (EFI_RUNTIME_ARCH_PROTOCOL); + +typedef struct _EFI_RUNTIME_IMAGE_ENTRY { + VOID *ImageBase; + UINT64 ImageSize; + VOID *RelocationData; + EFI_HANDLE Handle; + EFI_LIST_ENTRY Link; +} EFI_RUNTIME_IMAGE_ENTRY; + +typedef struct _EFI_RUNTIME_EVENT_ENTRY { + UINT32 Type; + EFI_TPL NotifyTpl; + EFI_EVENT_NOTIFY NotifyFunction; + VOID *NotifyContext; + EFI_EVENT *Event; + EFI_LIST_ENTRY Link; +} EFI_RUNTIME_EVENT_ENTRY; + +// +// Interface stucture for the Runtime Architectural Protocol +// +typedef struct _EFI_RUNTIME_ARCH_PROTOCOL { + EFI_LIST_ENTRY ImageHead; + EFI_LIST_ENTRY EventHead; + UINTN MemoryDescriptorSize; + UINT32 MemoryDesciptorVersion; + UINTN MemoryMapSize; + EFI_MEMORY_DESCRIPTOR *MemoryMapPhysical; + EFI_MEMORY_DESCRIPTOR *MemoryMapVirtual; + BOOLEAN VirtualMode; + BOOLEAN AtRuntime; +} EFI_RUNTIME_ARCH_PROTOCOL; +/*++ + +Protocol Description: + + Allows the runtime functionality of the DXE Foundation to be contained in a + separate driver. It also provides hooks for the DXE Foundation to export + information that is needed at runtime. As such, this protocol allows the DXE + Foundation to manage runtime drivers and events. This protocol also implies + that the runtime services required to transition to virtual mode, + SetVirtualAddressMap() and ConvertPointer(), have been registered into the + EFI Runtime Table in the EFI System Partition. This protocol must be produced + by a runtime DXE driver and may only be consumed by the DXE Foundation. + +Parameters: + + ImageHead - A list of type EFI_RUNTIME_IMAGE_ENTRY. + EventHead - A list of type EFI_RUNTIME_EVENT_ENTRY. + MemoryDescriptorSize - Size of a memory descriptor that is return by + GetMemoryMap(). + MemoryDescriptorVersion - Version of a memory descriptor that is return by + GetMemoryMap(). + MemoryMapSize - Size of the memory map in bytes contained in + MemoryMapPhysical and MemoryMapVirtual. + MemoryMapPhysical - Pointer to a runtime buffer that contains a copy of the + memory map returned via GetMemoryMap(). + MemoryMapVirtual - Pointer to MemoryMapPhysical that is updated to virtual mode + after SetVirtualAddressMap(). + VirtualMode - Boolean that is TRUE if SetVirtualAddressMap() has been called. + AtRuntime - Boolean that is TRUE if ExitBootServices () has been called. + +--*/ + +extern EFI_GUID gEfiRuntimeArchProtocolGuid; + +#endif
\ No newline at end of file diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Security/Security.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Security/Security.c new file mode 100644 index 0000000..0b84bd5 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Security/Security.c @@ -0,0 +1,28 @@ +/*++ + +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: + + Security.c + +Abstract: + + Security Architectural Protocol GUID as defined in DXE CIS + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION(Security) + +EFI_GUID gEfiSecurityArchProtocolGuid = EFI_SECURITY_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiSecurityArchProtocolGuid, "Security", "Security Arch Protocol"); + diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Security/Security.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Security/Security.h new file mode 100644 index 0000000..96ced0a --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Security/Security.h @@ -0,0 +1,146 @@ +/*++ + +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: + + Security.h + +Abstract: + + Security Architectural Protocol as defined in the DXE CIS + + Used to provide Security services. Specifically, dependening upon the + authentication state of a discovered driver in a Firmware Volume, the + portable DXE Core Dispatcher will call into the Security Architectural + Protocol (SAP) with the authentication state of the driver. + + This call-out allows for OEM-specific policy decisions to be made, such + as event logging for attested boots, locking flash in response to discovering + an unsigned driver or failed signature check, or other exception response. + + The SAP can also change system behavior by having the DXE core put a driver + in the Schedule-On-Request (SOR) state. This will allow for later disposition + of the driver by platform agent, such as Platform BDS. + +--*/ + +#ifndef _ARCH_PROTOCOL_SECURITY_H_ +#define _ARCH_PROTOCOL_SECURITY_H_ + +// +// Global ID for the Security Code Architectural Protocol +// +#define EFI_SECURITY_ARCH_PROTOCOL_GUID \ + { 0xA46423E3, 0x4617, 0x49f1, 0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } + +EFI_FORWARD_DECLARATION (EFI_SECURITY_ARCH_PROTOCOL); + +typedef +EFI_STATUS +(EFIAPI *EFI_SECURITY_FILE_AUTHENTICATION_STATE) ( + IN EFI_SECURITY_ARCH_PROTOCOL *This, + IN UINT32 AuthenticationStatus, + IN EFI_DEVICE_PATH_PROTOCOL *File + ) +/*++ + +Routine Description: + + The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific + policy from the DXE core response to an attempt to use a file that returns a + given status for the authentication check from the section extraction protocol. + + The possible responses in a given SAP implementation may include locking + flash upon failure to authenticate, attestation logging for all signed drivers, + and other exception operations. The File parameter allows for possible logging + within the SAP of the driver. + + If File is NULL, then EFI_INVALID_PARAMETER is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use under any circumstances, + then EFI_ACCESS_DENIED is returned. + + If the file specified by File with an authentication status specified by + AuthenticationStatus is not safe for the DXE Core to use right now, but it + might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is + returned. + +Arguments: + + This - The EFI_SECURITY_ARCH_PROTOCOL instance. + + AuthenticationStatus - This is the authentication type returned from the Section + Extraction protocol. See the Section Extraction Protocol + Specification for details on this type. + + File - This is a pointer to the device path of the file that is + being dispatched. This will optionally be used for logging. + +Returns: + + EFI_SUCCESS - The file specified by File did authenticate, and the + platform policy dictates that the DXE Core may use File. + + EFI_INVALID_PARAMETER - Driver is NULL. + + EFI_SECURITY_VIOLATION - The file specified by File did not authenticate, and + the platform policy dictates that File should be placed + in the untrusted state. A file may be promoted from + the untrusted to the trusted state at a future time + with a call to the Trust() DXE Service. + + EFI_ACCESS_DENIED - The file specified by File did not authenticate, and + the platform policy dictates that File should not be + used for any purpose. + +--*/ +; + +// +// Interface stucture for the Timer Architectural Protocol +// +typedef struct _EFI_SECURITY_ARCH_PROTOCOL { + EFI_SECURITY_FILE_AUTHENTICATION_STATE FileAuthenticationState; +} EFI_SECURITY_ARCH_PROTOCOL; +/*++ + + Protocol Description: + + The EFI_SECURITY_ARCH_PROTOCOL is used to abstract platform-specific policy + from the DXE core. This includes locking flash upon failure to authenticate, + attestation logging, and other exception operations. + + The driver that produces the EFI_SECURITY_ARCH_PROTOCOL may also optionally + install the EFI_SECURITY_POLICY_PROTOCOL_GUID onto a new handle with a NULL + interface. The existence of this GUID in the protocol database means that + the GUIDed Section Extraction Protocol should authenticate the contents of + an Authentication Section. The expectation is that the GUIDed Section + Extraction protocol will look for the existence of the EFI_SECURITY_POLICY_ + PROTOCOL_GUID in the protocol database. If it exists, then the publication + thereof is taken as an injunction to attempt an authentication of any section + wrapped in an Authentication Section. See the Firmware File System + Specification for details on the GUIDed Section Extraction Protocol and + Authentication Sections. + + Parameters: + + FileAuthenticationState - This service is called upon fault with respect to + the authentication of a section of a file. + +--*/ + +extern EFI_GUID gEfiSecurityArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/StatusCode/StatusCode.c b/EDK/Foundation/Core/Dxe/ArchProtocol/StatusCode/StatusCode.c new file mode 100644 index 0000000..1c0890c --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/StatusCode/StatusCode.c @@ -0,0 +1,29 @@ +/*++ + +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: + + StatusCode.c + +Abstract: + + Status code Architectural Protocol as defined in Tiano + + This code abstracts Status Code reporting. + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (StatusCode) + +EFI_GUID gEfiStatusCodeRuntimeProtocolGuid = EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiStatusCodeRuntimeProtocolGuid, "Status Code", "Status Code Arch Protocol");
\ No newline at end of file diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/StatusCode/StatusCode.h b/EDK/Foundation/Core/Dxe/ArchProtocol/StatusCode/StatusCode.h new file mode 100644 index 0000000..3346d87 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/StatusCode/StatusCode.h @@ -0,0 +1,100 @@ +/*++ + +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: + + StatusCode.h + +Abstract: + + Status code Architectural Protocol as defined in the DXE CIS + + This code abstracts Status Code reporting. + + The StatusCode () Tiano service is added to the EFI system table and the + EFI_STATUS_CODE_ARCH_PROTOCOL_GUID protocol is registered with a NULL + pointer. + + No CRC of the EFI system table is required, as it is done in the DXE core. + +--*/ + +#ifndef __STATUS_CODE_RUNTIME_PROTOCOL_H__ +#define __STATUS_CODE_RUNTIME_PROTOCOL_H__ + +#define EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID \ + { 0xd2b2b828, 0x826, 0x48a7, 0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24, 0xf0} + +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) +typedef +EFI_STATUS +(EFIAPI *EFI_REPORT_STATUS_CODE) ( + IN EFI_STATUS_CODE_TYPE Type, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId OPTIONAL, + IN EFI_STATUS_CODE_DATA *Data OPTIONAL + ) +/*++ +Routine Description: + + Provides an interface that a software module can call to report a status code. + +Arguments: + + Type - Indicates the type of status code being reported. + + Value - Describes the current status of a hardware or software entity. + This included information about the class and subclass that is + used to classify the entity as well as an operation. + + Instance - The enumeration of a hardware or software entity within + the system. Valid instance numbers start with 1. + + CallerId - This optional parameter may be used to identify the caller. + This parameter allows the status code driver to apply different + rules to different callers. + + Data - This optional parameter may be used to pass additional data. + +Returns: + + EFI_SUCCESS - The function completed successfully + + EFI_DEVICE_ERROR - The function should not be completed due to a device error. + +--*/ +; +#endif + +// +// Interface stucture for the STATUS CODE Architectural Protocol +// +typedef struct _EFI_STATUS_CODE_PROTOCOL { + EFI_REPORT_STATUS_CODE ReportStatusCode; +} EFI_STATUS_CODE_PROTOCOL; + +/*++ +// Protocol Description: +// +// Provides the service required to report a status code to the platform firmware. +// This protocol must be produced by a runtime DXE driver and may be consumed +// only by the DXE Foundation. +// +// Parameter: +// +// ReportStatusCode - Emit a status code. +--*/ + + +extern EFI_GUID gEfiStatusCodeRuntimeProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Timer/Timer.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Timer/Timer.c new file mode 100644 index 0000000..b2946f8 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Timer/Timer.c @@ -0,0 +1,27 @@ +/*++ + +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: + + Timer.c + +Abstract: + + Timer Architectural Protocol GUID as defined in Tiano + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Timer) + +EFI_GUID gEfiTimerArchProtocolGuid = EFI_TIMER_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiTimerArchProtocolGuid, "Timer", "Timer Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Timer/Timer.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Timer/Timer.h new file mode 100644 index 0000000..2e5c80d --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Timer/Timer.h @@ -0,0 +1,260 @@ +/*++ + +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: + + Timer.h + +Abstract: + + Timer Architectural Protocol as defined in the DXE CIS + + This code is used to provide the timer tick for the DXE core. + +--*/ + +#ifndef _ARCH_PROTOCOL_TIMER_H_ +#define _ARCH_PROTOCOL_TIMER_H_ + +// +// Global ID for the Timer Architectural Protocol +// +#define EFI_TIMER_ARCH_PROTOCOL_GUID \ + { 0x26baccb3, 0x6f42, 0x11d4, 0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } + +// +// Declare forward reference for the Timer Architectural Protocol +// +EFI_FORWARD_DECLARATION (EFI_TIMER_ARCH_PROTOCOL); + +typedef +VOID +(EFIAPI *EFI_TIMER_NOTIFY) ( + IN UINT64 Time + ); +/*++ + +Routine Description: + + This function of this type is called when a timer interrupt fires. This + function executes at TPL_HIGH_LEVEL. The DXE Core will register a funtion + of tyis type to be called for the timer interrupt, so it can know how much + time has passed. This information is used to signal timer based events. + +Arguments: + + Time - Time since the last timer interrupt in 100 ns units. This will + typically be TimerPeriod, but if a timer interrupt is missed, and the + EFI_TIMER_ARCH_PROTOCOL driver can detect missed interrupts, then Time + will contain the actual amount of time since the last interrupt. + +Returns: + + None. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_TIMER_REGISTER_HANDLER) ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN EFI_TIMER_NOTIFY NotifyFunction +); +/*++ + +Routine Description: + + This function registers the handler NotifyFunction so it is called every time + the timer interrupt fires. It also passes the amount of time since the last + handler call to the NotifyFunction. If NotifyFunction is NULL, then the + handler is unregistered. If the handler is registered, then EFI_SUCCESS is + returned. If the CPU does not support registering a timer interrupt handler, + then EFI_UNSUPPORTED is returned. If an attempt is made to register a handler + when a handler is already registered, then EFI_ALREADY_STARTED is returned. + If an attempt is made to unregister a handler when a handler is not registered, + then EFI_INVALID_PARAMETER is returned. If an error occurs attempting to + register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR + is returned. + +Arguments: + + This - The EFI_TIMER_ARCH_PROTOCOL instance. + + NotifyFunction - The function to call when a timer interrupt fires. This + function executes at TPL_HIGH_LEVEL. The DXE Core will + register a handler for the timer interrupt, so it can know + how much time has passed. This information is used to + signal timer based events. NULL will unregister the handler. + +Returns: + + EFI_SUCCESS - The timer handler was registered. + + EFI_UNSUPPORTED - The platform does not support timer interrupts. + + EFI_ALREADY_STARTED - NotifyFunction is not NULL, and a handler is already + registered. + + EFI_INVALID_PARAMETER - NotifyFunction is NULL, and a handler was not + previously registered. + + EFI_DEVICE_ERROR - The timer handler could not be registered. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_TIMER_SET_TIMER_PERIOD) ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod + ); +/*++ + +Routine Description: + + This function adjusts the period of timer interrupts to the value specified + by TimerPeriod. If the timer period is updated, then the selected timer + period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If + the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. + If an error occurs while attempting to update the timer period, then the + timer hardware will be put back in its state prior to this call, and + EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt + is disabled. This is not the same as disabling the CPU's interrupts. + Instead, it must either turn off the timer hardware, or it must adjust the + interrupt controller so that a CPU interrupt is not generated when the timer + interrupt fires. + +Arguments: + + This - The EFI_TIMER_ARCH_PROTOCOL instance. + + TimerPeriod - The rate to program the timer interrupt in 100 nS units. If + the timer hardware is not programmable, then EFI_UNSUPPORTED is + returned. If the timer is programmable, then the timer period + will be rounded up to the nearest timer period that is supported + by the timer hardware. If TimerPeriod is set to 0, then the + timer interrupts will be disabled. + +Returns: + + EFI_SUCCESS - The timer period was changed. + + EFI_UNSUPPORTED - The platform cannot change the period of the timer interrupt. + + EFI_DEVICE_ERROR - The timer period could not be changed due to a device error. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_TIMER_GET_TIMER_PERIOD) ( + IN EFI_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ); +/*++ + +Routine Description: + + This function retrieves the period of timer interrupts in 100 ns units, + returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPeriod + is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 is + returned, then the timer is currently disabled. + +Arguments: + + This - The EFI_TIMER_ARCH_PROTOCOL instance. + + TimerPeriod - A pointer to the timer period to retrieve in 100 ns units. If + 0 is returned, then the timer is currently disabled. + +Returns: + + EFI_SUCCESS - The timer period was returned in TimerPeriod. + + EFI_INVALID_PARAMETER - TimerPeriod is NULL. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_TIMER_GENERATE_SOFT_INTERRUPT) ( + IN EFI_TIMER_ARCH_PROTOCOL *This + ); +/*++ + +Routine Description: + + This function generates a soft timer interrupt. If the platform does not support soft + timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned. + If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler() + service, then a soft timer interrupt will be generated. If the timer interrupt is + enabled when this service is called, then the registered handler will be invoked. The + registered handler should not be able to distinguish a hardware-generated timer + interrupt from a software-generated timer interrupt. + +Arguments: + + This - The EFI_TIMER_ARCH_PROTOCOL instance. + +Returns: + + EFI_SUCCESS - The soft timer interrupt was generated. + + EFI_UNSUPPORTEDT - The platform does not support the generation of soft timer interrupts. + +--*/ + +// +// Interface stucture for the Timer Architectural Protocol +// +typedef struct _EFI_TIMER_ARCH_PROTOCOL { + EFI_TIMER_REGISTER_HANDLER RegisterHandler; + EFI_TIMER_SET_TIMER_PERIOD SetTimerPeriod; + EFI_TIMER_GET_TIMER_PERIOD GetTimerPeriod; + EFI_TIMER_GENERATE_SOFT_INTERRUPT GenerateSoftInterrupt; +} EFI_TIMER_ARCH_PROTOCOL; + +/*++ + + Protocol Description: + This protocol provides the services to initialize a periodic timer + interrupt, and to register a handler that is called each time the timer + interrupt fires. It may also provide a service to adjust the rate of the + periodic timer interrupt. When a timer interrupt occurs, the handler is + passed the amount of time that has passed since the previous timer + interrupt. + + Parameters: + + RegisterHandler - Registers a handler that will be called each time the + timer interrupt fires. TimerPeriod defines the minimum + time between timer interrupts, so TimerPeriod will also + be the minimum time between calls to the registered + handler. + + SetTimerPeriod - Sets the period of the timer interrupt in 100 nS units. + This function is optional, and may return EFI_UNSUPPORTED. + If this function is supported, then the timer period will + be rounded up to the nearest supported timer period. + + GetTimerPeriod - Retrieves the period of the timer interrupt in 100 nS units. + + GenerateSoftInterrupt - + Generates a soft timer interrupt that simulates the firing of + the timer interrupt. This service can be used to invoke the + registered handler if the timer interrupt has been masked for + a period of time. + +--*/ + +extern EFI_GUID gEfiTimerArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Variable/Variable.c b/EDK/Foundation/Core/Dxe/ArchProtocol/Variable/Variable.c new file mode 100644 index 0000000..5ff0e9b --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Variable/Variable.c @@ -0,0 +1,29 @@ +/*++ + +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: + + Variable.c + +Abstract: + + Variable Architectural Protocol as defined in Tiano + + This code is used to produce the EFI 1.0 runtime variable services + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (Variable) + +EFI_GUID gEfiVariableArchProtocolGuid = EFI_VARIABLE_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiVariableArchProtocolGuid, "Variable", "Variable Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/Variable/Variable.h b/EDK/Foundation/Core/Dxe/ArchProtocol/Variable/Variable.h new file mode 100644 index 0000000..8d9d4df --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/Variable/Variable.h @@ -0,0 +1,41 @@ +/*++ + +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: + + Variable.h + +Abstract: + + Variable Architectural Protocol as defined in the DXE CIS + + This code is used to produce the EFI 1.0 runtime variable services + + The GetVariable (), GetNextVariableName (), and SetVariable () EFI 1.0 + services are added to the EFI system table and the + EFI_VARIABLE_ARCH_PROTOCOL_GUID protocol is registered with a NULL pointer. + + No CRC of the EFI system table is required, as it is done in the DXE core. + +--*/ + +#ifndef _ARCH_PROTOCOL_VARIABLE_ARCH_H_ +#define _ARCH_PROTOCOL_VARIABLE_ARCH_H_ + +// +// Global ID for the Variable Architectural Protocol +// +#define EFI_VARIABLE_ARCH_PROTOCOL_GUID \ + { 0x1e5668e2, 0x8481, 0x11d4, 0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } + +extern EFI_GUID gEfiVariableArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/VariableWrite/VariableWrite.c b/EDK/Foundation/Core/Dxe/ArchProtocol/VariableWrite/VariableWrite.c new file mode 100644 index 0000000..7daf743 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/VariableWrite/VariableWrite.c @@ -0,0 +1,30 @@ +/*++ + +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: + + VariableWrite.c + +Abstract: + + Variable Write Architectural Protocol as defined in DXE CIS + + This code is used to indicate the EFI 1.0 runtime variable services + support writting to variables. + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (VariableWrite) + +EFI_GUID gEfiVariableWriteArchProtocolGuid = EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiVariableWriteArchProtocolGuid, "VariableWrite", "Variable Write Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/VariableWrite/VariableWrite.h b/EDK/Foundation/Core/Dxe/ArchProtocol/VariableWrite/VariableWrite.h new file mode 100644 index 0000000..7629b09 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/VariableWrite/VariableWrite.h @@ -0,0 +1,41 @@ +/*++ + +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: + + VariableWrite.h + +Abstract: + + Variable Write Architectural Protocol as defined in the DXE CIS + + This code is used to produce the EFI 1.0 runtime variable services + + The GetVariable (), GetNextVariableName (), and SetVariable () EFI 1.0 + services are added to the EFI system table and the + EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID protocol is registered with a NULL pointer. + + No CRC of the EFI system table is required, as it is done in the DXE core. + +--*/ + +#ifndef _ARCH_PROTOCOL_VARIABLE_WRITE_ARCH_H_ +#define _ARCH_PROTOCOL_VARIABLE_WRITE_ARCH_H_ + +// +// Global ID for the Variable Write Architectural Protocol +// +#define EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID \ + { 0x6441f818, 0x6362, 0x4e44, 0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53 } + +extern EFI_GUID gEfiVariableWriteArchProtocolGuid; + +#endif diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/WatchdogTimer/WatchdogTimer.c b/EDK/Foundation/Core/Dxe/ArchProtocol/WatchdogTimer/WatchdogTimer.c new file mode 100644 index 0000000..d6ee113 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/WatchdogTimer/WatchdogTimer.c @@ -0,0 +1,27 @@ +/*++ + +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: + + WatchdogTimer.c + +Abstract: + + Watchdog Timer Architectural Protocol GUID as defined in Tiano + +--*/ + +#include "Tiano.h" +#include EFI_ARCH_PROTOCOL_DEFINITION (WatchdogTimer) + +EFI_GUID gEfiWatchdogTimerArchProtocolGuid = EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID; + +EFI_GUID_STRING(&gEfiWatchdogTimerArchProtocolGuid, "Watchdog Timer", "Watchdog Timer Arch Protocol"); diff --git a/EDK/Foundation/Core/Dxe/ArchProtocol/WatchdogTimer/WatchdogTimer.h b/EDK/Foundation/Core/Dxe/ArchProtocol/WatchdogTimer/WatchdogTimer.h new file mode 100644 index 0000000..6586594 --- /dev/null +++ b/EDK/Foundation/Core/Dxe/ArchProtocol/WatchdogTimer/WatchdogTimer.h @@ -0,0 +1,206 @@ +/*++ + +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: + + WatchdogTimer.h + +Abstract: + + Watchdog Timer Architectural Protocol as defined in the DXE CIS + + Used to provide system watchdog timer services + +--*/ + +#ifndef _ARCH_PROTOCOL_WATCHDOG_TIMER_H_ +#define _ARCH_PROTOCOL_WATCHDOG_TIMER_H_ + +// +// Global ID for the Watchdog Timer Architectural Protocol +// +#define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \ + { 0x665E3FF5, 0x46CC, 0x11d4, 0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } + +// +// Declare forward reference for the Timer Architectural Protocol +// +EFI_FORWARD_DECLARATION (EFI_WATCHDOG_TIMER_ARCH_PROTOCOL); + +typedef +VOID +(EFIAPI *EFI_WATCHDOG_TIMER_NOTIFY) ( + IN UINT64 Time + ); +/*++ + +Routine Description: + + A function of this type is called when the watchdog timer fires if a + handler has been registered. + +Arguments: + + Time - The time in 100 ns units that has passed since the watchdog + timer was armed. For the notify function to be called, this + must be greater than TimerPeriod. + +Returns: + + None. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_WATCHDOG_TIMER_REGISTER_HANDLER) ( + IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction + ); +/*++ + +Routine Description: + + This function registers a handler that is to be invoked when the watchdog + timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the + Runtime Service ResetSystem() when the watchdog timer fires. If a + NotifyFunction is registered, then the NotifyFunction will be called before + the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then + the watchdog handler is unregistered. If a watchdog handler is registered, + then EFI_SUCCESS is returned. If an attempt is made to register a handler + when a handler is already registered, then EFI_ALREADY_STARTED is returned. + If an attempt is made to uninstall a handler when a handler is not installed, + then return EFI_INVALID_PARAMETER. + +Arguments: + + This - The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance. + + NotifyFunction - The function to call when the watchdog timer fires. If this + is NULL, then the handler will be unregistered. + +Returns: + + EFI_SUCCESS - The watchdog timer handler was registered or + unregistered. + + EFI_ALREADY_STARTED - NotifyFunction is not NULL, and a handler is already + registered. + + EFI_INVALID_PARAMETER - NotifyFunction is NULL, and a handler was not + previously registered. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD) ( + IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod + ); +/*++ + +Routine Description: + + This function sets the amount of time to wait before firing the watchdog + timer to TimerPeriod 100 nS units. If TimerPeriod is 0, then the watchdog + timer is disabled. + +Arguments: + + This - The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance. + + TimerPeriod - The amount of time in 100 nS units to wait before the watchdog + timer is fired. If TimerPeriod is zero, then the watchdog + timer is disabled. + +Returns: + + EFI_SUCCESS - The watchdog timer has been programmed to fire in Time + 100 nS units. + + EFI_DEVICE_ERROR - A watchdog timer could not be programmed due to a device + error. + +--*/ + +typedef +EFI_STATUS +(EFIAPI *EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD) ( + IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ); +/*++ + +Routine Description: + + This function retrieves the amount of time the system will wait before firing + the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS + is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned. + +Arguments: + + This - The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance. + + TimerPeriod - A pointer to the amount of time in 100 nS units that the system + will wait before the watchdog timer is fired. If TimerPeriod of + zero is returned, then the watchdog timer is disabled. + +Returns: + + EFI_SUCCESS - The amount of time that the system will wait before + firing the watchdog timer was returned in TimerPeriod. + + EFI_INVALID_PARAMETER - TimerPeriod is NULL. + +--*/ + +// +// Interface stucture for the Watchdog Timer Architectural Protocol +// +typedef struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL { + EFI_WATCHDOG_TIMER_REGISTER_HANDLER RegisterHandler; + EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD SetTimerPeriod; + EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD GetTimerPeriod; +} EFI_WATCHDOG_TIMER_ARCH_PROTOCOL; + +/*++ + + Protocol Description: + This protocol provides the services required to implement the Boot Service + SetWatchdogTimer(). It provides a service to set the amount of time to wait + before firing the watchdog timer, and it also provides a service to register + a handler that is invoked when the watchdog timer fires. This protocol can + implement the watchdog timer by using the event and timer Boot Services, or + it can make use of custom hardware. When the watchdog timer fires, control + will be passed to a handler if one has been registered. If no handler has + been registered, or the registered handler returns, then the system will be + reset by calling the Runtime Service ResetSystem(). + + Parameters: + + RegisterHandler - Registers a handler that is invoked when the watchdog + timer fires. + + SetTimerPeriod - Sets the amount of time in 100 ns units to wait before the + watchdog timer is fired. If this function is supported, + then the watchdog timer period will be rounded up to the + nearest supported watchdog timer period. + + GetTimerPeriod - Retrieves the amount of time in 100 ns units that the + system will wait before the watchdog timer is fired. + +--*/ + +extern EFI_GUID gEfiWatchdogTimerArchProtocolGuid; + +#endif + |