From d1f950002362305fcd4c30f108ef7b76679f5843 Mon Sep 17 00:00:00 2001 From: yshang1 Date: Tue, 19 Jun 2007 10:12:02 +0000 Subject: [PATCH] Checked in the Protocols introduced in UEFI/PI. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2674 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Ipf/PalApi.h | 816 ++++++ MdePkg/Include/Protocol/AbsolutePointer.h | 246 ++ MdePkg/Include/Protocol/AcpiTable.h | 129 + MdePkg/Include/Protocol/Arp.h | 259 ++ MdePkg/Include/Protocol/AuthenticationInfo.h | 125 + MdePkg/Include/Protocol/Bds.h | 87 + MdePkg/Include/Protocol/Bis.h | 418 ++++ MdePkg/Include/Protocol/BlockIo.h | 173 ++ .../Protocol/BusSpecificDriverOverride.h | 66 + MdePkg/Include/Protocol/ComponentName.h | 123 + MdePkg/Include/Protocol/ComponentName2.h | 165 ++ MdePkg/Include/Protocol/Cpu.h | 331 +++ MdePkg/Include/Protocol/DebugPort.h | 141 ++ MdePkg/Include/Protocol/DebugSupport.h | 660 +++++ MdePkg/Include/Protocol/Decompress.h | 121 + MdePkg/Include/Protocol/DeviceIo.h | 222 ++ .../DevicePath.h} | 99 +- MdePkg/Include/Protocol/DevicePathFromText.h | 75 + MdePkg/Include/Protocol/DevicePathToText.h | 88 + MdePkg/Include/Protocol/DevicePathUtilities.h | 197 ++ MdePkg/Include/Protocol/Dhcp4.h | 442 ++++ MdePkg/Include/Protocol/DiskIo.h | 98 + MdePkg/Include/Protocol/DriverBinding.h | 111 + MdePkg/Include/Protocol/DriverConfiguration.h | 203 ++ MdePkg/Include/Protocol/DriverDiagnostics.h | 134 + .../Protocol/DriverSupportedEfiVersion.h | 52 + MdePkg/Include/Protocol/Ebc.h | 148 ++ MdePkg/Include/Protocol/EdidActive.h | 34 + MdePkg/Include/Protocol/EdidDiscovered.h | 35 + MdePkg/Include/Protocol/EdidOverride.h | 66 + MdePkg/Include/Protocol/FirmwareVolume2.h | 787 ++++++ MdePkg/Include/Protocol/FirmwareVolumeBlock.h | 428 ++++ MdePkg/Include/Protocol/FormBrowser.h | 207 ++ MdePkg/Include/Protocol/GraphicsOutput.h | 194 ++ .../Include/Protocol/GuidedSectionExtaction.h | 144 ++ MdePkg/Include/Protocol/Hash.h | 149 ++ MdePkg/Include/Protocol/HiiConfigAccess.h | 233 ++ MdePkg/Include/Protocol/HiiConfigRouting.h | 363 +++ MdePkg/Include/Protocol/HiiDatabase.h | 2209 +++++++++++++++++ MdePkg/Include/Protocol/HiiFont.h | 527 ++++ MdePkg/Include/Protocol/HiiImage.h | 382 +++ MdePkg/Include/Protocol/HiiString.h | 303 +++ MdePkg/Include/Protocol/IP4.h | 414 +++ MdePkg/Include/Protocol/IP4Config.h | 123 + MdePkg/Include/Protocol/IScsiInitatorName.h | 92 + MdePkg/Include/Protocol/LoadFile.h | 83 + MdePkg/Include/Protocol/ManagedNetwork.h | 316 +++ MdePkg/Include/Protocol/Metronome.h | 98 + MdePkg/Include/Protocol/MonotonicCounter.h | 33 + MdePkg/Include/Protocol/Mtftp4.h | 507 ++++ .../Protocol/NetworkInterfaceIdentifier.h | 92 + MdePkg/Include/Protocol/Pcd.h | 860 +++++++ MdePkg/Include/Protocol/PciIo.h | 503 ++++ MdePkg/Include/Protocol/PciRootBridgeIo.h | 384 +++ .../Include/Protocol/PlatformDriverOverride.h | 135 + .../Protocol/PlatformToDriverConfiguration.h | 397 +++ MdePkg/Include/Protocol/PxeBaseCode.h | 622 +++++ MdePkg/Include/Protocol/PxeBaseCodeCallBack.h | 94 + MdePkg/Include/Protocol/RealTimeClock.h | 41 + MdePkg/Include/Protocol/Reset.h | 38 + MdePkg/Include/Protocol/Runtime.h | 126 + MdePkg/Include/Protocol/ScsiIo.h | 233 ++ MdePkg/Include/Protocol/ScsiPassThru.h | 312 +++ MdePkg/Include/Protocol/ScsiPassThruExt.h | 331 +++ MdePkg/Include/Protocol/Security.h | 132 + MdePkg/Include/Protocol/SecurityPolicy.h | 31 + MdePkg/Include/Protocol/SerialIo.h | 266 ++ MdePkg/Include/Protocol/ServiceBinding.h | 74 + MdePkg/Include/Protocol/SimpleFileSystem.h | 328 +++ MdePkg/Include/Protocol/SimpleNetwork.h | 580 +++++ MdePkg/Include/Protocol/SimplePointer.h | 97 + MdePkg/Include/Protocol/SimpleTextIn.h | 125 + MdePkg/Include/Protocol/SimpleTextInEx.h | 318 +++ MdePkg/Include/Protocol/SimpleTextOut.h | 390 +++ MdePkg/Include/Protocol/SmbusHc.h | 311 +++ MdePkg/Include/Protocol/StatusCode.h | 77 + MdePkg/Include/Protocol/TapeIo.h | 236 ++ MdePkg/Include/Protocol/Tcp4.h | 510 ++++ MdePkg/Include/Protocol/Timer.h | 211 ++ MdePkg/Include/Protocol/Udp4.h | 364 +++ MdePkg/Include/Protocol/UgaDraw.h | 168 ++ MdePkg/Include/Protocol/UgaIo.h | 237 ++ MdePkg/Include/Protocol/UnicodeCollation.h | 183 ++ MdePkg/Include/Protocol/Usb2HostController.h | 546 ++++ MdePkg/Include/Protocol/UsbHostController.h | 447 ++++ MdePkg/Include/Protocol/UsbIo.h | 420 ++++ MdePkg/Include/Protocol/Variable.h | 39 + MdePkg/Include/Protocol/VariableWrite.h | 38 + MdePkg/Include/Protocol/WatchdogTimer.h | 165 ++ MdePkg/Include/Uefi/UefiBaseType.h | 23 + .../Uefi/UefiInternalFormRepresentation.h | 12 + MdePkg/Include/Uefi/UefiSpec.h | 26 +- 92 files changed, 23936 insertions(+), 42 deletions(-) create mode 100644 MdePkg/Include/Protocol/AbsolutePointer.h create mode 100644 MdePkg/Include/Protocol/AcpiTable.h create mode 100644 MdePkg/Include/Protocol/Arp.h create mode 100644 MdePkg/Include/Protocol/AuthenticationInfo.h create mode 100644 MdePkg/Include/Protocol/Bds.h create mode 100644 MdePkg/Include/Protocol/Bis.h create mode 100644 MdePkg/Include/Protocol/BlockIo.h create mode 100644 MdePkg/Include/Protocol/BusSpecificDriverOverride.h create mode 100644 MdePkg/Include/Protocol/ComponentName.h create mode 100644 MdePkg/Include/Protocol/ComponentName2.h create mode 100644 MdePkg/Include/Protocol/Cpu.h create mode 100644 MdePkg/Include/Protocol/DebugPort.h create mode 100644 MdePkg/Include/Protocol/DebugSupport.h create mode 100644 MdePkg/Include/Protocol/Decompress.h create mode 100644 MdePkg/Include/Protocol/DeviceIo.h rename MdePkg/Include/{Uefi/UefiDevicePath.h => Protocol/DevicePath.h} (75%) create mode 100644 MdePkg/Include/Protocol/DevicePathFromText.h create mode 100644 MdePkg/Include/Protocol/DevicePathToText.h create mode 100644 MdePkg/Include/Protocol/DevicePathUtilities.h create mode 100644 MdePkg/Include/Protocol/Dhcp4.h create mode 100644 MdePkg/Include/Protocol/DiskIo.h create mode 100644 MdePkg/Include/Protocol/DriverBinding.h create mode 100644 MdePkg/Include/Protocol/DriverConfiguration.h create mode 100644 MdePkg/Include/Protocol/DriverDiagnostics.h create mode 100644 MdePkg/Include/Protocol/DriverSupportedEfiVersion.h create mode 100644 MdePkg/Include/Protocol/Ebc.h create mode 100644 MdePkg/Include/Protocol/EdidActive.h create mode 100644 MdePkg/Include/Protocol/EdidDiscovered.h create mode 100644 MdePkg/Include/Protocol/EdidOverride.h create mode 100644 MdePkg/Include/Protocol/FirmwareVolume2.h create mode 100644 MdePkg/Include/Protocol/FirmwareVolumeBlock.h create mode 100644 MdePkg/Include/Protocol/FormBrowser.h create mode 100644 MdePkg/Include/Protocol/GraphicsOutput.h create mode 100644 MdePkg/Include/Protocol/GuidedSectionExtaction.h create mode 100644 MdePkg/Include/Protocol/Hash.h create mode 100644 MdePkg/Include/Protocol/HiiConfigAccess.h create mode 100644 MdePkg/Include/Protocol/HiiConfigRouting.h create mode 100644 MdePkg/Include/Protocol/HiiDatabase.h create mode 100644 MdePkg/Include/Protocol/HiiFont.h create mode 100644 MdePkg/Include/Protocol/HiiImage.h create mode 100644 MdePkg/Include/Protocol/HiiString.h create mode 100644 MdePkg/Include/Protocol/IP4.h create mode 100644 MdePkg/Include/Protocol/IP4Config.h create mode 100644 MdePkg/Include/Protocol/IScsiInitatorName.h create mode 100644 MdePkg/Include/Protocol/LoadFile.h create mode 100644 MdePkg/Include/Protocol/ManagedNetwork.h create mode 100644 MdePkg/Include/Protocol/Metronome.h create mode 100644 MdePkg/Include/Protocol/MonotonicCounter.h create mode 100644 MdePkg/Include/Protocol/Mtftp4.h create mode 100644 MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h create mode 100644 MdePkg/Include/Protocol/Pcd.h create mode 100644 MdePkg/Include/Protocol/PciIo.h create mode 100644 MdePkg/Include/Protocol/PciRootBridgeIo.h create mode 100644 MdePkg/Include/Protocol/PlatformDriverOverride.h create mode 100644 MdePkg/Include/Protocol/PlatformToDriverConfiguration.h create mode 100644 MdePkg/Include/Protocol/PxeBaseCode.h create mode 100644 MdePkg/Include/Protocol/PxeBaseCodeCallBack.h create mode 100644 MdePkg/Include/Protocol/RealTimeClock.h create mode 100644 MdePkg/Include/Protocol/Reset.h create mode 100644 MdePkg/Include/Protocol/Runtime.h create mode 100644 MdePkg/Include/Protocol/ScsiIo.h create mode 100644 MdePkg/Include/Protocol/ScsiPassThru.h create mode 100644 MdePkg/Include/Protocol/ScsiPassThruExt.h create mode 100644 MdePkg/Include/Protocol/Security.h create mode 100644 MdePkg/Include/Protocol/SecurityPolicy.h create mode 100644 MdePkg/Include/Protocol/SerialIo.h create mode 100644 MdePkg/Include/Protocol/ServiceBinding.h create mode 100644 MdePkg/Include/Protocol/SimpleFileSystem.h create mode 100644 MdePkg/Include/Protocol/SimpleNetwork.h create mode 100644 MdePkg/Include/Protocol/SimplePointer.h create mode 100644 MdePkg/Include/Protocol/SimpleTextIn.h create mode 100644 MdePkg/Include/Protocol/SimpleTextInEx.h create mode 100644 MdePkg/Include/Protocol/SimpleTextOut.h create mode 100644 MdePkg/Include/Protocol/SmbusHc.h create mode 100644 MdePkg/Include/Protocol/StatusCode.h create mode 100644 MdePkg/Include/Protocol/TapeIo.h create mode 100644 MdePkg/Include/Protocol/Tcp4.h create mode 100644 MdePkg/Include/Protocol/Timer.h create mode 100644 MdePkg/Include/Protocol/Udp4.h create mode 100644 MdePkg/Include/Protocol/UgaDraw.h create mode 100644 MdePkg/Include/Protocol/UgaIo.h create mode 100644 MdePkg/Include/Protocol/UnicodeCollation.h create mode 100644 MdePkg/Include/Protocol/Usb2HostController.h create mode 100644 MdePkg/Include/Protocol/UsbHostController.h create mode 100644 MdePkg/Include/Protocol/UsbIo.h create mode 100644 MdePkg/Include/Protocol/Variable.h create mode 100644 MdePkg/Include/Protocol/VariableWrite.h create mode 100644 MdePkg/Include/Protocol/WatchdogTimer.h diff --git a/MdePkg/Include/Ipf/PalApi.h b/MdePkg/Include/Ipf/PalApi.h index 0afa3d361f..4f079ad156 100644 --- a/MdePkg/Include/Ipf/PalApi.h +++ b/MdePkg/Include/Ipf/PalApi.h @@ -28,4 +28,820 @@ typedef struct { UINT64 r11; } PAL_CALL_RETURN; + + +// +// CacheType of PAL_CACHE_FLUSH. +// +#define PAL_CACHE_FLUSH_INSTRUCTION_ALL 1 +#define PAL_CACHE_FLUSH_DATA_ALL 2 +#define PAL_CACHE_FLUSH_ALL 3 +#define PAL_CACHE_FLUSH_SYNC_TO_DATA 4 + + +// +// Bitmask of Opearation of PAL_CACHE_FLUSH. +// +#define PAL_CACHE_FLUSH_INVIDED_LINES BIT0 +#define PAL_CACHE_FLUSH_PROBE_INTERRUPT BIT1 + +/** + + Flush the instruction or data caches. It is required by IPF. + The PAL procedure supports the Static Registers calling + convention. It could be called at virtual mode and physical + mode. + + @param Index Index of PAL_CACHE_FLUSH within the + list of PAL procedures. + + @param CacheType Unsigned 64-bit integer indicating + which cache to flush. + + @param Operation Formatted bit vector indicating the + operation of this call. + + @param ProgressIndicator Unsigned 64-bit integer specifying + the starting position of the flush + operation. + + @return R9 Unsigned 64-bit integer specifying the vector + number of the pending interrupt. + + @return R10 Unsigned 64-bit integer specifying the + starting position of the flush operation. + + @return R11 Unsigned 64-bit integer specifying the vector + number of the pending interrupt. + + @return Status 2 - Call completed without error, but a PMI + was taken during the execution of this + procedure. + + @return Status 1 - Call has not completed flushing due to + a pending interrupt. + + @return Status 0 - Call completed without error + + @return Status -2 - Invalid argument + + @return Status -3 - Call completed with error + +**/ +#define PAL_CACHE_FLUSH 1 + + +// +// Attributes of PAL_CACHE_CONFIG_INFO1 +// +#define PAL_CACHE_ATTR_WT 0 +#define PAL_CACHE_ATTR_WB 1 + +// +// PAL_CACHE_CONFIG_INFO1.StoreHint +// +#define PAL_CACHE_STORE_TEMPORAL 0 +#define PAL_CACHE_STORE_NONE_TEMPORAL 3 + +// +// PAL_CACHE_CONFIG_INFO1.StoreHint +// +#define PAL_CACHE_STORE_TEMPORAL_LVL_1 0 +#define PAL_CACHE_STORE_NONE_TEMPORAL_LVL_ALL 3 + +// +// PAL_CACHE_CONFIG_INFO1.StoreHint +// +#define PAL_CACHE_LOAD_TEMPORAL_LVL_1 0 +#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_1 1 +#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_ALL 3 + +// +// Detail the characteristics of a given processor controlled +// cache in the cache hierarchy. +// +typedef struct { + UINT64 IsUnified : 1; + UINT64 Attributes : 2; + UINT64 Associativity:8; + UINT64 LineSize:8; + UINT64 Stride:8; + UINT64 StoreLatency:8; + UINT64 StoreHint:8; + UINT64 LoadHint:8; +} PAL_CACHE_INFO_RETURN1; + +// +// Detail the characteristics of a given processor controlled +// cache in the cache hierarchy. +// +typedef struct { + UINT64 CacheSize:32; + UINT64 AliasBoundary:8; + UINT64 TagLsBits:8; + UINT64 TagMsBits:8; +} PAL_CACHE_INFO_RETURN2; + +/** + + Return detailed instruction or data cache information. It is + required by IPF. The PAL procedure supports the Static + Registers calling convention. It could be called at virtual + mode and physical mode. + + @param Index Index of PAL_CACHE_INFO within the list of + PAL procedures. + + @param CacheLevel Unsigned 64-bit integer specifying the + level in the cache hierarchy for which + information is requested. This value must + be between 0 and one less than the value + returned in the cache_levels return value + from PAL_CACHE_SUMMARY. + + @param CacheType Unsigned 64-bit integer with a value of 1 + for instruction cache and 2 for data or + unified cache. All other values are + reserved. + + @param Reserved Should be 0. + + + @return R9 Detail the characteristics of a given + processor controlled cache in the cache + hierarchy. See PAL_CACHE_INFO_RETURN1. + + @return R10 Detail the characteristics of a given + processor controlled cache in the cache + hierarchy. See PAL_CACHE_INFO_RETURN2. + + @return R11 Reserved with 0. + + + @return Status 0 - Call completed without error + + @return Status -2 - Invalid argument + + @return Status -3 - Call completed with error + +**/ +#define PAL_CACHE_INFO 2 + + + +// +// Level of PAL_CACHE_INIT. +// +#define PAL_CACHE_INIT_ALL 0xffffffffffffffffULL + +// +// Restrict of PAL_CACHE_INIT. +// +#define PAL_CACHE_INIT_NO_RESTRICT 0 +#define PAL_CACHE_INIT_RESTRICTED 1 + +/** + + Initialize the instruction or data caches. It is required by + IPF. The PAL procedure supports the Static Registers calling + convention. It could be called at physical mode. + + @param Index Index of PAL_CACHE_INIT within the list of PAL + procedures. + + @param Level Unsigned 64-bit integer containing the level of + cache to initialize. If the cache level can be + initialized independently, only that level will + be initialized. Otherwise + implementation-dependent side-effects will + occur. + + @param CacheType Unsigned 64-bit integer with a value of 1 to + initialize the instruction cache, 2 to + initialize the data cache, or 3 to + initialize both. All other values are + reserved. + + @param Restrict Unsigned 64-bit integer with a value of 0 or + 1. All other values are reserved. If + restrict is 1 and initializing the specified + level and cache_type of the cache would + cause side-effects, PAL_CACHE_INIT will + return -4 instead of initializing the cache. + + + @return Status 0 - Call completed without error + + @return Status -2 - Invalid argument + + @return Status -3 - Call completed with error. + + @return Status -4 - Call could not initialize the specified + level and cache_type of the cache without + side-effects and restrict was 1. + +**/ +#define PAL_CACHE_INIT 3 + + +// +// PAL_CACHE_PROTECTION.Method. +// +#define PAL_CACHE_PROTECTION_NONE_PROTECT 0 +#define PAL_CACHE_PROTECTION_ODD_PROTECT 1 +#define PAL_CACHE_PROTECTION_EVEN_PROTECT 2 +#define PAL_CACHE_PROTECTION_ECC_PROTECT 3 + + + +// +// PAL_CACHE_PROTECTION.TagOrData. +// +#define PAL_CACHE_PROTECTION_PROTECT_DATA 0 +#define PAL_CACHE_PROTECTION_PROTECT_TAG 1 +#define PAL_CACHE_PROTECTION_PROTECT_TAG_ANDTHEN_DATA 2 +#define PAL_CACHE_PROTECTION_PROTECT_DATA_ANDTHEN_TAG 3 + +// +// 32-bit protection information structures. +// +typedef struct { + UINT32 DataBits:8; + UINT32 TagProtLsb:6; + UINT32 TagProtMsb:6; + UINT32 ProtBits:6; + UINT32 Method:4; + UINT32 TagOrData:2; +} PAL_CACHE_PROTECTION; + +/** + + Return instruction or data cache protection information. It is + required by IPF. The PAL procedure supports the Static + Registers calling convention. It could be called at physical + mode and Virtual mode. + + @param Index Index of PAL_CACHE_PROT_INFO within the list of + PAL procedures. + + @param CacheLevel Unsigned 64-bit integer specifying the level + in the cache hierarchy for which information + is requested. This value must be between 0 + and one less than the value returned in the + cache_levels return value from + PAL_CACHE_SUMMARY. + + @param CacheType Unsigned 64-bit integer with a value of 1 + for instruction cache and 2 for data or + unified cache. All other values are + reserved. + + @return R9 Detail the characteristics of a given + processor controlled cache in the cache + hierarchy. See PAL_CACHE_PROTECTION[0..1]. + + @return R10 Detail the characteristics of a given + processor controlled cache in the cache + hierarchy. See PAL_CACHE_PROTECTION[2..3]. + + @return R11 Detail the characteristics of a given + processor controlled cache in the cache + hierarchy. See PAL_CACHE_PROTECTION[4..5]. + + + @return Status 0 - Call completed without error + + @return Status -2 - Invalid argument + + @return Status -3 - Call completed with error. + +**/ +#define PAL_CACHE_PROT_INFO 38 + + + + + + + +/// +// ????????? + + + +/** + + Returns information on which logical processors share caches. + It is optional. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_CACHE_SHARED_INFO 43 + + +/** + + Return a summary of the cache hierarchy. It is required by + IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_CACHE_SUMMARY 4 + +/** + + Return a list of supported memory attributes.. It is required + by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_MEM_ATTRIB 5 + +/** + + Used in architected sequence to transition pages from a + cacheable, speculative attribute to an uncacheable attribute. + It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_PREFETCH_VISIBILITY 41 + +/** + + Return information needed for ptc.e instruction to purge + entire TC. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_PTCE_INFO 6 + +/** + + Return detailed information about virtual memory features + supported in the processor. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_VM_INFO 7 + + +/** + + Return virtual memory TC and hardware walker page sizes + supported in the processor. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_VM_PAGE_SIZE 34 + +/** + + Return summary information about virtual memory features + supported in the processor. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_VM_SUMMARY 8 + +/** + + Read contents of a translation register. It is required by + IPF. + + @param CallingConvention Stacked Register + + @param Mode Physical + +**/ +#define PAL_VM_TR_READ 261 + +/** + + Return configurable processor bus interface features and their + current settings. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_BUS_GET_FEATURES 9 + + +/** + + Enable or disable configurable features in processor bus + interface. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_BUS_SET_FEATURES 10 + + +/** + + Return the number of instruction and data breakpoint + registers. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_DEBUG_INFO 11 + +/** + + Return the fixed component of a processor¡¯s directed address. + It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_FIXED_ADDR 12 + +/** + + Return the frequency of the output clock for use by the + platform, if generated by the processor. It is optinal. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_FREQ_BASE 13 + +/** + + Return ratio of processor, bus, and interval time counter to + processor input clock or output clock for platform use, if + generated by the processor. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_FREQ_RATIOS 14 + +/** + + Return information on which logical processors map to a + physical processor die. It is optinal. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_LOGICAL_TO_PHYSICAL 42 + +/** + + Return the number and type of performance monitors. It is + required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_PERF_MON_INFO 15 + +/** + + Specify processor interrupt block address and I/O port space + address. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_PLATFORM_ADDR 16 + + +/** + + Return configurable processor features and their current + setting. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_PROC_GET_FEATURES 17 + + +/** + + Enable or disable configurable processor features. It is + required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_PROC_SET_FEATURES 18 + +/** + + Return AR and CR register information. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_REGISTER_INFO 39 + +/** + + Return RSE information. It is required by + IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_RSE_INFO 19 + +/** + + Return version of PAL code. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_VERSION 20 + +/** + + Clear all error information from processor error logging + registers. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_MC_CLEAR_LOG 21 + +/** + + Ensure that all operations that could cause an MCA have + completed. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_MC_DRAIN 22 + +/** + + Return Processor Dynamic State for logging by SAL. It is + optional. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_MC_DYNAMIC_STATE 24 + +/** + + Return Processor Machine Check Information and Processor + Static State for logging by SAL. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_MC_ERROR_INFO 25 Req. Static Both + +/** + + Set/Reset Expected Machine Check Indicator. It is required by + IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_MC_EXPECTED 23 + +/** + + Register min-state save area with PAL for machine checks and + inits. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_MC_REGISTER_MEM 27 + +/** + + Restore minimal architected state and return to interrupted + process. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_MC_RESUME 26 + +/** + + Enter the low-power HALT state or an implementation-dependent + low-power state. It is optinal. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_HALT 28 + + +/** + + Return the low power capabilities of the processor. It is + required by IPF. + + @param CallingConvention Stacked Register + + @param Mode Physical/Virtual + +**/ +#define PAL_HALT_INFO 257 + + +/** + + Enter the low power LIGHT HALT state. It is required by + IPF. + + @param CallingConvention Static Registers + + @param Mode Physical/Virtual + +**/ +#define PAL_HALT_LIGHT 29 + +/** + + Initialize tags and data of a cache line for processor + testing. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_CACHE_LINE_INIT 31 + +/** + + Read tag and data of a cache line for diagnostic testing. It + is optional. + + @param CallingConvention Satcked Register + + @param Mode Physical + +**/ +#define PAL_CACHE_READ 259 + +/** + + Write tag and data of a cache for diagnostic testing. It is + optional. + + @param CallingConvention Satcked Registers + + @param Mode Physical + +**/ +#define PAL_CACHE_WRITE 260 + +/** + + Returns alignment and size requirements needed for the memory + buffer passed to the PAL_TEST_PROC procedure as well as + information on self-test control words for the processor self + tests. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_TEST_INFO 37 + +/** + + Perform late processor self test. It is required by + IPF. + + @param CallingConvention Stacked Registers + + @param Mode Physical + +**/ +#define PAL_TEST_PROC 258 + +/** + + Return information needed to relocate PAL procedures and PAL + PMI code to memory. It is required by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_COPY_INFO 30 + +/** + + Relocate PAL procedures and PAL PMI code to memory. It is + required by IPF. + + @param CallingConvention Stacked Registers + + @param Mode Physical + +**/ +#define PAL_COPY_PAL 256 + +/** + + Enter IA-32 System environment. It is optional. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_ENTER_IA_32_ENV 33 + +/** + + Register PMI memory entrypoints with processor. It is required + by IPF. + + @param CallingConvention Static Registers + + @param Mode Physical + +**/ +#define PAL_PMI_ENTRYPOINT 32 + + + #endif diff --git a/MdePkg/Include/Protocol/AbsolutePointer.h b/MdePkg/Include/Protocol/AbsolutePointer.h new file mode 100644 index 0000000000..df90fc1f6c --- /dev/null +++ b/MdePkg/Include/Protocol/AbsolutePointer.h @@ -0,0 +1,246 @@ +/** @file + The file provides services that allow information about a + absolute pointer device to be retrieved. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: AbsolutePointer.h + +**/ + +#ifndef __ABSOLUTE_POINTER_H__ +#define __ABSOLUTE_POINTER_H__ + + +#define EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \ + { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } } + + +typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL EFI_ABSOLUTE_POINTER_PROTOCOL; + + +//******************************************************* +// EFI_ABSOLUTE_POINTER_MODE +//******************************************************* + + +/** + The following data values in the EFI_ABSOLUTE_POINTER_MODE + interface are read-only and are changed by using the appropriate + interface functions: + Attributes The following bits are set as needed (or'd + together) to indicate the capabilities of the device + supported. The remaining bits are undefined and should be + returned as 0. + + + @param AbsoluteMinX The Absolute Minimum of the device on the + x-axis. + + @param AbsoluteMinY The Absolute Minimum of the device on the + y axis. + + @param AbsoluteMinZ The Absolute Minimum of the device on the + z-axis. + + @param AbsoluteMaxX The Absolute Maximum of the device on the + x-axis. If 0, and the AbsoluteMinX is 0, + then the pointer device does not support a + xaxis. + + @param AbsoluteMaxY The Absolute Maximum of the device on the + y -axis. If 0,, and the AbsoluteMinX is 0, + then the pointer device does not support a + yaxis. + + @param AbsoluteMaxZ The Absolute Maximum of the device on the + z-axis. If 0 , and the AbsoluteMinX is 0, + then the pointer device does not support a + zaxis. + +**/ +typedef struct { + UINT64 AbsoluteMinX; + UINT64 AbsoluteMinY; + UINT64 AbsoluteMinZ; + UINT64 AbsoluteMaxX; + UINT64 AbsoluteMaxY; + UINT64 AbsoluteMaxZ; + UINT32 Attributes; +} EFI_ABSOLUTE_POINTER_MODE; + +// +// If set, indicates this device supports an alternate button input. +// +#define EFI_ABSP_SupportsAltActive 0x00000001 + +// +// If set, indicates this device returns pressure data in parameter CurrentZ. +// +#define EFI_ABSP_SupportsPressureAsZ 0x00000002 + + +/** + This function resets the pointer device hardware. As part of + initialization process, the firmware/device will make a quick + but reasonable attempt to verify that the device is + functioning. If the ExtendedVerification flag is TRUE the + firmware may take an extended amount of time to verify the + device is operating on reset. Otherwise the reset operation is + to occur as quickly as possible. The hardware verification + process is not defined by this specification and is left up to + the platform firmware or driver to implement. + + @param This A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL + instance. + + @param ExtendedVerification Indicates that the driver may + perform a more exhaustive + verification operation of the + device during reset. + + @retval EFI_SUCCESS The device was reset. + + @retval EFI_DEVICE_ERROR The device is not functioning + correctly and could not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ABSOLUTE_POINTER_RESET) ( + IN CONST EFI_ABSOLUTE_POINTER_PROTOCOL *This, + IN CONST BOOLEAN ExtendedVerification +); + + + + +/** + Definitions of bits within ActiveButtons. + + @param EFI_ABSP_TouchActive This bit is set if the touch + sensor is active. + + @param EFI_ABS_AltActive This bit is set if the alt sensor, + such as pen-side button, is + active. +**/ +#define EFI_ABSP_TouchActive 0x00000001 +#define EFI_ABS_AltActive 0x00000002 + + +/** + Definition of EFI_ABSOLUTE_POINTER_STATE. + + @param CurrentX The unsigned position of the activation on the + x axis If the AboluteMinX and the AboluteMaxX + fields of the EFI_ABSOLUTE_POINTER_MODE + structure are both 0, then this pointer device + does not support an x-axis, and this field + must be ignored. + + @param CurrentY The unsigned position of the activation on the + x axis If the AboluteMinY and the AboluteMaxY + fields of the EFI_ABSOLUTE_POINTER_MODE + structure are both 0, then this pointer device + does not support an y-axis, and this field + must be ignored. + + @param CurrentZ The unsigned position of the activation on the + x axis, or the pressure measurement. If the + AboluteMinZ and the AboluteMaxZ fields of the + EFI_ABSOLUTE_POINTER_MODE structure are + both 0, then this pointer device does not + support an z-axis, and this field must be + ignored. + + @param ActiveButtons Bits are set to 1 in this structure item + to indicate that device buttons are + active. + +**/ +typedef struct { + UINT64 CurrentX; + UINT64 CurrentY; + UINT64 CurrentZ; + UINT32 ActiveButtons; +} EFI_ABSOLUTE_POINTER_STATE; + +/** + The GetState() function retrieves the current state of a pointer + device. This includes information on the active state associated + with the pointer device and the current position of the axes + associated with the pointer device. If the state of the pointer + device has not changed since the last call to GetState(), then + EFI_NOT_READY is returned. If the state of the pointer device + has changed since the last call to GetState(), then the state + information is placed in State, and EFI_SUCCESS is returned. If + a device error occurs while attempting to retrieve the state + information, then EFI_DEVICE_ERROR is returned. + + + @param This A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL + instance. + + @param State A pointer to the state information on the + pointer device. + + @retval EFI_SUCCESS The state of the pointer device was + returned in State. + + @retval EFI_NOT_READY The state of the pointer device has not + changed since the last call to GetState(). + + @retval EFI_DEVICE_ERROR A device error occurred while + attempting to retrieve the pointer + device's current state. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE) ( + IN CONST EFI_ABSOLUTE_POINTER_PROTOCOL *This, + IN OUT EFI_ABSOLUTE_POINTER_STATE *State +); + + +/** + The EFI_ABSOLUTE_POINTER_PROTOCOL provides a set of services + for a pointer device that can be used as an input device from an + application written to this specification. The services include + the ability to reset the pointer device, retrieve the state of + the pointer device, and retrieve the capabilities of the pointer + device. In addition certain data items describing the device are + provided. + + + @param Reset Resets the pointer device. + + @param GetState Retrieves the current state of the pointer + device. + + @param WaitForInput Event to use with WaitForEvent() to wait + for input from the pointer device. + @param Mode Pointer to EFI_ABSOLUTE_POINTER_MODE data. + +**/ +struct _EFI_ABSOLUTE_POINTER_PROTOCOL { + EFI_ABSOLUTE_POINTER_RESET Reset; + EFI_ABSOLUTE_POINTER_GET_STATE GetState; + EFI_EVENT WaitForInput; + EFI_ABSOLUTE_POINTER_MODE *Mode; +}; + + +extern EFI_GUID gEfiAbsolutePointerProtocolGuid; + + +#endif + diff --git a/MdePkg/Include/Protocol/AcpiTable.h b/MdePkg/Include/Protocol/AcpiTable.h new file mode 100644 index 0000000000..b1335ef61a --- /dev/null +++ b/MdePkg/Include/Protocol/AcpiTable.h @@ -0,0 +1,129 @@ +/** @file + The file provides the protocol to install or remove an ACPI + table from a platform. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: AcpiTable.h + +**/ + +#ifndef __ACPI_TABLE_H___ +#define __ACPI_TABLE_H___ + +#define EFI_ACPI_TABLE_PROTOCOL_GUID \ + { 0xffe06bdd, 0x6107, 0x46a6, { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c }} + + +typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL; + +/** + + The InstallAcpiTable() function allows a caller to install an + ACPI table. When successful, the table will be linked by the + RSDT/XSDT. AcpiTableBuffer specifies the table to be installed. + InstallAcpiTable() will make a copy of the table and insert the + copy into the RSDT/XSDT. InstallAcpiTable() must insert the new + table at the end of the RSDT/XSDT. To prevent namespace + collision, ACPI tables may be created using UEFI ACPI table + format. See Appendix O. On successful output, TableKey is + initialized with a unique key. Its value may be used in a + subsequent call to UninstallAcpiTable to remove an ACPI table. + If an EFI application is running at the time of this call, the + relevant EFI_CONFIGURATION_TABLE pointer to the RSDT is no + longer considered valid. + + + @param This A pointer to a EFI_ACPI_TABLE_PROTOCOL. + + @param AcpiTableBuffer A pointer to a buffer containing the + ACPI table to be installed. + + @param AcpiTableBufferSize Specifies the size, in bytes, of + the AcpiTableBuffer buffer. + + + @param TableKey Returns a key to refer to the ACPI table. + + @retval EFI_SUCCESS The table was successfully inserted + + @retval EFI_INVALID_PARAMETER Either AcpiTableBuffer is NULL, + TableKey is NULL, or + AcpiTableBufferSize and the size + field embedded in the ACPI table + pointed to by AcpiTableBuffer + are not in sync. + + @retval EFI_OUT_OF_RESOURCES Insufficient resources exist to + complete the request. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ACPI_TABLE_INSTALL_ACPI_TABLE) ( + IN CONST EFI_ACPI_TABLE_PROTOCOL *This, + IN CONST VOID *AcpiTableBuffer, + IN CONST UINTN AcpiTableBufferSize, + OUT UINTN *TableKey +); + + +/** + + The UninstallAcpiTable() function allows a caller to remove an + ACPI table. The routine will remove its reference from the + RSDT/XSDT. A table is referenced by the TableKey parameter + returned from a prior call to InstallAcpiTable(). If an EFI + application is running at the time of this call, the relevant + EFI_CONFIGURATION_TABLE pointer to the RSDT is no longer + considered valid. + + @param This A pointer to a EFI_ACPI_TABLE_PROTOCOL. + + @param TableKey Specifies the table to uninstall. The key was + returned from InstallAcpiTable(). + + @retval EFI_SUCCESS The table was successfully inserted + + @retval EFI_NOT_FOUND TableKey does not refer to a valid key + for a table entry. + + @retval EFI_OUT_OF_RESOURCES Insufficient resources exist to + complete the request. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE) ( + IN CONST EFI_ACPI_TABLE_PROTOCOL *This, + IN CONST UINTN TableKey +); + +/** + The EFI_ACPI_TABLE_PROTOCOL provides the ability for a component + to install and uninstall ACPI tables from a platform. + + + @param InstallAcpiTable Installs an ACPI table into the + system. + + @param UninstallAcpiTable Removes a previously installed ACPI + table from the system. + +**/ +struct _EFI_ACPI_TABLE_PROTOCOL { + EFI_ACPI_TABLE_INSTALL_ACPI_TABLE InstallAcpiTable; + EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE UninstallAcpiTable; +}; + +extern EFI_GUID gEfiAcpiTableProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/Arp.h b/MdePkg/Include/Protocol/Arp.h new file mode 100644 index 0000000000..ddcc740eb4 --- /dev/null +++ b/MdePkg/Include/Protocol/Arp.h @@ -0,0 +1,259 @@ +/** @file + 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: Arp.h + +**/ + +#ifndef __EFI_ARP_PROTOCOL_H__ +#define __EFI_ARP_PROTOCOL_H__ + +#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3 } \ + } + +#define EFI_ARP_PROTOCOL_GUID \ + { \ + 0xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } \ + } + +typedef struct _EFI_ARP_PROTOCOL EFI_ARP_PROTOCOL; + +typedef struct { +UINT32 Size; +BOOLEAN DenyFlag; +BOOLEAN StaticFlag; +UINT16 HwAddressType; +UINT16 SwAddressType; +UINT8 HwAddressLength; +UINT8 SwAddressLength; +} EFI_ARP_FIND_DATA; + +typedef struct { + UINT16 SwAddressType; // Host byte order + UINT8 SwAddressLength; + VOID *StationAddress; // Network byte order + UINT32 EntryTimeOut; + UINT32 RetryCount; + UINT32 RetryTimeOut; +} EFI_ARP_CONFIG_DATA; + + +/** + Assigns a station address (protocol type and network address) to this instance of the ARP cache. + + @param This A pointer to the EFI_ARP_PROTOCOL instance. + @param ConfigData A pointer to the EFI_ARP_CONFIG_DATA structure.Buffer + + @retval EFI_SUCCESS The new station address was successfully registered. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + @retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or + StationAddress is different from the one that is already + registered. + @retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be allocated. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ARP_CONFIGURE) ( + IN EFI_ARP_PROTOCOL *This, + IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL + ) +; + +/** + Inserts an entry to the ARP cache. + + @param This A pointer to the EFI_ARP_PROTOCOL instance. + @param DenyFlag Set to TRUE if this entry is a "deny" entry. Set to FALSE if this + entry is a "normal" entry. + @param TargetSwAddress Pointer to a protocol address to add (or deny). May be set to + NULL if DenyFlag is TRUE. + @param TargetHwAddress Pointer to a hardware address to add (or deny). May be set to + NULL if DenyFlag is TRUE. + @param TimeoutValue Time in 100-ns units that this entry will remain in the ARP + cache. A value of zero means that the entry is permanent. A + nonzero value will override the one given by Configure() if + the entry to be added is dynamic entry. + @param Overwrite If TRUE, the matching cache entry will be overwritten with the + supplied parameters. If FALSE, EFI_ACCESS_DENIED + + @retval EFI_SUCCESS The entry has been added or updated. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + @retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated. + @retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite is not true. + @retval EFI_NOT_STARTED The ARP driver instance has not been configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ARP_ADD) ( + IN EFI_ARP_PROTOCOL *This, + IN BOOLEAN DenyFlag, + IN VOID *TargetSwAddress OPTIONAL, + IN VOID *TargetHwAddress OPTIONAL, + IN UINT32 TimeoutValue, + IN BOOLEAN Overwrite + ) +; + +/** + Locates one or more entries in the ARP cache. + + @param This A pointer to the EFI_ARP_PROTOCOL instance. + @param BySwAddress Set to TRUE to look for matching software protocol addresses. + Set to FALSE to look for matching hardware protocol addresses. + @param AddressBuffer Pointer to address buffer. Set to NULL to match all addresses. + @param EntryLength The size of an entry in the entries buffer. To keep the + EFI_ARP_FIND_DATA structure properly aligned, this field + may be longer than sizeof(EFI_ARP_FIND_DATA) plus + the length of the software and hardware addresses. + @param EntryCount The number of ARP cache entries that are found by the specified criteria. + @param Entries Pointer to the buffer that will receive the ARP cache entries. + @param Refresh Set to TRUE to refresh the timeout value of the matching ARP + cache entry. + + @retval EFI_SUCCESS The requested ARP cache entries were copied into the buffer. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + @retval EFI_NOT_FOUND No matching entries were found. + @retval EFI_NOT_STARTED The ARP driver instance has not been configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ARP_FIND) ( + IN EFI_ARP_PROTOCOL *This, + IN BOOLEAN BySwAddress, + IN VOID *AddressBuffer OPTIONAL, + OUT UINT32 *EntryLength OPTIONAL, + OUT UINT32 *EntryCount OPTIONAL, + OUT EFI_ARP_FIND_DATA **Entries OPTIONAL, + IN BOOLEAN Refresh + ) +; + + +/** + Removes entries from the ARP cache. + + @param This A pointer to the EFI_ARP_PROTOCOL instance. + @param BySwAddress Set to TRUE to delete matching protocol addresses. + Set to FALSE to delete matching hardware addresses. + @param AddressBuffer Pointer to the address buffer that is used as a key to look for the + cache entry. Set to NULL to delete all entries. + + @retval EFI_SUCCESS The entry was removed from the ARP cache. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_FOUND The specified deletion key was not found. + @retval EFI_NOT_STARTED The ARP driver instance has not been configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ARP_DELETE) ( + IN EFI_ARP_PROTOCOL *This, + IN BOOLEAN BySwAddress, + IN VOID *AddressBuffer OPTIONAL + ) +; + +/** + Removes all dynamic ARP cache entries that were added by this interface. + + @param This A pointer to the EFI_ARP_PROTOCOL instance. + + @retval EFI_SUCCESS The cache has been flushed. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_FOUND There are no matching dynamic cache entries. + @retval EFI_NOT_STARTED The ARP driver instance has not been configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ARP_FLUSH) ( + IN EFI_ARP_PROTOCOL *This + ) +; + +/** + Starts an ARP request session. + + @param This A pointer to the EFI_ARP_PROTOCOL instance. + @param TargetSwAddress Pointer to the protocol address to resolve. + @param ResolvedEvent Pointer to the event that will be signaled when the address is + resolved or some error occurs. + @param TargetHwAddress Pointer to the buffer for the resolved hardware address in + network byte order. The buffer must be large enough to hold the + resulting hardware address. TargetHwAddress must not be + NULL. + + @retval EFI_SUCCESS The data was copied from the ARP cache into the + TargetHwAddress buffer. + @retval EFI_INVALID_PARAMETER This or TargetHwAddress is NULL. + @retval EFI_ACCESS_DENIED The requested address is not present in the normal ARP cache but + is present in the deny address list. Outgoing traffic to that address is + forbidden. + @retval EFI_NOT_STARTED The ARP driver instance has not been configured. + @retval EFI_NOT_READY The request has been started and is not finished. + @retval EFI_UNSUPPORTED The requested conversion is not supported in this implementation or + configuration. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ARP_REQUEST) ( + IN EFI_ARP_PROTOCOL *This, + IN VOID *TargetSwAddress OPTIONAL, + IN EFI_EVENT ResolvedEvent OPTIONAL, + OUT VOID *TargetHwAddress + ) +; + +/** + Cancels an ARP request session. + + @param This A pointer to the EFI_ARP_PROTOCOL instance. + @param TargetSwAddress Pointer to the protocol address in previous request session. + @param ResolvedEvent Pointer to the event that is used as the notification event in + previous request session. + + @retval EFI_SUCCESS The pending request session(s) is/are aborted and corresponding + event(s) is/are signaled. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + @retval EFI_NOT_STARTED The ARP driver instance has not been configured. + @retval EFI_NOT_FOUND The request is not issued by + EFI_ARP_PROTOCOL.Request(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ARP_CANCEL) ( + IN EFI_ARP_PROTOCOL *This, + IN VOID *TargetSwAddress OPTIONAL, + IN EFI_EVENT ResolvedEvent OPTIONAL + ) +; + +struct _EFI_ARP_PROTOCOL { + EFI_ARP_CONFIGURE Configure; + EFI_ARP_ADD Add; + EFI_ARP_FIND Find; + EFI_ARP_DELETE Delete; + EFI_ARP_FLUSH Flush; + EFI_ARP_REQUEST Request; + EFI_ARP_CANCEL Cancel; +}; + + +extern EFI_GUID gEfiArpServiceBindingProtocolGuid; +extern EFI_GUID gEfiArpProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/AuthenticationInfo.h b/MdePkg/Include/Protocol/AuthenticationInfo.h new file mode 100644 index 0000000000..f80dbf362b --- /dev/null +++ b/MdePkg/Include/Protocol/AuthenticationInfo.h @@ -0,0 +1,125 @@ +/** @file + EFI_AUTHENTICATION_INFO_PROTOCOL as defined in UEFI 2.0. + This protocol is used on any device handle to obtain authentication information + associated with the physical or logical device. + + 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: AuthenticationInfo.h + +**/ + +#ifndef __AUTHENTICATION_INFO_H__ +#define __AUTHENTICATION_INFO_H__ + +#define EFI_AUTHENTICATION_INFO_PROTOCOL_GUID \ + { \ + 0x7671d9d0, 0x53db, 0x4173, {0xaa, 0x69, 0x23, 0x27, 0xf2, 0x1f, 0x0b, 0xc7 } \ + } + +#define EFI_AUTHENTICATION_CHAP_RADIUS_GUID \ + { \ + 0xd6062b50, 0x15ca, 0x11da, {0x92, 0x19, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \ + } + +#define EFI_AUTHENTICATION_CHAP_LOCAL_GUID \ + { \ + 0xc280c73e, 0x15ca, 0x11da, {0xb0, 0xca, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \ + } + +typedef struct _EFI_AUTHENTICATION_INFO_PROTOCOL EFI_AUTHENTICATION_INFO_PROTOCOL; + +typedef struct { + EFI_GUID Guid; + UINT16 Length; +} AUTH_NODE_HEADER; + +typedef struct { + AUTH_NODE_HEADER Header; + EFI_IPv6_ADDRESS RadiusIpAddr; // IPv4 or IPv6 address + UINT16 Reserved; + EFI_IPv6_ADDRESS NasIpAddr; // IPv4 or IPv6 address + UINT16 NasSecretLength; + UINT8 *NasSecret; + UINT16 ChapSecretLength; + UINT8 *ChapSecret; + UINT16 ChapNameLength; + UINT8 *ChapName; +} CHAP_RADIUS_AUTH_NODE; + +typedef struct { + AUTH_NODE_HEADER Header; + UINT16 Reserved; + UINT16 UserSecretLength; + UINT8 *UserSecret; + UINT16 UserNameLength; + UINT8 *UserName; + UINT16 ChapSecretLength; + UINT8 *ChapSecret; + UINT16 ChapNameLength; + UINT8 *ChapName; +} CHAP_LOCAL_AUTH_NODE; + +/** + Retrieves the Authentication information associated with a particular controller handle. + + @param This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL + @param ControllerHandle Handle to the Controller + @param Buffer Pointer to the authentication information. + + @retval EFI_SUCCESS Successfully retrieved Authentication information for the given ControllerHandle + @retval EFI_INVALID_PARAMETER No matching Authentication information found for the given ControllerHandle + @retval EFI_DEVICE_ERROR The authentication information could not be retrieved due to a + hardware error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_AUTHENTICATION_PROTOCOL_INFO_GET) ( + IN EFI_AUTHENTICATION_INFO_PROTOCOL *This, + IN EFI_HANDLE *ControllerHandle, + OUT VOID *Buffer + ) +; + +/** + Set the Authentication information for a given controller handle. + + @param This Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL + @param ControllerHandle Handle to the Controller + @param Buffer Pointer to the authentication information. + + @retval EFI_SUCCESS Successfully set Authentication information for the given ControllerHandle + @retval EFI_UNSUPPORTED If the platform policies do not allow setting of the Authentication + information. + @retval EFI_DEVICE_ERROR The authentication information could not be configured due to a + hardware error. + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_AUTHENTICATION_PROTOCOL_INFO_SET) ( + IN EFI_AUTHENTICATION_INFO_PROTOCOL *This, + IN EFI_HANDLE *ControllerHandle, + IN VOID *Buffer + ) +; + +struct _EFI_AUTHENTICATION_INFO_PROTOCOL { + EFI_AUTHENTICATION_PROTOCOL_INFO_GET Get; + EFI_AUTHENTICATION_PROTOCOL_INFO_SET Set; +}; + +extern EFI_GUID gEfiAuthenticationInfoProtocolGuid; +extern EFI_GUID gEfiAuthenticationChapRadiusGuid; +extern EFI_GUID gEfiAuthenticationChapLocalGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Bds.h b/MdePkg/Include/Protocol/Bds.h new file mode 100644 index 0000000000..d060eb9f57 --- /dev/null +++ b/MdePkg/Include/Protocol/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/Protocol/Bis.h b/MdePkg/Include/Protocol/Bis.h new file mode 100644 index 0000000000..37d1952c17 --- /dev/null +++ b/MdePkg/Include/Protocol/Bis.h @@ -0,0 +1,418 @@ +/** @file + This file defines the BIS 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: Bis.h + +**/ + +#ifndef __BIS_H__ +#define __BIS_H__ + +#define EFI_BIS_PROTOCOL_GUID \ + { \ + 0x0b64aab0, 0x5429, 0x11d4, {0x98, 0x16, 0x00, 0xa0, 0xc9, 0x1f, 0xad, 0xcf } \ + } + +typedef struct _EFI_BIS_PROTOCOL EFI_BIS_PROTOCOL; + + +// +// Basic types +// +typedef VOID *BIS_APPLICATION_HANDLE; +typedef UINT16 BIS_ALG_ID; +typedef UINT32 BIS_CERT_ID; + +// +// EFI_BIS_DATA type. +// +// EFI_BIS_DATA instances obtained from BIS must be freed by calling Free( ). +// +typedef struct { + UINT32 Length; // Length of Data in 8 bit bytes. + UINT8 *Data; // 32 Bit Flat Address of data. +} EFI_BIS_DATA; + +// +// EFI_BIS_VERSION type. +// +typedef struct { + UINT32 Major; // BIS Interface version number. + UINT32 Minor; // Build number. +} EFI_BIS_VERSION; + +// +// ----------------------------------------------------// +// Use these values to initialize EFI_BIS_VERSION.Major +// and to interpret results of Initialize. +// ----------------------------------------------------// +// +#define BIS_CURRENT_VERSION_MAJOR BIS_VERSION_1 +#define BIS_VERSION_1 1 + +// +// EFI_BIS_SIGNATURE_INFO type. +// +typedef struct { + BIS_CERT_ID CertificateID; // Truncated hash of platform Boot Object + // authorization certificate. + // + BIS_ALG_ID AlgorithmID; // A signature algorithm number. + UINT16 KeyLength; // Length of alg. keys in bits. +} EFI_BIS_SIGNATURE_INFO; + +// +// Currently defined values for EFI_BIS_SIGNATURE_INFO.AlgorithmID. +// The exact numeric values come from +// "Common Data Security Architecture (CDSA) Specification". +// +#define BIS_ALG_DSA (41) // CSSM_ALGID_DSA +#define BIS_ALG_RSA_MD5 (42) // CSSM_ALGID_MD5_WITH_RSA +// Currently defined values for EFI_BIS_SIGNATURE_INFO.CertificateId. +// +#define BIS_CERT_ID_DSA BIS_ALG_DSA // CSSM_ALGID_DSA +#define BIS_CERT_ID_RSA_MD5 BIS_ALG_RSA_MD5 // CSSM_ALGID_MD5_WITH_RSA +// The following is a mask value that gets applied to the truncated hash of a +// platform Boot Object Authorization Certificate to create the certificateID. +// A certificateID must not have any bits set to the value 1 other than bits in +// this mask. +// +#define BIS_CERT_ID_MASK (0xFF7F7FFF) + +// +// Macros for dealing with the EFI_BIS_DATA object obtained +// from BIS_GetSignatureInfo() +// BIS_GET_SIGINFO_COUNT - tells how many EFI_BIS_SIGNATURE_INFO +// elements are contained in a EFI_BIS_DATA struct pointed to +// by the provided EFI_BIS_DATA*. +// +#define BIS_GET_SIGINFO_COUNT(BisDataPtr) ((BisDataPtr)->Length / sizeof (EFI_BIS_SIGNATURE_INFO)) + +// +// BIS_GET_SIGINFO_ARRAY - produces a EFI_BIS_SIGNATURE_INFO* +// from a given EFI_BIS_DATA*. +// +#define BIS_GET_SIGINFO_ARRAY(BisDataPtr) ((EFI_BIS_SIGNATURE_INFO *) (BisDataPtr)->Data) + +// +// Binary Value of "X-Intel-BIS-ParameterSet" Attribute. +// (Value is Base64 encoded in actual signed manifest). +// {EDD35E31-07B9-11d2-83A3-00A0C91FADCF} +// +#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID \ + { \ + 0xedd35e31, 0x7b9, 0x11d2, \ + { \ + 0x83, 0xa3, 0x0, 0xa0, 0xc9, 0x1f, 0xad, 0xcf \ + } \ + } + +// +// Support old name for backward compatible +// +#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE \ + BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID + +/** + Initializes the BIS service, checking that it is compatible with the version requested by the caller. + After this call, other BIS functions may be invoked. + + @param This A pointer to the EFI_BIS_PROTOCOL object. + @param AppHandle The function writes the new BIS_APPLICATION_HANDLE if + successful, otherwise it writes NULL. The caller must eventually + destroy this handle by calling Shutdown(). + @param InterfaceVersion On input, the caller supplies the major version number of the + interface version desired. + On output, both the major and minor + version numbers are updated with the major and minor version + numbers of the interface + @param TargetAddress Indicates a network or device address of the BIS platform to connect to. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INCOMPATIBLE_VERSION The InterfaceVersion.Major requested by the + caller was not compatible with the interface version of the + @retval EFI_UNSUPPORTED This is a local-platform implementation and + TargetAddress.Data was not NULL, or + TargetAddress.Data was any other value that was not + supported by the implementation. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_DEVICE_ERROR The function encountered an unexpected internal failure. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_INITIALIZE) ( + IN EFI_BIS_PROTOCOL *This, + OUT BIS_APPLICATION_HANDLE *AppHandle, + IN OUT EFI_BIS_VERSION *InterfaceVersion, + IN EFI_BIS_DATA *TargetAddress + ); + +/** + Frees memory structures allocated and returned by other functions in the EFI_BIS protocol. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param ToFree An EFI_BIS_DATA* and associated memory block to be freed. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER The ToFree parameter is not or is no longer a memory resource + associated with this AppHandle. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_FREE) ( + IN BIS_APPLICATION_HANDLE AppHandle, + IN EFI_BIS_DATA *ToFree + ); + +/** + Shuts down an application's instance of the BIS service, invalidating the application handle. After + this call, other BIS functions may no longer be invoked using the application handle value. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_DEVICE_ERROR The function encountered an unexpected internal failure. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_SHUTDOWN) ( + IN BIS_APPLICATION_HANDLE AppHandle + ); + +/** + Retrieves the certificate that has been configured as the identity of the organization designated as + the source of authorization for signatures of boot objects. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param Certificate The function writes an allocated EFI_BIS_DATA* containing the Boot + Object Authorization Certificate object. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_NOT_FOUND There is no Boot Object Authorization Certificate currently installed. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER The Certificate parameter supplied by the caller is NULL or + an invalid memory reference. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CERTIFICATE) ( + IN BIS_APPLICATION_HANDLE AppHandle, + OUT EFI_BIS_DATA **Certificate + ); + +/** + Verifies the integrity and authorization of the indicated data object according to the + indicated credentials. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param Credentials A Signed Manifest containing verification information for the indicated + data object. + @param DataObject An in-memory copy of the raw data object to be verified. + @param IsVerified The function writes TRUE if the verification succeeded, otherwise + FALSE. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_SECURITY_VIOLATION The signed manifest supplied as the Credentials parameter + was invalid (could not be parsed) or Platform-specific authorization failed, etc. + @retval EFI_DEVICE_ERROR An unexpected internal error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_VERIFY_BOOT_OBJECT) ( + IN BIS_APPLICATION_HANDLE AppHandle, + IN EFI_BIS_DATA *Credentials, + IN EFI_BIS_DATA *DataObject, + OUT BOOLEAN *IsVerified + ); + +/** + Retrieves the current status of the Boot Authorization Check Flag. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param CheckIsRequired The function writes the value TRUE if a Boot Authorization Check is + currently required on this platform, otherwise the function writes + FALSE. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER The CheckIsRequired parameter supplied by the caller is + NULL or an invalid memory reference. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CHECKFLAG) ( + IN BIS_APPLICATION_HANDLE AppHandle, + OUT BOOLEAN *CheckIsRequired + ); + +/** + Retrieves a unique token value to be included in the request credential for the next update of any + parameter in the Boot Object Authorization set + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param UpdateToken The function writes an allocated EFI_BIS_DATA* containing the new + unique update token value. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER The UpdateToken parameter supplied by the caller is NULL or + an invalid memory reference. + @retval EFI_DEVICE_ERROR An unexpected internal error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_UPDATE_TOKEN) ( + IN BIS_APPLICATION_HANDLE AppHandle, + OUT EFI_BIS_DATA **UpdateToken + ); + +/** + Updates one of the configurable parameters of the Boot Object Authorization set. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param RequestCredential This is a Signed Manifest with embedded attributes that carry the details + of the requested update. + @param NewUpdateToken The function writes an allocated EFI_BIS_DATA* containing the new + unique update token value. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_SECURITY_VIOLATION The signed manifest supplied as the RequestCredential parameter + was invalid (could not be parsed) or Platform-specific authorization failed, etc. + @retval EFI_DEVICE_ERROR An unexpected internal error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_UPDATE_BOOT_OBJECT_AUTHORIZATION) ( + IN BIS_APPLICATION_HANDLE AppHandle, + IN EFI_BIS_DATA *RequestCredential, + OUT EFI_BIS_DATA **NewUpdateToken + ); + +/** + Verifies the integrity and authorization of the indicated data object according to the indicated + credentials and authority certificate. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param Credentials A Signed Manifest containing verification information for the + indicated data object. + @param DataObject An in-memory copy of the raw data object to be verified. + @param SectionName An ASCII (not Unicode) string giving the section name in the + manifest holding the verification information (in other words, + hash value) that corresponds to DataObject. + @param AuthorityCertificate A digital certificate whose public key must match the signer's + public key which is found in the credentials. + @param IsVerified The function writes TRUE if the verification was successful. + Otherwise, the function writes FALSE. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_SECURITY_VIOLATION The Credentials.Data supplied by the caller is NULL, + or the AuthorityCertificate supplied by the caller was + invalid (could not be parsed), + or Platform-specific authorization failed, etc. + @retval EFI_DEVICE_ERROR An unexpected internal error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_VERIFY_OBJECT_WITH_CREDENTIAL) ( + IN BIS_APPLICATION_HANDLE AppHandle, + IN EFI_BIS_DATA *Credentials, + IN EFI_BIS_DATA *DataObject, + IN EFI_BIS_DATA *SectionName, + IN EFI_BIS_DATA *AuthorityCertificate, + OUT BOOLEAN *IsVerified + ); + +/** + Retrieves a list of digital certificate identifier, digital signature algorithm, hash algorithm, and keylength + combinations that the platform supports. + + @param AppHandle An opaque handle that identifies the caller's instance of initialization + of the BIS service. + @param SignatureInfo The function writes an allocated EFI_BIS_DATA* containing the array + of EFI_BIS_SIGNATURE_INFO structures representing the supported + digital certificate identifier, algorithm, and key length combinations. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NO_MAPPING The AppHandle parameter is not or is no longer a valid + application instance handle associated with the EFI_BIS protocol. + @retval EFI_OUT_OF_RESOURCES The function failed due to lack of memory or other resources. + @retval EFI_INVALID_PARAMETER The SignatureInfo parameter supplied by the caller is NULL + or an invalid memory reference. + @retval EFI_DEVICE_ERROR An unexpected internal error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BIS_GET_SIGNATURE_INFO) ( + IN BIS_APPLICATION_HANDLE AppHandle, + OUT EFI_BIS_DATA **SignatureInfo + ); + +struct _EFI_BIS_PROTOCOL { + EFI_BIS_INITIALIZE Initialize; + EFI_BIS_SHUTDOWN Shutdown; + EFI_BIS_FREE Free; + EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CERTIFICATE GetBootObjectAuthorizationCertificate; + EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CHECKFLAG GetBootObjectAuthorizationCheckFlag; + EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_UPDATE_TOKEN GetBootObjectAuthorizationUpdateToken; + EFI_BIS_GET_SIGNATURE_INFO GetSignatureInfo; + EFI_BIS_UPDATE_BOOT_OBJECT_AUTHORIZATION UpdateBootObjectAuthorization; + EFI_BIS_VERIFY_BOOT_OBJECT VerifyBootObject; + EFI_BIS_VERIFY_OBJECT_WITH_CREDENTIAL VerifyObjectWithCredential; +}; + +extern EFI_GUID gEfiBisProtocolGuid; +extern EFI_GUID gBootObjectAuthorizationParmsetGuid; + +#endif diff --git a/MdePkg/Include/Protocol/BlockIo.h b/MdePkg/Include/Protocol/BlockIo.h new file mode 100644 index 0000000000..4c7e8b4270 --- /dev/null +++ b/MdePkg/Include/Protocol/BlockIo.h @@ -0,0 +1,173 @@ +/** @file + Block IO protocol as defined in the EFI 1.0 specification. + + The Block IO protocol is used to abstract block devices like hard drives, + DVD-ROMs and floppy drives. + + 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: BlockIo.h + +**/ + +#ifndef __BLOCK_IO_H__ +#define __BLOCK_IO_H__ + +#define EFI_BLOCK_IO_PROTOCOL_GUID \ + { \ + 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL; + +/** + Reset the Block Device. + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could + not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_RESET) ( + IN EFI_BLOCK_IO_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +; + +/** + Read BufferSize bytes from Lba into Buffer. + + @param This Protocol instance pointer. + @param MediaId Id of the media, changes every time the media is replaced. + @param Lba The starting Logical Block Address to read from + @param BufferSize Size of Buffer, must be a multiple of device block size. + @param Buffer Buffer containing read data + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_DEVICE_ERROR The device reported an error while performing the read. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not + valid for the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_READ) ( + IN EFI_BLOCK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN EFI_LBA Lba, + IN UINTN BufferSize, + OUT VOID *Buffer + ) +; + +/** + Write BufferSize bytes from Lba into Buffer. + + @param This Protocol instance pointer. + @param MediaId Id of the media, changes every time the media is replaced. + @param Lba The starting Logical Block Address to read from + @param BufferSize Size of Buffer, must be a multiple of device block size. + @param Buffer Buffer containing read data + + @retval EFI_SUCCESS The data was written correctly to the device. + @retval EFI_WRITE_PROTECTED The device can not be written to. + @retval EFI_DEVICE_ERROR The device reported an error while performing the write. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device. + @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device. + @retval EFI_INVALID_PARAMETER The write request contains a LBA that is not + valid for the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_WRITE) ( + IN EFI_BLOCK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN EFI_LBA Lba, + IN UINTN BufferSize, + IN VOID *Buffer + ) +; + +/** + Flush the Block Device. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS All outstanding data was written to the device + @retval EFI_DEVICE_ERROR The device reported an error while writting back the data + @retval EFI_NO_MEDIA There is no media in the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BLOCK_FLUSH) ( + IN EFI_BLOCK_IO_PROTOCOL *This + ) +; + +/** + Block IO read only mode data and updated only via members of BlockIO + +**/ +typedef struct { + UINT32 MediaId; ///< The curent media Id. If the media changes, this value is changed. + BOOLEAN RemovableMedia; ///< TRUE if the media is removable; otherwise, FALSE. + BOOLEAN MediaPresent; /**< TRUE if there is a media currently present in the device; + othersise, FALSE. THis field shows the media present status + as of the most recent ReadBlocks() or WriteBlocks() call. + **/ + BOOLEAN LogicalPartition; /**< TRUE if LBA 0 is the first block of a partition; otherwise + FALSE. For media with only one partition this would be TRUE. + **/ + BOOLEAN ReadOnly; /**< TRUE if the media is marked read-only otherwise, FALSE. + This field shows the read-only status as of the most recent WriteBlocks () call. + **/ + BOOLEAN WriteCaching; ///< TRUE if the WriteBlock () function caches write data. + + UINT32 BlockSize; /**< The intrinsic block size of the device. If the media changes, then + this field is updated. + **/ + UINT32 IoAlign; ///< Supplies the alignment requirement for any buffer to read or write block(s). + + EFI_LBA LastBlock; /**< The last logical block address on the device. + If the media changes, then this field is updated. + **/ +} EFI_BLOCK_IO_MEDIA; + +#define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000 + +struct _EFI_BLOCK_IO_PROTOCOL { + UINT64 Revision; + + EFI_BLOCK_IO_MEDIA *Media; + + EFI_BLOCK_RESET Reset; + EFI_BLOCK_READ ReadBlocks; + EFI_BLOCK_WRITE WriteBlocks; + EFI_BLOCK_FLUSH FlushBlocks; + +}; + +extern EFI_GUID gEfiBlockIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/BusSpecificDriverOverride.h b/MdePkg/Include/Protocol/BusSpecificDriverOverride.h new file mode 100644 index 0000000000..c446940567 --- /dev/null +++ b/MdePkg/Include/Protocol/BusSpecificDriverOverride.h @@ -0,0 +1,66 @@ +/** @file + Bus Specific Driver Override protocol as defined in the EFI 1.1 specification. + + 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: BusSpecificDriverOverride.h + +**/ + +#ifndef _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_ +#define _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_ + +// +// Global ID for the Bus Specific Driver Override Protocol +// +#define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID \ + { \ + 0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65 } \ + } + +typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL; + +// +// Prototypes for the Bus Specific Driver Override Protocol +// + +/** + Uses a bus specific algorithm to retrieve a driver image handle for a controller. + + @param This A pointer to the EFI_BUS_SPECIFIC_DRIVER_ + OVERRIDE_PROTOCOL instance. + @param DriverImageHandle On input, a pointer to the previous driver image handle returned + by GetDriver(). On output, a pointer to the next driver + image handle. Passing in a NULL, will return the first driver + image handle. + + @retval EFI_SUCCESS A bus specific override driver is returned in DriverImageHandle. + @retval EFI_NOT_FOUND The end of the list of override drivers was reached. + @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a + previous call to GetDriver(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER) ( + IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This, + IN OUT EFI_HANDLE *DriverImageHandle + ); + +// +// Interface structure for the Bus Specific Driver Override Protocol +// +struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL { + EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER GetDriver; +}; + +extern EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/ComponentName.h b/MdePkg/Include/Protocol/ComponentName.h new file mode 100644 index 0000000000..68fd31ba8b --- /dev/null +++ b/MdePkg/Include/Protocol/ComponentName.h @@ -0,0 +1,123 @@ +/** @file + EFI Component Name 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: ComponentName.h + +**/ + +#ifndef __EFI_COMPONENT_NAME_H__ +#define __EFI_COMPONENT_NAME_H__ + +// +// Global ID for the Component Name Protocol +// +#define EFI_COMPONENT_NAME_PROTOCOL_GUID \ + { \ + 0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +typedef struct _EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL; + + +/** + Retrieves a Unicode string that is the user readable name of the EFI Driver. + + @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. + @param Language A pointer to a three character ISO 639-2 language identifier. + This is the language of the driver name that that the caller + is requesting, and it must match one of the languages specified + in SupportedLanguages. The number of languages supported by a + driver is up to the driver writer. + @param DriverName A pointer to the Unicode string to return. This Unicode string + is the name of the driver specified by This in the language + specified by Language. + + @retval EFI_SUCCESS The Unicode string for the Driver specified by This + and the language specified by Language was returned + in DriverName. + @retval EFI_INVALID_PARAMETER Language is NULL. + @retval EFI_INVALID_PARAMETER DriverName is NULL. + @retval EFI_UNSUPPORTED The driver specified by This does not support the + language specified by Language. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN CHAR8 *Language, + OUT CHAR16 **DriverName + ); + + +/** + Retrieves a Unicode string that is the user readable name of the controller + that is being managed by an EFI Driver. + + @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. + @param ControllerHandle The handle of a controller that the driver specified by + This is managing. This handle specifies the controller + whose name is to be returned. + @param ChildHandle The handle of the child controller to retrieve the name + of. This is an optional parameter that may be NULL. It + will be NULL for device drivers. It will also be NULL + for a bus drivers that wish to retrieve the name of the + bus controller. It will not be NULL for a bus driver + that wishes to retrieve the name of a child controller. + @param Language A pointer to a three character ISO 639-2 language + identifier. This is the language of the controller name + that that the caller is requesting, and it must match one + of the languages specified in SupportedLanguages. The + number of languages supported by a driver is up to the + driver writer. + @param ControllerName A pointer to the Unicode string to return. This Unicode + string is the name of the controller specified by + ControllerHandle and ChildHandle in the language specified + by Language from the point of view of the driver specified + by This. + + @retval EFI_SUCCESS The Unicode string for the user readable name in the + language specified by Language for the driver + specified by This was returned in DriverName. + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER Language is NULL. + @retval EFI_INVALID_PARAMETER ControllerName is NULL. + @retval EFI_UNSUPPORTED The driver specified by This is not currently managing + the controller specified by ControllerHandle and + ChildHandle. + @retval EFI_UNSUPPORTED The driver specified by This does not support the + language specified by Language. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) ( + IN EFI_COMPONENT_NAME_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN CHAR8 *Language, + OUT CHAR16 **ControllerName + ); + +// +// Interface structure for the Component Name Protocol +// +struct _EFI_COMPONENT_NAME_PROTOCOL { + EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName; + EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName; + CHAR8 *SupportedLanguages; +}; + +extern EFI_GUID gEfiComponentNameProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/ComponentName2.h b/MdePkg/Include/Protocol/ComponentName2.h new file mode 100644 index 0000000000..243490d971 --- /dev/null +++ b/MdePkg/Include/Protocol/ComponentName2.h @@ -0,0 +1,165 @@ +/** @file + EFI Component Name 2 Protocol + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: ComponentName.h + +**/ + +#ifndef __EFI_COMPONENT_NAME2_H__ +#define __EFI_COMPONENT_NAME2_H__ + +// +// Global ID for the Component Name Protocol +// +#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \ + {0x6a7a5cff, 0xe8d9, 0x4f70, { 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14 } } + +typedef struct _EFI_COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL; + + +/** + Retrieves a Unicode string that is the user readable name of + the EFI Driver. + + @param This A pointer to the + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param Language A pointer to a Null-terminated ASCII string + array indicating the language. This is the + language of the driver name that the caller + is requesting, and it must match one of the + languages specified in SupportedLanguages. + The number of languages supported by a + driver is up to the driver writer. Language + is specified in RFC 3066 language code + format. + + @param DriverName A pointer to the Unicode string to return. + This Unicode string is the name of the + driver specified by This in the language + specified by Language. + + @retval EFI_SUCCESS The Unicode string for the + Driver specified by This and the + language specified by Language + was returned in DriverName. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER DriverName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This + does not support the language + specified by Language. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ( + IN EFI_COMPONENT_NAME2_PROTOCOL *This, + IN CHAR8 *Language, + OUT CHAR16 **DriverName + ); + + +/** + Retrieves a Unicode string that is the user readable name of + the controller that is being managed by an EFI Driver. + + @param This A pointer to the + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param ControllerHandle The handle of a controller that the + driver specified by This is managing. + This handle specifies the controller + whose name is to be returned. + + @param ChildHandle The handle of the child controller to + retrieve the name of. This is an + optional parameter that may be NULL. + It will be NULL for device drivers. + It will also be NULL for a bus + drivers that wish to retrieve the + name of the bus controller. It will + not be NULL for a bus driver that + wishes to retrieve the name of a + child controller. + + @param Language A pointer to a Null-terminated ASCII + string array indicating the language. + This is the language of the driver + name that the caller is requesting, + and it must match one of the + languages specified in + SupportedLanguages. The number of + languages supported by a driver is up + to the driver writer. Language is + specified in RFC 3066 language code + format. + + @param ControllerName A pointer to the Unicode string to + return. This Unicode string is the + name of the controller specified by + ControllerHandle and ChildHandle in + the language specified by Language + from the point of view of the driver + specified by This. + + @retval EFI_SUCCESS The Unicode string for the user + readable name in the language + specified by Language for the + driver specified by This was + returned in DriverName. + + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid + EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it + is not a valid EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER ControllerName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This is + not currently managing the + controller specified by + ControllerHandle and + ChildHandle. + + @retval EFI_UNSUPPORTED The driver specified by This + does not support the language + specified by Language. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ( + IN EFI_COMPONENT_NAME2_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN CHAR8 *Language, + OUT CHAR16 **ControllerName + ); + +// +// Interface structure for the Component Name Protocol +// +struct _EFI_COMPONENT_NAME2_PROTOCOL { + EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName; + EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName; + CHAR8 *SupportedLanguages; +}; + +extern EFI_GUID gEfiComponentName2ProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Cpu.h b/MdePkg/Include/Protocol/Cpu.h new file mode 100644 index 0000000000..5dd4ffc739 --- /dev/null +++ b/MdePkg/Include/Protocol/Cpu.h @@ -0,0 +1,331 @@ +/** @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__ + +#include + +#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 +(EFIAPI *EFI_CPU_INTERRUPT_HANDLER) ( + IN CONST EFI_EXCEPTION_TYPE InterruptType, + IN CONST 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/Protocol/DebugPort.h b/MdePkg/Include/Protocol/DebugPort.h new file mode 100644 index 0000000000..ceffaf6954 --- /dev/null +++ b/MdePkg/Include/Protocol/DebugPort.h @@ -0,0 +1,141 @@ +/** @file + 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: DebugPort.h + +**/ + +#ifndef __DEBUG_PORT_H__ +#define __DEBUG_PORT_H__ + + +// +// DebugPortIo protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0} +// +#define EFI_DEBUGPORT_PROTOCOL_GUID \ + { \ + 0xEBA4E8D2, 0x3858, 0x41EC, {0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \ + } + +extern EFI_GUID gEfiDebugPortProtocolGuid; + +typedef struct _EFI_DEBUGPORT_PROTOCOL EFI_DEBUGPORT_PROTOCOL; + +// +// DebugPort member functions +// + +/** + Resets the debugport. + + @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. + + @retval EFI_SUCCESS The debugport device was reset and is in usable state. + @retval EFI_DEVICE_ERROR The debugport device could not be reset and is unusable. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DEBUGPORT_RESET) ( + IN EFI_DEBUGPORT_PROTOCOL *This + ); + +/** + Writes data to the debugport. + + @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. + @param Timeout The number of microseconds to wait before timing out a write operation. + @param BufferSize On input, the requested number of bytes of data to write. On output, the + number of bytes of data actually written. + @param Buffer A pointer to a buffer containing the data to write. + + @retval EFI_SUCCESS The data was written. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_TIMEOUT The data write was stopped due to a timeout. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DEBUGPORT_WRITE) ( + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + IN VOID *Buffer + ); + +/** + Reads data from the debugport. + + @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. + @param Timeout The number of microseconds to wait before timing out a read operation. + @param BufferSize On input, the requested number of bytes of data to read. On output, the + number of bytes of data actually number of bytes + of data read and returned in Buffer. + @param Buffer A pointer to a buffer into which the data read will be saved. + + @retval EFI_SUCCESS The data was read. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_TIMEOUT The operation was stopped due to a timeout or overrun. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DEBUGPORT_READ) ( + IN EFI_DEBUGPORT_PROTOCOL *This, + IN UINT32 Timeout, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ); + +/** + Checks to see if any data is available to be read from the debugport device. + + @param This A pointer to the EFI_DEBUGPORT_PROTOCOL instance. + + @retval EFI_SUCCESS At least one byte of data is available to be read. + @retval EFI_DEVICE_ERROR The debugport device is not functioning correctly. + @retval EFI_NOT_READY No data is available to be read. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DEBUGPORT_POLL) ( + IN EFI_DEBUGPORT_PROTOCOL *This + ); + +// +// DebugPort protocol definition +// +struct _EFI_DEBUGPORT_PROTOCOL { + EFI_DEBUGPORT_RESET Reset; + EFI_DEBUGPORT_WRITE Write; + EFI_DEBUGPORT_READ Read; + EFI_DEBUGPORT_POLL Poll; +}; + +// +// DEBUGPORT variable definitions... +// +#define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT" +#define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID +#define gEfiDebugPortVariableGuid gEfiDebugPortProtocolGuid + +// +// DebugPort device path definitions... +// +#define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID +#define gEfiDebugPortDevicePathGuid gEfiDebugPortProtocolGuid + +typedef struct { + EFI_DEVICE_PATH_PROTOCOL Header; + EFI_GUID Guid; +} DEBUGPORT_DEVICE_PATH; + +#endif diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h new file mode 100644 index 0000000000..5c2c1cfabf --- /dev/null +++ b/MdePkg/Include/Protocol/DebugSupport.h @@ -0,0 +1,660 @@ +/** @file + DebugSupport protocol and supporting definitions as defined in the UEFI2.0 + specification. + + The DebugSupport protocol is used by source level debuggers to abstract the + processor and handle context save and restore operations. + + 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: DebugSupport.h + +**/ + +#ifndef __DEBUG_SUPPORT_H__ +#define __DEBUG_SUPPORT_H__ + +#include + +typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL; + +// +// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25} +// +#define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \ + { \ + 0x2755590C, 0x6F3C, 0x42FA, {0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \ + } + +// +// Debug Support definitions +// +typedef INTN EFI_EXCEPTION_TYPE; + +// +// IA-32 processor exception types +// +#define EXCEPT_IA32_DIVIDE_ERROR 0 +#define EXCEPT_IA32_DEBUG 1 +#define EXCEPT_IA32_NMI 2 +#define EXCEPT_IA32_BREAKPOINT 3 +#define EXCEPT_IA32_OVERFLOW 4 +#define EXCEPT_IA32_BOUND 5 +#define EXCEPT_IA32_INVALID_OPCODE 6 +#define EXCEPT_IA32_DOUBLE_FAULT 8 +#define EXCEPT_IA32_INVALID_TSS 10 +#define EXCEPT_IA32_SEG_NOT_PRESENT 11 +#define EXCEPT_IA32_STACK_FAULT 12 +#define EXCEPT_IA32_GP_FAULT 13 +#define EXCEPT_IA32_PAGE_FAULT 14 +#define EXCEPT_IA32_FP_ERROR 16 +#define EXCEPT_IA32_ALIGNMENT_CHECK 17 +#define EXCEPT_IA32_MACHINE_CHECK 18 +#define EXCEPT_IA32_SIMD 19 + +// +// IA-32 processor context definition +// +// +// FXSAVE_STATE +// FP / MMX / XMM registers (see fxrstor instruction definition) +// +typedef struct { + UINT16 Fcw; + UINT16 Fsw; + UINT16 Ftw; + UINT16 Opcode; + UINT32 Eip; + UINT16 Cs; + UINT16 Reserved1; + UINT32 DataOffset; + UINT16 Ds; + UINT8 Reserved2[10]; +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) + UINT8 St0Mm0[10], Reserved3[6]; + UINT8 St1Mm1[10], Reserved4[6]; + UINT8 St2Mm2[10], Reserved5[6]; + UINT8 St3Mm3[10], Reserved6[6]; + UINT8 St4Mm4[10], Reserved7[6]; + UINT8 St5Mm5[10], Reserved8[6]; + UINT8 St6Mm6[10], Reserved9[6]; + UINT8 St7Mm7[10], Reserved10[6]; + UINT8 Xmm0[16]; + UINT8 Xmm1[16]; + UINT8 Xmm2[16]; + UINT8 Xmm3[16]; + UINT8 Xmm4[16]; + UINT8 Xmm5[16]; + UINT8 Xmm6[16]; + UINT8 Xmm7[16]; + UINT8 Reserved11[14 * 16]; +} EFI_FX_SAVE_STATE_IA32; +#else + UINT8 St0Mm0[10], Reserved3[6]; + UINT8 St0Mm1[10], Reserved4[6]; + UINT8 St0Mm2[10], Reserved5[6]; + UINT8 St0Mm3[10], Reserved6[6]; + UINT8 St0Mm4[10], Reserved7[6]; + UINT8 St0Mm5[10], Reserved8[6]; + UINT8 St0Mm6[10], Reserved9[6]; + UINT8 St0Mm7[10], Reserved10[6]; + UINT8 Reserved11[22 * 16]; +} EFI_FX_SAVE_STATE; +#endif + +typedef struct { + UINT32 ExceptionData; +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) + EFI_FX_SAVE_STATE_IA32 FxSaveState; +#else + EFI_FX_SAVE_STATE FxSaveState; +#endif + UINT32 Dr0; + UINT32 Dr1; + UINT32 Dr2; + UINT32 Dr3; + UINT32 Dr6; + UINT32 Dr7; + UINT32 Cr0; + UINT32 Cr1; /* Reserved */ + UINT32 Cr2; + UINT32 Cr3; + UINT32 Cr4; + UINT32 Eflags; + UINT32 Ldtr; + UINT32 Tr; + UINT32 Gdtr[2]; + UINT32 Idtr[2]; + UINT32 Eip; + UINT32 Gs; + UINT32 Fs; + UINT32 Es; + UINT32 Ds; + UINT32 Cs; + UINT32 Ss; + UINT32 Edi; + UINT32 Esi; + UINT32 Ebp; + UINT32 Esp; + UINT32 Ebx; + UINT32 Edx; + UINT32 Ecx; + UINT32 Eax; +} EFI_SYSTEM_CONTEXT_IA32; + +// +// X64 processor exception types +// +#define EXCEPT_X64_DIVIDE_ERROR 0 +#define EXCEPT_X64_DEBUG 1 +#define EXCEPT_X64_NMI 2 +#define EXCEPT_X64_BREAKPOINT 3 +#define EXCEPT_X64_OVERFLOW 4 +#define EXCEPT_X64_BOUND 5 +#define EXCEPT_X64_INVALID_OPCODE 6 +#define EXCEPT_X64_DOUBLE_FAULT 8 +#define EXCEPT_X64_INVALID_TSS 10 +#define EXCEPT_X64_SEG_NOT_PRESENT 11 +#define EXCEPT_X64_STACK_FAULT 12 +#define EXCEPT_X64_GP_FAULT 13 +#define EXCEPT_X64_PAGE_FAULT 14 +#define EXCEPT_X64_FP_ERROR 16 +#define EXCEPT_X64_ALIGNMENT_CHECK 17 +#define EXCEPT_X64_MACHINE_CHECK 18 +#define EXCEPT_X64_SIMD 19 + +// +// X64 processor context definition +// +// FXSAVE_STATE +// FP / MMX / XMM registers (see fxrstor instruction definition) +// +typedef struct { + UINT16 Fcw; + UINT16 Fsw; + UINT16 Ftw; + UINT16 Opcode; + UINT64 Rip; + UINT64 DataOffset; + UINT8 Reserved1[8]; + UINT8 St0Mm0[10], Reserved2[6]; + UINT8 St1Mm1[10], Reserved3[6]; + UINT8 St2Mm2[10], Reserved4[6]; + UINT8 St3Mm3[10], Reserved5[6]; + UINT8 St4Mm4[10], Reserved6[6]; + UINT8 St5Mm5[10], Reserved7[6]; + UINT8 St6Mm6[10], Reserved8[6]; + UINT8 St7Mm7[10], Reserved9[6]; + UINT8 Xmm0[16]; + UINT8 Xmm1[16]; + UINT8 Xmm2[16]; + UINT8 Xmm3[16]; + UINT8 Xmm4[16]; + UINT8 Xmm5[16]; + UINT8 Xmm6[16]; + UINT8 Xmm7[16]; +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) + // + // NOTE: UEFI 2.0 spec definition as follows. It should be updated + // after spec update. + // + UINT8 Reserved11[14 * 16]; +#else + UINT8 Xmm8[16]; + UINT8 Xmm9[16]; + UINT8 Xmm10[16]; + UINT8 Xmm11[16]; + UINT8 Xmm12[16]; + UINT8 Xmm13[16]; + UINT8 Xmm14[16]; + UINT8 Xmm15[16]; + UINT8 Reserved10[6 * 16]; +#endif +} EFI_FX_SAVE_STATE_X64; + +typedef struct { + UINT64 ExceptionData; + EFI_FX_SAVE_STATE_X64 FxSaveState; + UINT64 Dr0; + UINT64 Dr1; + UINT64 Dr2; + UINT64 Dr3; + UINT64 Dr6; + UINT64 Dr7; + UINT64 Cr0; + UINT64 Cr1; /* Reserved */ + UINT64 Cr2; + UINT64 Cr3; + UINT64 Cr4; + UINT64 Cr8; + UINT64 Rflags; + UINT64 Ldtr; + UINT64 Tr; + UINT64 Gdtr[2]; + UINT64 Idtr[2]; + UINT64 Rip; + UINT64 Gs; + UINT64 Fs; + UINT64 Es; + UINT64 Ds; + UINT64 Cs; + UINT64 Ss; + UINT64 Rdi; + UINT64 Rsi; + UINT64 Rbp; + UINT64 Rsp; + UINT64 Rbx; + UINT64 Rdx; + UINT64 Rcx; + UINT64 Rax; + UINT64 R8; + UINT64 R9; + UINT64 R10; + UINT64 R11; + UINT64 R12; + UINT64 R13; + UINT64 R14; + UINT64 R15; +} EFI_SYSTEM_CONTEXT_X64; + +// +// IPF processor exception types +// +#define EXCEPT_IPF_VHTP_TRANSLATION 0 +#define EXCEPT_IPF_INSTRUCTION_TLB 1 +#define EXCEPT_IPF_DATA_TLB 2 +#define EXCEPT_IPF_ALT_INSTRUCTION_TLB 3 +#define EXCEPT_IPF_ALT_DATA_TLB 4 +#define EXCEPT_IPF_DATA_NESTED_TLB 5 +#define EXCEPT_IPF_INSTRUCTION_KEY_MISSED 6 +#define EXCEPT_IPF_DATA_KEY_MISSED 7 +#define EXCEPT_IPF_DIRTY_BIT 8 +#define EXCEPT_IPF_INSTRUCTION_ACCESS_BIT 9 +#define EXCEPT_IPF_DATA_ACCESS_BIT 10 +#define EXCEPT_IPF_BREAKPOINT 11 +#define EXCEPT_IPF_EXTERNAL_INTERRUPT 12 +// +// 13 - 19 reserved +// +#define EXCEPT_IPF_PAGE_NOT_PRESENT 20 +#define EXCEPT_IPF_KEY_PERMISSION 21 +#define EXCEPT_IPF_INSTRUCTION_ACCESS_RIGHTS 22 +#define EXCEPT_IPF_DATA_ACCESS_RIGHTS 23 +#define EXCEPT_IPF_GENERAL_EXCEPTION 24 +#define EXCEPT_IPF_DISABLED_FP_REGISTER 25 +#define EXCEPT_IPF_NAT_CONSUMPTION 26 +#define EXCEPT_IPF_SPECULATION 27 +// +// 28 reserved +// +#define EXCEPT_IPF_DEBUG 29 +#define EXCEPT_IPF_UNALIGNED_REFERENCE 30 +#define EXCEPT_IPF_UNSUPPORTED_DATA_REFERENCE 31 +#define EXCEPT_IPF_FP_FAULT 32 +#define EXCEPT_IPF_FP_TRAP 33 +#define EXCEPT_IPF_LOWER_PRIVILEGE_TRANSFER_TRAP 34 +#define EXCEPT_IPF_TAKEN_BRANCH 35 +#define EXCEPT_IPF_SINGLE_STEP 36 +// +// 37 - 44 reserved +// +#define EXCEPT_IPF_IA32_EXCEPTION 45 +#define EXCEPT_IPF_IA32_INTERCEPT 46 +#define EXCEPT_IPF_IA32_INTERRUPT 47 + +// +// IPF processor context definition +// +typedef struct { + // + // The first reserved field is necessary to preserve alignment for the correct + // bits in UNAT and to insure F2 is 16 byte aligned.. + // + UINT64 Reserved; + UINT64 R1; + UINT64 R2; + UINT64 R3; + UINT64 R4; + UINT64 R5; + UINT64 R6; + UINT64 R7; + UINT64 R8; + UINT64 R9; + UINT64 R10; + UINT64 R11; + UINT64 R12; + UINT64 R13; + UINT64 R14; + UINT64 R15; + UINT64 R16; + UINT64 R17; + UINT64 R18; + UINT64 R19; + UINT64 R20; + UINT64 R21; + UINT64 R22; + UINT64 R23; + UINT64 R24; + UINT64 R25; + UINT64 R26; + UINT64 R27; + UINT64 R28; + UINT64 R29; + UINT64 R30; + UINT64 R31; + + UINT64 F2[2]; + UINT64 F3[2]; + UINT64 F4[2]; + UINT64 F5[2]; + UINT64 F6[2]; + UINT64 F7[2]; + UINT64 F8[2]; + UINT64 F9[2]; + UINT64 F10[2]; + UINT64 F11[2]; + UINT64 F12[2]; + UINT64 F13[2]; + UINT64 F14[2]; + UINT64 F15[2]; + UINT64 F16[2]; + UINT64 F17[2]; + UINT64 F18[2]; + UINT64 F19[2]; + UINT64 F20[2]; + UINT64 F21[2]; + UINT64 F22[2]; + UINT64 F23[2]; + UINT64 F24[2]; + UINT64 F25[2]; + UINT64 F26[2]; + UINT64 F27[2]; + UINT64 F28[2]; + UINT64 F29[2]; + UINT64 F30[2]; + UINT64 F31[2]; + + UINT64 Pr; + + UINT64 B0; + UINT64 B1; + UINT64 B2; + UINT64 B3; + UINT64 B4; + UINT64 B5; + UINT64 B6; + UINT64 B7; + + // + // application registers + // + UINT64 ArRsc; + UINT64 ArBsp; + UINT64 ArBspstore; + UINT64 ArRnat; + + UINT64 ArFcr; + + UINT64 ArEflag; + UINT64 ArCsd; + UINT64 ArSsd; + UINT64 ArCflg; + UINT64 ArFsr; + UINT64 ArFir; + UINT64 ArFdr; + + UINT64 ArCcv; + + UINT64 ArUnat; + + UINT64 ArFpsr; + + UINT64 ArPfs; + UINT64 ArLc; + UINT64 ArEc; + + // + // control registers + // + UINT64 CrDcr; + UINT64 CrItm; + UINT64 CrIva; + UINT64 CrPta; + UINT64 CrIpsr; + UINT64 CrIsr; + UINT64 CrIip; + UINT64 CrIfa; + UINT64 CrItir; + UINT64 CrIipa; + UINT64 CrIfs; + UINT64 CrIim; + UINT64 CrIha; + + // + // debug registers + // + UINT64 Dbr0; + UINT64 Dbr1; + UINT64 Dbr2; + UINT64 Dbr3; + UINT64 Dbr4; + UINT64 Dbr5; + UINT64 Dbr6; + UINT64 Dbr7; + + UINT64 Ibr0; + UINT64 Ibr1; + UINT64 Ibr2; + UINT64 Ibr3; + UINT64 Ibr4; + UINT64 Ibr5; + UINT64 Ibr6; + UINT64 Ibr7; + + // + // virtual registers - nat bits for R1-R31 + // + UINT64 IntNat; + +} EFI_SYSTEM_CONTEXT_IPF; + +// +// EBC processor exception types +// +#define EXCEPT_EBC_UNDEFINED 0 +#define EXCEPT_EBC_DIVIDE_ERROR 1 +#define EXCEPT_EBC_DEBUG 2 +#define EXCEPT_EBC_BREAKPOINT 3 +#define EXCEPT_EBC_OVERFLOW 4 +#define EXCEPT_EBC_INVALID_OPCODE 5 // opcode out of range +#define EXCEPT_EBC_STACK_FAULT 6 +#define EXCEPT_EBC_ALIGNMENT_CHECK 7 +#define EXCEPT_EBC_INSTRUCTION_ENCODING 8 // malformed instruction +#define EXCEPT_EBC_BAD_BREAK 9 // BREAK 0 or undefined BREAK +#define EXCEPT_EBC_STEP 10 // to support debug stepping +// +// For coding convenience, define the maximum valid EBC exception. +// +#define MAX_EBC_EXCEPTION EXCEPT_EBC_STEP + +// +// EBC processor context definition +// +typedef struct { + UINT64 R0; + UINT64 R1; + UINT64 R2; + UINT64 R3; + UINT64 R4; + UINT64 R5; + UINT64 R6; + UINT64 R7; + UINT64 Flags; + UINT64 ControlFlags; + UINT64 Ip; +} EFI_SYSTEM_CONTEXT_EBC; + +// +// Universal EFI_SYSTEM_CONTEXT definition +// +typedef union { + EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc; + EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32; + EFI_SYSTEM_CONTEXT_X64 *SystemContextX64; + EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf; +} EFI_SYSTEM_CONTEXT; + +// +// DebugSupport callback function prototypes +// + +/** + Registers and enables an exception callback function for the specified exception. + + @param ExceptionType Exception types in EBC, IA-32, X64, or IPF + @param SystemContext Exception content. + +**/ +typedef +VOID +(*EFI_EXCEPTION_CALLBACK) ( + IN EFI_EXCEPTION_TYPE ExceptionType, + IN OUT EFI_SYSTEM_CONTEXT SystemContext + ); + +/** + Registers and enables the on-target debug agent's periodic entry point. + + @param SystemContext Exception content. + +**/ +typedef +VOID +(*EFI_PERIODIC_CALLBACK) ( + IN OUT EFI_SYSTEM_CONTEXT SystemContext + ); + +// +// Machine type definition +// +typedef enum { + IsaIa32 = IMAGE_FILE_MACHINE_I386, // 0x014C + IsaX64 = IMAGE_FILE_MACHINE_X64, // 0x8664 + IsaIpf = IMAGE_FILE_MACHINE_IA64, // 0x0200 + IsaEbc = IMAGE_FILE_MACHINE_EBC // 0x0EBC +} EFI_INSTRUCTION_SET_ARCHITECTURE; + + +// +// DebugSupport member function definitions +// + +/** + Returns the maximum value that may be used for the ProcessorIndex parameter in + RegisterPeriodicCallback() and RegisterExceptionCallback(). + + @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. + @param MaxProcessorIndex Pointer to a caller-allocated UINTN in which the maximum supported + processor index is returned. + + @retval EFI_SUCCESS The function completed successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GET_MAXIMUM_PROCESSOR_INDEX) ( + IN EFI_DEBUG_SUPPORT_PROTOCOL *This, + OUT UINTN *MaxProcessorIndex + ); + +/** + Registers a function to be called back periodically in interrupt context. + + @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. + @param ProcessorIndex Specifies which processor the callback function applies to. + @param PeriodicCallback A pointer to a function of type PERIODIC_CALLBACK that is the main + periodic entry point of the debug agent. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ALREADY_STARTED Non-NULL PeriodicCallback parameter when a callback + function was previously registered. + @retval EFI_OUT_OF_RESOURCES System has insufficient memory resources to register new callback + function. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_REGISTER_PERIODIC_CALLBACK) ( + IN EFI_DEBUG_SUPPORT_PROTOCOL *This, + IN UINTN ProcessorIndex, + IN EFI_PERIODIC_CALLBACK PeriodicCallback + ); + +/** + Registers a function to be called when a given processor exception occurs. + + @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. + @param ProcessorIndex Specifies which processor the callback function applies to. + @param PeriodicCallback A pointer to a function of type EXCEPTION_CALLBACK that is called + when the processor exception specified by ExceptionType occurs. + @param ExceptionType Specifies which processor exception to hook. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ALREADY_STARTED Non-NULL PeriodicCallback parameter when a callback + function was previously registered. + @retval EFI_OUT_OF_RESOURCES System has insufficient memory resources to register new callback + function. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_REGISTER_EXCEPTION_CALLBACK) ( + IN EFI_DEBUG_SUPPORT_PROTOCOL *This, + IN UINTN ProcessorIndex, + IN EFI_EXCEPTION_CALLBACK ExceptionCallback, + IN EFI_EXCEPTION_TYPE ExceptionType + ); + +/** + Invalidates processor instruction cache for a memory range. Subsequent execution in this range + causes a fresh memory fetch to retrieve code to be executed. + + @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. + @param ProcessorIndex Specifies which processor's instruction cache is to be invalidated. + @param Start Specifies the physical base of the memory range to be invalidated. + @param Length Specifies the minimum number of bytes in the processor's instruction + cache to invalidate. + + @retval EFI_SUCCESS The function completed successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_INVALIDATE_INSTRUCTION_CACHE) ( + IN EFI_DEBUG_SUPPORT_PROTOCOL *This, + IN UINTN ProcessorIndex, + IN VOID *Start, + IN UINT64 Length + ); + +// +// DebugSupport protocol definition +// +struct _EFI_DEBUG_SUPPORT_PROTOCOL { + EFI_INSTRUCTION_SET_ARCHITECTURE Isa; + EFI_GET_MAXIMUM_PROCESSOR_INDEX GetMaximumProcessorIndex; + EFI_REGISTER_PERIODIC_CALLBACK RegisterPeriodicCallback; + EFI_REGISTER_EXCEPTION_CALLBACK RegisterExceptionCallback; + EFI_INVALIDATE_INSTRUCTION_CACHE InvalidateInstructionCache; +}; + +extern EFI_GUID gEfiDebugSupportProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Decompress.h b/MdePkg/Include/Protocol/Decompress.h new file mode 100644 index 0000000000..7c295f310e --- /dev/null +++ b/MdePkg/Include/Protocol/Decompress.h @@ -0,0 +1,121 @@ +/** @file + The Decompress Protocol Interface + + 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: Decompress.h + +**/ + +#ifndef __DECOMPRESS_H__ +#define __DECOMPRESS_H__ + +#define EFI_DECOMPRESS_PROTOCOL_GUID \ + { \ + 0xd8117cfe, 0x94a6, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +typedef struct _EFI_DECOMPRESS_PROTOCOL EFI_DECOMPRESS_PROTOCOL; + +/** + The GetInfo() function retrieves the size of the uncompressed buffer + and the temporary scratch buffer required to decompress the buffer + specified by Source and SourceSize. If the size of the uncompressed + buffer or the size of the scratch buffer cannot be determined from + the compressed data specified by Source and SourceData, then + EFI_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed + buffer is returned in DestinationSize, the size of the scratch buffer is + returned in ScratchSize, and EFI_SUCCESS is returned. + + The GetInfo() function does not have scratch buffer available to perform + a thorough checking of the validity of the source data. It just retrieves + the 'Original Size' field from the beginning bytes of the source data and + output it as DestinationSize. And ScratchSize is specific to the decompression + implementation. + + @param This The protocol instance pointer + @param Source The source buffer containing the compressed data. + @param SourceSize The size, in bytes, of source buffer. + @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer + that will be generated when the compressed buffer specified + by Source and SourceSize is decompressed. + @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that + is required to decompress the compressed buffer specified by + Source and SourceSize. + + @retval EFI_SUCCESS The size of the uncompressed data was returned in DestinationSize + and the size of the scratch buffer was returned in ScratchSize. + @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of the scratch + buffer cannot be determined from the compressed data specified by + Source and SourceData. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DECOMPRESS_GET_INFO) ( + IN EFI_DECOMPRESS_PROTOCOL *This, + IN VOID *Source, + IN UINT32 SourceSize, + OUT UINT32 *DestinationSize, + OUT UINT32 *ScratchSize + ); + +/** + The Decompress() function extracts decompressed data to its original form. + + This protocol is designed so that the decompression algorithm can be + implemented without using any memory services. As a result, the + Decompress() function is not allowed to call AllocatePool() or + AllocatePages() in its implementation. It is the caller's responsibility + to allocate and free the Destination and Scratch buffers. + + If the compressed source data specified by Source and SourceSize is + sucessfully decompressed into Destination, then EFI_SUCCESS is returned. + If the compressed source data specified by Source and SourceSize is not in + a valid compressed data format, then EFI_INVALID_PARAMETER is returned. + + @param This The protocol instance pointer + @param Source The source buffer containing the compressed data. + @param SourceSize The size of source data. + @param Destination On output, the destination buffer that contains + the uncompressed data. + @param DestinationSize The size of destination buffer. The size of destination + buffer needed is obtained from GetInfo(). + @param Scratch A temporary scratch buffer that is used to perform the + decompression. + @param ScratchSize The size of scratch buffer. The size of scratch buffer needed + is obtained from GetInfo(). + + @retval EFI_SUCCESS Decompression completed successfully, and the uncompressed + buffer is returned in Destination. + @retval EFI_INVALID_PARAMETER The source buffer specified by Source and SourceSize is + corrupted (not in a valid compressed format). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DECOMPRESS_DECOMPRESS) ( + IN EFI_DECOMPRESS_PROTOCOL *This, + IN VOID *Source, + IN UINT32 SourceSize, + IN OUT VOID *Destination, + IN UINT32 DestinationSize, + IN OUT VOID *Scratch, + IN UINT32 ScratchSize + ); + +struct _EFI_DECOMPRESS_PROTOCOL { + EFI_DECOMPRESS_GET_INFO GetInfo; + EFI_DECOMPRESS_DECOMPRESS Decompress; +}; + +extern EFI_GUID gEfiDecompressProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/DeviceIo.h b/MdePkg/Include/Protocol/DeviceIo.h new file mode 100644 index 0000000000..643c810a34 --- /dev/null +++ b/MdePkg/Include/Protocol/DeviceIo.h @@ -0,0 +1,222 @@ +/** @file + Device IO protocol as defined in the EFI 1.0 specification. + + Device IO is used to abstract hardware access to devices. It includes + memory mapped IO, IO, PCI Config space, and DMA. + + 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: DeviceIo.h + +**/ + +#ifndef __DEVICE_IO_H__ +#define __DEVICE_IO_H__ + +#define EFI_DEVICE_IO_PROTOCOL_GUID \ + { \ + 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +typedef struct _EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL; + +typedef enum { + IO_UINT8, + IO_UINT16, + IO_UINT32, + IO_UINT64, + MMIO_COPY_UINT8, + MMIO_COPY_UINT16, + MMIO_COPY_UINT32, + MMIO_COPY_UINT64 +} EFI_IO_WIDTH; + +/** + Enables a driver to access device registers in the appropriate memory or I/O space. + + @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance. + @param Width Signifies the width of the I/O operations. + @param Address The base address of the I/O operations. + @param Count The number of I/O operations to perform. + @param Buffer For read operations, the destination buffer to store the results. For write + operations, the source buffer to write data from. + + @retval EFI_SUCCESS The data was read from or written to the device. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Width is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DEVICE_IO) ( + IN EFI_DEVICE_IO_PROTOCOL *This, + IN EFI_IO_WIDTH Width, + IN UINT64 Address, + IN UINTN Count, + IN OUT VOID *Buffer + ); + +typedef struct { + EFI_DEVICE_IO Read; + EFI_DEVICE_IO Write; +} EFI_IO_ACCESS; + +/** + Provides an EFI Device Path for a PCI device with the given PCI configuration space address. + + @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance. + @param PciAddress The PCI configuration space address of the device whose Device Path + is going to be returned. + @param PciDevicePath A pointer to the pointer for the EFI Device Path for PciAddress. + Memory for the Device Path is allocated from the pool. + + @retval EFI_SUCCESS The PciDevicePath returns a pointer to a valid EFI Device Path. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_UNSUPPORTED The PciAddress does not map to a valid EFI Device Path. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_DEVICE_PATH) ( + IN EFI_DEVICE_IO_PROTOCOL *This, + IN UINT64 PciAddress, + IN OUT EFI_DEVICE_PATH_PROTOCOL **PciDevicePath + ); + +typedef enum { + EfiBusMasterRead, + EfiBusMasterWrite, + EfiBusMasterCommonBuffer +} EFI_IO_OPERATION_TYPE; + +/** + Provides the device-specific addresses needed to access system memory. + + @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance. + @param Operation Indicates if the bus master is going to read or write to system memory. + @param HostAddress The system memory address to map to the device. + @param NumberOfBytes On input the number of bytes to map. + @param DeviceAddress The resulting map address for the bus master device to use to access the + hosts HostAddress. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. + @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined. + @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IO_MAP) ( + IN EFI_DEVICE_IO_PROTOCOL *This, + IN EFI_IO_OPERATION_TYPE Operation, + IN EFI_PHYSICAL_ADDRESS *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +/** + Completes the Map() operation and releases any corresponding resources. + + @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. + @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IO_UNMAP) ( + IN EFI_DEVICE_IO_PROTOCOL *This, + IN VOID *Mapping + ); + +/** + Allocates pages that are suitable for an EFIBusMasterCommonBuffer mapping. + + @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance. + @param Type The type allocation to perform. + @param MemoryType The type of memory to allocate, EfiBootServicesData or + EfiRuntimeServicesData. + @param Pages The number of pages to allocate. + @param HostAddress A pointer to store the base address of the allocated range. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. + @retval EFI_INVALID_PARAMETER The requested memory type is invalid. + @retval EFI_UNSUPPORTED The requested HostAddress is not supported on + this platform. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IO_ALLOCATE_BUFFER) ( + IN EFI_DEVICE_IO_PROTOCOL *This, + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages, + IN OUT EFI_PHYSICAL_ADDRESS *HostAddress + ); + +/** + Flushes any posted write data to the device. + + @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance. + + @retval EFI_SUCCESS The buffers were flushed. + @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IO_FLUSH) ( + IN EFI_DEVICE_IO_PROTOCOL *This + ); + +/** + Frees pages that were allocated with AllocateBuffer(). + + @param This A pointer to the EFI_DEVICE_IO_INTERFACE instance. + @param Pages The number of pages to free. + @param HostAddress The base address of the range to free. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_NOT_FOUND The requested memory pages were not allocated with + AllocateBuffer(). + @retval EFI_INVALID_PARAMETER HostAddress is not page aligned or Pages is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IO_FREE_BUFFER) ( + IN EFI_DEVICE_IO_PROTOCOL *This, + IN UINTN Pages, + IN EFI_PHYSICAL_ADDRESS HostAddress + ); + +struct _EFI_DEVICE_IO_PROTOCOL { + EFI_IO_ACCESS Mem; + EFI_IO_ACCESS Io; + EFI_IO_ACCESS Pci; + EFI_IO_MAP Map; + EFI_PCI_DEVICE_PATH PciDevicePath; + EFI_IO_UNMAP Unmap; + EFI_IO_ALLOCATE_BUFFER AllocateBuffer; + EFI_IO_FLUSH Flush; + EFI_IO_FREE_BUFFER FreeBuffer; +}; + +extern EFI_GUID gEfiDeviceIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Uefi/UefiDevicePath.h b/MdePkg/Include/Protocol/DevicePath.h similarity index 75% rename from MdePkg/Include/Uefi/UefiDevicePath.h rename to MdePkg/Include/Protocol/DevicePath.h index 3d27e92420..6ff0050437 100644 --- a/MdePkg/Include/Uefi/UefiDevicePath.h +++ b/MdePkg/Include/Protocol/DevicePath.h @@ -1,25 +1,33 @@ -/* @file - Device Path definitions introduced in UEFI. +/** @file + The device path protocol as defined in EFI 1.0. - This include file must only contain things defined in the UEFI 2.0 specification. - If a code construct is defined in the UEFI 2.0 specification it must be included - by this include file. + The device path represents a programatic path to a device. It's the view + from a software point of view. It also must persist from boot to boot, so + it can not contain things like PCI bus numbers that change from boot to boot. - Copyright (c) 2006 - 2007, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php + 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. + 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: UefiDevicePath.h + Module Name: DevicePath.h **/ -#ifndef __UEFI_DEVICE_PATH_H__ -#define __UEFI_DEVICE_PATH_H__ +#ifndef __EFI_DEVICE_PATH_PROTOCOL_H__ +#define __EFI_DEVICE_PATH_PROTOCOL_H__ + +// +// Device Path protocol +// +#define EFI_DEVICE_PATH_PROTOCOL_GUID \ + { \ + 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } // // Device Path information @@ -27,6 +35,12 @@ #pragma pack(1) +typedef struct { + UINT8 Type; + UINT8 SubType; + UINT8 Length[2]; +} EFI_DEVICE_PATH_PROTOCOL; + // // Hardware Device Paths // @@ -459,8 +473,57 @@ typedef union { } EFI_DEV_PATH_PTR; #pragma pack() - + +#define EFI_DP_TYPE_MASK 0x7F +#define EFI_DP_TYPE_UNPACKED 0x80 +#define END_DEVICE_PATH_TYPE 0x7f + +#define EFI_END_ENTIRE_DEVICE_PATH 0xff +#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff +#define EFI_END_INSTANCE_DEVICE_PATH 0x01 +#define END_ENTIRE_DEVICE_PATH_SUBTYPE EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE +#define END_INSTANCE_DEVICE_PATH_SUBTYPE EFI_END_INSTANCE_DEVICE_PATH + +#define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL)) +#define END_DEVICE_PATH_LENGTH EFI_END_DEVICE_PATH_LENGTH + +#define DP_IS_END_TYPE(a) +#define DP_IS_END_SUBTYPE(a) (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE) +#define DevicePathSubType(a) ((a)->SubType) +#define IsDevicePathUnpacked(a) ((a)->Type & EFI_DP_TYPE_UNPACKED) + +#define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8)) +#define DevicePathNodeLength(a) (EfiDevicePathNodeLength(a)) +#define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a))) +#define NextDevicePathNode(a) (EfiNextDevicePathNode(a)) + +#define EfiDevicePathType(a) (((a)->Type) & EFI_DP_TYPE_MASK) +#define DevicePathType(a) (EfiDevicePathType(a)) +#define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE) +#define IsDevicePathEndType(a) (EfiIsDevicePathEndType(a)) + + +#define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE) +#define IsDevicePathEndSubType(a) (EfiIsDevicePathEndSubType(a)) +#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH) + +#define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a)) +#define IsDevicePathEnd(a) (EfiIsDevicePathEnd(a)) +#define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a)) + + +#define SetDevicePathNodeLength(a,l) { \ + (a)->Length[0] = (UINT8) (l); \ + (a)->Length[1] = (UINT8) ((l) >> 8); \ + } + +#define SetDevicePathEndNode(a) { \ + (a)->Type = END_DEVICE_PATH_TYPE; \ + (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ + (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL); \ + (a)->Length[1] = 0; \ + } + +extern EFI_GUID gEfiDevicePathProtocolGuid; #endif - - diff --git a/MdePkg/Include/Protocol/DevicePathFromText.h b/MdePkg/Include/Protocol/DevicePathFromText.h new file mode 100644 index 0000000000..31b2e068db --- /dev/null +++ b/MdePkg/Include/Protocol/DevicePathFromText.h @@ -0,0 +1,75 @@ +/** @file + EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL as defined in UEFI 2.0. + This protocol provides service to convert text to device paths and device nodes. + + 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: DevicePathFromText.h + +**/ + +#ifndef __DEVICE_PATH_FROM_TEXT_PROTOCOL_H__ +#define __DEVICE_PATH_FROM_TEXT_PROTOCOL_H__ + +#include + +// +// Device Path From Text protocol +// +#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \ + { \ + 0x5c99a21, 0xc70f, 0x4ad2, {0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } \ + } + +/** + Convert text to the binary representation of a device node. + + @param TextDeviceNode TextDeviceNode points to the text representation of a device + node. Conversion starts with the first character and continues + until the first non-device node character. + + @retval a_pointer Pointer to the EFI device node. + @retval NULL if TextDeviceNode is NULL or there was insufficient memory. + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) ( + IN CONST CHAR16 *TextDeviceNode + ) +; + + +/** + Convert text to the binary representation of a device node. + + @param TextDeviceNode TextDevicePath points to the text representation of a device + path. Conversion starts with the first character and continues + until the first non-device path character. + + @retval a_pointer Pointer to the allocated device path. + @retval NULL if TextDeviceNode is NULL or there was insufficient memory. + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) ( + IN CONST CHAR16 *TextDevicePath + ) +; + +typedef struct { + EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertTextToDeviceNode; + EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertTextToDevicePath; +} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL; + +extern EFI_GUID gEfiDevicePathFromTextProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/DevicePathToText.h b/MdePkg/Include/Protocol/DevicePathToText.h new file mode 100644 index 0000000000..0b014120d4 --- /dev/null +++ b/MdePkg/Include/Protocol/DevicePathToText.h @@ -0,0 +1,88 @@ +/** @file + EFI_DEVICE_PATH_TO_TEXT_PROTOCOL as defined in UEFI 2.0. + This protocol provides service to convert device nodes and paths to text. + + 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: DevicePathToText.h + +**/ + +#ifndef __DEVICE_PATH_TO_TEXT_PROTOCOL_H__ +#define __DEVICE_PATH_TO_TEXT_PROTOCOL_H__ + +#include + +// +// Device Path To Text protocol +// +#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \ + { \ + 0x8b843e20, 0x8132, 0x4852, {0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } \ + } + +/** + Convert a device node to its text representation. + + @param DeviceNode Points to the device node to be converted. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + + @retval a_pointer a pointer to the allocated text representation of the device node data + @retval NULL if DeviceNode is NULL or there was insufficient memory. + +**/ +typedef +CHAR16* +(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +; + +/** + Convert a device path to its text representation. + + @param DevicePath Points to the device path to be converted. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts The AllowShortcuts is FALSE, then the shortcut forms of + text representation for a device node cannot be used. + + @retval a_pointer a pointer to the allocated text representation of the device node. + @retval NULL if DevicePath is NULL or there was insufficient memory. + +**/ +typedef +CHAR16* +(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +; + +typedef struct { + EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText; + EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText; +} EFI_DEVICE_PATH_TO_TEXT_PROTOCOL; + +extern EFI_GUID gEfiDevicePathToTextProtocolGuid; + +#endif + + diff --git a/MdePkg/Include/Protocol/DevicePathUtilities.h b/MdePkg/Include/Protocol/DevicePathUtilities.h new file mode 100644 index 0000000000..395945605a --- /dev/null +++ b/MdePkg/Include/Protocol/DevicePathUtilities.h @@ -0,0 +1,197 @@ +/** @file + EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0. + Use to create and manipulate device paths and device nodes. + + 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: DevicePathUtilities.h + +**/ + +#ifndef __DEVICE_PATH_UTILITIES_PROTOCOL_H__ +#define __DEVICE_PATH_UTILITIES_PROTOCOL_H__ + + +#include + +// +// Device Path Utilities protocol +// +#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \ + { \ + 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \ + } + +/** + Returns the size of the device path, in bytes. + + @param DevicePath Points to the start of the EFI device path. + + @revtal Size Size of the specified device path, in bytes, including the end-of-path tag. + +**/ +typedef +UINTN +(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +; + + +/** + Create a duplicate of the specified path. + + @param DevicePath Points to the source EFI device path. + + @retval Pointer A pointer to the duplicate device path. + @retval NULL insufficient memory + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +; + +/** + Create a new path by appending the second device path to the first. + + @param Src1 Points to the first device path. If NULL, then it is ignored. + @param Src2 Points to the second device path. If NULL, then it is ignored. + + @retval Pointer A pointer to the newly created device path. + @retval NULL Memory could not be allocated + or either DevicePath or DeviceNode is NULL. + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1, + IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2 + ) +; + +/** + Creates a new path by appending the device node to the device path. + + @param DevicePath Points to the device path. + @param DeviceNode Points to the device node. + + @retval Pointer A pointer to the allocated device node. + @retval NULL Memory could not be allocated + or either DevicePath or DeviceNode is NULL. + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode + ) +; + +/** + Creates a new path by appending the specified device path instance to the specified device path. + + @param DevicePath Points to the device path. If NULL, then ignored. + @param DevicePathInstance Points to the device path instance. + + @retval Pointer A pointer to the newly created device path + @retval NULL Memory could not be allocated or DevicePathInstance is NULL. + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance + ) +; + +/** + Creates a copy of the current device path instance and returns a pointer to the next device path + instance. + + @param DevicePathInstance On input, this holds the pointer to the current device path + instance. On output, this holds the pointer to the next + device path instance or NULL if there are no more device + path instances in the device path. + @param DevicePathInstanceSize On output, this holds the size of the device path instance, + in bytes or zero, if DevicePathInstance is zero. + + @retval Pointer A pointer to the copy of the current device path instance. + @retval NULL DevicePathInstace was NULL on entry or there was insufficient memory. + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE) ( + IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance, + OUT UINTN *DevicePathInstanceSize + ) +; + +/** + Creates a device node + + @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for + the new device node. + @param NodeSubType NodeSubType is the device node sub-type + EFI_DEVICE_PATH.SubType) for the new device node. + @param NodeLength NodeLength is the length of the device node + (EFI_DEVICE_PATH.Length) for the new device node. + + @retval Pointer A pointer to the newly created device node. + @retval NULL NodeLength is less than + the size of the header or there was insufficient memory. + +**/ +typedef +EFI_DEVICE_PATH_PROTOCOL* +(EFIAPI *EFI_DEVICE_PATH_CREATE_NODE) ( + IN UINT8 NodeType, + IN UINT8 NodeSubType, + IN UINT16 NodeLength +) +; + +/** + Returns whether a device path is multi-instance. + + @param DevicePath Points to the device path. If NULL, then ignored. + + @retval TRUE The device path has more than one instance + @retval FALSE The device path is empty or contains only a single instance. + +**/ +typedef +BOOLEAN +(EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE) ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +; + + +typedef struct { + EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize; + EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath; + EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath; + EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode; + EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance; + EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance; + EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance; + EFI_DEVICE_PATH_CREATE_NODE CreateDeviceNode; +} EFI_DEVICE_PATH_UTILITIES_PROTOCOL; + +extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Dhcp4.h b/MdePkg/Include/Protocol/Dhcp4.h new file mode 100644 index 0000000000..3adce1a04a --- /dev/null +++ b/MdePkg/Include/Protocol/Dhcp4.h @@ -0,0 +1,442 @@ +/** @file + EFI_DHCP4_PROTOCOL as defined in UEFI 2.0. + EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0. + These protocols are used to collect configuration information for the EFI IPv4 Protocol + drivers and to provide DHCPv4 server and PXE boot server discovery 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: DHCP4.h + +**/ + +#ifndef __EFI_DHCP4_PROTOCOL_H__ +#define __EFI_DHCP4_PROTOCOL_H__ + +#define EFI_DHCP4_PROTOCOL_GUID \ + { \ + 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \ + } + +#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \ + } + +typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL; + + +#pragma pack(1) +typedef struct { + UINT8 OpCode; + UINT8 Length; + UINT8 Data[1]; +} EFI_DHCP4_PACKET_OPTION; +#pragma pack() + + +#pragma pack(1) +typedef struct { + UINT8 OpCode; + UINT8 HwType; + UINT8 HwAddrLen; + UINT8 Hops; + UINT32 Xid; + UINT16 Seconds; + UINT16 Reserved; + EFI_IPv4_ADDRESS ClientAddr; //Client IP address from client + EFI_IPv4_ADDRESS YourAddr; //Client IP address from server + EFI_IPv4_ADDRESS ServerAddr; //IP address of next server in bootstrap + EFI_IPv4_ADDRESS GatewayAddr; //Relay agent IP address + UINT8 ClientHwAddr[16]; //Client hardware address + CHAR8 ServerName[64]; + CHAR8 BootFileName[128]; +}EFI_DHCP4_HEADER; +#pragma pack() + + +#pragma pack(1) +typedef struct { + UINT32 Size; + UINT32 Length; + + struct { + EFI_DHCP4_HEADER Header; + UINT32 Magik; + UINT8 Option[1]; + } Dhcp4; +} EFI_DHCP4_PACKET; +#pragma pack() + + +typedef enum { + Dhcp4Stopped = 0x0, + Dhcp4Init = 0x1, + Dhcp4Selecting = 0x2, + Dhcp4Requesting = 0x3, + Dhcp4Bound = 0x4, + Dhcp4Renewing = 0x5, + Dhcp4Rebinding = 0x6, + Dhcp4InitReboot = 0x7, + Dhcp4Rebooting = 0x8 +} EFI_DHCP4_STATE; + + +typedef enum{ + Dhcp4SendDiscover = 0x01, + Dhcp4RcvdOffer = 0x02, + Dhcp4SelectOffer = 0x03, + Dhcp4SendRequest = 0x04, + Dhcp4RcvdAck = 0x05, + Dhcp4RcvdNak = 0x06, + Dhcp4SendDecline = 0x07, + Dhcp4BoundCompleted = 0x08, + Dhcp4EnterRenewing = 0x09, + Dhcp4EnterRebinding = 0x0a, + Dhcp4AddressLost = 0x0b, + Dhcp4Fail = 0x0c +} EFI_DHCP4_EVENT; + +/** + Callback routine + + @param This Pointer to the EFI DHCPv4 Protocol instance that is used to + configure this callback function. + @param Context Pointer to the context that is initialized by + EFI_DHCP4_PROTOCOL.Configure(). + @param CurrentState The current operational state of the EFI DHCPv4 Protocol + driver. + @param Dhcp4Event The event that occurs in the current state, which usually means a + state transition. + @param Packet The DHCP packet that is going to be sent or already received. + @param NewPacket The packet that is used to replace the above Packet. + + @retval EFI_SUCCESS Tells the EFI DHCPv4 Protocol driver to continue the DHCP process. + @retval EFI_NOT_READY Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol + driver will continue to wait for more DHCPOFFER packets until the retry + timeout expires. + @retval EFI_ABORTED Tells the EFI DHCPv4 Protocol driver to abort the current process and + return to the Dhcp4Init or Dhcp4InitReboot state. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_CALLBACK) ( + IN EFI_DHCP4_PROTOCOL *This, + IN VOID *Context, + IN EFI_DHCP4_STATE CurrentState, + IN EFI_DHCP4_EVENT Dhcp4Event, + IN EFI_DHCP4_PACKET *Packet OPTIONAL, + OUT EFI_DHCP4_PACKET **NewPacket OPTIONAL + ); + + +typedef struct { + UINT32 DiscoverTryCount; + UINT32 *DiscoverTimeout; + UINT32 RequestTryCount; + UINT32 *RequestTimeout; + EFI_IPv4_ADDRESS ClientAddress; + EFI_DHCP4_CALLBACK Dhcp4Callback; + void *CallbackContext; + UINT32 OptionCount; + EFI_DHCP4_PACKET_OPTION **OptionList; +} EFI_DHCP4_CONFIG_DATA; + + +typedef struct { + EFI_DHCP4_STATE State; + EFI_DHCP4_CONFIG_DATA ConfigData; + EFI_IPv4_ADDRESS ClientAddress; + EFI_MAC_ADDRESS ClientMacAddress; + EFI_IPv4_ADDRESS ServerAddress; + EFI_IPv4_ADDRESS RouterAddress; + EFI_IPv4_ADDRESS SubnetMask; + UINT32 LeaseTime; + EFI_DHCP4_PACKET *ReplyPacket; +} EFI_DHCP4_MODE_DATA; + + +typedef struct { + EFI_IPv4_ADDRESS ListenAddress; + EFI_IPv4_ADDRESS SubnetMask; + UINT16 ListenPort; +} EFI_DHCP4_LISTEN_POINT; + + +typedef struct { + OUT EFI_STATUS Status; + IN EFI_EVENT CompletionEvent; + IN EFI_IPv4_ADDRESS RemoteAddress; + IN UINT16 RemotePort; + IN EFI_IPv4_ADDRESS GatewayAddress; + IN UINT32 ListenPointCount; + IN EFI_DHCP4_LISTEN_POINT *ListenPoints; + IN UINT32 TimeoutValue; + IN EFI_DHCP4_PACKET *Packet; + OUT UINT32 ResponseCount; + OUT EFI_DHCP4_PACKET *ResponseList; +} EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN; + + +/** + Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + @param Dhcp4ModeData Pointer to storage for the EFI_DHCP4_MODE_DATA structure. + + @retval EFI_SUCCESS The mode data was returned. + @retval EFI_INVALID_PARAMETER This is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_GET_MODE_DATA)( + IN EFI_DHCP4_PROTOCOL *This, + OUT EFI_DHCP4_MODE_DATA *Dhcp4ModeData + ) +; + +/** + Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + @param Dhcp4CfgData Pointer to the EFI_DHCP4_CONFIG_DATA. + + @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or + Dhcp4InitReboot state, if the original state of this driver + was Dhcp4Stopped and the value of Dhcp4CfgData was + not NULL. Otherwise, the state was left unchanged. + @retval EFI_ACCESS_DENIED This instance of the EFI DHCPv4 Protocol driver was not in the + Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state; + Or onother instance of this EFI DHCPv4 Protocol driver is already + in a valid configured state. + @retval EFI_INVALID_PARAMETER Some parameter is NULL. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_CONFIGURE) ( + IN EFI_DHCP4_PROTOCOL *This, + IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL + ) +; + + +/** + Starts the DHCP configuration process. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + @param CompletionEvent If not NULL, indicates the event that will be signaled when the + EFI DHCPv4 Protocol driver is transferred into the + Dhcp4Bound state or when the DHCP process is aborted. + EFI_DHCP4_PROTOCOL.GetModeData() can be called to + check the completion status. If NULL, + EFI_DHCP4_PROTOCOL.Start() will wait until the driver + is transferred into the Dhcp4Bound state or the process fails. + + @retval EFI_SUCCESS The DHCP configuration process has started, or it has completed + when CompletionEvent is NULL. + @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped + state. EFI_DHCP4_PROTOCOL. Configure() needs to be called. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_TIMEOUT The DHCP configuration process failed because no response was + received from the server within the specified timeout value. + @retval EFI_ABORTED The user aborted the DHCP process. + @retval EFI_ALREADY_STARTED Some other EFI DHCPv4 Protocol instance already started the + DHCP process. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_START) ( + IN EFI_DHCP4_PROTOCOL *This, + IN EFI_EVENT CompletionEvent OPTIONAL + ) +; + +/** + Extends the lease time by sending a request packet. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + @param RebindRequest If TRUE, this function broadcasts the request packets and enters + the Dhcp4Rebinding state. Otherwise, it sends a unicast + request packet and enters the Dhcp4Renewing state. + @param CompletionEvent If not NULL, this event is signaled when the renew/rebind phase + completes or some error occurs. + EFI_DHCP4_PROTOCOL.GetModeData() can be called to + check the completion status. If NULL, + EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait + until the DHCP process finishes. + + @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the + Dhcp4Renewing state or is back to the Dhcp4Bound state. + @retval EFI_NOT_STARTED The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped + state. EFI_DHCP4_PROTOCOL.Configure() needs to + be called. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_TIMEOUT There was no response from the server when the try count was + exceeded. + @retval EFI_ACCESS_DENIED The driver is not in the Dhcp4Bound state. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_RENEW_REBIND) ( + IN EFI_DHCP4_PROTOCOL *This, + IN BOOLEAN RebindRequest, + IN EFI_EVENT CompletionEvent OPTIONAL + ) +; + +/** + Releases the current address configuration. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + + @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_ACCESS_DENIED The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_RELEASE) ( + IN EFI_DHCP4_PROTOCOL *This + ) +; + +/** + Stops the current address configuration. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + + @retval EFI_SUCCESS The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase. + @retval EFI_INVALID_PARAMETER This is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_STOP) ( + IN EFI_DHCP4_PROTOCOL *This + ) +; + +/** + Builds a DHCP packet, given the options to be appended or deleted or replaced. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + @param SeedPacket Initial packet to be used as a base for building new packet. + @param DeleteCount Number of opcodes in the DeleteList. + @param DeleteList List of opcodes to be deleted from the seed packet. + Ignored if DeleteCount is zero. + @param AppendCount Number of entries in the OptionList. + @param AppendList Pointer to a DHCP option list to be appended to SeedPacket. + If SeedPacket also contains options in this list, they are + replaced by new options (except pad option). Ignored if + AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION + @param NewPacket Pointer to storage for the pointer to the new allocated packet. + Use the EFI Boot Service FreePool() on the resulting pointer + when done with the packet. + + @retval EFI_SUCCESS The new packet was built. + @retval EFI_OUT_OF_RESOURCES Storage for the new packet could not be allocated. + @retval EFI_INVALID_PARAMETER Some parameter is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_BUILD) ( + IN EFI_DHCP4_PROTOCOL *This, + IN EFI_DHCP4_PACKET *SeedPacket, + IN UINT32 DeleteCount, + IN UINT8 *DeleteList OPTIONAL, + IN UINT32 AppendCount, + IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL, + OUT EFI_DHCP4_PACKET **NewPacket + ); +; + +/** + Transmits a DHCP formatted packet and optionally waits for responses. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + @param Token Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure. + + @retval EFI_SUCCESS The packet was successfully queued for transmission. + @retval EFI_INVALID_PARAMETER Some parameter is NULL. + @retval EFI_NOT_READY The previous call to this function has not finished yet. Try to call + this function after collection process completes. + @retval EFI_NO_MAPPING The default station address is not available yet. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval Others Some other unexpected error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE) ( + IN EFI_DHCP4_PROTOCOL *This, + IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token + ) +; + + +/** + Parses the packed DHCP option data. + + @param This Pointer to the EFI_DHCP4_PROTOCOL instance. + @param Packet Pointer to packet to be parsed. + @param OptionCount On input, the number of entries in the PacketOptionList. + On output, the number of entries that were written into the + PacketOptionList. + @param PacketOptionList List of packet option entries to be filled in. End option or pad + options are not included. + + @retval EFI_SUCCESS The packet was successfully parsed. + @retval EFI_INVALID_PARAMETER Some parameter is NULL. + @retval EFI_BUFFER_TOO_SMALL One or more of the following conditions is TRUE: + 1) *OptionCount is smaller than the number of options that + were found in the Packet. + 2) PacketOptionList is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DHCP4_PARSE) ( + IN EFI_DHCP4_PROTOCOL *This, + IN EFI_DHCP4_PACKET *Packet, + IN OUT UINT32 *OptionCount, + OUT EFI_DHCP4_PACKET_OPTION *PacketOptionList[] OPTIONAL + ) +; + + +struct _EFI_DHCP4_PROTOCOL { + EFI_DHCP4_GET_MODE_DATA GetModeData; + EFI_DHCP4_CONFIGURE Configure; + EFI_DHCP4_START Start; + EFI_DHCP4_RENEW_REBIND RenewRebind; + EFI_DHCP4_RELEASE Release; + EFI_DHCP4_STOP Stop; + EFI_DHCP4_BUILD Build; + EFI_DHCP4_TRANSMIT_RECEIVE TransmitReceive; + EFI_DHCP4_PARSE Parse; +}; + +extern EFI_GUID gEfiDhcp4ProtocolGuid; +extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/DiskIo.h b/MdePkg/Include/Protocol/DiskIo.h new file mode 100644 index 0000000000..e36792c7cd --- /dev/null +++ b/MdePkg/Include/Protocol/DiskIo.h @@ -0,0 +1,98 @@ +/** @file + Disk IO protocol as defined in the EFI 1.0 specification. + + The Disk IO protocol is used to convert block oriented devices into byte + oriented devices. The Disk IO protocol is intended to layer on top of the + Block IO 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: DiskIo.h + +**/ + +#ifndef __DISK_IO_H__ +#define __DISK_IO_H__ + +#define EFI_DISK_IO_PROTOCOL_GUID \ + { \ + 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL; + +/** + Read BufferSize bytes from Offset into Buffer. + + @param This Protocol instance pointer. + @param MediaId Id of the media, changes every time the media is replaced. + @param Offset The starting byte offset to read from + @param BufferSize Size of Buffer + @param Buffer Buffer containing read data + + @retval EFI_SUCCESS The data was read correctly from the device. + @retval EFI_DEVICE_ERROR The device reported an error while performing the read. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device. + @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not + valid for the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DISK_READ) ( + IN EFI_DISK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN UINT64 Offset, + IN UINTN BufferSize, + OUT VOID *Buffer + ) +; + +/** + Read BufferSize bytes from Offset into Buffer. + + @param This Protocol instance pointer. + @param MediaId Id of the media, changes every time the media is replaced. + @param Offset The starting byte offset to read from + @param BufferSize Size of Buffer + @param Buffer Buffer containing read data + + @retval EFI_SUCCESS The data was written correctly to the device. + @retval EFI_WRITE_PROTECTED The device can not be written to. + @retval EFI_DEVICE_ERROR The device reported an error while performing the write. + @retval EFI_NO_MEDIA There is no media in the device. + @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device. + @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not + valid for the device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DISK_WRITE) ( + IN EFI_DISK_IO_PROTOCOL *This, + IN UINT32 MediaId, + IN UINT64 Offset, + IN UINTN BufferSize, + IN VOID *Buffer + ) +; + +#define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000 + +struct _EFI_DISK_IO_PROTOCOL { + UINT64 Revision; + EFI_DISK_READ ReadDisk; + EFI_DISK_WRITE WriteDisk; +}; + +extern EFI_GUID gEfiDiskIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/DriverBinding.h b/MdePkg/Include/Protocol/DriverBinding.h new file mode 100644 index 0000000000..5f5d90963e --- /dev/null +++ b/MdePkg/Include/Protocol/DriverBinding.h @@ -0,0 +1,111 @@ +/** @file + EFI ControllerHandle Driver 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: DriverBinding.h + +**/ + +#ifndef __EFI_DRIVER_BINDING_H__ +#define __EFI_DRIVER_BINDING_H__ + +// +// Global ID for the ControllerHandle Driver Protocol +// +#define EFI_DRIVER_BINDING_PROTOCOL_GUID \ + { \ + 0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71 } \ + } + +typedef struct _EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL; + +/** + Test to see if this driver supports ControllerHandle. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to test + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver supports this device + @retval EFI_ALREADY_STARTED This driver is already running on this device + @retval other This driver does not support this device + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_BINDING_SUPPORTED) ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL + ) +; + +/** + Start this driver on ControllerHandle. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to bind driver to + @param RemainingDevicePath Optional parameter use to pick a specific child + device to start. + + @retval EFI_SUCCESS This driver is added to ControllerHandle + @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle + @retval other This driver does not support this device + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_BINDING_START) ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL + ) +; + +/** + Stop this driver on ControllerHandle. + + @param This Protocol instance pointer. + @param ControllerHandle Handle of device to stop driver on + @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of + children is zero stop the entire bus driver. + @param ChildHandleBuffer List of Child Handles to Stop. + + @retval EFI_SUCCESS This driver is removed ControllerHandle + @retval other This driver was not removed from this device + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_BINDING_STOP) ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer OPTIONAL + ) +; + +// +// Interface structure for the ControllerHandle Driver Protocol +// +struct _EFI_DRIVER_BINDING_PROTOCOL { + EFI_DRIVER_BINDING_SUPPORTED Supported; + EFI_DRIVER_BINDING_START Start; + EFI_DRIVER_BINDING_STOP Stop; + UINT32 Version; + EFI_HANDLE ImageHandle; + EFI_HANDLE DriverBindingHandle; +}; + +extern EFI_GUID gEfiDriverBindingProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/DriverConfiguration.h b/MdePkg/Include/Protocol/DriverConfiguration.h new file mode 100644 index 0000000000..f4f0c7aeb2 --- /dev/null +++ b/MdePkg/Include/Protocol/DriverConfiguration.h @@ -0,0 +1,203 @@ +/** @file + EFI Driver Configuration 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: DriverConfiguration.h + +**/ + +#ifndef __EFI_DRIVER_CONFIGURATION_H__ +#define __EFI_DRIVER_CONFIGURATION_H__ + +// +// Global ID for the Driver Configuration Protocol defined in EFI 1.10 +// +#define EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \ + { \ + 0x107a772b, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +// +// Global ID for the Driver Configuration Protocol defined in UEFI 2.0 +// +#define UEFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \ + { \ + 0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe } \ + } + +typedef struct _EFI_DRIVER_CONFIGURATION_PROTOCOL EFI_DRIVER_CONFIGURATION_PROTOCOL; + +typedef enum { + EfiDriverConfigurationActionNone = 0, + EfiDriverConfigurationActionStopController = 1, + EfiDriverConfigurationActionRestartController = 2, + EfiDriverConfigurationActionRestartPlatform = 3, + EfiDriverConfigurationActionMaximum +} EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED; + +#define EFI_DRIVER_CONFIGURATION_SAFE_DEFAULTS 0x00000000 +#define EFI_DRIVER_CONFIGURATION_MANUFACTURING_DEFAULTS 0x00000001 +#define EFI_DRIVER_CONFIGURATION_CUSTOM_DEFAULTS 0x00000002 +#define EFI_DRIVER_CONFIGURATION_PERORMANCE_DEFAULTS 0x00000003 + +/** + Allows the user to set controller specific options for a controller that a + driver is currently managing. + + @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance. + @param ControllerHandle The handle of the controller to set options on. + @param ChildHandle The handle of the child controller to set options on. This + is an optional parameter that may be NULL. It will be NULL + for device drivers, and for a bus drivers that wish to set + options for the bus controller. It will not be NULL for a + bus driver that wishes to set options for one of its child + controllers. + @param Language A pointer to a three character ISO 639-2 language identifier. + This is the language of the user interface that should be + presented to the user, and it must match one of the languages + specified in SupportedLanguages. The number of languages + supported by a driver is up to the driver writer. + @param ActionRequired A pointer to the action that the calling agent is required + to perform when this function returns. See "Related + Definitions" for a list of the actions that the calling + agent is required to perform prior to accessing + ControllerHandle again. + + @retval EFI_SUCCESS The driver specified by This successfully set the + configuration options for the controller specified + by ControllerHandle.. + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ActionRequired is NULL. + @retval EFI_UNSUPPORTED The driver specified by This does not support setting + configuration options for the controller specified by + ControllerHandle and ChildHandle. + @retval EFI_UNSUPPORTED The driver specified by This does not support the + language specified by Language. + @retval EFI_DEVICE_ERROR A device error occurred while attempt to set the + configuration options for the controller specified + by ControllerHandle and ChildHandle. + @retval EFI_OUT_RESOURCES There are not enough resources available to set the + configuration options for the controller specified + by ControllerHandle and ChildHandle. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_CONFIGURATION_SET_OPTIONS) ( + IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN CHAR8 *Language, + OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired + ); + +/** + Tests to see if a controller's current configuration options are valid. + + @param This A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL instance. + @param ControllerHandle The handle of the controller to test if it's current + configuration options are valid. + @param ChildHandle The handle of the child controller to test if it's current + configuration options are valid. This is an optional + parameter that may be NULL. It will be NULL for device + drivers. It will also be NULL for a bus drivers that wish + to test the configuration options for the bus controller. + It will not be NULL for a bus driver that wishes to test + configuration options for one of its child controllers. + + @retval EFI_SUCCESS The controller specified by ControllerHandle and + ChildHandle that is being managed by the driver + specified by This has a valid set of configuration + options. + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE. + @retval EFI_UNSUPPORTED The driver specified by This is not currently + managing the controller specified by ControllerHandle + and ChildHandle. + @retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and + ChildHandle that is being managed by the driver + specified by This has an invalid set of configuration + options. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_CONFIGURATION_OPTIONS_VALID) ( + IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL + ); + +/** + Forces a driver to set the default configuration options for a controller. + + @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance. + @param ControllerHandle The handle of the controller to force default configuration options on. + @param ChildHandle The handle of the child controller to force default configuration options on This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to force default configuration options for the bus controller. It will not be NULL for a bus driver that wishes to force default configuration options for one of its child controllers. + @param DefaultType The type of default configuration options to force on the controller specified by ControllerHandle and ChildHandle. See Table 9-1 for legal values. A DefaultType of 0x00000000 must be supported by this protocol. + @param ActionRequired A pointer to the action that the calling agent is required to perform when this function returns. See "Related Definitions" in Section 9.1for a list of the actions that the calling agent is required to perform prior to accessing ControllerHandle again. + + @retval EFI_SUCCESS The driver specified by This successfully forced the default configuration options on the controller specified by ControllerHandle and ChildHandle. + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ActionRequired is NULL. + @retval EFI_UNSUPPORTED The driver specified by This does not support forcing the default configuration options on the controller specified by ControllerHandle and ChildHandle. + @retval EFI_UNSUPPORTED The driver specified by This does not support the configuration type specified by DefaultType. + @retval EFI_DEVICE_ERROR A device error occurred while attempt to force the default configuration options on the controller specified by ControllerHandle and ChildHandle. + @retval EFI_OUT_RESOURCES There are not enough resources available to force the default configuration options on the controller specified by ControllerHandle and ChildHandle. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_CONFIGURATION_FORCE_DEFAULTS) ( + IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN UINT32 DefaultType, + OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired + ); + + +// +// +struct _EFI_DRIVER_CONFIGURATION_PROTOCOL { + EFI_DRIVER_CONFIGURATION_SET_OPTIONS SetOptions; + EFI_DRIVER_CONFIGURATION_OPTIONS_VALID OptionsValid; + EFI_DRIVER_CONFIGURATION_FORCE_DEFAULTS ForceDefaults; + CHAR8 *SupportedLanguages; +}; + +/** + Interface structure for the Driver Configuration Protocol. + + @par Protocol Description: + Used to set configuration options for a controller that an EFI Driver is managing. + + @param SetOptions Allows the use to set drivers specific configuration + options for a controller that the driver is currently managing. + + @param OptionsValid Tests to see if a controller's current configuration + options are valid. + + @param ForceDefaults Forces a driver to set the default configuration options + for a controller. + + @param SupportedLanguages A Null-terminated ASCII string that contains one or more + ISO 639-2 language codes. This is the list of language + codes that this protocol supports. + +**/ + +extern EFI_GUID gEfiDriverConfigurationProtocolGuid; +extern EFI_GUID gUefiDriverConfigurationProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/DriverDiagnostics.h b/MdePkg/Include/Protocol/DriverDiagnostics.h new file mode 100644 index 0000000000..c0a0cbc63b --- /dev/null +++ b/MdePkg/Include/Protocol/DriverDiagnostics.h @@ -0,0 +1,134 @@ +/** @file + EFI Driver Diagnostics 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: DriverDiagnostics.h + +**/ + +#ifndef __EFI_DRIVER_DIAGNOSTICS_H__ +#define __EFI_DRIVER_DIAGNOSTICS_H__ + +// +// Global ID for the Driver Diagnostics Protocol as defined in EFI 1.10. +// +#define EFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \ + { \ + 0x0784924f, 0xe296, 0x11d4, {0x9a, 0x49, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +// +// Global ID for the Driver Diagnostics Protocol as defined in UEFI 2.0. +// +#define UEFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \ + { \ + 0x4d330321, 0x025f, 0x4aac, {0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63 } \ + } + +typedef struct _EFI_DRIVER_DIAGNOSTICS_PROTOCOL EFI_DRIVER_DIAGNOSTICS_PROTOCOL; + +typedef enum { + EfiDriverDiagnosticTypeStandard = 0, + EfiDriverDiagnosticTypeExtended = 1, + EfiDriverDiagnosticTypeManufacturing= 2, + EfiDriverDiagnosticTypeMaximum +} EFI_DRIVER_DIAGNOSTIC_TYPE; + +/** + Runs diagnostics on a controller. + + @param This A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL instance. + @param ControllerHandle The handle of the controller to run diagnostics on. + @param ChildHandle The handle of the child controller to run diagnostics on + This is an optional parameter that may be NULL. It will + be NULL for device drivers. It will also be NULL for a + bus drivers that wish to run diagnostics on the bus + controller. It will not be NULL for a bus driver that + wishes to run diagnostics on one of its child controllers. + @param DiagnosticType Indicates type of diagnostics to perform on the controller + specified by ControllerHandle and ChildHandle. See + "Related Definitions" for the list of supported types. + @param Language A pointer to a three character ISO 639-2 language + identifier. This is the language in which the optional + error message should be returned in Buffer, and it must + match one of the languages specified in SupportedLanguages. + The number of languages supported by a driver is up to + the driver writer. + @param ErrorType A GUID that defines the format of the data returned in Buffer. + @param BufferSize The size, in bytes, of the data returned in Buffer. + @param Buffer A buffer that contains a Null-terminated Unicode string + plus some additional data whose format is defined by + ErrorType. Buffer is allocated by this function with + AllocatePool(), and it is the caller's responsibility + to free it with a call to FreePool(). + + @retval EFI_SUCCESS The controller specified by ControllerHandle and + ChildHandle passed the diagnostic. + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER Language is NULL. + @retval EFI_INVALID_PARAMETER ErrorType is NULL. + @retval EFI_INVALID_PARAMETER BufferType is NULL. + @retval EFI_INVALID_PARAMETER Buffer is NULL. + @retval EFI_UNSUPPORTED The driver specified by This does not support + running diagnostics for the controller specified + by ControllerHandle and ChildHandle. + @retval EFI_UNSUPPORTED The driver specified by This does not support the + type of diagnostic specified by DiagnosticType. + @retval EFI_UNSUPPORTED The driver specified by This does not support the + language specified by Language. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available to complete + the diagnostics. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available to return + the status information in ErrorType, BufferSize, + and Buffer. + @retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and + ChildHandle did not pass the diagnostic. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DRIVER_DIAGNOSTICS_RUN_DIAGNOSTICS) ( + IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType, + IN CHAR8 *Language, + OUT EFI_GUID **ErrorType, + OUT UINTN *BufferSize, + OUT CHAR16 **Buffer + ); + + +// +// + +/** + Interface structure for the Driver Diagnostics Protocol. + + @par Protocol Description: + Used to perform diagnostics on a controller that an EFI Driver is managing. + + @param RunDiagnostics Runs diagnostics on a controller. + @param SupportedLanguages A Null-terminated ASCII string that contains one or more + ISO 639-2 language codes. This is the list of language + codes that this protocol supports. + +**/ +struct _EFI_DRIVER_DIAGNOSTICS_PROTOCOL { + EFI_DRIVER_DIAGNOSTICS_RUN_DIAGNOSTICS RunDiagnostics; + CHAR8 *SupportedLanguages; +}; + +extern EFI_GUID gEfiDriverDiagnosticsProtocolGuid; +extern EFI_GUID gUefiDriverDiagnosticsProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/DriverSupportedEfiVersion.h b/MdePkg/Include/Protocol/DriverSupportedEfiVersion.h new file mode 100644 index 0000000000..84e30ef2f6 --- /dev/null +++ b/MdePkg/Include/Protocol/DriverSupportedEfiVersion.h @@ -0,0 +1,52 @@ +/** @file + The file provides information about the version of the EFI + specification that a driver is following. This protocol is + required for EFI drivers that are on PCI and other plug in + cards. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: DriverSupportedEfiVesrion.h + +**/ + +#ifndef __DRIVER_SUPPORTED_EFI_VERSION_H__ +#define __DRIVER_SUPPORTED_EFI_VERSION_H__ + +#define EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL_GUID \ + { 0x5c198761, 0x16a8, 0x4e69, { 0x97, 0x2c, 0x89, 0xd6, 0x79, 0x54, 0xf8, 0x1d } } + + +/** + + The EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL provides a + mechanism for an EFI driver to publish the version of the EFI + specification it conforms to. This protocol must be placed on + the drivers image handle when the driver????s entry point is + called. + + @param Length The size, in bytes, of the entire structure. + Future versions of this specification may grow + the size of the structure. + + @param irmwareVersion The version of the EFI specification + that this driver conforms to. + EFI_2_10_SYSTEM_TABLE_REVISION for this + version of this specification. + +**/ +typedef struct _EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL { + UINT32 Length; + UINT32 FirmwareVersion; +} EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL; + +extern EFI_GUID gEfiDriverSupportedEfiVersionProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Ebc.h b/MdePkg/Include/Protocol/Ebc.h new file mode 100644 index 0000000000..c1abcbac5b --- /dev/null +++ b/MdePkg/Include/Protocol/Ebc.h @@ -0,0 +1,148 @@ +/** @file + Describes the protocol interface to the EBC interpreter. + + 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: Ebc.h + +**/ + +#ifndef __EFI_EBC_PROTOCOL_H__ +#define __EFI_EBC_PROTOCOL_H__ + +#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \ + { \ + 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 } \ + } + +// +// Protocol Guid Name defined in spec. +// +#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID + +// +// Define for forward reference. +// +typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL; + +/** + Create a thunk for an image entry point. In short, given the physical address + of the entry point for a loaded image, create a thunk that does some + fixup of arguments (and perform any other necessary overhead) and then + calls the original entry point. The caller can then use the returned pointer + to the created thunk as the new entry point to image. + + @param This protocol instance pointer + @param ImageHandle handle to the image. The EBC interpreter may use this to keep + track of any resource allocations performed in loading and + executing the image. + @param EbcEntryPoint the entry point for the image (as defined in the file header) + @param Thunk pointer to thunk pointer where the address of the created + thunk is returned. + + @return Standard EFI_STATUS + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EBC_CREATE_THUNK) ( + IN EFI_EBC_PROTOCOL *This, + IN EFI_HANDLE ImageHandle, + IN VOID *EbcEntryPoint, + OUT VOID **Thunk + ); + +/** + Perform any cleanup necessary when an image is unloaded. Basically it gives + the EBC interpreter the chance to free up any resources allocated during + load and execution of an EBC image. + + @param This protocol instance pointer + @param ImageHandle the handle of the image being unloaded. + + @return Standard EFI_STATUS. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EBC_UNLOAD_IMAGE) ( + IN EFI_EBC_PROTOCOL *This, + IN EFI_HANDLE ImageHandle + ); + +/** + The I-Cache-flush registration service takes a pointer to a function to + call to flush the I-Cache. Here's the prototype for that function pointer. + + @param Start physical start address of CPU instruction cache to flush. + @param Length how many bytes to flush of the instruction cache. + + @return Standard EFI_STATUS. + +**/ +typedef +EFI_STATUS +(EFIAPI *EBC_ICACHE_FLUSH) ( + IN EFI_PHYSICAL_ADDRESS Start, + IN UINT64 Length + ); + +/** + This routine is called by the core firmware to provide the EBC driver with + a function to call to flush the CPU's instruction cache following creation + of a thunk. It is not required. + + @param This protocol instance pointer + @param Flush pointer to the function to call to flush the CPU instruction + cache. + + @return Standard EFI_STATUS. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH) ( + IN EFI_EBC_PROTOCOL *This, + IN EBC_ICACHE_FLUSH Flush + ); + +/** + This routine can be called to get the VM revision. It returns the same + value as the EBC BREAK 1 instruction returns. + + @param This protocol instance pointer + @param Version pointer to where to return the VM version + + @return Standard EFI_STATUS. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EBC_GET_VERSION) ( + IN EFI_EBC_PROTOCOL *This, + IN OUT UINT64 *Version + ); + +// +// Prototype for the actual EBC protocol interface +// +struct _EFI_EBC_PROTOCOL { + EFI_EBC_CREATE_THUNK CreateThunk; + EFI_EBC_UNLOAD_IMAGE UnloadImage; + EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush; + EFI_EBC_GET_VERSION GetVersion; +}; + +// +// Extern the global EBC protocol GUID +// +extern EFI_GUID gEfiEbcProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/EdidActive.h b/MdePkg/Include/Protocol/EdidActive.h new file mode 100644 index 0000000000..0562cbec36 --- /dev/null +++ b/MdePkg/Include/Protocol/EdidActive.h @@ -0,0 +1,34 @@ +/** @file + EDID Active Protocol from the UEFI 2.0 specification. + + Placed on the video output device child handle that are actively displaying output. + + 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: EdidActive.h + +**/ + +#ifndef __EDID_ACTIVE_H__ +#define __EDID_ACTIVE_H__ + +#define EFI_EDID_ACTIVE_PROTOCOL_GUID \ + { \ + 0xbd8c1056, 0x9f36, 0x44ec, {0x92, 0xa8, 0xa6, 0x33, 0x7f, 0x81, 0x79, 0x86 } \ + } + +typedef struct { + UINT32 SizeOfEdid; + UINT8 *Edid; +} EFI_EDID_ACTIVE_PROTOCOL; + +extern EFI_GUID gEfiEdidActiveProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/EdidDiscovered.h b/MdePkg/Include/Protocol/EdidDiscovered.h new file mode 100644 index 0000000000..6790666b67 --- /dev/null +++ b/MdePkg/Include/Protocol/EdidDiscovered.h @@ -0,0 +1,35 @@ +/** @file + EDID Discovered Protocol from the UEFI 2.0 specification. + + This protocol is placed on the video output device child handle and it represents + the EDID information being used for output device represented by the child handle. + + 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: EdidDiscovered.h + +**/ + +#ifndef __EDID_DISCOVERED_H__ +#define __EDID_DISCOVERED_H__ + +#define EFI_EDID_DISCOVERED_PROTOCOL_GUID \ + { \ + 0x1c0c34f6, 0xd380, 0x41fa, {0xa0, 0x49, 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa } \ + } + +typedef struct { + UINT32 SizeOfEdid; + UINT8 *Edid; +} EFI_EDID_DISCOVERED_PROTOCOL; + +extern EFI_GUID gEfiEdidDiscoveredProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/EdidOverride.h b/MdePkg/Include/Protocol/EdidOverride.h new file mode 100644 index 0000000000..3f4c5762e7 --- /dev/null +++ b/MdePkg/Include/Protocol/EdidOverride.h @@ -0,0 +1,66 @@ +/** @file + EDID Override Protocol from the UEFI 2.0 specification. + + Allow platform to provide EDID information to producer of the Graphics Output + 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: EdidOverride.h + +**/ + +#ifndef __EDID_OVERRIDE_H__ +#define __EDID_OVERRIDE_H__ + +#define EFI_EDID_OVERRIDE_PROTOCOL_GUID \ + { \ + 0x48ecb431, 0xfb72, 0x45c0, {0xa9, 0x22, 0xf4, 0x58, 0xfe, 0x4, 0xb, 0xd5 } \ + } + +typedef struct _EFI_EDID_OVERRIDE_PROTOCOL EFI_EDID_OVERRIDE_PROTOCOL; + +#define EFI_EDID_OVERRIDE_DONT_OVERRIDE 0x01 +#define EFI_EDID_OVERRIDE_ENABLE_HOT_PLUG 0x02 + +/** + Return the current video mode information. + + @param This Protocol instance pointer. + @param ChildHandle A child handle produced by the Graphics Output EFI + driver that represents a video output device. + @param Attributes The attributes associated with ChildHandle video output device. + @param EdidSize A pointer to the size, in bytes, of the Edid buffer. + @param Edid A pointer to callee allocated buffer that contains the EDID that + should be used for ChildHandle. A value of NULL + represents no EDID override for ChildHandle. + + @retval EFI_SUCCESS Valid overrides returned for ChildHandle. + @retval EFI_UNSUPPORTED ChildHandle has no overrides. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID) ( + IN EFI_EDID_OVERRIDE_PROTOCOL *This, + IN EFI_HANDLE *ChildHandle, + OUT UINT32 *Attributes, + IN OUT UINTN *EdidSize, + IN OUT UINT8 **Edid + ) +; + +struct _EFI_EDID_OVERRIDE_PROTOCOL { + EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID GetEdid; +}; + +extern EFI_GUID gEfiEdidOverrideProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/FirmwareVolume2.h b/MdePkg/Include/Protocol/FirmwareVolume2.h new file mode 100644 index 0000000000..f154f730e5 --- /dev/null +++ b/MdePkg/Include/Protocol/FirmwareVolume2.h @@ -0,0 +1,787 @@ +/** @file + The Firmware Volume Protocol provides file-level access to the firmware volume. + Each firmware volume driver must produce an instance of the + Firmware Volume Protocol if the firmware volume is to be visible to + the system during the DXE phase. The Firmware Volume Protocol also provides + mechanisms for determining and modifying some attributes of the firmware volume. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: FirmwareVolume2.h + + @par Revision Reference: PI + Version 1.00. + +**/ + +#ifndef __FIRMWARE_VOLUME2_H__ +#define __FIRMWARE_VOLUME2_H__ + +#define EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID \ + { 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } } + +typedef struct _EFI_FIRMWARE_VOLUME2_PROTOCOL EFI_FIRMWARE_VOLUME2_PROTOCOL; + + +// +// EFI_FV_ATTRIBUTES +// +typedef UINT64 EFI_FV_ATTRIBUTES; + +// +// EFI_FV_ATTRIBUTES bit definitions +// +// EFI_FV_ATTRIBUTES bit semantics +#define EFI_FV2_READ_DISABLE_CAP 0x0000000000000001ULL +#define EFI_FV2_READ_ENABLE_CAP 0x0000000000000002ULL +#define EFI_FV2_READ_STATUS 0x0000000000000004ULL +#define EFI_FV2_WRITE_DISABLE_CAP 0x0000000000000008ULL +#define EFI_FV2_WRITE_ENABLE_CAP 0x0000000000000010ULL +#define EFI_FV2_WRITE_STATUS 0x0000000000000020ULL +#define EFI_FV2_LOCK_CAP 0x0000000000000040ULL +#define EFI_FV2_LOCK_STATUS 0x0000000000000080ULL +#define EFI_FV2_WRITE_POLICY_RELIABLE 0x0000000000000100ULL +#define EFI_FV2_READ_LOCK_CAP 0x0000000000001000ULL +#define EFI_FV2_READ_LOCK_STATUS 0x0000000000002000ULL +#define EFI_FV2_WRITE_LOCK_CAP 0x0000000000004000ULL +#define EFI_FV2_WRITE_LOCK_STATUS 0x0000000000008000ULL +#define EFI_FV2_ALIGNMENT 0x00000000001F0000ULL +#define EFI_FV2_ALIGNMENT_1 0x0000000000000000ULL +#define EFI_FV2_ALIGNMENT_2 0x0000000000010000ULL +#define EFI_FV2_ALIGNMENT_4 0x0000000000020000ULL +#define EFI_FV2_ALIGNMENT_8 0x0000000000030000ULL +#define EFI_FV2_ALIGNMENT_16 0x0000000000040000ULL +#define EFI_FV2_ALIGNMENT_32 0x0000000000050000ULL +#define EFI_FV2_ALIGNMENT_64 0x0000000000060000ULL +#define EFI_FV2_ALIGNMENT_128 0x0000000000070000ULL +#define EFI_FV2_ALIGNMENT_256 0x0000000000080000ULL +#define EFI_FV2_ALIGNMENT_512 0x0000000000090000ULL +#define EFI_FV2_ALIGNMENT_1K 0x00000000000A0000ULL +#define EFI_FV2_ALIGNMENT_2K 0x00000000000B0000ULL +#define EFI_FV2_ALIGNMENT_4K 0x00000000000C0000ULL +#define EFI_FV2_ALIGNMENT_8K 0x00000000000D0000ULL +#define EFI_FV2_ALIGNMENT_16K 0x00000000000E0000ULL +#define EFI_FV2_ALIGNMENT_32K 0x00000000000F0000ULL +#define EFI_FV2_ALIGNMENT_64K 0x0000000000100000ULL +#define EFI_FV2_ALIGNMENT_128K 0x0000000000110000ULL +#define EFI_FV2_ALIGNMENT_256K 0x0000000000120000ULL +#define EFI_FV2_ALIGNMENT_512K 0x0000000000130000ULL +#define EFI_FV2_ALIGNMENT_1M 0x0000000000140000ULL +#define EFI_FV2_ALIGNMENT_2M 0x0000000000150000ULL +#define EFI_FV2_ALIGNMENT_4M 0x0000000000160000ULL +#define EFI_FV2_ALIGNMENT_8M 0x0000000000170000ULL +#define EFI_FV2_ALIGNMENT_16M 0x0000000000180000ULL +#define EFI_FV2_ALIGNMENT_32M 0x0000000000190000ULL +#define EFI_FV2_ALIGNMENT_64M 0x00000000001A0000ULL +#define EFI_FV2_ALIGNMENT_128M 0x00000000001B0000ULL +#define EFI_FV2_ALIGNMENT_256M 0x00000000001C0000ULL +#define EFI_FV2_ALIGNMENT_512M 0x00000000001D0000ULL +#define EFI_FV2_ALIGNMENT_1G 0x00000000001E0000ULL +#define EFI_FV2_ALIGNMENT_2G 0x00000000001F0000ULL + +/** + + Because of constraints imposed by the underlying firmware + storage, an instance of the Firmware Volume Protocol may not + be to able to support all possible variations of this + architecture. These constraints and the current state of the + firmware volume are exposed to the caller using the + GetVolumeAttributes() function. GetVolumeAttributes() is + callable only from EFI_TPL_NOTIFY and below. Behavior of + GetVolumeAttributes() at any EFI_TPL above EFI_TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param FvAttributes Pointer to an EFI_FV_ATTRIBUTES in which + the attributes and current settings are + returned. + + + @retval EFI_SUCCESS The firmware volume attributes were + returned. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FV_GET_ATTRIBUTES) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + OUT EFI_FV_ATTRIBUTES *FvAttributes +); + + +/** + The SetVolumeAttributes() function is used to set configurable + firmware volume attributes. Only EFI_FV_READ_STATUS, + EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and + then only in accordance with the declared capabilities. All + other bits of FvAttributes are ignored on input. On successful + return, all bits of *FvAttributes are valid and it contains the + completed EFI_FV_ATTRIBUTES for the volume. To modify an + attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES + is set to the desired value on input. The EFI_FV_LOCK_STATUS bit + does not affect the ability to read or write the firmware + volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it + prevents further modification to all the attribute bits. + SetVolumeAttributes() is callable only from EFI_TPL_NOTIFY and + below. Behavior of SetVolumeAttributes() at any EFI_TPL above + EFI_TPL_NOTIFY is undefined. Type EFI_TPL is defined in + RaiseTPL() in the UEFI 2.0 specification. + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param FvAttributes On input, FvAttributes is a pointer to + an EFI_FV_ATTRIBUTES containing the + desired firmware volume settings. On + successful return, it contains the new + settings of the firmware volume. On + unsuccessful return, FvAttributes is not + modified and the firmware volume + settings are not changed. + + @retval EFI_SUCCESS The requested firmware volume attributes + were set and the resulting + EFI_FV_ATTRIBUTES is returned in + FvAttributes. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS + is set to 1 on input, but the + device does not support enabling + reads + (FvAttributes:EFI_FV_READ_ENABLE + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS + is cleared to 0 on input, but + the device does not support + disabling reads + (FvAttributes:EFI_FV_READ_DISABL + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS + is set to 1 on input, but the + device does not support enabling + writes + (FvAttributes:EFI_FV_WRITE_ENABL + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS + is cleared to 0 on input, but + the device does not support + disabling writes + (FvAttributes:EFI_FV_WRITE_DISAB + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS + is set on input, but the device + does not support locking + (FvAttributes:EFI_FV_LOCK_CAP is + clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_ACCESS_DENIED Device is locked and does not + allow attribute modification + (FvAttributes:EFI_FV_LOCK_STATUS + is set on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FV_SET_ATTRIBUTES) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT EFI_FV_ATTRIBUTES *FvAttributes +); + + +/** + ReadFile() is used to retrieve any file from a firmware volume + during the DXE phase. The actual binary encoding of the file in + the firmware volume media may be in any arbitrary format as long + as it does the following: ?It is accessed using the Firmware + Volume Protocol. ?The image that is returned follows the image + format defined in Code Definitions: PI Firmware File Format. + If the input value of Buffer==NULL, it indicates the caller is + requesting only that the type, attributes, and size of the + file be returned and that there is no output buffer. In this + case, the following occurs: + - BufferSize is returned with the size that is required to + successfully complete the read. + - The output parameters FoundType and *FileAttributes are + returned with valid values. + - The returned value of *AuthenticationStatus is undefined. + + If the input value of Buffer!=NULL, the output buffer is + specified by a double indirection of the Buffer parameter. The + input value of *Buffer is used to determine if the output + buffer is caller allocated or is dynamically allocated by + ReadFile(). If the input value of *Buffer!=NULL, it indicates + the output buffer is caller allocated. In this case, the input + value of *BufferSize indicates the size of the + caller-allocated output buffer. If the output buffer is not + large enough to contain the entire requested output, it is + filled up to the point that the output buffer is exhausted and + EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is + returned with the size required to successfully complete the + read. All other output parameters are returned with valid + values. If the input value of *Buffer==NULL, it indicates the + output buffer is to be allocated by ReadFile(). In this case, + ReadFile() will allocate an appropriately sized buffer from + boot services pool memory, which will be returned in Buffer. + The size of the new buffer is returned in BufferSize and all + other output parameters are returned with valid values. + ReadFile() is callable only from EFI_TPL_NOTIFY and below. + Behavior of ReadFile() at any EFI_TPL above EFI_TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param NameGuid Pointer to an EFI_GUID, which is the file + name. All firmware file names are EFI_GUIDs. + A single firmware volume must not have two + valid files with the same file name + EFI_GUID. + + @param Buffer Pointer to a pointer to a buffer in which the + file contents are returned, not including the + file header. + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. + + @param FoundType Pointer to a caller-allocated + EFI_FV_FILETYPE. + + @param FileAttributes Pointer to a caller-allocated + EFI_FV_FILE_ATTRIBUTES. + + @param AuthenticationStatus Pointer to a caller-allocated + UINT32 in which the + authentication status is + returned. + + @retval EFI_SUCCESS The call completed successfully. + + @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to + contain the requested + output. The buffer is + filled and the output is + truncated. + + @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. + + @retavl EFI_NOT_FOUND Name was not found in the firmware + volume. + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + isallow reads. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FV_READ_FILE) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT EFI_FV_FILETYPE *FoundType, + OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, + OUT UINT32 *AuthenticationStatus +); + + + +/** + ReadSection() is used to retrieve a specific section from a file + within a firmware volume. The section returned is determined + using a depth-first, left-to-right search algorithm through all + sections found in the specified file. See + ????Firmware File Sections???? on page 9 for more details about + sections. The output buffer is specified by a double indirection + of the Buffer parameter. The input value of Buffer is used to + determine if the output buffer is caller allocated or is + dynamically allocated by ReadSection(). If the input value of + Buffer!=NULL, it indicates that the output buffer is caller + allocated. In this case, the input value of *BufferSize + indicates the size of the caller-allocated output buffer. If + the output buffer is not large enough to contain the entire + requested output, it is filled up to the point that the output + buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned, + and then BufferSize is returned with the size that is required + to successfully complete the read. All other + output parameters are returned with valid values. If the input + value of *Buffer==NULL, it indicates the output buffer is to + be allocated by ReadSection(). In this case, ReadSection() + will allocate an appropriately sized buffer from boot services + pool memory, which will be returned in *Buffer. The size of + the new buffer is returned in *BufferSize and all other output + parameters are returned with valid values. ReadSection() is + callable only from EFI_TPL_NOTIFY and below. Behavior of + ReadSection() at any EFI_TPL above EFI_TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param NameGuid Pointer to an EFI_GUID, which indicates the + file name from which the requested section + will be read. + + @param SectionType Indicates the section type to return. + SectionType in conjunction with + SectionInstance indicates which section to + return. + + @param SectionInstance Indicates which instance of sections + with a type of SectionType to return. + SectionType in conjunction with + SectionInstance indicates which + section to return. SectionInstance is + zero based. + + @param Buffer Pointer to a pointer to a buffer in which the + section contents are returned, not including + the section header. + + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. + + @param AuthenticationStatus Pointer to a caller-allocated + UINT32 in which the authentication + status is returned. + + + @retval EFI_SUCCESS The call completed successfully. + + @retval EFI_WARN_BUFFER_TOO_SMALL The caller-allocated + buffer is too small to + contain the requested + output. The buffer is + filled and the output is + truncated. + + @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. + + @retval EFI_NOT_FOUND The requested file was not found in + the firmware volume. EFI_NOT_FOUND The + requested section was not found in the + specified file. + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + disallow reads. EFI_PROTOCOL_ERROR + The requested section was not found, + but the file could not be fully + parsed because a required + GUIDED_SECTION_EXTRACTION_PROTOCOL + was not found. It is possible the + requested section exists within the + file and could be successfully + extracted once the required + GUIDED_SECTION_EXTRACTION_PROTOCOL + is published. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FV_READ_SECTION) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN CONST EFI_SECTION_TYPE SectionType, + IN CONST UINTN SectionInstance, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT UINT32 *AuthenticationStatus +); + +// +// EFI_FV_WRITE_POLICY +// +typedef UINT32 EFI_FV_WRITE_POLICY; +#define EFI_FV_UNRELIABLE_WRITE 0x00000000 +#define EFI_FV_RELIABLE_WRITE 0x00000001 + +// +// EFI_FV_WRITE_FILE_DATA +// +typedef struct { + EFI_GUID *NameGuid; + EFI_FV_FILETYPE Type; + EFI_FV_FILE_ATTRIBUTES FileAttributes; + VOID *Buffer; + UINT32 BufferSize; +} EFI_FV_WRITE_FILE_DATA; + +/** + WriteFile() is used to write one or more files to a firmware + volume. Each file to be written is described by an + EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that + any required alignment for all files listed in the FileData + array is compatible with the firmware volume. Firmware volume + capabilities can be determined using the GetVolumeAttributes() + call. Similarly, if the WritePolicy is set to + EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume + capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the + firmware volume. EFI_FV_UNRELIABLE_WRITE must always be + supported. Writing a file with a size of zero + (FileData[n].BufferSize == 0) deletes the file from the firmware + volume if it exists. Deleting a file must be done one at a time. + Deleting a file as part of a multiple file write is not allowed. + Platform Initialization Specification VOLUME 3 Shared + Architectural Elements 84 August 21, 2006 Version 1.0 + WriteFile() is callable only from EFI_TPL_NOTIFY and below. + Behavior of WriteFile() at any EFI_TPL above EFI_TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 + specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. NumberOfFiles Indicates the number of + elements in the array pointed to by FileData. + + + @param WritePolicy Indicates the level of reliability for the + write in the event of a power failure or + other system failure during the write + operation. + + @param FileData Pointer to an array of + EFI_FV_WRITE_FILE_DATA. Each element of + FileData[] represents a file to be written. + + + @retval EFI_SUCCESS The write completed successfully. + + @retval EFI_OUT_OF_RESOURCES The firmware volume does not + have enough free space to + storefile(s). + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware volume. + + @retval EFI_WRITE_PROTECTED The firmware volume is + configured to disallow writes. + + @retval EFI_NOT_FOUND A delete was requested, but the + requested file was not found in the + firmware volume. + + @retval EFI_INVALID_PARAMETER A delete was requested with a + multiple file write. + + @retval EFI_INVALID_PARAMETER An unsupported WritePolicy was + requested. + + @retval EFI_INVALID_PARAMETER An unknown file type was + specified. + + @retval EFI_INVALID_PARAMETER A file system specific error + has occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FV_WRITE_FILE) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST UINT32 NumberOfFiles, + IN CONST EFI_FV_WRITE_POLICY WritePolicy, + IN CONST EFI_FV_WRITE_FILE_DATA *FileData +); + + +/** + GetNextFile() is the interface that is used to search a firmware + volume for a particular file. It is called successively until + the desired file is located or the function returns + EFI_NOT_FOUND. To filter uninteresting files from the output, + the type of file to search for may be specified in FileType. For + example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of + this type will be returned in the output. If *FileType is + EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key + parameter is used to indicate a starting point of the search. If + the buffer *Key is completely initialized to zero, the search + re-initialized and starts at the beginning. Subsequent calls to + GetNextFile() must maintain the value of *Key returned by the + immediately previous call. The actual contents of *Key are + implementation specific and no semantic content is implied. + GetNextFile() is callable only from EFI_TPL_NOTIFY and below. + Behavior of GetNextFile() at any EFI_TPL above EFI_TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 + specification. Status Codes Returned + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. Key Pointer to a caller-allocated buffer + that contains implementation-specific data that is + used to track where to begin the search for the + next file. The size of the buffer must be at least + This->KeySize bytes long. To re-initialize the + search and begin from the beginning of the + firmware volume, the entire buffer must be cleared + to zero. Other than clearing the buffer to + initiate a new search, the caller must not modify + the data in the buffer between calls to + GetNextFile(). + + @param FileType Pointer to a caller-allocated + EFI_FV_FILETYPE. The GetNextFile() API can + filter its search for files based on the + value of the FileType input. A *FileType + input of EFI_FV_FILETYPE_ALL causes + GetNextFile() to search for files of all + types. If a file is found, the file's type + is returned in FileType. *FileType is not + modified if no file is found. + + @param NameGuid Pointer to a caller-allocated EFI_GUID. If a + matching file is found, the file's name is + returned in NameGuid. If no matching file is + found, *NameGuid is not modified. + + @param Attributes Pointer to a caller-allocated + EFI_FV_FILE_ATTRIBUTES. If a matching file + is found, the file's attributes are returned + in Attributes. If no matching file is found, + Attributes is not modified. Type + EFI_FV_FILE_ATTRIBUTES is defined in + ReadFile(). + + @param Size Pointer to a caller-allocated UINTN. If a + matching file is found, the file's size is + returned in *Size. If no matching file is found, + Size is not modified. + + @retval EFI_SUCCESS The output parameters are filled with data + obtained from the first matching file that + was found. + + @retval FI_NOT_FOUND No files of type FileType were found. + + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + disallow reads. + + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FV_GET_NEXT_FILE) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT VOID *Key, + IN OUT EFI_FV_FILETYPE *FileType, + OUT EFI_GUID *NameGuid, + OUT EFI_FV_FILE_ATTRIBUTES *Attributes, + OUT UINTN *Size +); + +/** + The GetInfo() function returns information of type + InformationType for the requested firmware volume. If the volume + does not support the requested information type, then + EFI_UNSUPPORTED is returned. If the buffer is not large enough + to hold the requested structure, EFI_BUFFER_TOO_SMALL is + returned and the BufferSize is set to the size of buffer that is + required to make the request. The information types defined by + this specification are required information types that all file + systems must support. + + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the requested + information is for. + + @param InformationType The type identifier for the + information being requested. + + @param BufferSize On input, the size of Buffer. On output, + the amount of data returned in Buffer. In + both cases, the size is measured in bytes. + + @param Buffer A pointer to the data buffer to return. The + buffer's type is indicated by InformationType. + + + @retval EFI_SUCCESS The information was retrieved. + + @retval EFI_UNSUPPORTED The InformationType is not known. + + @retval EFI_NO_MEDIA The device has no medium. + + @retval EFI_DEVICE_ERROR The device reported an error. + + @retval EFI_VOLUME_CORRUPTED The file system structures are + corrupted. + + @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to + read the current directory + entry. BufferSize has been + updated with the size needed to + complete the request. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FV_GET_INFO) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer +); + + +/** + + The SetInfo() function sets information of type InformationType + on the requested firmware volume. + + + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the information + is for. + + @param InformationType The type identifier for the + information being set. + + @param BufferSize The size, in bytes, of Buffer. + + @param Buffer A pointer to the data buffer to write. The + buffer's type is indicated by InformationType. + + @retval EFI_SUCCESS The information was set. + + @retval EFI_UNSUPPORTED The InformationType is not known. + + @retval EFI_NO_MEDIA The device has no medium. + + @retval EFI_DEVICE_ERROR The device reported an error. + + @retval EFI_VOLUME_CORRUPTED The file system structures are + corrupted. + + + @retval EFI_WRITE_PROTECTED The media is read only. + + @retval EFI_VOLUME_FULL The volume is full. + + @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the + size of the type indicated by + InformationType. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FV_SET_INFO) ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN UINTN BufferSize, + IN CONST VOID *Buffer +); + + +/** + The Firmware Volume Protocol contains the file-level + abstraction to the firmware volume as well as some firmware + volume attribute reporting and configuration services. The + Firmware Volume Protocol is the interface used by all parts of + DXE that are not directly involved with managing the firmware + volume itself. This abstraction allows many varied types of + firmware volume implementations. A firmware volume may be a + flash device or it may be a file in the UEFI system partition, + for example. This level of firmware volume implementation + detail is not visible to the consumers of the Firmware Volume + Protocol. + + @param GetVolumeAttributes Retrieves volume capabilities + and current settings. See the + GetVolumeAttributes() function + description. + + @param SetVolumeAttributes Modifies the current settings of + the firmware volume. See the + SetVolumeAttributes() function + description. + + @param ReadFile Reads an entire file from the firmware + volume. See the ReadFile() function + description. + + @param ReadSection Reads a single section from a file into + a buffer. + + @param WriteFile Writes an entire file into the firmware + volume. See the WriteFile() function + description. + + @param GetNextFile Provides service to allow searching the + firmware volume. See the GetNextFile() + function description. + + @param KeySize Data field that indicates the size in bytes + of the Key input buffer for the + GetNextFile() API. + + @param ParentHandle Handle of the parent firmware volume. + Type EFI_HANDLE is defined in + InstallProtocolInterface() in the UEFI + 2.0 specification. + + @param GetInfo Gets the requested file or volume + information. See the GetInfo() function + description. + @param SetInfo Sets the requested file information. See the + SetInfo() function description. + +**/ +struct _EFI_FIRMWARE_VOLUME2_PROTOCOL { + EFI_FV_GET_ATTRIBUTES GetVolumeAttributes; + EFI_FV_SET_ATTRIBUTES SetVolumeAttributes; + EFI_FV_READ_FILE ReadFile; + EFI_FV_READ_SECTION ReadSection; + EFI_FV_WRITE_FILE WriteFile; + EFI_FV_GET_NEXT_FILE GetNextFile; + UINT32 KeySize; + EFI_HANDLE ParentHandle; + EFI_FV_GET_INFO GetInfo; + EFI_FV_SET_INFO SetInfo; +}; + + +extern EFI_GUID gEfiFirmwareVolume2ProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/FirmwareVolumeBlock.h b/MdePkg/Include/Protocol/FirmwareVolumeBlock.h new file mode 100644 index 0000000000..2e852221d4 --- /dev/null +++ b/MdePkg/Include/Protocol/FirmwareVolumeBlock.h @@ -0,0 +1,428 @@ +/** @file + This file provides control over block-oriented firmware devices. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: FirmwareVolumeBlock.h + + @par Revision Reference: PI + Version 1.00. + +**/ + +#ifndef __FIRMWARE_VOLUME_BLOCK_H__ +#define __FIRMWARE_VOLUME_BLOCK_H__ + + +#define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \ + { 0xDE28BC59, 0x6228, 0x41BD, 0xBD, {0xF6, 0xA3, 0xB9, 0xAD,0xB5, 0x8D, 0xA1 } } + + +typedef struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL; + +/** + The GetAttributes() function retrieves the attributes and + current settings of the block. Status Codes Returned + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL + instance. + + @param Attributes Pointer to EFI_FVB_ATTRIBUTES in which the + attributes and current settings are + returned. Type EFI_FVB_ATTRIBUTES is defined + in EFI_FIRMWARE_VOLUME_HEADER. + + @retval EFI_SUCCESS The firmware volume attributes were + returned. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FVB_GET_ATTRIBUTES) ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, + OUT EFI_FVB_ATTRIBUTES *Attributes +); + + +/** + The SetAttributes() function sets configurable firmware volume + attributes and returns the new settings of the firmware volume. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL + instance. + + @param Attributes On input, Attributes is a pointer to + EFI_FVB_ATTRIBUTES that contains the + desired firmware volume settings. On + successful return, it contains the new + settings of the firmware volume. Type + EFI_FVB_ATTRIBUTES is defined in + EFI_FIRMWARE_VOLUME_HEADER. + + + @retval EFI_SUCCESS The firmware volume attributes were + returned. + + @retval EFI_INVALID_PARAMETER The attributes requested are in + conflict with the capabilities + as declared in the firmware + volume header. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FVB_SET_ATTRIBUTES) ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, + IN OUT EFI_FVB_ATTRIBUTES *Attributes +); + + +/** + The GetPhysicalAddress() function retrieves the base address of + a memory-mapped firmware volume. This function should be called + only for memory-mapped firmware volumes. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL + nstance. + + @param Address Pointer to a caller-allocated + EFI_PHYSICAL_ADDRESS that, on successful + return from GetPhysicalAddress(), contains the + base address of the firmware volume. Type + EFI_PHYSICAL_ADDRESS is defined in + AllocatePages() in the UEFI 2.0 specification. + + @retval EFI_SUCCESS The firmware volume base address is + returned. + + @retval EFI_NOT_SUPPORTED The firmware volume is not memory + mapped. + + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FVB_GET_PHYSICAL_ADDRESS) ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, + OUT EFI_PHYSICAL_ADDRESS *Address +); + +/** + The GetBlockSize() function retrieves the size of the requested + block. It also returns the number of additional blocks with + the identical size. The GetBlockSize() function is used to + retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER). + + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL + instance. + + @param Lba Indicates the block for which to return the size. + Type EFI_LBA is defined in the BLOCK_IO Protocol + (section 11.6) in the UEFI 2.0 specification. + + @param BlockSize Pointer to a caller-allocated UINTN in which + the size of the block is returned. + + @param NumberOfBlocks Pointer to a caller-allocated UINTN in + which the number of consecutive blocks, + starting with Lba, is returned. All + blocks in this range have a size of + BlockSize. + + + @retval EFI_SUCCESS The firmware volume base address is + returned. + + @retval EFI_INVALID_PARAMETER The requested LBA is out of + range. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FVB_GET_BLOCK_SIZE) ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, + IN CONST EFI_LBA Lba, + OUT UINTN *BlockSize, + OUT UINTN *NumberOfBlocks +); + + +/** + The Read() function reads the requested number of bytes from the + requested block and stores them in the provided buffer. + Implementations should be mindful that the firmware volume + might be in the ReadDisabled state. If it is in this state, + the Read() function must return the status code + EFI_ACCESS_DENIED without modifying the contents of the + buffer. The Read() function must also prevent spanning block + boundaries. If a read is requested that would span a block + boundary, the read must read up to the boundary but not + beyond. The output parameter NumBytes must be set to correctly + indicate the number of bytes actually read. The caller must be + aware that a read may be partially completed. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL + instance. Lba The starting logical block index + from which to read. Type EFI_LBA is defined in the + BLOCK_IO Protocol (section 11.6) in the UEFI 2.0 + specification. + + @param Offset Offset into the block at which to begin reading. + + @param NumBytes Pointer to a UINTN. At entry, *NumBytes + contains the total size of the buffer. At + exit, *NumBytes contains the total number of + bytes read. + + @param Buffer Pointer to a caller-allocated buffer that will + be used to hold the data that is read. + + @retval EFI_SUCCESS The firmware volume was read successfully + and contents are in Buffer. + + @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA + boundary. On output, NumBytes + contains the total number of bytes + returned in Buffer. + + @retval EFI_ACCESS_DENIED The firmware volume is in the + ReadDisabled state. + + @retval EFI_DEVICE_ERROR The block device is not + functioning correctly and could + not be read. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FVB_READ) ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, + IN CONST EFI_LBA Lba, + IN CONST UINTN Offset, + IN OUT UINTN *NumBytes, + OUT UINT8 *Buffer +); + + + +/** + The Write() function writes the specified number of bytes from + the provided buffer to the specified block and offset. If the + firmware volume is sticky write, the caller must ensure that + all the bits of the specified range to write are in the + EFI_FVB_ERASE_POLARITY state before calling the Write() + function, or else the result will be unpredictable. This + unpredictability arises because, for a sticky-write firmware + volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY + state but it cannot flip it back again. In general, before + calling the Write() function, the caller should call the + EraseBlocks() function first to erase the specified block to + write. A block erase cycle will transition bits from the + (NOT)EFI_FVB_ERASE_POLARITY state back to the + EFI_FVB_ERASE_POLARITY state. Implementations should be + mindful that the firmware volume might be in the WriteDisabled + state. If it is in this state, the Write() function must + return the status code EFI_ACCESS_DENIED without modifying the + contents of the firmware volume. The Write() function must + also prevent spanning block boundaries. If a write is + requested that spans a block boundary, the write must store up + to the boundary but not beyond. The output parameter NumBytes + must be set to correctly indicate the number of bytes actually + written. The caller must be aware that a write may be + partially completed. All writes, partial or otherwise, must be + fully flushed to the hardware before the Write() service + returns. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL + instance. + + @param Lba The starting logical block index to write to. Type + EFI_LBA is defined in the BLOCK_IO Protocol + (section 11.6) in the UEFI 2.0 specification. + Offset Offset into the block at which to begin + writing. + + @param NumBytes Pointer to a UINTN. At entry, *NumBytes + contains the total size of the buffer. At + exit, *NumBytes contains the total number of + bytes actually written. + + @param Buffer Pointer to a caller-allocated buffer that + contains the source for the write. + + @retval EFI_SUCCESS The firmware volume was written + successfully. + + @retval EFI_BAD_BUFFER_SIZE The write was attempted across an + LBA boundary. On output, NumBytes + contains the total number of bytes + actually written. + + @retval EFI_ACCESS_DENIED The firmware volume is in the + WriteDisabled state. + + @retval EFI_DEVICE_ERROR The block device is malfunctioning + and could not be written. + + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FVB_WRITE) ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, + IN CONST EFI_LBA Lba, + IN CONST UINTN Offset, + IN OUT UINTN *NumBytes, + IN CONST UINT8 *Buffer +); + + + + +// +// EFI_LBA_LIST_TERMINATOR +// +#define EFI_LBA_LIST_TERMINATOR 0xFFFFFFFFFFFFFFFFULL + + +/** + The EraseBlocks() function erases one or more blocks as denoted + by the variable argument list. The entire parameter list of + blocks must be verified before erasing any blocks. If a block is + requested that does not exist within the associated firmware + volume (it has a larger index than the last block of the + firmware volume), the EraseBlocks() function must return the + status code EFI_INVALID_PARAMETER without modifying the contents + of the firmware volume. Implementations should be mindful that + the firmware volume might be in the WriteDisabled state. If it + is in this state, the EraseBlocks() function must return the + status code EFI_ACCESS_DENIED without modifying the contents of + the firmware volume. All calls to EraseBlocks() must be fully + flushed to the hardware before the EraseBlocks() service + returns. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL + instance. + + @param ... The variable argument list is a list of tuples. + Each tuple describes a range of LBAs to erase + and consists of the following: + - An EFI_LBA that indicates the starting LBA + - A UINTN that indicates the number of blocks to + erase + + The list is terminated with an + EFI_LBA_LIST_TERMINATOR. For example, the + following indicates that two ranges of blocks + (5-7 and 10-11) are to be erased: EraseBlocks + (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR); + + @retval EFI_SUCCESS The erase request was successfully + completed. + + @retval EFI_ACCESS_DENIED The firmware volume is in the + WriteDisabled state. + @retval EFI_DEVICE_ERROR The block device is not functioning + correctly and could not be written. + The firmware device may have been + partially erased. + @retval EFI_INVALID_PARAMETER One or more of the LBAs listed + in the variable argument list do + not exist in the firmware volume. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_FVB_ERASE_BLOCKS) ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, + ... +); + + + +/** + The Firmware Volume Block Protocol is the low-level interface + to a firmware volume. File-level access to a firmware volume + should not be done using the Firmware Volume Block Protocol. + Normal access to a firmware volume must use the Firmware + Volume Protocol. Typically, only the file system driver that + produces the Firmware Volume Protocol will bind to the + Firmware Volume Block Protocol. The Firmware Volume Block + Protocol provides the following: + - Byte-level read/write functionality. + - Block-level erase functionality. + - It further exposes device-hardening features, such as may be + equired to protect the firmware from unwanted overwriting + and/or erasure. + - It is useful to layer a file system driver on top of the + Firmware Volume Block Protocol. + + This file system driver produces the Firmware Volume Protocol, + which provides file-level access to a firmware volume. The + Firmware Volume Protocol abstracts the file system that is + used to format the firmware volume and the hardware + device-hardening features that may be present. + + + @param GetPhysicalAddress Retrieves the memory-mapped + address of the firmware volume. + See the GetPhysicalAddress() + function description. + + @param GetBlockSize Retrieves the size for a specific block. + Also returns the number of consecutive + similarly sized blocks. See the + GetBlockSize() function description. + + @param Read Reads n bytes into a buffer from the firmware + volume hardware. See the Read() function + description. + + @param Write Writes n bytes from a buffer into the firmware + volume hardware. See the Write() function + description. + + @param EraseBlocks Erases specified block(s) and sets all + values as indicated by the + EFI_FVB_ERASE_POLARITY bit. See the + EraseBlocks() function description. Type + EFI_FVB_ERASE_POLARITY is defined in + EFI_FIRMWARE_VOLUME_HEADER. ParentHandle + Handle of the parent firmware volume. Type + EFI_HANDLE is defined in + InstallProtocolInterface() in the UEFI 2.0 + specification. + + @param GetAttributes Retrieves the current volume attributes. + See the GetAttributes() function + description. + + @param SetAttributes Sets the current volume attributes. See + the SetAttributes() function description. + + +**/ +struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL { + EFI_FVB_GET_ATTRIBUTES GetAttributes; + EFI_FVB_SET_ATTRIBUTES SetAttributes; + EFI_FVB_GET_PHYSICAL_ADDRESS GetPhysicalAddress; + EFI_FVB_GET_BLOCK_SIZE GetBlockSize; + EFI_FVB_READ Read; + EFI_FVB_WRITE Write; + EFI_FVB_ERASE_BLOCKS EraseBlocks; + EFI_HANDLE ParentHandle; +}; + + +extern EFI_GUID gEfiFirmwareVolumeBlockProtocolGuid; + + +#endif diff --git a/MdePkg/Include/Protocol/FormBrowser.h b/MdePkg/Include/Protocol/FormBrowser.h new file mode 100644 index 0000000000..61d7e8f871 --- /dev/null +++ b/MdePkg/Include/Protocol/FormBrowser.h @@ -0,0 +1,207 @@ +/** @file + + The file provides services to call for drivers to leverage the + EFI configuration driver interface. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: FormBrowser.h + +**/ + +#ifndef __EFI_FORM_BROWSER_H__ +#define __EFI_FORM_BROWSER_H__ + + +#define EFI_FORM_BROWSER_PROTOCOL_GUID \ + { 0xe5a1333e, 0xe1b4, 0x4e55, { 0xce, 0xeb, 0x35, 0xc3, 0xef, 0x13, 0x34, 0x43 } } + + +typedef struct _EFI_FORM_BROWSER_PROTOCOL EFI_FORM_BROWSER_PROTOCOL; + + + +/** + + @param LeftColumn Value that designates the text column + where the browser window will begin from + the left-hand side of the screen + RightColumn Value that designates the text + column where the browser window will end + on the right-hand side of the screen. + + @param TopRow Value that designates the text row from the + top of the screen where the browser window + will start. + + @param BottomRow Value that designates the text row from the + bottom of the screen where the browser + window will end. +**/ +typedef struct { + UINTN LeftColumn; + UINTN RightColumn; + UINTN TopRow; + UINTN BottomRow; +} EFI_SCREEN_DESCRIPTOR; + +/** + + This function is the primary interface to the internal + forms-based browser. By calling this routine, one is directing + the browser to use a variety of passed-in information or + primarily use the HII database as the source of information. + + @param This A pointer to the EFI_FORM_BROWSER_PROTOCOL + instance. + + @param Handle A pointer to an array of HII handles to + display. This value should correspond to the + value of the HII form package that is required + to be displayed. + + @param HandleCount The number of handles in the array + specified by Handle. + + @param SingleUse If FALSE, the browser operates as a standard + forms processor and exits only when + explicitly requested by the user. If TRUE, + the browser will return immediately after + processing the first user-generated + selection. + + @param ScreenDimensions Allows the browser to be called so + that it occupies a portion of the + physical screen instead of + dynamically determining the screen + dimensions. If the input values + violate the platform policy then the + dimensions will be dynamically + adjusted to comply. + + @param ResetRequired This BOOLEAN value will tell the caller + if a reset is required based on the data + that might have been changed. The + ResetRequired parameter is primarily + applicable for configuration + applications, and is an optional + parameter. + + @retval EFI_SUCCESS The function completed successfully + + @retval EFI_NOT_FOUND The variable was not found. + + @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for + the result. DataSize has been + updated with the size needed to + complete the request. + + @retval EFI_INVALID_PARAMETER One of the parameters has an + invalid value. + + @retval EFI_DEVICE_ERROR The variable could not be saved due + to a hardware failure. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SEND_FORM) ( + IN CONST EFI_FORM_BROWSER_PROTOCOL *This, + IN CONST EFI_HII_HANDLE *Handle, + IN CONST UINTN HandleCount, + IN CONST BOOLEAN SingleUse, + IN CONST EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL + OUT BOOLEAN *ResetRequired OPTIONAL +); + + +/** + + This routine is called by a routine which was called by the + browser. This routine called this service in the browser to + retrieve or set certain uncommitted state information. + + @param This A pointer to the EFI_FORM_BROWSER_PROTOCOL + instance. + + @param ResultsDataSize A pointer to the size of the buffer + associated with ResultsData. + + @param ResultsData A string returned from an IFR browser or + equivalent. The results string will have + no routing information in them. + + @param RetrieveData A BOOLEAN field which allows an agent to + retrieve (if RetrieveData = TRUE) data + from the uncommitted browser state + information or set (if RetrieveData = + FALSE) data in the uncommitted browser + state information. + + @param VariableGuid An optional field to indicate the target + variable GUID name to use. + + @param VariableName An optional field to indicate the target + human-readable variable name. + + + @retval EFI_SUCCESS The results have been distributed or are + awaiting distribution. + + @retval EFI_OUT_OF_RESOURCES The ResultsDataSize specified + was too small to contain the + results data. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_BROWSER_CALLBACK ) ( + IN CONST EFI_FORM_BROWSER_PROTOCOL *This, + IN OUT UINTN *ResultsDataSize, + IN OUT EFI_STRING ResultsData, + IN CONST BOOLEAN RetrieveData, + IN CONST EFI_GUID *VariableGuid, OPTIONAL + IN CONST CHAR16 *VariableName OPTIONAL +); + +/** + + This protocol is the interface to call for drivers to leverage + the EFI configuration driver interface. + + @param SendForm Provides direction to the configuration + driver whether to use the HII database or to + use a passed-in set of data. This functions + also establishes a pointer to the calling + driver's callback interface. See the + SendForm() function description. + + @param BrowserCallback Routine used to expose internal + configuration state of the browser. + This is primarily used by callback + handler routines which were called by + the browser and in-turn need to get + additional information from the + browser itself. See the + BrowserCallback() function + description. + +**/ +struct _EFI_FORM_BROWSER_PROTOCOL { + EFI_SEND_FORM SendForm; + EFI_BROWSER_CALLBACK BrowserCallback; +} ; + + +extern EFI_GUID gEfiFormBrowserProtocolGuid; + +#endif + + diff --git a/MdePkg/Include/Protocol/GraphicsOutput.h b/MdePkg/Include/Protocol/GraphicsOutput.h new file mode 100644 index 0000000000..1b4e1fca06 --- /dev/null +++ b/MdePkg/Include/Protocol/GraphicsOutput.h @@ -0,0 +1,194 @@ +/** @file + Graphics Output Protocol from the UEFI 2.0 specification. + + Abstraction of a very simple graphics device. + + 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: GraphicsOutput.h + +**/ + +#ifndef __GRAPHICS_OUTPUT_H__ +#define __GRAPHICS_OUTPUT_H__ + +#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ + { \ + 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \ + } + +typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL; + +typedef struct { + UINT32 RedMask; + UINT32 GreenMask; + UINT32 BlueMask; + UINT32 ReservedMask; +} EFI_PIXEL_BITMASK; + +typedef enum { + PixelRedGreenBlueReserved8BitPerColor, + PixelBlueGreenRedReserved8BitPerColor, + PixelBitMask, + PixelBltOnly, + PixelFormatMax +} EFI_GRAPHICS_PIXEL_FORMAT; + +typedef struct { + UINT32 Version; + UINT32 HorizontalResolution; + UINT32 VerticalResolution; + EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; + EFI_PIXEL_BITMASK PixelInformation; + UINT32 PixelsPerScanLine; +} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION; + +/** + Return the current video mode information. + + @param This Protocol instance pointer. + @param ModeNumber The mode number to return information on. + @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer. + @param Info A pointer to callee allocated buffer that returns information about ModeNumber. + + @retval EFI_SUCCESS Mode information returned. + @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small. + @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode. + @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () + @retval EFI_INVALID_PARAMETER One of the input args was NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) ( + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN UINT32 ModeNumber, + OUT UINTN *SizeOfInfo, + OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info + ) +; + +/** + Return the current video mode information. + + @param This Protocol instance pointer. + @param ModeNumber The mode number to be set. + + @retval EFI_SUCCESS Graphics mode was changed. + @retval EFI_DEVICE_ERROR The device had an error and could not complete the request. + @retval EFI_UNSUPPORTED ModeNumber is not supported by this device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) ( + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN UINT32 ModeNumber + ) +; + +typedef struct { + UINT8 Blue; + UINT8 Green; + UINT8 Red; + UINT8 Reserved; +} EFI_GRAPHICS_OUTPUT_BLT_PIXEL; + +typedef union { + EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel; + UINT32 Raw; +} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION; + +typedef enum { + EfiBltVideoFill, + EfiBltVideoToBltBuffer, + EfiBltBufferToVideo, + EfiBltVideoToVideo, + EfiGraphicsOutputBltOperationMax +} EFI_GRAPHICS_OUTPUT_BLT_OPERATION; + +/** + The following table defines actions for BltOperations: + + EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) + directly to every pixel of the video display rectangle + (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). + Only one pixel will be used from the BltBuffer. Delta is NOT used. + + EfiBltVideoToBltBuffer - Read data from the video display rectangle + (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in + the BltBuffer rectangle (DestinationX, DestinationY ) + (DestinationX + Width, DestinationY + Height). If DestinationX or + DestinationY is not zero then Delta must be set to the length in bytes + of a row in the BltBuffer. + + EfiBltBufferToVideo - Write data from the BltBuffer rectangle + (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the + video display rectangle (DestinationX, DestinationY) + (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is + not zero then Delta must be set to the length in bytes of a row in the + BltBuffer. + + EfiBltVideoToVideo - Copy from the video display rectangle (SourceX, SourceY) + (SourceX + Width, SourceY + Height) .to the video display rectangle + (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). + The BltBuffer and Delta are not used in this mode. + + @param This Protocol instance pointer. + @param BltBuffer Buffer containing data to blit into video buffer. This + buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) + @param BltOperation Operation to perform on BlitBuffer and video memory + @param SourceX X coordinate of source for the BltBuffer. + @param SourceY Y coordinate of source for the BltBuffer. + @param DestinationX X coordinate of destination for the BltBuffer. + @param DestinationY Y coordinate of destination for the BltBuffer. + @param Width Width of rectangle in BltBuffer in pixels. + @param Height Hight of rectangle in BltBuffer in pixels. + @param Delta OPTIONAL + + @retval EFI_SUCCESS The Blt operation completed. + @retval EFI_INVALID_PARAMETER BltOperation is not valid. + @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) ( + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL + IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, + IN UINTN SourceX, + IN UINTN SourceY, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height, + IN UINTN Delta OPTIONAL + ); + +typedef struct { + UINT32 MaxMode; + UINT32 Mode; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; + UINTN SizeOfInfo; + EFI_PHYSICAL_ADDRESS FrameBufferBase; + UINTN FrameBufferSize; +} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE; + +struct _EFI_GRAPHICS_OUTPUT_PROTOCOL { + EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode; + EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode; + EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt; + EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; +}; + +extern EFI_GUID gEfiGraphicsOutputProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/GuidedSectionExtaction.h b/MdePkg/Include/Protocol/GuidedSectionExtaction.h new file mode 100644 index 0000000000..595bebc5cf --- /dev/null +++ b/MdePkg/Include/Protocol/GuidedSectionExtaction.h @@ -0,0 +1,144 @@ +/** @file + If a GUID-defined section is encountered when doing section + extraction, the section extraction driver calls the appropriate + instance of the GUIDed Section Extraction Protocol to extract + the section stream contained therein. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: GuidedSectionExtaction.h + + @par Revision Reference: PI + Version 1.00. + +**/ + +#ifndef __GUID_SECTION_EXTRACTION_PROTOCOL_H__ +#define __GUID_SECTION_EXTRACTION_PROTOCOL_H__ + +// +// The protocol interface structures are identified by associating +// them with a GUID. Each instance of a protocol with a given +// GUID must have the same interface structure. While all instances +// of the GUIDed Section Extraction Protocol must have the same +// interface structure, they do not all have the same GUID. The +// GUID that is associated with an instance of the GUIDed Section +// Extraction Protocol is used to correlate it with the GUIDed +// section type that it is intended to process. +// + +typedef struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL; + + +/** + The ExtractSection() function processes the input section and + allocates a buffer from the pool in which it returns the section + contents. If the section being extracted contains + authentication information (the section's + GuidedSectionHeader.Attributes field has the + EFI_GUIDED_SECTION_AUTH_STATUS_VALID bit set), the values + returned in AuthenticationStatus must reflect the results of + the authentication operation. Depending on the algorithm and + size of the encapsulated data, the time that is required to do + a full authentication may be prohibitively long for some + classes of systems. To indicate this, use + EFI_SECURITY_POLICY_PROTOCOL_GUID, which may be published by + the security policy driver (see the Platform Initialization + Driver Execution Environment Core Interface Specification for + more details and the GUID definition). If the + EFI_SECURITY_POLICY_PROTOCOL_GUID exists in the handle + database, then, if possible, full authentication should be + skipped and the section contents simply returned in the + OutputBuffer. In this case, the + EFI_AUTH_STATUS_PLATFORM_OVERRIDE bit AuthenticationStatus + must be set on return. ExtractSection() is callable only from + EFI_TPL_NOTIFY and below. Behavior of ExtractSection() at any + EFI_TPL above EFI_TPL_NOTIFY is undefined. Type EFI_TPL is + defined in RaiseTPL() in the UEFI 2.0 specification. + + + @param This Indicates the + EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance. + + @param InputSection Buffer containing the input GUIDed section + to be processed. OutputBuffer OutputBuffer + is allocated from boot services pool + memory and contains the new section + stream. The caller is responsible for + freeing this buffer. + + @param OutputSize A pointer to a caller-allocated UINTN in + which the size of OutputBuffer allocation + is stored. If the function returns + anything other than EFI_SUCCESS, the value + of OutputSize is undefined. + + @param AuthenticationStatus A pointer to a caller-allocated + UINT32 that indicates the + authentication status of the + output buffer. If the input + section's + GuidedSectionHeader.Attributes + field has the + EFI_GUIDED_SECTION_AUTH_STATUS_VAL + bit as clear, AuthenticationStatus + must return zero. Both local bits + (19:16) and aggregate bits (3:0) + in AuthenticationStatus are + returned by ExtractSection(). + These bits reflect the status of + the extraction operation. The bit + pattern in both regions must be + the same, as the local and + aggregate authentication statuses + have equivalent meaning at this + level. If the function returns + anything other than EFI_SUCCESS, + the value of AuthenticationStatus + is undefined. + + + @retval EFI_SUCCESS The InputSection was successfully + processed and the section contents were + returned. + + @retval EFI_OUT_OF_RESOURCES The system has insufficient + resources to process the + request. + + @retval EFI_INVALID_PARAMETER The GUID in InputSection does + not match this instance of the + GUIDed Section Extraction + Protocol. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXTRACT_GUIDED_SECTION)( + IN CONST EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This, + IN CONST VOID *InputSection, + OUT VOID **OutputBuffer, + OUT UINTN *OutputSize, + OUT UINT32 *AuthenticationStatus +); + + +/** + + Takes the GUIDed section as input and produces the section + stream data. See the ExtractSection() function description. + +**/ +struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL { + EFI_EXTRACT_GUIDED_SECTION ExtractSection; +}; + + +#endif diff --git a/MdePkg/Include/Protocol/Hash.h b/MdePkg/Include/Protocol/Hash.h new file mode 100644 index 0000000000..9355da4fff --- /dev/null +++ b/MdePkg/Include/Protocol/Hash.h @@ -0,0 +1,149 @@ +/** @file + EFI_HASH_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0. + EFI_HASH_PROTOCOL as defined in UEFI 2.0. + The EFI Hash Service Binding Protocol is used to locate hashing services support + provided by a driver and create and destroy instances of the EFI Hash Protocol + so that a multiple drivers can use the underlying hashing services. + The EFI Service Binding Protocol defines the generic Service Binding Protocol functions. + + 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: Hash.h + +**/ + +#ifndef __EFI_HASH_PROTOCOL_H__ +#define __EFI_HASH_PROTOCOL_H__ + +#define EFI_HASH_SERVICE_BINDING_PROTOCOL \ + { \ + 0x42881c98, 0xa4f3, 0x44b0, {0xa3, 0x9d, 0xdf, 0xa1, 0x86, 0x67, 0xd8, 0xcd } \ + } + +#define EFI_HASH_PROTOCOL_GUID \ + { \ + 0xc5184932, 0xdba5, 0x46db, {0xa5, 0xba, 0xcc, 0x0b, 0xda, 0x9c, 0x14, 0x35 } \ + } + +#define EFI_HASH_ALGORITHM_SHA1_GUID \ + { \ + 0x2ae9d80f, 0x3fb2, 0x4095, {0xb7, 0xb1, 0xe9, 0x31, 0x57, 0xb9, 0x46, 0xb6 } \ + } + +#define EFI_HASH_ALGORITHM_SHA224_GUID \ + { \ + 0x8df01a06, 0x9bd5, 0x4bf7, {0xb0, 0x21, 0xdb, 0x4f, 0xd9, 0xcc, 0xf4, 0x5b } \ + } + +#define EFI_HASH_ALGORITHM_SHA256_GUID \ + { \ + 0x51aa59de, 0xfdf2, 0x4ea3, {0xbc, 0x63, 0x87, 0x5f, 0xb7, 0x84, 0x2e, 0xe9 } \ + } + +#define EFI_HASH_ALGORITHM_SHA384_GUID \ + { \ + 0xefa96432, 0xde33, 0x4dd2, {0xae, 0xe6, 0x32, 0x8c, 0x33, 0xdf, 0x77, 0x7a } \ + } + +#define EFI_HASH_ALGORITHM_SHA512_GUID \ + { \ + 0xcaa4381e, 0x750c, 0x4770, {0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21, 0x30 } \ + } + +#define EFI_HASH_ALGORTIHM_MD5_GUID \ + { \ + 0xaf7c79c, 0x65b5, 0x4319, {0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, 0xd7 } \ + } + +typedef struct _EFI_HASH_PROTOCOL EFI_HASH_PROTOCOL; + +typedef UINT8 EFI_MD5_HASH[16]; +typedef UINT8 EFI_SHA1_HASH[20]; +typedef UINT8 EFI_SHA224_HASH[28]; +typedef UINT8 EFI_SHA256_HASH[32]; +typedef UINT8 EFI_SHA384_HASH[48]; +typedef UINT8 EFI_SHA512_HASH[64]; + +typedef union { + EFI_MD5_HASH *Md5Hash; + EFI_SHA1_HASH *Sha1Hash; + EFI_SHA224_HASH *Sha224Hash; + EFI_SHA256_HASH *Sha256Hash; + EFI_SHA384_HASH *Sha384Hash; + EFI_SHA512_HASH *Sha512Hash; +} EFI_HASH_OUTPUT; + +/** + Returns the size of the hash which results from a specific algorithm. + + @param This Points to this instance of EFI_HASH_PROTOCOL. + @param HashAlgorithm Points to the EFI_GUID which identifies the algorithm to use. + @param HashSize Holds the returned size of the algorithm's hash. + + @retval EFI_SUCCESS Hash size returned successfully. + @retval EFI_INVALID_PARAMETER HashSize is NULL + @retval EFI_UNSUPPORTED The algorithm specified by HashAlgorithm is not supported + by this driver. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HASH_GET_HASH_SIZE) ( + IN CONST EFI_HASH_PROTOCOL *This, + IN CONST EFI_GUID *HashAlgorithm, + OUT UINTN *HashSize + ) +; + +/** + Returns the size of the hash which results from a specific algorithm. + + @param This Points to this instance of EFI_HASH_PROTOCOL. + @param HashAlgorithm Points to the EFI_GUID which identifies the algorithm to use. + @param Extend Specifies whether to create a new hash (FALSE) or extend the specified + existing hash (TRUE). + @param Message Points to the start of the message. + @param MessageSize The size of Message, in bytes. + @param Hash On input, if Extend is TRUE, then this holds the hash to extend. On + output, holds the resulting hash computed from the message. + + @retval EFI_SUCCESS Hash returned successfully. + @retval EFI_INVALID_PARAMETER Message or Hash is NULL + @retval EFI_UNSUPPORTED The algorithm specified by HashAlgorithm is not supported by this + driver. Or extend is TRUE and the algorithm doesn't support extending the hash. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HASH_HASH) ( + IN CONST EFI_HASH_PROTOCOL *This, + IN CONST EFI_GUID *HashAlgorithm, + IN BOOLEAN Extend, + IN CONST UINT8 *Message, + IN UINT64 MessageSize, + IN OUT EFI_HASH_OUTPUT *Hash + ) +; + +struct _EFI_HASH_PROTOCOL { + EFI_HASH_GET_HASH_SIZE GetHashSize; + EFI_HASH_HASH Hash; +}; + +extern EFI_GUID gEfiHashServiceBindingProtocolGuid; +extern EFI_GUID gEfiHashProtocolGuid; +extern EFI_GUID gEfiHashAlgorithmSha1Guid; +extern EFI_GUID gEfiHashAlgorithmSha224Guid; +extern EFI_GUID gEfiHashAlgorithmSha256Guid; +extern EFI_GUID gEfiHashAlgorithmSha384Guid; +extern EFI_GUID gEfiHashAlgorithmSha512Guid; +extern EFI_GUID gEfiHashAlgorithmMD5Guid; + +#endif diff --git a/MdePkg/Include/Protocol/HiiConfigAccess.h b/MdePkg/Include/Protocol/HiiConfigAccess.h new file mode 100644 index 0000000000..84ea39f4e1 --- /dev/null +++ b/MdePkg/Include/Protocol/HiiConfigAccess.h @@ -0,0 +1,233 @@ +/** @file + + The file provides services to forward results to PCOL-based + handler if EFI HII results processing protocol invokes this + protocol. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: HiiConfigAccess.h + +**/ + + +#ifndef __EFI_HII_CONFIG_ACCESS_H__ +#define __EFI_HII_CONFIG_ACCESS_H__ + +#define EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID \ + { 0x330d4706, 0xf2a0, 0x4e4f, { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } } + +typedef struct _EFI_HII_CONFIG_ACCESS_PROTOCOL EFI_HII_CONFIG_ACCESS_PROTOCOL; + +/** + + This function allows the caller to request the current + configuration for one or more named elements. The resulting + string is in format. Any and all alternative + configuration strings shall also be appended to the end of the + current configuration string. If they are, they must appear + after the current configuration. They must contain the same + routing (GUID, NAME, PATH) as the current configuration string. + They must have an additional description indicating the type of + alternative configuration the string represents, + "ALTCFG=". That (when + converted from Hex UNICODE to binary) is a reference to a + string in the associated string pack. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + + @param Request A null-terminated Unicode string in + format. Note that this + includes the routing information as well as + the configurable name / value pairs. It is + invalid for this string to be in + format. + + @param Progress On return, points to a character in the + Request string. Points to the string's null + terminator if request was successful. Points + to the most recent "&" before the first + failing name / value pair (or the beginning + of the string if the failure is in the first + name / value pair) if the request was not + successful + + @param Results A null-terminated Unicode string in + format which has all values + filled in for the names in the Request string. + String to be allocated by the called function. + + @retval EFI_SUCCESS The Results string is filled with the + values corresponding to all requested + names. + + @retval EFI_OUT_OF_MEMORY Not enough memory to store the + parts of the results that must be + stored awaiting possible future + protocols. + + @retval EFI_INVALID_PARAMETER For example, passing in a NULL + for the Request parameter + would result in this type of + error. In this case, the + Progress parameter would be + set to NULL. + + @retval EFI_NOT_FOUND Routing data doesn't match any + known driver. Progress set to the + first character in the routing header. + Note: There is no requirement that the + driver validate the routing data. It + must skip the in order to + process the names. + + @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set + to most recent & before the + error or the beginning of the + string. + + @retval EFI_INVALID_PARAMETER Unknown name. Progress points + to the & before the name in + question. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_HII_ACCESS_EXTRACT_CONFIG ) ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results +); + + +/** + + This function applies changes in a driver's configuration. + Input is a Configuration, which has the routing data for this + driver followed by name / value configuration pairs. The driver + must apply those pairs to its configurable storage. If the + driver's configuration is stored in a linear block of data + and the driver????s name / value pairs are in + format, it may use the ConfigToBlock helper function (above) to + simplify the job. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + + @param Configuration A null-terminated Unicode string in + format. Progress a + pointer to a string filled in with the + offset of the most recent '&' before the + first failing name / value pair (or the + beginn ing of the string if the failure + is in the first name / value pair) or + the terminating NULL if all was + successful. + + @retval EFI_SUCCESS The results have been distributed or are + awaiting distribution. + + @retval EFI_OUT_OF_MEMORY Not enough memory to store the + parts of the results that must be + stored awaiting possible future + protocols. + + @retval EFI_INVALID_PARAMETERS Passing in a NULL for the + Results parameter would result + in this type of error. + + @retval EFI_NOT_FOUND Target for the specified routing data + was not found + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_HII_ACCESS_ROUTE_CONFIG ) ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress +); + +/** + + This function is called to provide results data to the driver. + This data consists of a unique key that is used to identify + which data is either being passed back or being asked for. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + + @param KeyValue A unique value which is sent to the original + exporting driver so that it can identify the + type of data to expect. The format of the + data tends to vary based on the opcode that + generated the callback. + + @param Data A pointer to the data being sent to the original + exporting driver. The format of the data should + be the same as that of the question invoking the + callback and will be known to the recipient. + + @retval EFI_SUCCESS The firmware has successfully stored the + variable and its data as defined by the + Attributes. + + @retval EFI_INVALID_PARAMETER An invalid combination of + Attributes bits was supplied, + or the DataSize exceeds the + maximum allowed. + + @retval EFI_OUT_OF_RESOURCES Not enough storage is available + to hold the variable and its + data. + + @retval EFI_DEVICE_ERROR The variable could not be saved due + to a hardware failure. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FORM_CALLBACK) ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST UINT16 KeyValue, + IN CONST VOID *Data +); +/** + + This protocol provides a callable interface between the HII and + drivers. Only drivers which provide IFR data to HII are required + to publish this protocol. + + @param ExtractConfig This function breaks apart the UNICODE + request strings routing them to the + appropriate drivers. This function is + analogous to the similarly named + function in the HII Routing Protocol. + + @param RouteConfig This function breaks apart the UNICODE + results strings and returns configuration + information as specified by the request. + + @param Callback This function is called from the + configuration browser to communicate certain + activities that were initiated by a user. + + +**/ +struct _EFI_HII_CONFIG_ACCESS_PROTOCOL { + EFI_HII_ACCESS_ROUTE_CONFIG ExtractConfig; + EFI_HII_ACCESS_EXTRACT_CONFIG RouteConfig; + EFI_FORM_CALLBACK Callback; +} ; + +extern EFI_GUID gEfiHiiConfigAccessProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/HiiConfigRouting.h b/MdePkg/Include/Protocol/HiiConfigRouting.h new file mode 100644 index 0000000000..e17dc31553 --- /dev/null +++ b/MdePkg/Include/Protocol/HiiConfigRouting.h @@ -0,0 +1,363 @@ +/** @file + The file provides services to manage the movement of + configuration data from drivers to configuration applications. + It then serves as the single point to receive configuration + information from configuration applications, routing the + results to the appropriate drivers. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: HiiConfigRouting.h + +**/ + +#ifndef __HII_CONFIG_ROUTING_H__ +#define __HII_CONFIG_ROUTING_H__ + +#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \ + { 0x587e72d7, 0xcc50, 0x4f79, { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } } + + +typedef struct _EFI_HII_CONFIG_ROUTING_PROTOCOL EFI_HII_CONFIG_ROUTING_PROTOCOL; + + +/** + + This function allows the caller to request the current + configuration for one or more named elements from one or more + drivers. The resulting string is in the standard HII + configuration string format. If Successful Results contains an + equivalent string with "=" and the values associated with all + names added in. The expected implementation is for each + substring in the Request, call the HII + Configuration Routing Protocol ExtractProtocol function for the + driver corresponding to the at the start of the + substring. The request fails if no driver + matches the substring. Note: Alternative + configuration strings may also be appended to the end of the + current configuration string. If they are, they must appear + after the current configuration. They must contain the same + routing (GUID, NAME, PATH) as the current configuration string. + They must have an additional description indicating the type of + alternative configuration the string represents, + "ALTCFG=". That (when converted from + Hex UNICODE to binary) is a reference to a string in the + associated string pack. As an example, assume that the Request + string is: + GUID=...&NAME=00480050&PATH=...&Fred&George&Ron&Neville A result + might be: + GUID=...&NAME=00480050&PATH=...&Fred=16&George=16&Ron=12&Neville=11& + GUID=...&NAME=00480050&PATH=...&ALTCFG=0037&Fred=12&Neville=7 + + @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL + instance. + + @param Request A null-terminated Unicode string in + format. + + @param Progress On return, points to a character in the + Request string. Points to the string's null + terminator if request was successful. Points + to the most recent '&' before the first + failing name / value pair (or the beginning + of the string if the failure is in the first + name / value pair) if the request was not + successful + + @param Results Null-terminated Unicode string in + format which has all + values filled in for the names in the + Request string. String to be allocated by + the called function. + + @retval EFI_SUCCESS The Results string is filled with the + values corresponding to all requested + names. + + @retval EFI_OUT_OF_MEMORY Not enough memory to store the + parts of the results that must be + stored awaiting possible future + protocols. + + @retval EFI_INVALID_PARAMETER For example, passing in a NULL + for the Request parameter + would result in this type of + error. The Progress parameter + is set to NULL. EFI_NOT_FOUND + Routing data doesn't match any + known driver. Progress set to + the "G" in "GUID" of the + routing header that doesn't + match. Note: There is no + requirement that all routing + data be validated before any + configuration extraction. + + @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set + to most recent & before the + error or the beginning of the + string. + @retval EFI_INVALID_PARAMETER Unknown name. + + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_HII_ROUTING_EXTRACT_CONFIG ) ( + IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This, + IN CONST EFI_STRING *Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results +); + +/** + + This function allows the caller to request the current + configuration for all of the current HII database. The results + include both the current and alternate configurations as + described in ExtractConfig() above. Implementation note: This + call has deceptively few inputs but the implementation is likely + to be somewhat complex. The requirement is to scan all IFR in + the HII database to determine the list of names and then request + the configuration using the corresponding drivers?? + EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig() interfaces below. + + @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL + instance. + + @param Results A null-terminated Unicode string in + format which has all + values filled in for the names in the Request + string. String to be allocated by this + function. De-allocation is up to the caller. + + @retval EFI_SUCCESS The Results string is filled with the + values corresponding to all requested + names. + + @retval EFI_OUT_OF_MEMORY Not enough memory to store the + parts of the results that must be + stored awaiting possible future + protocols. + + @retval EFI_INVALID_PARAMETERS For example, passing in a NULL + for the Results parameter + would result in this type of + error. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_HII_ROUTING_EXPORT_CONFIG ) ( + IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This, + OUT EFI_STRING *Results +); + +/** + + This function routes the results of processing forms to the + appropriate targets. It scans for within the string + and passes the header and subsequent body to the driver whose + location is described in the . Many s may + appear as a single request. The expected implementation is to + hand off the various substrings to the + Configuration Access Protocol RouteConfig routine corresponding + to the driver whose routing information is defined by the + in turn. + + @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL + instance. + + @param Configuration A null-terminated Unicode string in + format. + + @param Progress A pointer to a string filled in with the + offset of the most recent '&' before the + first failing name / value pair (or the + beginning of the string if the failure is in + the first name / value pair) or the + terminating NULL if all was successful. + + @retval EFI_SUCCESS The results have been distributed or are + awaiting distribution. + + @retval EFI_OUT_OF_MEMORY Not enough memory to store the + parts of the results that must be + stored awaiting possible future + protocols. + + @retval EFI_INVALID_PARAMETERS Passing in a NULL for the + Results parameter would result + in this type of error. + + @retval EFI_NOT_FOUND Target for the specified routing data + was not found + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_HII_ROUTING_ROUTE_CONFIG ) ( + IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress +); + + +/** + + This function extracts the current configuration from a block of + bytes. To do so, it requires that the ConfigRequest string + consists of a list of formatted names. It uses the + offset in the name to determine the index into the Block to + start the extraction and the width of each name to determine the + number of bytes to extract. These are mapped to a UNICODE value + using the equivalent of the C "%x" format (with optional leading + spaces). The call fails if, for any (offset, width) pair in + ConfigRequest, offset+value >= BlockSize. + + @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL + instance. + + @param ConfigRequest A null-terminated Unicode string in + format. + + @param Block Array of bytes defining the block's + configuration. + + @param BlockSize Length in bytes of Block. + + @param Config Filled-in configuration string. String + allocated by the function. Returned only if + call is successful. + + @param Progress A pointer to a string filled in with the + offset of the most recent '&' before the + first failing name / value pair (or the + beginning of the string if the failure is in + the first name / value pair) or the + terminating NULL if all was successful. + + @retval EFI_SUCCESS The request succeeded. Progress points + to the null terminator at the end of the + ConfigRequest string. + @retval EFI_OUT_OF_MEMORY Not enough memory to allocate + Config. Progress points to the + first character of ConfigRequest. + + @retval EFI_INVALID_PARAMETERS Passing in a NULL for the + ConfigRequest or Block + parameter would result in this + type of error. Progress points + to the first character of + ConfigRequest. + + @retval EFI_NOT_FOUND Target for the specified routing data + was not found. Progress points to the + 'G' in "GUID" of the errant routing + data. EFI_DEVICE_ERROR Block not large + enough. Progress undefined. + + @retval EFI_INVALID_PARAMETER Encountered non + formatted string. Block is + left updated and Progress + points at the '&' preceding + the first non-. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_HII_ROUTING_BLOCK_TO_CONFIG ) ( + IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This, + IN CONST EFI_STRING ConfigRequest, + IN CONST UINT8 *Block, + IN CONST UINTN BlockSize, + OUT EFI_STRING **Config, + OUT EFI_STRING *Progress +); + + + +/** + + This function maps a configuration containing a series of + formatted name value pairs in ConfigResp into a + Block so it may be stored in a linear mapped storage such as a + UEFI Variable. If present, the function skips GUID, NAME, and + PATH in . It stops when it finds a non- + name / value pair (after skipping the routing header) or when it + reaches the end of the string. + Example Assume an existing block containing: 00 01 02 03 04 05 + And the ConfigResp string is: + OFFSET=4&WIDTH=1&VALUE=7&OFFSET=0&WIDTH=2&VALUE=AA55 + The results are + 55 AA 02 07 04 05 + + @param This Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL + instance. + + @param ConfigResp A null-terminated Unicode string in + format. + + @param CurrentBlock A possibly null array of bytes + representing the current block. Only + bytes referenced in the ConfigResp + string in the block are modified. If + this parameter is null or if the + BlockLength parameter is (on input) + shorter than required by the + Configuration string, only the BlockSize + parameter is updated and an appropriate + status (see below) is returned. + + @param BlockSize The length of the Block in units of UINT8. + On input, this is the size of the Block. On + output, if successful, contains the index of + the last modified byte in the Block. + + @param Progress On return, points to an element of the + ConfigResp string filled in with the offset + of the most recent "&" before the first + failing name / value pair (or the beginning + of the string if the failure is in the first + name / value pair) or the terminating NULL + if all was successful. + +**/ +typedef +EFI_STATUS +(EFIAPI * EFI_HII_ROUTING_CONFIG_TO_BLOCK ) ( + IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This, + IN CONST EFI_STRING *ConfigResp, + IN CONST UINT8 *Block, + IN OUT UINTN *BlockSize, + OUT EFI_STRING *Progress +); + + +/** + + This protocol defines the configuration routing interfaces + between external applications and the HII. There may only be one + instance of this protocol in the system. + +**/ +struct _EFI_HII_CONFIG_ROUTING_PROTOCOL { + EFI_HII_ROUTING_EXTRACT_CONFIG ExtractConfig; + EFI_HII_ROUTING_EXPORT_CONFIG ExportConfig; + EFI_HII_ROUTING_ROUTE_CONFIG RouteConfig; + EFI_HII_ROUTING_BLOCK_TO_CONFIG BlockToConfig; + EFI_HII_ROUTING_CONFIG_TO_BLOCK ConfigToBlock; +}; + +extern EFI_GUID gEfiHiiConfigRoutingProtocolGuid; + + +#endif + diff --git a/MdePkg/Include/Protocol/HiiDatabase.h b/MdePkg/Include/Protocol/HiiDatabase.h new file mode 100644 index 0000000000..666c44d744 --- /dev/null +++ b/MdePkg/Include/Protocol/HiiDatabase.h @@ -0,0 +1,2209 @@ +/** @file + The file provides Database manager for HII-related data + structures. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: HiiDatabase.h + +**/ + +#ifndef __HII_DATABASE_H__ +#define __HII_DATABASE_H__ + +#define EFI_HII_DATABASE_PROTOCOL_GUID \ + { 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } } + + +typedef struct _EFI_HII_DATABASE_PROTOCOL EFI_HII_DATABASE_PROTOCOL; + +// +// ConfigurationS of HII. +// +#define GLYPH_WIDTH 8 +#define GLYPH_HEIGHT 19 + +/** + + Each package starts with a header, as defined above, which + indicates the size and type of the package. When added to a + pointer pointing to the start of the header, Length points at + the next package. The package lists form a package list when + concatenated together and terminated with an + EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The + type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII + packages, whose contents are determined by the Guid. The range + of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN + through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system + firmware implementers. + + @param Length The size of the package in bytes. + + @param Type The package type. See EFI_HII_PACKAGE_TYPE_x, + below. + + @param Data The package data, the format of which is + determined by Type. + +**/ +typedef struct { + UINT32 Length:24; + UINT32 Type:8; + // UINT8 Data[...]; +} EFI_HII_PACKAGE_HEADER; + +// +// EFI_HII_PACKAGE_TYPE_x. +// +#define EFI_HII_PACKAGE_TYPE_ALL 0x00 +#define EFI_HII_PACKAGE_TYPE_GUID 0x01 +#define EFI_HII_PACKAGE_FORM_CONFIG 0x02 +#define EFI_HII_PACKAGE_FORM_APP 0x03 +#define EFI_HII_PACKAGE_STRINGS 0x04 +#define EFI_HII_PACKAGE_FONTS 0x05 +#define EFI_HII_PACKAGE_IMAGES 0x06 +#define EFI_HII_PACKAGE_SIMPLE_FONTS 0x07 +#define EFI_HII_PACKAGE_DEVICE_PATH 0x08 +#define EFI_HII_PACKAGE_END 0x09 +#define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN 0xE0 +#define EFI_HII_PACKAGE_TYPE_SYSTEM_END 0xFF + + +/** + + This header uniquely identifies the package list.and is placed + in front of a list of packages. Package lists with the same + PackageListGuid value should contain the same data set. Updated + versions should have updated GUIDs. + + @param PackageListGuid The unique identifier applied to the + list of packages which follows. + + + @param PackageLength The size of the package list (in + bytes), including the header. + +**/ +typedef struct { + EFI_GUID PackageListGuid; + UINT32 PackagLength; +} EFI_HII_PACKAGE_LIST_HEADER; + +/** + + The fonts must be presented in Unicode sort order. That is, + the primary sort key is the UnicodeWeight and the secondary + sort key is the SurrogateWeight. It is up to developers who + manage fonts to choose efficient mechanisms for accessing + fonts. The contiguous presentation can easily be used because + narrow and wide glyphs are not intermixed, so a binary search + is possible (hence the requirement that the glyphs be sorted + by weight). + + @param Header The header contains a Length and Type field. + In the case of a font package, the type will + be EFI_HII_PACKAGE_SIMPLE_FONTS and the length + will be the total size of the font package + including the size of the narrow and wide + glyphs. See EFI_HII_PACKAGE_HEADER. + + @param NumberOfNarrowGlyphs The number of NarrowGlyphs that + are included in the font package. + + @param NumberOfWideGlyphs The number of WideGlyphs that are + included in the font package. + + @param NarrowGlyphs An array of EFI_NARROW_GLYPH entries. + The number of entries is specified by + NumberOfNarrowGlyphs. + + @param WideGlyphs An array of EFI_WIDE_GLYPH entries. The + number of entries is specified by + NumberOfWideGlyphs. To calculate the + offset of WideGlyphs, use the offset of + NarrowGlyphs and add the size of + EFI_NARROW_GLYPH multiplied by the + NumberOfNarrowGlyphs. + +*/ +typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR { + EFI_HII_PACKAGE_HEADER Header; + UINT16 NumberOfNarrowGlyphs; + UINT16 NumberOfWideGlyphs; + // EFI_NARROW_GLYPH NarrowGlyphs[]; + // EFI_WIDE_GLYPH WideGlyphs[]; +} EFI_HII_SIMPLE_FONT_PACKAGE_HDR; + +// +// Contents of EFI_NARROW_GLYPH.Attributes +// +#define EFI_GLYPH_NON_SPACING 0x01 +#define EFI_GLYPH_WIDE 0x02 + +/** + + Glyphs are represented by two structures, one each for the two + sizes of glyphs. The narrow glyph (EFI_NARROW_GLYPH) is the + normal glyph used for text display. + + @param UnicodeWeight The Unicode representation of the glyph. + The term weight is the technical term + for a character value. + + @param Attributes The data element containing the glyph + definitions; see Related Definitions + below. + + @param GlyphCol1 The column major glyph representation of the + character. Bits with values of one + indicate that the corresponding pixel is to + be on when normally displayed; those with + zero are off. + +**/ +typedef struct { + CHAR16 UnicodeWeight; + UINT8 Attributes; + UINT8 GlyphCol1[19]; +} EFI_NARROW_GLYPH; + +/** + + Glyphs are represented via the two structures, one each for the + two sizes of glyphs. The wide glyph (EFI_WIDE_GLYPH) is large + enough to display logographic characters. + + @param UnicodeWeight The Unicode representation of the glyph. + The term weight is the technical term + for a character value. + + @param Attributes The data element containing the glyph + definitions; see Related Definitions in + EFI_NARROW_GLYPH for attribute values. + + @param GlyphCol1, GlyphCol2 The column major glyph + representation of the character. + Bits with values of one indicate + that the corresponding pixel is + to be on when normally + displayed; those with zero are + off. + + @param Pad Ensures that sizeof(EFI_WIDE_GLYPH) is twice the + sizeof(EFI_NARROW_GLYPH). The contents of Pad must + bezero. + + +**/ +typedef struct { + CHAR16 UnicodeWeight; + UINT8 Attributes; + UINT8 GlyphCol1[GLYPH_HEIGHT]; + UINT8 GlyphCol2[GLYPH_HEIGHT]; + UINT8 Pad[3]; +} EFI_WIDE_GLYPH; + + +// +// EFI_HII_FONT_STYLE +// +typedef UINT32 EFI_HII_FONT_STYLE; +#define EFI_HII_FONT_STYLE_BOLD 0x00000001 +#define EFI_HII_FONT_STYLE_ITALIC 0x00000002 +#define EFI_HII_FONT_STYLE_EMBOSS 0x00010000 +#define EFI_HII_FONT_STYLE_OUTLINE 0x00020000 +#define EFI_HII_FONT_STYLE_SHADOW 0x00040000 +#define EFI_HII_FONT_STYLE_UNDERLINE 0x00080000 +#define EFI_HII_FONT_STYLE_DBL_UNDER 0x00100000 + +// +// EFI_HII_GLYPH_BLOCK.BlockType +// +#define EFI_HII_GIBT_END 0x00 +#define EFI_HII_GIBT_GLYPH 0x10 +#define EFI_HII_GIBT_GLYPHS 0x11 +#define EFI_HII_GIBT_GLYPH_DEFAULT 0x12 +#define EFI_HII_GIBT_GLYPHS_DEFAULT 0x13 +#define EFI_HII_GIBT_DUPLICATE 0x20 +#define EFI_HII_GIBT_SKIP2 0x21 +#define EFI_HII_GIBT_SKIP1 0x22 +#define EFI_HII_GIBT_DEFAULTS 0x23 +#define EFI_HII_GIBT_EXT1 0x30 +#define EFI_HII_GIBT_EXT2 0x31 +#define EFI_HII_GIBT_EXT4 0x32 + +/** + + EFI_HII_GIBT_END block is found. When processing the glyph + blocks, each block refers to the current character value + (CharValueCurrent), which is initially set to one (1). Glyph + blocks of an unknown type should be skipped. If they cannot be + skipped, then processing halts. + +**/ +typedef struct _EFI_HII_GLYPH_BLOCK { + UINT8 BlockType; + UINT8 BlockBody[1]; +} EFI_HII_GLYPH_BLOCK; + + +/** + + @param Width Width of the character or character cell, in + pixels. For fixed-pitch fonts, this is the same + as the advance. + + @param Height Height of the character or character cell, in + pixels. + + @param OffsetX Offset to the horizontal edge of the character + cell. + + @param OffsetY Offset to the vertical edge of the character + cell. + + @param AdvanceX Number of pixels to advance to the right + when moving from the origin of the current + glyph to the origin of the next glyph. + +**/ +typedef struct _EFI_HII_GLYPH_INFO { + UINT16 Width; + UINT16 Height; + INT16 OffsetX; + INT16 OffsetY; + INT16 AdvanceX; +} EFI_HII_GLYPH_INFO; + + +/** + + Changes the default cell information used for subsequent + EFI_HII_GIBT_GLYPH_DEFAULT and EFI_HII_GIBT_GLYPHS_DEFAULT glyph + blocks. The cell information described by Cell remains in effect + until the next EFI_HII_GIBT_DEFAULTS is found. Prior to the + first EFI_HII_GIBT_DEFAULTS block, the cell information in the + fixed header are used. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_DEFAULTS. + + @param Cell The new default cell information which will be + applied to all subsequent GLYPH_DEFAULT and + GLYPHS_DEFAULT blocks. + +**/ +typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + EFI_HII_GLYPH_INFO Cell; +} EFI_HII_GIBT_DEFAULTS_BLOCK; + + +/** + + Indicates that the glyph with character value CharValueCurrent + has the same glyph as a previously defined character value and + increments CharValueCurrent by one. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_DUPLICATE. + + @param CharValue The previously defined character value with + the exact same glyph. + +**/ +typedef struct _EFI_HII_GIBT_DUPLICATE_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + CHAR16 CharValue; +} EFI_HII_GIBT_DUPLICATE_BLOCK; + + +/** + + Any glyphs with a character value greater than or equal to + CharValueCurrent are empty. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_END. + +**/ +typedef struct _EFI_GLYPH_GIBT_END_BLOCK { + EFI_HII_GLYPH_BLOCK Header; +} EFI_GLYPH_GIBT_END_BLOCK; + +/** + + These are reserved for future expansion, with length bytes + included so that they can be easily skipped. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_EXT1, + EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4. + + @param Length Size of the glyph block, in bytes. + +**/ +typedef struct _EFI_HII_GIBT_EXT1_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + UINT8 BlockType2; + UINT8 Length; +} EFI_HII_GIBT_EXT1_BLOCK; + + +/** + + These are reserved for future expansion, with length bytes + included so that they can be easily skipped. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_EXT1, + EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4. + + @param Length Size of the glyph block, in bytes. + +**/ +typedef struct _EFI_HII_GIBT_EXT2_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + UINT8 BlockType2; + UINT16 Length; +} EFI_HII_GIBT_EXT2_BLOCK; + +/** + + These are reserved for future expansion, with length bytes + included so that they can be easily skipped. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_EXT1, + EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4. + + @param Length Size of the glyph block, in bytes. + +**/ +typedef struct _EFI_HII_GIBT_EXT4_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + UINT8 BlockType2; + UINT32 Length; +} EFI_HII_GIBT_EXT4_BLOCK; + + +/** + + This block provides the bitmap for the character with the value + CharValueCurrent and increments CharValueCurrent by one. Each + glyph contains a glyph width and height, a drawing offset, + number of pixels to advance after drawing and then the encoded + bitmap. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_GLYPH. + + @param Cell Contains the width and height of the encoded + bitmap (Cell.Width and Cell.Height), the number + of pixels (signed) right of the character cell + origin where the left edge of the bitmap should + be placed (Cell.OffsetX), the number of pixels + above the character cell origin where the top + edge of the bitmap should be placed + (Cell.OffsetY) and the number of pixels (signed) + to move right to find the origin for the next + charactercell (Cell.AdvanceX). + + @param GlyphCount The number of glyph bitmaps. + + @param BitmapData The bitmap data specifies a series of + pixels, one bit per pixel, left-to-right, + top-tobottom. Each glyph bitmap only + encodes the portion of the bitmap enclosed + by its character-bounding box, but the + entire glyph is padded out to the nearest + byte. The number of bytes per bitmap can + be calculated as: ((Cell.Width + 7)/8) * + Cell.Height. + + +**/ +typedef struct _EFI_HII_GIBT_GLYPH_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + EFI_HII_GLYPH_INFO Cell; + UINT16 GlyphCount; + UINT8 BitmapData[1]; +} EFI_HII_GIBT_GLYPH_BLOCK; + +/** + + Provides the bitmaps for the characters with the values + CharValueCurrent through CharValueCurrent + Count -1 and + increments CharValueCurrent by Count. These glyphs have + identical cell information and the encoded bitmaps are exactly + the same number of byes. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_GLYPHS. + + @param Cell Contains the width and height of the encoded + bitmap (Cell.Width and Cell.Height), the + number of pixels (signed) right of the + character cell origin where the left edge of + the bitmap should be placed (Cell.OffsetX), + the number of pixels above the character cell + origin where the top edge of the bitmap should + be placed (Cell.OffsetY) and the number of + pixels(signed) to move right to find the + origin for the next character cell + (Cell.AdvanceX). + + @param BitmapData The bitmap data specifies a series of + pixels, one bit per pixel, left-to-right, + top-tobottom, for each glyph. Each glyph + bitmap only encodes the portion of the + bitmap enclosed by its character-bounding + box. The number of bytes per bitmap can be + calculated as: ((Cell.Width + 7)/8) * + Cell.Height. + +**/ +typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + EFI_HII_GLYPH_INFO Cell; + UINT8 BitmapData[1]; +} EFI_HII_GIBT_GLYPHS_BLOCK; + +/** + + Provides the bitmap for the character with the value + CharValueCurrent and increments CharValueCurrent by 1. This + glyph uses the default cell information. The default cell + information is found in the font header or the most recently + processed EFI_HII_GIBT_DEFAULTS. + + @param Header Standard glyph block header, where + Header.BlockType = EFI_HII_GIBT_GLYPH_DEFAULT. + + @param BitmapData The bitmap data specifies a series of + pixels, one bit per pixel, left-to-right, + top-tobottom. Each glyph bitmap only + encodes the portion of the bitmap enclosed + by its character-bounding box. The number + of bytes per bitmap can be calculated as: + ((Global.Cell.Width + 7)/8) * + Global.Cell.Height. + +**/ +typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + UINT8 BitmapData[1]; +} EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK; + + + + +/** + + Provides the bitmaps for the characters with the values + CharValueCurrent through CharValueCurrent + Count -1 and + increments CharValueCurrent by Count. These glyphs use the + default cell information and the encoded bitmaps have exactly + the same number of byes. + + @param Header Standard glyph block header, where + Header.BlockType = + EFI_HII_GIBT_GLYPHS_DEFAULT. + + @param Count Number of glyphs in the glyph block. + + @param BitmapData The bitmap data specifies a series of + pixels, one bit per pixel, left-to-right, + top-tobottom, for each glyph. Each glyph + bitmap only encodes the portion of the + bitmap enclosed by its character-bounding + box. The number of bytes per bitmap can be + calculated as: ((Global.Cell.Width + 7)/8) + Global.Cell.Height. + +**/ +typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + UINT16 Count; + UINT8 BitmapData[1]; +} EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK; + +/** + + Increments the current character value CharValueCurrent by the + number specified. + + @param Header Standard glyph block header, where BlockType = + EFI_HII_GIBT_SKIP1 or EFI_HII_GIBT_SKIP2. + + @param SkipCount The unsigned 8- or 16-bit value to add to + CharValueCurrent. + +**/ +typedef struct _EFI_HII_GIBT_SKIP2_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + UINT16 SkipCount; +} EFI_HII_GIBT_SKIP2_BLOCK; + + +/** + + Increments the current character value CharValueCurrent by the + number specified. + + @param Header Standard glyph block header, where BlockType = + EFI_HII_GIBT_SKIP1 or EFI_HII_GIBT_SKIP2. + + @param SkipCount The unsigned 8- or 16-bit value to add to + CharValueCurrent. + +**/ +typedef struct _EFI_HII_GIBT_SKIP1_BLOCK { + EFI_HII_GLYPH_BLOCK Header; + UINT8 SkipCount; +} EFI_HII_GIBT_SKIP1_BLOCK; + + +/** + + This package is created by NewPackageList() when the package + list is first added to the HII database by locating the + EFI_DEVICE_PATH_PROTOCOL attached to the driver handle passed in + to that function. + +**/ +typedef EFI_DEVICE_PATH_PROTOCOL EFI_HII_DEVICE_PATH_PACKAGE_HDR; + + +/** + + This is a free-form package type designed to allow extensibility + by allowing the format to be specified using Guid. + + @param Guid Identifier which describes the remaining data + within the package. + +**/ +typedef struct _EFI_HII_GUID_PACKAGE_HDR { + EFI_GUID Guid; +} EFI_HII_GUID_PACKAGE_HDR; + + +/** + + The Strings package record describes the mapping between string + identifiers and the actual text of the strings themselves. The + package consists of three parts: a fixed header, the string + information and the font information. + + @param Header The standard package header, where Header.Type + = EFI_HII_PACKAGE_STRINGS. + + @param HdrSize Size of this header. + + @param StringInfoOffset Offset, relative to the start of + this header, of the string information. + + @param LanguageWindow Specifies the default values placed in + the static and dynamic windows before + processing each SCSU-encoded strings. + + + @param LanguageName String identifier within the current + string package of the full name of the + language specified by Language. Language + Language of the strings, as specified by + RFC 3066. + +**/ +typedef struct _EFI_HII_STRING_PACKAGE_HDR { + EFI_HII_PACKAGE_HEADER Header; + UINT32 HdrSize; + UINT32 StringInfoOffset; + CHAR16 LanguageWindow[16]; + EFI_STRING_ID LanguageName; + CHAR8 Language[1]; +} EFI_HII_STRING_PACKAGE_HDR; + + + +/** + + The fixed header consists of a standard record header and then + the character values in this section, the flags (including the + encoding method) and the offsets of the glyph information, the + glyph bitmaps and the character map. + + @param Header The standard package header, where Header.Size + EFI_HII_PACKAGE_FONTS. + + @param HdrSize Size of this header. + + @param GlyphInfoOffset The offset, relative to the start of + this header, of a series of + variable-length glyph blocks, each + describing information about the + bitmap associated with a glyph. + + @param Cell This contains the measurement of the widest and + tallest characters in the font (Cell.Width and + Cell.Height). It also contains the offset to the + horizontal and vertical origin point of the + character cell (Cell.OffsetX and Cell.OffsetY). + Finally, it contains the default AdvanceX. The + individual glyph's OffsetX and OffsetY value is + added to this position to determine where to + draw the top-left pixel of the character's + glyph. The character glyph's AdvanceX is added + to this position to determine the origin point + for the next character. + + @param FontStyle The design style of the font, 1 bit per + style. See EFI_HII_FONT_STYLE. + + @param FontFamily The null-terminated string with the name + of the font family to which the font + belongs. + +**/ +typedef struct _EFI_HII_FONT_PACKAGE_HDR { + EFI_HII_PACKAGE_HEADER Header; + UINT32 HdrSize; + UINT32 GlyphBlockOffset; + EFI_HII_GLYPH_INFO Cell; + EFI_HII_FONT_STYLE FontStyle; + CHAR16 FontFamily[1]; +} EFI_HII_FONT_PACKAGE_HDR; + + +// +// EFI_HII_STRING_BLOCK.BlockType +// +#define FI_HII_SIBT_END 0x00 +#define EFI_HII_SIBT_STRING_SCSU 0x10 +#define EFI_HII_SIBT_STRING_SCSU_FONT 0x11 +#define EFI_HII_SIBT_STRINGS_SCSU 0x12 +#define EFI_HII_SIBT_STRINGS_SCSU_FONT 0x13 +#define EFI_HII_SIBT_STRING_UCS2 0x14 +#define EFI_HII_SIBT_STRING_UCS2_FONT 0x15 +#define EFI_HII_SIBT_STRINGS_UCS2 0x16 +#define EFI_HII_SIBT_STRINGS_UCS2_FONT 0x17 +#define EFI_HII_SIBT_DUPLICATE 0x20 +#define EFI_HII_SIBT_SKIP2 0x21 +#define EFI_HII_SIBT_SKIP1 0x22 +#define EFI_HII_SIBT_EXT1 0x30 +#define EFI_HII_SIBT_EXT2 0x31 +#define EFI_HII_SIBT_EXT4 0x32 +#define EFI_HII_SIBT_FONT 0x40 + +/** + + String blocks specify the text and font for the current string + identifier and increment to the next string identifier. +**/ +typedef struct { + UINT8 BlockType; + UINT8 BlockBody[1]; +} EFI_HII_STRING_BLOCK; + + +/** + + Indicates that the string with string identifier + StringIdCurrent is the same as a previously defined string and + increments StringIdCurrent by one. + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_DUPLICATE. + + @param StringId The string identifier of a previously + defined string with the exact same string + text. Description + + +**/ +typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK { + EFI_HII_STRING_BLOCK Header; + EFI_STRING_ID StringId; +} EFI_HII_SIBT_DUPLICATE_BLOCK; + +/** + + Any strings with a string identifier greater than or equal to + StringIdCurrent are empty. + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_END. + +**/ +typedef struct _EFI_HII_SIBT_END_BLOCK { + EFI_HII_STRING_BLOCK Header; +} EFI_HII_SIBT_END_BLOCK; + + +/** + + These are reserved for future expansion, with length bytes + included so that they can be easily skip + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_EXT1, + EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4. + + @param Length Size of the string block, in bytes. + +**/ +typedef struct _EFI_HII_SIBT_EXT1_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT8 BlockType2; + UINT8 Length; +} EFI_HII_SIBT_EXT1_BLOCK; + +/** + + These are reserved for future expansion, with length bytes + included so that they can be easily skip + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_EXT1, + EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4. + + @param Length Size of the string block, in bytes. + +**/ +typedef struct _EFI_HII_SIBT_EXT2_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT8 BlockType2; + UINT16 Length; +} EFI_HII_SIBT_EXT2_BLOCK; + +/** + + These are reserved for future expansion, with length bytes + included so that they can be easily skip + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_EXT1, + EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4. + + @param Length Size of the string block, in bytes. + +**/ +typedef struct _EFI_HII_SIBT_EXT4_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT8 BlockType2; + UINT32 Length; +} EFI_HII_SIBT_EXT4_BLOCK; + +/** + + Associates a font identifier FontId with a font name FontName, + size FontSize and style FontStyle. This font identifier may be + used with the string blocks. The font identifier 0 is the + default font for those string blocks which do not specify a font + identifier. + + @param Header Standard extended header, where + Header.BlockType = EFI_HII_SIBT_FONT. + + @param FontId Font identifier, which must be unique within + the font package. + + @param FontSize Character cell size, in pixels, of the font. + + @param FontStyle Font style. + + @param FontName Null-terminated font family name. + +**/ +typedef struct _EFI_HII_SIBT_FONT_BLOCK { + EFI_HII_SIBT_EXT2_BLOCK Header; + UINT8 FontId; + UINT16 FontSize; + EFI_HII_FONT_STYLE FontStyle; + CHAR16 FontName[1]; +} EFI_HII_SIBT_FONT_BLOCK; + +/** + + Increments the current string identifier StringIdCurrent by the + number specified. + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_SKIP1. + + @param SkipCount The unsigned 8-bit value to add to + StringIdCurrent. + +**/ +typedef struct _EFI_HII_SIBT_SKIP1_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT8 SkipCount; +} EFI_HII_SIBT_SKIP1_BLOCK; + +/** + + Increments the current string identifier StringIdCurrent by + the number specified. + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_SKIP2. + + @param SkipCount The unsigned 16-bit value to add to + StringIdCurrent. + +**/ +typedef struct _EFI_HII_SIBT_SKIP2_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT16 SkipCount; +} EFI_HII_SIBT_SKIP2_BLOCK; + +/** + + This string block provides the SCSU-encoded text for the string + in the default font with string identifier StringIdCurrent and + increments StringIdCurrent by one. + + @param Header Standard header where Header.BlockType = + EFI_HII_SIBT_STRING_SCSU. + + @param StringText The string text is a null-terminated + string, which is assigned to the string + identifier StringIdCurrent. + +**/ +typedef struct _EFI_HII_SIBT_STRING_SCSU_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT8 StringText[1]; +} EFI_HII_SIBT_STRING_SCSU_BLOCK; + + +/** + + This string block provides the SCSU-encoded text for the string + in the font specified by FontIdentifier with string identifier + StringIdCurrent and increments StringIdCurrent by one. + + @param Header Standard string block header, where + Header.BlockType = EFI_HII_SIBT_STRING_SCSU_FONT. + + @param FontIdentifier The identifier of the font to be used + as the starting font for the entire + string. The identifier must either be + 0 for the default font or an + identifier previously specified by an + EFI_HII_SIBT_FONT block. Any string + characters that deviates from this + font family, size or style must + provide an explicit control character. + + @param StringText The string text is a null-terminated + encoded string, which is assigned to the + string identifier StringIdCurrent. + + +**/ +typedef struct _EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT8 FontIdentifier; + UINT8 StringText[1]; +} EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK; + + +/** + + This string block provides the SCSU-encoded text for StringCount + strings which have the default font and which have sequential + string identifiers. The strings are assigned the identifiers, + starting with StringIdCurrent and continuing through + StringIdCurrent + StringCount ??C 1. StringIdCurrent is + incremented by StringCount. + + @param Header Standard header where Header.BlockType = + EFI_HII_SIBT_STRINGS_SCSU. + + @param StringCount Number of strings in StringText. + + @param StringText The strings, where each string is a + null-terminated encoded string. + +**/ +typedef struct _EFI_HII_SIBT_STRINGS_SCSU_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT16 StringCount; + UINT8 StringText[1]; +} EFI_HII_SIBT_STRINGS_SCSU_BLOCK; + + +/** + + This string block provides the SCSU-encoded text for StringCount + strings which have the font specified by FontIdentifier and + which have sequential string identifiers. The strings are + assigned the identifiers, starting with StringIdCurrent and + continuing through StringIdCurrent + StringCount ??C 1. + StringIdCurrent is incremented by StringCount. + + @param Header Standard header where Header.BlockType = + EFI_HII_SIBT_STRINGS_SCSU_FONT. + + @param StringCount Number of strings in StringText. + + @param FontIdentifier The identifier of the font to be used + as the starting font for the entire + string. The identifier must either be + 0 for the default font or an + identifier previously specified by an + EFI_HII_SIBT_FONT block. Any string + characters that deviates from this + font family, size or style must + provide an explicit control character. + + @param StringText The strings, where each string is a + null-terminated encoded string. + +**/ +typedef struct _EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT16 StringCount; + UINT8 FontIdentifier; + UINT8 StringText[1]; +} EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK; + + +/** + + This string block provides the UCS-2 encoded text for the string + in the default font with string identifier StringIdCurrent and + increments StringIdCurrent by one. + + @param Header Standard header where Header.BlockType = + EFI_HII_SIBT_STRING_UCS2. + + @param StringText The string text is a null-terminated UCS-2 + string, which is assigned to the string + identifier StringIdCurrent. + +**/ +typedef struct _EFI_HII_SIBT_STRING_UCS2_BLOCK { + EFI_HII_STRING_BLOCK Header; + CHAR16 StringText[1]; +} EFI_HII_SIBT_STRING_UCS2_BLOCK; + + +/** + + This string block provides the UCS-2 encoded text for the string + in the font specified by FontIdentifier with string identifier + StringIdCurrent and increments StringIdCurrent by one + + @param Header Standard header where Header.BlockType = + EFI_HII_SIBT_STRING_UCS2_FONT. + + @param FontIdentifier The identifier of the font to be used + as the starting font for the entire + string. The identifier must either be + 0 for the default font or an + identifier previously specified by an + EFI_HII_SIBT_FONT block. Any string + characters that deviates from this + font family, size or style must + provide an explicit control character. + + @param StringText The string text is a null-terminated UCS-2 + string, which is assigned to the string + identifier StringIdCurrent. + +**/ +typedef struct _EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT8 FontIdentifier; + CHAR16 StringText[1]; +} EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK; + + +/** + + This string block provides the UCS-2 encoded text for the + strings in the default font with string identifiers + StringIdCurrent to StringIdCurrent + StringCount - 1 and + increments StringIdCurrent by StringCount. + + @param Header Standard header where Header.BlockType = + EFI_HII_SIBT_STRINGS_UCS2. + + @param StringCount Number of strings in StringText. + + @param StringText The string text is a series of + null-terminated UCS-2 strings, which are + assigned to the string identifiers + StringIdCurrent.to StringIdCurrent + + StringCount - 1. + +**/ +typedef struct _EFI_HII_SIBT_STRINGS_UCS2_BLOCK { + EFI_HII_STRING_BLOCK Header; + UINT16 StringCount; + CHAR16 StringText[1]; +} EFI_HII_SIBT_STRINGS_UCS2_BLOCK; + + +/** + + The fixed header consists of a standard record header and the + offsets of the image and palette information. + + @param Header Standard package header, where Header.Type = + EFI_HII_PACKAGE_IMAGES. ImageInfoOffset + Offset, relative to this header, of the image + information. If this is zero, then there are + no images in the package. + + @param PaletteInfoOffset Offset, relative to this header, of + the palette information. If this is + zero, then there are no palettes in + the image package. + +**/ +typedef struct _EFI_HII_IMAGE_PACKAGE_HDR { + EFI_HII_PACKAGE_HEADER Header; + UINT32 ImageInfoOffset; + UINT32 PaletteInfoOffset; +} EFI_HII_IMAGE_PACKAGE_HDR; + + +// +// EFI_HII_IMAGE_BLOCK +// +typedef struct _EFI_HII_IMAGE_BLOCK { + UINT8 BlockType; + UINT8 BlockBody[1]; +} EFI_HII_IMAGE_BLOCK; + +// +// EFI_HII_IMAGE_BLOCK.BlockType. +// +#define EFI_HII_IIBT_END 0x00 +#define EFI_HII_IIBT_IMAGE_1BIT 0x10 +#define EFI_HII_IIBT_IMAGE_1BIT_TRANS 0x11 +#define EFI_HII_IIBT_IMAGE_4BIT 0x12 +#define EFI_HII_IIBT_IMAGE_4BIT_TRANS 0x13 +#define EFI_HII_IIBT_IMAGE_8BIT 0x14 +#define EFI_HII_IIBT_IMAGE_8BIT_TRANS 0x15 +#define EFI_HII_IIBT_IMAGE_24BIT 0x16 +#define EFI_HII_IIBT_IMAGE_24BIT_TRANS 0x17 +#define EFI_HII_IIBT_IMAGE_JPEG 0x18 +#define EFI_HII_IIBT_DUPLICATE 0x20 +#define EFI_HII_IIBT_SKIP2 0x21 +#define EFI_HII_IIBT_SKIP1 0x22 +#define EFI_HII_IIBT_EXT1 0x30 +#define EFI_HII_IIBT_EXT2 0x31 +#define EFI_HII_IIBT_EXT4 0x32 + + +/** + + Any images with an image identifier greater than or equal to + ImageIdCurrent are empty. + + @param Header Standard image block header, where + Header.BlockType = EFI_HII_IIBT_END. + +**/ +typedef struct _EFI_HII_IIBT_END_BLOCK { + EFI_HII_IMAGE_BLOCK Header; +} EFI_HII_IIBT_END_BLOCK; + + +/** + + Future extensions for image records which need a length-byte + length use this prefix. + + @param Header Standard image block header, where + Header.BlockType = EFI_HII_IIBT_EXT1, + EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4. + + @param Length Size of the image block, in bytes, including + the image block header. + +**/ +typedef struct _EFI_HII_IIBT_EXT1_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + UINT8 BlockType2; + UINT8 Length; +} EFI_HII_IIBT_EXT1_BLOCK; + +/** + + Future extensions for image records which need a length-byte + length use this prefix. + + @param Header Standard image block header, where + Header.BlockType = EFI_HII_IIBT_EXT1, + EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4. + + @param Length Size of the image block, in bytes, including + the image block header. + +**/ +typedef struct _EFI_HII_IIBT_EXT2_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + UINT8 BlockType2; + UINT16 Length; +} EFI_HII_IIBT_EXT2_BLOCK; + +/** + + Future extensions for image records which need a length-byte + length use this prefix. + + @param Header Standard image block header, where + Header.BlockType = EFI_HII_IIBT_EXT1, + EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4. + + @param Length Size of the image block, in bytes, including + the image block header. + +**/ +typedef struct _EFI_HII_IIBT_EXT4_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + UINT8 BlockType2; + UINT32 Length; +} EFI_HII_IIBT_EXT4_BL0CK; + +// +// EFI_HII_IIBT_IMAGE_1BIT_BASE +// +typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BASE { + UINT16 Width; + UINT16 Height; + // UINT8 Data[...]; +} EFI_HII_IIBT_IMAGE_1BIT_BASE; + +/** + + This record assigns the 1-bit-per-pixel bitmap data to the + ImageIdCurrent identifier and increment ImageIdCurrent by one. + The data in the EFI_HII_IMAGE_1BIT_TRANS structure is exactly + the same as the EFI_HII_IMAGE_1BIT structure, the difference is + how the data is treated. The bitmap pixel value 0 is the + transparency value and will not be written to the + screen. The bitmap pixel value 1 will be translated to the color + specified by Palette. + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_IMAGE_1BIT_TRANS. + + @param PaletteIndex Index of the palette in the palette + information. + + @param Bitmap The bitmap specifies a series of pixels, one + bit per pixel, left-to-right, top-to-bottom, + and is padded out to the nearest byte. The + number of bytes per bitmap can be calculated + as: ((Width + 7)/8) * Height. + +**/ +typedef struct _EFI_HII_IBIT_IMAGE_1BIT_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + UINT8 PaletteIndex; + EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap; +} EFI_HII_IIBT_IMAGE_1BIT_BLOCK; + +typedef EFI_HII_IIBT_IMAGE_1BIT_BLOCK EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK; + + +// +// EFI_HII_RGB_PIXEL +// +typedef struct _EFI_HII_RGB_PIXEL { + UINT8 b; + UINT8 g; + UINT8 r; +} EFI_HII_RGB_PIXEL; + +// +// FI_HII_IIBT_IMAGE_24BIT_BASE +// +typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BASE { + UINT16 Width; + UINT16 Height; + // EFI_HII_RGB_PIXEL Bitmap[...]; +} EFI_HII_IIBT_IMAGE_24BIT_BASE; + +/** + + This record assigns the 24-bit-per-pixel bitmap data to the + ImageIdCurrent identifier and increment ImageIdCurrent by one. + The image's upper left hand corner pixel is composed of the + first three bitmap bytes. The first byte is the pixel????s blue + component value, the next byte is the pixel????s green component + value, and the third byte is the pixel's red component value + (B,G,R). Each color component value can vary from 0x00 (color + off) to 0xFF (color full on), allowing 16.8 millions colors that + can be specified. + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_IMAGE_24BIT. Bitmap The bitmap + specifies a series of pixels, 24 bits per + pixel, left-to-right, top-to-bottom. The + number of bytes per bitmap can be calculated + as: (Width * 3) * Height. + + @param Type See EFI_HII_RGB_PIXEL definition. + +**/ +typedef struct { + EFI_HII_IMAGE_BLOCK Header; + EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap; +} EFI_HII_IIBT_IMAGE_24BIT_BLOCK; + +typedef EFI_HII_IIBT_IMAGE_24BIT_BLOCK EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK; + + + +// +// EFI_HII_IIBT_IMAGE_4BIT_BASE +// +typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BASE { + UINT16 Width; + UINT16 Height; + // UINT8 Data[...]; +} EFI_HII_IIBT_IMAGE_4BIT_BASE; + +/** + + This record assigns the 4-bit-per-pixel bitmap data to the + ImageIdCurrent identifier using the specified palette and + increment ImageIdCurrent by one. The image????s upper left hand + corner pixel is the most significant nibble of the first bitmap + byte. + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_IMAGE_4BIT. + + @param PaletteIndex Index of the palette in the palette + information. + + @param Bitmap The bitmap specifies a series of pixels, four + bits per pixel, left-to-right, top-to-bottom, + and is padded out to the nearest byte. The + number of bytes per bitmap can be calculated + as: ((Width + 1)/2) Height. + +**/ +typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + UINT8 PaletteIndex; + EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap; +} EFI_HII_IIBT_IMAGE_4BIT_BLOCK; + +typedef EFI_HII_IIBT_IMAGE_4BIT_BLOCK EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK; + + + +// +// EFI_HII_IIBT_IMAGE_8BIT_BASE +// +typedef struct _EFI_HII_IIBT_IMAGE_8BIT_BASE { + UINT16 Width; + UINT16 Height; + // UINT8 Data[...]; +} EFI_HII_IIBT_IMAGE_8BIT_BASE; + +/** + + This record assigns the 8-bit-per-pixel bitmap data to the + ImageIdCurrent identifier using the specified palette and + increment ImageIdCurrent by one. The image????s upper left hand + corner pixel is the first bitmap byte. + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_IMAGE_8BIT. + + @param PaletteIndex Index of the palette in the palette + information. + + @param Bitmap The bitmap specifies a series of pixels, eight + bits per pixel, left-to-right, top-to-bottom. + The number of bytes per bitmap can be + calculated as: Width * Height. + +**/ +typedef struct _EFI_HII_IIBT_IMAGE_8BIT_PALETTE { + EFI_HII_IMAGE_BLOCK Header; + UINT8 PaletteIndex; + EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap; +} EFI_HII_IIBT_IMAGE_8BIT_PALETTE; + +typedef EFI_HII_IIBT_IMAGE_8BIT_PALETTE EFI_HII_IIBT_IMAGE_8BIT_TRANS_BLOCK; + + +/** + + Indicates that the image with image ID ImageValueCurrent has the + same image as a previously defined image ID and increments + ImageValueCurrent by one + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_DUPLICATE. + + @param ImageId The previously defined image ID with the exact + same image. + + +**/ +typedef struct _EFI_HII_IIBT_DUPLICATE_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + EFI_IMAGE_ID ImageId; +} EFI_HII_IIBT_DUPLICATE_BLOCK; + + +/** + + This record assigns the JPEG image data to the ImageIdCurrent + identifier and increment ImageIdCurrent by one. The JPEG decoder + is only required to cover the basic JPEG encoding types, which + are produced by standard available paint packages (for example: + MSPaint under Windows from Microsoft). This would include JPEG + encoding of high (1:1:1) and medium (4:1:1) quality with only + three components (R,G,B) ??C no support for the special gray + component encoding. + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_IMAGE_JPEG. + + @param Size Specifies the size of the JPEG encoded data. + + @param Data JPEG encoded data with ????JFIF???? signature at + offset 6 in the data block. The JPEG encoded + data, specifies type of encoding and final size + of true-color image. + +**/ +typedef struct _EFI_HII_IIBT_JPEG { + EFI_HII_IMAGE_BLOCK Header; + UINT32 Size; + //UINT8 Data[ ¡­ ]; +} EFI_HII_IIBT_JPEG; + + +/** + + Increments the current image ID ImageIdCurrent by the number + specified. + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_SKIP1. + + @param SkipCount The unsigned 8-bit value to add to + ImageIdCurrent. + +**/ +typedef struct _EFI_HII_IIBT_SKIP1_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + UINT8 SkipCount; +} EFI_HII_IIBT_SKIP1_BLOCK; + +/** + + Increments the current image ID ImageIdCurrent by the number + specified. + + @param Header Standard image header, where Header.BlockType + = EFI_HII_IIBT_SKIP2. + + @param SkipCount The unsigned 16-bit value to add to + ImageIdCurrent. + +**/ +typedef struct _EFI_HII_IIBT_SKIP2_BLOCK { + EFI_HII_IMAGE_BLOCK Header; + UINT16 SkipCount; +} EFI_HII_IIBT_SKIP2_BLOCK; + + +/** + + This fixed header is followed by zero or more variable-length + palette information records. The structures are assigned a + number 1 to n. + + @param PaletteCount Number of palettes. + +**/ +typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER { + UINT16 PaletteCount; +} EFI_HII_IMAGE_PALETTE_INFO_HEADER; + +/** + + Each palette information record is an array of 24-bit color + structures. The first entry (PaletteValue[0]) corresponds to + color 0 in the source image; the second entry (PaletteValue[1]) + corresponds to color 1, etc. Each palette entry is a three byte + entry, with the first byte equal to the blue component of the + color, followed by green, and finally red (B,G,R). Each color + component value can vary from 0x00 (color off) to 0xFF (color + full on), allowing 16.8 millions colors that can be specified. + + @param PaletteSize Size of the palette information. + + @param PaletteValue Array of color values. + +**/ +typedef struct _EFI_HII_IMAGE_PALETTE_INFO { + UINT16 PaletteSize; + // EFI_HII_RGB_PIXEL PaletteValue[...]; +} EFI_HII_IMAGE_PALETTE_INFO; + + + +// +// EFI_HII_DATABASE_NOTIFY_TYPE +// +typedef UINTN EFI_HII_DATABASE_NOTIFY_TYPE; +#define EFI_HII_DATABASE_NOTIFY_NEW_PACK 0x00000001 +#define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002 +#define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004 +#define EFI_HII_DATABASE_NOTIFY_ADD_PACK 0x00000008 +/** + + Functions which are registered to receive notification of + database events have this prototype. The actual event is encoded + in NotifyType. The following table describes how PackageType, + PackageGuid, Handle, and Package are used for each of the + notification types. + + @param PackageType Package type of the notification. + + @param PackageGuid If PackageType is + EFI_HII_PACKAGE_TYPE_GUID, then this is + the pointer to the GUID from the Guid + field of EFI_HII_PACKAGE_GUID_HEADER. + Otherwise, it must be NULL. + + @param Package Points to the package referred to by the + notification Handle The handle of the package + list which contains the specified package. + + @param NotifyType The type of change concerning the + database. See + EFI_HII_DATABASE_NOTIFY_TYPE. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_DATABASE_NOTIFY) ( + IN CONST UINT8 PackageType, + IN CONST EFI_GUID *PackageGuid, + IN CONST EFI_HII_PACKAGE_HEADER *Package, + IN CONST EFI_HII_HANDLE Handle, + IN CONST EFI_HII_DATABASE_NOTIFY_TYPE NotifyType +); + +/** + + This function adds the packages in the package list to the + database and returns a handle. If there is a + EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then + this function will create a package of type + EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For + each package in the package list, registered functions with the + notification type NEW_PACK and having the same package type will + be called. For each call to NewPackageList(), there should be a + corresponding call to + EFI_HII_DATABASE_PROTOCOL.RemovePackageList(). + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param PackageList A pointer to an + EFI_HII_PACKAGE_LIST_HEADER structure. + + @param DriverHandle Associate the package list with this EFI + handle Handle A pointer to the + EFI_HII_HANDLE instance. + + @retval EFI_SUCCESS The package list associated with the + Handle was added to the HII database. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary + resources for the new database + contents. + + @retval EFI_INVALID_PARAMETER PackageList is NULL or Handle + is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_NEW_PACK) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList, + IN CONST EFI_HANDLE DriverHandle, + OUT EFI_HII_HANDLE *Handle +); + + +/** + + This function removes the package list that is associated with a + handle Handle from the HII database. Before removing the + package, any registered functions with the notification type + REMOVE_PACK and the same package type will be called. For each + call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should + be a corresponding call to RemovePackageList. + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param Handle The handle that was registered to the data + that is requested for removal. + + @retval EFI_SUCCESS The data associated with the Handle was + removed from the HII database. + + @retval EFI_INVALID_PARAMETER The Handle was not valid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_REMOVE_PACK) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE Handle +); + + +/** + + This function updates the existing package list (which has the + specified Handle) in the HII databases, using the new package + list specified by PackageList. The update process has the + following steps: Collect all the package types in the package + list specified by PackageList. A package type consists of the + Type field of EFI_HII_PACKAGE_HEADER and, if the Type is + EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in + EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within + the existing package list in the HII database specified by + Handle. If a package??s type matches one of the types collected + in step 1, then perform the following steps: + - Call any functions registered with the notification type + REMOVE_PACK. + - Remove the package from the package list and the HII + database. + Add all of the packages within the new package list specified + by PackageList, using the following steps: + - Add the package to the package list and the HII database. + - Call any functions registered with the notification type + ADD_PACK. + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param Handle The handle that was registered to the data + that is requested for removal. + + @param PackageList A pointer to an EFI_HII_PACKAGE_LIST + package. + + @retval EFI_SUCCESS The HII database was successfully + updated. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory + for the updated database. + + @retval EFI_INVALID_PARAMETER The Handle was not valid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_UPDATE_PACK) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE Handle, + IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList +); + + +/** + + This function returns a list of the package handles of the + specified type that are currently active in the database. The + pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package + handles to be listed. + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param PackageType Specifies the package type of the packages + to list or EFI_HII_PACKAGE_TYPE_ALL for + all packages to be listed. + + @param PackageGuid If PackageType is + EFI_HII_PACKAGE_TYPE_GUID, then this is + the pointer to the GUID which must match + the Guid field of + EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it + must be NULL. + + @param HandleBufferLength On input, a pointer to the length + of the handle buffer. On output, + the length of the handle buffer + that is required for the handles + found. + + @param Handle An array of EFI_HII_HANDLE instances returned. + + + @retval EFI_SUCCESS Handle was updated successfully. + + @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter + indicates that Handle is too + small to support the number of + handles. HandleBufferLength is + updated with a value that will + enable the data to fit. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_LIST_PACKS) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST UINT8 PackageType, + IN CONST EFI_GUID *PackageGuid, + IN OUT UINTN *HandleBufferLength, + OUT EFI_HII_HANDLE *Handle +); + + + + + + +/** + + This function will export one or all package lists in the + database to a buffer. For each package list exported, this + function will call functions registered with EXPORT_PACK and + then copy the package list to the buffer. The registered + functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList() + to modify the package list before it is copied to the buffer. If + the specified BufferSize is too small, then the status + EFI_OUT_OF_RESOURCES will be returned and the actual package + size will be returned in BufferSize. + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param Handle An EFI_HII_HANDLE that corresponds to the + desired package list in the HII database to + export or NULL to indicate all package lists + should be exported. + + @param BufferSize On input, a pointer to the length of the + buffer. On output, the length of the + buffer that is required for the exported + data. + + @param Buffer A pointer to a buffer that will contain the + results of the export function. + + + @retval EFI_SUCCESS Package exported. + + @retval EFI_OUT_OF_RESOURCES BufferSize is too small to hold + the package. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_EXPORT_PACKS) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE Handle, + IN OUT UINTN *BufferSize, + OUT EFI_HII_PACKAGE_HEADER *Buffer +); + + +/** + + + This function registers a function which will be called when + specified actions related to packages of the specified type + occur in the HII database. By registering a function, other + HII-related drivers are notified when specific package types + are added, removed or updated in the HII database. Each driver + or application which registers a notification should use + EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before + exiting. + + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param PackageType The package type. See + EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER. + + @param PackageGuid If PackageType is + EFI_HII_PACKAGE_TYPE_GUID, then this is + the pointer to the GUID which must match + the Guid field of + EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it + must be NULL. + + @param PackageNotifyFn Points to the function to be called + when the event specified by + NotificationType occurs. See + EFI_HII_DATABASE_NOTIFY. + + @param NotifyType Describes the types of notification which + this function will be receiving. See + EFI_HII_DATABASE_NOTIFY_TYPE for more a + list of types. + + @param NotifyHandle Points to the unique handle assigned to + the registered notification. Can be used + in + EFI_HII_DATABASE_PROTOCOL.UnregisterPack + to stop notifications. + + + @retval EFI_SUCCESS Notification registered successfully. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary + data structures. + + @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when + PackageType is not + EFI_HII_PACKAGE_TYPE_GUID. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_REGISTER_NOTIFY) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST UINT8 PackageType, + IN CONST EFI_GUID *PackageGuid, + IN CONST EFI_HII_DATABASE_NOTIFY PackageNotifyFn, + IN CONST EFI_HII_DATABASE_NOTIFY_TYPE NotifyType, + OUT EFI_HANDLE *NotifyHandle +); + + +/** + + Removes the specified HII database package-related notification. + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param NotificationHandle The handle of the notification + function being unregistered. + + @retval EFI_SUCCESS Unregister the notification + Successsfully + + @retval EFI_INVALID_PARAMETER The Handle is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_UNREGISTER_NOTIFY) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HANDLE NotificationHandle +); + + +/** + + @param Header The general pack header which defines both the + type of pack and the length of the entire + pack. + + @param LayoutCount The number of keyboard layouts contained + in the entire keyboard pack. + + @param Layout An array of LayoutCount number of keyboard + layouts. + +**/ +typedef struct { + EFI_HII_PACKAGE_HEADER Header; + UINT16 LayoutCount; + // EFI_HII_KEYBOARD_LAYOUT Layout[...]; +} EFI_HII_KEYBOARD_PACK; + +/** + + @param LayoutLength The length of the current keyboard + layout. + + @param Guid The unique ID associated with this keyboard + layout. + + @param LayoutDescriptorString An offset location (0 is the + beginning of the + EFI_KEYBOARD_LAYOUT instance) + of the string which describes + this keyboard layout. The data + that is being referenced is in + EFI_DESCRIPTION_STRING_BUNDLE + format. + + @param DescriptorCount The number of Descriptor entries in + this layout. + + @param Descriptors An array of key descriptors. + +**/ +typedef struct { + UINT16 LayoutLength; + EFI_GUID Guid; + RELOFST LayoutDescriptorString; + UINT8 DescriptorCount; + // EFI_KEY_DESCRIPTOR Descriptors[...]; +} EFI_HII_KEYBOARD_LAYOUT; + + +/** + + @param Language The language to associate with + DescriptionString. + + @param Space A space (U-0x0020) character to force as a + separator between the Language field and the + formal description string. + + @param DescriptionString A null-terminated description + string. + +**/ +typedef struct { + CHAR16 Language[3]; + CHAR16 Space; + CHAR16 DescriptionString[1]; +} EFI_DESCRIPTION_STRING; + +/** + + @param DescriptionCount The number of description strings. + + @param DescriptionString An array of language-specific + description strings. + +**/ +typedef struct { + UINT16 DescriptionCount; + // EFI_DESCRIPTION_STRING DescriptionString[]; +} EFI_DESCRIPTION_STRING_BUNDLE; + +/** + + See the figure below for which key corresponds to the values in + the enumeration above. For example, EfiKeyLCtrl corresponds to + the left control key in the lower-left corner of the keyboard, + EfiKeyFour corresponds to the 4 key on the numeric keypad, and + EfiKeySLck corresponds to the Scroll Lock key in the upper-right + corner of the keyboard. + +**/ +typedef enum { + EfiKeyLCtrl, EfiKeyA0, EfiKeyLAlt, EfiKeySpaceBar, + EfiKeyA2, EfiKeyA3, EfiKeyA4, EfiKeyRCtrl, EfiKeyLeftArrow, + EfiKeyDownArrow, EfiKeyRightArrow, EfiKeyZero, + EfiKeyPeriod, EfiKeyEnter, EfiKeyLShift, EfiKeyB0, + EfiKeyB1, EfiKeyB2, EfiKeyB3, EfiKeyB4, EfiKeyB5, EfiKeyB6, + EfiKeyB7, EfiKeyB8, EfiKeyB9, EfiKeyB10, EfiKeyRshift, + EfiKeyUpArrow, EfiKeyOne, EfiKeyTwo, EfiKeyThree, + EfiKeyCapsLock, EfiKeyC1, EfiKeyC2, EfiKeyC3, EfiKeyC4, + EfiKeyC5, EfiKeyC6, EfiKeyC7, EfiKeyC8, EfiKeyC9, + EfiKeyC10, EfiKeyC11, EfiKeyC12, EfiKeyFour, EfiKeyFive, + EfiKeySix, EfiKeyPlus, EfiKeyTab, EfiKeyD1, EfiKeyD2, + EfiKeyD3, EfiKeyD4, EfiKeyD5, EfiKeyD6, EfiKeyD7, EfiKeyD8, + EfiKeyD9, EfiKeyD10, EfiKeyD11, EfiKeyD12, EfiKeyD13, + EfiKeyDel, EfiKeyEnd, EfiKeyPgDn, EfiKeySeven, EfiKeyEight, + EfiKeyNine, EfiKeyE0, EfiKeyE1, EfiKeyE2, EfiKeyE3, + EfiKeyE4, EfiKeyE5, EfiKeyE6, EfiKeyE7, EfiKeyE8, EfiKeyE9, + EfiKeyE10, EfiKeyE11, EfiKeyE12, EfiKeyBackSpace, + EfiKeyIns, EfiKeyHome, EfiKeyPgUp, EfiKeyNLck, EfiKeySlash, + EfiKeyAsterisk, EfiKeyMinus, EfiKeyEsc, EfiKeyF1, EfiKeyF2, + EfiKeyF3, EfiKeyF4, EfiKeyF5, EfiKeyF6, EfiKeyF7, EfiKeyF8, + EfiKeyF9, EfiKeyF10, EfiKeyF11, EfiKeyF12, EfiKeyPrint, + EfiKeySLck, EfiKeyPause +} EFI_KEY; + +/** + + @param Key Used to describe a physical key on a keyboard. + + @param Unicode Unicode value for the Key. + + @param ShiftedUnicode Unicode value for the key with the + shift key being held down. + + @param AltGrUnicode Unicode value for the key with the + Alt-GR being held down. + + @param ShiftedAltGrUnicode Unicode value for the key with the + Alt-GR and shift keys being held down. + + @param Modifier Modifier keys are defined to allow for + special functionality that is not + necessarily accomplished by a printable + character. Many of these modifier keys are + flags to toggle certain state bits on and + off inside of a keyboard driver. + +**/ +typedef struct { + EFI_KEY Key; + CHAR16 Unicode; + CHAR16 ShiftedUnicode; + CHAR16 AltGrUnicode; + CHAR16 ShiftedAltGrUnicode; + UINT16 Modifier; +} EFI_KEY_DESCRIPTOR; + + +// +// Modifier values +// +#define EFI_NULL_MODIFIER 0x0000 +#define EFI_LEFT_CONTROL_MODIFIER 0x0001 +#define EFI_RIGHT_CONTROL_MODIFIER 0x0002 +#define EFI_LEFT_ALT_MODIFIER 0x0003 +#define EFI_RIGHT_ALT_MODIFIER 0x0004 +#define EFI_ALT_GR_MODIFIER 0x0005 +#define EFI_INSERT_MODIFIER 0x0006 +#define EFI_DELETE_MODIFIER 0x0007 +#define EFI_PAGE_DOWN_MODIFIER 0x0008 +#define EFI_PAGE_UP_MODIFIER 0x0009 +#define EFI_HOME_MODIFIER 0x000A +#define EFI_END_MODIFIER 0x000B +#define EFI_LEFT_SHIFT_MODIFIER 0x000C +#define EFI_RIGHT_SHIFT_MODIFIER 0x000D +#define EFI_CAPS_LOCK_MODIFIER 0x000E +#define EFI_NUM_LOCK _MODIFIER 0x000F +#define EFI_LEFT_ARROW_MODIFIER 0x0010 +#define EFI_RIGHT_ARROW_MODIFIER 0x0011 +#define EFI_DOWN_ARROW_MODIFIER 0x0012 +#define EFI_UP_ARROW_MODIFIER 0X0013 +#define EFI_NS_KEY_MODIFIER 0x0014 +#define EFI_NS_KEY_DEPENDENCY_MODIFIER 0x0015 +#define EFI_FUNCTION_KEY_ONE_MODIFIER 0x0016 +#define EFI_FUNCTION_KEY_TWO_MODIFIER 0x0017 +#define EFI_FUNCTION_KEY_THREE_MODIFIER 0x0018 +#define EFI_FUNCTION_KEY_FOUR_MODIFIER 0x0019 +#define EFI_FUNCTION_KEY_FIVE_MODIFIER 0x001A +#define EFI_FUNCTION_KEY_SIX_MODIFIER 0x001B +#define EFI_FUNCTION_KEY_SEVEN_MODIFIER 0x001C +#define EFI_FUNCTION_KEY_EIGHT_MODIFIER 0x001D +#define EFI_FUNCTION_KEY_NINE_MODIFIER 0x001E +#define EFI_FUNCTION_KEY_TEN_MODIFIER 0x001F +#define EFI_FUNCTION_KEY_ELEVEN_MODIFIER 0x0020 +#define EFI_FUNCTION_KEY_TWELVE_MODIFIER 0x0021 +// +// Keys that have multiple control functions based on modifier +// settings are handled in the keyboard driver implementation. +// For instance PRINT_KEY might have a modifier held down and +// is still a nonprinting character, but might have an alternate +// control function like SYSREQUEST +// +#define EFI_PRINT_MODIFIER 0x0022 +#define EFI_SYS_REQUEST_MODIFIER 0x0023 +#define EFI_SCROLL_LOCK_MODIFIER 0x0024 +#define EFI_PAUSE_MODIFIER 0x0025 +#define EFI_BREAK_MODIFIER 0x0026 + + + +/** + + This routine retrieves an array of GUID values for each keyboard + layout that was previously registered in the system. + + @param This A pointer to the EFI_HII_PROTOCOL instance. + + @param KeyGuidBufferLength On input, a pointer to the length + of the keyboard GUID buffer. On + output, the length of the handle + buffer that is required for the + handles found. KeyGuidBuffer An + array of keyboard layout GUID + instances returned. + + @retval EFI_SUCCESS KeyGuidBuffer was updated successfully. + + @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength + parameter indicates that + KeyGuidBuffer is too small to + support the number of GUIDs. + KeyGuidBufferLength is updated + with a value that will enable + the data to fit. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN OUT UINT16 *KeyGuidBufferLength, + OUT EFI_GUID *KeyGuidBuffer +); + + +/** + + This routine retrieves the requested keyboard layout. The layout + is a physical description of the keys on a keyboard and the + character(s) that are associated with a particular set of key + strokes. + + @param This A pointer to the EFI_HII_PROTOCOL instance. + + @param KeyGuid A pointer to the unique ID associated with a + given keyboard layout. If KeyGuid is NULL then + the current layout will be retrieved. + + @param KeyboardLayout A pointer to a buffer containing the + retrieved keyboard layout. below. + + @retval EFI_SUCCESS The keyboard layout was retrieved + successfully. + + @retval EFI_NOT_FOUND The requested keyboard layout was not + found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_GUID *KeyGuid, + OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout +); + +/** + + This routine sets the default keyboard layout to the one + referenced by KeyGuid. When this routine is called, an event + will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID + group type. This is so that agents which are sensitive to the + current keyboard layout being changed can be notified of this + change. + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param KeyGuid A pointer to the unique ID associated with a + given keyboard layout. + + + @retval EFI_SUCCESS The current keyboard layout was + successfully set. + + @retval EFI_NOT_FOUND The referenced keyboard layout was not + found, so action was taken. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_GUID *KeyGuid +); + +/** + + Return the EFI handle associated with a package list. + + @param This A pointer to the EFI_HII_DATABASE_PROTOCOL + instance. + + @param PackageListHandle An EFI_HII_HANDLE that corresponds + to the desired package list in the + HIIdatabase. + + @param DriverHandle On return, contains the EFI_HANDLE which + was registered with the package list in + NewPackageList(). + + @retval EFI_SUCCESS The DriverHandle was returned + successfully. + + @retval EFI_INVALID_PARAMETER The PackageListHandle was not + valid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_GET_PACK_HANDLE) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageListHandle, + OUT EFI_HANDLE *DriverHandle +); + +/** + + @param NewPackageList Add a new package list to the HII + database. + + @param RemovePackageList Remove a package list from the HII + database. + + @param UpdatePackageList Update a package list in the HII + database. + + @param ListPackageLists List the handles of the package + lists within the HII database. + + @param ExportPackageLists Export package lists from the HII + database. + + @param RegisterPackageNotify Register notification when + packages of a certain type are + installed. + + @param UnregisterPackageNotify Unregister notification of + packages. + + @param FindKeyboardLayouts Retrieves a list of the keyboard + layouts in the system. + + @param GetKeyboardLayout Allows a program to extract the + current keyboard layout. See the + GetKeyboardLayout() function + description. + + @param SetKeyboardLayout Changes the current keyboard layout. + See the SetKeyboardLayout() function + + +**/ +struct _EFI_HII_DATABASE_PROTOCOL { + EFI_HII_NEW_PACK NewPackageList; + EFI_HII_REMOVE_PACK RemovePackageList; + EFI_HII_UPDATE_PACK UpdatePackageList; + EFI_HII_LIST_PACKS ListPackageLists; + EFI_HII_EXPORT_PACKS ExportPackageLists; + EFI_HII_REGISTER_NOTIFY RegisterPackageNotify; + EFI_HII_UNREGISTER_NOTIFY UnregisterPackageNotify; + EFI_HII_FIND_KEYBOARD_LAYOUTS FindKeyboardLayouts; + EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout; + EFI_HII_SET_KEYBOARD_LAYOUT SetKeyboardLayout; + EFI_HII_GET_PACK_HANDLE GetPackageHandle; +}; + +extern EFI_GUID gEfiHiiDatabaseProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/HiiFont.h b/MdePkg/Include/Protocol/HiiFont.h new file mode 100644 index 0000000000..d581d5312d --- /dev/null +++ b/MdePkg/Include/Protocol/HiiFont.h @@ -0,0 +1,527 @@ +/** @file + The file provides services to retrieve font information. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: HiiFont.h + +**/ + +#ifndef __HII_FONT_H__ +#define __HII_FONT_H__ + +#include + +#define EFI_HII_FONT_PROTOCOL_GUID \ +{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } } + +typedef struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL; + + +// +// EFI_HII_OUT_FLAGS +// +typedef UINT32 EFI_HII_OUT_FLAGS; +#define EFI_HII_OUT_FLAG_CLIP 0x00000001 +#define EFI_HII_OUT_FLAG_WRAP 0x00000002 +#define EFI_HII_OUT_FLAG_CLEAN_Y 0x00000004 +#define EFI_HII_OUT_FLAG_CLEAN_X 0x00000008 +#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010 +#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020 +#define EFI_HII_IGNORE_LINE_BREAK 0x00000040 +#define EFI_HII_DIRECT_TO_SCREEN 0x00000080 + +/** + + Definition of EFI_HII_ROW_INFO. + + @param StartIndex The index of the first character in the + string which is displayed on the line. + + @param EndIndex The index of the last character in the string + which is displayed on the line. If this is the + same as StartIndex, then no characters are + displayed. + + @param LineHeight The height of the line, in pixels. + + @param LineWidth The width of the text on the line, in + pixels. + + @param BaselineOffset The number of pixels above the bottom of + the row of the font baseline or 0 if + none. + +**/ +typedef struct _EFI_HII_ROW_INFO { + UINTN StartIndex; + UINTN EndIndex; + UINTN LineHeight; + UINTN LineWidth; + UINTN BaselineOffset; +} EFI_HII_ROW_INFO; + +// +// EFI_FONT_INFO_MASK +// +typedef UINT32 EFI_FONT_INFO_MASK; +#define EFI_FONT_INFO_SYS_FONT 0x00000001 +#define EFI_FONT_INFO_SYS_SIZE 0x00000002 +#define EFI_FONT_INFO_SYS_STYLE 0x00000004 +#define EFI_FONT_INFO_SYS_FORE_COLOR 0x00000010 +#define EFI_FONT_INFO_SYS_BACK_COLOR 0x00000020 +#define EFI_FONT_INFO_RESIZE 0x00001000 +#define EFI_FONT_INFO_RESTYLE 0x00002000 +#define EFI_FONT_INFO_ANY_FONT 0x00010000 +#define EFI_FONT_INFO_ANY_SIZE 0x00020000 +#define EFI_FONT_INFO_ANY_STYLE 0x00040000 + +// +// EFI_FONT_INFO +// +typedef struct { + UINT32 FontStyle; + UINT16 FontSize; + CHAR16 FontName[1]; +} EFI_FONT_INFO; + +/** + This structure is used for describing the way in which a string + should be rendered in a particular font. FontInfo specifies the + basic font information and ForegroundColor and BackgroundColor + specify the color in which they should be displayed. The flags + in FontInfoMask describe where the system default should be + supplied instead of the specified information. The flags also + describe what options can be used to make a match between the + font requested and the font available. If EFI_FONT_INFO_SYS_FONT + is specified, then the font name in FontInfo is ignored and the + system font name is used. This flag cannot be used with + EFI_FONT_INFO_ANY_FONT. If EFI_FONT_INFO_SYS_SIZE is specified, + then the font height specified in FontInfo is ignored and the + system font height is used instead. This flag cannot be used + with EFI_FONT_INFO_ANY_SIZE. If EFI_FONT_INFO_SYS_STYLE is + specified, then the font style in FontInfo is ignored and the + system font style is used. This flag cannot be used with + EFI_FONT_INFO_ANY_STYLE. If EFI_FONT_INFO_SYS_FORE_COLOR is + specified, then ForegroundColor is ignored and the system + foreground color is used. If EFI_FONT_INFO_SYS_BACK_COLOR is + specified, then BackgroundColor is ignored and the system + background color is used. If EFI_FONT_INFO_RESIZE is specified, + then the system may attempt to stretch or shrink a font to meet + the size requested. This flag cannot be used with + EFI_FONT_INFO_ANY_SIZE. If EFI_FONT_INFO_RESTYLE is specified, + then the system may attempt to remove some of the specified + styles in order to meet the style requested. This flag cannot be + used with EFI_FONT_INFO_ANY_STYLE. If EFI_FONT_INFO_ANY_FONT is + specified, then the system may attempt to match with any font. + This flag cannot be used with EFI_FONT_INFO_SYS_FONT. If + EFI_FONT_INFO_ANY_SIZE is specified, then the system may attempt + to match with any font size. This flag cannot be used with + EFI_FONT_INFO_SYS_SIZE or EFI_FONT_INFO_RESIZE. If + EFI_FONT_INFO_ANY_STYLE is specified, then the system may + attempt to match with any font style. This flag cannot be used + with EFI_FONT_INFO_SYS_STYLE or EFI_FONT_INFO_RESTYLE. + + @param FontInfo Points to the font information or NULL if the + string should use the default system font. + + @param ForegroundColor The color of the "on" pixels in the + glyph in the bitmap. + + @param BackgroundColor The color of the "off" pixels in the + glyph in the bitmap. + + @param FontInfoMask The font information mask determines + which portion of the font information + will be used and what to do if the + specific font is not available. + +**/ +typedef struct _EFI_FONT_DISPLAY_INFO { + EFI_FONT_INFO FontInfo; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor; + EFI_FONT_INFO_MASK FontInfoMask; +} EFI_FONT_DISPLAY_INFO; + +/** + + This function renders a string to a bitmap or the screen using + the specified font, color and options. It either draws the + string and glyphs on an existing bitmap, allocates a new bitmap + or uses the screen. The strings can be clipped or wrapped. + Optionally, the function also returns the information about each + row and the character position on that row. If + EFI_HII_OUT_FLAG_CLIP is set, then text will be formatted only + based on explicit line breaks and all pixels which would lie + outside the bounding box specified by Width and Height are + ignored. The information in the RowInfoArray only describes + characters which are at least partially displayed. For the final + row, the LineHeight and BaseLine may describe pixels which are + outside the limit specified by Height (unless + EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is specified) even though those + pixels were not drawn. The LineWidth may describe pixels which + are outside the limit specified by Width (unless + EFI_HII_OUT_FLAG_CLIP_CLEAN_X is specified) even though those + pixels were not drawn. If EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set, + then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP so that + if a character????s right-most on pixel cannot fit, then it will + not be drawn at all. This flag requires that + EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_CLIP_CLEAN_Y + is set, then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP + so that if a row????s bottom-most pixel cannot fit, then it will + not be drawn at all. This flag requires that + EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_WRAP is set, + then text will be wrapped at the right-most line-break + opportunity prior to a character whose right-most extent would + exceed Width. If no line-break opportunity can be found, then + the text will behave as if EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set. + This flag cannot be used with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If + EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is + ignored and all ????off???? pixels in the character????s drawn + will use the pixel value from Blt. This flag cannot be used if + Blt is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set, + then characters which have no glyphs are not drawn. Otherwise, + they are replaced with Unicode character 0xFFFD (REPLACEMENT + CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit + line break characters will be ignored. If + EFI_HII_DIRECT_TO_SCREEN is set, then the string will be written + directly to the output device specified by Screen. Otherwise the + string will be rendered to the bitmap specified by Bitmap. + + @param This A pointer to the EFI_HII_FONT_PROTOCOL instance. + + @param Flags Describes how the string is to be drawn. + + @param String Points to the null-terminated string to be + displayed. + + @param StringInfo Points to the string output information, + including the color and font. If NULL, then + the string will be output in the default + system font and color. + + @param Blt If this points to a non-NULL on entry, this points + to the image, which is Width pixels wide and + Height pixels high. The string will be drawn onto + this image and EFI_HII_OUT_FLAG_CLIP is implied. + If this points to a NULL on entry, then a buffer + will be allocated to hold the generated image and + the pointer updated on exit. It is the caller's + responsibility to free this buffer. + + @param BltX, BltY Specifies the offset from the left and top + edge of the image of the first character + cell in the image. + + @param RowInfoArray If this is non-NULL on entry, then on + exit, this will point to an allocated buffer + containing row information and + RowInfoArraySize will be updated to contain + the number of elements. This array describes + the characters which were at least partially + drawn and the heights of the rows. It is the + caller's responsibility to free this buffer. + + @param RowInfoArraySize If this is non-NULL on entry, then on + exit it contains the number of + elements in RowInfoArray. + + @param ColumnInfoArray If this is non-NULL, then on return it + will be filled with the horizontal + offset for each character in the + string on the row where it is + displayed. Non-printing characters + will have the offset ~0. The caller is + responsible to allocate a buffer large + enough so that there is one entry for + each character in the string, not + including the null-terminator. It is + possible when character display is + normalized that some character cells + overlap. + + @retval EFI_SUCCESS The string was successfully updated. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate an output + buffer for RowInfoArray or Blt. + + @retval EFI_INVALID_PARAMETER The String or Blt or Height or + Width was NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_STRING_TO_IMAGE) ( + IN CONST EFI_HII_FONT_PROTOCOL *This, + IN CONST EFI_HII_OUT_FLAGS Flags, + IN CONST EFI_STRING String, + IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, + IN OUT EFI_IMAGE_OUTPUT **Blt, + IN CONST UINTN BltX, + IN CONST UINTN BltY, + OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL, + OUT UINTN *RowInfoArraySize OPTIONAL, + OUT UINTN *ColumnInfoArray OPTIONAL +); + + + +/** + + This function renders a string as a bitmap or to the screen + and can clip or wrap the string. The bitmap is either supplied + by the caller or else is allocated by the function. The + strings are drawn with the font, size and style specified and + can be drawn transparently or opaquely. The function can also + return information about each row and each character's + position on the row. If EFI_HII_OUT_FLAG_CLIP is set, then + text will be formatted only based on explicit line breaks and + all pixels which would lie outside the bounding box specified + by Width and Height are ignored. The information in the + RowInfoArray only describes characters which are at least + partially displayed. For the final row, the LineHeight and + BaseLine may describe pixels which are outside the limit + specified by Height (unless EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is + specified) even though those pixels were not drawn. If + EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set, then it modifies the + behavior of EFI_HII_OUT_FLAG_CLIP so that if a character????s + right-most on pixel cannot fit, then it will not be drawn at + all. This flag requires that EFI_HII_OUT_FLAG_CLIP be set. If + EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is set, then it modifies the + behavior of EFI_HII_OUT_FLAG_CLIP so that if a row????s bottom + most pixel cannot fit, then it will not be drawn at all. This + flag requires that EFI_HII_OUT_FLAG_CLIP be set. Draft for + Review HII Protocols Version 2.1 November 3, 2006 1285 If + EFI_HII_OUT_FLAG_WRAP is set, then text will be wrapped at the + right-most line-break opportunity prior to a character whose + right-most extent would exceed Width. If no line-break + opportunity can be found, then the text will behave as if + EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set. This flag cannot be used + with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If + EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is + ignored and all off¡± pixels in the character¡¯s glyph will + use the pixel value from Blt. This flag cannot be used if Blt + is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set, then + characters which have no glyphs are not drawn. Otherwise, they + are replaced with Unicode character 0xFFFD (REPLACEMENT + CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit + line break characters will be ignored. If + EFI_HII_DIRECT_TO_SCREEN is set, then the string will be + written directly to the output device specified by Screen. + Otherwise the string will be rendered to the bitmap specified + by Bitmap. + + + @param This A pointer to the EFI_HII_FONT_PROTOCOL instance. + + @param Flags Describes how the string is to be drawn. + + @param PackageList The package list in the HII database to + search for the specified string. + + @param StringId The string's id, which is unique within + PackageList. + + @param Language Points to the language for the retrieved + string. If NULL, then the current system + language is used. + + @param StringInfo Points to the string output information, + including the color and font. If NULL, then + the string will be output in the default + system font and color. + + @param Blt If this points to a non-NULL on entry, this points + to the image, which is Width pixels wide and + Height pixels high. The string will be drawn onto + this image and EFI_HII_OUT_FLAG_CLIP is implied. + If this points to a NULL on entry, then a buffer + will be allocated to hold the generated image and + the pointer updated on exit. It is the caller's + responsibility to free this buffer. + + @param BltX, BltY Specifies the offset from the left and top + edge of the output image of the first + character cell in the image. + + @param RowInfoArray If this is non-NULL on entry, then on + exit, this will point to an allocated + buffer containing row information and + RowInfoArraySize will be updated to + contain the number of elements. This array + describes the characters which were at + least partially drawn and the heights of + the rows. It is the caller's + responsibility to free this buffer. + + @param RowInfoArraySize If this is non-NULL on entry, then on + exit it contains the number of + elements in RowInfoArray. + + @param ColumnInfoArray If non-NULL, on return it is filled + with the horizontal offset for each + character in the string on the row + where it is displayed. Non-printing + characters will have the offset ~0. + The caller is responsible to allocate + a buffer large enough so that there is + one entry for each character in the + string, not including the + null-terminator. It is possible when + character display is normalized that + some character cells overlap. + + + @retval EFI_SUCCESS The string was successfully updated. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate an output + buffer for RowInfoArray or Blt. + + @retval EFI_INVALID_PARAMETER The String or Blt or Height or + Width was NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_STRING_ID_TO_IMAGE) ( + IN CONST EFI_HII_FONT_PROTOCOL *This, + IN CONST EFI_HII_OUT_FLAGS Flags, + IN CONST EFI_HII_HANDLE PackageList, + IN CONST EFI_STRING_ID StringId, + IN CONST CHAR8 *Language, + IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL, + IN OUT EFI_IMAGE_OUTPUT **Blt, + IN CONST UINTN BltX, + IN CONST UINTN BltY, + OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL, + OUT UINTN *RowInfoArraySize OPTIONAL, + OUT UINTN *ColumnInfoArray OPTIONAL +); + + +/** + + Convert the glyph for a single character into a bitmap. + + @param This A pointer to the EFI_HII_FONT_PROTOCOL instance. + + @param Char Character to retrieve. + + @param StringInfo Points to the string font and color + information or NULL if the string should use + the default system font and color. + + @param Blt Thus must point to a NULL on entry. A buffer will + be allocated to hold the output and the pointer + updated on exit. It is the caller's responsibility + to free this buffer. + + @param Baseline Number of pixels from the bottom of the bitmap + to the baseline. + + + @retval EFI_SUCCESS Glyph bitmap created. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate the output + buffer Blt. + + @retval EFI_WARN_UNKNOWN_GLYPH The glyph was unknown and was + replaced with the glyph for + Unicode character 0xFFFD. + + @retval EFI_INVALID_PARAMETER Blt is NULL or Width is NULL or + Height is NULL + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_GET_GLYPH) ( + IN CONST EFI_HII_FONT_PROTOCOL *This, + IN CONST CHAR16 Char, + IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, + OUT EFI_IMAGE_OUTPUT **Blt, + OUT UINTN *Baseline OPTIONAL +); + +/** + + This function iterates through fonts which match the specified + font, using the specified criteria. If String is non-NULL, then + all of the characters in the string must exist in order for a + candidate font to be returned. + + @param This A pointer to the EFI_HII_FONT_PROTOCOL instance. + + @param FontHandle On entry, points to the font handle returned + by a previous call to GetFontInfo() or NULL + to start with the first font. On return, + points to the returned font handle or points + to NULL if there are no more matching fonts. + + @param StringInfoIn Upon entry, points to the font to return + information about. + + @param StringInfoOut Upon return, contains the matching + font's information. If NULL, then no + information is returned. + + @param String Points to the string which will be tested to + determine if all characters are available. If + NULL, then any font is acceptable. + + @retval EFI_SUCCESS Matching font returned successfully. + + @retval EFI_NOT_FOUND No matching font was found. + + @retval EFI_INVALID_PARAMETER FontHandle is NULL or + StringInfoIn is NULL + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_GET_FONT_INFO) ( + IN CONST EFI_HII_FONT_PROTOCOL *This, + IN OUT EFI_FONT_HANDLE *FontHandle, + IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, + OUT EFI_FONT_DISPLAY_INFO *StringInfoOut, + IN CONST EFI_STRING *String OPTIONAL +); + +/** + + The protocol provides the service to retrieve the font + informations; + + @param StringToImage Render a string to a bitmap or to the + display. + + @param StringIdToImage Render a string to a bitmap or to the + display. + @param GetGlyph Return a specific glyph in a specific font. + + @param GetFontInfo Return font information for a specific + font. + +**/ +struct _EFI_HII_FONT_PROTOCOL { + EFI_HII_STRING_TO_IMAGE StringToImage; + EFI_HII_STRING_ID_TO_IMAGE StringIdToImage; + EFI_HII_GET_GLYPH GetGlyph; + EFI_HII_GET_FONT_INFO GetFontInfo; +}; + +extern EFI_GUID gEfiHiiFontProtocolGuid; + + +#endif + diff --git a/MdePkg/Include/Protocol/HiiImage.h b/MdePkg/Include/Protocol/HiiImage.h new file mode 100644 index 0000000000..ed511c7ac0 --- /dev/null +++ b/MdePkg/Include/Protocol/HiiImage.h @@ -0,0 +1,382 @@ +/** @file + The file provides services to access to images in the images database. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: HiiImage.h + +**/ + +#ifndef __HII_IMAGE_H__ +#define __HII_IMAGE_H__ + + +#define EFI_HII_IMAGE_PROTOCOL_GUID \ + { 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } } + +typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL; + + +// +// Flags in EFI_IMAGE_INPUT +// +#define EFI_IMAGE_TRANSPARENT 0x00000001 + +/** + + Definition of EFI_IMAGE_INPUT. + + @param Flags Describe image characteristics. If + EFI_IMAGE_TRANSPARENT is set, then the image was + designed for transparent display. + + @param Width Image width, in pixels. + + @param Height Image height, in pixels. + + @param Bitmap The actual bitmap, organized left-to-right, + top-to-bottom. The size of the bitmap is + Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL). + + +**/ +typedef struct _EFI_IMAGE_INPUT { + UINT32 Flags; + UINT16 Width; + UINT16 Height; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap; +} EFI_IMAGE_INPUT; + + +/** + + This function adds the image Image to the group of images + owned by PackageList, and returns a new image identifier + (ImageId). + + @param This A pointer to the EFI_HII_IMAGE_PROTOCOL + instance. PackageList Handle of the package list + where this image will be added. + + @param ImageId On return, contains the new image id, which is + unique within PackageList. + + @param Image Points to the image. + + @retval EFI_SUCCESS The new image was added + successfully + + @retval EFI_OUT_OF_RESOURCES Could not add the image. + + @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is + NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_NEW_IMAGE) ( + IN CONST EFI_HII_IMAGE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageList, + OUT EFI_IMAGE_ID *ImageId, + IN CONST EFI_IMAGE_INPUT *Image +); + +/** + + This function retrieves the image specified by ImageId which + is associated with the specified PackageList and copies it + into the buffer specified by Image. If the image specified by + ImageId is not present in the specified PackageList, then + EFI_NOT_FOUND is returned. If the buffer specified by + ImageSize is too small to hold the image, then + EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be + updated to the size of buffer actually required to hold the + image. + + @param This A pointer to the EFI_HII_IMAGE_PROTOCOL + instance. + + @param PackageList The package list in the HII database to + search for the specified image. + + @param ImageId The image's id, which is unique within + PackageList. + + @param Image Points to the new image. + + @param ImageSize On entry, points to the size of the buffer + pointed to by Image, in bytes. On return, + points to the length of the image, in bytes. + + + @retval EFI_SUCCESS The image was returned successfully. + + @retval EFI_NOT_FOUND The image specified by ImageId is not + available. + + @retval EFI_BUFFER_TOO_SMALL The buffer specified by + ImageLength is too small to hold + the image. + + @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_GET_IMAGE) ( + IN CONST EFI_HII_IMAGE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageList, + IN CONST EFI_IMAGE_ID ImageId, + OUT EFI_IMAGE_INPUT *Image, + OUT UINTN *ImageSize +); + +/** + + This function updates the image specified by ImageId in the + specified PackageListHandle to the image specified by Image. + + + @param This A pointer to the EFI_HII_IMAGE_PROTOCOL + instance. + + @param PackageList The package list containing the images. + + @param ImageId The image id, which is unique within + PackageList. + + @param Image Points to the image. + + @retval EFI_SUCCESS The image was successfully updated. + + @retval EFI_NOT_FOUND The image specified by ImageId is not + in the database. + + @retval EFI_INVALID_PARAMETER The Image or Language was + NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_SET_IMAGE) ( + IN CONST EFI_HII_IMAGE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageList, + IN CONST EFI_IMAGE_ID ImageId, + IN CONST EFI_IMAGE_INPUT Image +); + + +// +// EFI_HII_DRAW_FLAGS +// +typedef UINT32 EFI_HII_DRAW_FLAGS; + +#define EFI_HII_DRAW_FLAG_CLIP 0x00000001 +#define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030 +#define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000 +#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000001 +#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000002 +#define EFI_HII_DIRECT_TO_SCREEN 0x00000080 + + +/** + + Definition of EFI_IMAGE_OUTPUT. + + @param Width Width of the output image. + + @param Height Height of the output image. + + @param Bitmap Points to the output bitmap. + + @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which + describes the screen on which to draw the + specified image. + +**/ +typedef struct _EFI_IMAGE_OUTPUT { + UINT16 Width; + UINT16 Height; + union { + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap; + EFI_GRAPHICS_OUTPUT_PROTOCOL *Screen; + } Image; +} EFI_IMAGE_OUTPUT; + + +/** + + This function renders an image to a bitmap or the screen using + the specified color and options. It draws the image on an + existing bitmap, allocates a new bitmap or uses the screen. The + images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then + all pixels drawn outside the bounding box specified by Width and + Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set, + then all ????off???? pixels in the images drawn will use the + pixel value from Blt. This flag cannot be used if Blt is NULL + upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image + will be written directly to the output device specified by + Screen. Otherwise the image will be rendered to the bitmap + specified by Bitmap. + + + @param This A pointer to the EFI_HII_IMAGE_PROTOCOL + instance. + + @param Flags Describes how the image is to be drawn. + EFI_HII_DRAW_FLAGS is defined in Related + Definitions, below. + + @param Image Points to the image to be displayed. + + @param Blt If this points to a non-NULL on entry, this points + to the image, which is Width pixels wide and + Height pixels high. The image will be drawn onto + this image and EFI_HII_DRAW_FLAG_CLIP is implied. + If this points to a NULL on entry, then a buffer + will be allocated to hold the generated image and + the pointer updated on exit. It is the caller????s + responsibility to free this buffer. + + @param BltX, BltY Specifies the offset from the left and top + edge of the image of the first pixel in + the image. + + @retval EFI_SUCCESS The image was successfully updated. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate an output + buffer for RowInfoArray or Blt. + + @retval EFI_INVALID_PARAMETER The Image or Blt or Height or + Width was NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_DRAW_IMAGE) ( + IN CONST EFI_HII_IMAGE_PROTOCOL *This, + IN CONST EFI_HII_DRAW_FLAGS Flags, + IN CONST EFI_IMAGE_INPUT Image, + IN OUT EFI_IMAGE_OUTPUT **Blt, + IN CONST UINTN BltX, + IN CONST UINTN BltY +); + +/** + + This function renders an image as a bitmap or to the screen and + can clip the image. The bitmap is either supplied by the caller + or else is allocated by the function. The images can be drawn + transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set, + then all pixels drawn outside the bounding box specified by + Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT + is set, then all "off" pixels in the character's glyph will + use the pixel value from Blt. This flag cannot be used if Blt + is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then + the image will be written directly to the output device + specified by Screen. Otherwise the image will be rendered to + the bitmap specified by Bitmap. + This function renders an image to a bitmap or the screen using + the specified color and options. It draws the image on an + existing bitmap, allocates a new bitmap or uses the screen. The + images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then + all pixels drawn outside the bounding box specified by Width and + Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag + determines whether the image will be drawn transparent or + opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image + will be drawn so that all ????off???? pixels in the image will + be drawn using the pixel value from Blt and all other pixels + will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then + the image????s pixels will be copied directly to the + destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image + will be drawn transparently or opaque, depending on the + image????s transparency setting (see EFI_IMAGE_TRANSPARENT). + Images cannot be drawn transparently if Blt is NULL. If + EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written + directly to the output device specified by Screen. Otherwise the + image will be rendered to the bitmap specified by Bitmap. + + @param This A pointer to the EFI_HII_IMAGE_PROTOCOL + instance. + + @param Flags Describes how the image is to be drawn. + + @param PackageList The package list in the HII database to + search for the specified image. + + @param ImageId The image's id, which is unique within + PackageList. + + @param Blt If this points to a non-NULL on entry, this points + to the image, which is Width pixels wide and + Height pixels high. The image will be drawn onto + this image and EFI_HII_DRAW_FLAG_CLIP is implied. + If this points to a NULL on entry, then a buffer + will be allocated to hold the generated image and + the pointer updated on exit. It is the caller's + responsibility to free this buffer. + + @param BltX, BltY Specifies the offset from the left and top + edge of the output image of the first + pixel in the image. + + @retval EFI_SUCCESS The image was successfully updated. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate an output + buffer for RowInfoArray or Blt. + + @retval EFI_INVALID_PARAMETER The Image or Blt or Height or + Width was NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_DRAW_IMAGE_ID) ( +IN CONST EFI_HII_IMAGE_PROTOCOL *This, +IN CONST EFI_HII_DRAW_FLAGS Flags, +IN CONST EFI_HII_HANDLE PackageList, +IN CONST EFI_IMAGE_ID ImageId, +IN OUT EFI_IMAGE_OUTPUT **Blt, +IN CONST UINTN BltX, +IN CONST UINTN BltY +); + + +/** + + services to access to images in the images database. + + @param NewImage Add a new image. + + @param GetImage Retrieve an image and related font + information. + + @param SetImage Change an image. EFI_INVALID_LANGUAGE The + language specified by FirstLanguage is not + present in the specified package list. + EFI_INVALID_PARAMETER FirstLanguage is NULL + or SecondLanguage is NULL. + +**/ +struct _EFI_HII_IMAGE_PROTOCOL { + EFI_HII_NEW_IMAGE NewImage; + EFI_HII_GET_IMAGE GetImage; + EFI_HII_SET_IMAGE SetImage; + EFI_HII_DRAW_IMAGE DrawImage; + EFI_HII_DRAW_IMAGE_ID DrawImageId; +}; + +extern EFI_GUID gEfiHiiImageProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/HiiString.h b/MdePkg/Include/Protocol/HiiString.h new file mode 100644 index 0000000000..06ff124b24 --- /dev/null +++ b/MdePkg/Include/Protocol/HiiString.h @@ -0,0 +1,303 @@ +/** @file + The file provides services to manipulate string data. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: HiiString.h + +**/ + +#ifndef __HII_STRING_H__ +#define __HII_STRING_H__ + +#define EFI_HII_STRING_PROTOCOL_GUID \ + { 0xfd96974, 0x23aa, 0x4cdc, { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } } + + +typedef struct _EFI_HII_STRING_PROTOCOL EFI_HII_STRING_PROTOCOL; + + + +/** + This function adds the string String to the group of strings + owned by PackageList, with the specified font information + StringFontInfo and returns a new string id. + + @param This A pointer to the EFI_HII_STRING_PROTOCOL instance. + + @param PackageList Handle of the package list where this + string will be added. + + @param Language Points to the language for the new string. + + @param String Points to the new null-terminated string. + + @param StringFontInfo Points to the new string's font + information or NULL if the string should + have the default system font, size and + style. StringId On return, contains the + new strings id, which is unique within + PackageList. + + @retval EFI_SUCCESS The new string was added successfully + + @retval EFI_OUT_OF_RESOURCES Could not add the string. + + @retval EFI_INVALID_PARAMETER String is NULL or StringId is + NULL or Language is NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_NEW_STRING) ( + IN CONST EFI_HII_STRING_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageList, + OUT EFI_STRING_ID *StringId + IN CONST CHAR8 *Language, + IN CONST EFI_STRING String, + IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL, +); + + +/** + + This function retrieves the string specified by StringId which + is associated with the specified PackageList in the language + Language and copies it into the buffer specified by String. If + the string specified by StringId is not present in the + specified PackageList, then EFI_NOT_FOUND is returned. If the + string specified by StringId is present, but not in the + specified language then EFI_INVALID_LANGUAGE is returned. If + the buffer specified by StringSize is too small to hold the + string, then EFI_BUFFER_TOO_SMALL will be returned. StringSize + will be updated to the size of buffer actually required to + hold the string. + + @param This A pointer to the EFI_HII_STRING_PROTOCOL instance. + + @param PackageList The package list in the HII database to + search for the specified string. + + @param Language Points to the language for the retrieved + string. + + @param StringId The string's id, which is unique within + PackageList. + + @param String Points to the new null-terminated string. + + @param StringSize On entry, points to the size of the buffer + pointed to by String, in bytes. On return, + points to the length of the string, in + bytes. + + @param StringFontInfo Points to the string's font + information or NULL if the string font + information is not desired. + + @retval EFI_SUCCESS The string was returned successfully. + + @retval EFI_NOT_FOUND The string specified by StringId is not + available. + + @retval EFI_INVALID_LANGUAGE The string specified by StringId + is available but not in the + specified language. + + @retval EFI_BUFFER_TOO_SMALL The buffer specified by + StringLength is too small to + hold the string. + + @retval EFI_INVALID_PARAMETER The String or Language was NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_GET_STRING) ( + IN CONST EFI_HII_STRING_PROTOCOL *This, + IN CONST CHAR8 *Language, + IN CONST EFI_HII_HANDLE PackageList, + IN CONST EFI_STRING_ID StringId, + OUT EFI_STRING String, + IN OUT UINTN StringSize, + OUT EFI_FONT_INFO *StringFontInfo OPTIONAL +); + +/** + This function updates the string specified by StringId in the + specified PackageList to the text specified by String and, + optionally, the font information specified by StringFontInfo. + There is no way to change the font information without changing + the string text. + + @param This A pointer to the EFI_HII_STRING_PROTOCOL instance. + + @param PackageList The package list containing the strings. + + @param Language Points to the language for the updated string. + + @param StringId The string id, which is unique within + PackageList. + + @param String Points to the new null-terminated string. + + @param StringFontInfo Points to the string's font information + or NULL if the string font information + is not changed. + + @retval EFI_SUCCESS The string was successfully updated. + + @retval EFI_NOT_FOUND The string specified by StringId is not + in the database. + + @retval EFI_INVALID_PARAMETER The String or Language was NULL. + + @retval EFI_OUT_OF_RESOURCES The system is out of resources + to accomplish the task. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_SET_STRING) ( + IN CONST EFI_HII_STRING_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageList, + IN CONST EFI_STRING_ID StringId, + IN CONST CHAR8 *Language, + IN CONST EFI_STRING String, + IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL +); + + +/** + + This function returns the list of supported languages. + + @param This A pointer to the EFI_HII_STRING_PROTOCOL instance. + + @param PackageList The package list to examine. + + @param Languages Points to the buffer to hold the returned + string. + + @param LanguageSize On entry, points to the size of the + buffer pointed to by Languages, in + bytes. On return, points to the length + of Languages, in bytes. + + + @retval EFI_SUCCESS The languages were returned successfully. + + @retval EFI_BUFFER_TOO_SMALL The LanguagesSize is too small + to hold the list of supported + languages. LanguageSize is + updated to contain the required + size. + + @retval EFI_INVALID_PARAMETER Languages is NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HII_GET_LANGUAGES) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageList, + IN OUT CHAR8 *Languages, + IN OUT UINTN LanguagesSize +); + + +/** + + Each string package has associated with it a single primary + language and zero or more secondary languages. This routine + returns the secondary languages associated with a package list. + + @param This A pointer to the EFI_HII_STRING_PROTOCOL + instance. + + @param PackageList The package list to examine. + + @param FirstLanguage Points to the primary language. + + @param Languages are specified in the format specified in + Appendix M of the UEFI 2.0 specification. + + @param SecondaryLanguages Points to the buffer to hold the + returned list of secondary languages + for the specified FirstLanguage. If + there are no secondary languages, + the function returns successfully, + but this is set to NULL. + + @param SecondaryLanguageSize On entry, points to the size of + the buffer pointed to by + Languages, in bytes. On return, + points to the length of + Languages in bytes. + + @retval EFI_SUCCESS Secondary languages correctly returned + + @retval EFI_BUFFER_TOO_SMALL The buffer specified by + SecondLanguagesSize is too small + to hold the returned + information. SecondLanguageSize + is updated to hold the size of + the buffer required. + + @retval EFI_INVALID_LANGUAGE The language specified by + FirstLanguage is not present in + the specified package list. + + @retval EFI_INVALID_PARAMETER FirstLanguage is NULL or + SecondLanguage is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_GET_2ND_LANGUAGES) ( + IN CONST EFI_HII_DATABASE_PROTOCOL *This, + IN CONST EFI_HII_HANDLE PackageList, + IN CONST CHAR8 *FirstLanguage; + IN OUT CHAR8 *SecondLanguages, + IN OUT UINTN SecondLanguagesSize +); + + +/** + Services to manipulate the string. + + @param NewString Add a new string. GetString Retrieve a + string and related string information. + + @param SetString Change a string. + + @param GetLanguages List the languages for a particular + package list. + + @param GetSecondaryLanguages List supported secondary + languages for a particular + primary language. + +**/ +struct _EFI_HII_STRING_PROTOCOL { + EFI_HII_NEW_STRING NewString; + EFI_HII_GET_STRING GetString; + EFI_HII_SET_STRING SetString; + EFI_HII_GET_LANGUAGES GetLanguages; + EFI_HII_GET_2ND_LANGUAGES GetSecondaryLanguages; +}; + + +extern EFI_GUID gEfiHiiStringProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/IP4.h b/MdePkg/Include/Protocol/IP4.h new file mode 100644 index 0000000000..e0f61340d5 --- /dev/null +++ b/MdePkg/Include/Protocol/IP4.h @@ -0,0 +1,414 @@ +/** @file + 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: IP4.h + +**/ + +#ifndef __EFI_IP4_PROTOCOL_H__ +#define __EFI_IP4_PROTOCOL_H__ + +#include + +#define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \ + } + +#define EFI_IP4_PROTOCOL_GUID \ + { \ + 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \ + } + +typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL; + +typedef struct { + EFI_HANDLE InstanceHandle; + EFI_IPv4_ADDRESS Ip4Address; + EFI_IPv4_ADDRESS SubnetMask; +} EFI_IP4_ADDRESS_PAIR; + +typedef struct { + EFI_HANDLE DriverHandle; + UINT32 AddressCount; + EFI_IP4_ADDRESS_PAIR AddressPairs[1]; +} EFI_IP4_VARIABLE_DATA; + +typedef struct { + UINT8 DefaultProtocol; + BOOLEAN AcceptAnyProtocol; + BOOLEAN AcceptIcmpErrors; + BOOLEAN AcceptBroadcast; + BOOLEAN AcceptPromiscuous; + BOOLEAN UseDefaultAddress; + EFI_IPv4_ADDRESS StationAddress; + EFI_IPv4_ADDRESS SubnetMask; + UINT8 TypeOfService; + UINT8 TimeToLive; + BOOLEAN DoNotFragment; + BOOLEAN RawData; + UINT32 ReceiveTimeout; + UINT32 TransmitTimeout; +} EFI_IP4_CONFIG_DATA; + + +typedef struct { + EFI_IPv4_ADDRESS SubnetAddress; + EFI_IPv4_ADDRESS SubnetMask; + EFI_IPv4_ADDRESS GatewayAddress; +} EFI_IP4_ROUTE_TABLE; + +typedef struct { + UINT8 Type; + UINT8 Code; +} EFI_IP4_ICMP_TYPE; + +typedef struct { + BOOLEAN IsStarted; + EFI_IP4_CONFIG_DATA ConfigData; + BOOLEAN IsConfigured; + UINT32 GroupCount; + EFI_IPv4_ADDRESS *GroupTable; + UINT32 RouteCount; + EFI_IP4_ROUTE_TABLE *RouteTable; + UINT32 IcmpTypeCount; + EFI_IP4_ICMP_TYPE *IcmpTypeList; +} EFI_IP4_MODE_DATA; + +#pragma pack(1) + +typedef struct { +#ifdef EFI_NET_LITTLE_ENDIAN + UINT8 HeaderLength:4; + UINT8 Version:4; +#else + UINT8 Version:4; + UINT8 HeaderLength:4; +#endif + UINT8 TypeOfService; + UINT16 TotalLength; + UINT16 Identification; + UINT16 Fragmentation; + UINT8 TimeToLive; + UINT8 Protocol; + UINT16 Checksum; + EFI_IPv4_ADDRESS SourceAddress; + EFI_IPv4_ADDRESS DestinationAddress; +} EFI_IP4_HEADER; +#pragma pack() + + +typedef struct { + UINT32 FragmentLength; + VOID *FragmentBuffer; +} EFI_IP4_FRAGMENT_DATA; + + +typedef struct { + EFI_TIME TimeStamp; + EFI_EVENT RecycleSignal; + UINT32 HeaderLength; + EFI_IP4_HEADER *Header; + UINT32 OptionsLength; + VOID *Options; + UINT32 DataLength; + UINT32 FragmentCount; + EFI_IP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_IP4_RECEIVE_DATA; + + +typedef struct { + EFI_IPv4_ADDRESS SourceAddress; + EFI_IPv4_ADDRESS GatewayAddress; + UINT8 Protocol; + UINT8 TypeOfService; + UINT8 TimeToLive; + BOOLEAN DoNotFragment; +} EFI_IP4_OVERRIDE_DATA; + +typedef struct { + EFI_IPv4_ADDRESS DestinationAddress; + EFI_IP4_OVERRIDE_DATA *OverrideData; //OPTIONAL + UINT32 OptionsLength; //OPTIONAL + VOID *OptionsBuffer; //OPTIONAL + UINT32 TotalDataLength; + UINT32 FragmentCount; + EFI_IP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_IP4_TRANSMIT_DATA; + +typedef struct { + EFI_EVENT Event; + EFI_STATUS Status; + union { + EFI_IP4_RECEIVE_DATA *RxData; + EFI_IP4_TRANSMIT_DATA *TxData; + } Packet; +} EFI_IP4_COMPLETION_TOKEN; + +/** + Gets the current operational settings for this instance of the EFI IPv4 Protocol driver. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure. + @param MnpConfigData Pointer to the managed network configuration data structure. + @param SnpData Pointer to the simple network mode data structure. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_GET_MODE_DATA) ( + IN CONST EFI_IP4_PROTOCOL *This, + OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, + OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, + OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL + ) +; + +/** + Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + @param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure. + + @retval EFI_SUCCESS The driver instance was successfully opened. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + @retval EFI_UNSUPPORTED One or more of the following conditions is TRUE: + A configuration protocol (DHCP, BOOTP, RARP, etc.) could + not be located when clients choose to use the default IPv4 + address. This EFI IPv4 Protocol implementation does not + support this requested filter or timeout setting. + @retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated. + @retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the + IPv4 address or subnet mask can be changed. The interface must + also be stopped when switching to/from raw packet mode. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4 + Protocol driver instance is not opened. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIGURE) ( + IN EFI_IP4_PROTOCOL *This, + IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL + ) +; + +/** + Joins and leaves multicast groups. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + @param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave. + @param GroupAddress Pointer to the IPv4 multicast address. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER One or more of the following is TRUE: + - This is NULL. + - JoinFlag is TRUE and GroupAddress is NULL. + - GroupAddress is not NULL and *GroupAddress is + not a multicast IPv4 address. + @retval EFI_NOT_STARTED This instance has not been started. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_OUT_OF_RESOURCES System resources could not be allocated. + @retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups. + @retval EFI_ALREADY_STARTED The group address is already in the group table (when + JoinFlag is TRUE). + @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE). + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_GROUPS) ( + IN EFI_IP4_PROTOCOL *This, + IN BOOLEAN JoinFlag, + IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL + ) +; + +/** + Adds and deletes routing table entries. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + @param DeleteRoute Set to TRUE to delete this route from the routing table. Set to + FALSE to add this route to the routing table. SubnetAddress + and SubnetMask are used as the key to each route entry. + @param SubnetAddress The address of the subnet that needs to be routed. + @param SubnetMask The subnet mask of SubnetAddress. + @param GatewayAddress The unicast gateway IPv4 address for this route. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_NOT_STARTED The driver instance has not been started. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - SubnetAddress is NULL. + - SubnetMask is NULL. + - GatewayAddress is NULL. + - *SubnetAddress is not a valid subnet address. + - *SubnetMask is not a valid subnet mask. + - *GatewayAddress is not a valid unicast IPv4 address. + @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table. + @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE). + @retval EFI_ACCESS_DENIED The route is already defined in the routing table (when + DeleteRoute is FALSE). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_ROUTES) ( + IN EFI_IP4_PROTOCOL *This, + IN BOOLEAN DeleteRoute, + IN EFI_IPv4_ADDRESS *SubnetAddress, + IN EFI_IPv4_ADDRESS *SubnetMask, + IN EFI_IPv4_ADDRESS *GatewayAddress + ) +; + +/** + Places outgoing data packets into the transmit queue. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + @param Token Pointer to the transmit token. + + @retval EFI_SUCCESS The data has been queued for transmission. + @retval EFI_NOT_STARTED This instance has not been started. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more pameters are invalid. + @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event + was already in the transmit queue. + @retval EFI_NOT_READY The completion token could not be queued because the transmit + queue is full. + @retval EFI_NOT_FOUND Not route is found to destination address. + @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data. + @retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too + short to transmit. + @retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is + greater than MTU (or greater than the maximum packet size if + Token.Packet.TxData.OverrideData. + DoNotFragment is TRUE.) + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_TRANSMIT) ( + IN EFI_IP4_PROTOCOL *This, + IN EFI_IP4_COMPLETION_TOKEN *Token + ) +; + +/** + Places a receiving request into the receiving queue. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + @param Token Pointer to a token that is associated with the receive data descriptor. + + @retval EFI_SUCCESS The receive completion token was cached. + @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.) + is not finished yet. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - Token is NULL. + - Token.Event is NULL. + @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system + resources (usually memory). + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + The EFI IPv4 Protocol instance has been reset to startup defaults. + EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already + in the receive queue. + @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full. + @retval EFI_ICMP_ERROR An ICMP error packet was received. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_RECEIVE) ( + IN EFI_IP4_PROTOCOL *This, + IN EFI_IP4_COMPLETION_TOKEN *Token + ) +; + +/** + Abort an asynchronous transmit or receive request. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + @param Token Pointer to a token that has been issued by + EFI_IP4_PROTOCOL.Transmit() or + EFI_IP4_PROTOCOL.Receive(). If NULL, all pending + tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is + defined in EFI_IP4_PROTOCOL.Transmit(). + + @retval EFI_SUCCESS The asynchronous I/O request was aborted and + Token.->Event was signaled. When Token is NULL, all + pending requests were aborted and their events were signaled. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_STARTED This instance has not been started. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was + not found in the transmit or receive queue. It has either completed + or was not issued by Transmit() and Receive(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CANCEL) ( + IN EFI_IP4_PROTOCOL *This, + IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL + ) +; + +/** + Polls for incoming data packets and processes outgoing data packets. + + @param This Pointer to the EFI_IP4_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed. + @retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_NOT_READY No incoming or outgoing data is processed. + @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue. + Consider increasing the polling rate. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_POLL) ( + IN EFI_IP4_PROTOCOL *This + ) +; + +struct _EFI_IP4_PROTOCOL { + EFI_IP4_GET_MODE_DATA GetModeData; + EFI_IP4_CONFIGURE Configure; + EFI_IP4_GROUPS Groups; + EFI_IP4_ROUTES Routes; + EFI_IP4_TRANSMIT Transmit; + EFI_IP4_RECEIVE Receive; + EFI_IP4_CANCEL Cancel; + EFI_IP4_POLL Poll; +}; + +extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid; +extern EFI_GUID gEfiIp4ProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/IP4Config.h b/MdePkg/Include/Protocol/IP4Config.h new file mode 100644 index 0000000000..a783e9b87a --- /dev/null +++ b/MdePkg/Include/Protocol/IP4Config.h @@ -0,0 +1,123 @@ +/** @file + 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: IP4Config.h + +**/ + +#ifndef __EFI_IP4CONFIG_PROTOCOL_H__ +#define __EFI_IP4CONFIG_PROTOCOL_H__ + +#include + +#define EFI_IP4_CONFIG_PROTOCOL_GUID \ + { \ + 0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } \ + } + +typedef struct _EFI_IP4_CONFIG_PROTOCOL EFI_IP4_CONFIG_PROTOCOL; + +#define IP4_CONFIG_VARIABLE_ATTRIBUTES \ + (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | \ + EFI_VARIABLE_RUNTIME_ACCESS ) + +typedef struct { + EFI_IPv4_ADDRESS StationAddress; + EFI_IPv4_ADDRESS SubnetMask; + UINT32 RouteTableSize; + EFI_IP4_ROUTE_TABLE *RouteTable; //OPTIONAL +} EFI_IP4_IPCONFIG_DATA; + + +/** + Starts running the configuration policy for the EFI IPv4 Protocol driver. + + @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance. + @param DoneEvent Event that will be signaled when the EFI IPv4 Protocol driver + configuration policy completes execution. This event must be of + type EVT_NOTIFY_SIGNAL. + @param ReconfigEvent Event that will be signaled when the EFI IPv4 Protocol driver + configuration needs to be updated. This event must be of type + EVT_NOTIFY_SIGNAL. + + @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol driver is now + running. + @retval EFI_INVALID_PARAMETER This, DoneEvent, or ReconfigEvent is NULL. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_ALREADY_STARTED The configuration policy for the EFI IPv4 Protocol driver was + already started. + @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred. + @retval EFI_UNSUPPORTED This interface does not support the EFI IPv4 Protocol driver + configuration. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG_START) ( + IN EFI_IP4_CONFIG_PROTOCOL *This, + IN EFI_EVENT DoneEvent, + IN EFI_EVENT ReconfigEvent + ) +; + +/** + Stops running the configuration policy for the EFI IPv4 Protocol driver. + + @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance. + + @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol driver has been stopped. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol driver was not started. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG_STOP) ( + IN EFI_IP4_CONFIG_PROTOCOL *This + ) +; + +/** + Returns the default configuration data (if any) for the EFI IPv4 Protocol driver. + + @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance. + @param IpConfigDataSize On input, the size of the IpConfigData buffer. + On output, the count of bytes that were written into the IpConfigData buffer. + @param IpConfigData Pointer to the EFI IPv4 Configuration Protocol driver + configuration data structure. + + @retval EFI_SUCCESS The EFI IPv4 Protocol driver configuration has been returned. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol driver is not + running. + @retval EFI_NOT_READY EFI IPv4 Protocol driver configuration is still running. + @retval EFI_ABORTED EFI IPv4 Protocol driver configuration could not complete. + @retval EFI_BUFFER_TOO_SMALL *IpConfigDataSize is smaller than the configuration data + buffer or IpConfigData is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG_GET_DATA) ( + IN EFI_IP4_CONFIG_PROTOCOL *This, + IN OUT UINTN *IpConfigDataSize, + OUT EFI_IP4_IPCONFIG_DATA *IpConfigData OPTIONAL + ) +; + +struct _EFI_IP4_CONFIG_PROTOCOL { + EFI_IP4_CONFIG_START Start; + EFI_IP4_CONFIG_STOP Stop; + EFI_IP4_CONFIG_GET_DATA GetData; +}; + +extern EFI_GUID gEfiIp4ConfigProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/IScsiInitatorName.h b/MdePkg/Include/Protocol/IScsiInitatorName.h new file mode 100644 index 0000000000..1481cd2bcb --- /dev/null +++ b/MdePkg/Include/Protocol/IScsiInitatorName.h @@ -0,0 +1,92 @@ +/** @file + EFI_ISCSI_INITIATOR_NAME_PROTOCOL as defined in UEFI 2.0. + It rovides the ability to get and set the iSCSI Initiator Name. + + 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: IScsiInitatorName.h + +**/ + +#ifndef __ISCSI_INITIATOR_NAME_H__ +#define __ISCSI_INITIATOR_NAME_H__ + +#define EFI_ISCSI_INITIATOR_NAME_PROTOCOL_GUID \ +{ \ + 0x59324945, 0xec44, 0x4c0d, {0xb1, 0xcd, 0x9d, 0xb1, 0x39, 0xdf, 0x7, 0xc } \ +} + +typedef struct _EFI_ISCSI_INITIATOR_NAME_PROTOCOL EFI_ISCSI_INITIATOR_NAME_PROTOCOL; + +/** + Retrieves the current set value of iSCSI Initiator Name. + + @param This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance. + @param BufferSize Size of the buffer in bytes pointed to by Buffer / Actual size of the + variable data buffer. + @param Buffer Pointer to the buffer for data to be read. + + @retval EFI_SUCCESS Data was successfully retrieved into the provided buffer and the + BufferSize was sufficient to handle the iSCSI initiator name + @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. + @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL. + @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to a hardware error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ISCSI_INITIATOR_NAME_GET) ( + IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +; + + + +/** + Sets the iSCSI Initiator Name. + + @param This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance. + @param BufferSize Size of the buffer in bytes pointed to by Buffer. + @param Buffer Pointer to the buffer for data to be written. + + @retval EFI_SUCCESS Data was successfully stored by the protocol. + @retval EFI_UNSUPPORTED Platform policies do not allow for data to be written. + @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL, or BufferSize exceeds the maximum allowed limit. + @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error. + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data. + @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720 + (and other related protocols) + +**/ +typedef EFI_STATUS +(EFIAPI *EFI_ISCSI_INITIATOR_NAME_SET) ( + IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This, + IN OUT UINTN *BufferSize, + IN VOID *Buffer + ) +; + +struct _EFI_ISCSI_INITIATOR_NAME_PROTOCOL { + EFI_ISCSI_INITIATOR_NAME_GET Get; + EFI_ISCSI_INITIATOR_NAME_SET Set; +}; + +extern EFI_GUID gEfiIScsiInitiatorNameProtocolGuid; + +#endif + + + + + + + diff --git a/MdePkg/Include/Protocol/LoadFile.h b/MdePkg/Include/Protocol/LoadFile.h new file mode 100644 index 0000000000..346039fb61 --- /dev/null +++ b/MdePkg/Include/Protocol/LoadFile.h @@ -0,0 +1,83 @@ +/** @file + Load File protocol as defined in the EFI 1.0 specification. + + Load file protocol exists to supports the addition of new boot devices, + and to support booting from devices that do not map well to file system. + Network boot is done via a LoadFile protocol. + + EFI 1.0 can boot from any device that produces a LoadFile 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: LoadFile.h + +**/ + +#ifndef __EFI_LOAD_FILE_PROTOCOL_H__ +#define __EFI_LOAD_FILE_PROTOCOL_H__ + +#define LOAD_FILE_PROTOCOL_GUID \ + { \ + 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \ + } + +// +// Protocol Guid Name defined by UEFI 2.0 spec. +// +#define EFI_LOAD_FILE_PROTOCOL_GUID LOAD_FILE_PROTOCOL_GUID + +typedef struct _EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL; + +/** + Causes the driver to load a specified file. + + @param This Protocol instance pointer. + @param FilePath The device specific path of the file to load. + @param BootPolicy If TRUE, indicates that the request originates from the + boot manager is attempting to load FilePath as a boot + selection. If FALSE, then FilePath must match as exact file + to be loaded. + @param BufferSize On input the size of Buffer in bytes. On output with a return + code of EFI_SUCCESS, the amount of data transferred to + Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, + the size of Buffer required to retrieve the requested file. + @param Buffer The memory buffer to transfer the file to. IF Buffer is NULL, + then no the size of the requested file is returned in + BufferSize. + + @retval EFI_SUCCESS The file was loaded. + @retval EFI_UNSUPPORTED The device does not support the provided BootPolicy + @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or + BufferSize is NULL. + @retval EFI_NO_MEDIA No medium was present to load the file. + @retval EFI_DEVICE_ERROR The file was not loaded due to a device error. + @retval EFI_NO_RESPONSE The remote system did not respond. + @retval EFI_NOT_FOUND The file was not found + @retval EFI_ABORTED The file load process was manually cancelled. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_LOAD_FILE) ( + IN EFI_LOAD_FILE_PROTOCOL *This, + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN BOOLEAN BootPolicy, + IN OUT UINTN *BufferSize, + IN VOID *Buffer OPTIONAL + ) +; + +struct _EFI_LOAD_FILE_PROTOCOL { + EFI_LOAD_FILE LoadFile; +}; + +extern EFI_GUID gEfiLoadFileProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/ManagedNetwork.h b/MdePkg/Include/Protocol/ManagedNetwork.h new file mode 100644 index 0000000000..ab6dba623c --- /dev/null +++ b/MdePkg/Include/Protocol/ManagedNetwork.h @@ -0,0 +1,316 @@ +/** @file + EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0. + EFI_MANAGED_NETWORK_PROTOCOL as defined in UEFI 2.0. + + 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: ManagedNetwork.h + +**/ + +#ifndef _EFI_MANAGED_NETWORK_PROTOCOL_H +#define _EFI_MANAGED_NETWORK_PROTOCOL_H + +#include + +#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } \ + } + +#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \ + { \ + 0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x7, 0x8, 0x92, 0xe0, 0x5e } \ + } + +typedef struct _EFI_MANAGED_NETWORK_PROTOCOL EFI_MANAGED_NETWORK_PROTOCOL; + +typedef struct { + UINT32 ReceivedQueueTimeoutValue; + UINT32 TransmitQueueTimeoutValue; + UINT16 ProtocolTypeFilter; + BOOLEAN EnableUnicastReceive; + BOOLEAN EnableMulticastReceive; + BOOLEAN EnableBroadcastReceive; + BOOLEAN EnablePromiscuousReceive; + BOOLEAN FlushQueuesOnReset; + BOOLEAN EnableReceiveTimestamps; + BOOLEAN DisableBackgroundPolling; +} EFI_MANAGED_NETWORK_CONFIG_DATA; + +typedef struct { + EFI_TIME Timestamp; + EFI_EVENT RecycleEvent; + UINT32 PacketLength; + UINT32 HeaderLength; + UINT32 AddressLength; + UINT32 DataLength; + BOOLEAN BroadcastFlag; + BOOLEAN MulticastFlag; + BOOLEAN PromiscuousFlag; + UINT16 ProtocolType; + VOID *DestinationAddress; + VOID *SourceAddress; + VOID *MediaHeader; + VOID *PacketData; +} EFI_MANAGED_NETWORK_RECEIVE_DATA; + +typedef struct { + UINT32 FragmentLength; + VOID *FragmentBuffer; +} EFI_MANAGED_NETWORK_FRAGMENT_DATA; + +typedef struct { + EFI_MAC_ADDRESS *DestinationAddress; //OPTIONAL + EFI_MAC_ADDRESS *SourceAddress; //OPTIONAL + UINT16 ProtocolType; //OPTIONAL + UINT32 DataLength; + UINT16 HeaderLength; //OPTIONAL + UINT16 FragmentCount; + EFI_MANAGED_NETWORK_FRAGMENT_DATA FragmentTable[1]; +} EFI_MANAGED_NETWORK_TRANSMIT_DATA; + + +typedef struct { + EFI_EVENT Event; + EFI_STATUS Status; + union { + EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData; + EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData; + } Packet; +} EFI_MANAGED_NETWORK_COMPLETION_TOKEN; + +/** + Returns the operational parameters for the current MNP child driver. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + @param MnpConfigData Pointer to storage for MNP operational parameters. + @param SnpModeData Pointer to storage for SNP operational parameters. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation. + @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. The default + values are returned in MnpConfigData if it is not NULL. + @retval Other The mode data could not be read. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_GET_MODE_DATA) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This, + OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, + OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL + ) +; + +/** + Sets or clears the operational parameters for the MNP child driver. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + @param MnpConfigData Pointer to configuration data that will be assigned to the MNP + child driver instance. If NULL, the MNP child driver instance is + reset to startup defaults and all pending transmit and receive + requests are flushed. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory) could not be + allocated. + @retval EFI_UNSUPPORTED The requested feature is unsupported in this [MNP] + implementation. + @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. + @retval Other The MNP child driver instance has been reset to startup defaults. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This, + IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL + ) +; + +/** + Translates an IP multicast address to a hardware (MAC) multicast address. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + @param Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address. + Set to FALSE if IpAddress is an IPv4 multicast address. + @param IpAddress Pointer to the multicast IP address (in network byte order) to convert. + @param MacAddress Pointer to the resulting multicast MAC address. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE: + - This is NULL. + - IpAddress is NULL. + - *IpAddress is not a valid multicast IP address. + - MacAddress is NULL. + @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. + @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation. + @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. + @retval Other The address could not be converted. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This, + IN BOOLEAN Ipv6Flag, + IN EFI_IP_ADDRESS *IpAddress, + OUT EFI_MAC_ADDRESS *MacAddress + ) +; + +/** + Enables and disables receive filters for multicast address. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + @param JoinFlag Set to TRUE to join this multicast group. + Set to FALSE to leave this multicast group. + @param MacAddress Pointer to the multicast MAC group (address) to join or leave. + + @retval EFI_SUCCESS The requested operation completed successfully. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - JoinFlag is TRUE and MacAddress is NULL. + - *MacAddress is not a valid multicast MAC address. + @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. + @retval EFI_ALREADY_STARTED The supplied multicast group is already joined. + @retval EFI_NOT_FOUND The supplied multicast group is not joined. + @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. + @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation. + @retval Other The requested operation could not be completed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_GROUPS) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This, + IN BOOLEAN JoinFlag, + IN EFI_MAC_ADDRESS *MacAddress OPTIONAL + ) +; + +/** + Places asynchronous outgoing data packets into the transmit queue. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + @param Token Pointer to a token associated with the transmit data descriptor. + + @retval EFI_SUCCESS The transmit completion token was cached. + @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_ACCESS_DENIED The transmit completion token is already in the transmit queue. + @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources + (usually memory). + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_NOT_READY The transmit request could not be queued because the transmit queue is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This, + IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token + ) +; + +/** + Places an asynchronous receiving request into the receiving queue. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + @param Token Pointer to a token associated with the receive data descriptor. + + @retval EFI_SUCCESS The receive completion token was cached. + @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - Token is NULL. + - Token.Event is NULL + @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources + (usually memory). + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_ACCESS_DENIED The receive completion token was already in the receive queue. + @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_RECEIVE) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This, + IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token + ) +; + + +/** + Aborts an asynchronous transmit or receive request. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + @param Token Pointer to a token that has been issued by + EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or + EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If + NULL, all pending tokens are aborted. + + @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event + was signaled. When Token is NULL, all pending requests were + aborted and their events were signaled. + @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was + not found in the transmit or receive queue. It has either completed + or was not issued by Transmit() and Receive(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_CANCEL) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This, + IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL + ) +; + +/** + Polls for incoming data packets and processes outgoing data packets. + + @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed. + @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider increasing + the polling rate. + @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue. + Consider increasing the polling rate. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MANAGED_NETWORK_POLL) ( + IN EFI_MANAGED_NETWORK_PROTOCOL *This + ) +; + +struct _EFI_MANAGED_NETWORK_PROTOCOL { + EFI_MANAGED_NETWORK_GET_MODE_DATA GetModeData; + EFI_MANAGED_NETWORK_CONFIGURE Configure; + EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC McastIpToMac; + EFI_MANAGED_NETWORK_GROUPS Groups; + EFI_MANAGED_NETWORK_TRANSMIT Transmit; + EFI_MANAGED_NETWORK_RECEIVE Receive; + EFI_MANAGED_NETWORK_CANCEL Cancel; + EFI_MANAGED_NETWORK_POLL Poll; +}; + +extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid; +extern EFI_GUID gEfiManagedNetworkProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Metronome.h b/MdePkg/Include/Protocol/Metronome.h new file mode 100644 index 0000000000..c4a1f71925 --- /dev/null +++ b/MdePkg/Include/Protocol/Metronome.h @@ -0,0 +1,98 @@ +/** @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/Protocol/MonotonicCounter.h b/MdePkg/Include/Protocol/MonotonicCounter.h new file mode 100644 index 0000000000..d25374074d --- /dev/null +++ b/MdePkg/Include/Protocol/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/Protocol/Mtftp4.h b/MdePkg/Include/Protocol/Mtftp4.h new file mode 100644 index 0000000000..18ae20bc4b --- /dev/null +++ b/MdePkg/Include/Protocol/Mtftp4.h @@ -0,0 +1,507 @@ +/** @file + EFI Multicast Trivial File Tranfer Protocol Definition + + 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: Mtftp4.h + +**/ + +#ifndef __EFI_MTFTP4_PROTOCOL_H__ +#define __EFI_MTFTP4_PROTOCOL_H__ + +#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } \ + } + +#define EFI_MTFTP4_PROTOCOL_GUID \ + { \ + 0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b } \ + } + +typedef struct _EFI_MTFTP4_PROTOCOL EFI_MTFTP4_PROTOCOL; +typedef struct _EFI_MTFTP4_TOKEN EFI_MTFTP4_TOKEN; + +// +//MTFTP4 packet opcode definition +// +#define EFI_MTFTP4_OPCODE_RRQ 1 +#define EFI_MTFTP4_OPCODE_WRQ 2 +#define EFI_MTFTP4_OPCODE_DATA 3 +#define EFI_MTFTP4_OPCODE_ACK 4 +#define EFI_MTFTP4_OPCODE_ERROR 5 +#define EFI_MTFTP4_OPCODE_OACK 6 +#define EFI_MTFTP4_OPCODE_DIR 7 +#define EFI_MTFTP4_OPCODE_DATA8 8 +#define EFI_MTFTP4_OPCODE_ACK8 9 + +// +// MTFTP4 error code definition +// +#define EFI_MTFTP4_ERRORCODE_NOT_DEFINED 0 +#define EFI_MTFTP4_ERRORCODE_FILE_NOT_FOUND 1 +#define EFI_MTFTP4_ERRORCODE_ACCESS_VIOLATION 2 +#define EFI_MTFTP4_ERRORCODE_DISK_FULL 3 +#define EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION 4 +#define EFI_MTFTP4_ERRORCODE_UNKNOWN_TRANSFER_ID 5 +#define EFI_MTFTP4_ERRORCODE_FILE_ALREADY_EXISTS 6 +#define EFI_MTFTP4_ERRORCODE_NO_SUCH_USER 7 +#define EFI_MTFTP4_ERRORCODE_REQUEST_DENIED 8 + +// +// MTFTP4 pacekt definitions +// +#pragma pack(1) + +typedef struct { + UINT16 OpCode; + UINT8 Filename[1]; +} EFI_MTFTP4_REQ_HEADER; + +typedef struct { + UINT16 OpCode; + UINT8 Data[1]; +} EFI_MTFTP4_OACK_HEADER; + +typedef struct { + UINT16 OpCode; + UINT16 Block; + UINT8 Data[1]; +} EFI_MTFTP4_DATA_HEADER; + +typedef struct { + UINT16 OpCode; + UINT16 Block[1]; +} EFI_MTFTP4_ACK_HEADER; + +typedef struct { + UINT16 OpCode; + UINT64 Block; + UINT8 Data[1]; +} EFI_MTFTP4_DATA8_HEADER; + +typedef struct { + UINT16 OpCode; + UINT64 Block[1]; +} EFI_MTFTP4_ACK8_HEADER; + +typedef struct { + UINT16 OpCode; + UINT16 ErrorCode; + UINT8 ErrorMessage[1]; +} EFI_MTFTP4_ERROR_HEADER; + +typedef union { + UINT16 OpCode; + EFI_MTFTP4_REQ_HEADER Rrq; + EFI_MTFTP4_REQ_HEADER Wrq; + EFI_MTFTP4_OACK_HEADER Oack; + EFI_MTFTP4_DATA_HEADER Data; + EFI_MTFTP4_ACK_HEADER Ack; + EFI_MTFTP4_DATA8_HEADER Data8; + EFI_MTFTP4_ACK8_HEADER Ack8; + EFI_MTFTP4_ERROR_HEADER Error; +} EFI_MTFTP4_PACKET; + +#pragma pack() + +// +// MTFTP4 option definition +// +typedef struct { + UINT8 *OptionStr; + UINT8 *ValueStr; +} EFI_MTFTP4_OPTION; + + +typedef struct { + BOOLEAN UseDefaultSetting; + EFI_IPv4_ADDRESS StationIp; + EFI_IPv4_ADDRESS SubnetMask; + UINT16 LocalPort; + EFI_IPv4_ADDRESS GatewayIp; + EFI_IPv4_ADDRESS ServerIp; + UINT16 InitialServerPort; + UINT16 TryCount; + UINT16 TimeoutValue; +} EFI_MTFTP4_CONFIG_DATA; + + +typedef struct { + EFI_MTFTP4_CONFIG_DATA ConfigData; + UINT8 SupportedOptionCount; + UINT8 **SupportedOptoins; + UINT8 UnsupportedOptionCount; + UINT8 **UnsupportedOptoins; +} EFI_MTFTP4_MODE_DATA; + + +typedef struct { + EFI_IPv4_ADDRESS GatewayIp; + EFI_IPv4_ADDRESS ServerIp; + UINT16 ServerPort; + UINT16 TryCount; + UINT16 TimeoutValue; +} EFI_MTFTP4_OVERRIDE_DATA; + +// +// Protocol interfaces definition +// + +/** + a callback function that is provided by the caller to intercept + the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the + EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept + EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to + EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() or ReadDirectory(). + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param Token The token that the caller provided in the + EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() + or ReadDirectory() function. + @param PacketLen Indicates the length of the packet. + @param Packet Pointer to an MTFTPv4 packet. + + @retval EFI_SUCCESS Operation sucess + @retval Others Abort transfer process + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_CHECK_PACKET)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_TOKEN *Token, + IN UINT16 PacketLen, + IN EFI_MTFTP4_PACKET *Paket + ) +; + +/** + Timeout callback funtion. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param Token The token that is provided in the + EFI_MTFTP4_PROTOCOL.ReadFile() or + EFI_MTFTP4_PROTOCOL.WriteFile() or + EFI_MTFTP4_PROTOCOL.ReadDirectory() functions + by the caller. + + @retval EFI_SUCCESS Operation sucess + @retval Others Aborts download process. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_TIMEOUT_CALLBACK)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_TOKEN *Token + ) +; + +/** + a callback function that the caller provides to feed data to the + EFI_MTFTP4_PROTOCOL.WriteFile() function. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param Token The token provided in the + EFI_MTFTP4_PROTOCOL.WriteFile() by the caller. + @param Length Indicates the length of the raw data wanted on input, and the + length the data available on output. + @param Buffer Pointer to the buffer where the data is stored. + + @retval EFI_SUCCESS Operation sucess + @retval Others Aborts session. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_PACKET_NEEDED)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_TOKEN *Token, + IN OUT UINT16 *Length, + OUT VOID **Buffer + ) +; + + +/** + Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param ModeData Pointer to storage for the EFI MTFTPv4 Protocol driver mode data. + + @retval EFI_SUCCESS The configuration data was successfully returned. + @retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated. + @retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_GET_MODE_DATA)( + IN EFI_MTFTP4_PROTOCOL *This, + OUT EFI_MTFTP4_MODE_DATA *ModeData + ) +; + + +/** + Initializes, changes, or resets the default operational setting for this + EFI MTFTPv4 Protocol driver instance. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param MtftpConfigData Pointer to the configuration data structure. + + @retval EFI_SUCCESS The EFI MTFTPv4 Protocol driver was configured successfully. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_ACCESS_DENIED The EFI configuration could not be changed at this time because + there is one MTFTP background operation in progress. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) has not finished yet. + @retval EFI_UNSUPPORTED A configuration protocol (DHCP, BOOTP, RARP, etc.) could not + be located when clients choose to use the default address + settings. + @retval EFI_OUT_OF_RESOURCES The EFI MTFTPv4 Protocol driver instance data could not be + allocated. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI + MTFTPv4 Protocol driver instance is not configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_CONFIGURE)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_CONFIG_DATA *MtftpConfigData OPTIONAL + ) +; + + +/** + Gets information about a file from an MTFTPv4 server. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param OverrideData Data that is used to override the existing parameters. If NULL, + the default parameters that were set in the + EFI_MTFTP4_PROTOCOL.Configure() function are used. + @param Filename Pointer to ASCIIZ file name string. + @param ModeStr Pointer to ASCIIZ mode string. If NULL, "octet" will be used. + @param OptionCount Number of option/value string pairs in OptionList. + @param OptionList Pointer to array of option/value string pairs. Ignored if + OptionCount is zero. + @param PacketLength The number of bytes in the returned packet. + @param Packet The pointer to the received packet. This buffer must be freed by + the caller. + + @retval EFI_SUCCESS An MTFTPv4 OACK packet was received and is in the Buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_UNSUPPORTED One or more options in the OptionList are in the + unsupported list of structure EFI_MTFTP4_MODE_DATA. + @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) has not finished yet. + @retval EFI_ACCESS_DENIED The previous operation has not completed yet. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received and is in the buffer. + @retval EFI_ICMP_ERROR An ICMP ERROR packet was received and is in the Buffer. + @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv4 packet was received and is in the buffer. + @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_GET_INFO)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_OVERRIDE_DATA *OverrideData OPTIONAL, + IN UINT8 *Filename, + IN UINT8 *ModeStr OPTIONAL, + IN UINT8 OptionCount, + IN EFI_MTFTP4_OPTION *OptionList, + OUT UINT32 *PacketLength, + OUT EFI_MTFTP4_PACKET **Packet OPTIONAL + ) +; + +/** + Parses the options in an MTFTPv4 OACK packet. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param PacketLen Length of the OACK packet to be parsed. + @param Packet Pointer to the OACK packet to be parsed. + @param OptionCount Pointer to the number of options in following OptionList. + @param OptionList Pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot + Service FreePool() to release each option if they are not + needed any more. + + @retval EFI_SUCCESS The OACK packet was valid and the OptionCount and + OptionList parameters have been updated. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - PacketLen is 0. + - Packet is NULL or Packet is not a valid MTFTPv4 packet. + - OptionCount is NULL. + @retval EFI_NOT_FOUND No options were found in the OACK packet. + @retval EFI_OUT_OF_RESOURCES Storage for the OptionList array cannot be allocated. + @retval EFI_PROTOCOL_ERROR One or more of the option fields is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_PARSE_OPTIONS)( + IN EFI_MTFTP4_PROTOCOL *This, + IN UINT32 PacketLen, + IN EFI_MTFTP4_PACKET *Packet, + OUT UINT32 *OptionCount, + OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL + ) +; + + +/** + Downloads a file from an MTFTPv4 server. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param Token Pointer to the token structure to provide the parameters that are + used in this operation. + + @retval EFI_SUCCESS The data file has been transferred successfully. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_BUFFER_TOO_SMALL BufferSize is not large enough to hold the downloaded data + in downloading process. + @retval EFI_ABORTED Current operation is aborted by user. + @retval EFI_ICMP_ERROR An ICMP ERROR packet was received. + @retval EFI_TIMEOUT No responses were received from the MTFTPv4 server. + @retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_READ_FILE)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_TOKEN *Token + ) +; + + + +/** + Sends a file to an MTFTPv4 server. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param Token Pointer to the token structure to provide the parameters that are + used in this operation. + + @retval EFI_SUCCESS The upload session has started. + @retval EFI_UNSUPPORTED The operation is not supported by this implementation. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in + the unsupported list of structure EFI_MTFTP4_MODE_DATA. + @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 session. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_ACCESS_DENIED The previous operation has not completed yet. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_WRITE_FILE)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_TOKEN *Token + ) +; + + +/** + Downloads a data file "directory" from an MTFTPv4 server. May be unsupported in some EFI + implementations. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + @param Token Pointer to the token structure to provide the parameters that are + used in this operation. + + @retval EFI_SUCCESS The MTFTPv4 related file "directory" has been downloaded. + @retval EFI_UNSUPPORTED The operation is not supported by this implementation. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in + the unsupported list of structure EFI_MTFTP4_MODE_DATA. + @retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 session. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_ACCESS_DENIED The previous operation has not completed yet. + @retval EFI_DEVICE_ERROR An unexpected network error or system error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_READ_DIRECTORY)( + IN EFI_MTFTP4_PROTOCOL *This, + IN EFI_MTFTP4_TOKEN *Token + ) +; + +/** + Polls for incoming data packets and processes outgoing data packets. + + @param This Pointer to the EFI_MTFTP4_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed. + @retval EFI_NOT_STARTED This EFI MTFTPv4 Protocol instance has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue. + Consider increasing the polling rate. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MTFTP4_POLL) ( + IN EFI_MTFTP4_PROTOCOL *This + ) +; + + +struct _EFI_MTFTP4_PROTOCOL { + EFI_MTFTP4_GET_MODE_DATA GetModeData; + EFI_MTFTP4_CONFIGURE Configure; + EFI_MTFTP4_GET_INFO GetInfo; + EFI_MTFTP4_PARSE_OPTIONS ParseOptions; + EFI_MTFTP4_READ_FILE ReadFile; + EFI_MTFTP4_WRITE_FILE WriteFile; + EFI_MTFTP4_READ_DIRECTORY ReadDirectory; + EFI_MTFTP4_POLL Poll; +}; + +struct _EFI_MTFTP4_TOKEN { + OUT EFI_STATUS Status; + IN EFI_EVENT Event; + IN EFI_MTFTP4_OVERRIDE_DATA *OverrideData; + IN UINT8 *Filename; + IN UINT8 *ModeStr; + IN UINT32 OptionCount; + IN EFI_MTFTP4_OPTION *OptionList; + IN OUT UINT64 BufferSize; + IN OUT VOID *Buffer; + IN EFI_MTFTP4_CHECK_PACKET CheckPacket; + IN EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback; + IN EFI_MTFTP4_PACKET_NEEDED PacketNeeded; +}; + +extern EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid; +extern EFI_GUID gEfiMtftp4ProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h b/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h new file mode 100644 index 0000000000..98f1c597a4 --- /dev/null +++ b/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h @@ -0,0 +1,92 @@ +/** @file + Revision history: + + 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: + + EfiNetworkInterfaceIdentifier.h + +**/ + +#ifndef __EFI_NETWORK_INTERFACE_IDENTIFER_H__ +#define __EFI_NETWORK_INTERFACE_IDENTIFER_H__ + + +#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID \ + { \ + 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 } \ + } + +#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 0x00010000 + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL; + +typedef enum { + EfiNetworkInterfaceUndi = 1 +} EFI_NETWORK_PROTOCOL_TYPE; + +struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL { + + UINT64 Revision; + // + // Revision of the network interface identifier protocol interface. + // + UINT64 ID; + // + // Address of the first byte of the identifying structure for this + // network interface. This is set to zero if there is no structure. + // + // For PXE/UNDI this is the first byte of the !PXE structure. + // + UINT64 ImageAddr; + // + // Address of the UNrelocated driver/ROM image. This is set + // to zero if there is no driver/ROM image. + // + // For 16-bit UNDI, this is the first byte of the option ROM in + // upper memory. + // + // For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM + // image. + // + // For H/W UNDI, this is set to zero. + // + UINT32 ImageSize; + // + // Size of the UNrelocated driver/ROM image of this network interface. + // This is set to zero if there is no driver/ROM image. + // + CHAR8 StringId[4]; + // + // 4 char ASCII string to go in class identifier (option 60) in DHCP + // and Boot Server discover packets. + // For EfiNetworkInterfaceUndi this field is "UNDI". + // For EfiNetworkInterfaceSnp this field is "SNPN". + // + UINT8 Type; + UINT8 MajorVer; + UINT8 MinorVer; + // + // Information to be placed into the PXE DHCP and Discover packets. + // This is the network interface type and version number that will + // be placed into DHCP option 94 (client network interface identifier). + // + BOOLEAN Ipv6Supported; + UINT8 IfNum; // interface number to be used with pxeid structure +}; + +extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid; +extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid_31; + +#endif // _EFI_NII_H diff --git a/MdePkg/Include/Protocol/Pcd.h b/MdePkg/Include/Protocol/Pcd.h new file mode 100644 index 0000000000..7741df17ea --- /dev/null +++ b/MdePkg/Include/Protocol/Pcd.h @@ -0,0 +1,860 @@ +/** @file + Platform Configuration Database (PCD) 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: Pcd.h + +**/ + +#ifndef __PCD_H__ +#define __PCD_H__ + +extern EFI_GUID gPcdProtocolGuid; + +#define PCD_PROTOCOL_GUID \ + { 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7 } } + +#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0) + + +/** + Sets the SKU value for subsequent calls to set or get PCD token values. + + SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. + SetSku() is normally called only once by the system. + + For each item (token), the database can hold a single value that applies to all SKUs, + or multiple values, where each value is associated with a specific SKU Id. Items with multiple, + SKU-specific values are called SKU enabled. + + The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. + For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the + single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the + last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, + the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been + set for that Id, the results are unpredictable. + + @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and + set values associated with a PCD token. + + @retval VOID + +**/ +typedef +VOID +(EFIAPI *PCD_PROTOCOL_SET_SKU) ( + IN UINTN SkuId + ); + + + +/** + Retrieves an 8-bit value for a given PCD token. + + Retrieves the current byte-sized value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT8 value. + +**/ +typedef +UINT8 +(EFIAPI *PCD_PROTOCOL_GET8) ( + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 16-bit value for a given PCD token. + + Retrieves the current 16-bits value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT16 value. + +**/ +typedef +UINT16 +(EFIAPI *PCD_PROTOCOL_GET16) ( + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 32-bit value for a given PCD token. + + Retrieves the current 32-bits value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT32 value. + +**/ +typedef +UINT32 +(EFIAPI *PCD_PROTOCOL_GET32) ( + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 64-bit value for a given PCD token. + + Retrieves the current 64-bits value for a PCD token number. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The UINT64 value. + +**/ +typedef +UINT64 +(EFIAPI *PCD_PROTOCOL_GET64) ( + IN UINTN TokenNumber + ); + + + +/** + Retrieves a pointer to a value for a given PCD token. + + Retrieves the current pointer to the buffer for a PCD token number. + Do not make any assumptions about the alignment of the pointer that + is returned by this function call. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The pointer to the buffer to be retrived. + +**/ +typedef +VOID * +(EFIAPI *PCD_PROTOCOL_GET_POINTER) ( + IN UINTN TokenNumber + ); + + + +/** + Retrieves a Boolean value for a given PCD token. + + Retrieves the current boolean value for a PCD token number. + Do not make any assumptions about the alignment of the pointer that + is returned by this function call. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The Boolean value. + +**/ +typedef +BOOLEAN +(EFIAPI *PCD_PROTOCOL_GET_BOOLEAN) ( + IN UINTN TokenNumber + ); + + + +/** + Retrieves the size of the value for a given PCD token. + + Retrieves the current size of a particular PCD token. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] TokenNumber The PCD token number. + + @return The size of the value for the PCD token. + +**/ +typedef +UINTN +(EFIAPI *PCD_PROTOCOL_GET_SIZE) ( + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 8-bit value for a given PCD token. + + Retrieves the 8-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 8-bit value for the PCD token. + +**/ +typedef +UINT8 +(EFIAPI *PCD_PROTOCOL_GET_EX_8) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 16-bit value for a given PCD token. + + Retrieves the 16-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 16-bit value for the PCD token. + +**/ +typedef +UINT16 +(EFIAPI *PCD_PROTOCOL_GET_EX_16) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 32-bit value for a given PCD token. + + Retrieves the 32-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 32-bit value for the PCD token. + +**/typedef +UINT32 +(EFIAPI *PCD_PROTOCOL_GET_EX_32) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves an 64-bit value for a given PCD token. + + Retrieves the 64-bit value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size 64-bit value for the PCD token. + +**/ +typedef +UINT64 +(EFIAPI *PCD_PROTOCOL_GET_EX_64) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves a pointer to a value for a given PCD token. + + Retrieves the current pointer to the buffer for a PCD token number. + Do not make any assumptions about the alignment of the pointer that + is returned by this function call. If the TokenNumber is invalid, + the results are unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The pointer to the buffer to be retrived. + +**/ +typedef +VOID * +(EFIAPI *PCD_PROTOCOL_GET_EX_POINTER) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves an Boolean value for a given PCD token. + + Retrieves the Boolean value of a particular PCD token. + If the TokenNumber is invalid or the token space + specified by Guid does not exist, the results are + unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size Boolean value for the PCD token. + +**/ +typedef +BOOLEAN +(EFIAPI *PCD_PROTOCOL_GET_EX_BOOLEAN) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Retrieves the size of the value for a given PCD token. + + Retrieves the current size of a particular PCD token. + If the TokenNumber is invalid, the results are unpredictable. + + @param[in] Guid The token space for the token number. + @param[in] TokenNumber The PCD token number. + + @return The size of the value for the PCD token. + +**/ +typedef +UINTN +(EFIAPI *PCD_PROTOCOL_GET_EX_SIZE) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber + ); + + + +/** + Sets an 8-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET8) ( + IN UINTN TokenNumber, + IN UINT8 Value + ); + + + +/** + Sets an 16-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET16) ( + IN UINTN TokenNumber, + IN UINT16 Value + ); + + + +/** + Sets an 32-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET32) ( + IN UINTN TokenNumber, + IN UINT32 Value + ); + + + +/** + Sets an 64-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET64) ( + IN UINTN TokenNumber, + IN UINT64 Value + ); + + + +/** + Sets a value of a specified size for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. + On input, if the SizeOfValue is greater than the maximum size supported + for this TokenNumber then the output value of SizeOfValue will reflect + the maximum size supported for this TokenNumber. + @param[in] Buffer The buffer to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_POINTER) ( + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer + ); + + + +/** + Sets an Boolean value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_BOOLEAN) ( + IN UINTN TokenNumber, + IN BOOLEAN Value + ); + + + +/** + Sets an 8-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_EX_8) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT8 Value + ); + + + +/** + Sets an 16-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_EX_16) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT16 Value + ); + + + +/** + Sets an 32-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_EX_32) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT32 Value + ); + + + +/** + Sets an 64-bit value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_EX_64) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN UINT64 Value + ); + + + +/** + Sets a value of a specified size for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. + On input, if the SizeOfValue is greater than the maximum size supported + for this TokenNumber then the output value of SizeOfValue will reflect + the maximum size supported for this TokenNumber. + @param[in] Buffer The buffer to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_EX_POINTER) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN OUT UINTN *SizeOfBuffer, + IN VOID *Buffer + ); + + + +/** + Sets an Boolean value for a given PCD token. + + When the PCD service sets a value, it will check to ensure that the + size of the value being set is compatible with the Token's existing definition. + If it is not, an error will be returned. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] TokenNumber The PCD token number. + @param[in] Value The value to set for the PCD token. + + @retval EFI_SUCCESS Procedure returned successfully. + @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data + being set was incompatible with a call to this function. + Use GetSize() to retrieve the size of the target data. + @retval EFI_NOT_FOUND The PCD service could not find the requested token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_SET_EX_BOOLEAN) ( + IN CONST EFI_GUID *Guid, + IN UINTN TokenNumber, + IN BOOLEAN Value + ); + + + +/** + Callback on SET function prototype definition. + + This notification function serves two purposes. + Firstly, it notifies the module which did the registration that the value + of this PCD token has been set. Secondly, it provides a mechanism for the + module which did the registration to intercept the set operation and override + the value been set if necessary. After the invocation of the callback function, + TokenData will be used by PCD service DXE driver to modify the internal data in + PCD database. + + @param[in] CallBackGuid The PCD token GUID being set. + @param[in] CallBackToken The PCD token number being set. + @param[in, out] TokenData A pointer to the token data being set. + @param[in] TokenDataSize The size, in bytes, of the data being set. + + @retval VOID + +**/ +typedef +VOID +(EFIAPI *PCD_PROTOCOL_CALLBACK) ( + IN CONST EFI_GUID *CallBackGuid, OPTIONAL + IN UINTN CallBackToken, + IN OUT VOID *TokenData, + IN UINTN TokenDataSize + ); + + + +/** + Specifies a function to be called anytime the value of a designated token is changed. + + @param[in] TokenNumber The PCD token number. + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. + + @retval EFI_SUCCESS The PCD service has successfully established a call event + for the CallBackToken requested. + @retval EFI_NOT_FOUND The PCD service could not find the referenced token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_CALLBACK_ONSET) ( + IN CONST EFI_GUID *Guid, OPTIONAL + IN UINTN TokenNumber, + IN PCD_PROTOCOL_CALLBACK CallBackFunction + ); + + + +/** + Cancels a previously set callback function for a particular PCD token number. + + @param[in] TokenNumber The PCD token number. + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. + + @retval EFI_SUCCESS The PCD service has successfully established a call event + for the CallBackToken requested. + @retval EFI_NOT_FOUND The PCD service could not find the referenced token number. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_CANCEL_CALLBACK) ( + IN CONST EFI_GUID *Guid, OPTIONAL + IN UINTN TokenNumber, + IN PCD_PROTOCOL_CALLBACK CallBackFunction + ); + + + +/** + Retrieves the next valid PCD token for a given namespace. + + @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. + @param[in,out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. + If the input token namespace or token number does not exist on the platform, + an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token, + have the pointer reference a TokenNumber value of 0. If the input token number is 0 and + there is no valid token number for this token namespace, *TokenNumber will be assigned to + 0 and the function return EFI_SUCCESS. If the token number is the last valid token number, + *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS. + + @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number + is already the last valid token number in the PCD database. + In the later case, *TokenNumber is updated with the value of 0. + @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKEN) ( + IN CONST EFI_GUID *Guid, OPTIONAL + IN OUT UINTN *TokenNumber + ); + + + +/** + Retrieves the next valid PCD token namespace for a given namespace. + + @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates + a known token namespace from which the search will start. On output, + it designates the next valid token namespace on the platform. If the input + token namespace does not exist on the platform, an error is returned and + the value of *Guid is undefined. If *Guid is NULL, then the GUID of the + first token space of the current platform is assigned to *Guid the function + return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in + the platform other than the default (NULL) tokennamespace, *Guid is unchanged + and the function return EFI_SUCCESS. If this input token namespace is the last + namespace on the platform, *Guid will be assigned to NULL and the function return + EFI_SUCCESS. + + @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid. + Or the input token space Guid is already the last valid token space Guid + in the PCD database. In the later case, *Guid is updated with the value of NULL. + @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform. + +**/ +typedef +EFI_STATUS +(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE) ( + IN OUT CONST EFI_GUID **Guid + ); + + + +// +// Interface structure for the PCD Protocol +// +typedef struct { + PCD_PROTOCOL_SET_SKU SetSku; + + PCD_PROTOCOL_GET8 Get8; + PCD_PROTOCOL_GET16 Get16; + PCD_PROTOCOL_GET32 Get32; + PCD_PROTOCOL_GET64 Get64; + PCD_PROTOCOL_GET_POINTER GetPtr; + PCD_PROTOCOL_GET_BOOLEAN GetBool; + PCD_PROTOCOL_GET_SIZE GetSize; + + PCD_PROTOCOL_GET_EX_8 Get8Ex; + PCD_PROTOCOL_GET_EX_16 Get16Ex; + PCD_PROTOCOL_GET_EX_32 Get32Ex; + PCD_PROTOCOL_GET_EX_64 Get64Ex; + PCD_PROTOCOL_GET_EX_POINTER GetPtrEx; + PCD_PROTOCOL_GET_EX_BOOLEAN GetBoolEx; + PCD_PROTOCOL_GET_EX_SIZE GetSizeEx; + + PCD_PROTOCOL_SET8 Set8; + PCD_PROTOCOL_SET16 Set16; + PCD_PROTOCOL_SET32 Set32; + PCD_PROTOCOL_SET64 Set64; + PCD_PROTOCOL_SET_POINTER SetPtr; + PCD_PROTOCOL_SET_BOOLEAN SetBool; + + PCD_PROTOCOL_SET_EX_8 Set8Ex; + PCD_PROTOCOL_SET_EX_16 Set16Ex; + PCD_PROTOCOL_SET_EX_32 Set32Ex; + PCD_PROTOCOL_SET_EX_64 Set64Ex; + PCD_PROTOCOL_SET_EX_POINTER SetPtrEx; + PCD_PROTOCOL_SET_EX_BOOLEAN SetBoolEx; + + PCD_PROTOCOL_CALLBACK_ONSET CallbackOnSet; + PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback; + PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken; + PCD_PROTOCOL_GET_NEXT_TOKENSPACE GetNextTokenSpace; +} PCD_PROTOCOL; + +#endif diff --git a/MdePkg/Include/Protocol/PciIo.h b/MdePkg/Include/Protocol/PciIo.h new file mode 100644 index 0000000000..147f6b2441 --- /dev/null +++ b/MdePkg/Include/Protocol/PciIo.h @@ -0,0 +1,503 @@ +/** @file + EFI PCI I/O 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: PciIo.h + +**/ + +#ifndef __PCI_IO_H__ +#define __PCI_IO_H__ + +// +// Global ID for the PCI I/O Protocol +// +#define EFI_PCI_IO_PROTOCOL_GUID \ + { \ + 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \ + } + +typedef struct _EFI_PCI_IO_PROTOCOL EFI_PCI_IO_PROTOCOL; + +// +// Prototypes for the PCI I/O Protocol +// +typedef enum { + EfiPciIoWidthUint8 = 0, + EfiPciIoWidthUint16, + EfiPciIoWidthUint32, + EfiPciIoWidthUint64, + EfiPciIoWidthFifoUint8, + EfiPciIoWidthFifoUint16, + EfiPciIoWidthFifoUint32, + EfiPciIoWidthFifoUint64, + EfiPciIoWidthFillUint8, + EfiPciIoWidthFillUint16, + EfiPciIoWidthFillUint32, + EfiPciIoWidthFillUint64, + EfiPciIoWidthMaximum +} EFI_PCI_IO_PROTOCOL_WIDTH; + +// +// Complete PCI address generater +// +#define EFI_PCI_IO_PASS_THROUGH_BAR 0xff // Special BAR that passes a memory or I/O cycle through unchanged +#define EFI_PCI_IO_ATTRIBUTE_MASK 0x077f // All the following I/O and Memory cycles +#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 // I/O cycles 0x0000-0x00FF (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 // I/O cycles 0x0100-0x03FF or greater (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 // I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 // MEM cycles 0xA0000-0xBFFFF (24 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 // I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 // I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 // Map a memory range so write are combined +#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 // Enable the I/O decode bit in the PCI Config Header +#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 // Enable the Memory decode bit in the PCI Config Header +#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 // Enable the DMA bit in the PCI Config Header +#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 // Map a memory range so all r/w accesses are cached +#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 // Disable a memory range +#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 // Clear for an add-in PCI Device +#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 // Clear for a physical PCI Option ROM accessed through ROM BAR +#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 // Clear for PCI controllers that can not genrate a DAC +#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 // I/O cycles 0x0100-0x03FF or greater (16 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 // I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x30000 // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode) + +#define EFI_PCI_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER) +#define EFI_VGA_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_IO) + +// +// ******************************************************* +// EFI_PCI_IO_PROTOCOL_OPERATION +// ******************************************************* +// +typedef enum { + EfiPciIoOperationBusMasterRead, + EfiPciIoOperationBusMasterWrite, + EfiPciIoOperationBusMasterCommonBuffer, + EfiPciIoOperationMaximum +} EFI_PCI_IO_PROTOCOL_OPERATION; + +// +// ******************************************************* +// EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION +// ******************************************************* +// +typedef enum { + EfiPciIoAttributeOperationGet, + EfiPciIoAttributeOperationSet, + EfiPciIoAttributeOperationEnable, + EfiPciIoAttributeOperationDisable, + EfiPciIoAttributeOperationSupported, + EfiPciIoAttributeOperationMaximum +} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION; + +/** + Reads from the memory space of a PCI controller. Returns when either the polling exit criteria is + satisfied or after a defined duration. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Width Signifies the width of the memory or I/O operations. + @param BarIndex The BAR index of the standard PCI Configuration header to use as the + base address for the memory operation to perform. + @param Offset The offset within the selected BAR to start the memory operation. + @param Mask Mask used for the polling criteria. + @param Value The comparison value used for the polling exit criteria. + @param Delay The number of 100 ns units to poll. + @param Result Pointer to the last value read from the memory location. + + @retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria. + @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. + @retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller. + @retval EFI_TIMEOUT Delay expired before a match occurred. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN EFI_PCI_IO_PROTOCOL_WIDTH Width, + IN UINT8 BarIndex, + IN UINT64 Offset, + IN UINT64 Mask, + IN UINT64 Value, + IN UINT64 Delay, + OUT UINT64 *Result + ); + +/** + Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Width Signifies the width of the memory or I/O operations. + @param BarIndex The BAR index of the standard PCI Configuration header to use as the + base address for the memory or I/O operation to perform. + @param Offset The offset within the selected BAR to start the memory or I/O operation. + @param Count The number of memory or I/O operations to perform. + @param Buffer For read operations, the destination buffer to store the results. For write + operations, the source buffer to write data from. + + @retval EFI_SUCCESS The data was read from or written to the PCI controller. + @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. + @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not + valid for the PCI BAR specified by BarIndex. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN EFI_PCI_IO_PROTOCOL_WIDTH Width, + IN UINT8 BarIndex, + IN UINT64 Offset, + IN UINTN Count, + IN OUT VOID *Buffer + ); + +typedef struct { + EFI_PCI_IO_PROTOCOL_IO_MEM Read; + EFI_PCI_IO_PROTOCOL_IO_MEM Write; +} EFI_PCI_IO_PROTOCOL_ACCESS; + +/** + Enable a PCI driver to access PCI controller registers in PCI configuration space. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Width Signifies the width of the memory operations. + @param Offset The offset within the PCI configuration space for the PCI controller. + @param Count The number of PCI configuration operations to perform. + @param Buffer For read operations, the destination buffer to store the results. For write + operations, the source buffer to write data from. + + + @retval EFI_SUCCESS The data was read from or written to the PCI controller. + @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not + valid for the PCI configuration header of the PCI controller. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN EFI_PCI_IO_PROTOCOL_WIDTH Width, + IN UINT32 Offset, + IN UINTN Count, + IN OUT VOID *Buffer + ); + +typedef struct { + EFI_PCI_IO_PROTOCOL_CONFIG Read; + EFI_PCI_IO_PROTOCOL_CONFIG Write; +} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS; + +/** + Enables a PCI driver to copy one region of PCI memory space to another region of PCI + memory space. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Width Signifies the width of the memory operations. + @param DestBarIndex The BAR index in the standard PCI Configuration header to use as the + base address for the memory operation to perform. + @param DestOffset The destination offset within the BAR specified by DestBarIndex to + start the memory writes for the copy operation. + @param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the + base address for the memory operation to perform. + @param SrcOffset The source offset within the BAR specified by SrcBarIndex to start + the memory reads for the copy operation. + @param Count The number of memory operations to perform. Bytes moved is Width + size * Count, starting at DestOffset and SrcOffset. + + @retval EFI_SUCCESS The data was copied from one memory region to another memory region. + @retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller. + @retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller. + @retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count + is not valid for the PCI BAR specified by DestBarIndex. + @retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is + not valid for the PCI BAR specified by SrcBarIndex. + @retval EFI_INVALID_PARAMETER Width is invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN EFI_PCI_IO_PROTOCOL_WIDTH Width, + IN UINT8 DestBarIndex, + IN UINT64 DestOffset, + IN UINT8 SrcBarIndex, + IN UINT64 SrcOffset, + IN UINTN Count + ); + +/** + Provides the PCI controller-Cspecific addresses needed to access system memory. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Operation Indicates if the bus master is going to read or write to system memory. + @param HostAddress The system memory address to map to the PCI controller. + @param NumberOfBytes On input the number of bytes to map. On output the number of bytes + that were mapped. + @param DeviceAddress The resulting map address for the bus master PCI controller to use to + access the hosts HostAddress. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_MAP) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN EFI_PCI_IO_PROTOCOL_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +/** + Completes the Map() operation and releases any corresponding resources. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Mapping The mapping value returned from Map(). + + @retval EFI_SUCCESS The range was unmapped. + @retval EFI_DEVICE_ERROR The data was not committed to the target system memory. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN VOID *Mapping + ); + +/** + Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer + mapping. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Type This parameter is not used and must be ignored. + @param MemoryType The type of memory to allocate, EfiBootServicesData or + EfiRuntimeServicesData. + @param Pages The number of pages to allocate. + @param HostAddress A pointer to store the base system memory address of the + allocated range. + @param Attributes The requested bit mask of attributes for the allocated range. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are + MEMORY_WRITE_COMBINE and MEMORY_CACHED. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages, + OUT VOID **HostAddress, + IN UINT64 Attributes + ); + +/** + Frees memory that was allocated with AllocateBuffer(). + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Pages The number of pages to free. + @param HostAddress The base system memory address of the allocated range. + + @retval EFI_SUCCESS The requested memory pages were freed. + @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages + was not allocated with AllocateBuffer(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN UINTN Pages, + IN VOID *HostAddress + ); + +/** + Flushes all PCI posted write transactions from a PCI host bridge to system memory. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + + @retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host + bridge to system memory. + @retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI + host bridge due to a hardware error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH) ( + IN EFI_PCI_IO_PROTOCOL *This + ); + +/** + Retrieves this PCI controller's current PCI bus number, device number, and function number. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param SegmentNumber The PCI controller's current PCI segment number. + @param BusNumber The PCI controller's current PCI bus number. + @param DeviceNumber The PCI controller's current PCI device number. + @param FunctionNumber The PCI controller's current PCI function number. + + @retval EFI_SUCCESS The PCI controller location was returned. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION) ( + IN EFI_PCI_IO_PROTOCOL *This, + OUT UINTN *SegmentNumber, + OUT UINTN *BusNumber, + OUT UINTN *DeviceNumber, + OUT UINTN *FunctionNumber + ); + +/** + Performs an operation on the attributes that this PCI controller supports. The operations include + getting the set of supported attributes, retrieving the current attributes, setting the current + attributes, enabling attributes, and disabling attributes. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Operation The operation to perform on the attributes for this PCI controller. + @param Attributes The mask of attributes that are used for Set, Enable, and Disable + operations. + @param Result A pointer to the result mask of attributes that are returned for the Get + and Supported operations. + + @retval EFI_SUCCESS The operation on the PCI controller's attributes was completed. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_UNSUPPORTED one or more of the bits set in + Attributes are not supported by this PCI controller or one of + its parent bridges when Operation is Set, Enable or Disable. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation, + IN UINT64 Attributes, + OUT UINT64 *Result OPTIONAL + ); + +/** + Gets the attributes that this PCI controller supports setting on a BAR using + SetBarAttributes(), and retrieves the list of resource descriptors for a BAR. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param BarIndex The BAR index of the standard PCI Configuration header to use as the + base address for resource range. The legal range for this field is 0..5. + @param Supports A pointer to the mask of attributes that this PCI controller supports + setting for this BAR with SetBarAttributes(). + @param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current + configuration of this BAR of the PCI controller. + + @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI + controller supports are returned in Supports. If Resources + is not NULL, then the ACPI 2.0 resource descriptors that the PCI + controller is currently using are returned in Resources. + @retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL. + @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate + Resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN UINT8 BarIndex, + OUT UINT64 *Supports, OPTIONAL + OUT VOID **Resources OPTIONAL + ); + +/** + Sets the attributes for a range of a BAR on a PCI controller. + + @param This A pointer to the EFI_PCI_IO_PROTOCOL instance. + @param Attributes The mask of attributes to set for the resource range specified by + BarIndex, Offset, and Length. + @param BarIndex The BAR index of the standard PCI Configuration header to use as the + base address for resource range. The legal range for this field is 0..5. + @param Offset A pointer to the BAR relative base address of the resource range to be + modified by the attributes specified by Attributes. + @param Length A pointer to the length of the resource range to be modified by the + attributes specified by Attributes. + + @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource + range specified by BarIndex, Offset, and Length were + set on the PCI controller, and the actual resource range is returned + in Offset and Length. + @retval EFI_INVALID_PARAMETER Offset or Length is NULL. + @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the + resource range specified by BarIndex, Offset, and + Length. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES) ( + IN EFI_PCI_IO_PROTOCOL *This, + IN UINT64 Attributes, + IN UINT8 BarIndex, + IN OUT UINT64 *Offset, + IN OUT UINT64 *Length + ); + +// +// Interface structure for the PCI I/O Protocol +// +struct _EFI_PCI_IO_PROTOCOL { + EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem; + EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo; + EFI_PCI_IO_PROTOCOL_ACCESS Mem; + EFI_PCI_IO_PROTOCOL_ACCESS Io; + EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci; + EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem; + EFI_PCI_IO_PROTOCOL_MAP Map; + EFI_PCI_IO_PROTOCOL_UNMAP Unmap; + EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer; + EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer; + EFI_PCI_IO_PROTOCOL_FLUSH Flush; + EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation; + EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes; + EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes; + EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes; + UINT64 RomSize; + VOID *RomImage; +}; + +extern EFI_GUID gEfiPciIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/PciRootBridgeIo.h b/MdePkg/Include/Protocol/PciRootBridgeIo.h new file mode 100644 index 0000000000..af3d9ed188 --- /dev/null +++ b/MdePkg/Include/Protocol/PciRootBridgeIo.h @@ -0,0 +1,384 @@ +/** @file + PCI Root Bridge I/O protocol as defined in the EFI 1.1 specification. + + PCI Root Bridge I/O protocol is used by PCI Bus Driver to perform PCI Memory, PCI I/O, + and PCI Configuration cycles on a PCI Root Bridge. It also provides services to perform + defferent types of bus mastering DMA + + 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: PciRootBridgeIo.h + +**/ + +#ifndef __PCI_ROOT_BRIDGE_IO_H__ +#define __PCI_ROOT_BRIDGE_IO_H__ + +#define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \ + { \ + 0x2f707ebb, 0x4a1a, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +typedef struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL; + +typedef enum { + EfiPciWidthUint8, + EfiPciWidthUint16, + EfiPciWidthUint32, + EfiPciWidthUint64, + EfiPciWidthFifoUint8, + EfiPciWidthFifoUint16, + EfiPciWidthFifoUint32, + EfiPciWidthFifoUint64, + EfiPciWidthFillUint8, + EfiPciWidthFillUint16, + EfiPciWidthFillUint32, + EfiPciWidthFillUint64, + EfiPciWidthMaximum +} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH; + +typedef enum { + EfiPciOperationBusMasterRead, + EfiPciOperationBusMasterWrite, + EfiPciOperationBusMasterCommonBuffer, + EfiPciOperationBusMasterRead64, + EfiPciOperationBusMasterWrite64, + EfiPciOperationBusMasterCommonBuffer64, + EfiPciOperationMaximum +} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION; + +#define EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 +#define EFI_PCI_ATTRIBUTE_ISA_IO 0x0002 +#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO 0x0004 +#define EFI_PCI_ATTRIBUTE_VGA_MEMORY 0x0008 +#define EFI_PCI_ATTRIBUTE_VGA_IO 0x0010 +#define EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 +#define EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 +#define EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 +#define EFI_PCI_ATTRIBUTE_MEMORY_CACHED 0x0800 +#define EFI_PCI_ATTRIBUTE_MEMORY_DISABLE 0x1000 +#define EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 + +#define EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER (EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE | EFI_PCI_ATTRIBUTE_MEMORY_CACHED | EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE) + +#define EFI_PCI_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER (~EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER) + +#define EFI_PCI_ADDRESS(bus, dev, func, reg) \ + ((UINT64) ((((UINTN) bus) << 24) + (((UINTN) dev) << 16) + (((UINTN) func) << 8) + ((UINTN) reg))) + +typedef struct { + UINT8 Register; + UINT8 Function; + UINT8 Device; + UINT8 Bus; + UINT32 ExtendedRegister; +} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS; + +/** + Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is + satisfied or after a defined duration. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Width Signifies the width of the memory or I/O operations. + @param Address The base address of the memory or I/O operations. + @param Mask Mask used for the polling criteria. + @param Value The comparison value used for the polling exit criteria. + @param Delay The number of 100 ns units to poll. + @param Result Pointer to the last value read from the memory location. + + @retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria. + @retval EFI_TIMEOUT Delay expired before a match occurred. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, + IN UINT64 Address, + IN UINT64 Mask, + IN UINT64 Value, + IN UINT64 Delay, + OUT UINT64 *Result + ); + +/** + Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Width Signifies the width of the memory operations. + @param Address The base address of the memory operations. + @param Count The number of memory operations to perform. + @param Buffer For read operations, the destination buffer to store the results. For write + operations, the source buffer to write data from. + + @retval EFI_SUCCESS The data was read from or written to the PCI root bridge. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, + IN UINT64 Address, + IN UINTN Count, + IN OUT VOID *Buffer + ); + +typedef struct { + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Read; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Write; +} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS; + +/** + Enables a PCI driver to copy one region of PCI root bridge memory space to another region of PCI + root bridge memory space. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance. + @param Width Signifies the width of the memory operations. + @param DestAddress The destination address of the memory operation. + @param SrcAddress The source address of the memory operation. + @param Count The number of memory operations to perform. + + @retval EFI_SUCCESS The data was copied from one memory region to another memory region. + @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, + IN UINT64 DestAddress, + IN UINT64 SrcAddress, + IN UINTN Count + ); + +/** + Provides the PCI controller-Cspecific addresses required to access system memory from a + DMA bus master. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Operation Indicates if the bus master is going to read or write to system memory. + @param HostAddress The system memory address to map to the PCI controller. + @param NumberOfBytes On input the number of bytes to map. On output the number of bytes + that were mapped. + @param DeviceAddress The resulting map address for the bus master PCI controller to use to + access the hosts HostAddress. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the requested address. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +/** + Completes the Map() operation and releases any corresponding resources. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Mapping The mapping value returned from Map(). + + @retval EFI_SUCCESS The range was unmapped. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map(). + @retval EFI_DEVICE_ERROR The data was not committed to the target system memory. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN VOID *Mapping + ); + +/** + Allocates pages that are suitable for an EfiPciOperationBusMasterCommonBuffer or + EfiPciOperationBusMasterCommonBuffer64 mapping. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Type This parameter is not used and must be ignored. + @param MemoryType The type of memory to allocate, EfiBootServicesData or + EfiRuntimeServicesData. + @param Pages The number of pages to allocate. + @param HostAddress A pointer to store the base system memory address of the + allocated range. + @param Attributes The requested bit mask of attributes for the allocated range. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are + MEMORY_WRITE_COMBINE and MEMORY_CACHED. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages, + IN OUT VOID **HostAddress, + IN UINT64 Attributes + ); + +/** + Frees memory that was allocated with AllocateBuffer(). + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Pages The number of pages to free. + @param HostAddress The base system memory address of the allocated range. + + @retval EFI_SUCCESS The requested memory pages were freed. + @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages + was not allocated with AllocateBuffer(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN UINTN Pages, + IN VOID *HostAddress + ); + +/** + Flushes all PCI posted write transactions from a PCI host bridge to system memory. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + + @retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host + bridge to system memory. + @retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI + host bridge due to a hardware error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This + ); + +/** + Gets the attributes that a PCI root bridge supports setting with SetAttributes(), and the + attributes that a PCI root bridge is currently using. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Supports A pointer to the mask of attributes that this PCI root bridge supports + setting with SetAttributes(). + @param Attributes A pointer to the mask of attributes that this PCI root bridge is currently + using. + + @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI root + bridge supports is returned in Supports. If Attributes is + not NULL, then the attributes that the PCI root bridge is currently + using is returned in Attributes. + @retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + OUT UINT64 *Supports, + OUT UINT64 *Attributes + ); + +/** + Sets attributes for a resource range on a PCI root bridge. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Attributes The mask of attributes to set. + @param ResourceBase A pointer to the base address of the resource range to be modified by the + attributes specified by Attributes. + @param ResourceLength A pointer to the length of the resource range to be modified by the + attributes specified by Attributes. + + @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource + range specified by ResourceBase and ResourceLength + were set on the PCI root bridge, and the actual resource range is + returned in ResuourceBase and ResourceLength. + @retval EFI_UNSUPPORTED A bit is set in Attributes that is not supported by the PCI Root + Bridge. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the + resource range specified by BaseAddress and Length. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + IN UINT64 Attributes, + IN OUT UINT64 *ResourceBase, + IN OUT UINT64 *ResourceLength + ); + +/** + Retrieves the current resource settings of this PCI root bridge in the form of a set of ACPI 2.0 + resource descriptors. + + @param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + @param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current + configuration of this PCI root bridge. + + @retval EFI_SUCCESS The current configuration of this PCI root bridge was returned in + Resources. + @retval EFI_UNSUPPORTED The current configuration of this PCI root bridge could not be + retrieved. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION) ( + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, + OUT VOID **Resources + ); + +struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL { + EFI_HANDLE ParentHandle; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollMem; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollIo; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Mem; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Io; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Pci; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM CopyMem; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP Map; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP Unmap; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER FreeBuffer; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH Flush; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES GetAttributes; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES SetAttributes; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION Configuration; + UINT32 SegmentNumber; +}; + +extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/PlatformDriverOverride.h b/MdePkg/Include/Protocol/PlatformDriverOverride.h new file mode 100644 index 0000000000..1015c50d3e --- /dev/null +++ b/MdePkg/Include/Protocol/PlatformDriverOverride.h @@ -0,0 +1,135 @@ +/** @file + Platform Driver Override protocol as defined in the EFI 1.1 specification. + + 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: PlatformDriverOverride.h + +**/ + +#ifndef __EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_H__ +#define __EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_H__ + +// +// Global ID for the Platform Driver Override Protocol +// +#define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID \ + { \ + 0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL; + +// +// Prototypes for the Platform Driver Override Protocol +// + +/** + Retrieves the image handle of the platform override driver for a controller in the system. + + @param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_ + PROTOCOL instance. + @param ControllerHandle The device handle of the controller to check if a driver override + exists. + @param DriverImageHandle On input, a pointer to the previous driver image handle returned + by GetDriver(). On output, a pointer to the next driver + image handle. + + @retval EFI_SUCCESS The driver override for ControllerHandle was returned in + DriverImageHandle. + @retval EFI_NOT_FOUND A driver override for ControllerHandle was not found. + @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not a valid handle. + @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a + previous call to GetDriver(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER) ( + IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN OUT EFI_HANDLE *DriverImageHandle + ); + +/** + Retrieves the device path of the platform override driver for a controller in the system. + + @param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_ + PROTOCOL instance. + @param ControllerHandle The device handle of the controller to check if a driver override + exists. + @param DriverImageHandle On input, a pointer to the previous driver image handle returned + by GetDriverPath(). On output, a pointer to the next driver + device path. + + @retval EFI_SUCCESS The driver override for ControllerHandle was returned in + DriverImageHandle. + @retval EFI_UNSUPPORTED The operation is not supported. + @retval EFI_NOT_FOUND A driver override for ControllerHandle was not found. + @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not a valid handle. + @retval EFI_INVALID_PARAMETER DriverImagePath is not a device path that was returned on a + previous call to GetDriverPath(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH) ( + IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN OUT EFI_DEVICE_PATH_PROTOCOL **DriverImagePath + ); + +/** + Used to associate a driver image handle with a device path that was returned on a prior call to the + GetDriverPath() service. This driver image handle will then be available through the + GetDriver() service. + + @param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_ + PROTOCOL instance. + @param ControllerHandle The device handle of the controller. + @param DriverImagePath A pointer to the driver device path that was returned in a prior + call to GetDriverPath(). + @param DriverImageHandle The driver image handle that was returned by LoadImage() + when the driver specified by DriverImagePath was loaded + into memory. + + @retval EFI_SUCCESS The association between DriverImagePath and + DriverImageHandle was established for the controller specified + by ControllerHandle. + @retval EFI_UNSUPPORTED The operation is not supported. + @retval EFI_NOT_FOUND DriverImagePath is not a device path that was returned on a prior + call to GetDriverPath() for the controller specified by + ControllerHandle. + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid device handle. + @retval EFI_INVALID_PARAMETER DriverImagePath is not a valid device path. + @retval EFI_INVALID_PARAMETER DriverImageHandle is not a valid image handle. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED) ( + IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_DEVICE_PATH_PROTOCOL *DriverImagePath, + IN EFI_HANDLE DriverImageHandle + ); + +// +// Interface structure for the Platform Driver Override Protocol +// +struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL { + EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER GetDriver; + EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH GetDriverPath; + EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED DriverLoaded; +}; + +extern EFI_GUID gEfiPlatformDriverOverrideProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h b/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h new file mode 100644 index 0000000000..078946e501 --- /dev/null +++ b/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h @@ -0,0 +1,397 @@ +/** @file + The file provides the protocol to retrieve configuration + information for a device that a UEFI driver is about to start. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: PlatformToDriverConfiguration.h + +**/ + +#ifndef __PLATFORM_TO_DRIVER_CONFIGUARTION_H__ +#define __PLATFORM_TO_DRIVER_CONFIGUARTION_H__ + +#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL_GUID \ + { 0x642cd590, 0x8059, 0x4c0a, { 0xa9, 0x58, 0xc5, 0xec, 0x7, 0xd2, 0x3c, 0x4b } } + + +typedef struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL; + + +/** + The UEFI driver must call Query early in the Start() function + before any time consuming operations are performed. If + ChildHandle is NULL the driver is requesting information from + the platform about the ControllerHandle that is being started. + Information returned from Query may lead to the drivers Start() + function failing. If the UEFI driver is a bus driver and + producing a ChildHandle the driver must call Query after the + child handle has been created and an EFI_DEVICE_PATH_PROTOCOL + has been placed on that handle, but before any time consuming + operation is performed. If information return by Query may lead + the driver to decide to not create the ChildHandle. The driver + must then cleanup and remove the ChildHandle from the system. + The UEFI driver repeatedly calls Query, processes the + information returned by the platform, and calls Response passing + in the arguments returned from Query. The Instance value passed + into Response must be the same value returned from the + corresponding call to Query. The UEFI driver must continuously + call Query and Response until EFI_NOT_FOUND is returned by + Query. The only value of Instance that has meaning to the UEFI + driver is zero. An Instance value of zero means return the first + ParameterBlock in the set of unprocessed parameter blocks. If a + ParameterBlock has been processed via a Query and corresponding + Response call it must not be returned again via a Query call. + + @param This A pointer to the + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL + instance. + + @param ControllerHandle The handle the platform will return + configuration information about. + + @param ChildHandle The handle of the child controller to + return information on. This is an optional + parameter that may be NULL. It will be + NULL for device drivers, and for bus + drivers that attempt to get options for + the bus controller. It will not be NULL + for a bus driver that attempts to get + options for one of its child controllers. + + + @param Instance Pointer to the Instance value. On output the + instance associated with the parameter data + return. On input zero means return the first + query data or pass in a valid instance + number returned from a previous call to + Query. + + @param ParameterTypeGuid An EFI_GUID that defines the + contents of ParameterBlock. UEFI + drivers must use the + ParameterTypeGuid to determine how + to parser the ParameterBlock. + + @param ParameterBlock The platform returns a pointer to the + ParameterBlock structure which + contains details about the + configuration parameters specific to + the ParameterTypeGuid. This structure + is defined based on the protocol and + may be different for different + protocols. UEFI driver decodes this + structure and its contents based on + ProtocolGuid. ParameterBlock is + allocated by the platform and the + platform is responsible for freeing + the ParameterBlock after Result is + called. + + @param ParameterBlockSize The platform returns the size of + the ParameterBlock in bytes. + + + @retval EFI_SUCCESS The platform return parameter + information for ControllerHandle. + + @retval EFI_NOT_FOUND No more unread Instance exists. + + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid + EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER Instance is NULL. + + @retval EFI_DEVICE_ERROR A device error occurred while + attempting to return parameter block + information for the controller + specified by ControllerHandle and + ChildHandle. + + @retval EFI_OUT_RESOURCES There are not enough resources + available to set the configuration + options for the controller specified + by ControllerHandle and ChildHandle. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY) ( + IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This, + IN CONST EFI_HANDLE ControllerHandle, + IN CONST EFI_HANDLE ChildHandle OPTIONAL, + IN OUT UINTN *Instance, + IN OUT EFI_GUID **ParameterTypeGuid, + IN OUT VOID **ParameterBlock, + IN OUT UINTN *ParameterBlockSize +); + +/** + + @param EfiPlatformConfigurationActionNone + The controller specified by ControllerHandle is still + in a usable state, it's configuration has been updated + via parsing the ParameterBlock. If required by the + parameter block and the module supports an NVRAM store + the configuration information from PB was successfully + saved to the NVRAM. No actions are required before + this controller can be used again with the updated + configuration settings. + + + @param EfiPlatformConfigurationStopController + The driver has detected that the controller specified + by ControllerHandle is not in a usable state, and it + needs to be stopped. The calling agent can use the + DisconnectControservice to perform this operation, and + it should be performed as soon as possible. + + @param EfiPlatformConfigurationRestartController + This controller specified by ControllerHandle needs to + be stopped and restarted before it can be used again. + The calling agent can use the DisconnectController() + and ConnectController() services to perform this + operation. The restart operation can be delayed until + all of the configuratiooptions have been set. + + + @param EfiPlatformConfigurationRestartPlatform + A configuration change has been made that requires the + platform to be restarted before the controller + specified by ControllerHandle can be used again. The + calling agent can use the ResetSystem() services to + perform this operation. The restart operation can be + delayed until all of the configuration options have + been set. + + @param EfiPlatformConfigurationActionNvramFailed + The controller specified by ControllerHandle is still + in a usable state; its configuration has been updated + via parsing the ParameterBlock. The driver tried to + update the driver's private NVRAM store with + information from ParameterBlock and failed. No actions + are required before this controller can be used again + with the updated configuration settings, but these + configuration settings are not guaranteed to persist + after ControllerHandle is stopped. + +**/ +typedef enum { + EfiPlatformConfigurationActionNone = 0, + EfiPlatformConfigurationActionStopController = 1, + EfiPlatformConfigurationActionRestartController = 2, + EfiPlatformConfigurationActionRestartPlatform = 3, + EfiPlatformConfigurationActionNvramFailed = 4, + EfiPlatformConfigurationActionMaximum +} EFI_PLATFORM_CONFIGURATION_ACTION; + + +/** + The UEFI driver repeatedly calls Query, processes the + information returned by the platform, and calls Response passing + in the arguments returned from Query. The UEFI driver must + continuously call Query until EFI_NOT_FOUND is returned. For + every call to Query that returns EFI_SUCCESS a corrisponding + call to Response is required passing in the same + ContollerHandle, ChildHandle, Instance, ParameterTypeGuid, + ParameterBlock, and ParameterBlockSize. The UEFI driver may + update values in ParameterBlock based on rules defined by + ParameterTypeGuid. The platform is responsible for freeing + ParameterBlock and the UEFI driver must not try to free it + + @param This A pointer to the + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL + instance. + + @param ControllerHandle The handle the driver is returning + configuration information about. + + @param ChildHandle The handle of the child controller to + return information on. This is an optional + parameter that may be NULL. It will be + NULL for device drivers, and for bus + drivers that attempt to get options for + the bus controller. It will not be NULL + for a bus driver that attempts to get + options for one of its child controllers. + Instance Instance data returned from + Query(). + + @param ParameterTypeGuid ParameterTypeGuid returned from + Query. + + @param ParameterBlock ParameterBlock returned from Query. + + @param ParameterBlockSize The ParameterBlock size returned + from Query. + + @param Configuration ActionThe driver tells the platform what + action is required for ParameterBlock to + take effect. + + + @retval EFI_SUCCESS The platform return parameter information + for ControllerHandle. + + @retval EFI_NOT_FOUND Instance was not found. + + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid + EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER Instance is zero. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE) ( + IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This, + IN CONST EFI_HANDLE ControllerHandle, + IN CONST EFI_HANDLE ChildHandle OPTIONAL, + IN CONST UINTN *Instance, + IN CONST EFI_GUID *ParameterTypeGuid, + IN CONST VOID *ParameterBlock, + IN CONST UINTN ParameterBlockSize , + IN CONST EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction +); + + +/** + The EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is used by the + UEFI driver to query the platform for configuration information. + The UEFI driver calls Query() multiple times to get + configuration information from the platform. For every call to + Query() there must be a matching call to Response() so the + UEFI driver can inform the platform how it used the + information passed in from Query(). It¡¯s legal for a UEFI + driver to use Response() to inform the platform it does not + understand the data returned via Query() and thus no action was + taken. + + @param Query Called by the UEFI Driver Start() function to + get configuration information from the + platform. + + @param Response Called by the UEFI Driver Start() function + to let the platform know how UEFI driver + processed the data return from Query. + + +**/ +struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL { + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY Query; + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE Response; +}; + + + +#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_CLP_GUID \ + {0x345ecc0e, 0xcb6, 0x4b75, { 0xbb, 0x57, 0x1b, 0x12, 0x9c, 0x47, 0x33,0x3e } } + +/** + + ParameterTypeGuid provides the support for parameters + communicated through the DMTF SM CLP Specification 1.0 Final + Standard to be used to configure the UEFI driver. In this + section the producer of the + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is platform + firmware and the consumer is the UEFI driver. Note: if future + versions of the DMTF SM CLP Specification require changes to the + parameter block definition, newer ParameterTypeGuid will be + used. + + @param CLPCommand A pointer to the DMTF SM CLP command line + null-terminated string that the driver is + required to parse and process when this + EFI_SUCCESS The platform return parameter + information for ControllerHandle. + EFI_NOT_FOUND Instance was not found. + EFI_INVALID_PARAMETER ControllerHandle is + not a valid EFI_HANDLE. + EFI_INVALID_PARAMETER Instance is zero. + function is called. See the DMTF SM CLP + Specification 1.0 Final Standard for + details on the format and syntax of the + CLP command line string. CLPCommand buffer + is allocated by the producer of the + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOOL. + + @param CLPCommandLength The length of the CLP Command in + bytes. + + @param CLPReturnString A pointer to the CLP return status + string that the driver is required to + provide to the calling agent. The + calling agent may parse and/ or pass + this for processing and user feedback. + The SM CLP Command Response string + buffer is filled in by the UEFI driver + in the "keyword=value" format + described in the SM CLP Specification, + unless otherwise requested via the SM + CLP Coutput option in the Command Line + string buffer. UEFI driver's support + for this default "keyword=value" + output format is required if the UEFI + driver supports this protocol, while + support for other SM CLP output + formats is optional (the UEFI Driver + should return an EFI_UNSUPPORTED if + the SM CLP Coutput option requested by + the caller is not supported by the + UEFI Driver). CLPReturnString buffer + is allocated by the consumer of the + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC + OL and undefined prior to the call to + Response(). + + @param CLPReturnStringLength The length of the CLP return + status string in bytes. + + @param CLPReturnStatus SM CLP Command Status (see DMTF SM CLP + Specification 1.0 Final Standard - + Table 4) CLPErrorValue SM CLP + Processing Error Value (see DMTF SM + CLP Specification 1.0 Final Standard - + Table 6). This field is filled in by + the consumer of the + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC + OL and undefined prior to the call to + Response(). + + @param CLPMessageCode Bit 15: OEM Message Code Flag 0 = + Message Code is an SM CLP Probable + Cause Value. (see SM CLP Specification + Table 11) 1 = Message Code is OEM + Specific Bits 14-0: Message Code This + field is filled in by the consumer of + the + EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC + OL and undefined prior to the call to + Response(). + +**/ +typedef struct { + CHAR8 *CLPCommand; + UINT32 CLPCommandLength; + CHAR8 *CLPReturnString; + UINT32 CLPReturnStringLength; + UINT8 CLPCmdStatus; + UINT8 CLPErrorValue; + UINT16 CLPMsgCode; +} EFI_CONFIGURE_CLP_PARAMETER_BLK; + + + +extern EFI_GUID gEfiPlatformToDriverConfigurationClpGuid; + +extern EFI_GUID gEfiPlatformToDriverConfigurationProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h new file mode 100644 index 0000000000..7fb2a80c42 --- /dev/null +++ b/MdePkg/Include/Protocol/PxeBaseCode.h @@ -0,0 +1,622 @@ +/** @file + EFI PXE Base Code Protocol definitions. + + 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: PxeBaseCode.h + +**/ +#ifndef __PXE_BASE_CODE_PROTOCOL_H__ +#define __PXE_BASE_CODE_PROTOCOL_H__ + +// +// PXE Base Code protocol +// +#define EFI_PXE_BASE_CODE_PROTOCOL_GUID \ + { \ + 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +typedef struct _EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE_PROTOCOL; + +// +// Default IP TTL and ToS. +// +#define DEFAULT_TTL 16 +#define DEFAULT_ToS 0 + +// +// ICMP error format +// +typedef struct { + UINT8 Type; + UINT8 Code; + UINT16 Checksum; + union { + UINT32 reserved; + UINT32 Mtu; + UINT32 Pointer; + struct { + UINT16 Identifier; + UINT16 Sequence; + } Echo; + } u; + UINT8 Data[494]; +} EFI_PXE_BASE_CODE_ICMP_ERROR; + +// +// TFTP error format +// +typedef struct { + UINT8 ErrorCode; + CHAR8 ErrorString[127]; +} EFI_PXE_BASE_CODE_TFTP_ERROR; + +// +// IP Receive Filter definitions +// +#define EFI_PXE_BASE_CODE_MAX_IPCNT 8 + +typedef struct { + UINT8 Filters; + UINT8 IpCnt; + UINT16 reserved; + EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT]; +} EFI_PXE_BASE_CODE_IP_FILTER; + +#define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001 +#define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002 +#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004 +#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008 + +// +// ARP Cache definitions +// +typedef struct { + EFI_IP_ADDRESS IpAddr; + EFI_MAC_ADDRESS MacAddr; +} EFI_PXE_BASE_CODE_ARP_ENTRY; + +typedef struct { + EFI_IP_ADDRESS IpAddr; + EFI_IP_ADDRESS SubnetMask; + EFI_IP_ADDRESS GwAddr; +} EFI_PXE_BASE_CODE_ROUTE_ENTRY; + +// +// UDP definitions +// +typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT; + +#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001 +#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002 +#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004 +#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008 +#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010 +#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020 + +// +// Discover() definitions +// +#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15 +#define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16 +// +// 17 through 32767 are reserved +// 32768 through 65279 are for vendor use +// 65280 through 65534 are reserved +// +#define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535 + +#define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF +#define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000 + +// +// Discover() server list structure. +// +typedef struct { + UINT16 Type; + BOOLEAN AcceptAnyResponse; + UINT8 Reserved; + EFI_IP_ADDRESS IpAddr; +} EFI_PXE_BASE_CODE_SRVLIST; + +// +// Discover() information override structure. +// +typedef struct { + BOOLEAN UseMCast; + BOOLEAN UseBCast; + BOOLEAN UseUCast; + BOOLEAN MustUseList; + EFI_IP_ADDRESS ServerMCastIp; + UINT16 IpCnt; + EFI_PXE_BASE_CODE_SRVLIST SrvList[1]; +} EFI_PXE_BASE_CODE_DISCOVER_INFO; + +// +// Mtftp() definitions +// +typedef enum { + EFI_PXE_BASE_CODE_TFTP_FIRST, + EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, + EFI_PXE_BASE_CODE_TFTP_READ_FILE, + EFI_PXE_BASE_CODE_TFTP_WRITE_FILE, + EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY, + EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE, + EFI_PXE_BASE_CODE_MTFTP_READ_FILE, + EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY, + EFI_PXE_BASE_CODE_MTFTP_LAST +} EFI_PXE_BASE_CODE_TFTP_OPCODE; + +typedef struct { + EFI_IP_ADDRESS MCastIp; + EFI_PXE_BASE_CODE_UDP_PORT CPort; + EFI_PXE_BASE_CODE_UDP_PORT SPort; + UINT16 ListenTimeout; + UINT16 TransmitTimeout; +} EFI_PXE_BASE_CODE_MTFTP_INFO; + +// +// PXE Base Code Mode structure +// +#define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 +#define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 + +typedef struct { + BOOLEAN Started; + BOOLEAN Ipv6Available; + BOOLEAN Ipv6Supported; + BOOLEAN UsingIpv6; + BOOLEAN BisSupported; + BOOLEAN BisDetected; + BOOLEAN AutoArp; + BOOLEAN SendGUID; + BOOLEAN DhcpDiscoverValid; + BOOLEAN DhcpAckReceived; + BOOLEAN ProxyOfferReceived; + BOOLEAN PxeDiscoverValid; + BOOLEAN PxeReplyReceived; + BOOLEAN PxeBisReplyReceived; + BOOLEAN IcmpErrorReceived; + BOOLEAN TftpErrorReceived; + BOOLEAN MakeCallbacks; + UINT8 TTL; + UINT8 ToS; + EFI_IP_ADDRESS StationIp; + EFI_IP_ADDRESS SubnetMask; + EFI_PXE_BASE_CODE_PACKET DhcpDiscover; + EFI_PXE_BASE_CODE_PACKET DhcpAck; + EFI_PXE_BASE_CODE_PACKET ProxyOffer; + EFI_PXE_BASE_CODE_PACKET PxeDiscover; + EFI_PXE_BASE_CODE_PACKET PxeReply; + EFI_PXE_BASE_CODE_PACKET PxeBisReply; + EFI_PXE_BASE_CODE_IP_FILTER IpFilter; + UINT32 ArpCacheEntries; + EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES]; + UINT32 RouteTableEntries; + EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES]; + EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError; + EFI_PXE_BASE_CODE_TFTP_ERROR TftpError; +} EFI_PXE_BASE_CODE_MODE; + +// +// PXE Base Code Interface Function definitions +// + +/** + Enables the use of the PXE Base Code Protocol functions. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param UseIpv6 Specifies the type of IP addresses that are to be used during the session + that is being started. Set to TRUE for IPv6 addresses, and FALSE for + IPv4 addresses. + + @retval EFI_SUCCESS The PXE Base Code Protocol was started. + @retval EFI_DEVICE_ERROR The network device encountered an error during this oper + @retval EFI_UNSUPPORTED UseIpv6 is TRUE, but the Ipv6Supported field of the + EFI_PXE_BASE_CODE_MODE structure is FALSE. + @retval EFI_ALREADY_STARTED The PXE Base Code Protocol is already in the started state. + @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid + EFI_PXE_BASE_CODE_PROTOCOL structure. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough memory or other resources to start the + PXE Base Code Protocol. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_START) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN BOOLEAN UseIpv6 + ); + +/** + Disables the use of the PXE Base Code Protocol functions. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + + @retval EFI_SUCCESS The PXE Base Code Protocol was stopped. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is already in the stopped state. + @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid + EFI_PXE_BASE_CODE_PROTOCOL structure. + @retval EFI_DEVICE_ERROR The network device encountered an error during this operation. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_STOP) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This + ); + +/** + Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request / acknowledge) or DHCPv6 + S.A.R.R (solicit / advertise / request / reply) sequence. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param SortOffers TRUE if the offers received should be sorted. Set to FALSE to try the + offers in the order that they are received. + + @retval EFI_SUCCESS Valid DHCP has completed. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid + EFI_PXE_BASE_CODE_PROTOCOL structure. + @retval EFI_DEVICE_ERROR The network device encountered an error during this operation. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete the DHCP Protocol. + @retval EFI_ABORTED The callback function aborted the DHCP Protocol. + @retval EFI_TIMEOUT The DHCP Protocol timed out. + @retval EFI_ICMP_ERROR An ICMP error packet was received during the DHCP session. + @retval EFI_NO_RESPONSE Valid PXE offer was not received. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_DHCP) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN BOOLEAN SortOffers + ); + +/** + Attempts to complete the PXE Boot Server and/or boot image discovery sequence. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param Type The type of bootstrap to perform. + @param Layer Pointer to the boot server layer number to discover, which must be + PXE_BOOT_LAYER_INITIAL when a new server type is being + discovered. + @param UseBis TRUE if Boot Integrity Services are to be used. FALSE otherwise. + @param Info Pointer to a data structure that contains additional information on the + type of discovery operation that is to be performed. + + @retval EFI_SUCCESS The Discovery sequence has been completed. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_DEVICE_ERROR The network device encountered an error during this operation. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete Discovery. + @retval EFI_ABORTED The callback function aborted the Discovery sequence. + @retval EFI_TIMEOUT The Discovery sequence timed out. + @retval EFI_ICMP_ERROR An ICMP error packet was received during the PXE discovery + session. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN UINT16 Type, + IN UINT16 *Layer, + IN BOOLEAN UseBis, + IN EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL + ); + +/** + Used to perform TFTP and MTFTP services. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param Operation The type of operation to perform. + @param BufferPtr A pointer to the data buffer. + @param Overwrite Only used on write file operations. TRUE if a file on a remote server can + be overwritten. + @param BufferSize For get-file-size operations, *BufferSize returns the size of the + requested file. + @param BlockSize The requested block size to be used during a TFTP transfer. + @param ServerIp The TFTP / MTFTP server IP address. + @param Filename A Null-terminated ASCII string that specifies a directory name or a file + name. + @param Info Pointer to the MTFTP information. + @param DontUseBuffer Set to FALSE for normal TFTP and MTFTP read file operation. + + @retval EFI_SUCCESS The TFTP/MTFTP operation was completed. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_DEVICE_ERROR The network device encountered an error during this operation. + @retval EFI_BUFFER_TOO_SMALL The buffer is not large enough to complete the read operation. + @retval EFI_ABORTED The callback function aborted the TFTP/MTFTP operation. + @retval EFI_TIMEOUT The TFTP/MTFTP operation timed out. + @retval EFI_ICMP_ERROR An ICMP error packet was received during the MTFTP session. + @retval EFI_TFTP_ERROR A TFTP error packet was received during the MTFTP session. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_MTFTP) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, + IN OUT VOID *BufferPtr OPTIONAL, + IN BOOLEAN Overwrite, + IN OUT UINT64 *BufferSize, + IN UINTN *BlockSize OPTIONAL, + IN EFI_IP_ADDRESS *ServerIp, + IN UINT8 *Filename OPTIONAL, + IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL, + IN BOOLEAN DontUseBuffer + ); + +/** + Writes a UDP packet to the network interface. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param OpFlags The UDP operation flags. + @param DestIp The destination IP address. + @param DestPort The destination UDP port number. + @param GatewayIp The gateway IP address. + @param SrcIp The source IP address. + @param SrcPort The source UDP port number. + @param HeaderSize An optional field which may be set to the length of a header at + HeaderPtr to be prefixed to the data at BufferPtr. + @param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the + data at BufferPtr. + @param BufferSize A pointer to the size of the data at BufferPtr. + @param BufferPtr A pointer to the data to be written. + + @retval EFI_SUCCESS The UDP Write operation was completed. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_BAD_BUFFER_SIZE The buffer is too long to be transmitted. + @retval EFI_ABORTED The callback function aborted the UDP Write operation. + @retval EFI_TIMEOUT The UDP Write operation timed out. + @retval EFI_ICMP_ERROR An ICMP error packet was received during the UDP write session. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN UINT16 OpFlags, + IN EFI_IP_ADDRESS *DestIp, + IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort, + IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL + IN EFI_IP_ADDRESS *SrcIp, OPTIONAL + IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL + IN UINTN *HeaderSize, OPTIONAL + IN VOID *HeaderPtr, OPTIONAL + IN UINTN *BufferSize, + IN VOID *BufferPtr + ); + +/** + Reads a UDP packet from the network interface. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param OpFlags The UDP operation flags. + @param DestIp The destination IP address. + @param DestPort The destination UDP port number. + @param GatewayIp The gateway IP address. + @param SrcIp The source IP address. + @param SrcPort The source UDP port number. + @param HeaderSize An optional field which may be set to the length of a header at + HeaderPtr to be prefixed to the data at BufferPtr. + @param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the + data at BufferPtr. + @param BufferSize A pointer to the size of the data at BufferPtr. + @param BufferPtr A pointer to the data to be read. + + @retval EFI_SUCCESS The UDP Write operation was completed. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_DEVICE_ERROR The network device encountered an error during this operation. + @retval EFI_BUFFER_TOO_SMALL The packet is larger than Buffer can hold. + @retval EFI_ABORTED The callback function aborted the UDP Read operation. + @retval EFI_TIMEOUT The UDP Read operation timed out. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN UINT16 OpFlags, + IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL + IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL + IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL + IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL + IN UINTN *HeaderSize, OPTIONAL + IN VOID *HeaderPtr, OPTIONAL + IN OUT UINTN *BufferSize, + IN VOID *BufferPtr + ); + +/** + Updates the IP receive filters of a network device and enables software filtering. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param NewFilter Pointer to the new set of IP receive filters. + + @retval EFI_SUCCESS The IP receive filter settings were updated. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter + ); + +/** + Uses the ARP protocol to resolve a MAC address. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param IpAddr Pointer to the IP address that is used to resolve a MAC address. + @param MacAddr If not NULL, a pointer to the MAC address that was resolved with the + ARP protocol. + + @retval EFI_SUCCESS The IP or MAC address was resolved. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_DEVICE_ERROR The network device encountered an error during this operation. + @retval EFI_ABORTED The callback function aborted the ARP Protocol. + @retval EFI_TIMEOUT The ARP Protocol encountered a timeout condition. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_ARP) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN EFI_IP_ADDRESS *IpAddr, + IN EFI_MAC_ADDRESS *MacAddr OPTIONAL + ); + +/** + Updates the parameters that affect the operation of the PXE Base Code Protocol. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param NewAutoArp If not NULL, a pointer to a value that specifies whether to replace the + current value of AutoARP. + @param NewSendGUID If not NULL, a pointer to a value that specifies whether to replace the + current value of SendGUID. + @param NewTTL If not NULL, a pointer to be used in place of the current value of TTL, + the "time to live" field of the IP header. + @param NewToS If not NULL, a pointer to be used in place of the current value of ToS, + the "type of service" field of the IP header. + @param NewMakeCallback If not NULL, a pointer to a value that specifies whether to replace the + current value of the MakeCallback field of the Mode structure. + + @retval EFI_SUCCESS The new parameters values were updated. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN BOOLEAN *NewAutoArp, OPTIONAL + IN BOOLEAN *NewSendGUID, OPTIONAL + IN UINT8 *NewTTL, OPTIONAL + IN UINT8 *NewToS, OPTIONAL + IN BOOLEAN *NewMakeCallback OPTIONAL + ); + +/** + Updates the station IP address and/or subnet mask values of a network device. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param NewStationIp Pointer to the new IP address to be used by the network device. + @param NewSubnetMask Pointer to the new subnet mask to be used by the network device. + + @retval EFI_SUCCESS The new station IP address and/or subnet mask were updated. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL + IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL + ); + +/** + Updates the contents of the cached DHCP and Discover packets. + + @param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance. + @param NewDhcpDiscoverValid Pointer to a value that will replace the current + DhcpDiscoverValid field. + @param NewDhcpAckReceived Pointer to a value that will replace the current + DhcpAckReceived field. + @param NewProxyOfferReceived Pointer to a value that will replace the current + ProxyOfferReceived field. + @param NewPxeDiscoverValid Pointer to a value that will replace the current + ProxyOfferReceived field. + @param NewPxeReplyReceived Pointer to a value that will replace the current + PxeReplyReceived field. + @param NewPxeBisReplyReceived Pointer to a value that will replace the current + PxeBisReplyReceived field. + @param NewDhcpDiscover Pointer to the new cached DHCP Discover packet contents. + @param NewDhcpAck Pointer to the new cached DHCP Ack packet contents. + @param NewProxyOffer Pointer to the new cached Proxy Offer packet contents. + @param NewPxeDiscover Pointer to the new cached PXE Discover packet contents. + @param NewPxeReply Pointer to the new cached PXE Reply packet contents. + @param NewPxeBisReply Pointer to the new cached PXE BIS Reply packet contents. + + @retval EFI_SUCCESS The cached packet contents were updated. + @retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state. + @retval EFI_INVALID_PARAMETER This is NULL or not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) ( + IN EFI_PXE_BASE_CODE_PROTOCOL *This, + BOOLEAN *NewDhcpDiscoverValid, OPTIONAL + BOOLEAN *NewDhcpAckReceived, OPTIONAL + BOOLEAN *NewProxyOfferReceived, OPTIONAL + BOOLEAN *NewPxeDiscoverValid, OPTIONAL + BOOLEAN *NewPxeReplyReceived, OPTIONAL + BOOLEAN *NewPxeBisReplyReceived, OPTIONAL + IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL + IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL + IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL + IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL + IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL + IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL + ); + +// +// PXE Base Code Protocol structure +// +#define EFI_PXE_BASE_CODE_INTERFACE_REVISION 0x00010000 +#define EFI_PXE_BASE_CODE_PROTOCOL_REVISION EFI_PXE_BASE_CODE_INTERFACE_REVISION + +struct _EFI_PXE_BASE_CODE_PROTOCOL { + UINT64 Revision; + EFI_PXE_BASE_CODE_START Start; + EFI_PXE_BASE_CODE_STOP Stop; + EFI_PXE_BASE_CODE_DHCP Dhcp; + EFI_PXE_BASE_CODE_DISCOVER Discover; + EFI_PXE_BASE_CODE_MTFTP Mtftp; + EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite; + EFI_PXE_BASE_CODE_UDP_READ UdpRead; + EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter; + EFI_PXE_BASE_CODE_ARP Arp; + EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters; + EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp; + EFI_PXE_BASE_CODE_SET_PACKETS SetPackets; + EFI_PXE_BASE_CODE_MODE *Mode; +}; + +extern EFI_GUID gEfiPxeBaseCodeProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h b/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h new file mode 100644 index 0000000000..7f16701367 --- /dev/null +++ b/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h @@ -0,0 +1,94 @@ +/** @file + EFI PXE Base Code CallBack 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: PxeBaseCodeCallBack.h + +**/ + +#ifndef _PXE_BASE_CODE_CALLBACK_H_ +#define _PXE_BASE_CODE_CALLBACK_H_ + +// +// Call Back Definitions +// +#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID \ + { \ + 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +// +// Revision Number +// +#define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION 0x00010000 +#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION \ + EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION + +// +// Protocol definition +// +typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL; + +typedef enum { + EFI_PXE_BASE_CODE_FUNCTION_FIRST, + EFI_PXE_BASE_CODE_FUNCTION_DHCP, + EFI_PXE_BASE_CODE_FUNCTION_DISCOVER, + EFI_PXE_BASE_CODE_FUNCTION_MTFTP, + EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE, + EFI_PXE_BASE_CODE_FUNCTION_UDP_READ, + EFI_PXE_BASE_CODE_FUNCTION_ARP, + EFI_PXE_BASE_CODE_FUNCTION_IGMP, + EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST +} EFI_PXE_BASE_CODE_FUNCTION; + +typedef enum { + EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST, + EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, + EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT, + EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST +} EFI_PXE_BASE_CODE_CALLBACK_STATUS; + +/** + Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has + received, or is waiting to receive a packet. + + @param This Pointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance. + @param Function The PXE Base Code Protocol function that is waiting for an event. + @param Received TRUE if the callback is being invoked due to a receive event. FALSE if + the callback is being invoked due to a transmit event. + @param PacketLen The length, in bytes, of Packet. This field will have a value of zero if + this is a wait for receive event. + @param Packet If Received is TRUE, a pointer to the packet that was just received; + otherwise a pointer to the packet that is about to be transmitted. + + @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation + @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT if Function specifies an abort operation + +**/ +typedef +EFI_PXE_BASE_CODE_CALLBACK_STATUS +(EFIAPI *EFI_PXE_CALLBACK)( + IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *This, + IN EFI_PXE_BASE_CODE_FUNCTION Function, + IN BOOLEAN Received, + IN UINT32 PacketLen, + IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL + ); + +struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL { + UINT64 Revision; + EFI_PXE_CALLBACK Callback; +}; + +extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/RealTimeClock.h b/MdePkg/Include/Protocol/RealTimeClock.h new file mode 100644 index 0000000000..dc968e1666 --- /dev/null +++ b/MdePkg/Include/Protocol/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/Protocol/Reset.h b/MdePkg/Include/Protocol/Reset.h new file mode 100644 index 0000000000..80befae95f --- /dev/null +++ b/MdePkg/Include/Protocol/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/Protocol/Runtime.h b/MdePkg/Include/Protocol/Runtime.h new file mode 100644 index 0000000000..1f7504a9fc --- /dev/null +++ b/MdePkg/Include/Protocol/Runtime.h @@ -0,0 +1,126 @@ +/** @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.91. + +**/ + +#ifndef __ARCH_PROTOCOL_RUNTIME_H__ +#define __ARCH_PROTOCOL_RUNTIME_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 } } + +typedef struct _EFI_RUNTIME_ARCH_PROTOCOL EFI_RUNTIME_ARCH_PROTOCOL; + +// +// LIST_ENTRY from BaseType +// +typedef LIST_ENTRY EFI_LIST_ENTRY; + +typedef struct _EFI_RUNTIME_IMAGE_ENTRY EFI_RUNTIME_IMAGE_ENTRY; + +struct _EFI_RUNTIME_IMAGE_ENTRY { + VOID *ImageBase; + UINT64 ImageSize; + VOID *RelocationData; + EFI_HANDLE Handle; + EFI_LIST_ENTRY Link; +}; + +typedef struct _EFI_RUNTIME_EVENT_ENTRY EFI_RUNTIME_EVENT_ENTRY; + +struct _EFI_RUNTIME_EVENT_ENTRY { + UINT32 Type; + EFI_TPL NotifyTpl; + EFI_EVENT_NOTIFY NotifyFunction; + VOID *NotifyContext; + EFI_EVENT *Event; + EFI_LIST_ENTRY Link; +}; + +// +// Interface stucture for the Runtime Architectural Protocol +// +/** + @par 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. + + @param ImageHead + A list of type EFI_RUNTIME_IMAGE_ENTRY. + + @param EventHead + A list of type EFI_RUNTIME_EVENT_ENTRY. + + @param MemoryDescriptorSize + Size of a memory descriptor that is return by GetMemoryMap(). + + @param MemoryDescriptorVersion + Version of a memory descriptor that is return by GetMemoryMap(). + + @param MemoryMapSize + Size of the memory map in bytes contained in MemoryMapPhysical and MemoryMapVirtual. + + @param MemoryMapPhysical + Pointer to a runtime buffer that contains a copy of + the memory map returned via GetMemoryMap(). + + @param MemoryMapVirtual + Pointer to MemoryMapPhysical that is updated to virtual mode after SetVirtualAddressMap(). + + @param VirtualMode + Boolean that is TRUE if SetVirtualAddressMap() has been called. + + @param AtRuntime + Boolean that is TRUE if ExitBootServices () has been called. + +**/ +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; +}; + +extern EFI_GUID gEfiRuntimeArchProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/ScsiIo.h b/MdePkg/Include/Protocol/ScsiIo.h new file mode 100644 index 0000000000..e1019bac44 --- /dev/null +++ b/MdePkg/Include/Protocol/ScsiIo.h @@ -0,0 +1,233 @@ +/** @file + EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0. + + 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: ScsiIo.h + +**/ + +#ifndef __EFI_SCSI_IO_PROTOCOL_H__ +#define __EFI_SCSI_IO_PROTOCOL_H__ + +#define EFI_SCSI_IO_PROTOCOL_GUID \ + { \ + 0x932f4736, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL; + +// +// SCSI Data Direction definition +// +#define EFI_SCSI_IO_DATA_DIRECTION_READ 0 +#define EFI_SCSI_IO_DATA_DIRECTION_WRITE 1 +#define EFI_SCSI_IO_DATA_DIRECTION_BIDIRECTIONAL 2 + +// +// SCSI Host Adapter Status definition +// +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK 0x00 +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure +#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER 0x7f + + +// +// SCSI Target Status definition +// +#define EFI_SCSI_IO_STATUS_TARGET_GOOD 0x00 +#define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition +#define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET 0x04 // condition met +#define EFI_SCSI_IO_STATUS_TARGET_BUSY 0x08 // busy +#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate +#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met +#define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict +#define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated +#define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL 0x28 // queue full + +typedef struct { + UINT64 Timeout; + VOID *InDataBuffer; + VOID *OutDataBuffer; + VOID *SenseData; + VOID *Cdb; + UINT32 InTransferLength; + UINT32 OutTransferLength; + UINT8 CdbLength; + UINT8 DataDirection; + UINT8 HostAdapterStatus; + UINT8 TargetStatus; + UINT8 SenseDataLength; +} EFI_SCSI_IO_SCSI_REQUEST_PACKET; + +/** + Retrieves the device type information of the SCSI Controller. + + @param This Protocol instance pointer. + @param DeviceType A pointer to the device type information + retrieved from the SCSI Controller. + + @retval EFI_SUCCESS Retrieves the device type information successfully. + @retval EFI_INVALID_PARAMETER The DeviceType is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE) ( + IN EFI_SCSI_IO_PROTOCOL *This, + OUT UINT8 *DeviceType + ) +; + +/** + Retrieves the device location in the SCSI channel. + + @param This Protocol instance pointer. + @param Target A pointer to the Target ID of a SCSI device + on the SCSI channel. + @param Lun A pointer to the LUN of the SCSI device on + the SCSI channel. + + @retval EFI_SUCCESS Retrieves the device location successfully. + @retval EFI_INVALID_PARAMETER The Target or Lun is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION) ( + IN EFI_SCSI_IO_PROTOCOL *This, + IN OUT UINT8 **Target, + OUT UINT64 *Lun + ) +; + +/** + Resets the SCSI Bus that the SCSI Controller is attached to. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The SCSI bus is reset successfully. + @retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus. + @retval EFI_UNSUPPORTED The bus reset operation is not supported by the + SCSI Host Controller. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset + the SCSI bus. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS) ( + IN EFI_SCSI_IO_PROTOCOL *This + ) +; + +/** + Resets the SCSI Controller that the device handle specifies. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS Reset the SCSI controller successfully. + @retval EFI_DEVICE_ERROR Errors are encountered when resetting the + SCSI Controller. + @retval EFI_UNSUPPORTED The SCSI bus does not support a device + reset operation. + @retval EFI_TIMEOUT A timeout occurred while attempting to + reset the SCSI Controller. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE) ( + IN EFI_SCSI_IO_PROTOCOL *This + ) +; + + +/** + Sends a SCSI Request Packet to the SCSI Controller for execution. + + @param This Protocol instance pointer. + @param Packet The SCSI request packet to send to the SCSI + Controller specified by the device handle. + @param Event If the SCSI bus where the SCSI device is attached + does not support non-blocking I/O, then Event is + ignored, and blocking I/O is performed. + If Event is NULL, then blocking I/O is performed. + If Event is not NULL and non-blocking I/O is + supported, then non-blocking I/O is performed, + and Event will be signaled when the SCSI Request + Packet completes. + + @retval EFI_SUCCESS The SCSI Request Packet was sent by the host + successfully, and TransferLength bytes were + transferred to/from DataBuffer.See + HostAdapterStatus, TargetStatus, + SenseDataLength, and SenseData in that order + for additional status information. + @retval EFI_WARN_BUFFER_TOO_SMALL The SCSI Request Packet was executed, + but the entire DataBuffer could not be transferred. + The actual number of bytes transferred is returned + in TransferLength. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_NOT_READY The SCSI Request Packet could not be sent because + there are too many SCSI Command Packets already + queued.The caller may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to send + the SCSI Request Packet. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + The SCSI Request Packet was not sent, so no + additional status information is available. + @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet + is not supported by the SCSI initiator(i.e., SCSI + Host Controller). The SCSI Request Packet was not + sent, so no additional status information is + available. + @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI + Request Packet to execute. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND) ( + IN EFI_SCSI_IO_PROTOCOL *This, + IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet, + IN EFI_EVENT Event OPTIONAL + ) +; + +struct _EFI_SCSI_IO_PROTOCOL { + EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE GetDeviceType; + EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION GetDeviceLocation; + EFI_SCSI_IO_PROTOCOL_RESET_BUS ResetBus; + EFI_SCSI_IO_PROTOCOL_RESET_DEVICE ResetDevice; + EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND ExecuteSCSICommand; + UINT32 IoAlign; +}; + +extern EFI_GUID gEfiScsiIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/ScsiPassThru.h b/MdePkg/Include/Protocol/ScsiPassThru.h new file mode 100644 index 0000000000..a5aa6c47c0 --- /dev/null +++ b/MdePkg/Include/Protocol/ScsiPassThru.h @@ -0,0 +1,312 @@ +/** @file + SCSI Pass Through 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: ScsiPassThru.h + +**/ + +#ifndef __SCSI_PASS_THROUGH_H__ +#define __SCSI_PASS_THROUGH_H__ + +#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \ + { \ + 0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77 } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_SCSI_PASS_THRU_PROTOCOL EFI_SCSI_PASS_THRU_PROTOCOL; + +#define EFI_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001 +#define EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002 +#define EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004 + +// +// SCSI Host Adapter Status definition +// +#define EFI_SCSI_STATUS_HOST_ADAPTER_OK 0x00 +#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command +#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing +#define EFI_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command +#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected +#define EFI_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f +#define EFI_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command +#define EFI_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout +#define EFI_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun +#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free +#define EFI_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure +#define EFI_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f + +// +// SCSI Target Status definition +// +#define EFI_SCSI_STATUS_TARGET_GOOD 0x00 +#define EFI_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition +#define EFI_SCSI_STATUS_TARGET_CONDITION_MET 0x04 // condition met +#define EFI_SCSI_STATUS_TARGET_BUSY 0x08 // busy +#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate +#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met +#define EFI_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict +#define EFI_SCSI_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated +#define EFI_SCSI_STATUS_TARGET_QUEUE_FULL 0x28 // queue full + +typedef struct { + UINT64 Timeout; + VOID *DataBuffer; + VOID *SenseData; + VOID *Cdb; + UINT32 TransferLength; + UINT8 CdbLength; + UINT8 DataDirection; + UINT8 HostAdapterStatus; + UINT8 TargetStatus; + UINT8 SenseDataLength; +} EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET; + +typedef struct { + CHAR16 *ControllerName; + CHAR16 *ChannelName; + UINT32 AdapterId; + UINT32 Attributes; + UINT32 IoAlign; +} EFI_SCSI_PASS_THRU_MODE; + +/** + Sends a SCSI Request Packet to a SCSI device that is attached to + the SCSI channel. This function supports both blocking I/O and + non-blocking I/O. The blocking I/O functionality is required, + and the non-blocking I/O functionality is optional. + + @param This Protocol instance pointer. + @param Target The Target ID of the SCSI device to + send the SCSI Request Packet. + @param Lun The LUN of the SCSI device to send the + SCSI Request Packet. + @param Packet A pointer to the SCSI Request Packet to send + to the SCSI device specified by Target and Lun. + @param Event If non-blocking I/O is not supported then Event + is ignored, and blocking I/O is performed. + If Event is NULL, then blocking I/O is performed. + If Event is not NULL and non blocking I/O is + supported, then non-blocking I/O is performed, + and Event will be signaled when the SCSI Request + Packet completes + + @retval EFI_SUCCESS The SCSI Request Packet was sent by the host, and + TransferLength bytes were transferred to/from + DataBuffer.See HostAdapterStatus, TargetStatus, + SenseDataLength,and SenseData in that order + for additional status information. + @retval EFI_WARN_BUFFER_TOO_SMALL The SCSI Request Packet was executed, but the + entire DataBuffer could not be transferred. + The actual number of bytes transferred is returned + in TransferLength. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_NOT_READY The SCSI Request Packet could not be sent because + there are too many SCSI Request Packets already + queued. The caller may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to send + the SCSI Request Packet. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket + are invalid. The SCSI Request Packet was not sent, + so no additional status information is available. + @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet + is not supported by the host adapter. The SCSI + Request Packet was not sent, so no additional + status information is available. + @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI + Request Packet to execute. See HostAdapterStatus, + TargetStatus, SenseDataLength, and SenseData in + that order for additional status information. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_PASS_THRU_PASSTHRU) ( + IN EFI_SCSI_PASS_THRU_PROTOCOL *This, + IN UINT32 Target, + IN UINT64 Lun, + IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, + IN EFI_EVENT Event OPTIONAL + ) +; + +/** + Used to retrieve the list of legal Target IDs for SCSI devices + on a SCSI channel. + + @param This Protocol instance pointer. + @param Target On input, a pointer to the Target ID of a + SCSI device present on the SCSI channel. + On output, a pointer to the Target ID of + the next SCSI device present on a SCSI channel. + An input value of 0xFFFFFFFF retrieves the + Target ID of the first SCSI device present on + a SCSI channel. + @param Lun On input, a pointer to the LUN of a SCSI device + present on the SCSI channel.On output, a pointer + to the LUN of the next SCSI device present on a + SCSI channel. + + @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI + channel was returned in Target and Lun. + @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel. + @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF, and Target and Lun were + not returned on a previous call to GetNextDevice(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE) ( + IN EFI_SCSI_PASS_THRU_PROTOCOL *This, + IN OUT UINT32 *Target, + IN OUT UINT64 *Lun + ) +; + +/** + Used to allocate and build a device path node for a SCSI device + on a SCSI channel. + + @param This Protocol instance pointer. + @param Target The Target ID of the SCSI device for which + a device path node is to be allocated and built. + @param Lun The LUN of the SCSI device for which a device + path node is to be allocated and built. + @param DevicePath A pointer to a single device path node that + describes the SCSI device specified by + Target and Lun. This function is responsible + for allocating the buffer DevicePath with the boot + service AllocatePool(). It is the caller's + responsibility to free DevicePath when the caller + is finished with DevicePath. + + @retval EFI_SUCCESS The device path node that describes the SCSI device + specified by Target and Lun was allocated and + returned in DevicePath. + @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does + not exist on the SCSI channel. + @retval EFI_INVALID_PARAMETER DevicePath is NULL. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate + DevicePath. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH) ( + IN EFI_SCSI_PASS_THRU_PROTOCOL *This, + IN UINT32 Target, + IN UINT64 Lun, + IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ) +; + +/** + Used to translate a device path node to a Target ID and LUN. + + @param This Protocol instance pointer. + @param DevicePath A pointer to the device path node that + describes a SCSI device on the SCSI channel. + @param Target A pointer to the Target ID of a SCSI device + on the SCSI channel. + @param Lun A pointer to the LUN of a SCSI device on + the SCSI channel. + + @retval EFI_SUCCESS DevicePath was successfully translated to a + Target ID and LUN, and they were returned + in Target and Lun. + @retval EFI_INVALID_PARAMETER DevicePath is NULL. + @retval EFI_INVALID_PARAMETER Target is NULL. + @retval EFI_INVALID_PARAMETER Lun is NULL. + @retval EFI_UNSUPPORTED This driver does not support the device path + node type in DevicePath. + @retval EFI_NOT_FOUND A valid translation from DevicePath to a + Target ID and LUN does not exist. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_PASS_THRU_GET_TARGET_LUN) ( + IN EFI_SCSI_PASS_THRU_PROTOCOL *This, + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, + OUT UINT32 *Target, + OUT UINT64 *Lun + ) +; + +/** + Resets a SCSI channel.This operation resets all the + SCSI devices connected to the SCSI channel. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The SCSI channel was reset. + @retval EFI_UNSUPPORTED The SCSI channel does not support + a channel reset operation. + @retval EFI_DEVICE_ERROR A device error occurred while + attempting to reset the SCSI channel. + @retval EFI_TIMEOUT A timeout occurred while attempting + to reset the SCSI channel. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_PASS_THRU_RESET_CHANNEL) ( + IN EFI_SCSI_PASS_THRU_PROTOCOL *This + ) +; + +/** + Resets a SCSI device that is connected to a SCSI channel. + + @param This Protocol instance pointer. + @param Target The Target ID of the SCSI device to reset. + @param Lun The LUN of the SCSI device to reset. + + @retval EFI_SUCCESS The SCSI device specified by Target and + Lun was reset. + @retval EFI_UNSUPPORTED The SCSI channel does not support a target + reset operation. + @retval EFI_INVALID_PARAMETER Target or Lun are invalid. + @retval EFI_DEVICE_ERROR A device error occurred while attempting + to reset the SCSI device specified by Target + and Lun. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset + the SCSI device specified by Target and Lun. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SCSI_PASS_THRU_RESET_TARGET) ( + IN EFI_SCSI_PASS_THRU_PROTOCOL *This, + IN UINT32 Target, + IN UINT64 Lun + ) +; + +struct _EFI_SCSI_PASS_THRU_PROTOCOL { + EFI_SCSI_PASS_THRU_MODE *Mode; + EFI_SCSI_PASS_THRU_PASSTHRU PassThru; + EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE GetNextDevice; + EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath; + EFI_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun; + EFI_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel; + EFI_SCSI_PASS_THRU_RESET_TARGET ResetTarget; +}; + +extern EFI_GUID gEfiScsiPassThruProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/ScsiPassThruExt.h b/MdePkg/Include/Protocol/ScsiPassThruExt.h new file mode 100644 index 0000000000..a59b61ec17 --- /dev/null +++ b/MdePkg/Include/Protocol/ScsiPassThruExt.h @@ -0,0 +1,331 @@ +/** @file + EFI_EXT_SCSI_PASS_THRU_PROTOCOL as defined in UEFI 2.0. + + 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: ScsiPassThruExt.h + +**/ + +#ifndef __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__ +#define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__ + +#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \ + { \ + 0x1d3de7f0, 0x0807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } \ + } + +typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL; + +#define TARGET_MAX_BYTES 0x10 + +#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001 +#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002 +#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004 + +// +// DataDirection +// +#define EFI_EXT_SCSI_DATA_DIRECTION_READ 0 +#define EFI_EXT_SCSI_DATA_DIRECTION_WRITE 1 +#define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL 2 +// +// HostAdapterStatus +// +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK 0x00 +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13 +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 +#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f +// +// TargetStatus +// +#define EFI_EXT_SCSI_STATUS_TARGET_GOOD 0x00 +#define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02 +#define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET 0x04 +#define EFI_EXT_SCSI_STATUS_TARGET_BUSY 0x08 +#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE 0x10 +#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 +#define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18 +#define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL 0x28 +#define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE 0x30 +#define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED 0x40 + +typedef struct { + UINT32 AdapterId; + UINT32 Attributes; + UINT32 IoAlign; +} EFI_EXT_SCSI_PASS_THRU_MODE; + +typedef struct { + UINT64 Timeout; + VOID *InDataBuffer; + VOID *OutDataBuffer; + VOID *SenseData; + VOID *Cdb; + UINT32 InTransferLength; + UINT32 OutTransferLength; + UINT8 CdbLength; + UINT8 DataDirection; + UINT8 HostAdapterStatus; + UINT8 TargetStatus; + UINT8 SenseDataLength; +} EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET; + +/** + Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function + supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the + nonblocking I/O functionality is optional. + + @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. + @param Target The Target is an array of size TARGET_MAX_BYTES and it represents + the id of the SCSI device to send the SCSI Request Packet. Each + transport driver may chose to utilize a subset of this size to suit the needs + of transport target representation. For example, a Fibre Channel driver + may use only 8 bytes (WWN) to represent an FC target. + @param Lun The LUN of the SCSI device to send the SCSI Request Packet. + @param Packet A pointer to the SCSI Request Packet to send to the SCSI device + specified by Target and Lun. + @param Event If nonblocking I/O is not supported then Event is ignored, and blocking + I/O is performed. If Event is NULL, then blocking I/O is performed. If + Event is not NULL and non blocking I/O is supported, then + nonblocking I/O is performed, and Event will be signaled when the + SCSI Request Packet completes. + + @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional + commands, InTransferLength bytes were transferred from + InDataBuffer. For write and bi-directional commands, + OutTransferLength bytes were transferred by + OutDataBuffer. + @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that + could be transferred is returned in InTransferLength. For write + and bi-directional commands, OutTransferLength bytes were + transferred by OutDataBuffer. + @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many + SCSI Request Packets already queued. The caller may retry again later. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request + Packet. + @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid. + @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported + by the host adapter. This includes the case of Bi-directional SCSI + commands not supported by the implementation. The SCSI Request + Packet was not sent, so no additional status information is available. + @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU) ( + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, + IN UINT8 *Target, + IN UINT64 Lun, + IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet, + IN EFI_EVENT Event OPTIONAL + ) +; + +/** + Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These + can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal + Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the + Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI + channel. + + @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. + @param Target On input, a pointer to the Target ID (an array of size + TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel. + On output, a pointer to the Target ID (an array of + TARGET_MAX_BYTES) of the next SCSI device present on a SCSI + channel. An input value of 0xF(all bytes in the array are 0xF) in the + Target array retrieves the Target ID of the first SCSI device present on a + SCSI channel. + @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI + channel. On output, a pointer to the LUN of the next SCSI device present + on a SCSI channel. + + @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI + channel was returned in Target and Lun. + @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were + not returned on a previous call to GetNextTargetLun(). + @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN) ( + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, + IN OUT UINT8 **Target, + IN OUT UINT64 *Lun + ) +; + +/** + Used to allocate and build a device path node for a SCSI device on a SCSI channel. + + @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. + @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the + Target ID of the SCSI device for which a device path node is to be + allocated and built. Transport drivers may chose to utilize a subset of + this size to suit the representation of targets. For example, a Fibre + Channel driver may use only 8 bytes (WWN) in the array to represent a + FC target. + @param Lun The LUN of the SCSI device for which a device path node is to be + allocated and built. + @param DevicePath A pointer to a single device path node that describes the SCSI device + specified by Target and Lun. This function is responsible for + allocating the buffer DevicePath with the boot service + AllocatePool(). It is the caller's responsibility to free + DevicePath when the caller is finished with DevicePath. + + @retval EFI_SUCCESS The device path node that describes the SCSI device specified by + Target and Lun was allocated and returned in + DevicePath. + @retval EFI_INVALID_PARAMETER DevicePath is NULL. + @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist + on the SCSI channel. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH) ( + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, + IN UINT8 *Target, + IN UINT64 Lun, + IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath + ) +; + +/** + Used to translate a device path node to a Target ID and LUN. + + @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. + @param DevicePath A pointer to a single device path node that describes the SCSI device + on the SCSI channel. + @param Target A pointer to the Target Array which represents the ID of a SCSI device + on the SCSI channel. + @param Lun A pointer to the LUN of a SCSI device on the SCSI channel. + + @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and + LUN, and they were returned in Target and Lun. + @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL. + @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN + does not exist. + @retval EFI_UNSUPPORTED This driver does not support the device path node type in + DevicePath. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN) ( + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, + OUT UINT8 **Target, + OUT UINT64 *Lun + ) +; + +/** + Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel. + + @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. + + @retval EFI_SUCCESS The SCSI channel was reset. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel. + @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL) ( + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This + ) +; + +/** + Resets a SCSI logical unit that is connected to a SCSI channel. + + @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. + @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the + target port ID of the SCSI device containing the SCSI logical unit to + reset. Transport drivers may chose to utilize a subset of this array to suit + the representation of their targets. + @param Lun The LUN of the SCSI device to reset. + + @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset. + @retval EFI_INVALID_PARAMETER Target or Lun is NULL. + @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device + specified by Target and Lun. + @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device + specified by Target and Lun. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN) ( + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, + IN UINT8 *Target, + IN UINT64 Lun + ) +; + +/** + Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either + be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs + for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to + see if a SCSI device is actually present at that location on the SCSI channel. + + @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance. + @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel. + On output, a pointer to the Target ID (an array of + TARGET_MAX_BYTES) of the next SCSI device present on a SCSI + channel. An input value of 0xF(all bytes in the array are 0xF) in the + Target array retrieves the Target ID of the first SCSI device present on a + SCSI channel. + + @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI + channel was returned in Target. + @retval EFI_INVALID_PARAMETER Target or Lun is NULL. + @retval EFI_TIMEOUT Target array is not all 0xF, and Target were not + returned on a previous call to GetNextTarget(). + @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET) ( + IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This, + IN OUT UINT8 **Target + ) +; + +struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL { + EFI_EXT_SCSI_PASS_THRU_MODE *Mode; + EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru; + EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun; + EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath; + EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun; + EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel; + EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun; + EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget; +}; + +extern EFI_GUID gEfiExtScsiPassThruProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Security.h b/MdePkg/Include/Protocol/Security.h new file mode 100644 index 0000000000..ec981b4a02 --- /dev/null +++ b/MdePkg/Include/Protocol/Security.h @@ -0,0 +1,132 @@ +/** @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/Protocol/SecurityPolicy.h b/MdePkg/Include/Protocol/SecurityPolicy.h new file mode 100644 index 0000000000..b46267e10a --- /dev/null +++ b/MdePkg/Include/Protocol/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/Protocol/SerialIo.h b/MdePkg/Include/Protocol/SerialIo.h new file mode 100644 index 0000000000..89a73409d9 --- /dev/null +++ b/MdePkg/Include/Protocol/SerialIo.h @@ -0,0 +1,266 @@ +/** @file + Serial IO protocol as defined in the EFI 1.0 specification. + + Abstraction of a basic serial device. Targeted at 16550 UART, but + could be much more generic. + + 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: SerialIo.h + +**/ + +#ifndef __SERIAL_IO_PROTOCOL_H__ +#define __SERIAL_IO_PROTOCOL_H__ + +#define EFI_SERIAL_IO_PROTOCOL_GUID \ + { \ + 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD } \ + } + +typedef struct _EFI_SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL; + +// +// Serial IO Data structures +// +typedef enum { + DefaultParity, + NoParity, + EvenParity, + OddParity, + MarkParity, + SpaceParity +} EFI_PARITY_TYPE; + +typedef enum { + DefaultStopBits, + OneStopBit, + OneFiveStopBits, + TwoStopBits +} EFI_STOP_BITS_TYPE; + +// +// define for Control bits, grouped by read only, write only, and read write +// +// +// Read Only +// +#define EFI_SERIAL_CLEAR_TO_SEND 0x00000010 +#define EFI_SERIAL_DATA_SET_READY 0x00000020 +#define EFI_SERIAL_RING_INDICATE 0x00000040 +#define EFI_SERIAL_CARRIER_DETECT 0x00000080 +#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x00000100 +#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x00000200 + +// +// Write Only +// +#define EFI_SERIAL_REQUEST_TO_SEND 0x00000002 +#define EFI_SERIAL_DATA_TERMINAL_READY 0x00000001 + +// +// Read Write +// +#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x00001000 +#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x00002000 +#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x00004000 + +// +// Serial IO Member Functions +// +/** + Reset the serial device. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The serial device could not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERIAL_RESET) ( + IN EFI_SERIAL_IO_PROTOCOL *This + ) +; + +/** + Sets the baud rate, receive FIFO depth, transmit/receice time out, parity, + data buts, and stop bits on a serial device. + + @param This Protocol instance pointer. + @param BaudRate The requested baud rate. A BaudRate value of 0 will use the the + device's default interface speed. + @param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the + serial interface. A ReceiveFifoDepth value of 0 will use + the device's dfault FIFO depth. + @param Timeout The requested time out for a single character in microseconds. + This timeout applies to both the transmit and receive side of the + interface. A Timeout value of 0 will use the device's default time + out value. + @param Parity The type of parity to use on this serial device. A Parity value of + DefaultParity will use the device's default parity value. + @param DataBits The number of data bits to use on the serial device. A DataBits + vaule of 0 will use the device's default data bit setting. + @param StopBits The number of stop bits to use on this serial device. A StopBits + value of DefaultStopBits will use the device's default number of + stop bits. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The serial device could not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) ( + IN EFI_SERIAL_IO_PROTOCOL *This, + IN UINT64 BaudRate, + IN UINT32 ReceiveFifoDepth, + IN UINT32 Timeout, + IN EFI_PARITY_TYPE Parity, + IN UINT8 DataBits, + IN EFI_STOP_BITS_TYPE StopBits + ) +; + +/** + Set the control bits on a serial device + + @param This Protocol instance pointer. + @param Control Set the bits of Control that are settable. + + @retval EFI_SUCCESS The new control bits were set on the serial device. + @retval EFI_UNSUPPORTED The serial device does not support this operation. + @retval EFI_DEVICE_ERROR The serial device is not functioning correctly. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) ( + IN EFI_SERIAL_IO_PROTOCOL *This, + IN UINT32 Control + ) +; + +/** + Retrieves the status of thecontrol bits on a serial device + + @param This Protocol instance pointer. + @param Control A pointer to return the current Control signals from the serial device. + + @retval EFI_SUCCESS The control bits were read from the serial device. + @retval EFI_DEVICE_ERROR The serial device is not functioning correctly. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) ( + IN EFI_SERIAL_IO_PROTOCOL *This, + OUT UINT32 *Control + ) +; + +/** + Writes data to a serial device. + + @param This Protocol instance pointer. + @param BufferSize On input, the size of the Buffer. On output, the amount of + data actually written. + @param Buffer The buffer of data to write + + @retval EFI_SUCCESS The data was written. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_TIMEOUT The data write was stopped due to a timeout. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERIAL_WRITE) ( + IN EFI_SERIAL_IO_PROTOCOL *This, + IN OUT UINTN *BufferSize, + IN VOID *Buffer + ) +; + +/** + Writes data to a serial device. + + @param This Protocol instance pointer. + @param BufferSize On input, the size of the Buffer. On output, the amount of + data returned in Buffer. + @param Buffer The buffer to return the data into. + + @retval EFI_SUCCESS The data was read. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_TIMEOUT The data write was stopped due to a timeout. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERIAL_READ) ( + IN EFI_SERIAL_IO_PROTOCOL *This, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +; + +/** + The data values in SERIAL_IO_MODE are read-only and are updated by the code + that produces the SERIAL_IO_PROTOCOL member functions. + + ControlMask - A mask fo the Control bits that the device supports. The device + must always support the Input Buffer Empty control bit. + TimeOut - If applicable, the number of microseconds to wait before timing out + a Read or Write operation. + BaudRate - If applicable, the current baud rate setting of the device; otherwise, + baud rate has the value of zero to indicate that device runs at the + device's designed speed. + ReceiveFifoDepth - The number of characters the device will buffer on input + DataBits - The number of characters the device will buffer on input + Parity - If applicable, this is the EFI_PARITY_TYPE that is computed or + checked as each character is transmitted or reveived. If the device + does not support parity the value is the default parity value. + StopBits - If applicable, the EFI_STOP_BITS_TYPE number of stop bits per + character. If the device does not support stop bits the value is + the default stop bit values. + +**/ +typedef struct { + UINT32 ControlMask; + + // + // current Attributes + // + UINT32 Timeout; + UINT64 BaudRate; + UINT32 ReceiveFifoDepth; + UINT32 DataBits; + UINT32 Parity; + UINT32 StopBits; +} EFI_SERIAL_IO_MODE; + +#define SERIAL_IO_INTERFACE_REVISION 0x00010000 +#define EFI_SERIAL_IO_PROTOCOL_REVISION SERIAL_IO_INTERFACE_REVISION + +struct _EFI_SERIAL_IO_PROTOCOL { + UINT32 Revision; + EFI_SERIAL_RESET Reset; + EFI_SERIAL_SET_ATTRIBUTES SetAttributes; + EFI_SERIAL_SET_CONTROL_BITS SetControl; + EFI_SERIAL_GET_CONTROL_BITS GetControl; + EFI_SERIAL_WRITE Write; + EFI_SERIAL_READ Read; + + EFI_SERIAL_IO_MODE *Mode; +}; + +extern EFI_GUID gEfiSerialIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/ServiceBinding.h b/MdePkg/Include/Protocol/ServiceBinding.h new file mode 100644 index 0000000000..57ce92f142 --- /dev/null +++ b/MdePkg/Include/Protocol/ServiceBinding.h @@ -0,0 +1,74 @@ +/** @file + 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: ServiceBinding.h + +**/ + +#ifndef __EFI_SERVICE_BINDING_H__ +#define __EFI_SERVICE_BINDING_H__ + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_SERVICE_BINDING_PROTOCOL EFI_SERVICE_BINDING_PROTOCOL; + +/** + Creates a child handle with a set of I/O services. + + @param This Protocol instance pointer. + @param ChildHandle Pointer to the handle of the child to create. If it is NULL, + then a new handle is created. If it is not NULL, then the + I/O services are added to the existing child handle. + + @retval EFI_SUCCES The child handle was created with the I/O services + @retval EFI_INVALID_PARAMETER ChildHandle is NULL. + @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create + the child + @retval other The child handle was not created + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) ( + IN EFI_SERVICE_BINDING_PROTOCOL *This, + IN OUT EFI_HANDLE *ChildHandle + ) +; + +/** + Destroys a child handle with a set of I/O services. + + @param This Protocol instance pointer. + @param ChildHandle Handle of the child to destroy + + @retval EFI_SUCCES The I/O services were removed from the child handle + @retval EFI_UNSUPPORTED The child handle does not support the I/O services + that are being removed. + @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle. + @retval EFI_ACCESS_DENIED The child handle could not be destroyed because its + I/O services are being used. + @retval other The child handle was not destroyed + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) ( + IN EFI_SERVICE_BINDING_PROTOCOL *This, + IN EFI_HANDLE ChildHandle + ) +; + +struct _EFI_SERVICE_BINDING_PROTOCOL { + EFI_SERVICE_BINDING_CREATE_CHILD CreateChild; + EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild; +}; + +#endif diff --git a/MdePkg/Include/Protocol/SimpleFileSystem.h b/MdePkg/Include/Protocol/SimpleFileSystem.h new file mode 100644 index 0000000000..add8ad6eeb --- /dev/null +++ b/MdePkg/Include/Protocol/SimpleFileSystem.h @@ -0,0 +1,328 @@ +/** @file + SimpleFileSystem protocol as defined in the EFI 1.0 specification. + + The SimpleFileSystem protocol is the programatic access to the FAT (12,16,32) + file system specified in EFI 1.0. It can also be used to abstract a file + system other than FAT. + + EFI 1.0 can boot from any valid EFI image contained in a SimpleFileSystem + + 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: SimpleFileSystem.h + +**/ + +#ifndef __SIMPLE_FILE_SYSTEM_H__ +#define __SIMPLE_FILE_SYSTEM_H__ + +#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ + { \ + 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL; +typedef struct _EFI_FILE EFI_FILE; +typedef struct _EFI_FILE *EFI_FILE_HANDLE; +typedef struct _EFI_FILE EFI_FILE_PROTOCOL; + +/** + Open the root directory on a volume. + + @param This Protocol instance pointer. + @param Root Returns an Open file handle for the root directory + + @retval EFI_SUCCESS The device was opened. + @retval EFI_UNSUPPORTED This volume does not suppor the file system. + @retval EFI_NO_MEDIA The device has no media. + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted + @retval EFI_ACCESS_DENIED The service denied access to the file + @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME) ( + IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, + OUT EFI_FILE **Root + ) +; + +#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000 + +struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL { + UINT64 Revision; + EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume; +}; + +/** + Open the root directory on a volume. + + @param This Protocol instance pointer. + @param NewHandle Returns File Handle for FileName + @param FileName Null terminated string. "\", ".", and ".." are supported + @param OpenMode Open mode for file. + @param Attributes Only used for EFI_FILE_MODE_CREATE + + @retval EFI_SUCCESS The device was opened. + @retval EFI_NOT_FOUND The specified file could not be found on the device + @retval EFI_NO_MEDIA The device has no media. + @retval EFI_MEDIA_CHANGED The media has changed + @retval EFI_DEVICE_ERROR The device reported an error. + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted + @retval EFI_ACCESS_DENIED The service denied access to the file + @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources + @retval EFI_VOLUME_FULL The volume is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_OPEN) ( + IN EFI_FILE *This, + OUT EFI_FILE **NewHandle, + IN CHAR16 *FileName, + IN UINT64 OpenMode, + IN UINT64 Attributes + ) +; + +// +// Open modes +// +#define EFI_FILE_MODE_READ 0x0000000000000001ULL +#define EFI_FILE_MODE_WRITE 0x0000000000000002ULL +#define EFI_FILE_MODE_CREATE 0x8000000000000000ULL + +// +// File attributes +// +#define EFI_FILE_READ_ONLY 0x0000000000000001ULL +#define EFI_FILE_HIDDEN 0x0000000000000002ULL +#define EFI_FILE_SYSTEM 0x0000000000000004ULL +#define EFI_FILE_RESERVED 0x0000000000000008ULL +#define EFI_FILE_DIRECTORY 0x0000000000000010ULL +#define EFI_FILE_ARCHIVE 0x0000000000000020ULL +#define EFI_FILE_VALID_ATTR 0x0000000000000037ULL + +/** + Close the file handle + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The device was opened. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_CLOSE) ( + IN EFI_FILE *This + ) +; + +/** + Close and delete the file handle + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The device was opened. + @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_DELETE) ( + IN EFI_FILE *This + ) +; + +/** + Read data from the file. + + @param This Protocol instance pointer. + @param BufferSize On input size of buffer, on output amount of data in buffer. + @param Buffer The buffer in which data is read. + + @retval EFI_SUCCESS Data was read. + @retval EFI_NO_MEDIA The device has no media + @retval EFI_DEVICE_ERROR The device reported an error + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted + @retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_READ) ( + IN EFI_FILE *This, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +; + +/** + Write data from to the file. + + @param This Protocol instance pointer. + @param BufferSize On input size of buffer, on output amount of data in buffer. + @param Buffer The buffer in which data to write. + + @retval EFI_SUCCESS Data was written. + @retval EFI_UNSUPPORT Writes to Open directory are not supported + @retval EFI_NO_MEDIA The device has no media + @retval EFI_DEVICE_ERROR The device reported an error + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted + @retval EFI_WRITE_PROTECTED The device is write protected + @retval EFI_ACCESS_DENIED The file was open for read only + @retval EFI_VOLUME_FULL The volume is full + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_WRITE) ( + IN EFI_FILE *This, + IN OUT UINTN *BufferSize, + IN VOID *Buffer + ) +; + +/** + Set a files current position + + @param This Protocol instance pointer. + @param Position Byte possition from the start of the file + + @retval EFI_SUCCESS Data was written. + @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_POSITION) ( + IN EFI_FILE *This, + IN UINT64 Position + ) +; + +/** + Get a files current position + + @param This Protocol instance pointer. + @param Position Byte possition from the start of the file + + @retval EFI_SUCCESS Data was written. + @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_POSITION) ( + IN EFI_FILE *This, + OUT UINT64 *Position + ) +; + +/** + Get information about a file + + @param This Protocol instance pointer. + @param InformationType Type of info to return in Buffer + @param BufferSize On input size of buffer, on output amount of data in buffer. + @param Buffer The buffer to return data. + + @retval EFI_SUCCESS Data was returned. + @retval EFI_UNSUPPORT InformationType is not supported + @retval EFI_NO_MEDIA The device has no media + @retval EFI_DEVICE_ERROR The device reported an error + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted + @retval EFI_WRITE_PROTECTED The device is write protected + @retval EFI_ACCESS_DENIED The file was open for read only + @retval EFI_BUFFER_TOO_SMALL Buffer was too small, required size returned in BufferSize + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_GET_INFO) ( + IN EFI_FILE *This, + IN EFI_GUID *InformationType, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +; + +/** + Set information about a file + + @param File Protocol instance pointer. + @param InformationType Type of info in Buffer + @param BufferSize Size of buffer. + @param Buffer The data to write. + + @retval EFI_SUCCESS Data was returned. + @retval EFI_UNSUPPORT InformationType is not supported + @retval EFI_NO_MEDIA The device has no media + @retval EFI_DEVICE_ERROR The device reported an error + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted + @retval EFI_WRITE_PROTECTED The device is write protected + @retval EFI_ACCESS_DENIED The file was open for read only + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_SET_INFO) ( + IN EFI_FILE *This, + IN EFI_GUID *InformationType, + IN UINTN BufferSize, + IN VOID *Buffer + ) +; + +/** + Flush data back for the file handle + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS Data was written. + @retval EFI_UNSUPPORT Writes to Open directory are not supported + @retval EFI_NO_MEDIA The device has no media + @retval EFI_DEVICE_ERROR The device reported an error + @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted + @retval EFI_WRITE_PROTECTED The device is write protected + @retval EFI_ACCESS_DENIED The file was open for read only + @retval EFI_VOLUME_FULL The volume is full + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_FILE_FLUSH) ( + IN EFI_FILE *This + ) +; + +#define EFI_FILE_HANDLE_REVISION 0x00010000 +#define EFI_FILE_PROTOCOL_REVISION EFI_FILE_HANDLE_REVISION + +struct _EFI_FILE { + UINT64 Revision; + EFI_FILE_OPEN Open; + EFI_FILE_CLOSE Close; + EFI_FILE_DELETE Delete; + EFI_FILE_READ Read; + EFI_FILE_WRITE Write; + EFI_FILE_GET_POSITION GetPosition; + EFI_FILE_SET_POSITION SetPosition; + EFI_FILE_GET_INFO GetInfo; + EFI_FILE_SET_INFO SetInfo; + EFI_FILE_FLUSH Flush; +}; + + +extern EFI_GUID gEfiSimpleFileSystemProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/SimpleNetwork.h b/MdePkg/Include/Protocol/SimpleNetwork.h new file mode 100644 index 0000000000..0da64bbe53 --- /dev/null +++ b/MdePkg/Include/Protocol/SimpleNetwork.h @@ -0,0 +1,580 @@ +/** @file + Simple Network protocol as defined in the EFI 1.0 specification. + + Basic network device abstraction. + + Rx - Received + Tx - Transmit + MCast - MultiCast + ... + + 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: SimpleNetwork.h + +**/ + +#ifndef __SIMPLE_NETWORK_H__ +#define __SIMPLE_NETWORK_H__ + +#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \ + { \ + 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } \ + } + +typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL; + +// +// Simple Network Protocol data structures +// +typedef struct { + // + // Total number of frames received. Includes frames with errors and + // dropped frames. + // + UINT64 RxTotalFrames; + + // + // Number of valid frames received and copied into receive buffers. + // + UINT64 RxGoodFrames; + + // + // Number of frames below the minimum length for the media. + // This would be <64 for ethernet. + // + UINT64 RxUndersizeFrames; + + // + // Number of frames longer than the maxminum length for the + // media. This would be >1500 for ethernet. + // + UINT64 RxOversizeFrames; + + // + // Valid frames that were dropped because receive buffers were full. + // + UINT64 RxDroppedFrames; + + // + // Number of valid unicast frames received and not dropped. + // + UINT64 RxUnicastFrames; + + // + // Number of valid broadcast frames received and not dropped. + // + UINT64 RxBroadcastFrames; + + // + // Number of valid mutlicast frames received and not dropped. + // + UINT64 RxMulticastFrames; + + // + // Number of frames w/ CRC or alignment errors. + // + UINT64 RxCrcErrorFrames; + + // + // Total number of bytes received. Includes frames with errors + // and dropped frames. + // + UINT64 RxTotalBytes; + + // + // Transmit statistics. + // + UINT64 TxTotalFrames; + UINT64 TxGoodFrames; + UINT64 TxUndersizeFrames; + UINT64 TxOversizeFrames; + UINT64 TxDroppedFrames; + UINT64 TxUnicastFrames; + UINT64 TxBroadcastFrames; + UINT64 TxMulticastFrames; + UINT64 TxCrcErrorFrames; + UINT64 TxTotalBytes; + + // + // Number of collisions detection on this subnet. + // + UINT64 Collisions; + + // + // Number of frames destined for unsupported protocol. + // + UINT64 UnsupportedProtocol; + +} EFI_NETWORK_STATISTICS; + +typedef enum { + EfiSimpleNetworkStopped, + EfiSimpleNetworkStarted, + EfiSimpleNetworkInitialized, + EfiSimpleNetworkMaxState +} EFI_SIMPLE_NETWORK_STATE; + +#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01 +#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02 +#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04 +#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 +#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 + +#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01 +#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02 +#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04 +#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08 + +#define MAX_MCAST_FILTER_CNT 16 +typedef struct { + UINT32 State; + UINT32 HwAddressSize; + UINT32 MediaHeaderSize; + UINT32 MaxPacketSize; + UINT32 NvRamSize; + UINT32 NvRamAccessSize; + UINT32 ReceiveFilterMask; + UINT32 ReceiveFilterSetting; + UINT32 MaxMCastFilterCount; + UINT32 MCastFilterCount; + EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT]; + EFI_MAC_ADDRESS CurrentAddress; + EFI_MAC_ADDRESS BroadcastAddress; + EFI_MAC_ADDRESS PermanentAddress; + UINT8 IfType; + BOOLEAN MacAddressChangeable; + BOOLEAN MultipleTxSupported; + BOOLEAN MediaPresentSupported; + BOOLEAN MediaPresent; +} EFI_SIMPLE_NETWORK_MODE; + +// +// Protocol Member Functions +// +/** + Changes the state of a network interface from "stopped" to "started". + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The network interface was started. + @retval EFI_ALREADY_STARTED The network interface is already in the started state. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_START) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This + ) +; + +/** + Changes the state of a network interface from "started" to "stopped". + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The network interface was stopped. + @retval EFI_ALREADY_STARTED The network interface is already in the stopped state. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_STOP) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This + ) +; + +/** + Resets a network adapter and allocates the transmit and receive buffers + required by the network interface; optionally, also requests allocation + of additional transmit and receive buffers. + + @param This Protocol instance pointer. + @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space + that the driver should allocate for the network interface. + Some network interfaces will not be able to use the extra + buffer, and the caller will not know if it is actually + being used. + @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space + that the driver should allocate for the network interface. + Some network interfaces will not be able to use the extra + buffer, and the caller will not know if it is actually + being used. + + @retval EFI_SUCCESS The network interface was initialized. + @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and + receive buffers. . + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN UINTN ExtraRxBufferSize OPTIONAL, + IN UINTN ExtraTxBufferSize OPTIONAL + ) +; + +/** + Resets a network adapter and re-initializes it with the parameters that were + provided in the previous call to Initialize(). + + @param This Protocol instance pointer. + @param ExtendedVerification Indicates that the driver may perform a more + exhaustive verification operation of the device + during reset. + + @retval EFI_SUCCESS The network interface was reset. + @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_RESET) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +; + +/** + Resets a network adapter and leaves it in a state that is safe for + another driver to initialize. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The network interface was shutdown. + @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This + ) +; + +/** + Manages the multicast receive filters of a network interface. + + @param This Protocol instance pointer. + @param Enable A bit mask of receive filters to enable on the network interface. + @param Disable A bit mask of receive filters to disable on the network interface. + @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive + filters on the network interface to their default values. + @param McastFilterCnt Number of multicast HW MAC addresses in the new + MCastFilter list. This value must be less than or equal to + the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This + field is optional if ResetMCastFilter is TRUE. + @param MCastFilter A pointer to a list of new multicast receive filter HW MAC + addresses. This list will replace any existing multicast + HW MAC address list. This field is optional if + ResetMCastFilter is TRUE. + + @retval EFI_SUCCESS The multicast receive filter list was updated. + @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN UINT32 Enable, + IN UINT32 Disable, + IN BOOLEAN ResetMCastFilter, + IN UINTN MCastFilterCnt OPTIONAL, + IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL + ) +; + +/** + Modifies or resets the current station address, if supported. + + @param This Protocol instance pointer. + @param Reset Flag used to reset the station address to the network interfaces + permanent address. + @param New New station address to be used for the network interface. + + @retval EFI_SUCCESS The network interfaces station address was updated. + @retval EFI_NOT_STARTED The network interface has not been started + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN BOOLEAN Reset, + IN EFI_MAC_ADDRESS *New OPTIONAL + ) +; + +/** + Resets or collects the statistics on a network interface. + + @param This Protocol instance pointer. + @param Reset Set to TRUE to reset the statistics for the network interface. + @param StatisticsSize On input the size, in bytes, of StatisticsTable. On + output the size, in bytes, of the resulting table of + statistics. + @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that + contains the statistics. + + @retval EFI_SUCCESS The statistics were collected from the network interface. + @retval EFI_NOT_STARTED The network interface has not been started. + @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer + size needed to hold the statistics is returned in + StatisticsSize. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN BOOLEAN Reset, + IN OUT UINTN *StatisticsSize OPTIONAL, + OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL + ) +; + +/** + Converts a multicast IP address to a multicast HW MAC address. + + @param This Protocol instance pointer. + @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set + to FALSE if the multicast IP address is IPv4 [RFC 791]. + @param IP The multicast IP address that is to be converted to a multicast + HW MAC address. + @param MAC The multicast HW MAC address that is to be generated from IP. + + @retval EFI_SUCCESS The multicast IP address was mapped to the multicast + HW MAC address. + @retval EFI_NOT_STARTED The network interface has not been started. + @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer + size needed to hold the statistics is returned in + StatisticsSize. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN BOOLEAN IPv6, + IN EFI_IP_ADDRESS *IP, + OUT EFI_MAC_ADDRESS *MAC + ) +; + +/** + Performs read and write operations on the NVRAM device attached to a + network interface. + + @param This Protocol instance pointer. + @param ReadWrite TRUE for read operations, FALSE for write operations. + @param Offset Byte offset in the NVRAM device at which to start the read or + write operation. This must be a multiple of NvRamAccessSize and + less than NvRamSize. + @param BufferSize The number of bytes to read or write from the NVRAM device. + This must also be a multiple of NvramAccessSize. + @param Buffer A pointer to the data buffer. + + @retval EFI_SUCCESS The NVRAM access was performed. + @retval EFI_NOT_STARTED The network interface has not been started. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN BOOLEAN ReadWrite, + IN UINTN Offset, + IN UINTN BufferSize, + IN OUT VOID *Buffer + ) +; + +/** + Reads the current interrupt status and recycled transmit buffer status from + a network interface. + + @param This Protocol instance pointer. + @param InterruptStatus A pointer to the bit mask of the currently active interrupts + If this is NULL, the interrupt status will not be read from + the device. If this is not NULL, the interrupt status will + be read from the device. When the interrupt status is read, + it will also be cleared. Clearing the transmit interrupt + does not empty the recycled transmit buffer array. + @param TxBuf Recycled transmit buffer address. The network interface will + not transmit if its internal recycled transmit buffer array + is full. Reading the transmit buffer does not clear the + transmit interrupt. If this is NULL, then the transmit buffer + status will not be read. If there are no transmit buffers to + recycle and TxBuf is not NULL, * TxBuf will be set to NULL. + + @retval EFI_SUCCESS The status of the network interface was retrieved. + @retval EFI_NOT_STARTED The network interface has not been started. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + OUT UINT32 *InterruptStatus OPTIONAL, + OUT VOID **TxBuf OPTIONAL + ) +; + +/** + Places a packet in the transmit queue of a network interface. + + @param This Protocol instance pointer. + @param HeaderSize The size, in bytes, of the media header to be filled in by + the Transmit() function. If HeaderSize is non-zero, then it + must be equal to This->Mode->MediaHeaderSize and the DestAddr + and Protocol parameters must not be NULL. + @param BufferSize The size, in bytes, of the entire packet (media header and + data) to be transmitted through the network interface. + @param Buffer A pointer to the packet (media header followed by data) to be + transmitted. This parameter cannot be NULL. If HeaderSize is zero, + then the media header in Buffer must already be filled in by the + caller. If HeaderSize is non-zero, then the media header will be + filled in by the Transmit() function. + @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter + is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then + This->Mode->CurrentAddress is used for the source HW MAC address. + @param DsetAddr The destination HW MAC address. If HeaderSize is zero, then this + parameter is ignored. + @param Protocol The type of header to build. If HeaderSize is zero, then this + parameter is ignored. See RFC 1700, section "Ether Types", for + examples. + + @retval EFI_SUCCESS The packet was placed on the transmit queue. + @retval EFI_NOT_STARTED The network interface has not been started. + @retval EFI_NOT_READY The network interface is too busy to accept this transmit request. + @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + IN UINTN HeaderSize, + IN UINTN BufferSize, + IN VOID *Buffer, + IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, + IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, + IN UINT16 *Protocol OPTIONAL + ) +; + +/** + Receives a packet from a network interface. + + @param This Protocol instance pointer. + @param HeaderSize The size, in bytes, of the media header received on the network + interface. If this parameter is NULL, then the media header size + will not be returned. + @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in + bytes, of the packet that was received on the network interface. + @param Buffer A pointer to the data buffer to receive both the media header and + the data. + @param SrcAddr The source HW MAC address. If this parameter is NULL, the + HW MAC source address will not be extracted from the media + header. + @param DsetAddr The destination HW MAC address. If this parameter is NULL, + the HW MAC destination address will not be extracted from the + media header. + @param Protocol The media header type. If this parameter is NULL, then the + protocol will not be extracted from the media header. See + RFC 1700 section "Ether Types" for examples. + + @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has + been updated to the number of bytes received. + @retval EFI_NOT_STARTED The network interface has not been started. + @retval EFI_NOT_READY The network interface is too busy to accept this transmit + request. + @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small. + @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. + @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. + @retval EFI_UNSUPPORTED This function is not supported by the network interface. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) ( + IN EFI_SIMPLE_NETWORK_PROTOCOL *This, + OUT UINTN *HeaderSize OPTIONAL, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer, + OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL, + OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL, + OUT UINT16 *Protocol OPTIONAL + ) +; + +#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000 + +struct _EFI_SIMPLE_NETWORK_PROTOCOL { + UINT64 Revision; + EFI_SIMPLE_NETWORK_START Start; + EFI_SIMPLE_NETWORK_STOP Stop; + EFI_SIMPLE_NETWORK_INITIALIZE Initialize; + EFI_SIMPLE_NETWORK_RESET Reset; + EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown; + EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters; + EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress; + EFI_SIMPLE_NETWORK_STATISTICS Statistics; + EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac; + EFI_SIMPLE_NETWORK_NVDATA NvData; + EFI_SIMPLE_NETWORK_GET_STATUS GetStatus; + EFI_SIMPLE_NETWORK_TRANSMIT Transmit; + EFI_SIMPLE_NETWORK_RECEIVE Receive; + EFI_EVENT WaitForPacket; + EFI_SIMPLE_NETWORK_MODE *Mode; +}; + +extern EFI_GUID gEfiSimpleNetworkProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/SimplePointer.h b/MdePkg/Include/Protocol/SimplePointer.h new file mode 100644 index 0000000000..a0e0804074 --- /dev/null +++ b/MdePkg/Include/Protocol/SimplePointer.h @@ -0,0 +1,97 @@ +/** @file + Simple Pointer protocol from the EFI 1.1 specification. + + Abstraction of a very simple pointer device like a mice or tracekballs. + + 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: SimplePointer.h + +**/ + +#ifndef __SIMPLE_POINTER_H__ +#define __SIMPLE_POINTER_H__ + +#define EFI_SIMPLE_POINTER_PROTOCOL_GUID \ + { \ + 0x31878c87, 0xb75, 0x11d5, {0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +typedef struct _EFI_SIMPLE_POINTER_PROTOCOL EFI_SIMPLE_POINTER_PROTOCOL; + +// +// Data structures +// +typedef struct { + INT32 RelativeMovementX; + INT32 RelativeMovementY; + INT32 RelativeMovementZ; + BOOLEAN LeftButton; + BOOLEAN RightButton; +} EFI_SIMPLE_POINTER_STATE; + +typedef struct { + UINT64 ResolutionX; + UINT64 ResolutionY; + UINT64 ResolutionZ; + BOOLEAN LeftButton; + BOOLEAN RightButton; +} EFI_SIMPLE_POINTER_MODE; + +/** + Resets the pointer device hardware. + + @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL + instance. + @param ExtendedVerification Indicates that the driver may perform a more exhaustive + verification operation of the device during reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_POINTER_RESET) ( + IN EFI_SIMPLE_POINTER_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ); + +/** + Retrieves the current state of a pointer device. + + @param This A pointer to the EFI_SIMPLE_POINTER_PROTOCOL + instance. + @param State A pointer to the state information on the pointer device. + + @retval EFI_SUCCESS The state of the pointer device was returned in State. + @retval EFI_NOT_READY The state of the pointer device has not changed since the last call to + GetState(). + @retval EFI_DEVICE_ERROR A device error occurred while attempting to retrieve the pointer device's + current state. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) ( + IN EFI_SIMPLE_POINTER_PROTOCOL *This, + IN OUT EFI_SIMPLE_POINTER_STATE *State + ); + +struct _EFI_SIMPLE_POINTER_PROTOCOL { + EFI_SIMPLE_POINTER_RESET Reset; + EFI_SIMPLE_POINTER_GET_STATE GetState; + EFI_EVENT WaitForInput; + EFI_SIMPLE_POINTER_MODE *Mode; +}; + +extern EFI_GUID gEfiSimplePointerProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/SimpleTextIn.h b/MdePkg/Include/Protocol/SimpleTextIn.h new file mode 100644 index 0000000000..3e7f016f4c --- /dev/null +++ b/MdePkg/Include/Protocol/SimpleTextIn.h @@ -0,0 +1,125 @@ +/** @file + Simple Text In protocol from the EFI 1.0 specification. + + Abstraction of a very simple input device like a keyboard or serial + terminal. + + 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: SimpleTextIn.h + +**/ + +#ifndef __SIMPLE_TEXT_IN_PROTOCOL_H__ +#define __SIMPLE_TEXT_IN_PROTOCOL_H__ + +#define EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID \ + { \ + 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID + +typedef struct _EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_IN_PROTOCOL; +typedef struct _EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL; + +// +// Data structures +// +typedef struct { + UINT16 ScanCode; + CHAR16 UnicodeChar; +} EFI_INPUT_KEY; + +// +// Required unicode control chars +// +#define CHAR_NULL 0x0000 +#define CHAR_BACKSPACE 0x0008 +#define CHAR_TAB 0x0009 +#define CHAR_LINEFEED 0x000A +#define CHAR_CARRIAGE_RETURN 0x000D + +// +// EFI Scan codes +// +#define SCAN_NULL 0x0000 +#define SCAN_UP 0x0001 +#define SCAN_DOWN 0x0002 +#define SCAN_RIGHT 0x0003 +#define SCAN_LEFT 0x0004 +#define SCAN_HOME 0x0005 +#define SCAN_END 0x0006 +#define SCAN_INSERT 0x0007 +#define SCAN_DELETE 0x0008 +#define SCAN_PAGE_UP 0x0009 +#define SCAN_PAGE_DOWN 0x000A +#define SCAN_F1 0x000B +#define SCAN_F2 0x000C +#define SCAN_F3 0x000D +#define SCAN_F4 0x000E +#define SCAN_F5 0x000F +#define SCAN_F6 0x0010 +#define SCAN_F7 0x0011 +#define SCAN_F8 0x0012 +#define SCAN_F9 0x0013 +#define SCAN_F10 0x0014 +#define SCAN_F11 0x0015 +#define SCAN_F12 0x0016 +#define SCAN_ESC 0x0017 + +/** + Reset the input device and optionaly run diagnostics + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The device was reset. + @retval EFI_DEVICE_ERROR The device is not functioning properly and could not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_RESET) ( + IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +; + +/** + Reads the next keystroke from the input device. The WaitForKey Event can + be used to test for existance of a keystroke via WaitForEvent () call. + + @param This Protocol instance pointer. + @param Key Driver may perform diagnostics on reset. + + @retval EFI_SUCCESS The keystroke information was returned. + @retval EFI_NOT_READY There was no keystroke data availiable. + @retval EFI_DEVICE_ERROR The keydtroke information was not returned due to + hardware errors. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_READ_KEY) ( + IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This, + OUT EFI_INPUT_KEY *Key + ) +; + +struct _EFI_SIMPLE_TEXT_IN_PROTOCOL { + EFI_INPUT_RESET Reset; + EFI_INPUT_READ_KEY ReadKeyStroke; + EFI_EVENT WaitForKey; +}; + +extern EFI_GUID gEfiSimpleTextInProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/SimpleTextInEx.h b/MdePkg/Include/Protocol/SimpleTextInEx.h new file mode 100644 index 0000000000..3aa4ecca1a --- /dev/null +++ b/MdePkg/Include/Protocol/SimpleTextInEx.h @@ -0,0 +1,318 @@ +/** @file + The file defines the protocol to obtain input from the + ConsoleIn device. The EFI specification requires that the + EFI_SIMPLE_TEXT_INPUT_PROTOCOL supports the same languages as + the corresponding + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: SimpleTextInEx.h + +**/ + +#ifndef __SIMPLE_TEXT_IN_EX_H__ +#define __SIMPLE_TEXT_IN_EX_H__ + +#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \ + {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } } + + +typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL; + +/** + The Reset() function resets the input device hardware. As part + of initialization process, the firmware/device will make a quick + but reasonable attempt to verify that the device is functioning. + If the ExtendedVerification flag is TRUE the firmware may take + an extended amount of time to verify the device is operating on + reset. Otherwise the reset operation is to occur as quickly as + possible. The hardware verification process is not defined by + this specification and is left up to the platform firmware or + driver to implement. + + @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX + instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX + is defined in this section. + + @param ExtendedVerification Indicates that the driver may + perform a more exhaustive + verification operation of the + device during reset. + + + @retval EFI_SUCCESS The device was reset. + + @retval EFI_DEVICE_ERROR The device is not functioning + correctly and could not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_RESET_EX) ( + IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN CONST BOOLEAN ExtendedVerification +); + + +// +// EFI_KEY_TOGGLE_STATE +// +typedef UINT8 EFI_KEY_TOGGLE_STATE; +#define TOGGLE_STATE_VALID 0x80 +#define SCROLL_LOCK_ACTIVE 0x01 +#define NUM_LOCK_ACTIVE 0x02 +#define CAPS_LOCK_ACTIVE 0x04 + +/** + Definition of EFI_KEY_STATE + + @param KeyShiftState Reflects the currently pressed shift + modifiers for the input device. The + returned value is valid only if the high + order bit has been set. + + @param KeyToggleState Reflects the current internal state of + various toggled attributes. The returned + value is valid only if the high order + bit has been set. + +**/ +typedef struct _EFI_KEY_STATE { + UINT32 KeyShiftState; + EFI_KEY_TOGGLE_STATE KeyToggleState; +} EFI_KEY_STATE; + +/** + Definition of EFI_KEY_DATA. + + @param Key The EFI scan code and Unicode value returned from + the input device. + + @param KeyState The current state of various toggled + attributes as well as input modifier values. + +**/ +typedef struct { + EFI_INPUT_KEY Key; + EFI_KEY_STATE KeyState; +} EFI_KEY_DATA; + +// +// Shift State. +// +// Any Shift or Toggle State that is valid should have +// high order bit set. +// +#define SHIFT_STATE_VALID 0x80000000 +#define RIGHT_SHIFT_PRESSED 0x00000001 +#define LEFT_SHIFT_PRESSED 0x00000002 +#define RIGHT_CONTROL_PRESSED 0x00000004 +#define LEFT_CONTROL_PRESSED 0x00000008 +#define RIGHT_ALT_PRESSED 0x00000010 +#define LEFT_ALT_PRESSED 0x00000020 +#define RIGHT_LOGO_PRESSED 0x00000040 +#define LEFT_LOGO_PRESSED 0x00000080 +#define MENU_KEY_PRESSED 0x00000100 +#define SYS_REQ_PRESSED 0x00000200 + +/** + The function reads the next keystroke from the input device. If + there is no pending keystroke the function returns + EFI_NOT_READY. If there is a pending keystroke, then + KeyData.Key.ScanCode is the EFI scan code defined in Error! + Reference source not found.. The KeyData.Key.UnicodeChar is the + actual printable character or is zero if the key does not + represent a printable character (control key, function key, + etc.). The KeyData.KeyState is shift state for the character + reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode . + When interpreting the data from this function, it should be + noted that if a class of printable characters that are + normally adjusted by shift modifiers (e.g. Shift Key + "f" + key) would be presented solely as a KeyData.Key.UnicodeChar + without the associated shift state. So in the previous example + of a Shift Key + "f" key being pressed, the only pertinent + data returned would be KeyData.Key.UnicodeChar with the value + of "F". This of course would not typically be the case for + non-printable characters such as the pressing of the Right + Shift Key + F10 key since the corresponding returned data + would be reflected both in the KeyData.KeyState.KeyShiftState + and KeyData.Key.ScanCode values. UEFI drivers which implement + the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return + KeyData.Key and KeyData.KeyState values. These drivers must + always return the most current state of + KeyData.KeyState.KeyShiftState and + KeyData.KeyState.KeyToggleState. It should also be noted that + certain input devices may not be able to produce shift or toggle + state information, and in those cases the high order bit in the + respective Toggle and Shift state fields should not be active. + + + @param This A pointer to the + EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance. + + @param KeyData A pointer to a buffer that is filled in with + the keystroke state data for the key that was + pressed. + + + @retval EFI_SUCCESS The keystroke information was + returned. + + @retval EFI_NOT_READY There was no keystroke data available. + EFI_DEVICE_ERROR The keystroke + information was not returned due to + hardware errors. + + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_READ_KEY_EX) ( + IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + OUT EFI_KEY_DATA *KeyData +); + +/** + The SetState() function allows the input device hardware to + have state settings adjusted. + + @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX + instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX + is defined in this section. + + @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to + set the state for the input device. + + + @retval EFI_SUCCESS The device state was set appropriately. + + @retval EFI_DEVICE_ERROR The device is not functioning + correctly and could not have the + setting adjusted. + + @retval EFI_UNSUPPORTED The device does not support the + ability to have its state set. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SET_STATE) ( + IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN CONST EFI_KEY_TOGGLE_STATE *KeyToggleState +); + +// +// EFI_KEY_NOTIFY +// +typedef +EFI_STATUS +(EFIAPI *EFI_KEY_NOTIFY_FUNCTION) ( + IN CONST EFI_KEY_DATA *KeyData +); + +/** + The RegisterKeystrokeNotify() function registers a function + which will be called when a specified keystroke will occur. + + @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX + instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX + is defined in this section. + + @param KeyData A pointer to a buffer that is filled in with + the keystroke information for the key that was + pressed. + + @param KeyNotificationFunction Points to the function to be + called when the key sequence + is typed specified by KeyData. + + + @param NotifyHandle Points to the unique handle assigned to + the registered notification. + + @retval EFI_SUCCESS The device state was set + appropriately. + + @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary + data structures. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) ( + IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN CONST EFI_KEY_DATA *KeyData, + IN CONST EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, + OUT EFI_HANDLE *NotifyHandle +); + +/** + The UnregisterKeystrokeNotify() function removes the + notification which was previously registered. + + @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX + instance. + + @param NotificationHandle The handle of the notification + function being unregistered. + + @retval EFI_SUCCESS The device state was set appropriately. + + @retval EFI_INVALID_PARAMETER The NotificationHandle is + invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) ( +IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, +IN EFI_HANDLE NotificationHandle +); + + +/** + The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn + device. It is an extension to the Simple Text Input protocol + which allows a variety of extended shift state information to be + returned. + + @param Reset Reset the ConsoleIn device. See Reset(). + + @param ReadKeyStrokeEx Returns the next input character. See + ReadKeyStrokeEx(). + + @param WaitForKeyEx Event to use with WaitForEvent() to wait + for a key to be available. + + @param SetState Set the EFI_KEY_TOGGLE_STATE state settings + for the input device. + + @param RegisterKeyNotify Register a notification function to + be called when a given key sequence + is hit. + + @param UnregisterKeyNotifyRemoves A specific notification + function. + +**/ +struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{ + EFI_INPUT_RESET_EX Reset; + EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx; + EFI_EVENT WaitForKeyEx; + EFI_SET_STATE SetState; + EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify; + EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify; +}; + + +extern EFI_GUID gEfiSimpleTextInputExProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/SimpleTextOut.h b/MdePkg/Include/Protocol/SimpleTextOut.h new file mode 100644 index 0000000000..b568865f18 --- /dev/null +++ b/MdePkg/Include/Protocol/SimpleTextOut.h @@ -0,0 +1,390 @@ +/** @file + Simple Text Out protocol from the EFI 1.0 specification. + + Abstraction of a very simple text based output device like VGA text mode or + a serial terminal. The Simple Text Out protocol instance can represent + a single hardware device or a virtual device that is an agregation + of multiple physical devices. + + 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: SimpleTextOut.h + +**/ + +#ifndef __SIMPLE_TEXT_OUT_H__ +#define __SIMPLE_TEXT_OUT_H__ + +#define EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID \ + { \ + 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ + } + +#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID + +typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUT_PROTOCOL; +typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL; + +// +// Define's for required EFI Unicode Box Draw characters +// +#define BOXDRAW_HORIZONTAL 0x2500 +#define BOXDRAW_VERTICAL 0x2502 +#define BOXDRAW_DOWN_RIGHT 0x250c +#define BOXDRAW_DOWN_LEFT 0x2510 +#define BOXDRAW_UP_RIGHT 0x2514 +#define BOXDRAW_UP_LEFT 0x2518 +#define BOXDRAW_VERTICAL_RIGHT 0x251c +#define BOXDRAW_VERTICAL_LEFT 0x2524 +#define BOXDRAW_DOWN_HORIZONTAL 0x252c +#define BOXDRAW_UP_HORIZONTAL 0x2534 +#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c +#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550 +#define BOXDRAW_DOUBLE_VERTICAL 0x2551 +#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552 +#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553 +#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554 +#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555 +#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556 +#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557 +#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558 +#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559 +#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a +#define BOXDRAW_UP_LEFT_DOUBLE 0x255b +#define BOXDRAW_UP_DOUBLE_LEFT 0x255c +#define BOXDRAW_DOUBLE_UP_LEFT 0x255d +#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e +#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f +#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560 +#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561 +#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562 +#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563 +#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564 +#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565 +#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566 +#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567 +#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568 +#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569 +#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a +#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b +#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c + +// +// EFI Required Block Elements Code Chart +// +#define BLOCKELEMENT_FULL_BLOCK 0x2588 +#define BLOCKELEMENT_LIGHT_SHADE 0x2591 + +// +// EFI Required Geometric Shapes Code Chart +// +#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2 +#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba +#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc +#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4 + +// +// EFI Required Arrow shapes +// +#define ARROW_LEFT 0x2190 +#define ARROW_UP 0x2191 +#define ARROW_RIGHT 0x2192 +#define ARROW_DOWN 0x2193 + +// +// EFI Console Colours +// +#define EFI_BLACK 0x00 +#define EFI_BLUE 0x01 +#define EFI_GREEN 0x02 +#define EFI_CYAN (EFI_BLUE | EFI_GREEN) +#define EFI_RED 0x04 +#define EFI_MAGENTA (EFI_BLUE | EFI_RED) +#define EFI_BROWN (EFI_GREEN | EFI_RED) +#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED) +#define EFI_BRIGHT 0x08 +#define EFI_DARKGRAY (EFI_BRIGHT) +#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT) +#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT) +#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT) +#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT) +#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT) +#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT) +#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT) + +#define EFI_TEXT_ATTR(f, b) ((f) | ((b) << 4)) + +#define EFI_BACKGROUND_BLACK 0x00 +#define EFI_BACKGROUND_BLUE 0x10 +#define EFI_BACKGROUND_GREEN 0x20 +#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN) +#define EFI_BACKGROUND_RED 0x40 +#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED) +#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED) +#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED) + +// +// We currently define attributes from 0 - 7F for color manipulations +// To internally handle the local display characteristics for a particular character, we are defining +// Bit 7 to signify the local glyph representation for a character. If turned on, glyphs will be +// pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19) +// If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to +// non-local displays (e.g. serial or LAN consoles). +// +#define EFI_WIDE_ATTRIBUTE 0x80 + +/** + Reset the text output device hardware and optionaly run diagnostics + + @param This Protocol instance pointer. + @param ExtendedVerification Driver may perform more exhaustive verfication + operation of the device during reset. + + @retval EFI_SUCCESS The text output device was reset. + @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and + could not be reset. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_RESET) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +; + +/** + Write a Unicode string to the output device. + + @param This Protocol instance pointer. + @param String The NULL-terminated Unicode string to be displayed on the output + device(s). All output devices must also support the Unicode + drawing defined in this file. + + @retval EFI_SUCCESS The string was output to the device. + @retval EFI_DEVICE_ERROR The device reported an error while attempting to output + the text. + @retval EFI_UNSUPPORTED The output device's mode is not currently in a + defined text mode. + @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the + characters in the Unicode string could not be + rendered and were skipped. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_STRING) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN CHAR16 *String + ) +; + +/** + Verifies that all characters in a Unicode string can be output to the + target device. + + @param This Protocol instance pointer. + @param String The NULL-terminated Unicode string to be examined for the output + device(s). + + @retval EFI_SUCCESS The device(s) are capable of rendering the output string. + @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be + rendered by one or more of the output devices mapped + by the EFI handle. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_TEST_STRING) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN CHAR16 *String + ) +; + +/** + Returns information for an available text mode that the output device(s) + supports. + + @param This Protocol instance pointer. + @param ModeNumber The mode number to return information on. + @param Columns Returns the geometry of the text output device for the + requested ModeNumber. + @param Rows Returns the geometry of the text output device for the + requested ModeNumber. + + @retval EFI_SUCCESS The requested mode information was returned. + @retval EFI_DEVICE_ERROR The device had an error and could not complete the request. + @retval EFI_UNSUPPORTED The mode number was not valid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_QUERY_MODE) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN UINTN ModeNumber, + OUT UINTN *Columns, + OUT UINTN *Rows + ) +; + +/** + Sets the output device(s) to a specified mode. + + @param This Protocol instance pointer. + @param ModeNumber The mode number to set. + + @retval EFI_SUCCESS The requested text mode was set. + @retval EFI_DEVICE_ERROR The device had an error and could not complete the request. + @retval EFI_UNSUPPORTED The mode number was not valid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_MODE) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN UINTN ModeNumber + ) +; + +/** + Sets the background and foreground colors for the OutputString () and + ClearScreen () functions. + + @param This Protocol instance pointer. + @param Attribute The attribute to set. Bits 0..3 are the foreground color, and + bits 4..6 are the background color. All other bits are undefined + and must be zero. The valid Attributes are defined in this file. + + @retval EFI_SUCCESS The attribute was set. + @retval EFI_DEVICE_ ERROR The device had an error and could not complete the request. + @retval EFI_UNSUPPORTED The attribute requested is not defined. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN UINTN Attribute + ) +; + +/** + Clears the output device(s) display to the currently selected background + color. + + @param This Protocol instance pointer. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The device had an error and could not complete the request. + @retval EFI_UNSUPPORTED The output device is not in a valid text mode. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_CLEAR_SCREEN) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This + ) +; + +/** + Sets the current coordinates of the cursor position + + @param This Protocol instance pointer. + @param Column The position to set the cursor to. Must be greater than or + equal to zero and less than the number of columns and rows + by QueryMode (). + @param Row The position to set the cursor to. Must be greater than or + equal to zero and less than the number of columns and rows + by QueryMode (). + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The device had an error and could not complete the request. + @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the + cursor position is invalid for the current mode. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN UINTN Column, + IN UINTN Row + ) +; + +/** + Makes the cursor visible or invisible + + @param This Protocol instance pointer. + @param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is + set to be invisible. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_DEVICE_ERROR The device had an error and could not complete the + request, or the device does not support changing + the cursor mode. + @retval EFI_UNSUPPORTED The output device is not in a valid text mode. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TEXT_ENABLE_CURSOR) ( + IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This, + IN BOOLEAN Visible + ) +; + +/** + Mode Structure pointed to by Simple Text Out protocol. + + MaxMode - The number of modes supported by QueryMode () and SetMode (). + Mode - The text mode of the output device(s). + Attribute - The current character output attribute + CursorColumn - The cursor's column. + CursorRow - The cursor's row. + CursorVisible - The cursor is currently visbile or not. + +**/ +typedef struct { + INT32 MaxMode; + + // + // current settings + // + INT32 Mode; + INT32 Attribute; + INT32 CursorColumn; + INT32 CursorRow; + BOOLEAN CursorVisible; +} EFI_SIMPLE_TEXT_OUTPUT_MODE; + +struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL { + EFI_TEXT_RESET Reset; + + EFI_TEXT_STRING OutputString; + EFI_TEXT_TEST_STRING TestString; + + EFI_TEXT_QUERY_MODE QueryMode; + EFI_TEXT_SET_MODE SetMode; + EFI_TEXT_SET_ATTRIBUTE SetAttribute; + + EFI_TEXT_CLEAR_SCREEN ClearScreen; + EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; + EFI_TEXT_ENABLE_CURSOR EnableCursor; + + // + // Current mode + // + EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode; +}; + +extern EFI_GUID gEfiSimpleTextOutProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/SmbusHc.h b/MdePkg/Include/Protocol/SmbusHc.h new file mode 100644 index 0000000000..d00097595f --- /dev/null +++ b/MdePkg/Include/Protocol/SmbusHc.h @@ -0,0 +1,311 @@ +/** @file + The file provides basic SMBus host controller management + and basic data transactions over the SMBus. + + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: SmbusHc.h + + @par Revision Reference: PI + Version 1.00. + +**/ + +#ifndef __SMBUS_HC_H__ +#define __SMBUS_HC_H__ + +#include + +#define EFI_SMBUS_HC_PROTOCOL_GUID \ + {0xe49d33ed, 0x513d, 0x4634, { 0xb6, 0x98, 0x6f, 0x55, 0xaa, 0x75, 0x1c, 0x1b} } + +typedef struct _EFI_SMBUS_HC_PROTOCOL EFI_SMBUS_HC_PROTOCOL; + +/** + + The Execute() function provides a standard way to execute an + operation as defined in the System Management Bus (SMBus) + Specification. The resulting transaction will be either that + the SMBus slave devices accept this transaction or that this + function returns with error. Status Codes Returned + + @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance. + SlaveAddress The SMBus slave address of the device + with which to communicate. Type + EFI_SMBUS_DEVICE_ADDRESS is defined in + EFI_PEI_SMBUS_PPI.Execute() in the Platform + Initialization SMBus PPI Specification. + + @param Command This command is transmitted by the SMBus host + controller to the SMBus slave device and the + interpretation is SMBus slave device specific. + It can mean the offset to a list of functions + inside an SMBus slave device. Not all + operations or slave devices support this + command's registers. Type + EFI_SMBUS_DEVICE_COMMAND is defined in + EFI_PEI_SMBUS_PPI.Execute() in the Platform + Initialization SMBus PPI Specification. + Operation Signifies which particular SMBus + hardware protocol instance that it will use to + execute the SMBus transactions. This SMBus + hardware protocol is defined by the SMBus + Specification and is not related to PI + Architecture. Type EFI_SMBUS_OPERATION is + defined in EFI_PEI_SMBUS_PPI.Execute() in the + Platform Initialization SMBus PPI + Specification. + + @param PecCheck Defines if Packet Error Code (PEC) checking + is required for this operation. SMBus Host + Controller Code Definitions Version 1.0 + August 21, 2006 13 Length Signifies the + number of bytes that this operation will do. + The maximum number of bytes can be revision + specific and operation specific. This field + will contain the actual number of bytes that + are executed for this operation. Not all + operations require this argument. + + @param Buffer Contains the value of data to execute to the + SMBus slave device. Not all operations require + this argument. The length of this buffer is + identified by Length. + + + @retval EFI_SUCCESS The last data that was returned from the + access matched the poll exit criteria. + + @retval EFI_CRC_ERROR Checksum is not correct (PEC is + incorrect). + + @retval EFI_TIMEOUT Timeout expired before the operation was + completed. Timeout is determined by the + SMBus host controller device. + + @retval EFI_OUT_OF_RESOURCES The request could not be + completed due to a lack of + resources. + + @retval EFI_DEVICE_ERROR The request was not completed + because a failure that was reflected + in the Host Status Register bit. + Device errors are a result of a + transaction collision, illegal + command field, unclaimed cycle (host + initiated), or bus errors + (collisions). + + @retval EFI_INVALID_PARAMETER Operation is not defined in + EFI_SMBUS_OPERATION. + + @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for + operations except for + EfiSmbusQuickRead and + EfiSmbusQuickWrite. Length is + outside the range of valid + values. + + @retval EFI_UNSUPPORTED The SMBus operation or PEC is not + supported. + + @retval EFI_BUFFER_TOO_SMALL Buffer is not sufficient for + this operation. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION) ( + IN CONST EFI_SMBUS_HC_PROTOCOL *This, + IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress, + IN CONST EFI_SMBUS_DEVICE_COMMAND Command, + IN CONST EFI_SMBUS_OPERATION Operation, + IN CONST BOOLEAN PecCheck, + IN OUT UINTN *Length, + IN OUT VOID *Buffer +); + + + +/** + + The ArpDevice() function provides a standard way for a device driver to enumerate the entire + SMBus or specific devices on the bus. + + + @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance. + + @param ArpAll A Boolean expression that indicates if the + host drivers need to enumerate all the devices + or enumerate only the device that is + identified by SmbusUdid. If ArpAll is TRUE, + SmbusUdid and SlaveAddress are optional. If + ArpAll is FALSE, ArpDevice will enumerate + SmbusUdid and the address will be at + SlaveAddress. + + @param SmbusUdid The Unique Device Identifier (UDID) that is + associated with this device. Type + EFI_SMBUS_UDID is defined in + EFI_PEI_SMBUS_PPI.ArpDevice() in the + Platform Initialization SMBus PPI + Specification. + + @param SlaveAddress The SMBus slave address that is + associated with an SMBus UDID. + + + + @retval EFI_SUCCESS The last data that was returned from the + access matched the poll exit criteria. + + @retval EFI_CRC_ERROR Checksum is not correct (PEC is + incorrect). + + @retval EFI_TIMEOUT Timeout expired before the operation was + completed. Timeout is determined by the + SMBus host controller device. + + @retval EFI_OUT_OF_RESOURCES The request could not be + completed due to a lack of + resources. + + @retval EFI_DEVICE_ERROR The request was not completed + because a failure was reflected in + the Host Status Register bit. Device + Errors are a result of a transaction + collision, illegal command field, + unclaimed cycle (host initiated), or + bus errors (collisions). + + @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are + not implemented by this driver. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE) ( + IN CONST EFI_SMBUS_HC_PROTOCOL *This, + IN CONST BOOLEAN ArpAll, + IN CONST EFI_SMBUS_UDID *SmbusUdid, OPTIONAL + IN OUT EFI_SMBUS_DEVICE_ADDRESS *SlaveAddress OPTIONAL +); + + +/** + The GetArpMap() function returns the mapping of all the SMBus devices that were enumerated + by the SMBus host driver. + + @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance. + + @param Length Size of the buffer that contains the SMBus + device map. + + @param SmbusDeviceMap The pointer to the device map as + enumerated by the SMBus controller + driver. + + @retval EFI_SUCCESS The SMBus returned the current device + map. + + @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are + not implemented by this driver. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP) ( + IN CONST EFI_SMBUS_HC_PROTOCOL *This, + IN OUT UINTN *Length, + IN OUT EFI_SMBUS_DEVICE_MAP **SmbusDeviceMap +); + + + +// +// EFI_SMBUS_NOTIFY_FUNCTION +// +typedef +EFI_STATUS +(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION) ( + IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress, + IN CONST UINTN Data +); + + +/** + + The Notify() function registers all the callback functions to + allow the bus driver to call these functions when the + SlaveAddress/Data pair happens. + + @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance. + + @param SlaveAddress Address that the host controller detects + as sending a message and calls all the registered function. + + @param Data Data that the host controller detects as sending + message and calls all the registered function. + + + @param NotifyFunction The function to call when the bus + driver detects the SlaveAddress and + Data pair. + + @retval EFI_SUCCESS NotifyFunction was registered. + + @retval EFI_UNSUPPORTED ArpDevice, GetArpMap, and Notify are + not implemented by this driver. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY) ( + IN CONST EFI_SMBUS_HC_PROTOCOL *This, + IN CONST EFI_SMBUS_DEVICE_ADDRESS SlaveAddress, + IN CONST UINTN Data, + IN CONST EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction +); + + +/** + The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data + transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus + host controller. + + @param Execute Executes the SMBus operation to an SMBus slave + device. See the Execute() function description. + + @param ArpDevice Allows an SMBus 2.0 device(s) to be Address + Resolution Protocol (ARP). + + @param GetArpMap Allows a driver to retrieve the address that + was allocated by the SMBus host controller + during enumeration/ARP. See the GetArpMap() + function description. + + @param Notify Allows a driver to register for a callback + to the SMBus host controller driver when the + bus issues a notification to the bus + controller driver. See the Notify() function + description. +**/ +struct _EFI_SMBUS_HC_PROTOCOL { + EFI_SMBUS_HC_EXECUTE_OPERATION Execute; + EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE ArpDevice; + EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap; + EFI_SMBUS_HC_PROTOCOL_NOTIFY Notify; +}; + + +extern EFI_GUID gEfiSmbusHcProtocolGuid; + +#endif + diff --git a/MdePkg/Include/Protocol/StatusCode.h b/MdePkg/Include/Protocol/StatusCode.h new file mode 100644 index 0000000000..6bfaeaedd2 --- /dev/null +++ b/MdePkg/Include/Protocol/StatusCode.h @@ -0,0 +1,77 @@ +/** @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/Protocol/TapeIo.h b/MdePkg/Include/Protocol/TapeIo.h new file mode 100644 index 0000000000..919c95bc70 --- /dev/null +++ b/MdePkg/Include/Protocol/TapeIo.h @@ -0,0 +1,236 @@ +/** @file + EFI_TAPE_IO_PROTOCOL as defined in the UEFI 2.0. + Provide services to control and access a tape device. + + 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: TapeIo.h + +**/ + +#ifndef __EFI_TAPE_IO_PROTOCOL_H__ +#define __EFI_TAPE_IO_PROTOCOL_H__ + +#define EFI_TAPE_IO_PROTOCOL_GUID \ + { \ + 0x1e93e633, 0xd65a, 0x459e, {0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \ + } + +typedef struct _EFI_TAPE_IO_PROTOCOL EFI_TAPE_IO_PROTOCOL; + +typedef struct { + UINT64 Signature; + UINT32 Revision; + UINT32 BootDescSize; + UINT32 BootDescCRC; + EFI_GUID TapeGUID; + EFI_GUID TapeType; + EFI_GUID TapeUnique; + UINT32 BLLocation; + UINT32 BLBlocksize; + UINT32 BLFilesize; + CHAR8 OSVersion[40]; + CHAR8 AppVersion[40]; + CHAR8 CreationDate[10]; + CHAR8 CreationTime[10]; + CHAR8 SystemName[256]; // UTF-8 + CHAR8 TapeTitle[120]; // UTF-8 + CHAR8 pad[468]; // pad to 1024 +} TAPE_HEADER; + +/** + Reads from the tape. + + @param This A pointer to the EFI_TAPE_IO_PROTOCOL instance. + @param BufferSize Size of the buffer in bytes pointed to by Buffer. + @param Buffer Pointer to the buffer for data to be read into. + + @retval EFI_SUCCESS Data was successfully transferred from the media. + @retval EFI_END_OF_FILE A filemark was encountered which limited the data + transferred by the read operation or the head is positioned + just after a filemark. + @retval EFI_NO_MEDIA No media is loaded in the device. + @retval EFI_NOT_READY The transfer failed since the device was not ready (e.g. not + online). The transfer may be retried at a later time. + @retval EFI_UNSUPPORTED The device does not support this type of transfer. + @retval EFI_TIMEOUT The transfer failed to complete within the timeout specified. + @retval EFI_MEDIA_CHANGED The media in the device was changed since the last access. + The transfer was aborted since the current position of the + media may be incorrect. + @retval EFI_INVALID_PARAMETER A NULL Buffer was specified with a non-zero + BufferSize or the device is operating in fixed block + size mode and the BufferSize was not a multiple of + device's fixed block size + @retval EFI_DEVICE_ERROR A device error occurred while attempting to transfer data + from the media. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TAPE_READ) ( + IN EFI_TAPE_IO_PROTOCOL *This, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +; + +/** + Writes to the tape. + + @param This A pointer to the EFI_TAPE_IO_PROTOCOL instance. + @param BufferSize Size of the buffer in bytes pointed to by Buffer. + @param Buffer Pointer to the buffer for data to be written from. + + @retval EFI_SUCCESS Data was successfully transferred to the media. + @retval EFI_END_OF_MEDIA The logical end of media has been reached. Data may have + been successfully transferred to the media. + @retval EFI_NO_MEDIA No media is loaded in the device. + @retval EFI_NOT_READY The transfer failed since the device was not ready (e.g. not + online). The transfer may be retried at a later time. + @retval EFI_UNSUPPORTED The device does not support this type of transfer. + @retval EFI_TIMEOUT The transfer failed to complete within the timeout specified. + @retval EFI_MEDIA_CHANGED The media in the device was changed since the last access. + The transfer was aborted since the current position of the + media may be incorrect. + @retval EFI_WRITE_PROTECTED The media in the device is write-protected. The transfer + was aborted since a write cannot be completed. + @retval EFI_INVALID_PARAMETER A NULL Buffer was specified with a non-zero + BufferSize or the device is operating in fixed block + size mode and the BufferSize was not a multiple of + device's fixed block size + @retval EFI_DEVICE_ERROR A device error occurred while attempting to transfer data + from the media. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TAPE_WRITE) ( + IN EFI_TAPE_IO_PROTOCOL *This, + IN UINTN *BufferSize, + IN VOID *Buffer + ) +; + + +/** + Rewinds the tape. + + @param This A pointer to the EFI_TAPE_IO_PROTOCOL instance. + + @retval EFI_SUCCESS The media was successfully repositioned. + @retval EFI_NO_MEDIA No media is loaded in the device. + @retval EFI_NOT_READY Repositioning the media failed since the device was not + ready (e.g. not online). The transfer may be retried at a later time. + @retval EFI_UNSUPPORTED The device does not support this type of media repositioning. + @retval EFI_TIMEOUT Repositioning of the media did not complete within the timeout specified. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to reposition the media. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TAPE_REWIND) ( + IN EFI_TAPE_IO_PROTOCOL *This + ) +; + + +/** + Positions the tape. + + @param This A pointer to the EFI_TAPE_IO_PROTOCOL instance. + @param Direction Direction and number of data blocks or filemarks to space over on media. + @param Type Type of mark to space over on media. + + @retval EFI_SUCCESS The media was successfully repositioned. + @retval EFI_END_OF_MEDIA Beginning or end of media was reached before the + indicated number of data blocks or filemarks were found. + @retval EFI_NO_MEDIA No media is loaded in the device. + @retval EFI_NOT_READY The reposition failed since the device was not ready (e.g. not + online). The reposition may be retried at a later time. + @retval EFI_UNSUPPORTED The device does not support this type of repositioning. + @retval EFI_TIMEOUT The repositioning failed to complete within the timeout specified. + @retval EFI_MEDIA_CHANGED The media in the device was changed since the last access. + Repositioning the media was aborted since the current + position of the media may be incorrect. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to reposition the media. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TAPE_SPACE) ( + IN EFI_TAPE_IO_PROTOCOL *This, + INTN Direction, + UINTN Type + ) +; + + +/** + Writes filemarks to the media. + + @param This A pointer to the EFI_TAPE_IO_PROTOCOL instance. + @param Count Number of filemarks to write to the media. + + @retval EFI_SUCCESS Data was successfully transferred from the media. + @retval EFI_NO_MEDIA No media is loaded in the device. + @retval EFI_NOT_READY The transfer failed since the device was not ready (e.g. not + online). The transfer may be retried at a later time. + @retval EFI_UNSUPPORTED The device does not support this type of repositioning. + @retval EFI_TIMEOUT The transfer failed to complete within the timeout specified. + @retval EFI_MEDIA_CHANGED The media in the device was changed since the last access. + The transfer was aborted since the current position of the + media may be incorrect. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to transfer data from the media. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TAPE_WRITEFM) ( + IN EFI_TAPE_IO_PROTOCOL *This, + IN UINTN Count + ) +; + + +/** + Resets the tape device. + + @param This A pointer to the EFI_TAPE_IO_PROTOCOL instance. + @param ExtendedVerification Indicates whether the parent bus should also be reset. + + @retval EFI_SUCCESS The bus and/or device were successfully reset. + @retval EFI_NO_MEDIA No media is loaded in the device. + @retval EFI_NOT_READY The reset failed since the device and/or bus was not ready. + The reset may be retried at a later time. + @retval EFI_UNSUPPORTED The device does not support this type of reset. + @retval EFI_TIMEOUT The reset did not complete within the timeout allowed. + @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the bus and/or device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TAPE_RESET) ( + IN EFI_TAPE_IO_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +; + +struct _EFI_TAPE_IO_PROTOCOL { + EFI_TAPE_READ TapeRead; + EFI_TAPE_WRITE TapeWrite; + EFI_TAPE_REWIND TapeRewind; + EFI_TAPE_SPACE TapeSpace; + EFI_TAPE_WRITEFM TapeWriteFM; + EFI_TAPE_RESET TapeReset; +}; + +extern EFI_GUID gEfiTapeIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Tcp4.h b/MdePkg/Include/Protocol/Tcp4.h new file mode 100644 index 0000000000..42aebdc7db --- /dev/null +++ b/MdePkg/Include/Protocol/Tcp4.h @@ -0,0 +1,510 @@ +/** @file + EFI TCPv4 Protocol Definition + The EFI TCPv4 Service Binding Protocol is used to locate EFI TCPv4 Protocol drivers to create + and destroy child of the driver to communicate with other host using TCP protocol. + The EFI TCPv4 Protocol provides services to send and receive data stream. + + 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: Tcp4.h + +**/ + +#ifndef __EFI_TCP4_PROTOCOL_H__ +#define __EFI_TCP4_PROTOCOL_H__ + +#include + +#define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \ + } + +#define EFI_TCP4_PROTOCOL_GUID \ + { \ + 0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \ + } + +typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL; + +typedef struct { + EFI_HANDLE InstanceHandle; + EFI_IPv4_ADDRESS LocalAddress; + UINT16 LocalPort; + EFI_IPv4_ADDRESS RemoteAddress; + UINT16 RemotePort; +} EFI_TCP4_SERVICE_POINT; + +typedef struct { + EFI_HANDLE DriverHandle; + UINT32 ServiceCount; + EFI_TCP4_SERVICE_POINT Services[1]; +} EFI_TCP4_VARIABLE_DATA; + +typedef struct { + BOOLEAN UseDefaultAddress; + EFI_IPv4_ADDRESS StationAddress; + EFI_IPv4_ADDRESS SubnetMask; + UINT16 StationPort; + EFI_IPv4_ADDRESS RemoteAddress; + UINT16 RemotePort; + BOOLEAN ActiveFlag; +} EFI_TCP4_ACCESS_POINT; + +typedef struct { + UINTN ReceiveBufferSize; + UINTN SendBufferSize; + UINTN MaxSynBackLog; + UINTN ConnectionTimeout; + UINTN DataRetries; + UINTN FinTimeout; + UINTN TimeWaitTimeout; + UINTN KeepAliveProbes; + UINTN KeepAliveTime; + UINTN KeepAliveInterval; + BOOLEAN EnableNagle; + BOOLEAN EnableTimeStamp; + BOOLEAN EnableWindowScaling; + BOOLEAN EnableSelectiveAck; + BOOLEAN EnablePathMtuDiscovery; +} EFI_TCP4_OPTION; + +typedef struct { + // + // I/O parameters + // + UINT8 TypeOfService; + UINT8 TimeToLive; + + // + // Access Point + // + EFI_TCP4_ACCESS_POINT AccessPoint; + + // + // TCP Control Options + // + EFI_TCP4_OPTION *ControlOption; +} EFI_TCP4_CONFIG_DATA; + +typedef enum { + Tcp4StateClosed = 0, + Tcp4StateListen = 1, + Tcp4StateSynSent = 2, + Tcp4StateSynReceived = 3, + Tcp4StateEstablished = 4, + Tcp4StateFinWait1 = 5, + Tcp4StateFinWait2 = 6, + Tcp4StateClosing = 7, + Tcp4StateTimeWait = 8, + Tcp4StateCloseWait = 9, + Tcp4StateLastAck = 10 +} EFI_TCP4_CONNECTION_STATE; + +typedef struct { + EFI_EVENT Event; + EFI_STATUS Status; +} EFI_TCP4_COMPLETION_TOKEN; + +typedef struct { + EFI_TCP4_COMPLETION_TOKEN CompletionToken; +} EFI_TCP4_CONNECTION_TOKEN; + +typedef struct { + EFI_TCP4_COMPLETION_TOKEN CompletionToken; + EFI_HANDLE NewChildHandle; +} EFI_TCP4_LISTEN_TOKEN; + +typedef struct { + UINTN FragmentLength; + VOID *FragmentBuffer; +} EFI_TCP4_FRAGMENT_DATA; + +typedef struct { + BOOLEAN UrgentFlag; + IN OUT UINTN DataLength; + UINTN FragmentCount; + EFI_TCP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_TCP4_RECEIVE_DATA; + +typedef struct { + BOOLEAN Push; + BOOLEAN Urgent; + UINTN DataLength; + UINTN FragmentCount; + EFI_TCP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_TCP4_TRANSMIT_DATA; + +typedef struct { + EFI_TCP4_COMPLETION_TOKEN CompletionToken; + union { + EFI_TCP4_RECEIVE_DATA *RxData; + EFI_TCP4_TRANSMIT_DATA *TxData; + } Packet; +} EFI_TCP4_IO_TOKEN; + +typedef struct { + EFI_TCP4_COMPLETION_TOKEN CompletionToken; + BOOLEAN AbortOnClose; +} EFI_TCP4_CLOSE_TOKEN; + +// +// Interface definition for TCP4 protocol +// + +/** + Get the current operational status. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param Tcp4State Pointer to the buffer to receive the current TCP state. + @param Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration. + @param Ip4ModeData Pointer to the buffer to receive the current IPv4 configuration + data used by the TCPv4 instance. + @param MnpConfigData Pointer to the buffer to receive the current MNP configuration + data used indirectly by the TCPv4 instance. + @param SnpModeData Pointer to the buffer to receive the current SNP configuration + data used indirectly by the TCPv4 instance. + + @retval EFI_SUCCESS The mode data was read. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_STARTED No configuration data is available because this instance hasn't + been started. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_GET_MODE_DATA) ( + IN CONST EFI_TCP4_PROTOCOL *This, + OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL, + OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL, + OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, + OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, + OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL + ) +; + +/** + Initialize or brutally reset the operational parameters for this EFI TCPv4 instance. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param Tcp4ConfigData Pointer to the configure data to configure the instance. + + @retval EFI_SUCCESS The operational settings are set, changed, or reset + successfully. + @retval EFI_INVALID_PARAMETER Some parameter is invalid. + @retval EFI_NO_MAPPING When using a default address, configuration (through + DHCP, BOOTP, RARP, etc.) is not finished yet. + @retval EFI_ACCESS_DENIED Configuring TCP instance when it is configured without + calling Configure() with NULL to reset it. + @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. + @retval EFI_UNSUPPORTED One or more of the control options are not supported in + the implementation. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when + executing Configure(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_CONFIGURE) ( + IN EFI_TCP4_PROTOCOL *This, + IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL + ) +; + + +/** + Add or delete a route entry to the route table + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param DeleteRoute Set it to TRUE to delete this route from the routing table. Set it to + FALSE to add this route to the routing table. + DestinationAddress and SubnetMask are used as the + keywords to search route entry. + @param SubnetAddress The destination network. + @param SubnetMask The subnet mask of the destination network. + @param GatewayAddress The gateway address for this route. It must be on the same + subnet with the station address unless a direct route is specified. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_NOT_STARTED The EFI TCPv4 Protocol instance has not been configured. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - SubnetAddress is NULL. + - SubnetMask is NULL. + - GatewayAddress is NULL. + - *SubnetAddress is not NULL a valid subnet address. + - *SubnetMask is not a valid subnet mask. + - *GatewayAddress is not a valid unicast IP address or it + is not in the same subnet. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to add the entry to the + routing table. + @retval EFI_NOT_FOUND This route is not in the routing table. + @retval EFI_ACCESS_DENIED The route is already defined in the routing table. + @retval EFI_UNSUPPORTED The TCP driver does not support this operation. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_ROUTES) ( + IN EFI_TCP4_PROTOCOL *This, + IN BOOLEAN DeleteRoute, + IN EFI_IPv4_ADDRESS *SubnetAddress, + IN EFI_IPv4_ADDRESS *SubnetMask, + IN EFI_IPv4_ADDRESS *GatewayAddress + ) +; + +/** + Initiate a nonblocking TCP connection request for an active TCP instance. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param ConnectionToken Pointer to the connection token to return when the TCP three + way handshake finishes. + + @retval EFI_SUCCESS The connection request is successfully initiated and the state + - of this TCPv4 instance has been changed to + - Tcp4StateSynSent. + @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured. + @retval EFI_ACCESS_DENIED One or more of the following conditions are TRUE: + - This instance is not configured as an active one. + - This instance is not in Tcp4StateClosed state. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + - This is NULL. + - ConnectionToken is NULL. + - ConnectionToken->CompletionToken.Event is NULL. + @retval EFI_OUT_OF_RESOURCES The driver can't allocate enough resource to initiate the activeopen. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_CONNECT) ( + IN EFI_TCP4_PROTOCOL *This, + IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken + ) +; + + +/** + Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param ListenToken Pointer to the listen token to return when operation finishes. + + @retval EFI_SUCCESS The listen token has been queued successfully. + @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured. + @retval EFI_ACCESS_DENIED One or more of the following are TRUE: + - This instance is not a passive instance. + - This instance is not in Tcp4StateListen state. + - The same listen token has already existed in the listen + token queue of this TCP instance. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + - This is NULL. + - ListenToken is NULL. + - ListentToken->CompletionToken.Event is NULL. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation. + @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_ACCEPT) ( + IN EFI_TCP4_PROTOCOL *This, + IN EFI_TCP4_LISTEN_TOKEN *ListenToken + ) +; + +/** + Queues outgoing data into the transmit queue. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param Token Pointer to the completion token to queue to the transmit queue. + + @retval EFI_SUCCESS The data has been queued for transmission. + @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + - This is NULL. + - Token is NULL. + - Token->CompletionToken.Event is NULL. + - Token->Packet.TxData is NULL L. + - Token->Packet.FragmentCount is zero. + - Token->Packet.DataLength is not equal to the sum of fragment lengths. + @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE: + - A transmit completion token with the same Token->CompletionToken.Event + was already in the transmission queue. + - The current instance is in Tcp4StateClosed state. + - The current instance is a passive one and it is in + Tcp4StateListen state. + - User has called Close() to disconnect this connection. + @retval EFI_NOT_READY The completion token could not be queued because the + transmit queue is full. + @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of resource + shortage. + @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_TRANSMIT) ( + IN EFI_TCP4_PROTOCOL *This, + IN EFI_TCP4_IO_TOKEN *Token + ) +; + + +/** + Places an asynchronous receive request into the receiving queue. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param Token Pointer to a token that is associated with the receive data + descriptor. + + @retval EFI_SUCCESS The receive completion token was cached. + @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP, + etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - Token is NULL. + - Token->CompletionToken.Event is NULL. + - Token->Packet.RxData is NULL. + - Token->Packet.RxData->DataLength is 0. + - The Token->Packet.RxData->DataLength is not + the sum of all FragmentBuffer length in FragmentTable. + @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of + system resources (usually memory). + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE: + - A receive completion token with the same Token- + >CompletionToken.Event was already in the receive + queue. + - The current instance is in Tcp4StateClosed state. + - The current instance is a passive one and it is in + Tcp4StateListen state. + - User has called Close() to disconnect this connection. + @retval EFI_CONNECTION_FIN The communication peer has closed the connection and there is + no any buffered data in the receive buffer of this instance. + @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_RECEIVE) ( + IN EFI_TCP4_PROTOCOL *This, + IN EFI_TCP4_IO_TOKEN *Token + ) +; + +/** + Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a + nonblocking operation. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param CloseToken Pointer to the close token to return when operation finishes. + + @retval EFI_SUCCESS The Close() is called successfully. + @retval EFI_NOT_STARTED This EFI TCPv4 Protocol instance has not been configured. + @retval EFI_ACCESS_DENIED One or more of the following are TRUE: + - Configure() has been called with + TcpConfigData set to NULL and this function has + not returned. + - Previous Close() call on this instance has not + finished. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + - This is NULL. + - CloseToken is NULL. + - CloseToken->CompletionToken.Event is NULL. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the operation. + @retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_CLOSE) ( + IN EFI_TCP4_PROTOCOL *This, + IN EFI_TCP4_CLOSE_TOKEN *CloseToken + ) +; + +/** + Abort an asynchronous connection, listen, transmission or receive request. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + @param Token Pointer to a token that has been issued by + EFI_TCP4_PROTOCOL.Connect(), + EFI_TCP4_PROTOCOL.Accept(), + EFI_TCP4_PROTOCOL.Transmit() or + EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending + tokens issued by above four functions will be aborted. Type + EFI_TCP4_COMPLETION_TOKEN is defined in + EFI_TCP4_PROTOCOL.Connect(). + + @retval EFI_SUCCESS Incoming or outgoing data was processed. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_NOT_READY No incoming or outgoing data is processed. + @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue. + Consider increasing the polling rate. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_CANCEL) ( + IN EFI_TCP4_PROTOCOL *This, + IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL + ) +; + + +/** + Poll to receive incoming data and transmit outgoing segments. + + @param This Pointer to the EFI_TCP4_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_NOT_READY No incoming or outgoing data is processed. + @retval EFI_TIMEOUT Data was dropped out of the transmission or receive queue. + Consider increasing the polling rate. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_TCP4_POLL) ( + IN EFI_TCP4_PROTOCOL *This + ) +; + +struct _EFI_TCP4_PROTOCOL { + EFI_TCP4_GET_MODE_DATA GetModeData; + EFI_TCP4_CONFIGURE Configure; + EFI_TCP4_ROUTES Routes; + EFI_TCP4_CONNECT Connect; + EFI_TCP4_ACCEPT Accept; + EFI_TCP4_TRANSMIT Transmit; + EFI_TCP4_RECEIVE Receive; + EFI_TCP4_CLOSE Close; + EFI_TCP4_CANCEL Cancel; + EFI_TCP4_POLL Poll; +}; + +#define EFI_CONNECTION_FIN EFIERR (104) +#define EFI_CONNECTION_RESET EFIERR (105) +#define EFI_CONNECTION_REFUSED EFIERR (106) + +extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid; +extern EFI_GUID gEfiTcp4ProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Timer.h b/MdePkg/Include/Protocol/Timer.h new file mode 100644 index 0000000000..302ae1428a --- /dev/null +++ b/MdePkg/Include/Protocol/Timer.h @@ -0,0 +1,211 @@ +/** @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/Protocol/Udp4.h b/MdePkg/Include/Protocol/Udp4.h new file mode 100644 index 0000000000..9725a1bf91 --- /dev/null +++ b/MdePkg/Include/Protocol/Udp4.h @@ -0,0 +1,364 @@ +/** @file + 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: Udp4.h + +**/ + +#ifndef __EFI_UDP4_PROTOCOL_H__ +#define __EFI_UDP4_PROTOCOL_H__ + +#include +// +//GUID definitions +// +#define EFI_UDP4_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } \ + } + +#define EFI_UDP4_PROTOCOL_GUID \ + { \ + 0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } \ + } + +typedef struct _EFI_UDP4_PROTOCOL EFI_UDP4_PROTOCOL; + +typedef struct { + EFI_HANDLE InstanceHandle; + EFI_IPv4_ADDRESS LocalAddress; + UINT16 LocalPort; + EFI_IPv4_ADDRESS RemoteAddress; + UINT16 RemotePort; +} EFI_UDP4_SERVICE_POINT; + +typedef struct { + EFI_HANDLE DriverHandle; + UINT32 ServiceCount; + EFI_UDP4_SERVICE_POINT Services[1]; +} EFI_UDP4_VARIABLE_DATA; + +// +//ICMP error definitions +// +#define EFI_NETWORK_UNREACHABLE EFIERR(100) +#define EFI_HOST_UNREACHABLE EFIERR(101) +#define EFI_PROTOCOL_UNREACHABLE EFIERR(102) +#define EFI_PORT_UNREACHABLE EFIERR(103) + + +typedef struct { + UINT32 FragmentLength; + VOID *FragmentBuffer; +} EFI_UDP4_FRAGMENT_DATA; + +typedef struct { + EFI_IPv4_ADDRESS SourceAddress; + UINT16 SourcePort; + EFI_IPv4_ADDRESS DestinationAddress; + UINT16 DestinationPort; +} EFI_UDP4_SESSION_DATA; +typedef struct { + // + // Receiving Filters + // + BOOLEAN AcceptBroadcast; + BOOLEAN AcceptPromiscuous; + BOOLEAN AcceptAnyPort; + BOOLEAN AllowDuplicatePort; + // + // I/O parameters + // + UINT8 TypeOfService; + UINT8 TimeToLive; + BOOLEAN DoNotFragment; + UINT32 ReceiveTimeout; + UINT32 TransmitTimeout; + // + // Access Point + // + BOOLEAN UseDefaultAddress; + EFI_IPv4_ADDRESS StationAddress; + EFI_IPv4_ADDRESS SubnetMask; + UINT16 StationPort; + EFI_IPv4_ADDRESS RemoteAddress; + UINT16 RemotePort; +} EFI_UDP4_CONFIG_DATA; + +typedef struct { + EFI_UDP4_SESSION_DATA *UdpSessionData; //OPTIONAL + EFI_IPv4_ADDRESS *GatewayAddress; //OPTIONAL + UINT32 DataLength; + UINT32 FragmentCount; + EFI_UDP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_UDP4_TRANSMIT_DATA; + +typedef struct { + EFI_TIME TimeStamp; + EFI_EVENT RecycleSignal; + EFI_UDP4_SESSION_DATA UdpSession; + UINT32 DataLength; + UINT32 FragmentCount; + EFI_UDP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_UDP4_RECEIVE_DATA; + + +typedef struct { + EFI_EVENT Event; + EFI_STATUS Status; + union { + EFI_UDP4_RECEIVE_DATA *RxData; + EFI_UDP4_TRANSMIT_DATA *TxData; + } Packet; +} EFI_UDP4_COMPLETION_TOKEN; + +/** + Reads the current operational settings. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + @param Udp4ConfigData Pointer to the buffer to receive the current configuration data. + @param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure. + @param MnpConfigData Pointer to the managed network configuration data structure. + @param SnpModeData Pointer to the simple network mode data structure. + + @retval EFI_SUCCESS The mode data was read. + @retval EFI_NOT_STARTED When Udp4ConfigData is queried, no configuration data is + available because this instance has not been started. + @retval EFI_INVALID_PARAMETER This is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_GET_MODE_DATA) ( + IN EFI_UDP4_PROTOCOL *This, + OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL, + OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, + OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, + OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL + ) +; + + +/** + Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4 + Protocol. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + @param Udp4ConfigData Pointer to the buffer to receive the current configuration data. + + @retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE: + @retval EFI_ALREADY_STARTED The EFI UDPv4 Protocol instance is already started/configured + and must be stopped/reset before it can be reconfigured. + @retval EFI_ACCESS_DENIED UdpConfigData. AllowDuplicatePort is FALSE + and UdpConfigData.StationPort is already used by + other instance. + @retval EFI_OUT_OF_RESOURCES The EFI UDPv4 Protocol driver cannot allocate memory for this + EFI UDPv4 Protocol instance. + @retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance + was not opened. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_CONFIGURE) ( + IN EFI_UDP4_PROTOCOL *This, + IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL + ) +; + +/** + Joins and leaves multicast groups. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + @param JoinFlag Set to TRUE to join a multicast group. Set to FALSE to leave one + or all multicast groups. + @param MulticastAddress Pointer to multicast group address to join or leave. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_OUT_OF_RESOURCES Could not allocate resources to join the group. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + - This is NULL. + - JoinFlag is TRUE and MulticastAddress is NULL. + - JoinFlag is TRUE and *MulticastAddress is not + a valid multicast address. + @retval EFI_ALREADY_STARTED The group address is already in the group table (when + JoinFlag is TRUE). + @retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is + FALSE). + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_GROUPS) ( + IN EFI_UDP4_PROTOCOL *This, + IN BOOLEAN JoinFlag, + IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL + ) +; + +/** + Adds and deletes routing table entries. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + @param DeleteRoute Set to TRUE to delete this route from the routing table. + Set to FALSE to add this route to the routing table. + @param SubnetAddress The destination network address that needs to be routed. + @param SubnetMask The subnet mask of SubnetAddress. + @param GatewayAddress The gateway IP address for this route. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_NOT_STARTED The EFI UDPv4 Protocol instance has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + - RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table. + @retval EFI_NOT_FOUND This route is not in the routing table. + @retval EFI_ACCESS_DENIED The route is already defined in the routing table. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_ROUTES) ( + IN EFI_UDP4_PROTOCOL *This, + IN BOOLEAN DeleteRoute, + IN EFI_IPv4_ADDRESS *SubnetAddress, + IN EFI_IPv4_ADDRESS *SubnetMask, + IN EFI_IPv4_ADDRESS *GatewayAddress + ) +; + +/** + Polls for incoming data packets and processes outgoing data packets. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_POLL) ( + IN EFI_UDP4_PROTOCOL *This + ) +; + +/** + Places an asynchronous receive request into the receiving queue. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + @param Token Pointer to a token that is associated with the receive data + descriptor. + + @retval EFI_SUCCESS The receive completion token was cached. + @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, RARP, etc.) + is not finished yet. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system + resources (usually memory). + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_ACCESS_DENIED A receive completion token with the same Token.Event was already in + the receive queue. + @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_RECEIVE) ( + IN EFI_UDP4_PROTOCOL *This, + IN EFI_UDP4_COMPLETION_TOKEN *Token + ) +; + +/** + Queues outgoing data packets into the transmit queue. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + @param Token Pointer to the completion token that will be placed into the + transmit queue. + + @retval EFI_SUCCESS The data has been queued for transmission. + @retval EFI_NOT_STARTED This EFI UDPv4 Protocol instance has not been started. + @retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_ACCESS_DENIED The transmit completion token with the same + Token.Event was already in the transmit queue. + @retval EFI_NOT_READY The completion token could not be queued because the + transmit queue is full. + @retval EFI_OUT_OF_RESOURCES Could not queue the transmit data. + @retval EFI_NOT_FOUND There is no route to the destination network or address. + @retval EFI_BAD_BUFFER_SIZE The data length is greater than the maximum UDP packet + size. Or the length of the IP header + UDP header + data + length is greater than MTU if DoNotFragment is TRUE. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_TRANSMIT) ( + IN EFI_UDP4_PROTOCOL *This, + IN EFI_UDP4_COMPLETION_TOKEN *Token + ) +; + +/** + Aborts an asynchronous transmit or receive request. + + @param This Pointer to the EFI_UDP4_PROTOCOL instance. + @param Token Pointer to a token that has been issued by + EFI_UDP4_PROTOCOL.Transmit() or + EFI_UDP4_PROTOCOL.Receive().If NULL, all pending + tokens are aborted. + + @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event + was signaled. When Token is NULL, all pending requests are + aborted and their events are signaled. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_STARTED This instance has not been started. + @retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, + RARP, etc.) is not finished yet. + @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was + not found in the transmit or receive queue. It has either completed + or was not issued by Transmit() and Receive(). + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UDP4_CANCEL)( + IN EFI_UDP4_PROTOCOL *This, + IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL + ) +; + +struct _EFI_UDP4_PROTOCOL { + EFI_UDP4_GET_MODE_DATA GetModeData; + EFI_UDP4_CONFIGURE Configure; + EFI_UDP4_GROUPS Groups; + EFI_UDP4_ROUTES Routes; + EFI_UDP4_TRANSMIT Transmit; + EFI_UDP4_RECEIVE Receive; + EFI_UDP4_CANCEL Cancel; + EFI_UDP4_POLL Poll; +}; + +extern EFI_GUID gEfiUdp4ServiceBindingProtocolGuid; +extern EFI_GUID gEfiUdp4ProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/UgaDraw.h b/MdePkg/Include/Protocol/UgaDraw.h new file mode 100644 index 0000000000..5586bdfffb --- /dev/null +++ b/MdePkg/Include/Protocol/UgaDraw.h @@ -0,0 +1,168 @@ +/** @file + UGA Draw protocol from the EFI 1.1 specification. + + Abstraction of a very simple graphics device. + + 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: UgaDraw.h + +**/ + +#ifndef __UGA_DRAW_H__ +#define __UGA_DRAW_H__ + +#define EFI_UGA_DRAW_PROTOCOL_GUID \ + { \ + 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \ + } + +typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL; + +/** + Return the current video mode information. + + @param This Protocol instance pointer. + @param HorizontalResolution Current video horizontal resolution in pixels + @param VerticalResolution Current video vertical resolution in pixels + @param ColorDepth Current video color depth in bits per pixel + @param RefreshRate Current video refresh rate in Hz. + + @retval EFI_SUCCESS Mode information returned. + @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () + @retval EFI_INVALID_PARAMETER One of the input args was NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) ( + IN EFI_UGA_DRAW_PROTOCOL *This, + OUT UINT32 *HorizontalResolution, + OUT UINT32 *VerticalResolution, + OUT UINT32 *ColorDepth, + OUT UINT32 *RefreshRate + ) +; + +/** + Return the current video mode information. + + @param This Protocol instance pointer. + @param HorizontalResolution Current video horizontal resolution in pixels + @param VerticalResolution Current video vertical resolution in pixels + @param ColorDepth Current video color depth in bits per pixel + @param RefreshRate Current video refresh rate in Hz. + + @retval EFI_SUCCESS Mode information returned. + @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE) ( + IN EFI_UGA_DRAW_PROTOCOL *This, + IN UINT32 HorizontalResolution, + IN UINT32 VerticalResolution, + IN UINT32 ColorDepth, + IN UINT32 RefreshRate + ) +; + +typedef struct { + UINT8 Blue; + UINT8 Green; + UINT8 Red; + UINT8 Reserved; +} EFI_UGA_PIXEL; + +typedef union { + EFI_UGA_PIXEL Pixel; + UINT32 Raw; +} EFI_UGA_PIXEL_UNION; + +typedef enum { + EfiUgaVideoFill, + EfiUgaVideoToBltBuffer, + EfiUgaBltBufferToVideo, + EfiUgaVideoToVideo, + EfiUgaBltMax +} EFI_UGA_BLT_OPERATION; + +/** + Type specifying a pointer to a function to perform an UGA Blt operation. + + The following table defines actions for BltOperations: + + EfiUgaVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) + directly to every pixel of the video display rectangle + (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). + Only one pixel will be used from the BltBuffer. Delta is NOT used. + + EfiUgaVideoToBltBuffer - Read data from the video display rectangle + (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in + the BltBuffer rectangle (DestinationX, DestinationY ) + (DestinationX + Width, DestinationY + Height). If DestinationX or + DestinationY is not zero then Delta must be set to the length in bytes + of a row in the BltBuffer. + + EfiUgaBltBufferToVideo - Write data from the BltBuffer rectangle + (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the + video display rectangle (DestinationX, DestinationY) + (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is + not zero then Delta must be set to the length in bytes of a row in the + BltBuffer. + + EfiUgaVideoToVideo - Copy from the video display rectangle (SourceX, SourceY) + (SourceX + Width, SourceY + Height) .to the video display rectangle + (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). + The BltBuffer and Delta are not used in this mode. + + + @param[in] This - Protocol instance pointer. + @param[in] BltBuffer - Buffer containing data to blit into video buffer. This + buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL) + @param[in] BltOperation - Operation to perform on BlitBuffer and video memory + @param[in] SourceX - X coordinate of source for the BltBuffer. + @param[in] SourceY - Y coordinate of source for the BltBuffer. + @param[in] DestinationX - X coordinate of destination for the BltBuffer. + @param[in] DestinationY - Y coordinate of destination for the BltBuffer. + @param[in] Width - Width of rectangle in BltBuffer in pixels. + @param[in] Height - Hight of rectangle in BltBuffer in pixels. + @param[in] Delta - OPTIONAL + + @retval EFI_SUCCESS - The Blt operation completed. + @retval EFI_INVALID_PARAMETER - BltOperation is not valid. + @retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer. + +--*/ +typedef +EFI_STATUS +(EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) ( + IN EFI_UGA_DRAW_PROTOCOL * This, + IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL + IN EFI_UGA_BLT_OPERATION BltOperation, + IN UINTN SourceX, + IN UINTN SourceY, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height, + IN UINTN Delta OPTIONAL + ); + +struct _EFI_UGA_DRAW_PROTOCOL { + EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode; + EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode; + EFI_UGA_DRAW_PROTOCOL_BLT Blt; +}; + +extern EFI_GUID gEfiUgaDrawProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/UgaIo.h b/MdePkg/Include/Protocol/UgaIo.h new file mode 100644 index 0000000000..b1e7d44575 --- /dev/null +++ b/MdePkg/Include/Protocol/UgaIo.h @@ -0,0 +1,237 @@ + +/*++ + +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: + + UgaIo.h + +Abstract: + + UGA IO protocol from the EFI 1.1 specification. + + Abstraction of a very simple graphics device. + +--*/ + +#ifndef __UGA_IO_H__ +#define __UGA_IO_H__ + +#define EFI_UGA_IO_PROTOCOL_GUID \ + { \ + 0x61a4d49e, 0x6f68, 0x4f1b, { 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 } \ + } + +typedef struct _EFI_UGA_IO_PROTOCOL EFI_UGA_IO_PROTOCOL; + +typedef UINT32 UGA_STATUS; + +typedef enum { + UgaDtParentBus = 1, + UgaDtGraphicsController, + UgaDtOutputController, + UgaDtOutputPort, + UgaDtOther +} +UGA_DEVICE_TYPE, *PUGA_DEVICE_TYPE; + +typedef UINT32 UGA_DEVICE_ID, *PUGA_DEVICE_ID; + +typedef struct { + UGA_DEVICE_TYPE deviceType; + UGA_DEVICE_ID deviceId; + UINT32 ui32DeviceContextSize; + UINT32 ui32SharedContextSize; +} +UGA_DEVICE_DATA, *PUGA_DEVICE_DATA; + +typedef struct _UGA_DEVICE { + VOID *pvDeviceContext; + VOID *pvSharedContext; + VOID *pvRunTimeContext; + struct _UGA_DEVICE *pParentDevice; + VOID *pvBusIoServices; + VOID *pvStdIoServices; + UGA_DEVICE_DATA deviceData; +} +UGA_DEVICE, *PUGA_DEVICE; + +#ifndef UGA_IO_REQUEST_CODE +// +// Prevent conflicts with UGA typedefs. +// +typedef enum { + UgaIoGetVersion = 1, + UgaIoGetChildDevice, + UgaIoStartDevice, + UgaIoStopDevice, + UgaIoFlushDevice, + UgaIoResetDevice, + UgaIoGetDeviceState, + UgaIoSetDeviceState, + UgaIoSetPowerState, + UgaIoGetMemoryConfiguration, + UgaIoSetVideoMode, + UgaIoCopyRectangle, + UgaIoGetEdidSegment, + UgaIoDeviceChannelOpen, + UgaIoDeviceChannelClose, + UgaIoDeviceChannelRead, + UgaIoDeviceChannelWrite, + UgaIoGetPersistentDataSize, + UgaIoGetPersistentData, + UgaIoSetPersistentData, + UgaIoGetDevicePropertySize, + UgaIoGetDeviceProperty, + UgaIoBtPrivateInterface +} +UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE; + +#endif + +typedef struct { + IN UGA_IO_REQUEST_CODE ioRequestCode; + IN VOID *pvInBuffer; + IN UINT64 ui64InBufferSize; + OUT VOID *pvOutBuffer; + IN UINT64 ui64OutBufferSize; + OUT UINT64 ui64BytesReturned; +} +UGA_IO_REQUEST, *PUGA_IO_REQUEST; + +typedef +EFI_STATUS +(EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE) ( + IN EFI_UGA_IO_PROTOCOL * This, + IN UGA_DEVICE * ParentDevice, + IN UGA_DEVICE_DATA * DeviceData, + IN VOID *RunTimeContext, + OUT UGA_DEVICE **Device + ); + +/*++ + + Routine Description: + + Dynamically allocate storage for a child UGA_DEVICE . + + Arguments: + + This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is + defined in Section 10.7. + + ParentDevice - ParentDevice specifies a pointer to the parent device of Device. + + DeviceData - A pointer to UGA_DEVICE_DATA returned from a call to DispatchService() + with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice. + + RuntimeContext - Context to associate with Device. + + Device - The Device returns a dynamically allocated child UGA_DEVICE object + for ParentDevice. The caller is responsible for deleting Device. + + Returns: + + EFI_SUCCESS - Device was returned. + + EFI_INVALID_PARAMETER - One of the arguments was not valid. + + EFI_DEVICE_ERROR - The device had an error and could not complete the request. + +--*/ +typedef +EFI_STATUS +(EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE) ( + IN EFI_UGA_IO_PROTOCOL * This, + IN UGA_DEVICE * Device + ); + +/*++ + + Routine Description: + + Delete a dynamically allocated child UGA_DEVICE object that was allocated via + CreateDevice() . + + Arguments: + + This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is defined + in Section 10.7. + + Device - The Device points to a UGA_DEVICE object that was dynamically + allocated via a CreateDevice() call. + + Returns: + + EFI_SUCCESS - Device was deleted. + + EFI_INVALID_PARAMETER - The Device was not allocated via CreateDevice() + +--*/ +typedef UGA_STATUS (EFIAPI *PUGA_FW_SERVICE_DISPATCH) (IN PUGA_DEVICE pDevice, IN OUT PUGA_IO_REQUEST pIoRequest); + +/*++ + + Routine Description: + + This is the main UGA service dispatch routine for all UGA_IO_REQUEST s. + + Arguments: + + pDevice - pDevice specifies a pointer to a device object associated with a + device enumerated by a pIoRequest->ioRequestCode of type + UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL + is represented by pDevice being set to NULL. + + pIoRequest - pIoRequest points to a caller allocated buffer that contains data + defined by pIoRequest->ioRequestCode. See Related Definitions for + a definition of UGA_IO_REQUEST_CODE s and their associated data + structures. + + Returns: + + Varies depending on pIoRequest. + +--*/ +struct _EFI_UGA_IO_PROTOCOL { + EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice; + EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice; + PUGA_FW_SERVICE_DISPATCH DispatchService; +}; + +extern EFI_GUID gEfiUgaIoProtocolGuid; + +// +// Data structure that is stored in the EFI Configuration Table with the +// EFI_UGA_IO_PROTOCOL_GUID. The option ROMs listed in this table may have +// EBC UGA drivers. +// +typedef struct { + UINT32 Version; + UINT32 HeaderSize; + UINT32 SizeOfEntries; + UINT32 NumberOfEntries; +} EFI_DRIVER_OS_HANDOFF_HEADER; + +typedef enum { + EfiUgaDriverFromPciRom, + EfiUgaDriverFromSystem, + EfiDriverHandoffMax +} EFI_DRIVER_HANOFF_ENUM; + +typedef struct { + EFI_DRIVER_HANOFF_ENUM Type; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + VOID *PciRomImage; + UINT64 PciRomSize; +} EFI_DRIVER_OS_HANDOFF; + +#endif diff --git a/MdePkg/Include/Protocol/UnicodeCollation.h b/MdePkg/Include/Protocol/UnicodeCollation.h new file mode 100644 index 0000000000..e0278038f7 --- /dev/null +++ b/MdePkg/Include/Protocol/UnicodeCollation.h @@ -0,0 +1,183 @@ +/** @file + Unicode Collation protocol that follows the EFI 1.0 specification. + + 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: UnicodeCollation.h + +**/ + +#ifndef __UNICODE_COLLATION_H__ +#define __UNICODE_COLLATION_H__ + +#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \ + { \ + 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +typedef struct _EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL; + +// +// Protocol data structures and defines +// +#define EFI_UNICODE_BYTE_ORDER_MARK (CHAR16) (0xfeff) + +// +// Protocol member functions +// +/** + Performs a case-insensitive comparison of two Null-terminated Unicode + strings. + + @param This Protocol instance pointer. + @param Str1 A pointer to a Null-terminated Unicode string. + @param Str2 A pointer to a Null-terminated Unicode string. + + @retval 0 Str1 is equivalent to Str2 + @retval >_0 Str1 is lexically greater than Str2 + @retval <_0 Str1 is lexically less than Str2 + +**/ +typedef +INTN +(EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) ( + IN EFI_UNICODE_COLLATION_PROTOCOL *This, + IN CHAR16 *Str1, + IN CHAR16 *Str2 + ) +; + +/** + Performs a case-insensitive comparison of a Null-terminated Unicode + pattern string and a Null-terminated Unicode string. + + @param This Protocol instance pointer. + @param String A pointer to a Null-terminated Unicode string. + @param Pattern A pointer to a Null-terminated Unicode pattern string. + + @retval TRUE Pattern was found in String. + @retval FALSE Pattern was not found in String. + +**/ +typedef +BOOLEAN +(EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH) ( + IN EFI_UNICODE_COLLATION_PROTOCOL *This, + IN CHAR16 *String, + IN CHAR16 *Pattern + ) +; + +/** + Converts all the Unicode characters in a Null-terminated Unicode string to + lower case Unicode characters. + + @param This Protocol instance pointer. + @param String A pointer to a Null-terminated Unicode string. + + NONE + +**/ +typedef +VOID +(EFIAPI *EFI_UNICODE_COLLATION_STRLWR) ( + IN EFI_UNICODE_COLLATION_PROTOCOL *This, + IN OUT CHAR16 *Str + ) +; + +/** + Converts all the Unicode characters in a Null-terminated Unicode string to upper + case Unicode characters. + + @param This Protocol instance pointer. + @param String A pointer to a Null-terminated Unicode string. + + NONE + +**/ +typedef +VOID +(EFIAPI *EFI_UNICODE_COLLATION_STRUPR) ( + IN EFI_UNICODE_COLLATION_PROTOCOL *This, + IN OUT CHAR16 *Str + ) +; + +/** + Converts an 8.3 FAT file name in an OEM character set to a Null-terminated + Unicode string. + + @param This Protocol instance pointer. + @param FatSize The size of the string Fat in bytes. + @param Fat A pointer to a Null-terminated string that contains an 8.3 file + name using an OEM character set. + @param String A pointer to a Null-terminated Unicode string. The string must + be preallocated to hold FatSize Unicode characters. + + NONE + +**/ +typedef +VOID +(EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR) ( + IN EFI_UNICODE_COLLATION_PROTOCOL *This, + IN UINTN FatSize, + IN CHAR8 *Fat, + OUT CHAR16 *String + ) +; + +/** + Converts a Null-terminated Unicode string to legal characters in a FAT + filename using an OEM character set. + + @param This Protocol instance pointer. + @param String A pointer to a Null-terminated Unicode string. The string must + be preallocated to hold FatSize Unicode characters. + @param FatSize The size of the string Fat in bytes. + @param Fat A pointer to a Null-terminated string that contains an 8.3 file + name using an OEM character set. + + @retval TRUE Fat is a Long File Name + @retval FALSE Fat is an 8.3 file name + +**/ +typedef +BOOLEAN +(EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT) ( + IN EFI_UNICODE_COLLATION_PROTOCOL *This, + IN CHAR16 *String, + IN UINTN FatSize, + OUT CHAR8 *Fat + ) +; + +struct _EFI_UNICODE_COLLATION_PROTOCOL { + // + // general + // + EFI_UNICODE_COLLATION_STRICOLL StriColl; + EFI_UNICODE_COLLATION_METAIMATCH MetaiMatch; + EFI_UNICODE_COLLATION_STRLWR StrLwr; + EFI_UNICODE_COLLATION_STRUPR StrUpr; + + // + // for supporting fat volumes + // + EFI_UNICODE_COLLATION_FATTOSTR FatToStr; + EFI_UNICODE_COLLATION_STRTOFAT StrToFat; + + CHAR8 *SupportedLanguages; +}; + +extern EFI_GUID gEfiUnicodeCollationProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Usb2HostController.h b/MdePkg/Include/Protocol/Usb2HostController.h new file mode 100644 index 0000000000..f45478ac68 --- /dev/null +++ b/MdePkg/Include/Protocol/Usb2HostController.h @@ -0,0 +1,546 @@ +/** @file + EFI_USB2_HC_PROTOCOL as defined in UEFI 2.0. + + 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: Usb2HostController.h + +**/ + +#ifndef _USB2_HOSTCONTROLLER_H_ +#define _USB2_HOSTCONTROLLER_H_ + +#include +#include + +#define EFI_USB2_HC_PROTOCOL_GUID \ + { \ + 0x3e745226, 0x9818, 0x45b6, {0xa2, 0xac, 0xd7, 0xcd, 0xe, 0x8b, 0xa2, 0xbc } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_USB2_HC_PROTOCOL EFI_USB2_HC_PROTOCOL; + +#define EFI_USB_SPEED_FULL 0x0000 // 12 Mb/s, USB 1.1 OHCI and UHCI HC. +#define EFI_USB_SPEED_LOW 0x0001 // 1 Mb/s, USB 1.1 OHCI and UHCI HC. +#define EFI_USB_SPEED_HIGH 0x0002 // 480 Mb/s, USB 2.0 EHCI HC. + +typedef struct { + UINT8 TranslatorHubAddress; + UINT8 TranslatorPortNumber; +} EFI_USB2_HC_TRANSACTION_TRANSLATOR; + +// +// Protocol definitions +// + +/** + Retrieves the Host Controller capabilities. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param MaxSpeed Host controller data transfer speed. + @param PortNumber Number of the root hub ports. + @param Is64BitCapable TRUE if controller supports 64-bit memory addressing, + FALSE otherwise. + + @retval EFI_SUCCESS The host controller capabilities were retrieved successfully. + @retval EFI_INVALID_PARAMETER One of the input args was NULL. + @retval EFI_DEVICE_ERROR An error was encountered while attempting to + retrieve the capabilities. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_GET_CAPABILITY) ( + IN EFI_USB2_HC_PROTOCOL *This, + OUT UINT8 *MaxSpeed, + OUT UINT8 *PortNumber, + OUT UINT8 *Is64BitCapable + ) +; + +/** + Provides software reset for the USB host controller. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param Attributes A bit mask of the reset operation to perform. + + @retval EFI_SUCCESS The reset operation succeeded. + @retval EFI_INVALID_PARAMETER Attributes is not valid. + @retval EFI_UNSUPPORTED The type of reset specified by Attributes is not currently + supported by the host controller hardware. + @retval EFI_ACCESS_DENIED Reset operation is rejected due to the debug port being configured + and active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or + EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Attributes can be used to + perform reset operation for this host controller. + @retval EFI_DEVICE_ERROR An error was encountered while attempting to + retrieve the capabilities. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_RESET) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT16 Attributes + ) +; + +/** + + @param EfiUsbHcStateHalt The host controller is in halt + state. No USB transactions can occur + while in this state. The host + controller can enter this state for + three reasons: 1) After host + controller hardware reset. 2) + Explicitly set by software. 3) + Triggered by a fatal error such as + consistency check failure. + + + @param EfiUsbHcStateOperational The host controller is in an + operational state. When in + this state, the host + controller can execute bus + traffic. This state must be + explicitly set to enable the + USB bus traffic. + + + @param EfiUsbHcStateSuspend The host controller is in the + suspend state. No USB + transactions can occur while in + this state. The host controller + enters this state for the + following reasons: 1) Explicitly + set by software. 2) Triggered + when there is no bus traffic for + 3 microseconds. + +**/ +typedef enum { + EfiUsbHcStateHalt, + EfiUsbHcStateOperational, + EfiUsbHcStateSuspend, + EfiUsbHcStateMaximum +} EFI_USB_HC_STATE; + +/** + Retrieves current state of the USB host controller. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param State A pointer to the EFI_USB_HC_STATE data structure that + indicates current state of the USB host controller. + + @retval EFI_SUCCESS The state information of the host controller was returned in State. + @retval EFI_INVALID_PARAMETER State is NULL. + @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the + host controller's current state. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_GET_STATE) ( + IN CONST EFI_USB2_HC_PROTOCOL *This, + OUT EFI_USB_HC_STATE *State +) +; + +/** + Sets the USB host controller to a specific state. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param State Indicates the state of the host controller that will be set. + + @retval EFI_SUCCESS The USB host controller was successfully placed in the state + specified by State. + @retval EFI_INVALID_PARAMETER State is not valid. + @retval EFI_DEVICE_ERROR Failed to set the state specified by State due to device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_SET_STATE) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN EFI_USB_HC_STATE State + ) +; + +/** + Submits control transfer to a target USB device. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB. + @param DeviceSpeed Indicates device speed. + @param MaximumPacketLength Indicates the maximum packet size that the default control transfer + endpoint is capable of sending or receiving. + @param Request A pointer to the USB device request that will be sent to the USB device. + @param TransferDirection Specifies the data direction for the transfer. There are three values + available, EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData. + @param Data A pointer to the buffer of data that will be transmitted to USB device or + received from USB device. + @param DataLength On input, indicates the size, in bytes, of the data buffer specified by Data. + On output, indicates the amount of data actually transferred. + @param Translator A pointer to the transaction translator data. + @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is + allowed to complete. + @param TransferResult A pointer to the detailed result information generated by this control + transfer. + + @retval EFI_SUCCESS The control transfer was completed successfully. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources. + @retval EFI_TIMEOUT The control transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The control transfer failed due to host controller or device error. + Caller should check TransferResult for detailed error information. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaximumPacketLength, + IN EFI_USB_DEVICE_REQUEST *Request, + IN EFI_USB_DATA_DIRECTION TransferDirection, + IN OUT VOID *Data OPTIONAL, + IN OUT UINTN *DataLength OPTIONAL, + IN UINTN TimeOut, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, + OUT UINT32 *TransferResult + ) +; + +#define EFI_USB_MAX_BULK_BUFFER_NUM 10 + +/** + Submits bulk transfer to a bulk endpoint of a USB device. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB. + @param EndPointAddress The combination of an endpoint number and an endpoint direction of the + target USB device. + @param DeviceSpeed Indicates device speed. + @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of + sending or receiving. + @param DataBuffersNumber Number of data buffers prepared for the transfer. + @param Data Array of pointers to the buffers of data that will be transmitted to USB + device or received from USB device. + @param DataLength When input, indicates the size, in bytes, of the data buffers specified by + Data. When output, indicates the actually transferred data size. + @param DataToggle A pointer to the data toggle value. + @param Translator A pointer to the transaction translator data. + @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is + allowed to complete. + @param TransferResult A pointer to the detailed result information of the bulk transfer. + + @retval EFI_SUCCESS The bulk transfer was completed successfully. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The bulk transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error. + Caller should check TransferResult for detailed error information. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_BULK_TRANSFER) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaximumPacketLength, + IN UINT8 DataBuffersNumber, + IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM], + IN OUT UINTN *DataLength, + IN OUT UINT8 *DataToggle, + IN UINTN TimeOut, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, + OUT UINT32 *TransferResult + ) +; + +/** + Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device. + Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB. + @param EndPointAddress The combination of an endpoint number and an endpoint direction of the + target USB device. + @param DeviceSpeed Indicates device speed. + @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of + sending or receiving. + @param IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between the host and the + target interrupt endpoint. If FALSE, the specified asynchronous interrupt + pipe is canceled. If TRUE, and an interrupt transfer exists for the target + end point, then EFI_INVALID_PARAMETER is returned. + @param DataToggle A pointer to the data toggle value. + @param PollingInterval Indicates the interval, in milliseconds, that the asynchronous interrupt + transfer is polled. + @param DataLength Indicates the length of data to be received at the rate specified by + PollingInterval from the target asynchronous interrupt endpoint. + @param Translator A pointr to the transaction translator data. + @param CallBackFunction The Callback function. This function is called at the rate specified by + PollingInterval. + @param Context The context that is passed to the CallBackFunction. This is an + optional parameter and may be NULL. + + @retval EFI_SUCCESS The asynchronous interrupt transfer request has been successfully + submitted or canceled. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaxiumPacketLength, + IN BOOLEAN IsNewTransfer, + IN OUT UINT8 *DataToggle, + IN UINTN PollingInterval OPTIONAL, + IN UINTN DataLength OPTIONAL, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator OPTIONAL, + IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL, + IN VOID *Context OPTIONAL + ) +; + +/** + Submits synchronous interrupt transfer to an interrupt endpoint of a USB device. + Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB. + @param EndPointAddress The combination of an endpoint number and an endpoint direction of the + target USB device. + @param DeviceSpeed Indicates device speed. + @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of + sending or receiving. + @param Data A pointer to the buffer of data that will be transmitted to USB device or + received from USB device. + @param DataLength On input, the size, in bytes, of the data buffer specified by Data. On + output, the number of bytes transferred. + @param DataToggle A pointer to the data toggle value. + @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is + allowed to complete. + @param Translator A pointr to the transaction translator data. + @param TransferResult A pointer to the detailed result information from the synchronous + interrupt transfer. + + @retval EFI_SUCCESS The synchronous interrupt transfer was completed successfully. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The synchronous interrupt transfer could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The synchronous interrupt transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The synchronous interrupt transfer failed due to host controller or device error. + Caller should check TransferResult for detailed error information. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaximumPacketLength, + IN OUT VOID *Data, + IN OUT UINTN *DataLength, + IN OUT UINT8 *DataToggle, + IN UINTN TimeOut, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, + OUT UINT32 *TransferResult + ) +; + +#define EFI_USB_MAX_ISO_BUFFER_NUM 7 +#define EFI_USB_MAX_ISO_BUFFER_NUM1 2 + +/** + Submits isochronous transfer to an isochronous endpoint of a USB device. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB. + @param EndPointAddress The combination of an endpoint number and an endpoint direction of the + target USB device. + @param DeviceSpeed Indicates device speed. + @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of + sending or receiving. + @param DataBuffersNumber Number of data buffers prepared for the transfer. + @param Data Array of pointers to the buffers of data that will be transmitted to USB + device or received from USB device. + @param DataLength Specifies the length, in bytes, of the data to be sent to or received from + the USB device. + @param Translator A pointer to the transaction translator data. + @param TransferResult A pointer to the detailed result information of the isochronous transfer. + + @retval EFI_SUCCESS The isochronous transfer was completed successfully. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The isochronous transfer could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The isochronous transfer cannot be completed within the one USB frame time. + @retval EFI_DEVICE_ERROR The isochronous transfer failed due to host controller or device error. + Caller should check TransferResult for detailed error information. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaximumPacketLength, + IN UINT8 DataBuffersNumber, + IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM], + IN UINTN DataLength, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, + OUT UINT32 *TransferResult + ) +; + +/** + Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB. + @param EndPointAddress The combination of an endpoint number and an endpoint direction of the + target USB device. + @param DeviceSpeed Indicates device speed. + @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of + sending or receiving. + @param DataBuffersNumber Number of data buffers prepared for the transfer. + @param Data Array of pointers to the buffers of data that will be transmitted to USB + device or received from USB device. + @param DataLength Specifies the length, in bytes, of the data to be sent to or received from + the USB device. + @param Translator A pointer to the transaction translator data. + @param IsochronousCallback The Callback function. This function is called if the requested + isochronous transfer is completed. + @param Context Data passed to the IsochronousCallback function. This is an + optional parameter and may be NULL. + + @retval EFI_SUCCESS The asynchronous isochronous transfer request has been successfully + submitted or canceled. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The asynchronous isochronous transfer could not be submitted due to + a lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 DeviceSpeed, + IN UINTN MaximumPacketLength, + IN UINT8 DataBuffersNumber, + IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM], + IN UINTN DataLength, + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator, + IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack, + IN VOID *Context OPTIONAL + ) +; + +/** + Retrieves the current status of a USB root hub port. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param PortNumber Specifies the root hub port from which the status is to be retrieved. + This value is zero based. + @param PortStatus A pointer to the current port status bits and port status change bits. + + @retval EFI_SUCCESS The status of the USB root hub port specified by PortNumber + was returned in PortStatus. + @retval EFI_INVALID_PARAMETER PortNumber is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS) ( + IN CONST EFI_USB2_HC_PROTOCOL *This, + IN CONST UINT8 PortNumber, + OUT EFI_USB_PORT_STATUS *PortStatus + ) +; + +/** + Sets a feature for the specified root hub port. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param PortNumber Specifies the root hub port whose feature is requested to be set. This + value is zero based. + @param PortFeature Indicates the feature selector associated with the feature set request. + + @retval EFI_SUCCESS The feature specified by PortFeature was set for the USB + root hub port specified by PortNumber. + @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ) +; + +/** + Clears a feature for the specified root hub port. + + @param This A pointer to the EFI_USB2_HC_PROTOCOL instance. + @param PortNumber Specifies the root hub port whose feature is requested to be cleared. This + value is zero based. + @param PortFeature Indicates the feature selector associated with the feature clear request. + + @retval EFI_SUCCESS The feature specified by PortFeature was cleared for the USB + root hub port specified by PortNumber. + @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE) ( + IN EFI_USB2_HC_PROTOCOL *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ) +; + +struct _EFI_USB2_HC_PROTOCOL { + EFI_USB2_HC_PROTOCOL_GET_CAPABILITY GetCapability; + EFI_USB2_HC_PROTOCOL_RESET Reset; + EFI_USB2_HC_PROTOCOL_GET_STATE GetState; + EFI_USB2_HC_PROTOCOL_SET_STATE SetState; + EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER ControlTransfer; + EFI_USB2_HC_PROTOCOL_BULK_TRANSFER BulkTransfer; + EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER AsyncInterruptTransfer; + EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER SyncInterruptTransfer; + EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER IsochronousTransfer; + EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER AsyncIsochronousTransfer; + EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus; + EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature; + EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature; + UINT16 MajorRevision; + UINT16 MinorRevision; +}; + +extern EFI_GUID gEfiUsb2HcProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/UsbHostController.h b/MdePkg/Include/Protocol/UsbHostController.h new file mode 100644 index 0000000000..33e744ac1f --- /dev/null +++ b/MdePkg/Include/Protocol/UsbHostController.h @@ -0,0 +1,447 @@ +/** @file + EFI_USB_HC_PROTOCOL as defined in EFI 1.10. + + 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: UsbHostController.h + +**/ + +#ifndef _USB_HOSTCONTROLLER_H_ +#define _USB_HOSTCONTROLLER_H_ + +#include + +#define EFI_USB_HC_PROTOCOL_GUID \ + { \ + 0xf5089266, 0x1aa0, 0x4953, {0x97, 0xd8, 0x56, 0x2f, 0x8a, 0x73, 0xb5, 0x19 } \ + } + +// +// Forward reference for pure ANSI compatability +// +typedef struct _EFI_USB_HC_PROTOCOL EFI_USB_HC_PROTOCOL; + +// +// Protocol definitions +// + +/** + Provides software reset for the USB host controller. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param Attributes A bit mask of the reset operation to perform. + + @retval EFI_SUCCESS The reset operation succeeded. + @retval EFI_UNSUPPORTED The type of reset specified by Attributes is not currently supported + by the host controller hardware. + @retval EFI_INVALID_PARAMETER Attributes is not valid. + @retval EFI_DEVICE_ERROR An error was encountered while attempting to perform the reset operation. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_RESET) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT16 Attributes + ); + +/** + Retrieves current state of the USB host controller. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param State A pointer to the EFI_USB_HC_STATE data structure that + indicates current state of the USB host controller. + + @retval EFI_SUCCESS The state information of the host controller was returned in State. + @retval EFI_INVALID_PARAMETER State is NULL. + @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the host controller's + current state. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_GET_STATE) ( + IN EFI_USB_HC_PROTOCOL *This, + OUT EFI_USB_HC_STATE *State + ); + +/** + Sets the USB host controller to a specific state. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param State Indicates the state of the host controller that will be set. + + @retval EFI_SUCCESS The USB host controller was successfully placed in the state specified by + State. + @retval EFI_INVALID_PARAMETER State is NULL. + @retval EFI_DEVICE_ERROR Failed to set the state specified by State due to device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_SET_STATE) ( + IN EFI_USB_HC_PROTOCOL *This, + IN EFI_USB_HC_STATE State + ); + +/** + Submits control transfer to a target USB device. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB, which is + assigned during USB enumeration. + @param IsSlowDevice Indicates whether the target device is slow device or full-speed + device. + @param MaximumPacketLength Indicates the maximum packet size that the default control + transfer endpoint is capable of sending or receiving. + @param Request A pointer to the USB device request that will be sent to the USB + device. + @param TransferDirection Specifies the data direction for the transfer. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param DataLength On input, indicates the size, in bytes, of the data buffer specified + by Data. On output, indicates the amount of data actually + transferred. + @param TimeOut Indicates the maximum time, in milliseconds, which the transfer + is allowed to complete. + @param TransferResult A pointer to the detailed result information generated by this + control transfer. + + @retval EFI_SUCCESS The control transfer was completed successfully. + @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_TIMEOUT The control transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The control transfer failed due to host controller or device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN BOOLEAN IsSlowDevice, + IN UINT8 MaximumPacketLength, + IN EFI_USB_DEVICE_REQUEST *Request, + IN EFI_USB_DATA_DIRECTION TransferDirection, + IN OUT VOID *Data OPTIONAL, + IN OUT UINTN *DataLength OPTIONAL, + IN UINTN TimeOut, + OUT UINT32 *TransferResult + ); + +/** + Submits bulk transfer to a bulk endpoint of a USB device. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB, which is + assigned during USB enumeration. + @param EndPointAddress The combination of an endpoint number and an endpoint + direction of the target USB device. + @param MaximumPacketLength Indicates the maximum packet size that the default control + transfer endpoint is capable of sending or receiving. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param DataLength On input, indicates the size, in bytes, of the data buffer specified + by Data. On output, indicates the amount of data actually + transferred. + @param DataToggle A pointer to the data toggle value. + @param TimeOut Indicates the maximum time, in milliseconds, which the transfer + is allowed to complete. + @param TransferResult A pointer to the detailed result information of the bulk transfer. + + @retval EFI_SUCCESS The bulk transfer was completed successfully. + @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_TIMEOUT The bulk transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_BULK_TRANSFER) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 MaximumPacketLength, + IN OUT VOID *Data, + IN OUT UINTN *DataLength, + IN OUT UINT8 *DataToggle, + IN UINTN TimeOut, + OUT UINT32 *TransferResult + ); + +/** + Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB, which is + assigned during USB enumeration. + @param EndPointAddress The combination of an endpoint number and an endpoint + direction of the target USB device. + @param IsSlowDevice Indicates whether the target device is slow device or full-speed + device. + @param MaximumPacketLength Indicates the maximum packet size that the default control + transfer endpoint is capable of sending or receiving. + @param IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between the host + and the target interrupt endpoint. If FALSE, the specified + @param DataToggle A pointer to the data toggle value. + @param PollingInterval Indicates the interval, in milliseconds, that the asynchronous + interrupt transfer is polled. asynchronous interrupt pipe is canceled. + @param DataLength Indicates the length of data to be received at the rate specified by + PollingInterval from the target asynchronous interrupt + endpoint. + @param CallBackFunction The Callback function. + @param Context The context that is passed to the CallBackFunction. + + @retval EFI_SUCCESS The asynchronous interrupt transfer request has been successfully + submitted or canceled. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_TIMEOUT The bulk transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN BOOLEAN IsSlowDevice, + IN UINT8 MaxiumPacketLength, + IN BOOLEAN IsNewTransfer, + IN OUT UINT8 *DataToggle, + IN UINTN PollingInterval OPTIONAL, + IN UINTN DataLength OPTIONAL, + IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL, + IN VOID *Context OPTIONAL + ); + +/** + Submits synchronous interrupt transfer to an interrupt endpoint of a USB device. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB, which is + assigned during USB enumeration. + @param EndPointAddress The combination of an endpoint number and an endpoint + direction of the target USB device. + @param IsSlowDevice Indicates whether the target device is slow device or full-speed + device. + @param MaximumPacketLength Indicates the maximum packet size that the default control + transfer endpoint is capable of sending or receiving. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. asynchronous interrupt pipe is canceled. + @param DataLength On input, the size, in bytes, of the data buffer specified by Data. + On output, the number of bytes transferred. + @param DataToggle A pointer to the data toggle value. + @param TimeOut Indicates the maximum time, in milliseconds, which the transfer + is allowed to complete. + @param TransferResult A pointer to the detailed result information from the synchronous + interrupt transfer. + + @retval EFI_SUCCESS The synchronous interrupt transfer was completed successfully. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_TIMEOUT The synchronous interrupt transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The synchronous interrupt transfer failed due to host controller or device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN BOOLEAN IsSlowDevice, + IN UINT8 MaximumPacketLength, + IN OUT VOID *Data, + IN OUT UINTN *DataLength, + IN OUT UINT8 *DataToggle, + IN UINTN TimeOut, + OUT UINT32 *TransferResult + ); + +/** + Submits isochronous transfer to an isochronous endpoint of a USB device. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB, which is + assigned during USB enumeration. + @param EndPointAddress The combination of an endpoint number and an endpoint + direction of the target USB device. + @param MaximumPacketLength Indicates the maximum packet size that the default control + transfer endpoint is capable of sending or receiving. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. asynchronous interrupt pipe is canceled. + @param DataLength Specifies the length, in bytes, of the data to be sent to or received + from the USB device. + @param TransferResult A pointer to the detailed result information from the isochronous + transfer. + + @retval EFI_SUCCESS The isochronous transfer was completed successfully. + @retval EFI_OUT_OF_RESOURCES The isochronous could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + @retval EFI_TIMEOUT The isochronous transfer failed due to timeout. + @retval EFI_DEVICE_ERROR The isochronous transfer failed due to host controller or device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 MaximumPacketLength, + IN OUT VOID *Data, + IN UINTN DataLength, + OUT UINT32 *TransferResult + ); + +/** + Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param DeviceAddress Represents the address of the target device on the USB, which is + assigned during USB enumeration. + @param EndPointAddress The combination of an endpoint number and an endpoint + direction of the target USB device. + @param MaximumPacketLength Indicates the maximum packet size that the default control + transfer endpoint is capable of sending or receiving. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. asynchronous interrupt pipe is canceled. + @param DataLength Specifies the length, in bytes, of the data to be sent to or received + from the USB device. + @param IsochronousCallback The Callback function. + @param Context Data passed to the IsochronousCallback function. This is + an optional parameter and may be NULL. + + @retval EFI_SUCCESS The asynchronous isochronous transfer was completed successfully. + @retval EFI_OUT_OF_RESOURCES The asynchronous isochronous could not be completed due to a lack of resources. + @retval EFI_INVALID_PARAMETER Some parameters are invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 DeviceAddress, + IN UINT8 EndPointAddress, + IN UINT8 MaximumPacketLength, + IN OUT VOID *Data, + IN UINTN DataLength, + IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack, + IN VOID *Context OPTIONAL + ); + +/** + Retrieves the number of root hub ports. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param PortNumber A pointer to the number of the root hub ports. + + @retval EFI_SUCCESS The port number was retrieved successfully. + @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the port number. + @retval EFI_INVALID_PARAMETER PortNumber is NULL. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER) ( + IN EFI_USB_HC_PROTOCOL *This, + OUT UINT8 *PortNumber + ); + +/** + Retrieves the current status of a USB root hub port. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param PortNumber Specifies the root hub port from which the status is to be retrieved. + This value is zero based. + @param PortStatus A pointer to the current port status bits and port status change bits. + + @retval EFI_SUCCESS The status of the USB root hub port specified by PortNumber + was returned in PortStatus. + @retval EFI_INVALID_PARAMETER PortNumber is invalid. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 PortNumber, + OUT EFI_USB_PORT_STATUS *PortStatus + ); + +/** + Sets a feature for the specified root hub port. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param PortNumber Specifies the root hub port from which the status is to be retrieved. + This value is zero based. + @param PortFeature Indicates the feature selector associated with the feature set + request. + + @retval EFI_SUCCESS The feature specified by PortFeature was set for the USB + root hub port specified by PortNumber. + @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ); + +/** + Clears a feature for the specified root hub port. + + @param This A pointer to the EFI_USB_HC_PROTOCOL instance. + @param PortNumber Specifies the root hub port from which the status is to be cleared. + This value is zero based. + @param PortFeature Indicates the feature selector associated with the feature clear + request. + + @retval EFI_SUCCESS The feature specified by PortFeature was cleared for the USB + root hub port specified by PortNumber. + @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE) ( + IN EFI_USB_HC_PROTOCOL *This, + IN UINT8 PortNumber, + IN EFI_USB_PORT_FEATURE PortFeature + ); + +struct _EFI_USB_HC_PROTOCOL { + EFI_USB_HC_PROTOCOL_RESET Reset; + EFI_USB_HC_PROTOCOL_GET_STATE GetState; + EFI_USB_HC_PROTOCOL_SET_STATE SetState; + EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER ControlTransfer; + EFI_USB_HC_PROTOCOL_BULK_TRANSFER BulkTransfer; + EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER AsyncInterruptTransfer; + EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER SyncInterruptTransfer; + EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER IsochronousTransfer; + EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER AsyncIsochronousTransfer; + EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber; + EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus; + EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature; + EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature; + UINT16 MajorRevision; + UINT16 MinorRevision; +}; + +extern EFI_GUID gEfiUsbHcProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h new file mode 100644 index 0000000000..48d1ba32cf --- /dev/null +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -0,0 +1,420 @@ +/** @file + EFI Usb I/O 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: UsbIo.h + +**/ + +#ifndef __USB_IO_H__ +#define __USB_IO_H__ + +#include + +// +// Global ID for the USB I/O Protocol +// +#define EFI_USB_IO_PROTOCOL_GUID \ + { \ + 0x2B2F68D6, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \ + } + +typedef struct _EFI_USB_IO_PROTOCOL EFI_USB_IO_PROTOCOL; + +/** + Async USB transfer callback routine. + + @param Data Data received or sent via the USB Asynchronous Transfer, if the + transfer completed successfully. + @param DataLength The length of Data received or sent via the Asynchronous + Transfer, if transfer successfully completes. + @param Context Data passed from UsbAsyncInterruptTransfer() request. + @param Status Indicates the result of the asynchronous transfer. + + @retval EFI_SUCCESS The asynchronous USB transfer request has been successfully executed. + @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_ASYNC_USB_TRANSFER_CALLBACK) ( + IN VOID *Data, + IN UINTN DataLength, + IN VOID *Context, + IN UINT32 Status + ); + +// +// Prototype for EFI USB I/O protocol +// + + +/** + This function is used to manage a USB device with a control transfer pipe. A control transfer is + typically used to perform device initialization and configuration. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param Request A pointer to the USB device request that will be sent to the USB + device. + @param Direction Indicates the data direction. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param Timeout Indicating the transfer should be completed within this time frame. + The units are in milliseconds. + @param DataLength The size, in bytes, of the data buffer specified by Data. + @param Status A pointer to the result of the USB transfer. + + @retval EFI_SUCCESS The control transfer has been successfully executed. + @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status. + @retval EFI_INVALID_PARAMETE One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. + @retval EFI_TIMEOUT The control transfer fails due to timeout. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_CONTROL_TRANSFER) ( + IN EFI_USB_IO_PROTOCOL *This, + IN EFI_USB_DEVICE_REQUEST *Request, + IN EFI_USB_DATA_DIRECTION Direction, + IN UINT32 Timeout, + IN OUT VOID *Data OPTIONAL, + IN UINTN DataLength OPTIONAL, + OUT UINT32 *Status + ); + +/** + This function is used to manage a USB device with the bulk transfer pipe. Bulk Transfers are + typically used to transfer large amounts of data to/from USB devices. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB + device. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param DataLength The size, in bytes, of the data buffer specified by Data. + @param Timeout Indicating the transfer should be completed within this time frame. + The units are in milliseconds. + @param Status This parameter indicates the USB transfer status. + + @retval EFI_SUCCESS The bulk transfer has been successfully executed. + @retval EFI_DEVICE_ERROR The transfer failed. The transfer status is returned in Status. + @retval EFI_INVALID_PARAMETE One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The control transfer fails due to timeout. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_BULK_TRANSFER) ( + IN EFI_USB_IO_PROTOCOL *This, + IN UINT8 DeviceEndpoint, + IN OUT VOID *Data, + IN OUT UINTN *DataLength, + IN UINTN Timeout, + OUT UINT32 *Status + ); + +/** + This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous + Interrupt Transfer is typically used to query a device's status at a fixed rate. For example, + keyboard, mouse, and hub devices use this type of transfer to query their interrupt endpoints at + a fixed rate. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB + device. + @param IsNewTransfer If TRUE, a new transfer will be submitted to USB controller. If + FALSE, the interrupt transfer is deleted from the device's interrupt + transfer queue. + @param PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be + executed. + @param DataLength Specifies the length, in bytes, of the data to be received from the + USB device. + @param Context Data passed to the InterruptCallback function. + @param InterruptCallback The Callback function. This function is called if the asynchronous + interrupt transfer is completed. + + @retval EFI_SUCCESS The asynchronous USB transfer request transfer has been successfully executed. + @retval EFI_DEVICE_ERROR The asynchronous USB transfer request failed. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER) ( + IN EFI_USB_IO_PROTOCOL *This, + IN UINT8 DeviceEndpoint, + IN BOOLEAN IsNewTransfer, + IN UINTN PollingInterval OPTIONAL, + IN UINTN DataLength OPTIONAL, + IN EFI_ASYNC_USB_TRANSFER_CALLBACK InterruptCallBack OPTIONAL, + IN VOID *Context OPTIONAL + ); + +/** + This function is used to manage a USB device with an interrupt transfer pipe. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB + device. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param DataLength On input, then size, in bytes, of the buffer Data. On output, the + amount of data actually transferred. + @param Timeout The time out, in seconds, for this transfer. + @param Status This parameter indicates the USB transfer status. + + @retval EFI_SUCCESS The sync interrupt transfer has been successfully executed. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_DEVICE_ERROR The sync interrupt transfer request failed. + @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The transfer fails due to timeout. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_SYNC_INTERRUPT_TRANSFER) ( + IN EFI_USB_IO_PROTOCOL *This, + IN UINT8 DeviceEndpoint, + IN OUT VOID *Data, + IN OUT UINTN *DataLength, + IN UINTN Timeout, + OUT UINT32 *Status + ); + +/** + This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous + transfer is typically used to transfer streaming data. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB + device. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param DataLength The size, in bytes, of the data buffer specified by Data. + @param Status This parameter indicates the USB transfer status. + + @retval EFI_SUCCESS The isochronous transfer has been successfully executed. + @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid. + @retval EFI_DEVICE_ERROR The transfer failed due to the reason other than timeout, The error status + is returned in Status. + @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources. + @retval EFI_TIMEOUT The transfer fails due to timeout. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_ISOCHRONOUS_TRANSFER) ( + IN EFI_USB_IO_PROTOCOL *This, + IN UINT8 DeviceEndpoint, + IN OUT VOID *Data, + IN UINTN DataLength, + OUT UINT32 *Status + ); + +/** + This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous + transfer is typically used to transfer streaming data. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param DeviceEndpoint A pointer to the USB device request that will be sent to the USB + device. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. + @param DataLength The size, in bytes, of the data buffer specified by Data. + @param Context Data passed to the IsochronousCallback() function. + @param IsochronousCallback The IsochronousCallback() function. + + @retval EFI_SUCCESS The asynchronous isochronous transfer has been successfully submitted + to the system. + @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid. + @retval EFI_OUT_OF_RESOURCES The request could not be submitted due to a lack of resources. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER) ( + IN EFI_USB_IO_PROTOCOL *This, + IN UINT8 DeviceEndpoint, + IN OUT VOID *Data, + IN UINTN DataLength, + IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack, + IN VOID *Context OPTIONAL + ); + +/** + Resets and reconfigures the USB controller. This function will work for all USB devices except + USB Hub Controllers. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + + @retval EFI_SUCCESS The USB controller was reset. + @retval EFI_INVALID_PARAMETER If the controller specified by This is a USB hub. + @retval EFI_DEVICE_ERROR An error occurred during the reconfiguration process. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_PORT_RESET) ( + IN EFI_USB_IO_PROTOCOL *This + ); + +/** + Retrieves the USB Device Descriptor. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param DeviceDescriptor A pointer to the caller allocated USB Device Descriptor. + + @retval EFI_SUCCESS The device descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER DeviceDescriptor is NULL. + @retval EFI_NOT_FOUND The device descriptor was not found. The device may not be configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_GET_DEVICE_DESCRIPTOR) ( + IN EFI_USB_IO_PROTOCOL *This, + OUT EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor + ); + +/** + Retrieves the USB Device Descriptor. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param ConfigurationDescriptor A pointer to the caller allocated USB Active Configuration + Descriptor. + @retval EFI_SUCCESS The active configuration descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER ConfigurationDescriptor is NULL. + @retval EFI_NOT_FOUND An active configuration descriptor cannot be found. The device may not + be configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_GET_CONFIG_DESCRIPTOR) ( + IN EFI_USB_IO_PROTOCOL *This, + OUT EFI_USB_CONFIG_DESCRIPTOR *ConfigurationDescriptor + ); + +/** + Retrieves the Interface Descriptor for a USB Device Controller. As stated earlier, an interface + within a USB device is equivalently to a USB Controller within the current configuration. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param InterfaceDescriptor A pointer to the caller allocated USB Interface Descriptor within + the configuration setting. + @retval EFI_SUCCESS The interface descriptor retrieved successfully. + @retval EFI_INVALID_PARAMETER InterfaceDescriptor is NULL. + @retval EFI_NOT_FOUND The interface descriptor cannot be found. The device may not be + correctly configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_GET_INTERFACE_DESCRIPTOR) ( + IN EFI_USB_IO_PROTOCOL *This, + OUT EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor + ); + +/** + Retrieves an Endpoint Descriptor within a USB Controller. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param EndpointIndex Indicates which endpoint descriptor to retrieve. + @param EndpointDescriptor A pointer to the caller allocated USB Endpoint Descriptor of + a USB controller. + + @retval EFI_SUCCESS The endpoint descriptor was retrieved successfully. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_NOT_FOUND The endpoint descriptor cannot be found. The device may not be + correctly configured. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR) ( + IN EFI_USB_IO_PROTOCOL *This, + IN UINT8 EndpointIndex, + OUT EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor + ); + +/** + Retrieves a Unicode string stored in a USB Device. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param LangID The Language ID for the string being retrieved. + @param StringID The ID of the string being retrieved. + @param String A pointer to a buffer allocated by this function with + AllocatePool() to store the string. + + @retval EFI_SUCCESS The string was retrieved successfully. + @retval EFI_NOT_FOUND The string specified by LangID and StringID was not found. + @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the return buffer String. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_GET_STRING_DESCRIPTOR) ( + IN EFI_USB_IO_PROTOCOL *This, + IN UINT16 LangID, + IN UINT8 StringID, + OUT CHAR16 **String + ); + +/** + Retrieves all the language ID codes that the USB device supports. + + @param This A pointer to the EFI_USB_IO_PROTOCOL instance. + @param LangIDTable Language ID for the string the caller wants to get. + @param TableSize The size, in bytes, of the table LangIDTable. + + @retval EFI_SUCCESS The support languages were retrieved successfully. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_USB_IO_GET_SUPPORTED_LANGUAGE) ( + IN EFI_USB_IO_PROTOCOL *This, + OUT UINT16 **LangIDTable, + OUT UINT16 *TableSize + ); + +// +// Protocol Interface Structure +// +struct _EFI_USB_IO_PROTOCOL { + // + // IO transfer + // + EFI_USB_IO_CONTROL_TRANSFER UsbControlTransfer; + EFI_USB_IO_BULK_TRANSFER UsbBulkTransfer; + EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER UsbAsyncInterruptTransfer; + EFI_USB_IO_SYNC_INTERRUPT_TRANSFER UsbSyncInterruptTransfer; + EFI_USB_IO_ISOCHRONOUS_TRANSFER UsbIsochronousTransfer; + EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER UsbAsyncIsochronousTransfer; + + // + // Common device request + // + EFI_USB_IO_GET_DEVICE_DESCRIPTOR UsbGetDeviceDescriptor; + EFI_USB_IO_GET_CONFIG_DESCRIPTOR UsbGetConfigDescriptor; + EFI_USB_IO_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor; + EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor; + EFI_USB_IO_GET_STRING_DESCRIPTOR UsbGetStringDescriptor; + EFI_USB_IO_GET_SUPPORTED_LANGUAGE UsbGetSupportedLanguages; + + // + // Reset controller's parent port + // + EFI_USB_IO_PORT_RESET UsbPortReset; +}; + +extern EFI_GUID gEfiUsbIoProtocolGuid; + +#endif diff --git a/MdePkg/Include/Protocol/Variable.h b/MdePkg/Include/Protocol/Variable.h new file mode 100644 index 0000000000..13eb113bcc --- /dev/null +++ b/MdePkg/Include/Protocol/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/Protocol/VariableWrite.h b/MdePkg/Include/Protocol/VariableWrite.h new file mode 100644 index 0000000000..8c21df54f1 --- /dev/null +++ b/MdePkg/Include/Protocol/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/Protocol/WatchdogTimer.h b/MdePkg/Include/Protocol/WatchdogTimer.h new file mode 100644 index 0000000000..8e31a36bc5 --- /dev/null +++ b/MdePkg/Include/Protocol/WatchdogTimer.h @@ -0,0 +1,165 @@ +/** @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 + diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h index 429cbdcf1d..9218b1d311 100644 --- a/MdePkg/Include/Uefi/UefiBaseType.h +++ b/MdePkg/Include/Uefi/UefiBaseType.h @@ -65,6 +65,29 @@ typedef struct { UINT8 Pad2; } EFI_TIME; + +// +// Networking Definitions +// +typedef struct { + UINT8 Addr[4]; +} EFI_IPv4_ADDRESS; + +typedef struct { + UINT8 Addr[16]; +} EFI_IPv6_ADDRESS; + +typedef struct { + UINT8 Addr[32]; +} EFI_MAC_ADDRESS; + +typedef union { + UINT32 Addr[4]; + EFI_IPv4_ADDRESS v4; + EFI_IPv6_ADDRESS v6; +} EFI_IP_ADDRESS; + + // // Enumeration of EFI_STATUS. // diff --git a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h index 1f16535c77..5b22c23429 100644 --- a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h +++ b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h @@ -27,7 +27,19 @@ // The following types are currently defined: // typedef UINT32 RELOFST; + typedef CHAR16 *EFI_STRING; +typedef UINT16 EFI_IMAGE_ID; +typedef UINT16 EFI_QUESTION_ID; +typedef UINT16 EFI_STRING_ID; +typedef UINT16 EFI_FORM_ID; +typedef UINT16 EFI_VARSTORE_ID; + +// +// BugBug in UEFI2.1 +// +typedef VOID *EFI_FONT_HANDLE; + // // IFR Op codes diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index 4eef223db0..f43624284f 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -27,28 +27,6 @@ #include #include -// -// Networking Definitions -// -typedef struct { - UINT8 Addr[4]; -} EFI_IPv4_ADDRESS; - -typedef struct { - UINT8 Addr[16]; -} EFI_IPv6_ADDRESS; - -typedef struct { - UINT8 Addr[32]; -} EFI_MAC_ADDRESS; - -typedef union { - UINT32 Addr[4]; - EFI_IPv4_ADDRESS v4; - EFI_IPv6_ADDRESS v6; -} EFI_IP_ADDRESS; - - // // Enumeration of memory allocation. // @@ -1550,7 +1528,7 @@ EFI_STATUS #define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02)) #define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 -#define EFI_RUNTIME_SERVICES_REVISION EFI_2_00_SYSTEM_TABLE_REVISION +#define EFI_RUNTIME_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION typedef struct { EFI_TABLE_HEADER Hdr; @@ -1596,7 +1574,7 @@ typedef struct { #define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 -#define EFI_BOOT_SERVICES_REVISION ((2<<16) | (00)) +#define EFI_BOOT_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION typedef struct { EFI_TABLE_HEADER Hdr; -- 2.39.2