summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Dxe/ArchProtocol
diff options
context:
space:
mode:
authorbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>2006-04-21 22:54:32 +0000
committerbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>2006-04-21 22:54:32 +0000
commit878ddf1fc3540a715f63594ed22b6929e881afb4 (patch)
treec56c44dac138137b510e1fba7c3efe5e4d84bea2 /MdePkg/Include/Dxe/ArchProtocol
downloadedk2-platforms-878ddf1fc3540a715f63594ed22b6929e881afb4.tar.xz
Initial import.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Include/Dxe/ArchProtocol')
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Bds.h87
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Cpu.h326
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Metronome.h100
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/MonotonicCounter.h33
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/RealTimeClock.h41
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Reset.h38
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Runtime.h162
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Security.h136
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/SecurityPolicy.h31
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/StatusCode.h82
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Timer.h222
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/Variable.h39
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/VariableWrite.h38
-rw-r--r--MdePkg/Include/Dxe/ArchProtocol/WatchdogTimer.h172
14 files changed, 1507 insertions, 0 deletions
diff --git a/MdePkg/Include/Dxe/ArchProtocol/Bds.h b/MdePkg/Include/Dxe/ArchProtocol/Bds.h
new file mode 100644
index 0000000000..f6b72d2b00
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Bds.h
@@ -0,0 +1,87 @@
+/** @file
+ Boot Device Selection Architectural Protocol as defined in DXE CIS
+
+ When the DXE core is done it calls the BDS via this protocol.
+
+ 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: Bds.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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
+//
+typedef struct _EFI_BDS_ARCH_PROTOCOL EFI_BDS_ARCH_PROTOCOL;
+
+/**
+ 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.
+
+ @param This The EFI_BDS_ARCH_PROTOCOL instance.
+
+ @return None.
+
+**/
+typedef
+VOID
+(EFIAPI *EFI_BDS_ENTRY) (
+ IN EFI_BDS_ARCH_PROTOCOL *This
+ );
+
+/**
+ Interface stucture for the BDS Architectural Protocol.
+
+ @par 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.
+
+ @par Protocol 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.
+
+**/
+struct _EFI_BDS_ARCH_PROTOCOL {
+ EFI_BDS_ENTRY Entry;
+};
+
+extern EFI_GUID gEfiBdsArchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/Cpu.h b/MdePkg/Include/Dxe/ArchProtocol/Cpu.h
new file mode 100644
index 0000000000..975a816356
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Cpu.h
@@ -0,0 +1,326 @@
+/** @file
+ CPU Architectural Protocol as defined in DXE CIS
+
+ This code abstracts the DXE core from processor implementation details.
+
+ 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: Cpu.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#ifndef __ARCH_PROTOCOL_CPU_H__
+#define __ARCH_PROTOCOL_CPU_H__
+
+
+#define EFI_CPU_ARCH_PROTOCOL_GUID \
+ { 0x26baccb1, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+typedef struct _EFI_CPU_ARCH_PROTOCOL EFI_CPU_ARCH_PROTOCOL;
+
+typedef enum {
+ EfiCpuFlushTypeWriteBackInvalidate,
+ EfiCpuFlushTypeWriteBack,
+ EfiCpuFlushTypeInvalidate,
+ EfiCpuMaxFlushType
+} EFI_CPU_FLUSH_TYPE;
+
+typedef enum {
+ EfiCpuInit,
+ EfiCpuMaxInitType
+} EFI_CPU_INIT_TYPE;
+
+/**
+ EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs.
+
+ @param InterruptType Defines the type of interrupt or exception that
+ occurred on the processor.This parameter is processor architecture specific.
+
+ @param SystemContext A pointer to the processor context when
+ the interrupt occurred on the processor.
+
+ @return None
+
+**/
+typedef
+VOID
+(*EFI_CPU_INTERRUPT_HANDLER) (
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
+ );
+
+/**
+ 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.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+ @param Start The beginning physical address to flush from the processor's data
+ cache.
+ @param 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.
+ @param FlushType Specifies the type of flush operation to perform.
+
+ @retval EFI_SUCCESS The address range from Start to Start+Length was flushed from
+ the processor's data cache.
+ @retval EFI_UNSUPPORTEDT The processor does not support the cache flush type specified
+ by FlushType.
+ @retval 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_FLUSH_DATA_CACHE) (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS Start,
+ IN UINT64 Length,
+ IN EFI_CPU_FLUSH_TYPE FlushType
+ );
+
+
+/**
+ This function enables interrupt processing by the processor.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+
+ @retval EFI_SUCCESS Interrupts are enabled on the processor.
+ @retval EFI_DEVICE_ERROR Interrupts could not be enabled on the processor.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CPU_ENABLE_INTERRUPT) (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ );
+
+
+/**
+ This function disables interrupt processing by the processor.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+
+ @retval EFI_SUCCESS Interrupts are disabled on the processor.
+ @retval EFI_DEVICE_ERROR Interrupts could not be disabled on the processor.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CPU_DISABLE_INTERRUPT) (
+ IN EFI_CPU_ARCH_PROTOCOL *This
+ );
+
+
+/**
+ 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.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+ @param State A pointer to the processor's current interrupt state. Set to TRUE if
+ interrupts are enabled and FALSE if interrupts are disabled.
+
+ @retval EFI_SUCCESS The processor's current interrupt state was returned in State.
+ @retval EFI_INVALID_PARAMETER State is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CPU_GET_INTERRUPT_STATE) (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ OUT BOOLEAN *State
+ );
+
+
+/**
+ 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.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+ @param InitType The type of processor INIT to perform.
+
+ @retval EFI_SUCCESS The processor INIT was performed. This return code should never be seen.
+ @retval EFI_UNSUPPORTED The processor INIT operation specified by InitType is not supported
+ by this processor.
+ @retval EFI_DEVICE_ERROR The processor INIT failed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CPU_INIT) (
+ IN EFI_CPU_ARCH_PROTOCOL *This,
+ IN EFI_CPU_INIT_TYPE InitType
+ );
+
+
+/**
+ 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.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+ @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
+ are enabled and FALSE if interrupts are disabled.
+ @param 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.
+
+ @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
+ @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
+ previously installed.
+ @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
+ previously installed.
+ @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
+
+**/
+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
+ );
+
+
+/**
+ This function reads the processor timer specified by TimerIndex and returns it in TimerValue.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+ @param TimerIndex Specifies which processor timer is to be returned in TimerValue. This parameter
+ must be between 0 and NumberOfTimers-1.
+ @param TimerValue Pointer to the returned timer value.
+ @param TimerPeriod A pointer to the amount of time that passes in femtoseconds for each increment
+ of TimerValue.
+
+ @retval EFI_SUCCESS The processor timer value specified by TimerIndex was returned in TimerValue.
+ @retval EFI_DEVICE_ERROR An error occurred attempting to read one of the processor's timers.
+ @retval EFI_INVALID_PARAMETER TimerValue is NULL or TimerIndex is not valid.
+ @retval EFI_UNSUPPORTED The processor does not have any readable timers.
+
+**/
+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
+ );
+
+
+/**
+ This function modifies the attributes for the memory region specified by BaseAddress and
+ Length from their current attributes to the attributes specified by Attributes.
+
+ @param This The EFI_CPU_ARCH_PROTOCOL instance.
+ @param BaseAddress The physical address that is the start address of a memory region.
+ @param Length The size in bytes of the memory region.
+ @param Attributes The bit mask of attributes to set for the memory region.
+
+ @retval EFI_SUCCESS The attributes were set for the memory region.
+ @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
+ BaseAddress and Length cannot be modified.
+ @retval EFI_INVALID_PARAMETER Length is zero.
+ @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
+ the memory resource range.
+ @retval 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
+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
+ );
+
+
+/**
+ @par 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.
+
+ @param 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.
+
+ @param EnableInterrupt Enables interrupt processing by the processor.
+
+ @param DisableInterrupt Disables interrupt processing by the processor.
+
+ @param GetInterruptState Retrieves the processor's current interrupt state.
+
+ @param 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.
+
+ @param 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.
+
+ @param GetTimerValue Returns the value of one of the processor's internal timers.
+
+ @param SetMemoryAttributes Attempts to set the attributes of a memory region.
+
+ @param 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.
+
+ @param 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.
+
+**/
+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;
+};
+
+extern EFI_GUID gEfiCpuArchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/Metronome.h b/MdePkg/Include/Dxe/ArchProtocol/Metronome.h
new file mode 100644
index 0000000000..a07003e5cc
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Metronome.h
@@ -0,0 +1,100 @@
+/** @file
+ Metronome Architectural Protocol as defined in DXE CIS
+
+ This code abstracts the DXE core to provide delay services.
+
+ 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: Metronome.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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
+//
+typedef struct _EFI_METRONOME_ARCH_PROTOCOL EFI_METRONOME_ARCH_PROTOCOL;
+
+/**
+ 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.
+
+ @param This The EFI_METRONOME_ARCH_PROTOCOL instance.
+
+ @param TickNumber Number of ticks to wait.
+
+ @retval EFI_SUCCESS The wait for the number of ticks specified by TickNumber
+ succeeded.
+
+ @retval EFI_TIMEOUT A timeout occurred waiting for the specified number of ticks.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_METRONOME_WAIT_FOR_TICK) (
+ IN EFI_METRONOME_ARCH_PROTOCOL *This,
+ IN UINT32 TickNumber
+ );
+
+//
+//
+
+/**
+ Interface stucture for the Metronome Architectural Protocol.
+
+ @par 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.
+
+ @param 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.
+
+ @param 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.
+
+**/
+struct _EFI_METRONOME_ARCH_PROTOCOL {
+ EFI_METRONOME_WAIT_FOR_TICK WaitForTick;
+ UINT32 TickPeriod;
+};
+
+extern EFI_GUID gEfiMetronomeArchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/MonotonicCounter.h b/MdePkg/Include/Dxe/ArchProtocol/MonotonicCounter.h
new file mode 100644
index 0000000000..d25374074d
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/MonotonicCounter.h
@@ -0,0 +1,33 @@
+/** @file
+ Monotonic Counter Architectural Protocol as defined in DXE CIS
+
+ This code provides the services required to access the systems monotonic counter
+
+ 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: MonotonicCounter.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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/MdePkg/Include/Dxe/ArchProtocol/RealTimeClock.h b/MdePkg/Include/Dxe/ArchProtocol/RealTimeClock.h
new file mode 100644
index 0000000000..dc968e1666
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/RealTimeClock.h
@@ -0,0 +1,41 @@
+/** @file
+ Real Time clock Architectural Protocol as defined in DXE CIS
+
+ 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.
+
+ 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: RealTimeClock.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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/MdePkg/Include/Dxe/ArchProtocol/Reset.h b/MdePkg/Include/Dxe/ArchProtocol/Reset.h
new file mode 100644
index 0000000000..80befae95f
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Reset.h
@@ -0,0 +1,38 @@
+/** @file
+ 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.
+
+ 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: Reset.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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/MdePkg/Include/Dxe/ArchProtocol/Runtime.h b/MdePkg/Include/Dxe/ArchProtocol/Runtime.h
new file mode 100644
index 0000000000..bbd4c1a699
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Runtime.h
@@ -0,0 +1,162 @@
+/** @file
+ Runtime Architectural Protocol as defined in DXE CIS
+
+ This code is used to produce the EFI 1.0 runtime virtual switch over
+
+ 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 need
+ by this driver to produce the runtime transition to virtual mode
+ calling.
+
+ 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: Runtime.h
+
+ @par Revision Reference:
+ Version 0.90.
+
+**/
+
+#ifndef __ARCH_PROTOCOL_RUNTIME_H__
+#define __ARCH_PROTOCOL_RUNTIME_H__
+
+//
+// Global ID for the Runtime Architectural Protocol
+//
+#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \
+ { 0x96d08253, 0x8483, 0x11d4, {0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
+
+typedef struct _EFI_RUNTIME_ARCH_PROTOCOL EFI_RUNTIME_ARCH_PROTOCOL;
+
+/**
+ When a SetVirtualAddressMap() is performed all the runtime images loaded by
+ DXE must be fixed up with the new virtual address map. To facilitate this the
+ Runtime Architectural Protocol needs to be informed of every runtime driver
+ that is registered. All the runtime images loaded by DXE should be registered
+ with this service by the DXE Core when ExitBootServices() is called. The
+ images that are registered with this service must have successfully been
+ loaded into memory with the Boot Service LoadImage(). As a result, no
+ parameter checking needs to be performed.
+
+ @param This The EFI_RUNTIME_ARCH_PROTOCOL instance.
+
+ @param ImageBase Start of image that has been loaded in memory. It is either
+ a pointer to the DOS or PE header of the image.
+
+ @param ImageSize Size of the image in bytes.
+
+ @param RelocationData Information about the fixups that were performed on ImageBase
+ when it was loaded into memory. This information is needed
+ when the virtual mode fix-ups are reapplied so that data that
+ has been programmatically updated will not be fixed up. If
+ code updates a global variable the code is responsible for
+ fixing up the variable for virtual mode.
+
+ @retval EFI_SUCCESS The ImageBase has been registered.
+
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources to register ImageBase.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_RUNTIME_REGISTER_IMAGE) (
+ IN EFI_RUNTIME_ARCH_PROTOCOL *This,
+ IN EFI_PHYSICAL_ADDRESS ImageBase,
+ IN UINTN ImageSize,
+ IN VOID *RelocationData
+ );
+
+
+/**
+ This function is used to support the required runtime events. Currently only
+ runtime events of type EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE needs to be
+ registered with this service. All the runtime events that exist in the DXE
+ Core should be registered with this service when ExitBootServices() is called.
+ All the events that are registered with this service must have been created
+ with the Boot Service CreateEvent(). As a result, no parameter checking needs
+ to be performed.
+
+ @param This The EFI_RUNTIME_ARCH_PROTOCOL instance.
+
+ @param Type The same as Type passed into CreateEvent().
+
+ @param NotifyTpl The same as NotifyTpl passed into CreateEvent().
+
+ @param NotifyFunction The same as NotifyFunction passed into CreateEvent().
+
+ @param NotifyContext The same as NotifyContext passed into CreateEvent().
+
+ @param Event The EFI_EVENT returned by CreateEvent(). Event must be in
+ runtime memory.
+
+ @retval EFI_SUCCESS The Event has been registered.
+
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources to register Event.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_RUNTIME_REGISTER_EVENT) (
+ IN EFI_RUNTIME_ARCH_PROTOCOL *This,
+ IN UINT32 Type,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction,
+ IN VOID *NotifyContext,
+ IN EFI_EVENT *Event
+ );
+
+//
+// Interface stucture for the Runtime Architectural Protocol
+//
+/**
+ @par Protocol Description:
+ The DXE driver that produces this protocol must be a runtime driver. This
+ driver is responsible for initializing the SetVirtualAddressMap() and
+ ConvertPointer() fields of the EFI Runtime Services Table and the
+ CalculateCrc32() field of the EFI Boot Services Table. See the Runtime
+ Services chapter and the Boot Services chapter for details on these services.
+ After the two fields of the EFI Runtime Services Table and the one field of
+ the EFI Boot Services Table have been initialized, the driver must install
+ the EFI_RUNTIME_ARCH_PROTOCOL_GUID on a new handle with an EFI_RUNTIME_ARCH_
+ PROTOCOL interface pointer. The installation of this protocol informs the
+ DXE core that the virtual memory services and the 32-bit CRC services are
+ now available, and the DXE core must update the 32-bit CRC of the EFI Runtime
+ Services Table and the 32-bit CRC of the EFI Boot Services Table.
+
+ All runtime core services are provided by the EFI_RUNTIME_ARCH_PROTOCOL.
+ This includes the support for registering runtime images that must be
+ re-fixed up when a transition is made from physical mode to virtual mode.
+ This protocol also supports all events that are defined to fire at runtime.
+ This protocol also contains a CRC-32 function that will be used by the DXE
+ core as a boot service. The EFI_RUNTIME_ARCH_PROTOCOL needs the CRC-32
+ function when a transition is made from physical mode to virtual mode and
+ the EFI System Table and EFI Runtime Table are fixed up with virtual pointers.
+
+ @param RegisterRuntimeImage
+ Register a runtime image so it can be converted to virtual mode if the EFI Runtime Services
+ SetVirtualAddressMap() is called.
+
+ @param RegisterRuntimeEvent
+ Register an event than needs to be notified at runtime.
+
+**/
+struct _EFI_RUNTIME_ARCH_PROTOCOL {
+ EFI_RUNTIME_REGISTER_IMAGE RegisterImage;
+ EFI_RUNTIME_REGISTER_EVENT RegisterEvent;
+};
+
+extern EFI_GUID gEfiRuntimeArchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/Security.h b/MdePkg/Include/Dxe/ArchProtocol/Security.h
new file mode 100644
index 0000000000..3598199b84
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Security.h
@@ -0,0 +1,136 @@
+/** @file
+ 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.
+
+ 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: Security.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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 } }
+
+typedef struct _EFI_SECURITY_ARCH_PROTOCOL EFI_SECURITY_ARCH_PROTOCOL;
+
+/**
+ 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.
+
+ @param This The EFI_SECURITY_ARCH_PROTOCOL instance.
+
+ @param AuthenticationStatus This is the authentication type returned from the Section
+ Extraction protocol. See the Section Extraction Protocol
+ Specification for details on this type.
+
+ @param File This is a pointer to the device path of the file that is
+ being dispatched. This will optionally be used for logging.
+
+ @retval EFI_SUCCESS The file specified by File did authenticate, and the
+ platform policy dictates that the DXE Core may use File.
+
+ @retval EFI_INVALID_PARAMETER Driver is NULL.
+
+ @retval 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.
+
+ @retval 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.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_SECURITY_FILE_AUTHENTICATION_STATE) (
+ IN EFI_SECURITY_ARCH_PROTOCOL *This,
+ IN UINT32 AuthenticationStatus,
+ IN EFI_DEVICE_PATH_PROTOCOL *File
+ )
+;
+
+//
+// Interface stucture for the Timer Architectural Protocol
+//
+/**
+ @par 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.
+
+ @par Protocol Parameters:
+
+ FileAuthenticationState - This service is called upon fault with respect to
+ the authentication of a section of a file.
+
+**/
+struct _EFI_SECURITY_ARCH_PROTOCOL {
+ EFI_SECURITY_FILE_AUTHENTICATION_STATE FileAuthenticationState;
+};
+
+extern EFI_GUID gEfiSecurityArchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/SecurityPolicy.h b/MdePkg/Include/Dxe/ArchProtocol/SecurityPolicy.h
new file mode 100644
index 0000000000..b46267e10a
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/SecurityPolicy.h
@@ -0,0 +1,31 @@
+/** @file
+ Security Policy protocol as defined in the DXE CIS
+
+ 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: SecurityPolicy.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#ifndef _SECURITY_POLICY_H_
+#define _SECURITY_POLICY_H_
+
+//
+// Security policy protocol GUID definition
+//
+#define EFI_SECURITY_POLICY_PROTOCOL_GUID \
+ {0x78E4D245, 0xCD4D, 0x4a05, {0xA2, 0xBA, 0x47, 0x43, 0xE8, 0x6C, 0xFC, 0xAB} }
+
+extern EFI_GUID gEfiSecurityPolicyProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/StatusCode.h b/MdePkg/Include/Dxe/ArchProtocol/StatusCode.h
new file mode 100644
index 0000000000..6440dc3388
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/StatusCode.h
@@ -0,0 +1,82 @@
+/** @file
+ Status code Runtime Protocol as defined in the DXE CIS
+
+ 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.
+
+ This code abstracts Status Code reporting.
+
+ 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: StatusCode.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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 } }
+
+/**
+ Provides an interface that a software module can call to report a status code.
+
+ @param Type Indicates the type of status code being reported.
+
+ @param 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.
+
+ @param Instance The enumeration of a hardware or software entity within
+ the system. Valid instance numbers start with 1.
+
+ @param 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.
+
+ @param Data This optional parameter may be used to pass additional data.
+
+ @retval EFI_SUCCESS The function completed successfully
+
+ @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.
+
+**/
+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
+ );
+
+/**
+ @par 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.
+
+ @param ReportStatusCode Emit a status code.
+
+**/
+typedef struct _EFI_STATUS_CODE_PROTOCOL {
+ EFI_REPORT_STATUS_CODE ReportStatusCode;
+} EFI_STATUS_CODE_PROTOCOL;
+
+extern EFI_GUID gEfiStatusCodeRuntimeProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/Timer.h b/MdePkg/Include/Dxe/ArchProtocol/Timer.h
new file mode 100644
index 0000000000..330f4cfd68
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Timer.h
@@ -0,0 +1,222 @@
+/** @file
+ Timer Architectural Protocol as defined in the DXE CIS
+
+ This code is used to provide the timer tick for the DXE core.
+
+ 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: Timer.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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
+//
+typedef struct _EFI_TIMER_ARCH_PROTOCOL EFI_TIMER_ARCH_PROTOCOL;
+
+/**
+ 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.
+
+ @param 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.
+
+ None.
+
+**/
+typedef
+VOID
+(EFIAPI *EFI_TIMER_NOTIFY) (
+ IN UINT64 Time
+ );
+
+/**
+ 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.
+
+ @param This The EFI_TIMER_ARCH_PROTOCOL instance.
+
+ @param 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.
+
+ @retval EFI_SUCCESS The timer handler was registered.
+
+ @retval EFI_UNSUPPORTED The platform does not support timer interrupts.
+
+ @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already
+ registered.
+
+ @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
+ previously registered.
+
+ @retval EFI_DEVICE_ERROR The timer handler could not be registered.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TIMER_REGISTER_HANDLER) (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ IN EFI_TIMER_NOTIFY NotifyFunction
+);
+
+/**
+ 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.
+
+ @param This The EFI_TIMER_ARCH_PROTOCOL instance.
+
+ @param 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.
+
+ @retval EFI_SUCCESS The timer period was changed.
+
+ @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt.
+
+ @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TIMER_SET_TIMER_PERIOD) (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ IN UINT64 TimerPeriod
+ );
+
+/**
+ 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.
+
+ @param This The EFI_TIMER_ARCH_PROTOCOL instance.
+
+ @param TimerPeriod A pointer to the timer period to retrieve in 100 ns units. If
+ 0 is returned, then the timer is currently disabled.
+
+ @retval EFI_SUCCESS The timer period was returned in TimerPeriod.
+
+ @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TIMER_GET_TIMER_PERIOD) (
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
+ );
+
+/**
+ 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.
+
+ @param This The EFI_TIMER_ARCH_PROTOCOL instance.
+
+ @retval EFI_SUCCESS The soft timer interrupt was generated.
+
+ @retval EFI_UNSUPPORTEDT The platform does not support the generation of soft timer interrupts.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TIMER_GENERATE_SOFT_INTERRUPT) (
+ IN EFI_TIMER_ARCH_PROTOCOL *This
+ );
+
+
+/**
+ Interface stucture for the Timer Architectural Protocol.
+
+ @par 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.
+
+ @param 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.
+
+ @param 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.
+
+ @param GetTimerPeriod
+ Retrieves the period of the timer interrupt in 100 nS units.
+
+ @param 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.
+
+**/
+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;
+};
+
+extern EFI_GUID gEfiTimerArchProtocolGuid;
+
+#endif
diff --git a/MdePkg/Include/Dxe/ArchProtocol/Variable.h b/MdePkg/Include/Dxe/ArchProtocol/Variable.h
new file mode 100644
index 0000000000..13eb113bcc
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/Variable.h
@@ -0,0 +1,39 @@
+/** @file
+ 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.
+
+ 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: Variable.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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/MdePkg/Include/Dxe/ArchProtocol/VariableWrite.h b/MdePkg/Include/Dxe/ArchProtocol/VariableWrite.h
new file mode 100644
index 0000000000..8c21df54f1
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/VariableWrite.h
@@ -0,0 +1,38 @@
+/** @file
+ Variable Write Architectural Protocol as defined in the DXE CIS
+
+ This code is used to produce the EFI 1.0 runtime variable services
+
+ The SetVariable () EFI 1.0 services may be updated 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.
+
+ 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: VariableWrite.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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/MdePkg/Include/Dxe/ArchProtocol/WatchdogTimer.h b/MdePkg/Include/Dxe/ArchProtocol/WatchdogTimer.h
new file mode 100644
index 0000000000..a8d84b18da
--- /dev/null
+++ b/MdePkg/Include/Dxe/ArchProtocol/WatchdogTimer.h
@@ -0,0 +1,172 @@
+/** @file
+ Watchdog Timer Architectural Protocol as defined in the DXE CIS
+
+ Used to provide system watchdog timer services
+
+ 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: WatchdogTimer.h
+
+ @par Revision Reference:
+ Version 0.91B.
+
+**/
+
+#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
+//
+typedef struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL EFI_WATCHDOG_TIMER_ARCH_PROTOCOL;
+
+/**
+ A function of this type is called when the watchdog timer fires if a
+ handler has been registered.
+
+ @param 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.
+
+ @return None.
+
+**/
+typedef
+VOID
+(EFIAPI *EFI_WATCHDOG_TIMER_NOTIFY) (
+ IN UINT64 Time
+ );
+
+/**
+ 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.
+
+ @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
+
+ @param NotifyFunction The function to call when the watchdog timer fires. If this
+ is NULL, then the handler will be unregistered.
+
+ @retval EFI_SUCCESS The watchdog timer handler was registered or
+ unregistered.
+
+ @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler is already
+ registered.
+
+ @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not
+ previously registered.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_WATCHDOG_TIMER_REGISTER_HANDLER) (
+ IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
+ IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
+ );
+
+/**
+ 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.
+
+ @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
+
+ @param 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.
+
+ @retval EFI_SUCCESS The watchdog timer has been programmed to fire in Time
+ 100 nS units.
+
+ @retval EFI_DEVICE_ERROR A watchdog timer could not be programmed due to a device
+ error.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD) (
+ IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
+ IN UINT64 TimerPeriod
+ );
+
+/**
+ 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.
+
+ @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
+
+ @param 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.
+
+ @retval EFI_SUCCESS The amount of time that the system will wait before
+ firing the watchdog timer was returned in TimerPeriod.
+
+ @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD) (
+ IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
+ );
+
+
+/**
+ Interface stucture for the Watchdog Timer Architectural Protocol.
+
+ @par 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().
+
+ @param RegisterHandler - Registers a handler that is invoked when the watchdog
+ timer fires.
+
+ @param 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.
+
+ @param GetTimerPeriod - Retrieves the amount of time in 100 ns units that the
+ system will wait before the watchdog timer is fired.
+
+**/
+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;
+};
+
+extern EFI_GUID gEfiWatchdogTimerArchProtocolGuid;
+
+#endif
+