]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Checked in the Protocols introduced in UEFI/PI.
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 19 Jun 2007 10:12:02 +0000 (10:12 +0000)
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 19 Jun 2007 10:12:02 +0000 (10:12 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2674 6f19259b-4bc3-4df7-8a09-765794883524

93 files changed:
MdePkg/Include/Ipf/PalApi.h
MdePkg/Include/Protocol/AbsolutePointer.h [new file with mode: 0644]
MdePkg/Include/Protocol/AcpiTable.h [new file with mode: 0644]
MdePkg/Include/Protocol/Arp.h [new file with mode: 0644]
MdePkg/Include/Protocol/AuthenticationInfo.h [new file with mode: 0644]
MdePkg/Include/Protocol/Bds.h [new file with mode: 0644]
MdePkg/Include/Protocol/Bis.h [new file with mode: 0644]
MdePkg/Include/Protocol/BlockIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/BusSpecificDriverOverride.h [new file with mode: 0644]
MdePkg/Include/Protocol/ComponentName.h [new file with mode: 0644]
MdePkg/Include/Protocol/ComponentName2.h [new file with mode: 0644]
MdePkg/Include/Protocol/Cpu.h [new file with mode: 0644]
MdePkg/Include/Protocol/DebugPort.h [new file with mode: 0644]
MdePkg/Include/Protocol/DebugSupport.h [new file with mode: 0644]
MdePkg/Include/Protocol/Decompress.h [new file with mode: 0644]
MdePkg/Include/Protocol/DeviceIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/DevicePath.h [new file with mode: 0644]
MdePkg/Include/Protocol/DevicePathFromText.h [new file with mode: 0644]
MdePkg/Include/Protocol/DevicePathToText.h [new file with mode: 0644]
MdePkg/Include/Protocol/DevicePathUtilities.h [new file with mode: 0644]
MdePkg/Include/Protocol/Dhcp4.h [new file with mode: 0644]
MdePkg/Include/Protocol/DiskIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/DriverBinding.h [new file with mode: 0644]
MdePkg/Include/Protocol/DriverConfiguration.h [new file with mode: 0644]
MdePkg/Include/Protocol/DriverDiagnostics.h [new file with mode: 0644]
MdePkg/Include/Protocol/DriverSupportedEfiVersion.h [new file with mode: 0644]
MdePkg/Include/Protocol/Ebc.h [new file with mode: 0644]
MdePkg/Include/Protocol/EdidActive.h [new file with mode: 0644]
MdePkg/Include/Protocol/EdidDiscovered.h [new file with mode: 0644]
MdePkg/Include/Protocol/EdidOverride.h [new file with mode: 0644]
MdePkg/Include/Protocol/FirmwareVolume2.h [new file with mode: 0644]
MdePkg/Include/Protocol/FirmwareVolumeBlock.h [new file with mode: 0644]
MdePkg/Include/Protocol/FormBrowser.h [new file with mode: 0644]
MdePkg/Include/Protocol/GraphicsOutput.h [new file with mode: 0644]
MdePkg/Include/Protocol/GuidedSectionExtaction.h [new file with mode: 0644]
MdePkg/Include/Protocol/Hash.h [new file with mode: 0644]
MdePkg/Include/Protocol/HiiConfigAccess.h [new file with mode: 0644]
MdePkg/Include/Protocol/HiiConfigRouting.h [new file with mode: 0644]
MdePkg/Include/Protocol/HiiDatabase.h [new file with mode: 0644]
MdePkg/Include/Protocol/HiiFont.h [new file with mode: 0644]
MdePkg/Include/Protocol/HiiImage.h [new file with mode: 0644]
MdePkg/Include/Protocol/HiiString.h [new file with mode: 0644]
MdePkg/Include/Protocol/IP4.h [new file with mode: 0644]
MdePkg/Include/Protocol/IP4Config.h [new file with mode: 0644]
MdePkg/Include/Protocol/IScsiInitatorName.h [new file with mode: 0644]
MdePkg/Include/Protocol/LoadFile.h [new file with mode: 0644]
MdePkg/Include/Protocol/ManagedNetwork.h [new file with mode: 0644]
MdePkg/Include/Protocol/Metronome.h [new file with mode: 0644]
MdePkg/Include/Protocol/MonotonicCounter.h [new file with mode: 0644]
MdePkg/Include/Protocol/Mtftp4.h [new file with mode: 0644]
MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h [new file with mode: 0644]
MdePkg/Include/Protocol/Pcd.h [new file with mode: 0644]
MdePkg/Include/Protocol/PciIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/PciRootBridgeIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/PlatformDriverOverride.h [new file with mode: 0644]
MdePkg/Include/Protocol/PlatformToDriverConfiguration.h [new file with mode: 0644]
MdePkg/Include/Protocol/PxeBaseCode.h [new file with mode: 0644]
MdePkg/Include/Protocol/PxeBaseCodeCallBack.h [new file with mode: 0644]
MdePkg/Include/Protocol/RealTimeClock.h [new file with mode: 0644]
MdePkg/Include/Protocol/Reset.h [new file with mode: 0644]
MdePkg/Include/Protocol/Runtime.h [new file with mode: 0644]
MdePkg/Include/Protocol/ScsiIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/ScsiPassThru.h [new file with mode: 0644]
MdePkg/Include/Protocol/ScsiPassThruExt.h [new file with mode: 0644]
MdePkg/Include/Protocol/Security.h [new file with mode: 0644]
MdePkg/Include/Protocol/SecurityPolicy.h [new file with mode: 0644]
MdePkg/Include/Protocol/SerialIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/ServiceBinding.h [new file with mode: 0644]
MdePkg/Include/Protocol/SimpleFileSystem.h [new file with mode: 0644]
MdePkg/Include/Protocol/SimpleNetwork.h [new file with mode: 0644]
MdePkg/Include/Protocol/SimplePointer.h [new file with mode: 0644]
MdePkg/Include/Protocol/SimpleTextIn.h [new file with mode: 0644]
MdePkg/Include/Protocol/SimpleTextInEx.h [new file with mode: 0644]
MdePkg/Include/Protocol/SimpleTextOut.h [new file with mode: 0644]
MdePkg/Include/Protocol/SmbusHc.h [new file with mode: 0644]
MdePkg/Include/Protocol/StatusCode.h [new file with mode: 0644]
MdePkg/Include/Protocol/TapeIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/Tcp4.h [new file with mode: 0644]
MdePkg/Include/Protocol/Timer.h [new file with mode: 0644]
MdePkg/Include/Protocol/Udp4.h [new file with mode: 0644]
MdePkg/Include/Protocol/UgaDraw.h [new file with mode: 0644]
MdePkg/Include/Protocol/UgaIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/UnicodeCollation.h [new file with mode: 0644]
MdePkg/Include/Protocol/Usb2HostController.h [new file with mode: 0644]
MdePkg/Include/Protocol/UsbHostController.h [new file with mode: 0644]
MdePkg/Include/Protocol/UsbIo.h [new file with mode: 0644]
MdePkg/Include/Protocol/Variable.h [new file with mode: 0644]
MdePkg/Include/Protocol/VariableWrite.h [new file with mode: 0644]
MdePkg/Include/Protocol/WatchdogTimer.h [new file with mode: 0644]
MdePkg/Include/Uefi/UefiBaseType.h
MdePkg/Include/Uefi/UefiDevicePath.h [deleted file]
MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
MdePkg/Include/Uefi/UefiSpec.h

index 0afa3d361f10f329092e4e4bca7d67868b18a0d0..4f079ad15669d8f85a4a03df41fc61394ffdad07 100644 (file)
@@ -28,4 +28,820 @@ typedef struct {
   UINT64                    r11;\r
 } PAL_CALL_RETURN;\r
 \r
+\r
+\r
+//\r
+// CacheType of PAL_CACHE_FLUSH.\r
+//\r
+#define PAL_CACHE_FLUSH_INSTRUCTION_ALL        1\r
+#define PAL_CACHE_FLUSH_DATA_ALL                                       2\r
+#define PAL_CACHE_FLUSH_ALL                                                            3\r
+#define PAL_CACHE_FLUSH_SYNC_TO_DATA                   4\r
+\r
+\r
+//\r
+// Bitmask of Opearation of PAL_CACHE_FLUSH.\r
+// \r
+#define PAL_CACHE_FLUSH_INVIDED_LINES                  BIT0\r
+#define PAL_CACHE_FLUSH_PROBE_INTERRUPT                BIT1\r
+\r
+/**\r
+   \r
+  Flush the instruction or data caches. It is required by IPF.\r
+  The PAL procedure supports the Static Registers calling\r
+  convention. It could be called at virtual mode and physical\r
+  mode.\r
+\r
+  @param Index                                                         Index of PAL_CACHE_FLUSH within the\r
+                                                                                                               list of PAL procedures.\r
+  \r
+  @param CacheType                                     Unsigned 64-bit integer indicating\r
+                                                                                                               which cache to flush.\r
+\r
+  @param Operation                                     Formatted bit vector indicating the\r
+                                                                                                               operation of this call.\r
+\r
+  @param ProgressIndicator  Unsigned 64-bit integer specifying\r
+                            the starting position of the flush\r
+                            operation.\r
+  \r
+  @return R9                   Unsigned 64-bit integer specifying the vector\r
+                                                                       number of the pending interrupt.\r
+  \r
+  @return R10                  Unsigned 64-bit integer specifying the\r
+                  starting position of the flush operation.\r
+  \r
+  @return R11                  Unsigned 64-bit integer specifying the vector\r
+                                                                       number of the pending interrupt.\r
+  \r
+  @return Status       2 - Call completed without error, but a PMI\r
+                  was taken during the execution of this\r
+                  procedure.\r
+\r
+  @return Status       1 - Call has not completed flushing due to\r
+                  a pending interrupt.\r
+\r
+  @return Status  0 - Call completed without error\r
+\r
+  @return Status  -2 - Invalid argument\r
+\r
+  @return Status  -3 - Call completed with error\r
+   \r
+**/\r
+#define PAL_CACHE_FLUSH        1\r
+\r
+\r
+//\r
+// Attributes of PAL_CACHE_CONFIG_INFO1\r
+// \r
+#define PAL_CACHE_ATTR_WT      0\r
+#define PAL_CACHE_ATTR_WB              1\r
+\r
+//\r
+// PAL_CACHE_CONFIG_INFO1.StoreHint\r
+// \r
+#define PAL_CACHE_STORE_TEMPORAL                       0\r
+#define PAL_CACHE_STORE_NONE_TEMPORAL  3\r
+\r
+//\r
+// PAL_CACHE_CONFIG_INFO1.StoreHint\r
+// \r
+#define PAL_CACHE_STORE_TEMPORAL_LVL_1                         0\r
+#define PAL_CACHE_STORE_NONE_TEMPORAL_LVL_ALL  3\r
+\r
+//\r
+// PAL_CACHE_CONFIG_INFO1.StoreHint\r
+// \r
+#define PAL_CACHE_LOAD_TEMPORAL_LVL_1                                  0\r
+#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_1             1\r
+#define PAL_CACHE_LOAD_NONE_TEMPORAL_LVL_ALL   3\r
+\r
+//\r
+// Detail the characteristics of a given processor controlled\r
+// cache in the cache hierarchy.\r
+// \r
+typedef struct {\r
+       UINT64  IsUnified       : 1;\r
+       UINT64  Attributes      :       2;\r
+       UINT64  Associativity:8;\r
+       UINT64  LineSize:8;\r
+       UINT64  Stride:8;\r
+       UINT64  StoreLatency:8;\r
+       UINT64  StoreHint:8;\r
+       UINT64  LoadHint:8;\r
+} PAL_CACHE_INFO_RETURN1;\r
+\r
+//\r
+// Detail the characteristics of a given processor controlled\r
+// cache in the cache hierarchy.\r
+// \r
+typedef struct {\r
+       UINT64  CacheSize:32;\r
+       UINT64  AliasBoundary:8;\r
+       UINT64  TagLsBits:8;\r
+       UINT64  TagMsBits:8;\r
+} PAL_CACHE_INFO_RETURN2;\r
+\r
+/**\r
+   \r
+  Return detailed instruction or data cache information. It is\r
+  required by IPF. The PAL procedure supports the Static\r
+  Registers calling convention. It could be called at virtual\r
+  mode and physical mode.\r
+  \r
+  @param Index                                 Index of PAL_CACHE_INFO within the list of\r
+                                                                                       PAL procedures.\r
+  \r
+  @param CacheLevel            Unsigned 64-bit integer specifying the\r
+                      level in the cache hierarchy for which\r
+                      information is requested. This value must\r
+                      be between 0 and one less than the value\r
+                      returned in the cache_levels return value\r
+                      from PAL_CACHE_SUMMARY.\r
+  \r
+  @param CacheType    Unsigned 64-bit integer with a value of 1\r
+                      for instruction cache and 2 for data or\r
+                      unified cache. All other values are\r
+                      reserved.\r
+  \r
+  @param Reserved              Should be 0.\r
+  \r
+  \r
+  @return R9                   Detail the characteristics of a given\r
+                  processor controlled cache in the cache\r
+                  hierarchy. See PAL_CACHE_INFO_RETURN1.\r
+  \r
+  @return R10                  Detail the characteristics of a given\r
+                  processor controlled cache in the cache\r
+                  hierarchy. See PAL_CACHE_INFO_RETURN2.\r
+  \r
+  @return R11                  Reserved with 0.\r
+  \r
+  \r
+  @return Status  0 - Call completed without error\r
+\r
+  @return Status  -2 - Invalid argument\r
+\r
+  @return Status  -3 - Call completed with error\r
+   \r
+**/\r
+#define PAL_CACHE_INFO                 2\r
+\r
+\r
+\r
+//\r
+// Level of PAL_CACHE_INIT.\r
+// \r
+#define PAL_CACHE_INIT_ALL     0xffffffffffffffffULL\r
+\r
+//\r
+// Restrict of PAL_CACHE_INIT.\r
+// \r
+#define PAL_CACHE_INIT_NO_RESTRICT     0\r
+#define PAL_CACHE_INIT_RESTRICTED              1\r
+\r
+/**\r
+   \r
+  Initialize the instruction or data caches. It is required by\r
+  IPF. The PAL procedure supports the Static Registers calling\r
+  convention. It could be called at physical mode.\r
+\r
+  @param Index         Index of PAL_CACHE_INIT within the list of PAL\r
+                procedures.\r
+  \r
+  @param Level         Unsigned 64-bit integer containing the level of\r
+                cache to initialize. If the cache level can be\r
+                initialized independently, only that level will\r
+                be initialized. Otherwise\r
+                implementation-dependent side-effects will\r
+                occur.\r
+  \r
+  @param CacheType     Unsigned 64-bit integer with a value of 1 to\r
+                    initialize the instruction cache, 2 to\r
+                    initialize the data cache, or 3 to\r
+                    initialize both. All other values are\r
+                    reserved.\r
+\r
+  @param Restrict      Unsigned 64-bit integer with a value of 0 or\r
+                    1. All other values are reserved. If\r
+                    restrict is 1 and initializing the specified\r
+                    level and cache_type of the cache would\r
+                    cause side-effects, PAL_CACHE_INIT will\r
+                    return -4 instead of initializing the cache.\r
\r
+  \r
+  @return Status  0 - Call completed without error\r
+\r
+  @return Status  -2 - Invalid argument\r
+\r
+  @return Status  -3 - Call completed with error.\r
+  \r
+  @return Status  -4 - Call could not initialize the specified\r
+                  level and cache_type of the cache without\r
+                                                                       side-effects and restrict was 1.  \r
+   \r
+**/\r
+#define PAL_CACHE_INIT                 3 \r
+\r
+\r
+//\r
+// PAL_CACHE_PROTECTION.Method.\r
+// \r
+#define PAL_CACHE_PROTECTION_NONE_PROTECT              0\r
+#define PAL_CACHE_PROTECTION_ODD_PROTECT               1\r
+#define PAL_CACHE_PROTECTION_EVEN_PROTECT              2\r
+#define PAL_CACHE_PROTECTION_ECC_PROTECT               3\r
+\r
+\r
+\r
+//\r
+// PAL_CACHE_PROTECTION.TagOrData.\r
+// \r
+#define PAL_CACHE_PROTECTION_PROTECT_DATA              0\r
+#define PAL_CACHE_PROTECTION_PROTECT_TAG               1\r
+#define PAL_CACHE_PROTECTION_PROTECT_TAG_ANDTHEN_DATA          2\r
+#define PAL_CACHE_PROTECTION_PROTECT_DATA_ANDTHEN_TAG          3\r
+\r
+//\r
+// 32-bit protection information structures.\r
+// \r
+typedef struct {\r
+       UINT32  DataBits:8;\r
+       UINT32  TagProtLsb:6;\r
+       UINT32  TagProtMsb:6;\r
+       UINT32  ProtBits:6;\r
+       UINT32  Method:4;\r
+       UINT32  TagOrData:2;\r
+} PAL_CACHE_PROTECTION;\r
+\r
+/**\r
+   \r
+  Return instruction or data cache protection information. It is\r
+  required by IPF. The PAL procedure supports the Static\r
+  Registers calling convention. It could be called at physical\r
+  mode and Virtual mode.\r
+\r
+  @param Index         Index of PAL_CACHE_PROT_INFO within the list of\r
+                PAL procedures.\r
+\r
+  @param CacheLevel    Unsigned 64-bit integer specifying the level\r
+                    in the cache hierarchy for which information\r
+                    is requested. This value must be between 0\r
+                    and one less than the value returned in the\r
+                    cache_levels return value from\r
+                    PAL_CACHE_SUMMARY.\r
+\r
+  @param CacheType     Unsigned 64-bit integer with a value of 1\r
+                    for instruction cache and 2 for data or\r
+                    unified cache. All other values are\r
+                    reserved.\r
+  \r
+  @return R9                   Detail the characteristics of a given\r
+                  processor controlled cache in the cache\r
+                  hierarchy. See PAL_CACHE_PROTECTION[0..1].\r
+  \r
+  @return R10                  Detail the characteristics of a given\r
+                  processor controlled cache in the cache\r
+                  hierarchy. See PAL_CACHE_PROTECTION[2..3].\r
+  \r
+  @return R11                  Detail the characteristics of a given\r
+                  processor controlled cache in the cache\r
+                  hierarchy. See PAL_CACHE_PROTECTION[4..5].\r
+  \r
+  \r
+  @return Status  0 - Call completed without error\r
+\r
+  @return Status  -2 - Invalid argument\r
+\r
+  @return Status  -3 - Call completed with error.\r
+   \r
+**/\r
+#define PAL_CACHE_PROT_INFO            38\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+///\r
+// ?????????\r
+\r
+\r
+\r
+/**\r
+   \r
+  Returns information on which logical processors share caches.\r
+  It is optional.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_CACHE_SHARED_INFO  43\r
+\r
+\r
+/**\r
+   \r
+  Return a summary of the cache hierarchy. It is required by\r
+  IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_CACHE_SUMMARY              4\r
+\r
+/**\r
+   \r
+  Return a list of supported memory attributes.. It is required\r
+  by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_MEM_ATTRIB                         5\r
+\r
+/**\r
+   \r
+  Used in architected sequence to transition pages from a\r
+  cacheable, speculative attribute to an uncacheable attribute.\r
+  It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_PREFETCH_VISIBILITY        41\r
+\r
+/**\r
+   \r
+  Return information needed for ptc.e instruction to purge\r
+  entire TC. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_PTCE_INFO          6\r
+\r
+/**\r
+   \r
+  Return detailed information about virtual memory features\r
+  supported in the processor. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_VM_INFO                    7\r
+\r
+\r
+/**\r
+   \r
+  Return virtual memory TC and hardware walker page sizes\r
+  supported in the processor. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_VM_PAGE_SIZE 34\r
+\r
+/**\r
+   \r
+  Return summary information about virtual memory features\r
+  supported in the processor. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_VM_SUMMARY         8\r
+\r
+/**\r
+   \r
+  Read contents of a translation register. It is required by\r
+  IPF.\r
+\r
+  @param CallingConvention  Stacked Register\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_VM_TR_READ         261 \r
+\r
+/**\r
+   \r
+  Return configurable processor bus interface features and their\r
+  current settings. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_BUS_GET_FEATURES 9\r
+\r
+\r
+/**\r
+   \r
+  Enable or disable configurable features in processor bus\r
+  interface. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_BUS_SET_FEATURES 10\r
+\r
+\r
+/**\r
+   \r
+  Return the number of instruction and data breakpoint\r
+  registers. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_DEBUG_INFO         11\r
+\r
+/**\r
+   \r
+  Return the fixed component of a processor¡¯s directed address.\r
+  It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_FIXED_ADDR 12\r
+\r
+/**\r
+   \r
+  Return the frequency of the output clock for use by the\r
+  platform, if generated by the processor. It is optinal.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_FREQ_BASE 13\r
+\r
+/**\r
+   \r
+  Return ratio of processor, bus, and interval time counter to\r
+  processor input clock or output clock for platform use, if\r
+  generated by the processor. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_FREQ_RATIOS 14\r
+\r
+/**\r
+   \r
+  Return information on which logical processors map to a\r
+  physical processor die. It is optinal.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_LOGICAL_TO_PHYSICAL 42\r
+\r
+/**\r
+   \r
+  Return the number and type of performance monitors. It is\r
+  required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_PERF_MON_INFO 15\r
+\r
+/**\r
+   \r
+  Specify processor interrupt block address and I/O port space\r
+  address. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_PLATFORM_ADDR 16\r
+\r
+\r
+/**\r
+   \r
+  Return configurable processor features and their current\r
+  setting. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_PROC_GET_FEATURES 17\r
+\r
+\r
+/**\r
+   \r
+  Enable or disable configurable processor features. It is\r
+  required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_PROC_SET_FEATURES 18\r
+\r
+/**\r
+   \r
+  Return AR and CR register information. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_REGISTER_INFO 39 \r
+\r
+/**\r
+   \r
+  Return RSE information. It is required by\r
+  IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_RSE_INFO 19\r
+\r
+/**\r
+   \r
+  Return version of PAL code. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_VERSION 20\r
+\r
+/**\r
+   \r
+  Clear all error information from processor error logging\r
+  registers. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_MC_CLEAR_LOG 21 \r
+\r
+/**\r
+   \r
+  Ensure that all operations that could cause an MCA have\r
+  completed. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_MC_DRAIN 22\r
+\r
+/**\r
+   \r
+  Return Processor Dynamic State for logging by SAL. It is\r
+  optional.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_MC_DYNAMIC_STATE 24 \r
+\r
+/**\r
+   \r
+  Return Processor Machine Check Information and Processor\r
+  Static State for logging by SAL. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_MC_ERROR_INFO 25 Req. Static Both \r
+\r
+/**\r
+   \r
+  Set/Reset Expected Machine Check Indicator. It is required by\r
+  IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_MC_EXPECTED 23 \r
+\r
+/**\r
+   \r
+  Register min-state save area with PAL for machine checks and\r
+  inits. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_MC_REGISTER_MEM 27 \r
+\r
+/**\r
+   \r
+  Restore minimal architected state and return to interrupted\r
+  process. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_MC_RESUME 26 \r
+\r
+/**\r
+   \r
+  Enter the low-power HALT state or an implementation-dependent\r
+  low-power state. It is optinal.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_HALT 28\r
+\r
+\r
+/**\r
+   \r
+  Return the low power capabilities of the processor. It is\r
+  required by IPF.\r
+\r
+  @param CallingConvention  Stacked Register\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_HALT_INFO 257\r
+\r
+\r
+/**\r
+   \r
+  Enter the low power LIGHT HALT state. It is required by\r
+  IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical/Virtual\r
+   \r
+**/\r
+#define PAL_HALT_LIGHT 29 \r
+\r
+/**\r
+   \r
+  Initialize tags and data of a cache line for processor\r
+  testing. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_CACHE_LINE_INIT 31\r
+\r
+/**\r
+   \r
+  Read tag and data of a cache line for diagnostic testing. It\r
+  is optional.\r
+\r
+  @param CallingConvention  Satcked Register\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_CACHE_READ 259 \r
+\r
+/**\r
+   \r
+  Write tag and data of a cache for diagnostic testing. It is\r
+  optional.\r
+\r
+  @param CallingConvention  Satcked Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_CACHE_WRITE 260\r
+\r
+/**\r
+   \r
+  Returns alignment and size requirements needed for the memory\r
+  buffer passed to the PAL_TEST_PROC procedure as well as\r
+  information on self-test control words for the processor self\r
+  tests. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_TEST_INFO 37\r
+\r
+/**\r
+   \r
+  Perform late processor self test. It is required by\r
+  IPF.\r
+\r
+  @param CallingConvention  Stacked Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_TEST_PROC 258\r
+\r
+/**\r
+   \r
+  Return information needed to relocate PAL procedures and PAL\r
+  PMI code to memory. It is required by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_COPY_INFO 30\r
+\r
+/**\r
+   \r
+  Relocate PAL procedures and PAL PMI code to memory. It is\r
+  required by IPF.\r
+\r
+  @param CallingConvention  Stacked Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_COPY_PAL 256\r
+\r
+/**\r
+   \r
+  Enter IA-32 System environment. It is optional.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_ENTER_IA_32_ENV 33\r
+\r
+/**\r
+   \r
+  Register PMI memory entrypoints with processor. It is required\r
+  by IPF.\r
+\r
+  @param CallingConvention  Static Registers\r
+\r
+  @param Mode               Physical\r
+   \r
+**/\r
+#define PAL_PMI_ENTRYPOINT 32\r
+\r
+\r
+\r
 #endif\r
diff --git a/MdePkg/Include/Protocol/AbsolutePointer.h b/MdePkg/Include/Protocol/AbsolutePointer.h
new file mode 100644 (file)
index 0000000..df90fc1
--- /dev/null
@@ -0,0 +1,246 @@
+/** @file\r
+  The file provides services that allow information about a\r
+  absolute pointer device to be retrieved.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: AbsolutePointer.h\r
+\r
+**/\r
+\r
+#ifndef __ABSOLUTE_POINTER_H__\r
+#define __ABSOLUTE_POINTER_H__\r
+\r
+\r
+#define EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \\r
+  { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } }\r
+\r
+\r
+typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL EFI_ABSOLUTE_POINTER_PROTOCOL;\r
+\r
+\r
+//*******************************************************\r
+// EFI_ABSOLUTE_POINTER_MODE\r
+//*******************************************************\r
+\r
+\r
+/**\r
+  The following data values in the EFI_ABSOLUTE_POINTER_MODE\r
+  interface are read-only and are changed by using the appropriate\r
+  interface functions:\r
+  Attributes The following bits are set as needed (or'd\r
+  together) to indicate the capabilities of the device\r
+  supported. The remaining bits are undefined and should be\r
+  returned as 0.\r
+\r
+  \r
+  @param AbsoluteMinX The Absolute Minimum of the device on the\r
+                      x-axis.\r
+\r
+  @param AbsoluteMinY The Absolute Minimum of the device on the\r
+                      y axis.\r
+\r
+  @param AbsoluteMinZ The Absolute Minimum of the device on the\r
+                      z-axis.\r
+\r
+  @param AbsoluteMaxX The Absolute Maximum of the device on the\r
+                      x-axis. If 0, and the AbsoluteMinX is 0,\r
+                      then the pointer device does not support a\r
+                      xaxis.\r
+\r
+  @param AbsoluteMaxY The Absolute Maximum of the device on the\r
+                      y -axis. If 0,, and the AbsoluteMinX is 0,\r
+                      then the pointer device does not support a\r
+                      yaxis.\r
+\r
+  @param AbsoluteMaxZ The Absolute Maximum of the device on the\r
+                      z-axis. If 0 , and the AbsoluteMinX is 0,\r
+                      then the pointer device does not support a\r
+                      zaxis. \r
+\r
+**/\r
+typedef struct {\r
+  UINT64 AbsoluteMinX;\r
+  UINT64 AbsoluteMinY;\r
+  UINT64 AbsoluteMinZ;\r
+  UINT64 AbsoluteMaxX;\r
+  UINT64 AbsoluteMaxY;\r
+  UINT64 AbsoluteMaxZ;\r
+  UINT32 Attributes;\r
+} EFI_ABSOLUTE_POINTER_MODE;\r
+\r
+//\r
+// If set, indicates this device supports an alternate button input. \r
+// \r
+#define EFI_ABSP_SupportsAltActive    0x00000001\r
+\r
+//\r
+// If set, indicates this device returns pressure data in parameter CurrentZ.\r
+// \r
+#define EFI_ABSP_SupportsPressureAsZ  0x00000002\r
+\r
+\r
+/**\r
+  This function resets the pointer device hardware. As part of\r
+  initialization process, the firmware/device will make a quick\r
+  but reasonable attempt to verify that the device is\r
+  functioning. If the ExtendedVerification flag is TRUE the\r
+  firmware may take an extended amount of time to verify the\r
+  device is operating on reset. Otherwise the reset operation is\r
+  to occur as quickly as possible. The hardware verification\r
+  process is not defined by this specification and is left up to\r
+  the platform firmware or driver to implement.\r
+\r
+  @param This A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL\r
+              instance.\r
+\r
+  @param ExtendedVerification Indicates that the driver may\r
+                              perform a more exhaustive\r
+                              verification operation of the\r
+                              device during reset.\r
+\r
+  @retval EFI_SUCCESS The device was reset.\r
+  \r
+  @retval EFI_DEVICE_ERROR  The device is not functioning\r
+                            correctly and could not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ABSOLUTE_POINTER_RESET) (\r
+  IN CONST  EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
+  IN CONST  BOOLEAN                       ExtendedVerification\r
+);\r
+\r
+\r
+\r
+\r
+/**\r
+  Definitions of bits within ActiveButtons.\r
+  \r
+  @param EFI_ABSP_TouchActive This bit is set if the touch\r
+                              sensor is active.\r
+  \r
+  @param EFI_ABS_AltActive    This bit is set if the alt sensor,\r
+                              such as pen-side button, is\r
+                              active.\r
+**/\r
+#define EFI_ABSP_TouchActive  0x00000001\r
+#define EFI_ABS_AltActive     0x00000002\r
+\r
+\r
+/**\r
+  Definition of EFI_ABSOLUTE_POINTER_STATE.\r
+  \r
+  @param CurrentX The unsigned position of the activation on the\r
+                  x axis If the AboluteMinX and the AboluteMaxX\r
+                  fields of the EFI_ABSOLUTE_POINTER_MODE\r
+                  structure are both 0, then this pointer device\r
+                  does not support an x-axis, and this field\r
+                  must be ignored.\r
+\r
+  @param CurrentY The unsigned position of the activation on the\r
+                  x axis If the AboluteMinY and the AboluteMaxY\r
+                  fields of the EFI_ABSOLUTE_POINTER_MODE\r
+                  structure are both 0, then this pointer device\r
+                  does not support an y-axis, and this field\r
+                  must be ignored.\r
+\r
+  @param CurrentZ The unsigned position of the activation on the\r
+                  x axis, or the pressure measurement. If the\r
+                  AboluteMinZ and the AboluteMaxZ fields of the\r
+                  EFI_ABSOLUTE_POINTER_MODE structure are\r
+                  both 0, then this pointer device does not\r
+                  support an z-axis, and this field must be\r
+                  ignored.\r
+\r
+  @param ActiveButtons  Bits are set to 1 in this structure item\r
+                       to indicate that device buttons are\r
+                       active.\r
+\r
+**/\r
+typedef struct {\r
+  UINT64 CurrentX;\r
+  UINT64 CurrentY;\r
+  UINT64 CurrentZ;\r
+  UINT32 ActiveButtons;\r
+} EFI_ABSOLUTE_POINTER_STATE;\r
+\r
+/**\r
+  The GetState() function retrieves the current state of a pointer\r
+  device. This includes information on the active state associated\r
+  with the pointer device and the current position of the axes\r
+  associated with the pointer device. If the state of the pointer\r
+  device has not changed since the last call to GetState(), then\r
+  EFI_NOT_READY is returned. If the state of the pointer device\r
+  has changed since the last call to GetState(), then the state\r
+  information is placed in State, and EFI_SUCCESS is returned. If\r
+  a device error occurs while attempting to retrieve the state\r
+  information, then EFI_DEVICE_ERROR is returned.\r
+\r
+\r
+  @param This A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL\r
+              instance.\r
+\r
+  @param State  A pointer to the state information on the\r
+                pointer device.\r
+\r
+  @retval EFI_SUCCESS The state of the pointer device was\r
+                      returned in State.\r
+\r
+  @retval EFI_NOT_READY The state of the pointer device has not\r
+                        changed since the last call to GetState().\r
+\r
+  @retval EFI_DEVICE_ERROR  A device error occurred while\r
+                            attempting to retrieve the pointer\r
+                            device's current state.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE) (\r
+  IN CONST  EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r
+  IN OUT    EFI_ABSOLUTE_POINTER_STATE    *State\r
+);\r
+\r
+\r
+/**\r
+  The EFI_ABSOLUTE_POINTER_PROTOCOL provides a set of services\r
+  for a pointer device that can be used as an input device from an\r
+  application written to this specification. The services include\r
+  the ability to reset the pointer device, retrieve the state of\r
+  the pointer device, and retrieve the capabilities of the pointer\r
+  device. In addition certain data items describing the device are\r
+  provided.\r
+\r
+\r
+  @param Reset  Resets the pointer device.\r
+\r
+  @param GetState Retrieves the current state of the pointer\r
+                  device.\r
+\r
+  @param WaitForInput Event to use with WaitForEvent() to wait\r
+                      for input from the pointer device.\r
+  @param Mode Pointer to EFI_ABSOLUTE_POINTER_MODE data.\r
+\r
+**/\r
+struct _EFI_ABSOLUTE_POINTER_PROTOCOL {\r
+  EFI_ABSOLUTE_POINTER_RESET      Reset;\r
+  EFI_ABSOLUTE_POINTER_GET_STATE  GetState;\r
+  EFI_EVENT                       WaitForInput;\r
+  EFI_ABSOLUTE_POINTER_MODE       *Mode;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiAbsolutePointerProtocolGuid;\r
+\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/AcpiTable.h b/MdePkg/Include/Protocol/AcpiTable.h
new file mode 100644 (file)
index 0000000..b1335ef
--- /dev/null
@@ -0,0 +1,129 @@
+/** @file\r
+  The file provides the protocol to install or remove an ACPI\r
+  table from a platform. \r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: AcpiTable.h\r
+\r
+**/\r
+\r
+#ifndef __ACPI_TABLE_H___\r
+#define __ACPI_TABLE_H___\r
+\r
+#define EFI_ACPI_TABLE_PROTOCOL_GUID \\r
+  { 0xffe06bdd, 0x6107, 0x46a6, { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c }}\r
+\r
+\r
+typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL;\r
+\r
+/**\r
+\r
+  The InstallAcpiTable() function allows a caller to install an   \r
+  ACPI table. When successful, the table will be linked by the   \r
+  RSDT/XSDT. AcpiTableBuffer specifies the table to be installed.   \r
+  InstallAcpiTable() will make a copy of the table and insert the   \r
+  copy into the RSDT/XSDT. InstallAcpiTable() must insert the new   \r
+  table at the end of the RSDT/XSDT. To prevent namespace   \r
+  collision, ACPI tables may be created using UEFI ACPI table   \r
+  format. See Appendix O. On successful output, TableKey is   \r
+  initialized with a unique key. Its value may be used in a   \r
+  subsequent call to UninstallAcpiTable to remove an ACPI table.   \r
+  If an EFI application is running at the time of this call, the   \r
+  relevant EFI_CONFIGURATION_TABLE pointer to the RSDT is no   \r
+  longer considered valid.   \r
+\r
+\r
+  @param This A pointer to a EFI_ACPI_TABLE_PROTOCOL.\r
+\r
+  @param AcpiTableBuffer  A pointer to a buffer containing the\r
+                          ACPI table to be installed.\r
+\r
+  @param AcpiTableBufferSize  Specifies the size, in bytes, of\r
+                              the AcpiTableBuffer buffer.\r
+\r
+\r
+  @param TableKey   Returns a key to refer to the ACPI table.\r
+  \r
+  @retval EFI_SUCCESS The table was successfully inserted\r
+  \r
+  @retval EFI_INVALID_PARAMETER Either AcpiTableBuffer is NULL,\r
+                                TableKey is NULL, or\r
+                                AcpiTableBufferSize and the size\r
+                                field embedded in the ACPI table\r
+                                pointed to by AcpiTableBuffer\r
+                                are not in sync.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  Insufficient resources exist to\r
+                                complete the request.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ACPI_TABLE_INSTALL_ACPI_TABLE) (\r
+  IN CONST  EFI_ACPI_TABLE_PROTOCOL *This,\r
+  IN CONST  VOID                    *AcpiTableBuffer,\r
+  IN CONST  UINTN                   AcpiTableBufferSize,\r
+  OUT       UINTN                   *TableKey\r
+);\r
+\r
+\r
+/**\r
+  \r
+  The UninstallAcpiTable() function allows a caller to remove an\r
+  ACPI table. The routine will remove its reference from the\r
+  RSDT/XSDT. A table is referenced by the TableKey parameter\r
+  returned from a prior call to InstallAcpiTable(). If an EFI\r
+  application is running at the time of this call, the relevant\r
+  EFI_CONFIGURATION_TABLE pointer to the RSDT is no longer\r
+  considered valid.\r
+\r
+  @param This A pointer to a EFI_ACPI_TABLE_PROTOCOL.\r
+\r
+  @param TableKey Specifies the table to uninstall. The key was\r
+                  returned from InstallAcpiTable().\r
+\r
+  @retval EFI_SUCCESS The table was successfully inserted\r
+\r
+  @retval EFI_NOT_FOUND TableKey does not refer to a valid key\r
+                        for a table entry.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Insufficient resources exist to\r
+                                complete the request.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE) (\r
+  IN CONST  EFI_ACPI_TABLE_PROTOCOL *This,\r
+  IN CONST  UINTN                   TableKey\r
+);\r
+\r
+/**\r
+  The EFI_ACPI_TABLE_PROTOCOL provides the ability for a component\r
+  to install and uninstall ACPI tables from a platform.\r
+\r
+\r
+  @param InstallAcpiTable Installs an ACPI table into the\r
+                          system.\r
+\r
+  @param UninstallAcpiTable Removes a previously installed ACPI\r
+                            table from the system.\r
+\r
+**/   \r
+struct _EFI_ACPI_TABLE_PROTOCOL {\r
+  EFI_ACPI_TABLE_INSTALL_ACPI_TABLE   InstallAcpiTable;\r
+  EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE UninstallAcpiTable;\r
+};\r
+\r
+extern EFI_GUID gEfiAcpiTableProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/Arp.h b/MdePkg/Include/Protocol/Arp.h
new file mode 100644 (file)
index 0000000..ddcc740
--- /dev/null
@@ -0,0 +1,259 @@
+/** @file\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+  \r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  \r
+  Module Name:  Arp.h\r
+  \r
+**/\r
+\r
+#ifndef __EFI_ARP_PROTOCOL_H__\r
+#define __EFI_ARP_PROTOCOL_H__\r
+\r
+#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3 } \\r
+  }\r
+\r
+#define EFI_ARP_PROTOCOL_GUID \\r
+  { \\r
+    0xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } \\r
+  }\r
+\r
+typedef struct _EFI_ARP_PROTOCOL EFI_ARP_PROTOCOL;\r
+\r
+typedef struct {\r
+UINT32                      Size;\r
+BOOLEAN                     DenyFlag;\r
+BOOLEAN                     StaticFlag;\r
+UINT16                      HwAddressType;\r
+UINT16                      SwAddressType;\r
+UINT8                       HwAddressLength;\r
+UINT8                       SwAddressLength;\r
+} EFI_ARP_FIND_DATA;\r
+\r
+typedef struct {\r
+  UINT16                    SwAddressType;      // Host byte order\r
+  UINT8                     SwAddressLength;\r
+  VOID                      *StationAddress;    // Network byte order\r
+  UINT32                    EntryTimeOut;\r
+  UINT32                    RetryCount;\r
+  UINT32                    RetryTimeOut;\r
+} EFI_ARP_CONFIG_DATA;\r
+\r
+\r
+/**\r
+  Assigns a station address (protocol type and network address) to this instance of the ARP cache.\r
+\r
+  @param  This                   A pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  ConfigData             A pointer to the EFI_ARP_CONFIG_DATA structure.Buffer\r
+\r
+  @retval EFI_SUCCESS           The new station address was successfully registered.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_ACCESS_DENIED     The SwAddressType, SwAddressLength, or\r
+                                StationAddress is different from the one that is already\r
+                                registered.\r
+  @retval EFI_OUT_OF_RESOURCES  Storage for the new StationAddress could not be allocated.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_ARP_CONFIGURE) (\r
+  IN EFI_ARP_PROTOCOL       *This,\r
+  IN EFI_ARP_CONFIG_DATA    *ConfigData   OPTIONAL\r
+  )\r
+;  \r
+\r
+/**\r
+  Inserts an entry to the ARP cache.\r
+\r
+  @param  This            A pointer to the EFI_ARP_PROTOCOL instance.  \r
+  @param  DenyFlag        Set to TRUE if this entry is a "deny" entry. Set to FALSE if this\r
+                          entry is a "normal" entry.\r
+  @param  TargetSwAddress Pointer to a protocol address to add (or deny). May be set to\r
+                          NULL if DenyFlag is TRUE.\r
+  @param  TargetHwAddress Pointer to a hardware address to add (or deny). May be set to\r
+                          NULL if DenyFlag is TRUE.\r
+  @param  TimeoutValue    Time in 100-ns units that this entry will remain in the ARP\r
+                          cache. A value of zero means that the entry is permanent. A\r
+                          nonzero value will override the one given by Configure() if\r
+                          the entry to be added is dynamic entry.\r
+  @param  Overwrite       If TRUE, the matching cache entry will be overwritten with the\r
+                          supplied parameters. If FALSE, EFI_ACCESS_DENIED\r
+\r
+  @retval EFI_SUCCESS           The entry has been added or updated.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_OUT_OF_RESOURCES  The new ARP cache entry could not be allocated.\r
+  @retval EFI_ACCESS_DENIED     The ARP cache entry already exists and Overwrite is not true.\r
+  @retval EFI_NOT_STARTED       The ARP driver instance has not been configured.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ARP_ADD) (\r
+  IN EFI_ARP_PROTOCOL       *This,\r
+  IN BOOLEAN                DenyFlag,\r
+  IN VOID                   *TargetSwAddress  OPTIONAL,\r
+  IN VOID                   *TargetHwAddress  OPTIONAL,\r
+  IN UINT32                 TimeoutValue,\r
+  IN BOOLEAN                Overwrite\r
+  )\r
+;  \r
+\r
+/**\r
+  Locates one or more entries in the ARP cache.\r
+\r
+  @param  This            A pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  BySwAddress     Set to TRUE to look for matching software protocol addresses.\r
+                          Set to FALSE to look for matching hardware protocol addresses.\r
+  @param  AddressBuffer   Pointer to address buffer. Set to NULL to match all addresses.\r
+  @param  EntryLength     The size of an entry in the entries buffer. To keep the\r
+                          EFI_ARP_FIND_DATA structure properly aligned, this field\r
+                          may be longer than sizeof(EFI_ARP_FIND_DATA) plus\r
+                          the length of the software and hardware addresses.\r
+  @param  EntryCount      The number of ARP cache entries that are found by the specified criteria.\r
+  @param  Entries         Pointer to the buffer that will receive the ARP cache entries.\r
+  @param  Refresh         Set to TRUE to refresh the timeout value of the matching ARP\r
+                          cache entry.\r
+\r
+  @retval EFI_SUCCESS           The requested ARP cache entries were copied into the buffer.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_NOT_FOUND         No matching entries were found.\r
+  @retval EFI_NOT_STARTED       The ARP driver instance has not been configured.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_ARP_FIND) (\r
+  IN EFI_ARP_PROTOCOL       *This,\r
+  IN BOOLEAN                BySwAddress,\r
+  IN VOID                   *AddressBuffer    OPTIONAL,\r
+  OUT UINT32                *EntryLength      OPTIONAL,\r
+  OUT UINT32                *EntryCount       OPTIONAL,\r
+  OUT EFI_ARP_FIND_DATA     **Entries         OPTIONAL,\r
+  IN BOOLEAN                Refresh\r
+  )\r
+;  \r
+\r
+\r
+/**\r
+  Removes entries from the ARP cache.\r
+\r
+  @param  This          A pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  BySwAddress   Set to TRUE to delete matching protocol addresses.\r
+                        Set to FALSE to delete matching hardware addresses.\r
+  @param  AddressBuffer Pointer to the address buffer that is used as a key to look for the\r
+                        cache entry. Set to NULL to delete all entries.\r
+\r
+  @retval EFI_SUCCESS           The entry was removed from the ARP cache.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_NOT_FOUND         The specified deletion key was not found.\r
+  @retval EFI_NOT_STARTED       The ARP driver instance has not been configured.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ARP_DELETE) (\r
+  IN EFI_ARP_PROTOCOL       *This,\r
+  IN BOOLEAN                BySwAddress,\r
+  IN VOID                   *AddressBuffer   OPTIONAL\r
+  )\r
+;  \r
+\r
+/**\r
+  Removes all dynamic ARP cache entries that were added by this interface.\r
+\r
+  @param  This                   A pointer to the EFI_ARP_PROTOCOL instance.\r
+                                 \r
+  @retval EFI_SUCCESS           The cache has been flushed.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_NOT_FOUND         There are no matching dynamic cache entries.\r
+  @retval EFI_NOT_STARTED       The ARP driver instance has not been configured.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ARP_FLUSH) (\r
+  IN EFI_ARP_PROTOCOL       *This\r
+  )\r
+;  \r
+\r
+/**\r
+  Starts an ARP request session.\r
+\r
+  @param  This            A pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  TargetSwAddress Pointer to the protocol address to resolve.\r
+  @param  ResolvedEvent   Pointer to the event that will be signaled when the address is\r
+                          resolved or some error occurs.\r
+  @param  TargetHwAddress Pointer to the buffer for the resolved hardware address in\r
+                          network byte order. The buffer must be large enough to hold the\r
+                          resulting hardware address. TargetHwAddress must not be\r
+                          NULL.\r
+\r
+  @retval EFI_SUCCESS           The data was copied from the ARP cache into the\r
+                                TargetHwAddress buffer.\r
+  @retval EFI_INVALID_PARAMETER This or TargetHwAddress is NULL.\r
+  @retval EFI_ACCESS_DENIED     The requested address is not present in the normal ARP cache but\r
+                                is present in the deny address list. Outgoing traffic to that address is\r
+                                forbidden.\r
+  @retval EFI_NOT_STARTED       The ARP driver instance has not been configured.\r
+  @retval EFI_NOT_READY         The request has been started and is not finished.\r
+  @retval EFI_UNSUPPORTED       The requested conversion is not supported in this implementation or\r
+                                configuration.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ARP_REQUEST) (\r
+  IN EFI_ARP_PROTOCOL       *This, \r
+  IN VOID                   *TargetSwAddress  OPTIONAL,\r
+  IN EFI_EVENT              ResolvedEvent     OPTIONAL,\r
+  OUT VOID                  *TargetHwAddress  \r
+  )\r
+;  \r
+\r
+/**\r
+  Cancels an ARP request session.\r
+\r
+  @param  This            A pointer to the EFI_ARP_PROTOCOL instance.\r
+  @param  TargetSwAddress Pointer to the protocol address in previous request session.\r
+  @param  ResolvedEvent   Pointer to the event that is used as the notification event in\r
+                          previous request session.\r
+\r
+  @retval EFI_SUCCESS           The pending request session(s) is/are aborted and corresponding\r
+                                event(s) is/are signaled.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_NOT_STARTED       The ARP driver instance has not been configured.\r
+  @retval EFI_NOT_FOUND         The request is not issued by\r
+                                EFI_ARP_PROTOCOL.Request().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ARP_CANCEL) (\r
+  IN EFI_ARP_PROTOCOL       *This, \r
+  IN VOID                   *TargetSwAddress  OPTIONAL,\r
+  IN EFI_EVENT              ResolvedEvent     OPTIONAL\r
+  )\r
+;  \r
+\r
+struct _EFI_ARP_PROTOCOL {\r
+  EFI_ARP_CONFIGURE         Configure;\r
+  EFI_ARP_ADD               Add;\r
+  EFI_ARP_FIND              Find;\r
+  EFI_ARP_DELETE            Delete;\r
+  EFI_ARP_FLUSH             Flush;\r
+  EFI_ARP_REQUEST           Request;\r
+  EFI_ARP_CANCEL            Cancel;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiArpServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiArpProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/AuthenticationInfo.h b/MdePkg/Include/Protocol/AuthenticationInfo.h
new file mode 100644 (file)
index 0000000..f80dbf3
--- /dev/null
@@ -0,0 +1,125 @@
+/** @file\r
+  EFI_AUTHENTICATION_INFO_PROTOCOL as defined in UEFI 2.0.\r
+  This protocol is used on any device handle to obtain authentication information \r
+  associated with the physical or logical device.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  AuthenticationInfo.h\r
+\r
+**/\r
+\r
+#ifndef __AUTHENTICATION_INFO_H__\r
+#define __AUTHENTICATION_INFO_H__\r
+\r
+#define EFI_AUTHENTICATION_INFO_PROTOCOL_GUID \\r
+  { \\r
+    0x7671d9d0, 0x53db, 0x4173, {0xaa, 0x69, 0x23, 0x27, 0xf2, 0x1f, 0x0b, 0xc7 } \\r
+  }\r
+  \r
+#define EFI_AUTHENTICATION_CHAP_RADIUS_GUID \\r
+  { \\r
+    0xd6062b50, 0x15ca, 0x11da, {0x92, 0x19, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \\r
+  }\r
+\r
+#define EFI_AUTHENTICATION_CHAP_LOCAL_GUID \\r
+  { \\r
+    0xc280c73e, 0x15ca, 0x11da, {0xb0, 0xca, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_AUTHENTICATION_INFO_PROTOCOL EFI_AUTHENTICATION_INFO_PROTOCOL;\r
+\r
+typedef struct {\r
+  EFI_GUID         Guid;\r
+  UINT16           Length;\r
+} AUTH_NODE_HEADER;\r
+\r
+typedef struct {\r
+  AUTH_NODE_HEADER Header;\r
+  EFI_IPv6_ADDRESS RadiusIpAddr;             // IPv4 or IPv6 address\r
+  UINT16           Reserved;\r
+  EFI_IPv6_ADDRESS NasIpAddr;                // IPv4 or IPv6 address\r
+  UINT16           NasSecretLength; \r
+  UINT8            *NasSecret;      \r
+  UINT16           ChapSecretLength;\r
+  UINT8            *ChapSecret;\r
+  UINT16           ChapNameLength;\r
+  UINT8            *ChapName;\r
+} CHAP_RADIUS_AUTH_NODE;\r
+\r
+typedef struct {\r
+  AUTH_NODE_HEADER Header;\r
+  UINT16           Reserved;\r
+  UINT16           UserSecretLength;\r
+  UINT8            *UserSecret;     \r
+  UINT16           UserNameLength;\r
+  UINT8            *UserName;\r
+  UINT16           ChapSecretLength;\r
+  UINT8            *ChapSecret;\r
+  UINT16           ChapNameLength;\r
+  UINT8            *ChapName;\r
+} CHAP_LOCAL_AUTH_NODE;\r
+\r
+/**\r
+  Retrieves the Authentication information associated with a particular controller handle.\r
+\r
+  @param  This                   Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL\r
+  @param  ControllerHandle       Handle to the Controller\r
+  @param  Buffer                 Pointer to the authentication information.\r
+\r
+  @retval EFI_SUCCESS           Successfully retrieved Authentication information for the given ControllerHandle\r
+  @retval EFI_INVALID_PARAMETER No matching Authentication information found for the given ControllerHandle\r
+  @retval EFI_DEVICE_ERROR      The authentication information could not be retrieved due to a\r
+                                hardware error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_AUTHENTICATION_PROTOCOL_INFO_GET) (\r
+  IN  EFI_AUTHENTICATION_INFO_PROTOCOL *This,\r
+  IN  EFI_HANDLE                       *ControllerHandle,\r
+  OUT VOID                             *Buffer\r
+  )\r
+;  \r
+\r
+/**\r
+  Set the Authentication information for a given controller handle.\r
+\r
+  @param  This                  Pointer to the EFI_AUTHENTICATION_INFO_PROTOCOL\r
+  @param  ControllerHandle      Handle to the Controller\r
+  @param  Buffer                Pointer to the authentication information.\r
+                                \r
+  @retval EFI_SUCCESS          Successfully set Authentication information for the given ControllerHandle\r
+  @retval EFI_UNSUPPORTED      If the platform policies do not allow setting of the Authentication\r
+                               information.\r
+  @retval EFI_DEVICE_ERROR     The authentication information could not be configured due to a\r
+                               hardware error.\r
+  @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_AUTHENTICATION_PROTOCOL_INFO_SET) (\r
+  IN EFI_AUTHENTICATION_INFO_PROTOCOL  *This,\r
+  IN EFI_HANDLE                        *ControllerHandle,\r
+  IN VOID                              *Buffer\r
+  )\r
+;  \r
+\r
+struct _EFI_AUTHENTICATION_INFO_PROTOCOL {\r
+  EFI_AUTHENTICATION_PROTOCOL_INFO_GET Get;\r
+  EFI_AUTHENTICATION_PROTOCOL_INFO_SET Set;\r
+};\r
+\r
+extern EFI_GUID gEfiAuthenticationInfoProtocolGuid;\r
+extern EFI_GUID gEfiAuthenticationChapRadiusGuid;\r
+extern EFI_GUID gEfiAuthenticationChapLocalGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Bds.h b/MdePkg/Include/Protocol/Bds.h
new file mode 100644 (file)
index 0000000..d060eb9
--- /dev/null
@@ -0,0 +1,87 @@
+/** @file\r
+  Boot Device Selection Architectural Protocol as defined in DXE CIS\r
+\r
+  When the DXE core is done it calls the BDS via this protocol.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Bds.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_BDS_H__\r
+#define __ARCH_PROTOCOL_BDS_H__\r
+\r
+//\r
+// Global ID for the BDS Architectural Protocol\r
+//\r
+#define EFI_BDS_ARCH_PROTOCOL_GUID \\r
+  { 0x665E3FF6, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }\r
+\r
+//\r
+// Declare forward reference for the BDS Architectural Protocol\r
+//\r
+typedef struct _EFI_BDS_ARCH_PROTOCOL   EFI_BDS_ARCH_PROTOCOL;\r
+\r
+/**\r
+  This function uses policy data from the platform to determine what operating \r
+  system or system utility should be loaded and invoked.  This function call \r
+  also optionally make the use of user input to determine the operating system \r
+  or system utility to be loaded and invoked.  When the DXE Core has dispatched \r
+  all the drivers on the dispatch queue, this function is called.  This \r
+  function will attempt to connect the boot devices required to load and invoke \r
+  the selected operating system or system utility.  During this process, \r
+  additional firmware volumes may be discovered that may contain addition DXE \r
+  drivers that can be dispatched by the DXE Core.   If a boot device cannot be \r
+  fully connected, this function calls the DXE Service Dispatch() to allow the \r
+  DXE drivers from any newly discovered firmware volumes to be dispatched.  \r
+  Then the boot device connection can be attempted again.  If the same boot \r
+  device connection operation fails twice in a row, then that boot device has \r
+  failed, and should be skipped.  This function should never return.\r
+\r
+  @param  This             The EFI_BDS_ARCH_PROTOCOL instance.\r
+\r
+  @return None.\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_BDS_ENTRY) (\r
+  IN EFI_BDS_ARCH_PROTOCOL  *This\r
+  );\r
+\r
+/**\r
+  Interface stucture for the BDS Architectural Protocol.\r
+\r
+  @par Protocol Description:\r
+  The EFI_BDS_ARCH_PROTOCOL transfers control from DXE to an operating \r
+  system or a system utility.  If there are not enough drivers initialized \r
+  when this protocol is used to access the required boot device(s), then \r
+  this protocol should add drivers to the dispatch queue and return control \r
+  back to the dispatcher.  Once the required boot devices are available, then \r
+  the boot device can be used to load and invoke an OS or a system utility.\r
+\r
+  @par Protocol Parameters:\r
+  Entry - The entry point to BDS.  This call does not take any parameters, \r
+  and the return value can be ignored.  If it returns, then the \r
+  dispatcher must be invoked again, if it never returns, then an \r
+  operating system or a system utility have been invoked.\r
+\r
+**/\r
+struct _EFI_BDS_ARCH_PROTOCOL {\r
+  EFI_BDS_ENTRY Entry;\r
+};\r
+\r
+extern EFI_GUID gEfiBdsArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Bis.h b/MdePkg/Include/Protocol/Bis.h
new file mode 100644 (file)
index 0000000..37d1952
--- /dev/null
@@ -0,0 +1,418 @@
+/** @file\r
+  This file defines the BIS protocol.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Bis.h\r
+\r
+**/\r
+\r
+#ifndef __BIS_H__\r
+#define __BIS_H__\r
+\r
+#define EFI_BIS_PROTOCOL_GUID \\r
+  { \\r
+    0x0b64aab0, 0x5429, 0x11d4, {0x98, 0x16, 0x00, 0xa0, 0xc9, 0x1f, 0xad, 0xcf } \\r
+  }\r
+\r
+typedef struct _EFI_BIS_PROTOCOL  EFI_BIS_PROTOCOL;\r
+\r
+\r
+//\r
+// Basic types\r
+//\r
+typedef VOID    *BIS_APPLICATION_HANDLE;\r
+typedef UINT16  BIS_ALG_ID;\r
+typedef UINT32  BIS_CERT_ID;\r
+\r
+//\r
+// EFI_BIS_DATA type.\r
+//\r
+// EFI_BIS_DATA instances obtained from BIS must be freed by calling Free( ).\r
+//\r
+typedef struct {\r
+  UINT32  Length; // Length of Data in 8 bit bytes.\r
+  UINT8   *Data;  // 32 Bit Flat Address of data.\r
+} EFI_BIS_DATA;\r
+\r
+//\r
+// EFI_BIS_VERSION type.\r
+//\r
+typedef struct {\r
+  UINT32  Major;  // BIS Interface version number.\r
+  UINT32  Minor;  // Build number.\r
+} EFI_BIS_VERSION;\r
+\r
+//\r
+// ----------------------------------------------------//\r
+// Use these values to initialize EFI_BIS_VERSION.Major\r
+// and to interpret results of Initialize.\r
+// ----------------------------------------------------//\r
+//\r
+#define BIS_CURRENT_VERSION_MAJOR BIS_VERSION_1\r
+#define BIS_VERSION_1             1\r
+\r
+//\r
+// EFI_BIS_SIGNATURE_INFO type.\r
+//\r
+typedef struct {\r
+  BIS_CERT_ID CertificateID;  // Truncated hash of platform Boot Object\r
+  //  authorization certificate.\r
+  //\r
+  BIS_ALG_ID  AlgorithmID;  // A signature algorithm number.\r
+  UINT16      KeyLength;    // Length of alg. keys in bits.\r
+} EFI_BIS_SIGNATURE_INFO;\r
+\r
+//\r
+// Currently defined values for EFI_BIS_SIGNATURE_INFO.AlgorithmID.\r
+// The exact numeric values come from\r
+//    "Common Data Security Architecture (CDSA) Specification".\r
+//\r
+#define BIS_ALG_DSA     (41)  // CSSM_ALGID_DSA\r
+#define BIS_ALG_RSA_MD5 (42)  // CSSM_ALGID_MD5_WITH_RSA\r
+// Currently defined values for EFI_BIS_SIGNATURE_INFO.CertificateId.\r
+//\r
+#define BIS_CERT_ID_DSA     BIS_ALG_DSA     // CSSM_ALGID_DSA\r
+#define BIS_CERT_ID_RSA_MD5 BIS_ALG_RSA_MD5 // CSSM_ALGID_MD5_WITH_RSA\r
+// The  following  is a mask value that gets applied to the truncated hash of a\r
+// platform  Boot Object Authorization Certificate to create the certificateID.\r
+// A certificateID must not have any bits set to the value 1 other than bits in\r
+// this mask.\r
+//\r
+#define BIS_CERT_ID_MASK  (0xFF7F7FFF)\r
+\r
+//\r
+// Macros for dealing with the EFI_BIS_DATA object obtained\r
+// from BIS_GetSignatureInfo()\r
+// BIS_GET_SIGINFO_COUNT - tells how many EFI_BIS_SIGNATURE_INFO\r
+//  elements are contained in a EFI_BIS_DATA struct pointed to\r
+//  by the provided EFI_BIS_DATA*.\r
+//\r
+#define BIS_GET_SIGINFO_COUNT(BisDataPtr) ((BisDataPtr)->Length / sizeof (EFI_BIS_SIGNATURE_INFO))\r
+\r
+//\r
+// BIS_GET_SIGINFO_ARRAY - produces a EFI_BIS_SIGNATURE_INFO*\r
+//  from a given EFI_BIS_DATA*.\r
+//\r
+#define BIS_GET_SIGINFO_ARRAY(BisDataPtr) ((EFI_BIS_SIGNATURE_INFO *) (BisDataPtr)->Data)\r
+\r
+//\r
+// Binary Value of "X-Intel-BIS-ParameterSet" Attribute.\r
+// (Value is Base64 encoded in actual signed manifest).\r
+// {EDD35E31-07B9-11d2-83A3-00A0C91FADCF}\r
+//\r
+#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID \\r
+  { \\r
+    0xedd35e31, 0x7b9, 0x11d2, \\r
+    { \\r
+      0x83, 0xa3, 0x0, 0xa0, 0xc9, 0x1f, 0xad, 0xcf \\r
+    } \\r
+  }\r
+\r
+//\r
+// Support old name for backward compatible\r
+//\r
+#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE \\r
+        BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID\r
+\r
+/**                                                                 \r
+  Initializes the BIS service, checking that it is compatible with the version requested by the caller.\r
+  After this call, other BIS functions may be invoked.                                                 \r
+    \r
+  @param  This                     A pointer to the EFI_BIS_PROTOCOL object.\r
+  @param  AppHandle                The function writes the new BIS_APPLICATION_HANDLE if           \r
+                                   successful, otherwise it writes NULL. The caller must eventually\r
+                                   destroy this handle by calling Shutdown().                      \r
+  @param  InterfaceVersion         On input, the caller supplies the major version number of the\r
+                                   interface version desired.                                   \r
+                                   On output, both the major and minor                         \r
+                                   version numbers are updated with the major and minor version\r
+                                   numbers of the interface                                    \r
+  @param  TargetAddress            Indicates a network or device address of the BIS platform to connect to.                                                                 \r
+\r
+  @retval EFI_SUCCESS              The function completed successfully.\r
+  @retval EFI_INCOMPATIBLE_VERSION The InterfaceVersion.Major requested by the                \r
+                                   caller was not compatible with the interface version of the\r
+  @retval EFI_UNSUPPORTED          This is a local-platform implementation and        \r
+                                   TargetAddress.Data was not NULL, or                \r
+                                   TargetAddress.Data was any other value that was not\r
+                                   supported by the implementation.                   \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                              \r
+  @retval EFI_DEVICE_ERROR         The function encountered an unexpected internal failure.\r
+  @retval EFI_INVALID_PARAMETER    One or more parameters are invalid.\r
+                                          \r
+**/                                       \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_INITIALIZE) (\r
+  IN     EFI_BIS_PROTOCOL        *This,              \r
+  OUT    BIS_APPLICATION_HANDLE  *AppHandle,         \r
+  IN OUT EFI_BIS_VERSION         *InterfaceVersion,  \r
+  IN     EFI_BIS_DATA            *TargetAddress      \r
+  );\r
+\r
+/**                                                                 \r
+  Frees memory structures allocated and returned by other functions in the EFI_BIS protocol.  \r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                         \r
+  @param  ToFree                   An EFI_BIS_DATA* and associated memory block to be freed.\r
+\r
+  @retval EFI_SUCCESS              The function completed successfully.\r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid\r
+                                   application instance handle associated with the EFI_BIS protocol.                                     \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                                \r
+  @retval EFI_INVALID_PARAMETER    The ToFree parameter is not or is no longer a memory resource\r
+                                   associated with this AppHandle.                              \r
+                                           \r
+**/     \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_FREE) (\r
+  IN BIS_APPLICATION_HANDLE  AppHandle,               \r
+  IN EFI_BIS_DATA            *ToFree                  \r
+  );\r
+\r
+/**                                                                 \r
+  Shuts down an application's instance of the BIS service, invalidating the application handle. After\r
+  this call, other BIS functions may no longer be invoked using the application handle value.         \r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+\r
+  @retval EFI_SUCCESS              The function completed successfully.\r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid\r
+                                   application instance handle associated with the EFI_BIS protocol.                                     \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                                \r
+  @retval EFI_DEVICE_ERROR         The function encountered an unexpected internal failure.  \r
+                                           \r
+**/   \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_SHUTDOWN) (\r
+  IN BIS_APPLICATION_HANDLE  AppHandle               \r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the certificate that has been configured as the identity of the organization designated as\r
+  the source of authorization for signatures of boot objects.\r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+  @param  Certificate              The function writes an allocated EFI_BIS_DATA* containing the Boot\r
+                                   Object Authorization Certificate object.                            \r
+\r
+  @retval EFI_SUCCESS              The function completed successfully.\r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid\r
+                                   application instance handle associated with the EFI_BIS protocol.                                     \r
+  @retval EFI_NOT_FOUND            There is no Boot Object Authorization Certificate currently installed.                        \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                                \r
+  @retval EFI_INVALID_PARAMETER    The Certificate parameter supplied by the caller is NULL or\r
+                                   an invalid memory reference.                                       \r
+                                   \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CERTIFICATE) (\r
+  IN  BIS_APPLICATION_HANDLE  AppHandle,              \r
+  OUT EFI_BIS_DATA            **Certificate           \r
+  );\r
+\r
+/**                                                                 \r
+  Verifies the integrity and authorization of the indicated data object according to the\r
+  indicated credentials.                                                                \r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+  @param  Credentials              A Signed Manifest containing verification information for the indicated\r
+                                   data object.                                                            \r
+  @param  DataObject               An in-memory copy of the raw data object to be verified.\r
+  @param  IsVerified               The function writes TRUE if the verification succeeded, otherwise\r
+                                   FALSE.                                                           \r
+                                   \r
+  @retval EFI_SUCCESS              The function completed successfully.\r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid\r
+                                   application instance handle associated with the EFI_BIS protocol.                                       \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                                \r
+  @retval EFI_INVALID_PARAMETER    One or more parameters are invalid.\r
+  @retval EFI_SECURITY_VIOLATION   The signed manifest supplied as the Credentials parameter\r
+                                   was invalid (could not be parsed) or Platform-specific authorization failed, etc.\r
+  @retval EFI_DEVICE_ERROR         An unexpected internal error occurred.                           \r
+                                   \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_VERIFY_BOOT_OBJECT) (\r
+  IN  BIS_APPLICATION_HANDLE AppHandle,               \r
+  IN  EFI_BIS_DATA           *Credentials,            \r
+  IN  EFI_BIS_DATA           *DataObject,             \r
+  OUT BOOLEAN                *IsVerified              \r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the current status of the Boot Authorization Check Flag.\r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+  @param  CheckIsRequired          The function writes the value TRUE if a Boot Authorization Check is\r
+                                   currently required on this platform, otherwise the function writes \r
+                                   FALSE.                                                             \r
+                                   \r
+  @retval EFI_SUCCESS              The function completed successfully.\r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid\r
+                                   application instance handle associated with the EFI_BIS protocol.                                       \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                                \r
+  @retval EFI_INVALID_PARAMETER    The CheckIsRequired parameter supplied by the caller is\r
+                                   NULL or an invalid memory reference.                   \r
+                                   \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CHECKFLAG) (\r
+  IN  BIS_APPLICATION_HANDLE  AppHandle,             \r
+  OUT BOOLEAN                 *CheckIsRequired       \r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves a unique token value to be included in the request credential for the next update of any\r
+  parameter in the Boot Object Authorization set                                                    \r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+  @param  UpdateToken              The function writes an allocated EFI_BIS_DATA* containing the new\r
+                                   unique update token value.                                                                          \r
+                                   \r
+  @retval EFI_SUCCESS              The function completed successfully.\r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid\r
+                                   application instance handle associated with the EFI_BIS protocol.                                       \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                                \r
+  @retval EFI_INVALID_PARAMETER    The UpdateToken parameter supplied by the caller is NULL or\r
+                                   an invalid memory reference.        \r
+  @retval EFI_DEVICE_ERROR         An unexpected internal error occurred.                                                            \r
+                                   \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_UPDATE_TOKEN) (\r
+  IN  BIS_APPLICATION_HANDLE  AppHandle,              \r
+  OUT EFI_BIS_DATA            **UpdateToken           \r
+  );\r
+\r
+/**                                                                 \r
+  Updates one of the configurable parameters of the Boot Object Authorization set.\r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+  @param  RequestCredential        This is a Signed Manifest with embedded attributes that carry the details\r
+                                   of the requested update.                                                 \r
+  @param  NewUpdateToken           The function writes an allocated EFI_BIS_DATA* containing the new                        \r
+                                   unique update token value.                                       \r
+                                   \r
+  @retval EFI_SUCCESS              The function completed successfully.                                                \r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid                              \r
+                                   application instance handle associated with the EFI_BIS protocol.                   \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                       \r
+  @retval EFI_INVALID_PARAMETER    One or more parameters are invalid.                                                 \r
+  @retval EFI_SECURITY_VIOLATION   The signed manifest supplied as the RequestCredential parameter                           \r
+                                   was invalid (could not be parsed) or Platform-specific authorization failed, etc.   \r
+  @retval EFI_DEVICE_ERROR         An unexpected internal error occurred.                                                                                                                                                                   \r
+                                   \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_UPDATE_BOOT_OBJECT_AUTHORIZATION) (\r
+  IN  BIS_APPLICATION_HANDLE AppHandle,               \r
+  IN  EFI_BIS_DATA           *RequestCredential,      \r
+  OUT EFI_BIS_DATA           **NewUpdateToken         \r
+  );\r
+\r
+/**                                                                 \r
+  Verifies the integrity and authorization of the indicated data object according to the indicated\r
+  credentials and authority certificate.                                                          \r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+  @param  Credentials              A Signed Manifest containing verification information for the\r
+                                   indicated data object.                                       \r
+  @param  DataObject               An in-memory copy of the raw data object to be verified.\r
+  @param  SectionName              An ASCII (not Unicode) string giving the section name in the  \r
+                                   manifest holding the verification information (in other words,\r
+                                   hash value) that corresponds to DataObject.                             \r
+  @param  AuthorityCertificate     A digital certificate whose public key must match the signer's                              \r
+                                   public key which is found in the credentials.                  \r
+  @param  IsVerified               The function writes TRUE if the verification was successful.\r
+                                   Otherwise, the function writes FALSE.                       \r
+                                   \r
+  @retval EFI_SUCCESS              The function completed successfully.                                                \r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid                              \r
+                                   application instance handle associated with the EFI_BIS protocol.                   \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                       \r
+  @retval EFI_INVALID_PARAMETER    One or more parameters are invalid.                                                 \r
+  @retval EFI_SECURITY_VIOLATION   The Credentials.Data supplied by the caller is NULL,\r
+                                   or the AuthorityCertificate supplied by the caller was \r
+                                   invalid (could not be parsed),                      \r
+                                   or Platform-specific authorization failed, etc.   \r
+  @retval EFI_DEVICE_ERROR         An unexpected internal error occurred.                                                                                                                                                                   \r
+                                   \r
+**/ \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_VERIFY_OBJECT_WITH_CREDENTIAL) (\r
+  IN  BIS_APPLICATION_HANDLE AppHandle,              \r
+  IN  EFI_BIS_DATA           *Credentials,           \r
+  IN  EFI_BIS_DATA           *DataObject,            \r
+  IN  EFI_BIS_DATA           *SectionName,           \r
+  IN  EFI_BIS_DATA           *AuthorityCertificate,  \r
+  OUT BOOLEAN                *IsVerified             \r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves a list of digital certificate identifier, digital signature algorithm, hash algorithm, and keylength\r
+  combinations that the platform supports.                                                                      \r
+      \r
+  @param  AppHandle                An opaque handle that identifies the caller's instance of initialization\r
+                                   of the BIS service.                                                                                           \r
+  @param  SignatureInfo            The function writes an allocated EFI_BIS_DATA* containing the array\r
+                                   of EFI_BIS_SIGNATURE_INFO structures representing the supported    \r
+                                   digital certificate identifier, algorithm, and key length combinations.                                   \r
+                                   \r
+  @retval EFI_SUCCESS              The function completed successfully.                                                \r
+  @retval EFI_NO_MAPPING           The AppHandle parameter is not or is no longer a valid                              \r
+                                   application instance handle associated with the EFI_BIS protocol.                   \r
+  @retval EFI_OUT_OF_RESOURCES     The function failed due to lack of memory or other resources.                       \r
+  @retval EFI_INVALID_PARAMETER    The SignatureInfo parameter supplied by the caller is NULL\r
+                                   or an invalid memory reference.                           \r
+  @retval EFI_DEVICE_ERROR         An unexpected internal error occurred.                                                                                                                                                                   \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BIS_GET_SIGNATURE_INFO) (\r
+  IN  BIS_APPLICATION_HANDLE  AppHandle,           \r
+  OUT EFI_BIS_DATA            **SignatureInfo      \r
+  );\r
+\r
+struct _EFI_BIS_PROTOCOL {\r
+  EFI_BIS_INITIALIZE                                  Initialize;\r
+  EFI_BIS_SHUTDOWN                                    Shutdown;\r
+  EFI_BIS_FREE                                        Free;\r
+  EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CERTIFICATE   GetBootObjectAuthorizationCertificate;\r
+  EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_CHECKFLAG     GetBootObjectAuthorizationCheckFlag;\r
+  EFI_BIS_GET_BOOT_OBJECT_AUTHORIZATION_UPDATE_TOKEN  GetBootObjectAuthorizationUpdateToken;\r
+  EFI_BIS_GET_SIGNATURE_INFO                          GetSignatureInfo;\r
+  EFI_BIS_UPDATE_BOOT_OBJECT_AUTHORIZATION            UpdateBootObjectAuthorization;\r
+  EFI_BIS_VERIFY_BOOT_OBJECT                          VerifyBootObject;\r
+  EFI_BIS_VERIFY_OBJECT_WITH_CREDENTIAL               VerifyObjectWithCredential;\r
+};\r
+\r
+extern EFI_GUID gEfiBisProtocolGuid;\r
+extern EFI_GUID gBootObjectAuthorizationParmsetGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/BlockIo.h b/MdePkg/Include/Protocol/BlockIo.h
new file mode 100644 (file)
index 0000000..4c7e8b4
--- /dev/null
@@ -0,0 +1,173 @@
+/** @file\r
+  Block IO protocol as defined in the EFI 1.0 specification.\r
+\r
+  The Block IO protocol is used to abstract block devices like hard drives,\r
+  DVD-ROMs and floppy drives.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  BlockIo.h\r
+\r
+**/\r
+\r
+#ifndef __BLOCK_IO_H__\r
+#define __BLOCK_IO_H__\r
+\r
+#define EFI_BLOCK_IO_PROTOCOL_GUID \\r
+  { \\r
+    0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_BLOCK_IO_PROTOCOL  EFI_BLOCK_IO_PROTOCOL;\r
+\r
+/**\r
+  Reset the Block Device.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ExtendedVerification Driver may perform diagnostics on reset.\r
+\r
+  @retval EFI_SUCCESS          The device was reset.\r
+  @retval EFI_DEVICE_ERROR     The device is not functioning properly and could\r
+                               not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLOCK_RESET) (\r
+  IN EFI_BLOCK_IO_PROTOCOL          *This,\r
+  IN BOOLEAN                        ExtendedVerification\r
+  )\r
+;\r
+\r
+/**\r
+  Read BufferSize bytes from Lba into Buffer.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  MediaId    Id of the media, changes every time the media is replaced.\r
+  @param  Lba        The starting Logical Block Address to read from\r
+  @param  BufferSize Size of Buffer, must be a multiple of device block size.\r
+  @param  Buffer     Buffer containing read data\r
+\r
+  @retval EFI_SUCCESS           The data was read correctly from the device.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error while performing the read.\r
+  @retval EFI_NO_MEDIA          There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED     The MediaId does not matched the current device.\r
+  @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
+  @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
+                                valid for the device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLOCK_READ) (\r
+  IN EFI_BLOCK_IO_PROTOCOL          *This,\r
+  IN UINT32                         MediaId,\r
+  IN EFI_LBA                        Lba,\r
+  IN UINTN                          BufferSize,\r
+  OUT VOID                          *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Write BufferSize bytes from Lba into Buffer.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  MediaId    Id of the media, changes every time the media is replaced.\r
+  @param  Lba        The starting Logical Block Address to read from\r
+  @param  BufferSize Size of Buffer, must be a multiple of device block size.\r
+  @param  Buffer     Buffer containing read data\r
+\r
+  @retval EFI_SUCCESS           The data was written correctly to the device.\r
+  @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.\r
+  @retval EFI_NO_MEDIA          There is no media in the device.\r
+  @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
+  @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
+  @retval EFI_INVALID_PARAMETER The write request contains a LBA that is not\r
+                                valid for the device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLOCK_WRITE) (\r
+  IN EFI_BLOCK_IO_PROTOCOL          *This,\r
+  IN UINT32                         MediaId,\r
+  IN EFI_LBA                        Lba,\r
+  IN UINTN                          BufferSize,\r
+  IN VOID                           *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Flush the Block Device.\r
+\r
+  @param  This              Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS       All outstanding data was written to the device\r
+  @retval EFI_DEVICE_ERROR  The device reported an error while writting back the data\r
+  @retval EFI_NO_MEDIA      There is no media in the device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BLOCK_FLUSH) (\r
+  IN EFI_BLOCK_IO_PROTOCOL  *This\r
+  )\r
+;\r
+\r
+/**\r
+  Block IO read only mode data and updated only via members of BlockIO\r
+\r
+**/\r
+typedef struct {\r
+  UINT32  MediaId;    ///< The curent media Id. If the media changes, this value is changed.\r
+  BOOLEAN RemovableMedia;  ///< TRUE if the media is removable; otherwise, FALSE.\r
+  BOOLEAN MediaPresent;    /**< TRUE if there is a media currently present in the device;\r
+             othersise, FALSE. THis field shows the media present status\r
+             as of the most recent ReadBlocks() or WriteBlocks() call.\r
+        **/\r
+  BOOLEAN LogicalPartition;  /**< TRUE if LBA 0 is the first block of a partition; otherwise\r
+             FALSE. For media with only one partition this would be TRUE.\r
+        **/\r
+  BOOLEAN ReadOnly;    /**< TRUE if the media is marked read-only otherwise, FALSE.\r
+             This field shows the read-only status as of the most recent WriteBlocks () call.\r
+        **/\r
+  BOOLEAN WriteCaching;    ///< TRUE if the WriteBlock () function caches write data.\r
+\r
+  UINT32  BlockSize;    /**< The intrinsic block size of the device. If the media changes, then\r
+             this field is updated.\r
+        **/\r
+  UINT32  IoAlign;    ///< Supplies the alignment requirement for any buffer to read or write block(s).\r
+\r
+  EFI_LBA LastBlock;    /**< The last logical block address on the device.\r
+             If the media changes, then this field is updated.\r
+        **/\r
+} EFI_BLOCK_IO_MEDIA;\r
+\r
+#define EFI_BLOCK_IO_PROTOCOL_REVISION  0x00010000\r
+\r
+struct _EFI_BLOCK_IO_PROTOCOL {\r
+  UINT64              Revision;\r
+\r
+  EFI_BLOCK_IO_MEDIA  *Media;\r
+\r
+  EFI_BLOCK_RESET     Reset;\r
+  EFI_BLOCK_READ      ReadBlocks;\r
+  EFI_BLOCK_WRITE     WriteBlocks;\r
+  EFI_BLOCK_FLUSH     FlushBlocks;\r
+\r
+};\r
+\r
+extern EFI_GUID gEfiBlockIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/BusSpecificDriverOverride.h b/MdePkg/Include/Protocol/BusSpecificDriverOverride.h
new file mode 100644 (file)
index 0000000..c446940
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+  Bus Specific Driver Override protocol as defined in the EFI 1.1 specification.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  BusSpecificDriverOverride.h\r
+\r
+**/\r
+\r
+#ifndef _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_\r
+#define _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_H_\r
+\r
+//\r
+// Global ID for the Bus Specific Driver Override Protocol\r
+//\r
+#define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID \\r
+  { \\r
+    0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65 } \\r
+  }\r
+\r
+typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL;\r
+\r
+//\r
+// Prototypes for the Bus Specific Driver Override Protocol\r
+//\r
+\r
+/**                                                                   \r
+  Uses a bus specific algorithm to retrieve a driver image handle for a controller.\r
+    \r
+  @param  This                  A pointer to the EFI_BUS_SPECIFIC_DRIVER_\r
+                                OVERRIDE_PROTOCOL instance.              \r
+  @param  DriverImageHandle     On input, a pointer to the previous driver image handle returned\r
+                                by GetDriver(). On output, a pointer to the next driver         \r
+                                image handle. Passing in a NULL, will return the first driver   \r
+                                image handle.                                                     \r
+                                \r
+  @retval EFI_SUCCESS           A bus specific override driver is returned in DriverImageHandle.\r
+  @retval EFI_NOT_FOUND         The end of the list of override drivers was reached.\r
+  @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a\r
+                                previous call to GetDriver().                           \r
+                                   \r
+**/   \r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER) (\r
+  IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL              *This,\r
+  IN OUT EFI_HANDLE                                         *DriverImageHandle\r
+  );\r
+\r
+//\r
+// Interface structure for the Bus Specific Driver Override Protocol\r
+//\r
+struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL {\r
+  EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER GetDriver;\r
+};\r
+\r
+extern EFI_GUID gEfiBusSpecificDriverOverrideProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/ComponentName.h b/MdePkg/Include/Protocol/ComponentName.h
new file mode 100644 (file)
index 0000000..68fd31b
--- /dev/null
@@ -0,0 +1,123 @@
+/** @file\r
+  EFI Component Name Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  ComponentName.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_COMPONENT_NAME_H__\r
+#define __EFI_COMPONENT_NAME_H__\r
+\r
+//\r
+// Global ID for the Component Name Protocol\r
+//\r
+#define EFI_COMPONENT_NAME_PROTOCOL_GUID \\r
+  { \\r
+    0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_COMPONENT_NAME_PROTOCOL  EFI_COMPONENT_NAME_PROTOCOL;\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
+\r
+  @param  This       A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  Language   A pointer to a three character ISO 639-2 language identifier.\r
+                     This is the language of the driver name that that the caller\r
+                     is requesting, and it must match one of the languages specified\r
+                     in SupportedLanguages.  The number of languages supported by a\r
+                     driver is up to the driver writer.\r
+  @param  DriverName A pointer to the Unicode string to return.  This Unicode string\r
+                     is the name of the driver specified by This in the language\r
+                     specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by This\r
+                                and the language specified by Language was returned\r
+                                in DriverName.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                language specified by Language.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) (\r
+  IN EFI_COMPONENT_NAME_PROTOCOL           *This,\r
+  IN  CHAR8                                *Language,\r
+  OUT CHAR16                               **DriverName\r
+  );\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by an EFI Driver.\r
+\r
+  @param  This             A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  ControllerHandle The handle of a controller that the driver specified by\r
+                           This is managing.  This handle specifies the controller\r
+                           whose name is to be returned.\r
+  @param  ChildHandle      The handle of the child controller to retrieve the name\r
+                           of.  This is an optional parameter that may be NULL.  It\r
+                           will be NULL for device drivers.  It will also be NULL\r
+                           for a bus drivers that wish to retrieve the name of the\r
+                           bus controller.  It will not be NULL for a bus driver\r
+                           that wishes to retrieve the name of a child controller.\r
+  @param  Language         A pointer to a three character ISO 639-2 language\r
+                           identifier.  This is the language of the controller name\r
+                           that that the caller is requesting, and it must match one\r
+                           of the languages specified in SupportedLanguages.  The\r
+                           number of languages supported by a driver is up to the\r
+                           driver writer.\r
+  @param  ControllerName   A pointer to the Unicode string to return.  This Unicode\r
+                           string is the name of the controller specified by\r
+                           ControllerHandle and ChildHandle in the language specified\r
+                           by Language from the point of view of the driver specified\r
+                           by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in the\r
+                                language specified by Language for the driver\r
+                                specified by This was returned in DriverName.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently managing\r
+                                the controller specified by ControllerHandle and\r
+                                ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                language specified by Language.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) (\r
+  IN EFI_COMPONENT_NAME_PROTOCOL                              *This,\r
+  IN  EFI_HANDLE                                              ControllerHandle,\r
+  IN  EFI_HANDLE                                              ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                                   *Language,\r
+  OUT CHAR16                                                  **ControllerName\r
+  );\r
+\r
+//\r
+// Interface structure for the Component Name Protocol\r
+//\r
+struct _EFI_COMPONENT_NAME_PROTOCOL {\r
+  EFI_COMPONENT_NAME_GET_DRIVER_NAME      GetDriverName;\r
+  EFI_COMPONENT_NAME_GET_CONTROLLER_NAME  GetControllerName;\r
+  CHAR8                                   *SupportedLanguages;\r
+};\r
+\r
+extern EFI_GUID gEfiComponentNameProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/ComponentName2.h b/MdePkg/Include/Protocol/ComponentName2.h
new file mode 100644 (file)
index 0000000..243490d
--- /dev/null
@@ -0,0 +1,165 @@
+/** @file\r
+  EFI Component Name 2 Protocol\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  ComponentName.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_COMPONENT_NAME2_H__\r
+#define __EFI_COMPONENT_NAME2_H__\r
+\r
+//\r
+// Global ID for the Component Name Protocol\r
+//\r
+#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \\r
+  {0x6a7a5cff, 0xe8d9, 0x4f70, { 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14 } }\r
+\r
+typedef struct _EFI_COMPONENT_NAME2_PROTOCOL  EFI_COMPONENT_NAME2_PROTOCOL;\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of\r
+  the EFI Driver.\r
+\r
+  @param  This       A pointer to the\r
+                     EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  \r
+  @param  Language   A pointer to a Null-terminated ASCII string\r
+                     array indicating the language. This is the\r
+                     language of the driver name that the caller\r
+                     is requesting, and it must match one of the\r
+                     languages specified in SupportedLanguages.\r
+                     The number of languages supported by a\r
+                     driver is up to the driver writer. Language\r
+                     is specified in RFC 3066 language code\r
+                     format.\r
+  \r
+  @param  DriverName A pointer to the Unicode string to return.\r
+                     This Unicode string is the name of the\r
+                     driver specified by This in the language\r
+                     specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the\r
+                                Driver specified by This and the\r
+                                language specified by Language\r
+                                was returned in DriverName.\r
+  \r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  \r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+  \r
+  @retval EFI_UNSUPPORTED       The driver specified by This\r
+                                does not support the language\r
+                                specified by Language.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) (\r
+  IN EFI_COMPONENT_NAME2_PROTOCOL          *This,\r
+  IN  CHAR8                                *Language,\r
+  OUT CHAR16                               **DriverName\r
+  );\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of\r
+  the controller that is being managed by an EFI Driver.\r
+\r
+  @param  This             A pointer to the\r
+                           EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  ControllerHandle The handle of a controller that the\r
+                           driver specified by This is managing.\r
+                           This handle specifies the controller\r
+                           whose name is to be returned.\r
+\r
+  @param ChildHandle      The handle of the child controller to\r
+                           retrieve the name of.  This is an\r
+                           optional parameter that may be NULL.\r
+                           It will be NULL for device drivers.\r
+                           It will also be NULL for a bus\r
+                           drivers that wish to retrieve the\r
+                           name of the bus controller.  It will\r
+                           not be NULL for a bus driver that\r
+                           wishes to retrieve the name of a\r
+                           child controller.\r
+\r
+  @param  Language         A pointer to a Null-terminated ASCII\r
+                           string array indicating the language.\r
+                           This is the language of the driver\r
+                           name that the caller is requesting,\r
+                           and it must match one of the\r
+                           languages specified in\r
+                           SupportedLanguages. The number of\r
+                           languages supported by a driver is up\r
+                           to the driver writer. Language is\r
+                           specified in RFC 3066 language code\r
+                           format.\r
+\r
+  @param  ControllerName   A pointer to the Unicode string to\r
+                           return.  This Unicode string is the\r
+                           name of the controller specified by\r
+                           ControllerHandle and ChildHandle in\r
+                           the language specified by Language\r
+                           from the point of view of the driver\r
+                           specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user\r
+                                readable name in the language\r
+                                specified by Language for the\r
+                                driver specified by This was\r
+                                returned in DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it\r
+                                is not a valid EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is\r
+                                not currently managing the\r
+                                controller specified by\r
+                                ControllerHandle and\r
+                                ChildHandle.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This\r
+                                does not support the language\r
+                                specified by Language.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) (\r
+  IN EFI_COMPONENT_NAME2_PROTOCOL *This,\r
+  IN  EFI_HANDLE                  ControllerHandle,\r
+  IN  EFI_HANDLE                  ChildHandle        OPTIONAL,\r
+  IN  CHAR8                       *Language,\r
+  OUT CHAR16                      **ControllerName\r
+  );\r
+\r
+//\r
+// Interface structure for the Component Name Protocol\r
+//\r
+struct _EFI_COMPONENT_NAME2_PROTOCOL {\r
+  EFI_COMPONENT_NAME2_GET_DRIVER_NAME      GetDriverName;\r
+  EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME  GetControllerName;\r
+  CHAR8                                    *SupportedLanguages;\r
+};\r
+\r
+extern EFI_GUID gEfiComponentName2ProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Cpu.h b/MdePkg/Include/Protocol/Cpu.h
new file mode 100644 (file)
index 0000000..5dd4ffc
--- /dev/null
@@ -0,0 +1,331 @@
+/** @file\r
+  CPU Architectural Protocol as defined in DXE CIS\r
+\r
+  This code abstracts the DXE core from processor implementation details.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Cpu.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_CPU_H__\r
+#define __ARCH_PROTOCOL_CPU_H__\r
+\r
+#include <Protocol/DebugSupport.h>\r
+\r
+#define EFI_CPU_ARCH_PROTOCOL_GUID \\r
+  { 0x26baccb1, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }\r
+\r
+typedef struct _EFI_CPU_ARCH_PROTOCOL   EFI_CPU_ARCH_PROTOCOL;\r
+\r
+typedef enum {\r
+  EfiCpuFlushTypeWriteBackInvalidate,\r
+  EfiCpuFlushTypeWriteBack,\r
+  EfiCpuFlushTypeInvalidate,\r
+  EfiCpuMaxFlushType\r
+} EFI_CPU_FLUSH_TYPE;\r
+\r
+typedef enum {\r
+  EfiCpuInit,\r
+  EfiCpuMaxInitType\r
+} EFI_CPU_INIT_TYPE;\r
+\r
+/**\r
+  EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs.\r
+\r
+  @param  InterruptType    Defines the type of interrupt or exception that\r
+                           occurred on the processor.This parameter is processor architecture specific.\r
+  @param  SystemContext    A pointer to the processor context when\r
+                           the interrupt occurred on the processor.\r
+\r
+  @return None\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_CPU_INTERRUPT_HANDLER) (\r
+  IN CONST  EFI_EXCEPTION_TYPE  InterruptType,\r
+  IN CONST  EFI_SYSTEM_CONTEXT  SystemContext\r
+  );\r
+\r
+/**\r
+  This function flushes the range of addresses from Start to Start+Length \r
+  from the processor's data cache. If Start is not aligned to a cache line \r
+  boundary, then the bytes before Start to the preceding cache line boundary \r
+  are also flushed. If Start+Length is not aligned to a cache line boundary, \r
+  then the bytes past Start+Length to the end of the next cache line boundary \r
+  are also flushed. The FlushType of EfiCpuFlushTypeWriteBackInvalidate must be \r
+  supported. If the data cache is fully coherent with all DMA operations, then \r
+  this function can just return EFI_SUCCESS. If the processor does not support \r
+  flushing a range of the data cache, then the entire data cache can be flushed.\r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+  @param  Start            The beginning physical address to flush from the processor's data\r
+                           cache.\r
+  @param  Length           The number of bytes to flush from the processor's data cache. This\r
+                           function may flush more bytes than Length specifies depending upon\r
+                           the granularity of the flush operation that the processor supports.\r
+  @param  FlushType        Specifies the type of flush operation to perform.\r
+\r
+  @retval EFI_SUCCESS           The address range from Start to Start+Length was flushed from\r
+                                the processor's data cache.\r
+  @retval EFI_UNSUPPORTEDT      The processor does not support the cache flush type specified\r
+                                by FlushType.\r
+  @retval EFI_DEVICE_ERROR      The address range from Start to Start+Length could not be flushed\r
+                                from the processor's data cache.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_FLUSH_DATA_CACHE) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This,\r
+  IN EFI_PHYSICAL_ADDRESS               Start,\r
+  IN UINT64                             Length,\r
+  IN EFI_CPU_FLUSH_TYPE                 FlushType\r
+  );\r
+\r
+\r
+/**\r
+  This function enables interrupt processing by the processor. \r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           Interrupts are enabled on the processor.\r
+  @retval EFI_DEVICE_ERROR      Interrupts could not be enabled on the processor.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_ENABLE_INTERRUPT) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This\r
+  );\r
+\r
+\r
+/**\r
+  This function disables interrupt processing by the processor.\r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           Interrupts are disabled on the processor.\r
+  @retval EFI_DEVICE_ERROR      Interrupts could not be disabled on the processor.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_DISABLE_INTERRUPT) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This\r
+  );\r
+\r
+\r
+/**\r
+  This function retrieves the processor's current interrupt state a returns it in \r
+  State. If interrupts are currently enabled, then TRUE is returned. If interrupts \r
+  are currently disabled, then FALSE is returned.\r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+  @param  State            A pointer to the processor's current interrupt state. Set to TRUE if\r
+                           interrupts are enabled and FALSE if interrupts are disabled.\r
+\r
+  @retval EFI_SUCCESS           The processor's current interrupt state was returned in State.\r
+  @retval EFI_INVALID_PARAMETER State is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_GET_INTERRUPT_STATE) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This,\r
+  OUT BOOLEAN                           *State\r
+  );\r
+\r
+\r
+/**\r
+  This function generates an INIT on the processor. If this function succeeds, then the\r
+  processor will be reset, and control will not be returned to the caller. If InitType is \r
+  not supported by this processor, or the processor cannot programmatically generate an \r
+  INIT without help from external hardware, then EFI_UNSUPPORTED is returned. If an error \r
+  occurs attempting to generate an INIT, then EFI_DEVICE_ERROR is returned.\r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+  @param  InitType         The type of processor INIT to perform.\r
+\r
+  @retval EFI_SUCCESS           The processor INIT was performed. This return code should never be seen.\r
+  @retval EFI_UNSUPPORTED       The processor INIT operation specified by InitType is not supported\r
+                                by this processor.\r
+  @retval EFI_DEVICE_ERROR      The processor INIT failed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_INIT) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This,\r
+  IN EFI_CPU_INIT_TYPE                  InitType\r
+  );\r
+\r
+\r
+/**\r
+  This function registers and enables the handler specified by InterruptHandler for a processor \r
+  interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the \r
+  handler for the processor interrupt or exception type specified by InterruptType is uninstalled. \r
+  The installed handler is called once for each processor interrupt or exception.\r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+  @param  InterruptType    A pointer to the processor's current interrupt state. Set to TRUE if interrupts\r
+                           are enabled and FALSE if interrupts are disabled.\r
+  @param  InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
+                           when a processor interrupt occurs. If this parameter is NULL, then the handler\r
+                           will be uninstalled.\r
+\r
+  @retval EFI_SUCCESS           The handler for the processor interrupt was successfully installed or uninstalled.\r
+  @retval EFI_ALREADY_STARTED   InterruptHandler is not NULL, and a handler for InterruptType was\r
+                                previously installed.\r
+  @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not\r
+                                previously installed.\r
+  @retval EFI_UNSUPPORTED       The interrupt specified by InterruptType is not supported.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_REGISTER_INTERRUPT_HANDLER) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This,\r
+  IN EFI_EXCEPTION_TYPE                 InterruptType,\r
+  IN EFI_CPU_INTERRUPT_HANDLER          InterruptHandler\r
+  );\r
+\r
+\r
+/**\r
+  This function reads the processor timer specified by TimerIndex and returns it in TimerValue.\r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+  @param  TimerIndex       Specifies which processor timer is to be returned in TimerValue. This parameter\r
+                           must be between 0 and NumberOfTimers-1.\r
+  @param  TimerValue       Pointer to the returned timer value.\r
+  @param  TimerPeriod      A pointer to the amount of time that passes in femtoseconds for each increment\r
+                           of TimerValue.\r
+\r
+  @retval EFI_SUCCESS           The processor timer value specified by TimerIndex was returned in TimerValue.\r
+  @retval EFI_DEVICE_ERROR      An error occurred attempting to read one of the processor's timers.\r
+  @retval EFI_INVALID_PARAMETER TimerValue is NULL or TimerIndex is not valid.\r
+  @retval EFI_UNSUPPORTED       The processor does not have any readable timers.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_GET_TIMER_VALUE) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This,\r
+  IN UINT32                             TimerIndex,\r
+  OUT UINT64                            *TimerValue,\r
+  OUT UINT64                            *TimerPeriod OPTIONAL\r
+  );\r
+\r
+\r
+/**\r
+  This function modifies the attributes for the memory region specified by BaseAddress and\r
+  Length from their current attributes to the attributes specified by Attributes.\r
+\r
+  @param  This             The EFI_CPU_ARCH_PROTOCOL instance.\r
+  @param  BaseAddress      The physical address that is the start address of a memory region.\r
+  @param  Length           The size in bytes of the memory region.\r
+  @param  Attributes       The bit mask of attributes to set for the memory region.\r
+\r
+  @retval EFI_SUCCESS           The attributes were set for the memory region.\r
+  @retval EFI_ACCESS_DENIED     The attributes for the memory resource range specified by\r
+                                BaseAddress and Length cannot be modified.\r
+  @retval EFI_INVALID_PARAMETER Length is zero.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the attributes of\r
+                                the memory resource range.\r
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory\r
+                                resource range specified by BaseAddress and Length.\r
+                                The bit mask of attributes is not support for the memory resource\r
+                                range specified by BaseAddress and Length.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_CPU_SET_MEMORY_ATTRIBUTES) (\r
+  IN EFI_CPU_ARCH_PROTOCOL              *This,\r
+  IN  EFI_PHYSICAL_ADDRESS              BaseAddress,\r
+  IN  UINT64                            Length,\r
+  IN  UINT64                            Attributes\r
+  );\r
+\r
+\r
+/**\r
+  @par Protocol Description:\r
+  The EFI_CPU_ARCH_PROTOCOL is used to abstract processor-specific functions from the DXE\r
+  Foundation. This includes flushing caches, enabling and disabling interrupts, hooking interrupt\r
+  vectors and exception vectors, reading internal processor timers, resetting the processor, and\r
+  determining the processor frequency.\r
+\r
+  @param FlushDataCache\r
+  Flushes a range of the processor's data cache. If the processor does \r
+  not contain a data cache, or the data cache is fully coherent, then this \r
+  function can just return EFI_SUCCESS. If the processor does not support \r
+  flushing a range of addresses from the data cache, then the entire data \r
+  cache must be flushed. \r
+\r
+  @param EnableInterrupt   \r
+  Enables interrupt processing by the processor.\r
+\r
+  @param DisableInterrupt  \r
+  Disables interrupt processing by the processor.\r
+\r
+  @param GetInterruptState \r
+  Retrieves the processor's current interrupt state.\r
+\r
+  @param Init\r
+  Generates an INIT on the processor. If a processor cannot programmatically \r
+  generate an INIT without help from external hardware, then this function \r
+  returns EFI_UNSUPPORTED.\r
+\r
+  @param RegisterInterruptHandler\r
+  Associates an interrupt service routine with one of the processor's interrupt \r
+  vectors. This function is typically used by the EFI_TIMER_ARCH_PROTOCOL to \r
+  hook the timer interrupt in a system. It can also be used by the debugger to \r
+  hook exception vectors.\r
+\r
+  @param GetTimerValue       \r
+  Returns the value of one of the processor's internal timers.\r
+\r
+  @param SetMemoryAttributes \r
+  Attempts to set the attributes of a memory region.\r
+\r
+  @param NumberOfTimers\r
+  The number of timers that are available in a processor. The value in this \r
+  field is a constant that must not be modified after the CPU Architectural \r
+  Protocol is installed. All consumers must treat this as a read-only field.\r
+\r
+  @param DmaBufferAlignment\r
+  The size, in bytes, of the alignment required for DMA buffer allocations. \r
+  This is typically the size of the largest data cache line in the platform. \r
+  The value in this field is a constant that must not be modified after the \r
+  CPU Architectural Protocol is installed. All consumers must treat this as \r
+  a read-only field.\r
+\r
+**/\r
+struct _EFI_CPU_ARCH_PROTOCOL {\r
+  EFI_CPU_FLUSH_DATA_CACHE            FlushDataCache;\r
+  EFI_CPU_ENABLE_INTERRUPT            EnableInterrupt;\r
+  EFI_CPU_DISABLE_INTERRUPT           DisableInterrupt;\r
+  EFI_CPU_GET_INTERRUPT_STATE         GetInterruptState;\r
+  EFI_CPU_INIT                        Init;\r
+  EFI_CPU_REGISTER_INTERRUPT_HANDLER  RegisterInterruptHandler;\r
+  EFI_CPU_GET_TIMER_VALUE             GetTimerValue;\r
+  EFI_CPU_SET_MEMORY_ATTRIBUTES       SetMemoryAttributes;\r
+  UINT32                              NumberOfTimers;\r
+  UINT32                              DmaBufferAlignment;\r
+};\r
+\r
+extern EFI_GUID gEfiCpuArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DebugPort.h b/MdePkg/Include/Protocol/DebugPort.h
new file mode 100644 (file)
index 0000000..ceffaf6
--- /dev/null
@@ -0,0 +1,141 @@
+/** @file\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DebugPort.h\r
+\r
+**/\r
+\r
+#ifndef __DEBUG_PORT_H__\r
+#define __DEBUG_PORT_H__\r
+\r
+\r
+//\r
+// DebugPortIo protocol {EBA4E8D2-3858-41EC-A281-2647BA9660D0}\r
+//\r
+#define EFI_DEBUGPORT_PROTOCOL_GUID \\r
+  { \\r
+    0xEBA4E8D2, 0x3858, 0x41EC, {0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \\r
+  }\r
+\r
+extern EFI_GUID gEfiDebugPortProtocolGuid;\r
+\r
+typedef struct _EFI_DEBUGPORT_PROTOCOL EFI_DEBUGPORT_PROTOCOL;\r
+\r
+//\r
+// DebugPort member functions\r
+//\r
+\r
+/**                                                                 \r
+  Resets the debugport.\r
+    \r
+  @param  This                  A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
+                                \r
+  @retval EFI_SUCCESS           The debugport device was reset and is in usable state.\r
+  @retval EFI_DEVICE_ERROR      The debugport device could not be reset and is unusable.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DEBUGPORT_RESET) (\r
+  IN EFI_DEBUGPORT_PROTOCOL               *This\r
+  );\r
+\r
+/**                                                                 \r
+  Writes data to the debugport.\r
+    \r
+  @param  This                  A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
+  @param  Timeout               The number of microseconds to wait before timing out a write operation.\r
+  @param  BufferSize            On input, the requested number of bytes of data to write. On output, the\r
+                                number of bytes of data actually written.\r
+  @param  Buffer                A pointer to a buffer containing the data to write.                                \r
+                                  \r
+  @retval EFI_SUCCESS           The data was written.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error.\r
+  @retval EFI_TIMEOUT           The data write was stopped due to a timeout.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DEBUGPORT_WRITE) (\r
+  IN EFI_DEBUGPORT_PROTOCOL               *This,\r
+  IN UINT32                               Timeout,\r
+  IN OUT UINTN                            *BufferSize,\r
+  IN VOID                                 *Buffer\r
+  );\r
+\r
+/**                                                                 \r
+  Reads data from the debugport.\r
+    \r
+  @param  This                  A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
+  @param  Timeout               The number of microseconds to wait before timing out a read operation.\r
+  @param  BufferSize            On input, the requested number of bytes of data to read. On output, the\r
+                                number of bytes of data actually number of bytes\r
+                                of data read and returned in Buffer.\r
+  @param  Buffer                A pointer to a buffer into which the data read will be saved.\r
+                                  \r
+  @retval EFI_SUCCESS           The data was read.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error.\r
+  @retval EFI_TIMEOUT           The operation was stopped due to a timeout or overrun.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DEBUGPORT_READ) (\r
+  IN EFI_DEBUGPORT_PROTOCOL               *This,\r
+  IN UINT32                               Timeout,\r
+  IN OUT UINTN                            *BufferSize,\r
+  OUT VOID                                *Buffer\r
+  );\r
+\r
+/**                                                                 \r
+  Checks to see if any data is available to be read from the debugport device.\r
+    \r
+  @param  This                  A pointer to the EFI_DEBUGPORT_PROTOCOL instance.\r
+                                  \r
+  @retval EFI_SUCCESS           At least one byte of data is available to be read.\r
+  @retval EFI_DEVICE_ERROR      The debugport device is not functioning correctly.\r
+  @retval EFI_NOT_READY         No data is available to be read.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DEBUGPORT_POLL) (\r
+  IN EFI_DEBUGPORT_PROTOCOL               *This\r
+  );\r
+\r
+//\r
+// DebugPort protocol definition\r
+//\r
+struct _EFI_DEBUGPORT_PROTOCOL {\r
+  EFI_DEBUGPORT_RESET Reset;\r
+  EFI_DEBUGPORT_WRITE Write;\r
+  EFI_DEBUGPORT_READ  Read;\r
+  EFI_DEBUGPORT_POLL  Poll;\r
+};\r
+\r
+//\r
+// DEBUGPORT variable definitions...\r
+//\r
+#define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT"\r
+#define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID\r
+#define gEfiDebugPortVariableGuid   gEfiDebugPortProtocolGuid\r
+\r
+//\r
+// DebugPort device path definitions...\r
+//\r
+#define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID\r
+#define gEfiDebugPortDevicePathGuid     gEfiDebugPortProtocolGuid\r
+\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL  Header;\r
+  EFI_GUID                  Guid;\r
+} DEBUGPORT_DEVICE_PATH;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h
new file mode 100644 (file)
index 0000000..5c2c1cf
--- /dev/null
@@ -0,0 +1,660 @@
+/** @file\r
+  DebugSupport protocol and supporting definitions as defined in the UEFI2.0\r
+  specification.\r
+\r
+  The DebugSupport protocol is used by source level debuggers to abstract the\r
+  processor and handle context save and restore operations.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DebugSupport.h\r
+\r
+**/\r
+\r
+#ifndef __DEBUG_SUPPORT_H__\r
+#define __DEBUG_SUPPORT_H__\r
+\r
+#include <IndustryStandard/PeImage.h>\r
+\r
+typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL;\r
+\r
+//\r
+// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25}\r
+//\r
+#define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \\r
+  { \\r
+    0x2755590C, 0x6F3C, 0x42FA, {0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \\r
+  }\r
+\r
+//\r
+// Debug Support definitions\r
+//\r
+typedef INTN  EFI_EXCEPTION_TYPE;\r
+\r
+//\r
+//  IA-32 processor exception types\r
+//\r
+#define EXCEPT_IA32_DIVIDE_ERROR    0\r
+#define EXCEPT_IA32_DEBUG           1\r
+#define EXCEPT_IA32_NMI             2\r
+#define EXCEPT_IA32_BREAKPOINT      3\r
+#define EXCEPT_IA32_OVERFLOW        4\r
+#define EXCEPT_IA32_BOUND           5\r
+#define EXCEPT_IA32_INVALID_OPCODE  6\r
+#define EXCEPT_IA32_DOUBLE_FAULT    8\r
+#define EXCEPT_IA32_INVALID_TSS     10\r
+#define EXCEPT_IA32_SEG_NOT_PRESENT 11\r
+#define EXCEPT_IA32_STACK_FAULT     12\r
+#define EXCEPT_IA32_GP_FAULT        13\r
+#define EXCEPT_IA32_PAGE_FAULT      14\r
+#define EXCEPT_IA32_FP_ERROR        16\r
+#define EXCEPT_IA32_ALIGNMENT_CHECK 17\r
+#define EXCEPT_IA32_MACHINE_CHECK   18\r
+#define EXCEPT_IA32_SIMD            19\r
+\r
+//\r
+//  IA-32 processor context definition\r
+//\r
+//\r
+// FXSAVE_STATE\r
+// FP / MMX / XMM registers (see fxrstor instruction definition)\r
+//\r
+typedef struct {\r
+  UINT16  Fcw;\r
+  UINT16  Fsw;\r
+  UINT16  Ftw;\r
+  UINT16  Opcode;\r
+  UINT32  Eip;\r
+  UINT16  Cs;\r
+  UINT16  Reserved1;\r
+  UINT32  DataOffset;\r
+  UINT16  Ds;\r
+  UINT8   Reserved2[10];\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+  UINT8   St0Mm0[10], Reserved3[6];\r
+  UINT8   St1Mm1[10], Reserved4[6];\r
+  UINT8   St2Mm2[10], Reserved5[6];\r
+  UINT8   St3Mm3[10], Reserved6[6];\r
+  UINT8   St4Mm4[10], Reserved7[6];\r
+  UINT8   St5Mm5[10], Reserved8[6];\r
+  UINT8   St6Mm6[10], Reserved9[6];\r
+  UINT8   St7Mm7[10], Reserved10[6];\r
+  UINT8   Xmm0[16];\r
+  UINT8   Xmm1[16];\r
+  UINT8   Xmm2[16];\r
+  UINT8   Xmm3[16];\r
+  UINT8   Xmm4[16];\r
+  UINT8   Xmm5[16];\r
+  UINT8   Xmm6[16];\r
+  UINT8   Xmm7[16];\r
+  UINT8   Reserved11[14 * 16];\r
+} EFI_FX_SAVE_STATE_IA32;\r
+#else\r
+  UINT8   St0Mm0[10], Reserved3[6];\r
+  UINT8   St0Mm1[10], Reserved4[6];\r
+  UINT8   St0Mm2[10], Reserved5[6];\r
+  UINT8   St0Mm3[10], Reserved6[6];\r
+  UINT8   St0Mm4[10], Reserved7[6];\r
+  UINT8   St0Mm5[10], Reserved8[6];\r
+  UINT8   St0Mm6[10], Reserved9[6];\r
+  UINT8   St0Mm7[10], Reserved10[6];\r
+  UINT8   Reserved11[22 * 16];\r
+} EFI_FX_SAVE_STATE;\r
+#endif\r
+\r
+typedef struct {\r
+  UINT32                 ExceptionData;\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+  EFI_FX_SAVE_STATE_IA32 FxSaveState;\r
+#else\r
+  EFI_FX_SAVE_STATE      FxSaveState;\r
+#endif\r
+  UINT32                 Dr0;\r
+  UINT32                 Dr1;\r
+  UINT32                 Dr2;\r
+  UINT32                 Dr3;\r
+  UINT32                 Dr6;\r
+  UINT32                 Dr7;\r
+  UINT32                 Cr0;\r
+  UINT32                 Cr1;  /* Reserved */\r
+  UINT32                 Cr2;\r
+  UINT32                 Cr3;\r
+  UINT32                 Cr4;\r
+  UINT32                 Eflags;\r
+  UINT32                 Ldtr;\r
+  UINT32                 Tr;\r
+  UINT32                 Gdtr[2];\r
+  UINT32                 Idtr[2];\r
+  UINT32                 Eip;\r
+  UINT32                 Gs;\r
+  UINT32                 Fs;\r
+  UINT32                 Es;\r
+  UINT32                 Ds;\r
+  UINT32                 Cs;\r
+  UINT32                 Ss;\r
+  UINT32                 Edi;\r
+  UINT32                 Esi;\r
+  UINT32                 Ebp;\r
+  UINT32                 Esp;\r
+  UINT32                 Ebx;\r
+  UINT32                 Edx;\r
+  UINT32                 Ecx;\r
+  UINT32                 Eax;\r
+} EFI_SYSTEM_CONTEXT_IA32;\r
+\r
+//\r
+//  X64 processor exception types\r
+//\r
+#define EXCEPT_X64_DIVIDE_ERROR    0\r
+#define EXCEPT_X64_DEBUG           1\r
+#define EXCEPT_X64_NMI             2\r
+#define EXCEPT_X64_BREAKPOINT      3\r
+#define EXCEPT_X64_OVERFLOW        4\r
+#define EXCEPT_X64_BOUND           5\r
+#define EXCEPT_X64_INVALID_OPCODE  6\r
+#define EXCEPT_X64_DOUBLE_FAULT    8\r
+#define EXCEPT_X64_INVALID_TSS     10\r
+#define EXCEPT_X64_SEG_NOT_PRESENT 11\r
+#define EXCEPT_X64_STACK_FAULT     12\r
+#define EXCEPT_X64_GP_FAULT        13\r
+#define EXCEPT_X64_PAGE_FAULT      14\r
+#define EXCEPT_X64_FP_ERROR        16\r
+#define EXCEPT_X64_ALIGNMENT_CHECK 17\r
+#define EXCEPT_X64_MACHINE_CHECK   18\r
+#define EXCEPT_X64_SIMD            19\r
+\r
+//\r
+//  X64 processor context definition\r
+//\r
+// FXSAVE_STATE\r
+// FP / MMX / XMM registers (see fxrstor instruction definition)\r
+//\r
+typedef struct {\r
+  UINT16  Fcw;\r
+  UINT16  Fsw;\r
+  UINT16  Ftw;\r
+  UINT16  Opcode;\r
+  UINT64  Rip;\r
+  UINT64  DataOffset;\r
+  UINT8   Reserved1[8];\r
+  UINT8   St0Mm0[10], Reserved2[6];\r
+  UINT8   St1Mm1[10], Reserved3[6];\r
+  UINT8   St2Mm2[10], Reserved4[6];\r
+  UINT8   St3Mm3[10], Reserved5[6];\r
+  UINT8   St4Mm4[10], Reserved6[6];\r
+  UINT8   St5Mm5[10], Reserved7[6];\r
+  UINT8   St6Mm6[10], Reserved8[6];\r
+  UINT8   St7Mm7[10], Reserved9[6];\r
+  UINT8   Xmm0[16];\r
+  UINT8   Xmm1[16];\r
+  UINT8   Xmm2[16];\r
+  UINT8   Xmm3[16];\r
+  UINT8   Xmm4[16];\r
+  UINT8   Xmm5[16];\r
+  UINT8   Xmm6[16];\r
+  UINT8   Xmm7[16];\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+  //\r
+  // NOTE: UEFI 2.0 spec definition as follows. It should be updated \r
+  // after spec update.\r
+  //\r
+  UINT8   Reserved11[14 * 16];\r
+#else\r
+  UINT8   Xmm8[16];\r
+  UINT8   Xmm9[16];\r
+  UINT8   Xmm10[16];\r
+  UINT8   Xmm11[16];\r
+  UINT8   Xmm12[16];\r
+  UINT8   Xmm13[16];\r
+  UINT8   Xmm14[16];\r
+  UINT8   Xmm15[16];\r
+  UINT8   Reserved10[6 * 16];\r
+#endif\r
+} EFI_FX_SAVE_STATE_X64;\r
+\r
+typedef struct {\r
+  UINT64                ExceptionData;\r
+  EFI_FX_SAVE_STATE_X64 FxSaveState;\r
+  UINT64                Dr0;\r
+  UINT64                Dr1;\r
+  UINT64                Dr2;\r
+  UINT64                Dr3;\r
+  UINT64                Dr6;\r
+  UINT64                Dr7;\r
+  UINT64                Cr0;\r
+  UINT64                Cr1;  /* Reserved */\r
+  UINT64                Cr2;\r
+  UINT64                Cr3;\r
+  UINT64                Cr4;\r
+  UINT64                Cr8;\r
+  UINT64                Rflags;\r
+  UINT64                Ldtr;\r
+  UINT64                Tr;\r
+  UINT64                Gdtr[2];\r
+  UINT64                Idtr[2];\r
+  UINT64                Rip;\r
+  UINT64                Gs;\r
+  UINT64                Fs;\r
+  UINT64                Es;\r
+  UINT64                Ds;\r
+  UINT64                Cs;\r
+  UINT64                Ss;\r
+  UINT64                Rdi;\r
+  UINT64                Rsi;\r
+  UINT64                Rbp;\r
+  UINT64                Rsp;\r
+  UINT64                Rbx;\r
+  UINT64                Rdx;\r
+  UINT64                Rcx;\r
+  UINT64                Rax;\r
+  UINT64                R8;\r
+  UINT64                R9;\r
+  UINT64                R10;\r
+  UINT64                R11;\r
+  UINT64                R12;\r
+  UINT64                R13;\r
+  UINT64                R14;\r
+  UINT64                R15;\r
+} EFI_SYSTEM_CONTEXT_X64;\r
+\r
+//\r
+//  IPF processor exception types\r
+//\r
+#define EXCEPT_IPF_VHTP_TRANSLATION       0\r
+#define EXCEPT_IPF_INSTRUCTION_TLB        1\r
+#define EXCEPT_IPF_DATA_TLB               2\r
+#define EXCEPT_IPF_ALT_INSTRUCTION_TLB    3\r
+#define EXCEPT_IPF_ALT_DATA_TLB           4\r
+#define EXCEPT_IPF_DATA_NESTED_TLB        5\r
+#define EXCEPT_IPF_INSTRUCTION_KEY_MISSED 6\r
+#define EXCEPT_IPF_DATA_KEY_MISSED        7\r
+#define EXCEPT_IPF_DIRTY_BIT              8\r
+#define EXCEPT_IPF_INSTRUCTION_ACCESS_BIT 9\r
+#define EXCEPT_IPF_DATA_ACCESS_BIT        10\r
+#define EXCEPT_IPF_BREAKPOINT             11\r
+#define EXCEPT_IPF_EXTERNAL_INTERRUPT     12\r
+//\r
+// 13 - 19 reserved\r
+//\r
+#define EXCEPT_IPF_PAGE_NOT_PRESENT           20\r
+#define EXCEPT_IPF_KEY_PERMISSION             21\r
+#define EXCEPT_IPF_INSTRUCTION_ACCESS_RIGHTS  22\r
+#define EXCEPT_IPF_DATA_ACCESS_RIGHTS         23\r
+#define EXCEPT_IPF_GENERAL_EXCEPTION          24\r
+#define EXCEPT_IPF_DISABLED_FP_REGISTER       25\r
+#define EXCEPT_IPF_NAT_CONSUMPTION            26\r
+#define EXCEPT_IPF_SPECULATION                27\r
+//\r
+// 28 reserved\r
+//\r
+#define EXCEPT_IPF_DEBUG                          29\r
+#define EXCEPT_IPF_UNALIGNED_REFERENCE            30\r
+#define EXCEPT_IPF_UNSUPPORTED_DATA_REFERENCE     31\r
+#define EXCEPT_IPF_FP_FAULT                       32\r
+#define EXCEPT_IPF_FP_TRAP                        33\r
+#define EXCEPT_IPF_LOWER_PRIVILEGE_TRANSFER_TRAP  34\r
+#define EXCEPT_IPF_TAKEN_BRANCH                   35\r
+#define EXCEPT_IPF_SINGLE_STEP                    36\r
+//\r
+// 37 - 44 reserved\r
+//\r
+#define EXCEPT_IPF_IA32_EXCEPTION 45\r
+#define EXCEPT_IPF_IA32_INTERCEPT 46\r
+#define EXCEPT_IPF_IA32_INTERRUPT 47\r
+\r
+//\r
+//  IPF processor context definition\r
+//\r
+typedef struct {\r
+  //\r
+  // The first reserved field is necessary to preserve alignment for the correct\r
+  // bits in UNAT and to insure F2 is 16 byte aligned..\r
+  //\r
+  UINT64  Reserved;\r
+  UINT64  R1;\r
+  UINT64  R2;\r
+  UINT64  R3;\r
+  UINT64  R4;\r
+  UINT64  R5;\r
+  UINT64  R6;\r
+  UINT64  R7;\r
+  UINT64  R8;\r
+  UINT64  R9;\r
+  UINT64  R10;\r
+  UINT64  R11;\r
+  UINT64  R12;\r
+  UINT64  R13;\r
+  UINT64  R14;\r
+  UINT64  R15;\r
+  UINT64  R16;\r
+  UINT64  R17;\r
+  UINT64  R18;\r
+  UINT64  R19;\r
+  UINT64  R20;\r
+  UINT64  R21;\r
+  UINT64  R22;\r
+  UINT64  R23;\r
+  UINT64  R24;\r
+  UINT64  R25;\r
+  UINT64  R26;\r
+  UINT64  R27;\r
+  UINT64  R28;\r
+  UINT64  R29;\r
+  UINT64  R30;\r
+  UINT64  R31;\r
+\r
+  UINT64  F2[2];\r
+  UINT64  F3[2];\r
+  UINT64  F4[2];\r
+  UINT64  F5[2];\r
+  UINT64  F6[2];\r
+  UINT64  F7[2];\r
+  UINT64  F8[2];\r
+  UINT64  F9[2];\r
+  UINT64  F10[2];\r
+  UINT64  F11[2];\r
+  UINT64  F12[2];\r
+  UINT64  F13[2];\r
+  UINT64  F14[2];\r
+  UINT64  F15[2];\r
+  UINT64  F16[2];\r
+  UINT64  F17[2];\r
+  UINT64  F18[2];\r
+  UINT64  F19[2];\r
+  UINT64  F20[2];\r
+  UINT64  F21[2];\r
+  UINT64  F22[2];\r
+  UINT64  F23[2];\r
+  UINT64  F24[2];\r
+  UINT64  F25[2];\r
+  UINT64  F26[2];\r
+  UINT64  F27[2];\r
+  UINT64  F28[2];\r
+  UINT64  F29[2];\r
+  UINT64  F30[2];\r
+  UINT64  F31[2];\r
+\r
+  UINT64  Pr;\r
+\r
+  UINT64  B0;\r
+  UINT64  B1;\r
+  UINT64  B2;\r
+  UINT64  B3;\r
+  UINT64  B4;\r
+  UINT64  B5;\r
+  UINT64  B6;\r
+  UINT64  B7;\r
+\r
+  //\r
+  // application registers\r
+  //\r
+  UINT64  ArRsc;\r
+  UINT64  ArBsp;\r
+  UINT64  ArBspstore;\r
+  UINT64  ArRnat;\r
+\r
+  UINT64  ArFcr;\r
+\r
+  UINT64  ArEflag;\r
+  UINT64  ArCsd;\r
+  UINT64  ArSsd;\r
+  UINT64  ArCflg;\r
+  UINT64  ArFsr;\r
+  UINT64  ArFir;\r
+  UINT64  ArFdr;\r
+\r
+  UINT64  ArCcv;\r
+\r
+  UINT64  ArUnat;\r
+\r
+  UINT64  ArFpsr;\r
+\r
+  UINT64  ArPfs;\r
+  UINT64  ArLc;\r
+  UINT64  ArEc;\r
+\r
+  //\r
+  // control registers\r
+  //\r
+  UINT64  CrDcr;\r
+  UINT64  CrItm;\r
+  UINT64  CrIva;\r
+  UINT64  CrPta;\r
+  UINT64  CrIpsr;\r
+  UINT64  CrIsr;\r
+  UINT64  CrIip;\r
+  UINT64  CrIfa;\r
+  UINT64  CrItir;\r
+  UINT64  CrIipa;\r
+  UINT64  CrIfs;\r
+  UINT64  CrIim;\r
+  UINT64  CrIha;\r
+\r
+  //\r
+  // debug registers\r
+  //\r
+  UINT64  Dbr0;\r
+  UINT64  Dbr1;\r
+  UINT64  Dbr2;\r
+  UINT64  Dbr3;\r
+  UINT64  Dbr4;\r
+  UINT64  Dbr5;\r
+  UINT64  Dbr6;\r
+  UINT64  Dbr7;\r
+\r
+  UINT64  Ibr0;\r
+  UINT64  Ibr1;\r
+  UINT64  Ibr2;\r
+  UINT64  Ibr3;\r
+  UINT64  Ibr4;\r
+  UINT64  Ibr5;\r
+  UINT64  Ibr6;\r
+  UINT64  Ibr7;\r
+\r
+  //\r
+  // virtual registers - nat bits for R1-R31\r
+  //\r
+  UINT64  IntNat;\r
+\r
+} EFI_SYSTEM_CONTEXT_IPF;\r
+\r
+//\r
+//  EBC processor exception types\r
+//\r
+#define EXCEPT_EBC_UNDEFINED            0\r
+#define EXCEPT_EBC_DIVIDE_ERROR         1\r
+#define EXCEPT_EBC_DEBUG                2\r
+#define EXCEPT_EBC_BREAKPOINT           3\r
+#define EXCEPT_EBC_OVERFLOW             4\r
+#define EXCEPT_EBC_INVALID_OPCODE       5   // opcode out of range\r
+#define EXCEPT_EBC_STACK_FAULT          6\r
+#define EXCEPT_EBC_ALIGNMENT_CHECK      7\r
+#define EXCEPT_EBC_INSTRUCTION_ENCODING 8   // malformed instruction\r
+#define EXCEPT_EBC_BAD_BREAK            9   // BREAK 0 or undefined BREAK\r
+#define EXCEPT_EBC_STEP                 10  // to support debug stepping\r
+//\r
+// For coding convenience, define the maximum valid EBC exception.\r
+//\r
+#define MAX_EBC_EXCEPTION EXCEPT_EBC_STEP\r
+\r
+//\r
+//  EBC processor context definition\r
+//\r
+typedef struct {\r
+  UINT64  R0;\r
+  UINT64  R1;\r
+  UINT64  R2;\r
+  UINT64  R3;\r
+  UINT64  R4;\r
+  UINT64  R5;\r
+  UINT64  R6;\r
+  UINT64  R7;\r
+  UINT64  Flags;\r
+  UINT64  ControlFlags;\r
+  UINT64  Ip;\r
+} EFI_SYSTEM_CONTEXT_EBC;\r
+\r
+//\r
+// Universal EFI_SYSTEM_CONTEXT definition\r
+//\r
+typedef union {\r
+  EFI_SYSTEM_CONTEXT_EBC  *SystemContextEbc;\r
+  EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;\r
+  EFI_SYSTEM_CONTEXT_X64  *SystemContextX64;\r
+  EFI_SYSTEM_CONTEXT_IPF  *SystemContextIpf;\r
+} EFI_SYSTEM_CONTEXT;\r
+\r
+//\r
+// DebugSupport callback function prototypes\r
+//\r
+\r
+/**                                                                 \r
+  Registers and enables an exception callback function for the specified exception.\r
+    \r
+  @param  ExceptionType         Exception types in EBC, IA-32, X64, or IPF\r
+  @param  SystemContext         Exception content.\r
+                                   \r
+**/\r
+typedef\r
+VOID\r
+(*EFI_EXCEPTION_CALLBACK) (\r
+  IN     EFI_EXCEPTION_TYPE               ExceptionType,\r
+  IN OUT EFI_SYSTEM_CONTEXT               SystemContext\r
+  );\r
+\r
+/**                                                                 \r
+  Registers and enables the on-target debug agent's periodic entry point.\r
+      \r
+  @param  SystemContext         Exception content.\r
+                                   \r
+**/\r
+typedef\r
+VOID\r
+(*EFI_PERIODIC_CALLBACK) (\r
+  IN OUT EFI_SYSTEM_CONTEXT               SystemContext\r
+  );\r
+\r
+//\r
+// Machine type definition\r
+//\r
+typedef enum {\r
+  IsaIa32 = IMAGE_FILE_MACHINE_I386, // 0x014C\r
+  IsaX64  = IMAGE_FILE_MACHINE_X64,   // 0x8664\r
+  IsaIpf  = IMAGE_FILE_MACHINE_IA64,  // 0x0200\r
+  IsaEbc  = IMAGE_FILE_MACHINE_EBC    // 0x0EBC\r
+} EFI_INSTRUCTION_SET_ARCHITECTURE;\r
+\r
+\r
+//\r
+// DebugSupport member function definitions\r
+//\r
+\r
+/**                                                                 \r
+  Returns the maximum value that may be used for the ProcessorIndex parameter in\r
+  RegisterPeriodicCallback() and RegisterExceptionCallback().                   \r
+    \r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.\r
+  @param  MaxProcessorIndex     Pointer to a caller-allocated UINTN in which the maximum supported\r
+                                processor index is returned.                                      \r
+                                \r
+  @retval EFI_SUCCESS           The function completed successfully.  \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_MAXIMUM_PROCESSOR_INDEX) (\r
+  IN EFI_DEBUG_SUPPORT_PROTOCOL          *This,\r
+  OUT UINTN                              *MaxProcessorIndex\r
+  );\r
+\r
+/**                                                                 \r
+  Registers a function to be called back periodically in interrupt context.\r
+    \r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function applies to.\r
+  @param  PeriodicCallback      A pointer to a function of type PERIODIC_CALLBACK that is the main\r
+                                periodic entry point of the debug agent.\r
+                                \r
+  @retval EFI_SUCCESS           The function completed successfully.  \r
+  @retval EFI_ALREADY_STARTED   Non-NULL PeriodicCallback parameter when a callback\r
+                                function was previously registered.                \r
+  @retval EFI_OUT_OF_RESOURCES  System has insufficient memory resources to register new callback                               \r
+                                function.                                                           \r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_REGISTER_PERIODIC_CALLBACK) (\r
+  IN EFI_DEBUG_SUPPORT_PROTOCOL          *This,\r
+  IN UINTN                               ProcessorIndex,\r
+  IN EFI_PERIODIC_CALLBACK               PeriodicCallback\r
+  );\r
+\r
+/**                                                                 \r
+  Registers a function to be called when a given processor exception occurs.\r
+    \r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.\r
+  @param  ProcessorIndex        Specifies which processor the callback function applies to.\r
+  @param  PeriodicCallback      A pointer to a function of type EXCEPTION_CALLBACK that is called\r
+                                when the processor exception specified by ExceptionType occurs.  \r
+  @param  ExceptionType         Specifies which processor exception to hook.                       \r
+                                \r
+  @retval EFI_SUCCESS           The function completed successfully.  \r
+  @retval EFI_ALREADY_STARTED   Non-NULL PeriodicCallback parameter when a callback\r
+                                function was previously registered.                \r
+  @retval EFI_OUT_OF_RESOURCES  System has insufficient memory resources to register new callback                               \r
+                                function.                                                           \r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_REGISTER_EXCEPTION_CALLBACK) (\r
+  IN EFI_DEBUG_SUPPORT_PROTOCOL          *This,\r
+  IN UINTN                               ProcessorIndex,\r
+  IN EFI_EXCEPTION_CALLBACK              ExceptionCallback,\r
+  IN EFI_EXCEPTION_TYPE                  ExceptionType\r
+  );\r
+\r
+/**                                                                 \r
+  Invalidates processor instruction cache for a memory range. Subsequent execution in this range\r
+  causes a fresh memory fetch to retrieve code to be executed.                                  \r
+    \r
+  @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.\r
+  @param  ProcessorIndex        Specifies which processor's instruction cache is to be invalidated.\r
+  @param  Start                 Specifies the physical base of the memory range to be invalidated.                                \r
+  @param  Length                Specifies the minimum number of bytes in the processor's instruction\r
+                                cache to invalidate.                                                 \r
+                                \r
+  @retval EFI_SUCCESS           The function completed successfully.  \r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INVALIDATE_INSTRUCTION_CACHE) (\r
+  IN EFI_DEBUG_SUPPORT_PROTOCOL          *This,\r
+  IN UINTN                               ProcessorIndex,\r
+  IN VOID                                *Start,\r
+  IN UINT64                              Length\r
+  );\r
+\r
+//\r
+// DebugSupport protocol definition\r
+//\r
+struct _EFI_DEBUG_SUPPORT_PROTOCOL {\r
+  EFI_INSTRUCTION_SET_ARCHITECTURE  Isa;\r
+  EFI_GET_MAXIMUM_PROCESSOR_INDEX   GetMaximumProcessorIndex;\r
+  EFI_REGISTER_PERIODIC_CALLBACK    RegisterPeriodicCallback;\r
+  EFI_REGISTER_EXCEPTION_CALLBACK   RegisterExceptionCallback;\r
+  EFI_INVALIDATE_INSTRUCTION_CACHE  InvalidateInstructionCache;\r
+};\r
+\r
+extern EFI_GUID gEfiDebugSupportProtocolGuid;\r
+\r
+#endif \r
diff --git a/MdePkg/Include/Protocol/Decompress.h b/MdePkg/Include/Protocol/Decompress.h
new file mode 100644 (file)
index 0000000..7c295f3
--- /dev/null
@@ -0,0 +1,121 @@
+/** @file\r
+  The Decompress Protocol Interface\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Decompress.h\r
+\r
+**/\r
+\r
+#ifndef __DECOMPRESS_H__\r
+#define __DECOMPRESS_H__\r
+\r
+#define EFI_DECOMPRESS_PROTOCOL_GUID \\r
+  { \\r
+    0xd8117cfe, 0x94a6, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_DECOMPRESS_PROTOCOL  EFI_DECOMPRESS_PROTOCOL;\r
+\r
+/**\r
+  The GetInfo() function retrieves the size of the uncompressed buffer \r
+  and the temporary scratch buffer required to decompress the buffer \r
+  specified by Source and SourceSize.  If the size of the uncompressed\r
+  buffer or the size of the scratch buffer cannot be determined from \r
+  the compressed data specified by Source and SourceData, then \r
+  EFI_INVALID_PARAMETER is returned.  Otherwise, the size of the uncompressed\r
+  buffer is returned in DestinationSize, the size of the scratch buffer is \r
+  returned in ScratchSize, and EFI_SUCCESS is returned.\r
+\r
+  The GetInfo() function does not have scratch buffer available to perform \r
+  a thorough checking of the validity of the source data. It just retrieves\r
+  the 'Original Size' field from the beginning bytes of the source data and\r
+  output it as DestinationSize.  And ScratchSize is specific to the decompression\r
+  implementation.\r
+\r
+  @param  This            The protocol instance pointer\r
+  @param  Source          The source buffer containing the compressed data.\r
+  @param  SourceSize      The size, in bytes, of source buffer.\r
+  @param  DestinationSize A pointer to the size, in bytes, of the uncompressed buffer\r
+                          that will be generated when the compressed buffer specified\r
+                          by Source and SourceSize is decompressed.\r
+  @param  ScratchSize     A pointer to the size, in bytes, of the scratch buffer that\r
+                          is required to decompress the compressed buffer specified by\r
+                          Source and SourceSize.\r
+\r
+  @retval  EFI_SUCCESS           The size of the uncompressed data was returned in DestinationSize\r
+                                 and the size of the scratch buffer was returned in ScratchSize.\r
+  @retval  EFI_INVALID_PARAMETER The size of the uncompressed data or the size of the scratch\r
+                                 buffer cannot be determined from the compressed data specified by\r
+                                 Source and SourceData.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DECOMPRESS_GET_INFO) (\r
+  IN EFI_DECOMPRESS_PROTOCOL            *This,\r
+  IN   VOID                             *Source,\r
+  IN   UINT32                           SourceSize,\r
+  OUT  UINT32                           *DestinationSize,\r
+  OUT  UINT32                           *ScratchSize\r
+  );\r
+\r
+/**\r
+  The Decompress() function extracts decompressed data to its original form.\r
+\r
+  This protocol is designed so that the decompression algorithm can be \r
+  implemented without using any memory services.  As a result, the \r
+  Decompress() function is not allowed to call AllocatePool() or \r
+  AllocatePages() in its implementation.  It is the caller's responsibility \r
+  to allocate and free the Destination and Scratch buffers.\r
+\r
+  If the compressed source data specified by Source and SourceSize is \r
+  sucessfully decompressed into Destination, then EFI_SUCCESS is returned.  \r
+  If the compressed source data specified by Source and SourceSize is not in \r
+  a valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
+\r
+  @param  This            The protocol instance pointer\r
+  @param  Source          The source buffer containing the compressed data.\r
+  @param  SourceSize      The size of source data.\r
+  @param  Destination     On output, the destination buffer that contains\r
+                          the uncompressed data.\r
+  @param  DestinationSize The size of destination buffer. The size of destination\r
+                          buffer needed is obtained from GetInfo().\r
+  @param  Scratch         A temporary scratch buffer that is used to perform the\r
+                          decompression.          \r
+  @param  ScratchSize     The size of scratch buffer. The size of scratch buffer needed\r
+                          is obtained from GetInfo().\r
+\r
+  @retval  EFI_SUCCESS          Decompression completed successfully, and the uncompressed\r
+                                buffer is returned in Destination.\r
+  @retval EFI_INVALID_PARAMETER The source buffer specified by Source and SourceSize is\r
+                                corrupted (not in a valid compressed format).\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DECOMPRESS_DECOMPRESS) (\r
+  IN EFI_DECOMPRESS_PROTOCOL              *This,\r
+  IN     VOID                             *Source,\r
+  IN     UINT32                           SourceSize,\r
+  IN OUT VOID                             *Destination,\r
+  IN     UINT32                           DestinationSize,\r
+  IN OUT VOID                             *Scratch,\r
+  IN     UINT32                           ScratchSize\r
+  );\r
+\r
+struct _EFI_DECOMPRESS_PROTOCOL {\r
+  EFI_DECOMPRESS_GET_INFO   GetInfo;\r
+  EFI_DECOMPRESS_DECOMPRESS Decompress;\r
+};\r
+\r
+extern EFI_GUID gEfiDecompressProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DeviceIo.h b/MdePkg/Include/Protocol/DeviceIo.h
new file mode 100644 (file)
index 0000000..643c810
--- /dev/null
@@ -0,0 +1,222 @@
+/** @file\r
+  Device IO protocol as defined in the EFI 1.0 specification.\r
+\r
+  Device IO is used to abstract hardware access to devices. It includes\r
+  memory mapped IO, IO, PCI Config space, and DMA.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DeviceIo.h\r
+\r
+**/\r
+\r
+#ifndef __DEVICE_IO_H__\r
+#define __DEVICE_IO_H__\r
+\r
+#define EFI_DEVICE_IO_PROTOCOL_GUID \\r
+  { \\r
+    0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+typedef struct _EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL;\r
+\r
+typedef enum {\r
+  IO_UINT8,\r
+  IO_UINT16,\r
+  IO_UINT32,\r
+  IO_UINT64,\r
+  MMIO_COPY_UINT8,\r
+  MMIO_COPY_UINT16,\r
+  MMIO_COPY_UINT32,\r
+  MMIO_COPY_UINT64\r
+} EFI_IO_WIDTH;\r
+\r
+/**                                                                 \r
+  Enables a driver to access device registers in the appropriate memory or I/O space.\r
+    \r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
+  @param  Width                 Signifies the width of the I/O operations.                                                                   \r
+  @param  Address               The base address of the I/O operations. \r
+  @param  Count                 The number of I/O operations to perform.\r
+  @param  Buffer                For read operations, the destination buffer to store the results. For write\r
+                                operations, the source buffer to write data from.                \r
+\r
+  @retval EFI_SUCCESS           The data was read from or written to the device.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.      \r
+  @retval EFI_INVALID_PARAMETER Width is invalid.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DEVICE_IO) (\r
+  IN EFI_DEVICE_IO_PROTOCOL         *This,\r
+  IN EFI_IO_WIDTH                   Width,\r
+  IN UINT64                         Address,\r
+  IN UINTN                          Count,\r
+  IN OUT VOID                       *Buffer\r
+  );\r
+\r
+typedef struct {\r
+  EFI_DEVICE_IO Read;\r
+  EFI_DEVICE_IO Write;\r
+} EFI_IO_ACCESS;\r
+\r
+/**                                                                 \r
+  Provides an EFI Device Path for a PCI device with the given PCI configuration space address.\r
+    \r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
+  @param  PciAddress            The PCI configuration space address of the device whose Device Path\r
+                                is going to be returned.  \r
+  @param  PciDevicePath         A pointer to the pointer for the EFI Device Path for PciAddress.\r
+                                Memory for the Device Path is allocated from the pool.          \r
+\r
+  @retval EFI_SUCCESS           The PciDevicePath returns a pointer to a valid EFI Device Path.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.      \r
+  @retval EFI_UNSUPPORTED       The PciAddress does not map to a valid EFI Device Path.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_DEVICE_PATH) (\r
+  IN EFI_DEVICE_IO_PROTOCOL           *This,\r
+  IN UINT64                           PciAddress,\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL     **PciDevicePath\r
+  );\r
+\r
+typedef enum {\r
+  EfiBusMasterRead,\r
+  EfiBusMasterWrite,\r
+  EfiBusMasterCommonBuffer\r
+} EFI_IO_OPERATION_TYPE;\r
+\r
+/**                                                                 \r
+  Provides the device-specific addresses needed to access system memory.\r
+    \r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
+  @param  Operation             Indicates if the bus master is going to read or write to system memory.\r
+  @param  HostAddress           The system memory address to map to the device.\r
+  @param  NumberOfBytes         On input the number of bytes to map.\r
+  @param  DeviceAddress         The resulting map address for the bus master device to use to access the\r
+                                hosts HostAddress.\r
+  @param  Mapping               A resulting value to pass to Unmap().\r
+\r
+  @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.      \r
+  @retval EFI_UNSUPPORTED       The HostAddress cannot be mapped as a common buffer.\r
+  @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.\r
+  @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IO_MAP) (\r
+  IN EFI_DEVICE_IO_PROTOCOL           *This,\r
+  IN EFI_IO_OPERATION_TYPE            Operation,\r
+  IN EFI_PHYSICAL_ADDRESS             *HostAddress,\r
+  IN OUT UINTN                        *NumberOfBytes,\r
+  OUT EFI_PHYSICAL_ADDRESS            *DeviceAddress,\r
+  OUT VOID                            **Mapping\r
+  );\r
+\r
+/**                                                                 \r
+  Completes the Map() operation and releases any corresponding resources.\r
+    \r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
+  @param  Mapping               A resulting value to pass to Unmap().\r
+\r
+  @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.\r
+  @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IO_UNMAP) (\r
+  IN EFI_DEVICE_IO_PROTOCOL           *This,\r
+  IN VOID                             *Mapping\r
+  );\r
+\r
+/**                                                                 \r
+  Allocates pages that are suitable for an EFIBusMasterCommonBuffer mapping.\r
+    \r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
+  @param  Type                  The type allocation to perform.\r
+  @param  MemoryType            The type of memory to allocate, EfiBootServicesData or\r
+                                EfiRuntimeServicesData.\r
+  @param  Pages                 The number of pages to allocate.\r
+  @param  HostAddress           A pointer to store the base address of the allocated range.                                \r
+\r
+  @retval EFI_SUCCESS           The requested memory pages were allocated.\r
+  @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.\r
+  @retval EFI_INVALID_PARAMETER The requested memory type is invalid.\r
+  @retval EFI_UNSUPPORTED       The requested HostAddress is not supported on\r
+                                this platform.                               \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IO_ALLOCATE_BUFFER) (\r
+  IN EFI_DEVICE_IO_PROTOCOL           *This,\r
+  IN EFI_ALLOCATE_TYPE                Type,\r
+  IN EFI_MEMORY_TYPE                  MemoryType,\r
+  IN UINTN                            Pages,\r
+  IN OUT EFI_PHYSICAL_ADDRESS         *HostAddress\r
+  );\r
+\r
+/**                                                                 \r
+  Flushes any posted write data to the device.\r
+    \r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.\r
+\r
+  @retval EFI_SUCCESS           The buffers were flushed.\r
+  @retval EFI_DEVICE_ERROR      The buffers were not flushed due to a hardware error.                                 \r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IO_FLUSH) (\r
+  IN EFI_DEVICE_IO_PROTOCOL  *This\r
+  );\r
+\r
+/**                                                                 \r
+  Frees pages that were allocated with AllocateBuffer().\r
+    \r
+  @param  This                  A pointer to the EFI_DEVICE_IO_INTERFACE instance.  \r
+  @param  Pages                 The number of pages to free.\r
+  @param  HostAddress           The base address of the range to free.\r
+\r
+  @retval EFI_SUCCESS           The requested memory pages were allocated.\r
+  @retval EFI_NOT_FOUND         The requested memory pages were not allocated with\r
+                                AllocateBuffer().  \r
+  @retval EFI_INVALID_PARAMETER HostAddress is not page aligned or Pages is invalid.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IO_FREE_BUFFER) (\r
+  IN EFI_DEVICE_IO_PROTOCOL           *This,\r
+  IN UINTN                            Pages,\r
+  IN EFI_PHYSICAL_ADDRESS             HostAddress\r
+  );\r
+\r
+struct _EFI_DEVICE_IO_PROTOCOL {\r
+  EFI_IO_ACCESS           Mem;\r
+  EFI_IO_ACCESS           Io;\r
+  EFI_IO_ACCESS           Pci;\r
+  EFI_IO_MAP              Map;\r
+  EFI_PCI_DEVICE_PATH     PciDevicePath;\r
+  EFI_IO_UNMAP            Unmap;\r
+  EFI_IO_ALLOCATE_BUFFER  AllocateBuffer;\r
+  EFI_IO_FLUSH            Flush;\r
+  EFI_IO_FREE_BUFFER      FreeBuffer;\r
+};\r
+\r
+extern EFI_GUID gEfiDeviceIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DevicePath.h b/MdePkg/Include/Protocol/DevicePath.h
new file mode 100644 (file)
index 0000000..6ff0050
--- /dev/null
@@ -0,0 +1,529 @@
+/** @file\r
+  The device path protocol as defined in EFI 1.0.\r
+\r
+  The device path represents a programatic path to a device. It's the view\r
+  from a software point of view. It also must persist from boot to boot, so \r
+  it can not contain things like PCI bus numbers that change from boot to boot.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DevicePath.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_DEVICE_PATH_PROTOCOL_H__\r
+#define __EFI_DEVICE_PATH_PROTOCOL_H__\r
+\r
+//\r
+// Device Path protocol\r
+//\r
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \\r
+  { \\r
+    0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+//\r
+// Device Path information\r
+//\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+  UINT8 Type;\r
+  UINT8 SubType;\r
+  UINT8 Length[2];\r
+} EFI_DEVICE_PATH_PROTOCOL;\r
+\r
+//\r
+// Hardware Device Paths\r
+//\r
+#define HARDWARE_DEVICE_PATH      0x01\r
+\r
+#define HW_PCI_DP                 0x01\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT8                           Function;\r
+  UINT8                           Device;\r
+} PCI_DEVICE_PATH;\r
+\r
+#define HW_PCCARD_DP              0x02\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT8                           FunctionNumber;\r
+} PCCARD_DEVICE_PATH;\r
+\r
+#define HW_MEMMAP_DP              0x03\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          MemoryType;\r
+  EFI_PHYSICAL_ADDRESS            StartingAddress;\r
+  EFI_PHYSICAL_ADDRESS            EndingAddress;\r
+} MEMMAP_DEVICE_PATH;\r
+\r
+#define HW_VENDOR_DP              0x04\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  EFI_GUID                        Guid;\r
+} VENDOR_DEVICE_PATH;\r
+\r
+#define HW_CONTROLLER_DP          0x05\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          ControllerNumber;\r
+} CONTROLLER_DEVICE_PATH;\r
+\r
+//\r
+// ACPI Device Paths\r
+//\r
+#define ACPI_DEVICE_PATH          0x02\r
+\r
+#define ACPI_DP                   0x01\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          HID;\r
+  UINT32                          UID;\r
+} ACPI_HID_DEVICE_PATH;\r
+\r
+#define ACPI_EXTENDED_DP          0x02\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          HID;\r
+  UINT32                          UID;\r
+  UINT32                          CID;\r
+  //\r
+  // Optional variable length _HIDSTR\r
+  // Optional variable length _UIDSTR\r
+  //\r
+} ACPI_EXTENDED_HID_DEVICE_PATH;\r
+\r
+//\r
+//  EISA ID Macro\r
+//  EISA ID Definition 32-bits\r
+//   bits[15:0] - three character compressed ASCII EISA ID.\r
+//   bits[31:16] - binary number\r
+//    Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'\r
+//\r
+#define PNP_EISA_ID_CONST         0x41d0\r
+#define EISA_ID(_Name, _Num)      ((UINT32) ((_Name) | (_Num) << 16))\r
+#define EISA_PNP_ID(_PNPId)       (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
+#define EFI_PNP_ID(_PNPId)        (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
+\r
+#define PNP_EISA_ID_MASK          0xffff\r
+#define EISA_ID_TO_NUM(_Id)       ((_Id) >> 16)\r
+\r
+\r
+#define ACPI_ADR_DP               0x03\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          ADR;\r
+} ACPI_ADR_DEVICE_PATH;\r
+\r
+\r
+//\r
+// Messaging Device Paths\r
+//\r
+#define MESSAGING_DEVICE_PATH     0x03\r
+\r
+#define MSG_ATAPI_DP              0x01\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT8                           PrimarySecondary;\r
+  UINT8                           SlaveMaster;\r
+  UINT16                          Lun;\r
+} ATAPI_DEVICE_PATH;\r
+\r
+#define MSG_SCSI_DP               0x02\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT16                          Pun;\r
+  UINT16                          Lun;\r
+} SCSI_DEVICE_PATH;\r
+\r
+#define MSG_FIBRECHANNEL_DP       0x03\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          Reserved;\r
+  UINT64                          WWN;\r
+  UINT64                          Lun;\r
+} FIBRECHANNEL_DEVICE_PATH;\r
+\r
+#define MSG_1394_DP               0x04\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          Reserved;\r
+  UINT64                          Guid;\r
+} F1394_DEVICE_PATH;\r
+\r
+#define MSG_USB_DP                0x05\r
+typedef struct {\r
+    EFI_DEVICE_PATH_PROTOCOL      Header;\r
+    UINT8                         ParentPortNumber;\r
+    UINT8                         InterfaceNumber;\r
+} USB_DEVICE_PATH;\r
+\r
+#define MSG_USB_CLASS_DP          0x0f\r
+typedef struct {\r
+    EFI_DEVICE_PATH_PROTOCOL      Header;\r
+    UINT16                        VendorId;\r
+    UINT16                        ProductId;\r
+    UINT8                         DeviceClass;\r
+    UINT8                         DeviceSubClass;\r
+    UINT8                         DeviceProtocol;\r
+} USB_CLASS_DEVICE_PATH;\r
+\r
+#define MSG_USB_WWID_DP           0x10\r
+typedef struct {\r
+    EFI_DEVICE_PATH_PROTOCOL      Header;\r
+    UINT16                        InterfaceNumber;\r
+    UINT16                        VendorId;\r
+    UINT16                        ProductId;\r
+    // CHAR16                     SerialNumber[...];\r
+} USB_WWID_DEVICE_PATH;\r
+\r
+\r
+#define MSG_DEVICE_LOGICAL_UNIT_DP  0x11\r
+typedef struct {\r
+    EFI_DEVICE_PATH_PROTOCOL      Header;\r
+    UINT8                         Lun;\r
+} DEVICE_LOGICAL_UNIT_DEVICE_PATH;\r
+\r
+#define MSG_SATA_DP               0x12\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT16                          HbaPortNumber;\r
+  UINT16                          PortMultiplierPort;\r
+  UINT16                          LogicalUnitNumber;\r
+} SATA_DEVICE_PATH;\r
+\r
+#define MSG_I2O_DP                0x06\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          Tid;\r
+} I2O_DEVICE_PATH;\r
+\r
+#define MSG_MAC_ADDR_DP           0x0b\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  EFI_MAC_ADDRESS                 MacAddress;\r
+  UINT8                           IfType;\r
+} MAC_ADDR_DEVICE_PATH;\r
+\r
+#define MSG_IPv4_DP               0x0c\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  EFI_IPv4_ADDRESS                LocalIpAddress;\r
+  EFI_IPv4_ADDRESS                RemoteIpAddress;\r
+  UINT16                          LocalPort;\r
+  UINT16                          RemotePort;\r
+  UINT16                          Protocol;\r
+  BOOLEAN                         StaticIpAddress;\r
+} IPv4_DEVICE_PATH;\r
+\r
+#define MSG_IPv6_DP               0x0d\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  EFI_IPv6_ADDRESS                LocalIpAddress;\r
+  EFI_IPv6_ADDRESS                RemoteIpAddress;\r
+  UINT16                          LocalPort;\r
+  UINT16                          RemotePort;\r
+  UINT16                          Protocol;\r
+  BOOLEAN                         StaticIpAddress;\r
+} IPv6_DEVICE_PATH;\r
+\r
+#define MSG_INFINIBAND_DP         0x09\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          ResourceFlags;\r
+  UINT8                           PortGid[16];\r
+  UINT64                          ServiceId;\r
+  UINT64                          TargetPortId;\r
+  UINT64                          DeviceId;\r
+} INFINIBAND_DEVICE_PATH;\r
+\r
+#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE                0x01\r
+#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT  0x02\r
+#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL           0x04\r
+#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL           0x08\r
+#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL           0x10\r
+\r
+#define MSG_UART_DP               0x0e\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          Reserved;\r
+  UINT64                          BaudRate;\r
+  UINT8                           DataBits;\r
+  UINT8                           Parity;\r
+  UINT8                           StopBits;\r
+} UART_DEVICE_PATH;\r
+\r
+//\r
+// Use VENDOR_DEVICE_PATH struct\r
+//\r
+#define MSG_VENDOR_DP             0x0a\r
+typedef VENDOR_DEVICE_PATH        VENDOR_DEFINED_DEVICE_PATH;\r
+\r
+#define DEVICE_PATH_MESSAGING_PC_ANSI     EFI_PC_ANSI_GUID\r
+#define DEVICE_PATH_MESSAGING_VT_100      EFI_VT_100_GUID\r
+#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID\r
+#define DEVICE_PATH_MESSAGING_VT_UTF8     EFI_VT_UTF8_GUID\r
+\r
+#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL   EFI_UART_DEVICE_PATH_GUID\r
+\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  EFI_GUID                        Guid;\r
+  UINT32                          FlowControlMap;\r
+} UART_FLOW_CONTROL_DEVICE_PATH;\r
+\r
+#define DEVICE_PATH_MESSAGING_SAS                 EFI_SAS_DEVICE_PATH_GUID\r
+\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  EFI_GUID                        Guid;\r
+  UINT32                          Reserved;\r
+  UINT64                          SasAddress;\r
+  UINT64                          Lun;\r
+  UINT16                          DeviceTopology;\r
+  UINT16                          RelativeTargetPort;\r
+} SAS_DEVICE_PATH;\r
+\r
+#define MSG_ISCSI_DP              0x13\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT16                          NetworkProtocol;\r
+  UINT16                          LoginOption;\r
+  UINT16                          Reserved;\r
+  UINT16                          TargetPortalGroupTag;\r
+  UINT64                          LUN;\r
+  // CHAR8                        iSCSI Target Name\r
+} ISCSI_DEVICE_PATH;\r
+\r
+#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST             0x0000\r
+#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C   0x0002\r
+#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST               0x0000\r
+#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C     0x0008\r
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP              0x0000\r
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON               0x1000\r
+#define ISCSI_LOGIN_OPTION_CHAP_BI                      0x0000\r
+#define ISCSI_LOGIN_OPTION_CHAP_UNI                     0x2000\r
+\r
+//\r
+// Media Device Path\r
+//\r
+#define MEDIA_DEVICE_PATH         0x04\r
+\r
+#define MEDIA_HARDDRIVE_DP        0x01\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          PartitionNumber;\r
+  UINT64                          PartitionStart;\r
+  UINT64                          PartitionSize;\r
+  UINT8                           Signature[16];\r
+  UINT8                           MBRType;\r
+  UINT8                           SignatureType;\r
+} HARDDRIVE_DEVICE_PATH;\r
+\r
+#define MBR_TYPE_PCAT             0x01\r
+#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02\r
+\r
+#define SIGNATURE_TYPE_MBR        0x01\r
+#define SIGNATURE_TYPE_GUID       0x02\r
+\r
+#define MEDIA_CDROM_DP            0x02\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT32                          BootEntry;\r
+  UINT64                          PartitionStart;\r
+  UINT64                          PartitionSize;\r
+} CDROM_DEVICE_PATH;\r
+\r
+//\r
+// Use VENDOR_DEVICE_PATH struct\r
+//\r
+#define MEDIA_VENDOR_DP           0x03\r
+\r
+#define MEDIA_FILEPATH_DP         0x04\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  CHAR16                          PathName[1];\r
+} FILEPATH_DEVICE_PATH;\r
+\r
+#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)\r
+\r
+#define MEDIA_PROTOCOL_DP         0x05\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  EFI_GUID                        Protocol;\r
+} MEDIA_PROTOCOL_DEVICE_PATH;\r
+\r
+\r
+#define MEDIA_PIWG_FW_VOL_DP      0x6\r
+typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;\r
+\r
+\r
+#define MEDIA_PIWG_FW_FILE_DP     0x7\r
+typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_DEVICE_PATH;\r
+\r
+//\r
+// BBS Device Path\r
+//\r
+#define BBS_DEVICE_PATH           0x05\r
+#define BBS_BBS_DP                0x01\r
+typedef struct {\r
+  EFI_DEVICE_PATH_PROTOCOL        Header;\r
+  UINT16                          DeviceType;\r
+  UINT16                          StatusFlag;\r
+  CHAR8                           String[1];\r
+} BBS_BBS_DEVICE_PATH;\r
+\r
+//\r
+// DeviceType definitions - from BBS specification\r
+//\r
+#define BBS_TYPE_FLOPPY           0x01\r
+#define BBS_TYPE_HARDDRIVE        0x02\r
+#define BBS_TYPE_CDROM            0x03\r
+#define BBS_TYPE_PCMCIA           0x04\r
+#define BBS_TYPE_USB              0x05\r
+#define BBS_TYPE_EMBEDDED_NETWORK 0x06\r
+#define BBS_TYPE_BEV              0x80\r
+#define BBS_TYPE_UNKNOWN          0xFF\r
+\r
+\r
+//\r
+// Union of all possible Device Paths and pointers to Device Paths\r
+//\r
+\r
+typedef union {\r
+  EFI_DEVICE_PATH_PROTOCOL             DevPath;\r
+  PCI_DEVICE_PATH                      Pci;\r
+  PCCARD_DEVICE_PATH                   PcCard;\r
+  MEMMAP_DEVICE_PATH                   MemMap;\r
+  VENDOR_DEVICE_PATH                   Vendor;\r
+\r
+  CONTROLLER_DEVICE_PATH               Controller;\r
+  ACPI_HID_DEVICE_PATH                 Acpi;\r
+\r
+  ATAPI_DEVICE_PATH                    Atapi;\r
+  SCSI_DEVICE_PATH                     Scsi;\r
+  FIBRECHANNEL_DEVICE_PATH             FibreChannel;\r
+\r
+  F1394_DEVICE_PATH                    F1394;\r
+  USB_DEVICE_PATH                      Usb;\r
+  SATA_DEVICE_PATH                     Sata;\r
+  USB_CLASS_DEVICE_PATH                UsbClass;\r
+  I2O_DEVICE_PATH                      I2O;\r
+  MAC_ADDR_DEVICE_PATH                 MacAddr;\r
+  IPv4_DEVICE_PATH                     Ipv4;\r
+  IPv6_DEVICE_PATH                     Ipv6;\r
+  INFINIBAND_DEVICE_PATH               InfiniBand;\r
+  UART_DEVICE_PATH                     Uart;\r
+\r
+  HARDDRIVE_DEVICE_PATH                HardDrive;\r
+  CDROM_DEVICE_PATH                    CD;\r
+\r
+  FILEPATH_DEVICE_PATH                 FilePath;\r
+  MEDIA_PROTOCOL_DEVICE_PATH           MediaProtocol;\r
+\r
+  BBS_BBS_DEVICE_PATH                  Bbs;\r
+} EFI_DEV_PATH;\r
+\r
+\r
+\r
+typedef union {\r
+  EFI_DEVICE_PATH_PROTOCOL             *DevPath;\r
+  PCI_DEVICE_PATH                      *Pci;\r
+  PCCARD_DEVICE_PATH                   *PcCard;\r
+  MEMMAP_DEVICE_PATH                   *MemMap;\r
+  VENDOR_DEVICE_PATH                   *Vendor;\r
+\r
+  CONTROLLER_DEVICE_PATH               *Controller;\r
+  ACPI_HID_DEVICE_PATH                 *Acpi;\r
+  ACPI_EXTENDED_HID_DEVICE_PATH        *ExtendedAcpi;\r
+\r
+  ATAPI_DEVICE_PATH                    *Atapi;\r
+  SCSI_DEVICE_PATH                     *Scsi;\r
+  FIBRECHANNEL_DEVICE_PATH             *FibreChannel;\r
+\r
+  F1394_DEVICE_PATH                    *F1394;\r
+  USB_DEVICE_PATH                      *Usb;\r
+  SATA_DEVICE_PATH                     *Sata;\r
+  USB_CLASS_DEVICE_PATH                *UsbClass;\r
+  I2O_DEVICE_PATH                      *I2O;\r
+  MAC_ADDR_DEVICE_PATH                 *MacAddr;\r
+  IPv4_DEVICE_PATH                     *Ipv4;\r
+  IPv6_DEVICE_PATH                     *Ipv6;\r
+  INFINIBAND_DEVICE_PATH               *InfiniBand;\r
+  UART_DEVICE_PATH                     *Uart;\r
+\r
+  HARDDRIVE_DEVICE_PATH                *HardDrive;\r
+  CDROM_DEVICE_PATH                    *CD;\r
+\r
+  FILEPATH_DEVICE_PATH                 *FilePath;\r
+  MEDIA_PROTOCOL_DEVICE_PATH           *MediaProtocol;\r
+\r
+  BBS_BBS_DEVICE_PATH                  *Bbs;\r
+  UINT8                                *Raw;\r
+} EFI_DEV_PATH_PTR;\r
+\r
+#pragma pack()\r
+                                             \r
+#define EFI_DP_TYPE_MASK                     0x7F\r
+#define EFI_DP_TYPE_UNPACKED                 0x80\r
+#define END_DEVICE_PATH_TYPE                 0x7f\r
+                                             \r
+#define EFI_END_ENTIRE_DEVICE_PATH           0xff\r
+#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE   0xff\r
+#define EFI_END_INSTANCE_DEVICE_PATH         0x01\r
+#define END_ENTIRE_DEVICE_PATH_SUBTYPE       EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE\r
+#define END_INSTANCE_DEVICE_PATH_SUBTYPE     EFI_END_INSTANCE_DEVICE_PATH\r
+                                             \r
+#define EFI_END_DEVICE_PATH_LENGTH           (sizeof (EFI_DEVICE_PATH_PROTOCOL))\r
+#define END_DEVICE_PATH_LENGTH               EFI_END_DEVICE_PATH_LENGTH\r
+                                             \r
+#define DP_IS_END_TYPE(a)                    \r
+#define DP_IS_END_SUBTYPE(a)                 (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)\r
+#define DevicePathSubType(a)                 ((a)->SubType)\r
+#define IsDevicePathUnpacked(a)              ((a)->Type & EFI_DP_TYPE_UNPACKED)\r
+                                             \r
+#define EfiDevicePathNodeLength(a)           (((a)->Length[0]) | ((a)->Length[1] << 8))\r
+#define DevicePathNodeLength(a)              (EfiDevicePathNodeLength(a))\r
+#define EfiNextDevicePathNode(a)             ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))\r
+#define NextDevicePathNode(a)                (EfiNextDevicePathNode(a)) \r
+                                             \r
+#define EfiDevicePathType(a)                 (((a)->Type) & EFI_DP_TYPE_MASK)\r
+#define DevicePathType(a)                    (EfiDevicePathType(a))\r
+#define EfiIsDevicePathEndType(a)            (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)\r
+#define IsDevicePathEndType(a)               (EfiIsDevicePathEndType(a)) \r
+                                             \r
+                                             \r
+#define EfiIsDevicePathEndSubType(a)         ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)\r
+#define IsDevicePathEndSubType(a)            (EfiIsDevicePathEndSubType(a))\r
+#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)\r
+                                             \r
+#define EfiIsDevicePathEnd(a)                (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))\r
+#define IsDevicePathEnd(a)                   (EfiIsDevicePathEnd(a))\r
+#define EfiIsDevicePathEndInstance(a)        (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))\r
+\r
+\r
+#define SetDevicePathNodeLength(a,l) {                           \\r
+          (a)->Length[0] = (UINT8) (l);                          \\r
+          (a)->Length[1] = (UINT8) ((l) >> 8);                   \\r
+          }\r
+\r
+#define SetDevicePathEndNode(a)  {                               \\r
+          (a)->Type = END_DEVICE_PATH_TYPE;                      \\r
+          (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;         \\r
+          (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL);     \\r
+          (a)->Length[1] = 0;                                    \\r
+          }\r
+\r
+extern EFI_GUID gEfiDevicePathProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DevicePathFromText.h b/MdePkg/Include/Protocol/DevicePathFromText.h
new file mode 100644 (file)
index 0000000..31b2e06
--- /dev/null
@@ -0,0 +1,75 @@
+/** @file\r
+  EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL as defined in UEFI 2.0.  \r
+  This protocol provides service to convert text to device paths and device nodes.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DevicePathFromText.h\r
+\r
+**/\r
+\r
+#ifndef __DEVICE_PATH_FROM_TEXT_PROTOCOL_H__\r
+#define __DEVICE_PATH_FROM_TEXT_PROTOCOL_H__\r
+\r
+#include <Protocol/DevicePath.h>\r
+\r
+//\r
+// Device Path From Text protocol\r
+//\r
+#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \\r
+  { \\r
+    0x5c99a21, 0xc70f, 0x4ad2, {0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e  } \\r
+  }\r
+\r
+/**\r
+  Convert text to the binary representation of a device node.\r
+\r
+  @param  TextDeviceNode TextDeviceNode points to the text representation of a device\r
+                         node. Conversion starts with the first character and continues\r
+                         until the first non-device node character.\r
+\r
+  @retval a_pointer      Pointer to the EFI device node.\r
+  @retval NULL           if TextDeviceNode is NULL or there was insufficient memory.\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) (\r
+  IN CONST CHAR16                 *TextDeviceNode\r
+  )\r
+;    \r
+  \r
+\r
+/**\r
+  Convert text to the binary representation of a device node.\r
+\r
+  @param  TextDeviceNode TextDevicePath points to the text representation of a device\r
+                         path. Conversion starts with the first character and continues\r
+                         until the first non-device path character.\r
+\r
+  @retval a_pointer      Pointer to the allocated device path.\r
+  @retval NULL           if TextDeviceNode is NULL or there was insufficient memory.\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) (\r
+  IN CONST CHAR16                 *TextDevicePath\r
+  )\r
+;  \r
+  \r
+typedef struct {\r
+  EFI_DEVICE_PATH_FROM_TEXT_NODE  ConvertTextToDeviceNode;\r
+  EFI_DEVICE_PATH_FROM_TEXT_PATH  ConvertTextToDevicePath;\r
+} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiDevicePathFromTextProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DevicePathToText.h b/MdePkg/Include/Protocol/DevicePathToText.h
new file mode 100644 (file)
index 0000000..0b01412
--- /dev/null
@@ -0,0 +1,88 @@
+/** @file\r
+  EFI_DEVICE_PATH_TO_TEXT_PROTOCOL as defined in UEFI 2.0.  \r
+  This protocol provides service to convert device nodes and paths to text.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DevicePathToText.h\r
+\r
+**/\r
+\r
+#ifndef __DEVICE_PATH_TO_TEXT_PROTOCOL_H__\r
+#define __DEVICE_PATH_TO_TEXT_PROTOCOL_H__\r
+\r
+#include <Protocol/DevicePath.h>\r
+\r
+//\r
+// Device Path To Text protocol\r
+//\r
+#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \\r
+  { \\r
+    0x8b843e20, 0x8132, 0x4852, {0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } \\r
+  }\r
+\r
+/**\r
+  Convert a device node to its text representation.\r
+\r
+  @param  DeviceNode     Points to the device node to be converted.\r
+  @param  DisplayOnly    If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.\r
+  @param  AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r
+                         representation for a device node can be used, where applicable.\r
+\r
+  @retval a_pointer      a pointer to the allocated text representation of the device node data\r
+  @retval NULL           if DeviceNode is NULL or there was insufficient memory.\r
+\r
+**/\r
+typedef\r
+CHAR16*\r
+(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL   *DeviceNode,\r
+  IN BOOLEAN                          DisplayOnly,\r
+  IN BOOLEAN                          AllowShortcuts\r
+  )\r
+;      \r
+\r
+/**\r
+  Convert a device path to its text representation.\r
+\r
+  @param  DevicePath     Points to the device path to be converted.\r
+  @param  DisplayOnly    If DisplayOnly is TRUE, then the shorter text representation\r
+                         of the display node is used, where applicable. If DisplayOnly\r
+                         is FALSE, then the longer text representation of the display node\r
+                         is used.  \r
+  @param  AllowShortcuts The AllowShortcuts is FALSE, then the shortcut forms of\r
+                         text representation for a device node cannot be used.\r
+\r
+  @retval a_pointer      a pointer to the allocated text representation of the device node.\r
+  @retval NULL           if DevicePath is NULL or there was insufficient memory.\r
+\r
+**/\r
+typedef\r
+CHAR16*\r
+(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL   *DevicePath,\r
+  IN BOOLEAN                          DisplayOnly,\r
+  IN BOOLEAN                          AllowShortcuts\r
+  )\r
+;    \r
+\r
+typedef struct {\r
+  EFI_DEVICE_PATH_TO_TEXT_NODE        ConvertDeviceNodeToText;\r
+  EFI_DEVICE_PATH_TO_TEXT_PATH        ConvertDevicePathToText;\r
+} EFI_DEVICE_PATH_TO_TEXT_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiDevicePathToTextProtocolGuid;\r
+\r
+#endif\r
+\r
+\r
diff --git a/MdePkg/Include/Protocol/DevicePathUtilities.h b/MdePkg/Include/Protocol/DevicePathUtilities.h
new file mode 100644 (file)
index 0000000..3959456
--- /dev/null
@@ -0,0 +1,197 @@
+/** @file\r
+  EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.  \r
+  Use to create and manipulate device paths and device nodes.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DevicePathUtilities.h\r
+\r
+**/\r
+\r
+#ifndef __DEVICE_PATH_UTILITIES_PROTOCOL_H__\r
+#define __DEVICE_PATH_UTILITIES_PROTOCOL_H__\r
+\r
+\r
+#include <Protocol/DevicePath.h>\r
+\r
+//\r
+// Device Path Utilities protocol\r
+//\r
+#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \\r
+  { \\r
+    0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \\r
+  }\r
+\r
+/**\r
+  Returns the size of the device path, in bytes.\r
+\r
+  @param  DevicePath Points to the start of the EFI device path.\r
+\r
+  @revtal Size       Size of the specified device path, in bytes, including the end-of-path tag.\r
+\r
+**/\r
+typedef\r
+UINTN\r
+(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
+  )\r
+;    \r
+  \r
+\r
+/**\r
+  Create a duplicate of the specified path.\r
+\r
+  @param  DevicePath Points to the source EFI device path.\r
+\r
+  @retval Pointer    A pointer to the duplicate device path.\r
+  @retval NULL       insufficient memory\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
+  )\r
+;      \r
+\r
+/**\r
+  Create a new path by appending the second device path to the first.\r
+\r
+  @param  Src1 Points to the first device path. If NULL, then it is ignored.\r
+  @param  Src2 Points to the second device path. If NULL, then it is ignored.\r
+\r
+  @retval Pointer  A pointer to the newly created device path.\r
+  @retval NULL     Memory could not be allocated\r
+                   or either DevicePath or DeviceNode is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_PATH) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2\r
+  )\r
+;     \r
+  \r
+/**\r
+  Creates a new path by appending the device node to the device path.\r
+\r
+  @param  DevicePath Points to the device path.\r
+  @param  DeviceNode Points to the device node.\r
+\r
+  @retval Pointer    A pointer to the allocated device node.\r
+  @retval NULL       Memory could not be allocated\r
+                     or either DevicePath or DeviceNode is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_NODE) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode\r
+  )\r
+;\r
+\r
+/**\r
+  Creates a new path by appending the specified device path instance to the specified device path.\r
+\r
+  @param  DevicePath         Points to the device path. If NULL, then ignored.\r
+  @param  DevicePathInstance Points to the device path instance.\r
+\r
+  @retval Pointer            A pointer to the newly created device path\r
+  @retval NULL               Memory could not be allocated or DevicePathInstance is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r
+  )\r
+;  \r
+\r
+/**\r
+  Creates a copy of the current device path instance and returns a pointer to the next device path\r
+  instance.\r
+\r
+  @param  DevicePathInstance     On input, this holds the pointer to the current device path\r
+                                 instance. On output, this holds the pointer to the next\r
+                                 device path instance or NULL if there are no more device\r
+                                 path instances in the device path.  \r
+  @param  DevicePathInstanceSize On output, this holds the size of the device path instance,\r
+                                 in bytes or zero, if DevicePathInstance is zero.\r
+\r
+  @retval Pointer                A pointer to the copy of the current device path instance.\r
+  @retval NULL                   DevicePathInstace was NULL on entry or there was insufficient memory.\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE) (\r
+  IN  OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePathInstance,\r
+  OUT UINTN                         *DevicePathInstanceSize\r
+  )\r
+;  \r
+\r
+/**\r
+  Creates a device node\r
+\r
+  @param  NodeType    NodeType is the device node type (EFI_DEVICE_PATH.Type) for\r
+                      the new device node.\r
+  @param  NodeSubType NodeSubType is the device node sub-type\r
+                      EFI_DEVICE_PATH.SubType) for the new device node.\r
+  @param  NodeLength  NodeLength is the length of the device node\r
+                      (EFI_DEVICE_PATH.Length) for the new device node.\r
+\r
+  @retval Pointer     A pointer to the newly created device node.\r
+  @retval NULL        NodeLength is less than\r
+                      the size of the header or there was insufficient memory.\r
+\r
+**/\r
+typedef\r
+EFI_DEVICE_PATH_PROTOCOL*\r
+(EFIAPI *EFI_DEVICE_PATH_CREATE_NODE) (\r
+  IN UINT8                          NodeType,\r
+  IN UINT8                          NodeSubType,\r
+  IN UINT16                         NodeLength\r
+)\r
+;   \r
+\r
+/**\r
+  Returns whether a device path is multi-instance.\r
+\r
+  @param  DevicePath Points to the device path. If NULL, then ignored.\r
+\r
+  @retval TRUE       The device path has more than one instance\r
+  @retval FALSE      The device path is empty or contains only a single instance.\r
+\r
+**/\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE) (\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL         *DevicePath\r
+  )\r
+;                                                                                                       \r
+  \r
+\r
+typedef struct {\r
+  EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;\r
+  EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH      DuplicateDevicePath;\r
+  EFI_DEVICE_PATH_UTILS_APPEND_PATH          AppendDevicePath;\r
+  EFI_DEVICE_PATH_UTILS_APPEND_NODE          AppendDeviceNode;\r
+  EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE      AppendDevicePathInstance;\r
+  EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE    GetNextDevicePathInstance;\r
+  EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE    IsDevicePathMultiInstance;\r
+  EFI_DEVICE_PATH_CREATE_NODE                CreateDeviceNode;\r
+} EFI_DEVICE_PATH_UTILITIES_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid; \r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Dhcp4.h b/MdePkg/Include/Protocol/Dhcp4.h
new file mode 100644 (file)
index 0000000..3adce1a
--- /dev/null
@@ -0,0 +1,442 @@
+/** @file\r
+  EFI_DHCP4_PROTOCOL as defined in UEFI 2.0.\r
+  EFI_DHCP4_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.\r
+  These protocols are used to collect configuration information for the EFI IPv4 Protocol \r
+  drivers and to provide DHCPv4 server and PXE boot server discovery services.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DHCP4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_DHCP4_PROTOCOL_H__\r
+#define __EFI_DHCP4_PROTOCOL_H__\r
+\r
+#define EFI_DHCP4_PROTOCOL_GUID \\r
+  { \\r
+    0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } \\r
+  }\r
+\r
+#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } \\r
+  }\r
+  \r
+typedef struct _EFI_DHCP4_PROTOCOL EFI_DHCP4_PROTOCOL;\r
+\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+  UINT8               OpCode;\r
+  UINT8               Length;\r
+  UINT8               Data[1];\r
+} EFI_DHCP4_PACKET_OPTION;\r
+#pragma pack()\r
+\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+    UINT8             OpCode;\r
+    UINT8             HwType;\r
+    UINT8             HwAddrLen;\r
+    UINT8             Hops;\r
+    UINT32            Xid;\r
+    UINT16            Seconds;\r
+    UINT16            Reserved;\r
+    EFI_IPv4_ADDRESS  ClientAddr;       //Client IP address from client\r
+    EFI_IPv4_ADDRESS  YourAddr;         //Client IP address from server\r
+    EFI_IPv4_ADDRESS  ServerAddr;       //IP address of next server in bootstrap \r
+    EFI_IPv4_ADDRESS  GatewayAddr;      //Relay agent IP address\r
+    UINT8             ClientHwAddr[16]; //Client hardware address\r
+    CHAR8             ServerName[64];   \r
+    CHAR8             BootFileName[128];\r
+}EFI_DHCP4_HEADER;\r
+#pragma pack()\r
+\r
+\r
+#pragma pack(1)\r
+typedef struct {\r
+  UINT32              Size;\r
+  UINT32              Length;\r
+\r
+  struct {\r
+    EFI_DHCP4_HEADER  Header;\r
+    UINT32            Magik;\r
+    UINT8             Option[1];\r
+  } Dhcp4;\r
+} EFI_DHCP4_PACKET;\r
+#pragma pack()\r
+\r
+\r
+typedef enum {\r
+  Dhcp4Stopped        = 0x0,\r
+  Dhcp4Init           = 0x1,\r
+  Dhcp4Selecting      = 0x2,\r
+  Dhcp4Requesting     = 0x3,\r
+  Dhcp4Bound          = 0x4,\r
+  Dhcp4Renewing       = 0x5,\r
+  Dhcp4Rebinding      = 0x6,\r
+  Dhcp4InitReboot     = 0x7,\r
+  Dhcp4Rebooting      = 0x8\r
+} EFI_DHCP4_STATE;\r
+\r
+\r
+typedef enum{\r
+  Dhcp4SendDiscover   = 0x01,\r
+  Dhcp4RcvdOffer      = 0x02,\r
+  Dhcp4SelectOffer    = 0x03,\r
+  Dhcp4SendRequest    = 0x04,\r
+  Dhcp4RcvdAck        = 0x05,\r
+  Dhcp4RcvdNak        = 0x06,\r
+  Dhcp4SendDecline    = 0x07,\r
+  Dhcp4BoundCompleted = 0x08,\r
+  Dhcp4EnterRenewing  = 0x09,\r
+  Dhcp4EnterRebinding = 0x0a,\r
+  Dhcp4AddressLost    = 0x0b,\r
+  Dhcp4Fail           = 0x0c\r
+} EFI_DHCP4_EVENT;\r
+\r
+/**                                                                 \r
+  Callback routine \r
+    \r
+  @param  This                  Pointer to the EFI DHCPv4 Protocol instance that is used to\r
+                                configure this callback function.                          \r
+  @param  Context               Pointer to the context that is initialized by\r
+                                EFI_DHCP4_PROTOCOL.Configure().                                              \r
+  @param  CurrentState          The current operational state of the EFI DHCPv4 Protocol\r
+                                driver.                                                 \r
+  @param  Dhcp4Event            The event that occurs in the current state, which usually means a\r
+                                state transition.                                                \r
+  @param  Packet                The DHCP packet that is going to be sent or already received.                \r
+  @param  NewPacket             The packet that is used to replace the above Packet.\r
+                                \r
+  @retval EFI_SUCCESS           Tells the EFI DHCPv4 Protocol driver to continue the DHCP process.\r
+  @retval EFI_NOT_READY         Only used in the Dhcp4Selecting state. The EFI DHCPv4 Protocol         \r
+                                driver will continue to wait for more DHCPOFFER packets until the retry\r
+                                timeout expires.                                                       \r
+  @retval EFI_ABORTED           Tells the EFI DHCPv4 Protocol driver to abort the current process and\r
+                                return to the Dhcp4Init or Dhcp4InitReboot state.                    \r
+                                   \r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_DHCP4_CALLBACK) (\r
+  IN  EFI_DHCP4_PROTOCOL         *This,\r
+  IN  VOID                       *Context,\r
+  IN  EFI_DHCP4_STATE            CurrentState,\r
+  IN  EFI_DHCP4_EVENT            Dhcp4Event,\r
+  IN  EFI_DHCP4_PACKET           *Packet     OPTIONAL, \r
+  OUT EFI_DHCP4_PACKET           **NewPacket OPTIONAL\r
+  );\r
+\r
+\r
+typedef struct {\r
+  UINT32                      DiscoverTryCount;      \r
+  UINT32                      *DiscoverTimeout;\r
+  UINT32                      RequestTryCount;\r
+  UINT32                      *RequestTimeout;\r
+  EFI_IPv4_ADDRESS            ClientAddress;\r
+  EFI_DHCP4_CALLBACK          Dhcp4Callback;\r
+  void                        *CallbackContext;\r
+  UINT32                      OptionCount;\r
+  EFI_DHCP4_PACKET_OPTION     **OptionList;\r
+} EFI_DHCP4_CONFIG_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_DHCP4_STATE             State;\r
+  EFI_DHCP4_CONFIG_DATA       ConfigData;\r
+  EFI_IPv4_ADDRESS            ClientAddress;\r
+  EFI_MAC_ADDRESS             ClientMacAddress;\r
+  EFI_IPv4_ADDRESS            ServerAddress;\r
+  EFI_IPv4_ADDRESS            RouterAddress;\r
+  EFI_IPv4_ADDRESS            SubnetMask;\r
+  UINT32                      LeaseTime;\r
+  EFI_DHCP4_PACKET            *ReplyPacket;\r
+} EFI_DHCP4_MODE_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS            ListenAddress;\r
+  EFI_IPv4_ADDRESS            SubnetMask;\r
+  UINT16                      ListenPort;\r
+} EFI_DHCP4_LISTEN_POINT;\r
+\r
+\r
+typedef struct {\r
+  OUT EFI_STATUS              Status;\r
+  IN  EFI_EVENT               CompletionEvent;\r
+  IN  EFI_IPv4_ADDRESS        RemoteAddress;\r
+  IN  UINT16                  RemotePort;\r
+  IN  EFI_IPv4_ADDRESS        GatewayAddress;\r
+  IN  UINT32                  ListenPointCount;\r
+  IN  EFI_DHCP4_LISTEN_POINT  *ListenPoints;\r
+  IN  UINT32                  TimeoutValue;\r
+  IN  EFI_DHCP4_PACKET        *Packet;\r
+  OUT UINT32                  ResponseCount;\r
+  OUT EFI_DHCP4_PACKET        *ResponseList;\r
+} EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN;\r
+\r
+\r
+/**\r
+  Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.\r
+\r
+  @param  This          Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  Dhcp4ModeData Pointer to storage for the EFI_DHCP4_MODE_DATA structure.\r
+\r
+  @retval EFI_SUCCESS           The mode data was returned.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_DHCP4_GET_MODE_DATA)(\r
+  IN  EFI_DHCP4_PROTOCOL      *This,\r
+  OUT EFI_DHCP4_MODE_DATA     *Dhcp4ModeData\r
+  )\r
+;\r
+\r
+/**\r
+  Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.\r
+\r
+  @param  This                   Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  Dhcp4CfgData           Pointer to the EFI_DHCP4_CONFIG_DATA.\r
+\r
+  @retval EFI_SUCCESS           The EFI DHCPv4 Protocol driver is now in the Dhcp4Init or\r
+                                Dhcp4InitReboot state, if the original state of this driver\r
+                                was Dhcp4Stopped and the value of Dhcp4CfgData was\r
+                                not NULL. Otherwise, the state was left unchanged.\r
+  @retval EFI_ACCESS_DENIED     This instance of the EFI DHCPv4 Protocol driver was not in the\r
+                                Dhcp4Stopped, Dhcp4Init, Dhcp4InitReboot, or Dhcp4Bound state;\r
+                                Or onother instance of this EFI DHCPv4 Protocol driver is already\r
+                                in a valid configured state.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_CONFIGURE) (\r
+  IN EFI_DHCP4_PROTOCOL       *This,\r
+  IN EFI_DHCP4_CONFIG_DATA    *Dhcp4CfgData  OPTIONAL\r
+  )\r
+;\r
+\r
+\r
+/**\r
+  Starts the DHCP configuration process.\r
+\r
+  @param  This            Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  CompletionEvent If not NULL, indicates the event that will be signaled when the\r
+                          EFI DHCPv4 Protocol driver is transferred into the\r
+                          Dhcp4Bound state or when the DHCP process is aborted.\r
+                          EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
+                          check the completion status. If NULL,\r
+                          EFI_DHCP4_PROTOCOL.Start() will wait until the driver\r
+                          is transferred into the Dhcp4Bound state or the process fails.\r
+\r
+  @retval EFI_SUCCESS           The DHCP configuration process has started, or it has completed\r
+                                when CompletionEvent is NULL.\r
+  @retval EFI_NOT_STARTED       The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
+                                state. EFI_DHCP4_PROTOCOL. Configure() needs to be called.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_TIMEOUT           The DHCP configuration process failed because no response was\r
+                                received from the server within the specified timeout value.\r
+  @retval EFI_ABORTED           The user aborted the DHCP process.\r
+  @retval EFI_ALREADY_STARTED   Some other EFI DHCPv4 Protocol instance already started the\r
+                                DHCP process.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_START) (\r
+  IN EFI_DHCP4_PROTOCOL       *This,\r
+  IN EFI_EVENT                CompletionEvent   OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Extends the lease time by sending a request packet.\r
+\r
+  @param  This            Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  RebindRequest   If TRUE, this function broadcasts the request packets and enters\r
+                          the Dhcp4Rebinding state. Otherwise, it sends a unicast\r
+                          request packet and enters the Dhcp4Renewing state.\r
+  @param  CompletionEvent If not NULL, this event is signaled when the renew/rebind phase\r
+                          completes or some error occurs.\r
+                          EFI_DHCP4_PROTOCOL.GetModeData() can be called to\r
+                          check the completion status. If NULL,\r
+                          EFI_DHCP4_PROTOCOL.RenewRebind() will busy-wait\r
+                          until the DHCP process finishes.\r
+\r
+  @retval EFI_SUCCESS           The EFI DHCPv4 Protocol driver is now in the\r
+                                Dhcp4Renewing state or is back to the Dhcp4Bound state.\r
+  @retval EFI_NOT_STARTED       The EFI DHCPv4 Protocol driver is in the Dhcp4Stopped\r
+                                state. EFI_DHCP4_PROTOCOL.Configure() needs to\r
+                                be called.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_TIMEOUT           There was no response from the server when the try count was\r
+                                exceeded.\r
+  @retval EFI_ACCESS_DENIED     The driver is not in the Dhcp4Bound state.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_RENEW_REBIND) (\r
+  IN EFI_DHCP4_PROTOCOL       *This,\r
+  IN BOOLEAN                  RebindRequest,\r
+  IN EFI_EVENT                CompletionEvent  OPTIONAL\r
+  )\r
+;  \r
+\r
+/**\r
+  Releases the current address configuration.\r
+\r
+  @param  This                  Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The EFI DHCPv4 Protocol driver is now in the Dhcp4Init phase.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_ACCESS_DENIED     The EFI DHCPv4 Protocol driver is not Dhcp4InitReboot state.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_RELEASE) (\r
+  IN EFI_DHCP4_PROTOCOL       *This\r
+  )\r
+;  \r
+\r
+/**\r
+  Stops the current address configuration.\r
+\r
+  @param  This                  Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+                                 \r
+  @retval EFI_SUCCESS           The EFI DHCPv4 Protocol driver is now in the Dhcp4Stopped phase.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_STOP) (\r
+  IN EFI_DHCP4_PROTOCOL       *This\r
+  )\r
+; \r
+\r
+/**\r
+  Builds a DHCP packet, given the options to be appended or deleted or replaced.\r
+\r
+  @param  This        Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  SeedPacket  Initial packet to be used as a base for building new packet.\r
+  @param  DeleteCount Number of opcodes in the DeleteList.\r
+  @param  DeleteList  List of opcodes to be deleted from the seed packet.\r
+                      Ignored if DeleteCount is zero.\r
+  @param  AppendCount Number of entries in the OptionList.\r
+  @param  AppendList  Pointer to a DHCP option list to be appended to SeedPacket.\r
+                      If SeedPacket also contains options in this list, they are\r
+                      replaced by new options (except pad option). Ignored if\r
+                      AppendCount is zero. Type EFI_DHCP4_PACKET_OPTION\r
+  @param  NewPacket   Pointer to storage for the pointer to the new allocated packet.\r
+                      Use the EFI Boot Service FreePool() on the resulting pointer\r
+                      when done with the packet.\r
+\r
+  @retval EFI_SUCCESS           The new packet was built.\r
+  @retval EFI_OUT_OF_RESOURCES  Storage for the new packet could not be allocated.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_BUILD) (\r
+  IN  EFI_DHCP4_PROTOCOL      *This,\r
+  IN  EFI_DHCP4_PACKET        *SeedPacket,\r
+  IN  UINT32                  DeleteCount,\r
+  IN  UINT8                   *DeleteList         OPTIONAL,\r
+  IN  UINT32                  AppendCount,\r
+  IN  EFI_DHCP4_PACKET_OPTION *AppendList[]       OPTIONAL,\r
+  OUT EFI_DHCP4_PACKET        **NewPacket\r
+  );\r
+;   \r
+\r
+/**\r
+  Transmits a DHCP formatted packet and optionally waits for responses.\r
+\r
+  @param  This    Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  Token   Pointer to the EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN structure.\r
+\r
+  @retval EFI_SUCCESS           The packet was successfully queued for transmission.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+  @retval EFI_NOT_READY         The previous call to this function has not finished yet. Try to call\r
+                                this function after collection process completes.\r
+  @retval EFI_NO_MAPPING        The default station address is not available yet.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval Others                Some other unexpected error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_TRANSMIT_RECEIVE) (\r
+  IN EFI_DHCP4_PROTOCOL                *This,\r
+  IN EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN  *Token\r
+  )\r
+;\r
+\r
+\r
+/**\r
+  Parses the packed DHCP option data.\r
+\r
+  @param  This             Pointer to the EFI_DHCP4_PROTOCOL instance.\r
+  @param  Packet           Pointer to packet to be parsed.\r
+  @param  OptionCount      On input, the number of entries in the PacketOptionList.\r
+                           On output, the number of entries that were written into the\r
+                           PacketOptionList.\r
+  @param  PacketOptionList List of packet option entries to be filled in. End option or pad\r
+                           options are not included.\r
+\r
+  @retval EFI_SUCCESS           The packet was successfully parsed.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is NULL.\r
+  @retval EFI_BUFFER_TOO_SMALL  One or more of the following conditions is TRUE:\r
+                                1) *OptionCount is smaller than the number of options that\r
+                                were found in the Packet.\r
+                                2) PacketOptionList is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DHCP4_PARSE) (\r
+  IN EFI_DHCP4_PROTOCOL        *This,\r
+  IN EFI_DHCP4_PACKET          *Packet,\r
+  IN OUT UINT32                *OptionCount,\r
+  OUT EFI_DHCP4_PACKET_OPTION  *PacketOptionList[]  OPTIONAL\r
+  )\r
+;\r
+\r
+\r
+struct _EFI_DHCP4_PROTOCOL {\r
+  EFI_DHCP4_GET_MODE_DATA      GetModeData;\r
+  EFI_DHCP4_CONFIGURE          Configure;\r
+  EFI_DHCP4_START              Start;\r
+  EFI_DHCP4_RENEW_REBIND       RenewRebind;\r
+  EFI_DHCP4_RELEASE            Release;\r
+  EFI_DHCP4_STOP               Stop;\r
+  EFI_DHCP4_BUILD              Build;\r
+  EFI_DHCP4_TRANSMIT_RECEIVE   TransmitReceive;\r
+  EFI_DHCP4_PARSE              Parse;\r
+};\r
+\r
+extern EFI_GUID gEfiDhcp4ProtocolGuid;\r
+extern EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DiskIo.h b/MdePkg/Include/Protocol/DiskIo.h
new file mode 100644 (file)
index 0000000..e36792c
--- /dev/null
@@ -0,0 +1,98 @@
+/** @file\r
+  Disk IO protocol as defined in the EFI 1.0 specification.\r
+\r
+  The Disk IO protocol is used to convert block oriented devices into byte\r
+  oriented devices. The Disk IO protocol is intended to layer on top of the\r
+  Block IO protocol.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DiskIo.h\r
+\r
+**/\r
+\r
+#ifndef __DISK_IO_H__\r
+#define __DISK_IO_H__\r
+\r
+#define EFI_DISK_IO_PROTOCOL_GUID \\r
+  { \\r
+    0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+typedef struct _EFI_DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL;\r
+\r
+/**\r
+  Read BufferSize bytes from Offset into Buffer.\r
+\r
+  @param  This                  Protocol instance pointer.\r
+  @param  MediaId               Id of the media, changes every time the media is replaced.\r
+  @param  Offset                The starting byte offset to read from\r
+  @param  BufferSize            Size of Buffer\r
+  @param  Buffer                Buffer containing read data\r
+\r
+  @retval EFI_SUCCESS           The data was read correctly from the device.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error while performing the read.\r
+  @retval EFI_NO_MEDIA          There is no media in the device.\r
+  @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
+  @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
+                                valid for the device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DISK_READ) (\r
+  IN EFI_DISK_IO_PROTOCOL         *This,\r
+  IN UINT32                       MediaId,\r
+  IN UINT64                       Offset,\r
+  IN UINTN                        BufferSize,\r
+  OUT VOID                        *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Read BufferSize bytes from Offset into Buffer.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  MediaId    Id of the media, changes every time the media is replaced.\r
+  @param  Offset     The starting byte offset to read from\r
+  @param  BufferSize Size of Buffer\r
+  @param  Buffer     Buffer containing read data\r
+\r
+  @retval EFI_SUCCESS           The data was written correctly to the device.\r
+  @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
+  @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.\r
+  @retval EFI_NO_MEDIA          There is no media in the device.\r
+  @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
+  @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not\r
+                                 valid for the device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DISK_WRITE) (\r
+  IN EFI_DISK_IO_PROTOCOL         *This,\r
+  IN UINT32                       MediaId,\r
+  IN UINT64                       Offset,\r
+  IN UINTN                        BufferSize,\r
+  IN VOID                         *Buffer\r
+  )\r
+;\r
+\r
+#define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000\r
+\r
+struct _EFI_DISK_IO_PROTOCOL {\r
+  UINT64          Revision;\r
+  EFI_DISK_READ   ReadDisk;\r
+  EFI_DISK_WRITE  WriteDisk;\r
+};\r
+\r
+extern EFI_GUID gEfiDiskIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DriverBinding.h b/MdePkg/Include/Protocol/DriverBinding.h
new file mode 100644 (file)
index 0000000..5f5d909
--- /dev/null
@@ -0,0 +1,111 @@
+/** @file\r
+  EFI ControllerHandle Driver Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DriverBinding.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_DRIVER_BINDING_H__\r
+#define __EFI_DRIVER_BINDING_H__\r
+\r
+//\r
+// Global ID for the ControllerHandle Driver Protocol\r
+//\r
+#define EFI_DRIVER_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0xc, 0x9, 0x26, 0x1e, 0x9f, 0x71 } \\r
+  }\r
+\r
+typedef struct _EFI_DRIVER_BINDING_PROTOCOL  EFI_DRIVER_BINDING_PROTOCOL;\r
+\r
+/**\r
+  Test to see if this driver supports ControllerHandle. \r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+  @retval other               This driver does not support this device\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DRIVER_BINDING_SUPPORTED) (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL            *This,\r
+  IN EFI_HANDLE                             ControllerHandle,\r
+  IN EFI_DEVICE_PATH_PROTOCOL               *RemainingDevicePath OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Start this driver on ControllerHandle.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DRIVER_BINDING_START) (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL            *This,\r
+  IN EFI_HANDLE                             ControllerHandle,\r
+  IN EFI_DEVICE_PATH_PROTOCOL               *RemainingDevicePath OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Stop this driver on ControllerHandle.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DRIVER_BINDING_STOP) (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL            *This,\r
+  IN  EFI_HANDLE                            ControllerHandle,\r
+  IN  UINTN                                 NumberOfChildren,\r
+  IN  EFI_HANDLE                            *ChildHandleBuffer OPTIONAL\r
+  )\r
+;\r
+\r
+//\r
+// Interface structure for the ControllerHandle Driver Protocol\r
+//\r
+struct _EFI_DRIVER_BINDING_PROTOCOL {\r
+  EFI_DRIVER_BINDING_SUPPORTED  Supported;\r
+  EFI_DRIVER_BINDING_START      Start;\r
+  EFI_DRIVER_BINDING_STOP       Stop;\r
+  UINT32                        Version;\r
+  EFI_HANDLE                    ImageHandle;\r
+  EFI_HANDLE                    DriverBindingHandle;\r
+};\r
+\r
+extern EFI_GUID gEfiDriverBindingProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DriverConfiguration.h b/MdePkg/Include/Protocol/DriverConfiguration.h
new file mode 100644 (file)
index 0000000..f4f0c7a
--- /dev/null
@@ -0,0 +1,203 @@
+/** @file\r
+  EFI Driver Configuration Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DriverConfiguration.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_DRIVER_CONFIGURATION_H__\r
+#define __EFI_DRIVER_CONFIGURATION_H__\r
+\r
+//\r
+// Global ID for the Driver Configuration Protocol defined in EFI 1.10\r
+//\r
+#define EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \\r
+  { \\r
+    0x107a772b, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+//\r
+// Global ID for the Driver Configuration Protocol defined in UEFI 2.0\r
+//\r
+#define UEFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \\r
+  { \\r
+    0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe } \\r
+  }\r
+  \r
+typedef struct _EFI_DRIVER_CONFIGURATION_PROTOCOL  EFI_DRIVER_CONFIGURATION_PROTOCOL;\r
+\r
+typedef enum {\r
+  EfiDriverConfigurationActionNone              = 0,\r
+  EfiDriverConfigurationActionStopController    = 1,\r
+  EfiDriverConfigurationActionRestartController = 2,\r
+  EfiDriverConfigurationActionRestartPlatform   = 3,\r
+  EfiDriverConfigurationActionMaximum\r
+} EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED;\r
+\r
+#define EFI_DRIVER_CONFIGURATION_SAFE_DEFAULTS          0x00000000\r
+#define EFI_DRIVER_CONFIGURATION_MANUFACTURING_DEFAULTS 0x00000001\r
+#define EFI_DRIVER_CONFIGURATION_CUSTOM_DEFAULTS        0x00000002\r
+#define EFI_DRIVER_CONFIGURATION_PERORMANCE_DEFAULTS    0x00000003\r
+\r
+/**\r
+  Allows the user to set controller specific options for a controller that a \r
+  driver is currently managing.\r
+\r
+  @param  This             A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.\r
+  @param  ControllerHandle The handle of the controller to set options on.\r
+  @param  ChildHandle      The handle of the child controller to set options on.  This\r
+                           is an optional parameter that may be NULL.  It will be NULL\r
+                           for device drivers, and for a bus drivers that wish to set\r
+                           options for the bus controller.  It will not be NULL for a\r
+                           bus driver that wishes to set options for one of its child\r
+                           controllers.\r
+  @param  Language         A pointer to a three character ISO 639-2 language identifier.\r
+                           This is the language of the user interface that should be\r
+                           presented to the user, and it must match one of the languages\r
+                           specified in SupportedLanguages.  The number of languages\r
+                           supported by a driver is up to the driver writer.\r
+  @param  ActionRequired   A pointer to the action that the calling agent is required\r
+                           to perform when this function returns.  See "Related\r
+                           Definitions" for a list of the actions that the calling\r
+                           agent is required to perform prior to accessing\r
+                           ControllerHandle again.\r
+\r
+  @retval EFI_SUCCESS           The driver specified by This successfully set the\r
+                                configuration options for the controller specified\r
+                                by ControllerHandle..\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ActionRequired is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support setting\r
+                                configuration options for the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                language specified by Language.\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempt to set the\r
+                                configuration options for the controller specified\r
+                                by ControllerHandle and ChildHandle.\r
+  @retval EFI_OUT_RESOURCES     There are not enough resources available to set the\r
+                                configuration options for the controller specified\r
+                                by ControllerHandle and ChildHandle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DRIVER_CONFIGURATION_SET_OPTIONS) (\r
+  IN EFI_DRIVER_CONFIGURATION_PROTOCOL                        *This,\r
+  IN  EFI_HANDLE                                              ControllerHandle,\r
+  IN  EFI_HANDLE                                              ChildHandle  OPTIONAL,\r
+  IN  CHAR8                                                   *Language,\r
+  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED                *ActionRequired\r
+  );\r
+\r
+/**\r
+  Tests to see if a controller's current configuration options are valid.\r
+\r
+  @param  This             A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL instance.\r
+  @param  ControllerHandle The handle of the controller to test if it's current\r
+                           configuration options are valid.\r
+  @param  ChildHandle      The handle of the child controller to test if it's current\r
+                           configuration options are valid.  This is an optional\r
+                           parameter that may be NULL.  It will be NULL for device\r
+                           drivers.  It will also be NULL for a bus drivers that wish\r
+                           to test the configuration options for the bus controller.\r
+                           It will not be NULL for a bus driver that wishes to test\r
+                           configuration options for one of its child controllers.\r
+\r
+  @retval EFI_SUCCESS           The controller specified by ControllerHandle and\r
+                                ChildHandle that is being managed by the driver\r
+                                specified by This has a valid set of  configuration\r
+                                options.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by ControllerHandle\r
+                                and ChildHandle.\r
+  @retval EFI_DEVICE_ERROR      The controller specified by ControllerHandle and\r
+                                ChildHandle that is being managed by the driver\r
+                                specified by This has an invalid set of configuration\r
+                                options.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DRIVER_CONFIGURATION_OPTIONS_VALID) (\r
+  IN EFI_DRIVER_CONFIGURATION_PROTOCOL                        *This,\r
+  IN  EFI_HANDLE                                              ControllerHandle,\r
+  IN  EFI_HANDLE                                              ChildHandle  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Forces a driver to set the default configuration options for a controller.\r
+\r
+  @param  This             A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.\r
+  @param  ControllerHandle The handle of the controller to force default configuration options on.\r
+  @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.\r
+  @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.\r
+  @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.\r
+\r
+  @retval EFI_SUCCESS           The driver specified by This successfully forced the default configuration options on the controller specified by ControllerHandle and ChildHandle.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ActionRequired is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support forcing the default configuration options on the controller specified by ControllerHandle and ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the configuration type specified by DefaultType.\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempt to force the default configuration options on the controller specified by  ControllerHandle and ChildHandle.\r
+  @retval EFI_OUT_RESOURCES     There are not enough resources available to force the default configuration options on the controller specified by ControllerHandle and ChildHandle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DRIVER_CONFIGURATION_FORCE_DEFAULTS) (\r
+  IN EFI_DRIVER_CONFIGURATION_PROTOCOL                        *This,\r
+  IN  EFI_HANDLE                                              ControllerHandle,\r
+  IN  EFI_HANDLE                                              ChildHandle  OPTIONAL,\r
+  IN  UINT32                                                  DefaultType,\r
+  OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED                *ActionRequired\r
+  );\r
+\r
+\r
+//\r
+//\r
+struct _EFI_DRIVER_CONFIGURATION_PROTOCOL {\r
+  EFI_DRIVER_CONFIGURATION_SET_OPTIONS    SetOptions;\r
+  EFI_DRIVER_CONFIGURATION_OPTIONS_VALID  OptionsValid;\r
+  EFI_DRIVER_CONFIGURATION_FORCE_DEFAULTS ForceDefaults;\r
+  CHAR8                                   *SupportedLanguages;\r
+};\r
+\r
+/**\r
+  Interface structure for the Driver Configuration Protocol.\r
+\r
+  @par Protocol Description:  \r
+  Used to set configuration options for a controller that an EFI Driver is managing.\r
+\r
+  @param SetOptions          Allows the use to set drivers specific configuration \r
+                             options for a controller that the driver is currently managing.\r
+                             \r
+  @param OptionsValid        Tests to see if a controller's current configuration \r
+                             options are valid. \r
+                             \r
+  @param ForceDefaults       Forces a driver to set the default configuration options \r
+                             for a controller.\r
+\r
+  @param SupportedLanguages  A Null-terminated ASCII string that contains one or more \r
+                             ISO 639-2 language codes.  This is the list of language \r
+                             codes that this protocol supports.\r
+\r
+**/\r
+\r
+extern EFI_GUID gEfiDriverConfigurationProtocolGuid;\r
+extern EFI_GUID gUefiDriverConfigurationProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DriverDiagnostics.h b/MdePkg/Include/Protocol/DriverDiagnostics.h
new file mode 100644 (file)
index 0000000..c0a0cbc
--- /dev/null
@@ -0,0 +1,134 @@
+/** @file\r
+  EFI Driver Diagnostics Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DriverDiagnostics.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_DRIVER_DIAGNOSTICS_H__\r
+#define __EFI_DRIVER_DIAGNOSTICS_H__\r
+\r
+//\r
+// Global ID for the Driver Diagnostics Protocol as defined in EFI 1.10.\r
+//\r
+#define EFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \\r
+  { \\r
+    0x0784924f, 0xe296, 0x11d4, {0x9a, 0x49, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+//\r
+// Global ID for the Driver Diagnostics Protocol as defined in UEFI 2.0.\r
+//\r
+#define UEFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \\r
+  { \\r
+    0x4d330321, 0x025f, 0x4aac, {0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63 } \\r
+  }\r
+  \r
+typedef struct _EFI_DRIVER_DIAGNOSTICS_PROTOCOL  EFI_DRIVER_DIAGNOSTICS_PROTOCOL;\r
+\r
+typedef enum {\r
+  EfiDriverDiagnosticTypeStandard     = 0,\r
+  EfiDriverDiagnosticTypeExtended     = 1,\r
+  EfiDriverDiagnosticTypeManufacturing= 2,\r
+  EfiDriverDiagnosticTypeMaximum\r
+} EFI_DRIVER_DIAGNOSTIC_TYPE;\r
+\r
+/**\r
+  Runs diagnostics on a controller.\r
+\r
+  @param  This             A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL instance.\r
+  @param  ControllerHandle The handle of the controller to run diagnostics on.\r
+  @param  ChildHandle      The handle of the child controller to run diagnostics on\r
+                           This is an optional parameter that may be NULL.  It will\r
+                           be NULL for device drivers.  It will also be NULL for a\r
+                           bus drivers that wish to run diagnostics on the bus\r
+                           controller.  It will not be NULL for a bus driver that\r
+                           wishes to run diagnostics on one of its child controllers.\r
+  @param  DiagnosticType   Indicates type of diagnostics to perform on the controller\r
+                           specified by ControllerHandle and ChildHandle.   See\r
+                           "Related Definitions" for the list of supported types.\r
+  @param  Language         A pointer to a three character ISO 639-2 language\r
+                           identifier.  This is the language in which the optional\r
+                           error message should be returned in Buffer, and it must\r
+                           match one of the languages specified in SupportedLanguages.\r
+                           The number of languages supported by a driver is up to\r
+                           the driver writer.\r
+  @param  ErrorType        A GUID that defines the format of the data returned in Buffer.\r
+  @param  BufferSize       The size, in bytes, of the data returned in Buffer.\r
+  @param  Buffer           A buffer that contains a Null-terminated Unicode string\r
+                           plus some additional data whose format is defined by\r
+                           ErrorType.  Buffer is allocated by this function with\r
+                           AllocatePool(), and it is the caller's responsibility\r
+                           to free it with a call to FreePool().\r
+\r
+  @retval EFI_SUCCESS           The controller specified by ControllerHandle and\r
+                                ChildHandle passed the diagnostic.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER ErrorType is NULL.\r
+  @retval EFI_INVALID_PARAMETER BufferType is NULL.\r
+  @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                running diagnostics for the controller specified\r
+                                by ControllerHandle and ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                type of diagnostic specified by DiagnosticType.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the\r
+                                language specified by Language.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to complete\r
+                                the diagnostics.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to return\r
+                                the status information in ErrorType, BufferSize,\r
+                                and Buffer.\r
+  @retval EFI_DEVICE_ERROR      The controller specified by ControllerHandle and\r
+                                ChildHandle did not pass the diagnostic.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_DRIVER_DIAGNOSTICS_RUN_DIAGNOSTICS) (\r
+  IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL                        *This,\r
+  IN  EFI_HANDLE                                            ControllerHandle,\r
+  IN  EFI_HANDLE                                            ChildHandle  OPTIONAL,\r
+  IN  EFI_DRIVER_DIAGNOSTIC_TYPE                            DiagnosticType,\r
+  IN  CHAR8                                                 *Language,\r
+  OUT EFI_GUID                                              **ErrorType,\r
+  OUT UINTN                                                 *BufferSize,\r
+  OUT CHAR16                                                **Buffer\r
+  );\r
+\r
+\r
+//\r
+//\r
+\r
+/**\r
+  Interface structure for the Driver Diagnostics Protocol.\r
+\r
+  @par Protocol Description:\r
+  Used to perform diagnostics on a controller that an EFI Driver is managing.\r
+\r
+  @param RunDiagnostics      Runs diagnostics on a controller.\r
+  @param SupportedLanguages  A Null-terminated ASCII string that contains one or more\r
+                             ISO 639-2 language codes.  This is the list of language \r
+                             codes that this protocol supports.\r
+\r
+**/\r
+struct _EFI_DRIVER_DIAGNOSTICS_PROTOCOL {\r
+  EFI_DRIVER_DIAGNOSTICS_RUN_DIAGNOSTICS  RunDiagnostics;\r
+  CHAR8                                   *SupportedLanguages;\r
+};\r
+\r
+extern EFI_GUID gEfiDriverDiagnosticsProtocolGuid;\r
+extern EFI_GUID gUefiDriverDiagnosticsProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/DriverSupportedEfiVersion.h b/MdePkg/Include/Protocol/DriverSupportedEfiVersion.h
new file mode 100644 (file)
index 0000000..84e30ef
--- /dev/null
@@ -0,0 +1,52 @@
+/** @file\r
+  The file provides information about the version of the EFI\r
+  specification that a driver is following. This protocol is\r
+  required for EFI drivers that are on PCI and other plug in\r
+  cards.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: DriverSupportedEfiVesrion.h\r
+\r
+**/\r
+\r
+#ifndef __DRIVER_SUPPORTED_EFI_VERSION_H__\r
+#define __DRIVER_SUPPORTED_EFI_VERSION_H__\r
+\r
+#define EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL_GUID  \\r
+  { 0x5c198761, 0x16a8, 0x4e69, { 0x97, 0x2c, 0x89, 0xd6, 0x79, 0x54, 0xf8, 0x1d } }\r
+\r
+\r
+/**\r
+  \r
+  The EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL provides a\r
+  mechanism for an EFI driver to publish the version of the EFI   \r
+  specification it conforms to. This protocol must be placed on   \r
+  the drivers image handle when the driver????s entry point is   \r
+  called.\r
+  \r
+  @param Length The size, in bytes, of the entire structure.\r
+                Future versions of this specification may grow\r
+                the size of the structure.\r
+  \r
+  @param irmwareVersion The version of the EFI specification\r
+                        that this driver conforms to.\r
+                        EFI_2_10_SYSTEM_TABLE_REVISION for this\r
+                        version of this specification.\r
+\r
+**/ \r
+typedef struct _EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL {\r
+  UINT32 Length;\r
+  UINT32 FirmwareVersion;\r
+} EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiDriverSupportedEfiVersionProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Ebc.h b/MdePkg/Include/Protocol/Ebc.h
new file mode 100644 (file)
index 0000000..c1abcba
--- /dev/null
@@ -0,0 +1,148 @@
+/** @file\r
+  Describes the protocol interface to the EBC interpreter.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Ebc.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_EBC_PROTOCOL_H__\r
+#define __EFI_EBC_PROTOCOL_H__\r
+\r
+#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \\r
+  { \\r
+    0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 } \\r
+  }\r
+\r
+//\r
+// Protocol Guid Name defined in spec.\r
+//\r
+#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID\r
+\r
+//\r
+// Define for forward reference.\r
+//\r
+typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL;\r
+\r
+/**\r
+  Create a thunk for an image entry point. In short, given the physical address\r
+  of the entry point for a loaded image, create a thunk that does some \r
+  fixup of arguments (and perform any other necessary overhead) and then\r
+  calls the original entry point. The caller can then use the returned pointer\r
+  to the created thunk as the new entry point to image.\r
+\r
+  @param  This          protocol instance pointer\r
+  @param  ImageHandle   handle to the image. The EBC interpreter may use this to keep\r
+                        track of any resource allocations performed in loading and\r
+                        executing the image.\r
+  @param  EbcEntryPoint the entry point for the image (as defined in the file header)\r
+  @param  Thunk pointer to thunk pointer where the address of the created\r
+                        thunk is returned.\r
+\r
+  @return Standard EFI_STATUS\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EBC_CREATE_THUNK) (\r
+  IN EFI_EBC_PROTOCOL           *This,\r
+  IN EFI_HANDLE                 ImageHandle,\r
+  IN VOID                       *EbcEntryPoint,\r
+  OUT VOID                      **Thunk\r
+  );\r
+\r
+/**\r
+  Perform any cleanup necessary when an image is unloaded. Basically it gives\r
+  the EBC interpreter the chance to free up any resources allocated during\r
+  load and execution of an EBC image.\r
+\r
+  @param  This        protocol instance pointer\r
+  @param  ImageHandle the handle of the image being unloaded.\r
+\r
+  @return Standard EFI_STATUS.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EBC_UNLOAD_IMAGE) (\r
+  IN EFI_EBC_PROTOCOL           *This,\r
+  IN EFI_HANDLE                 ImageHandle\r
+  );\r
+\r
+/**\r
+  The I-Cache-flush registration service takes a pointer to a function to\r
+  call to flush the I-Cache. Here's the prototype for that function pointer.\r
+\r
+  @param  Start  physical start address of CPU instruction cache to flush.\r
+  @param  Length how many bytes to flush of the instruction cache.\r
+\r
+  @return Standard EFI_STATUS.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EBC_ICACHE_FLUSH) (\r
+  IN EFI_PHYSICAL_ADDRESS     Start,\r
+  IN UINT64                   Length\r
+  );\r
+\r
+/**\r
+  This routine is called by the core firmware to provide the EBC driver with\r
+  a function to call to flush the CPU's instruction cache following creation\r
+  of a thunk. It is not required.\r
+\r
+  @param  This  protocol instance pointer\r
+  @param  Flush pointer to the function to call to flush the CPU instruction\r
+  cache.\r
+\r
+  @return Standard EFI_STATUS.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH) (\r
+  IN EFI_EBC_PROTOCOL           *This,\r
+  IN EBC_ICACHE_FLUSH           Flush\r
+  );\r
+\r
+/**\r
+  This routine can be called to get the VM revision. It returns the same\r
+  value as the EBC BREAK 1 instruction returns.\r
+\r
+  @param  This    protocol instance pointer\r
+  @param  Version pointer to where to return the VM version\r
+\r
+  @return Standard EFI_STATUS.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EBC_GET_VERSION) (\r
+  IN EFI_EBC_PROTOCOL           *This,\r
+  IN OUT UINT64                 *Version\r
+  );\r
+\r
+//\r
+// Prototype for the actual EBC protocol interface\r
+//\r
+struct _EFI_EBC_PROTOCOL {\r
+  EFI_EBC_CREATE_THUNK          CreateThunk;\r
+  EFI_EBC_UNLOAD_IMAGE          UnloadImage;\r
+  EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;\r
+  EFI_EBC_GET_VERSION           GetVersion;\r
+};\r
+\r
+//\r
+// Extern the global EBC protocol GUID\r
+//\r
+extern EFI_GUID gEfiEbcProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/EdidActive.h b/MdePkg/Include/Protocol/EdidActive.h
new file mode 100644 (file)
index 0000000..0562cbe
--- /dev/null
@@ -0,0 +1,34 @@
+/** @file\r
+  EDID Active Protocol from the UEFI 2.0 specification.\r
+\r
+  Placed on the video output device child handle that are actively displaying output.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  EdidActive.h\r
+\r
+**/\r
+\r
+#ifndef __EDID_ACTIVE_H__\r
+#define __EDID_ACTIVE_H__\r
+\r
+#define EFI_EDID_ACTIVE_PROTOCOL_GUID \\r
+  { \\r
+    0xbd8c1056, 0x9f36, 0x44ec, {0x92, 0xa8, 0xa6, 0x33, 0x7f, 0x81, 0x79, 0x86 } \\r
+  }\r
+\r
+typedef struct {\r
+  UINT32   SizeOfEdid;\r
+  UINT8    *Edid;\r
+} EFI_EDID_ACTIVE_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiEdidActiveProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/EdidDiscovered.h b/MdePkg/Include/Protocol/EdidDiscovered.h
new file mode 100644 (file)
index 0000000..6790666
--- /dev/null
@@ -0,0 +1,35 @@
+/** @file\r
+  EDID Discovered Protocol from the UEFI 2.0 specification.\r
+\r
+  This protocol is placed on the video output device child handle and it represents\r
+  the EDID information being used for output device represented by the child handle.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  EdidDiscovered.h\r
+\r
+**/\r
+\r
+#ifndef __EDID_DISCOVERED_H__\r
+#define __EDID_DISCOVERED_H__\r
+\r
+#define EFI_EDID_DISCOVERED_PROTOCOL_GUID \\r
+  { \\r
+    0x1c0c34f6, 0xd380, 0x41fa, {0xa0, 0x49, 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa } \\r
+  }\r
+\r
+typedef struct {\r
+  UINT32   SizeOfEdid;\r
+  UINT8    *Edid;\r
+} EFI_EDID_DISCOVERED_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiEdidDiscoveredProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/EdidOverride.h b/MdePkg/Include/Protocol/EdidOverride.h
new file mode 100644 (file)
index 0000000..3f4c576
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+  EDID Override Protocol from the UEFI 2.0 specification.\r
+\r
+  Allow platform to provide EDID information to producer of the Graphics Output\r
+  protocol.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  EdidOverride.h\r
+\r
+**/\r
+\r
+#ifndef __EDID_OVERRIDE_H__\r
+#define __EDID_OVERRIDE_H__\r
+\r
+#define EFI_EDID_OVERRIDE_PROTOCOL_GUID \\r
+  { \\r
+    0x48ecb431, 0xfb72, 0x45c0, {0xa9, 0x22, 0xf4, 0x58, 0xfe, 0x4, 0xb, 0xd5 } \\r
+  }\r
+\r
+typedef struct _EFI_EDID_OVERRIDE_PROTOCOL EFI_EDID_OVERRIDE_PROTOCOL;\r
+\r
+#define EFI_EDID_OVERRIDE_DONT_OVERRIDE   0x01\r
+#define EFI_EDID_OVERRIDE_ENABLE_HOT_PLUG 0x02\r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  ChildHandle       A child handle produced by the Graphics Output EFI\r
+                            driver that represents a video output device.\r
+  @param  Attributes        The attributes associated with ChildHandle video output device.\r
+  @param  EdidSize          A pointer to the size, in bytes, of the Edid buffer.\r
+  @param  Edid              A pointer to callee allocated buffer that contains the EDID that\r
+                            should be used for ChildHandle. A value of NULL\r
+                            represents no EDID override for ChildHandle.\r
+\r
+  @retval EFI_SUCCESS       Valid overrides returned for ChildHandle.\r
+  @retval EFI_UNSUPPORTED   ChildHandle has no overrides.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID) (\r
+  IN  EFI_EDID_OVERRIDE_PROTOCOL          *This,\r
+  IN  EFI_HANDLE                          *ChildHandle,\r
+  OUT UINT32                              *Attributes,\r
+  IN OUT UINTN                            *EdidSize,\r
+  IN OUT UINT8                            **Edid\r
+  )\r
+;\r
+\r
+struct _EFI_EDID_OVERRIDE_PROTOCOL {\r
+  EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID   GetEdid;\r
+};\r
+                                             \r
+extern EFI_GUID gEfiEdidOverrideProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/FirmwareVolume2.h b/MdePkg/Include/Protocol/FirmwareVolume2.h
new file mode 100644 (file)
index 0000000..f154f73
--- /dev/null
@@ -0,0 +1,787 @@
+/** @file\r
+  The Firmware Volume Protocol provides file-level access to the firmware volume. \r
+  Each firmware volume driver must produce an instance of the \r
+  Firmware Volume Protocol if the firmware volume is to be visible to\r
+  the system during the DXE phase. The Firmware Volume Protocol also provides\r
+  mechanisms for determining and modifying some attributes of the firmware volume.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  FirmwareVolume2.h\r
+\r
+  @par Revision Reference: PI\r
+  Version 1.00.\r
+\r
+**/\r
+\r
+#ifndef __FIRMWARE_VOLUME2_H__\r
+#define __FIRMWARE_VOLUME2_H__\r
+\r
+#define EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID \\r
+  { 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } }\r
+\r
+typedef struct _EFI_FIRMWARE_VOLUME2_PROTOCOL EFI_FIRMWARE_VOLUME2_PROTOCOL;\r
+\r
+\r
+//\r
+// EFI_FV_ATTRIBUTES\r
+//\r
+typedef UINT64  EFI_FV_ATTRIBUTES;\r
+\r
+//\r
+// EFI_FV_ATTRIBUTES bit definitions\r
+//\r
+// EFI_FV_ATTRIBUTES bit semantics\r
+#define EFI_FV2_READ_DISABLE_CAP        0x0000000000000001ULL\r
+#define EFI_FV2_READ_ENABLE_CAP         0x0000000000000002ULL\r
+#define EFI_FV2_READ_STATUS             0x0000000000000004ULL\r
+#define EFI_FV2_WRITE_DISABLE_CAP       0x0000000000000008ULL\r
+#define EFI_FV2_WRITE_ENABLE_CAP        0x0000000000000010ULL\r
+#define EFI_FV2_WRITE_STATUS            0x0000000000000020ULL\r
+#define EFI_FV2_LOCK_CAP                0x0000000000000040ULL\r
+#define EFI_FV2_LOCK_STATUS             0x0000000000000080ULL\r
+#define EFI_FV2_WRITE_POLICY_RELIABLE   0x0000000000000100ULL\r
+#define EFI_FV2_READ_LOCK_CAP           0x0000000000001000ULL\r
+#define EFI_FV2_READ_LOCK_STATUS        0x0000000000002000ULL\r
+#define EFI_FV2_WRITE_LOCK_CAP          0x0000000000004000ULL\r
+#define EFI_FV2_WRITE_LOCK_STATUS       0x0000000000008000ULL\r
+#define EFI_FV2_ALIGNMENT               0x00000000001F0000ULL\r
+#define EFI_FV2_ALIGNMENT_1             0x0000000000000000ULL\r
+#define EFI_FV2_ALIGNMENT_2             0x0000000000010000ULL\r
+#define EFI_FV2_ALIGNMENT_4             0x0000000000020000ULL\r
+#define EFI_FV2_ALIGNMENT_8             0x0000000000030000ULL\r
+#define EFI_FV2_ALIGNMENT_16            0x0000000000040000ULL\r
+#define EFI_FV2_ALIGNMENT_32            0x0000000000050000ULL\r
+#define EFI_FV2_ALIGNMENT_64            0x0000000000060000ULL\r
+#define EFI_FV2_ALIGNMENT_128           0x0000000000070000ULL\r
+#define EFI_FV2_ALIGNMENT_256           0x0000000000080000ULL\r
+#define EFI_FV2_ALIGNMENT_512           0x0000000000090000ULL\r
+#define EFI_FV2_ALIGNMENT_1K            0x00000000000A0000ULL\r
+#define EFI_FV2_ALIGNMENT_2K            0x00000000000B0000ULL\r
+#define EFI_FV2_ALIGNMENT_4K            0x00000000000C0000ULL\r
+#define EFI_FV2_ALIGNMENT_8K            0x00000000000D0000ULL\r
+#define EFI_FV2_ALIGNMENT_16K           0x00000000000E0000ULL\r
+#define EFI_FV2_ALIGNMENT_32K           0x00000000000F0000ULL\r
+#define EFI_FV2_ALIGNMENT_64K           0x0000000000100000ULL\r
+#define EFI_FV2_ALIGNMENT_128K          0x0000000000110000ULL\r
+#define EFI_FV2_ALIGNMENT_256K          0x0000000000120000ULL\r
+#define EFI_FV2_ALIGNMENT_512K          0x0000000000130000ULL\r
+#define EFI_FV2_ALIGNMENT_1M            0x0000000000140000ULL\r
+#define EFI_FV2_ALIGNMENT_2M            0x0000000000150000ULL\r
+#define EFI_FV2_ALIGNMENT_4M            0x0000000000160000ULL\r
+#define EFI_FV2_ALIGNMENT_8M            0x0000000000170000ULL\r
+#define EFI_FV2_ALIGNMENT_16M           0x0000000000180000ULL\r
+#define EFI_FV2_ALIGNMENT_32M           0x0000000000190000ULL\r
+#define EFI_FV2_ALIGNMENT_64M           0x00000000001A0000ULL\r
+#define EFI_FV2_ALIGNMENT_128M          0x00000000001B0000ULL\r
+#define EFI_FV2_ALIGNMENT_256M          0x00000000001C0000ULL\r
+#define EFI_FV2_ALIGNMENT_512M          0x00000000001D0000ULL\r
+#define EFI_FV2_ALIGNMENT_1G            0x00000000001E0000ULL\r
+#define EFI_FV2_ALIGNMENT_2G            0x00000000001F0000ULL\r
+\r
+/**\r
+  \r
+  Because of constraints imposed by the underlying firmware\r
+  storage, an instance of the Firmware Volume Protocol may not\r
+  be to able to support all possible variations of this\r
+  architecture. These constraints and the current state of the\r
+  firmware volume are exposed to the caller using the\r
+  GetVolumeAttributes() function. GetVolumeAttributes() is\r
+  callable only from EFI_TPL_NOTIFY and below. Behavior of\r
+  GetVolumeAttributes() at any EFI_TPL above EFI_TPL_NOTIFY is\r
+  undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI\r
+  2.0 specification.\r
+  \r
+  @param  This    Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+                  instance.\r
+  \r
+  @param  FvAttributes  Pointer to an EFI_FV_ATTRIBUTES in which\r
+                        the attributes and current settings are\r
+                        returned.\r
+\r
+\r
+  @retval EFI_SUCCESS   The firmware volume attributes were\r
+                        returned.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FV_GET_ATTRIBUTES) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  OUT       EFI_FV_ATTRIBUTES             *FvAttributes\r
+);\r
+\r
+\r
+/**\r
+  The SetVolumeAttributes() function is used to set configurable\r
+  firmware volume attributes. Only EFI_FV_READ_STATUS,\r
+  EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and\r
+   then only in accordance with the declared capabilities. All\r
+  other bits of FvAttributes are ignored on input. On successful\r
+  return, all bits of *FvAttributes are valid and it contains the\r
+  completed EFI_FV_ATTRIBUTES for the volume. To modify an\r
+  attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES\r
+  is set to the desired value on input. The EFI_FV_LOCK_STATUS bit\r
+  does not affect the ability to read or write the firmware\r
+  volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it\r
+  prevents further modification to all the attribute bits.\r
+  SetVolumeAttributes() is callable only from EFI_TPL_NOTIFY and\r
+  below. Behavior of SetVolumeAttributes() at any EFI_TPL above\r
+  EFI_TPL_NOTIFY is undefined. Type EFI_TPL is defined in\r
+  RaiseTPL() in the UEFI 2.0 specification.\r
+\r
+\r
+  @param  This  Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+                instance.\r
+  \r
+  @param  FvAttributes  On input, FvAttributes is a pointer to\r
+                        an EFI_FV_ATTRIBUTES containing the\r
+                        desired firmware volume settings. On\r
+                        successful return, it contains the new\r
+                        settings of the firmware volume. On\r
+                        unsuccessful return, FvAttributes is not\r
+                        modified and the firmware volume\r
+                        settings are not changed.\r
+  \r
+  @retval EFI_SUCCESS   The requested firmware volume attributes\r
+                        were set and the resulting\r
+                        EFI_FV_ATTRIBUTES is returned in\r
+                        FvAttributes.\r
+\r
+  @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS\r
+                                is set to 1 on input, but the\r
+                                device does not support enabling\r
+                                reads\r
+                                (FvAttributes:EFI_FV_READ_ENABLE\r
+                                is clear on return from\r
+                                GetVolumeAttributes()). Actual\r
+                                volume attributes are unchanged.\r
+\r
+  @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS\r
+                                is cleared to 0 on input, but\r
+                                the device does not support\r
+                                disabling reads\r
+                                (FvAttributes:EFI_FV_READ_DISABL\r
+                                is clear on return from\r
+                                GetVolumeAttributes()). Actual\r
+                                volume attributes are unchanged.\r
+\r
+  @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS\r
+                                is set to 1 on input, but the\r
+                                device does not support enabling\r
+                                writes\r
+                                (FvAttributes:EFI_FV_WRITE_ENABL\r
+                                is clear on return from\r
+                                GetVolumeAttributes()). Actual\r
+                                volume attributes are unchanged.\r
+\r
+  @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS\r
+                                is cleared to 0 on input, but\r
+                                the device does not support\r
+                                disabling writes\r
+                                (FvAttributes:EFI_FV_WRITE_DISAB\r
+                                is clear on return from\r
+                                GetVolumeAttributes()). Actual\r
+                                volume attributes are unchanged.\r
+\r
+  @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS\r
+                                is set on input, but the device\r
+                                does not support locking\r
+                                (FvAttributes:EFI_FV_LOCK_CAP is\r
+                                clear on return from\r
+                                GetVolumeAttributes()). Actual\r
+                                volume attributes are unchanged.\r
+\r
+  @retval EFI_ACCESS_DENIED     Device is locked and does not\r
+                                allow attribute modification\r
+                                (FvAttributes:EFI_FV_LOCK_STATUS\r
+                                is set on return from\r
+                                GetVolumeAttributes()). Actual\r
+                                volume attributes are unchanged.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FV_SET_ATTRIBUTES) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN OUT    EFI_FV_ATTRIBUTES             *FvAttributes\r
+);\r
+\r
+\r
+/**\r
+  ReadFile() is used to retrieve any file from a firmware volume\r
+  during the DXE phase. The actual binary encoding of the file in\r
+  the firmware volume media may be in any arbitrary format as long\r
+  as it does the following: ?It is accessed using the Firmware\r
+  Volume Protocol. ?The image that is returned follows the image\r
+  format defined in Code Definitions: PI Firmware File Format.\r
+  If the input value of Buffer==NULL, it indicates the caller is\r
+  requesting only that the type, attributes, and size of the\r
+  file be returned and that there is no output buffer. In this\r
+  case, the following occurs:\r
+  - BufferSize is returned with the size that is required to\r
+    successfully complete the read.\r
+  - The output parameters FoundType and *FileAttributes are\r
+  returned with valid values.\r
+  - The returned value of *AuthenticationStatus is undefined.\r
+\r
+  If the input value of Buffer!=NULL, the output buffer is\r
+  specified by a double indirection of the Buffer parameter. The\r
+  input value of *Buffer is used to determine if the output\r
+  buffer is caller allocated or is dynamically allocated by\r
+  ReadFile(). If the input value of *Buffer!=NULL, it indicates\r
+  the output buffer is caller allocated. In this case, the input\r
+   value of *BufferSize indicates the size of the\r
+  caller-allocated output buffer. If the output buffer is not\r
+  large enough to contain the entire requested output, it is\r
+  filled up to the point that the output buffer is exhausted and\r
+  EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is\r
+   returned with the size required to successfully complete the\r
+  read. All other output parameters are returned with valid\r
+  values. If the input value of *Buffer==NULL, it indicates the\r
+  output buffer is to be allocated by ReadFile(). In this case,\r
+  ReadFile() will allocate an appropriately sized buffer from\r
+  boot services pool memory, which will be returned in Buffer.\r
+  The size of the new buffer is returned in BufferSize and all\r
+  other output parameters are returned with valid values.\r
+  ReadFile() is callable only from EFI_TPL_NOTIFY and below.\r
+  Behavior of ReadFile() at any EFI_TPL above EFI_TPL_NOTIFY is\r
+  undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI\r
+  2.0 specification.\r
+  \r
+  @param  This  Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+                instance.\r
+  \r
+  @param  NameGuid  Pointer to an EFI_GUID, which is the file\r
+                    name. All firmware file names are EFI_GUIDs.\r
+                    A single firmware volume must not have two\r
+                    valid files with the same file name\r
+                    EFI_GUID.\r
+  \r
+  @param  Buffer  Pointer to a pointer to a buffer in which the\r
+                  file contents are returned, not including the\r
+                  file header.\r
+  @param  BufferSize  Pointer to a caller-allocated UINTN. It\r
+                      indicates the size of the memory\r
+                      represented by Buffer.\r
+  \r
+  @param  FoundType   Pointer to a caller-allocated\r
+                      EFI_FV_FILETYPE.\r
+  \r
+  @param  FileAttributes  Pointer to a  caller-allocated\r
+                          EFI_FV_FILE_ATTRIBUTES.\r
+  \r
+  @param  AuthenticationStatus  Pointer to a caller-allocated\r
+                                UINT32 in which the\r
+                                authentication status is\r
+                                returned.\r
+  \r
+  @retval EFI_SUCCESS   The call completed successfully.\r
+  \r
+  @retval EFI_WARN_BUFFER_TOO_SMALL   The buffer is too small to\r
+                                      contain the requested\r
+                                      output. The buffer is\r
+                                      filled and the output is\r
+                                      truncated.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  An allocation failure occurred.\r
+\r
+  @retavl EFI_NOT_FOUND   Name was not found in the firmware\r
+                          volume.\r
+\r
+  @retval EFI_DEVICE_ERROR  A hardware error occurred when\r
+                            attempting to access the firmware\r
+                            volume.\r
+\r
+  @retval EFI_ACCESS_DENIED The firmware volume is configured to\r
+                            isallow reads.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FV_READ_FILE) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN CONST  EFI_GUID                      *NameGuid,\r
+  IN OUT    VOID                          **Buffer,\r
+  IN OUT    UINTN                         *BufferSize,\r
+  OUT       EFI_FV_FILETYPE               *FoundType,\r
+  OUT       EFI_FV_FILE_ATTRIBUTES        *FileAttributes,\r
+  OUT       UINT32                        *AuthenticationStatus\r
+);\r
+\r
+\r
+\r
+/**\r
+  ReadSection() is used to retrieve a specific section from a file\r
+  within a firmware volume. The section returned is determined\r
+  using a depth-first, left-to-right search algorithm through all\r
+  sections found in the specified file. See\r
+   ????Firmware File Sections???? on page 9 for more details about\r
+  sections. The output buffer is specified by a double indirection\r
+  of the Buffer parameter. The input value of Buffer is used to\r
+  determine if the output buffer is caller allocated or is\r
+  dynamically allocated by ReadSection(). If the input value of\r
+  Buffer!=NULL, it indicates that the output buffer is caller\r
+  allocated. In this case, the input value of *BufferSize\r
+  indicates the size of the caller-allocated output buffer. If\r
+  the output buffer is not large enough to contain the entire\r
+  requested output, it is filled up to the point that the output\r
+  buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned,\r
+  and then BufferSize is returned with the size that is required\r
+  to successfully complete the read. All other\r
+  output parameters are returned with valid values. If the input\r
+  value of *Buffer==NULL, it indicates the output buffer is to\r
+  be allocated by ReadSection(). In this case, ReadSection()\r
+  will allocate an appropriately sized buffer from boot services\r
+  pool memory, which will be returned in *Buffer. The size of\r
+  the new buffer is returned in *BufferSize and all other output\r
+  parameters are returned with valid values. ReadSection() is\r
+  callable only from EFI_TPL_NOTIFY and below. Behavior of\r
+  ReadSection() at any EFI_TPL above EFI_TPL_NOTIFY is\r
+  undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI\r
+  2.0 specification.\r
+\r
+\r
+  @param This   Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+                instance.\r
+  \r
+  @param NameGuid   Pointer to an EFI_GUID, which indicates the\r
+                    file name from which the requested section\r
+                    will be read.\r
+  \r
+  @param SectionType  Indicates the section type to return.\r
+                      SectionType in conjunction with\r
+                      SectionInstance indicates which section to\r
+                      return.\r
+  \r
+  @param SectionInstance  Indicates which instance of sections\r
+                          with a type of SectionType to return.\r
+                          SectionType in conjunction with\r
+                          SectionInstance indicates which\r
+                          section to return. SectionInstance is\r
+                          zero based.\r
+  \r
+  @param Buffer   Pointer to a pointer to a buffer in which the\r
+                  section contents are returned, not including\r
+                  the section header.\r
+  \r
+  @param BufferSize   Pointer to a caller-allocated UINTN. It\r
+                      indicates the size of the memory\r
+                      represented by Buffer.\r
+  \r
+  @param AuthenticationStatus Pointer to a caller-allocated\r
+                              UINT32 in which the authentication\r
+                              status is returned.\r
+  \r
+  \r
+  @retval EFI_SUCCESS   The call completed successfully.\r
+  \r
+  @retval EFI_WARN_BUFFER_TOO_SMALL   The caller-allocated\r
+                                      buffer is too small to\r
+                                      contain the requested\r
+                                      output. The buffer is\r
+                                      filled and the output is\r
+                                      truncated.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  An allocation failure occurred.\r
+  \r
+  @retval EFI_NOT_FOUND   The requested file was not found in\r
+                          the firmware volume. EFI_NOT_FOUND The\r
+                          requested section was not found in the\r
+                          specified file.\r
+  \r
+  @retval EFI_DEVICE_ERROR  A hardware error occurred when\r
+                            attempting to access the firmware\r
+                            volume.\r
+  \r
+  @retval EFI_ACCESS_DENIED The firmware volume is configured to\r
+                            disallow reads. EFI_PROTOCOL_ERROR\r
+                            The requested section was not found,\r
+                            but the file could not be fully\r
+                            parsed because a required\r
+                            GUIDED_SECTION_EXTRACTION_PROTOCOL\r
+                            was not found. It is possible the\r
+                            requested section exists within the\r
+                            file and could be successfully\r
+                            extracted once the required\r
+                            GUIDED_SECTION_EXTRACTION_PROTOCOL\r
+                            is published.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FV_READ_SECTION) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN CONST  EFI_GUID                      *NameGuid,\r
+  IN CONST  EFI_SECTION_TYPE              SectionType,\r
+  IN CONST  UINTN                         SectionInstance,\r
+  IN OUT    VOID                          **Buffer,\r
+  IN OUT    UINTN                         *BufferSize,\r
+  OUT       UINT32                        *AuthenticationStatus\r
+);\r
+\r
+//\r
+// EFI_FV_WRITE_POLICY\r
+//\r
+typedef UINT32 EFI_FV_WRITE_POLICY;\r
+#define EFI_FV_UNRELIABLE_WRITE   0x00000000\r
+#define EFI_FV_RELIABLE_WRITE     0x00000001\r
+\r
+//\r
+// EFI_FV_WRITE_FILE_DATA\r
+//\r
+typedef struct {\r
+  EFI_GUID                *NameGuid;\r
+  EFI_FV_FILETYPE         Type;\r
+  EFI_FV_FILE_ATTRIBUTES  FileAttributes;\r
+  VOID                    *Buffer;\r
+  UINT32                  BufferSize;\r
+} EFI_FV_WRITE_FILE_DATA;\r
+\r
+/**\r
+  WriteFile() is used to write one or more files to a firmware\r
+  volume. Each file to be written is described by an\r
+  EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that\r
+  any required alignment for all files listed in the FileData\r
+  array is compatible with the firmware volume. Firmware volume\r
+  capabilities can be determined using the GetVolumeAttributes()\r
+  call. Similarly, if the WritePolicy is set to\r
+  EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume\r
+  capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the\r
+  firmware volume. EFI_FV_UNRELIABLE_WRITE must always be\r
+  supported. Writing a file with a size of zero\r
+  (FileData[n].BufferSize == 0) deletes the file from the firmware\r
+  volume if it exists. Deleting a file must be done one at a time.\r
+  Deleting a file as part of a multiple file write is not allowed.\r
+  Platform Initialization Specification VOLUME 3 Shared\r
+  Architectural Elements 84 August 21, 2006 Version 1.0\r
+  WriteFile() is callable only from EFI_TPL_NOTIFY and below.\r
+  Behavior of WriteFile() at any EFI_TPL above EFI_TPL_NOTIFY is\r
+  undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0\r
+  specification.\r
+\r
+  @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+              instance. NumberOfFiles Indicates the number of\r
+              elements in the array pointed to by FileData.\r
+\r
+\r
+  @param WritePolicy  Indicates the level of reliability for the\r
+                      write in the event of a power failure or\r
+                      other system failure during the write\r
+                      operation.\r
+\r
+  @param FileData   Pointer to an array of\r
+                    EFI_FV_WRITE_FILE_DATA. Each element of\r
+                    FileData[] represents a file to be written.\r
+\r
+\r
+  @retval EFI_SUCCESS The write completed successfully.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  The firmware volume does not\r
+                                have enough free space to\r
+                                storefile(s).\r
+  \r
+  @retval EFI_DEVICE_ERROR  A hardware error occurred when\r
+                            attempting to access the firmware volume.\r
+  \r
+  @retval EFI_WRITE_PROTECTED   The firmware volume is\r
+                                configured to disallow writes.\r
+  \r
+  @retval EFI_NOT_FOUND   A delete was requested, but the\r
+                          requested file was not found in the\r
+                          firmware volume.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   A delete was requested with a\r
+                                  multiple file write.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   An unsupported WritePolicy was\r
+                                  requested.\r
+\r
+  @retval EFI_INVALID_PARAMETER   An unknown file type was\r
+                                  specified.\r
+\r
+  @retval EFI_INVALID_PARAMETER   A file system specific error\r
+                                  has occurred.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS \r
+(EFIAPI * EFI_FV_WRITE_FILE) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN CONST  UINT32                        NumberOfFiles,\r
+  IN CONST  EFI_FV_WRITE_POLICY           WritePolicy,\r
+  IN CONST  EFI_FV_WRITE_FILE_DATA        *FileData\r
+);\r
+\r
+\r
+/**\r
+  GetNextFile() is the interface that is used to search a firmware\r
+  volume for a particular file. It is called successively until\r
+  the desired file is located or the function returns\r
+   EFI_NOT_FOUND. To filter uninteresting files from the output,\r
+  the type of file to search for may be specified in FileType. For\r
+  example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of\r
+  this type will be returned in the output. If *FileType is\r
+  EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key\r
+  parameter is used to indicate a starting point of the search. If\r
+  the buffer *Key is completely initialized to zero, the search\r
+  re-initialized and starts at the beginning. Subsequent calls to\r
+  GetNextFile() must maintain the value of *Key returned by the\r
+  immediately previous call. The actual contents of *Key are\r
+  implementation specific and no semantic content is implied.\r
+  GetNextFile() is callable only from EFI_TPL_NOTIFY and below.\r
+  Behavior of GetNextFile() at any EFI_TPL above EFI_TPL_NOTIFY is\r
+  undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0\r
+  specification. Status Codes Returned\r
+\r
+\r
+  @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+              instance. Key Pointer to a caller-allocated buffer\r
+              that contains implementation-specific data that is\r
+              used to track where to begin the search for the\r
+              next file. The size of the buffer must be at least\r
+              This->KeySize bytes long. To re-initialize the\r
+              search and begin from the beginning of the\r
+              firmware volume, the entire buffer must be cleared\r
+              to zero. Other than clearing the buffer to\r
+              initiate a new search, the caller must not modify\r
+              the data in the buffer between calls to\r
+              GetNextFile().\r
+\r
+  @param FileType   Pointer to a caller-allocated\r
+                    EFI_FV_FILETYPE. The GetNextFile() API can\r
+                    filter its search for files based on the\r
+                    value of the FileType input. A *FileType\r
+                    input of EFI_FV_FILETYPE_ALL causes\r
+                    GetNextFile() to search for files of all\r
+                    types. If a file is found, the file's type\r
+                    is returned in FileType. *FileType is not\r
+                    modified if no file is found.\r
+\r
+  @param NameGuid   Pointer to a caller-allocated EFI_GUID. If a\r
+                    matching file is found, the file's name is\r
+                    returned in NameGuid. If no matching file is\r
+                    found, *NameGuid is not modified.\r
+\r
+  @param Attributes Pointer to a caller-allocated\r
+                    EFI_FV_FILE_ATTRIBUTES. If a matching file\r
+                    is found, the file's attributes are returned\r
+                    in Attributes. If no matching file is found,\r
+                    Attributes is not modified. Type\r
+                    EFI_FV_FILE_ATTRIBUTES is defined in\r
+                    ReadFile().\r
+\r
+  @param Size   Pointer to a caller-allocated UINTN. If a\r
+                matching file is found, the file's size is\r
+                returned in *Size. If no matching file is found,\r
+                Size is not modified.\r
+\r
+  @retval EFI_SUCCESS The output parameters are filled with data\r
+                      obtained from the first matching file that\r
+                      was found.\r
+\r
+  @retval FI_NOT_FOUND  No files of type FileType were found.\r
+\r
+\r
+  @retval EFI_DEVICE_ERROR  A hardware error occurred when\r
+                            attempting to access the firmware\r
+                            volume.\r
+\r
+  @retval EFI_ACCESS_DENIED The firmware volume is configured to\r
+                            disallow reads.\r
+\r
+   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FV_GET_NEXT_FILE) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN OUT    VOID                          *Key,\r
+  IN OUT    EFI_FV_FILETYPE               *FileType,\r
+  OUT       EFI_GUID                      *NameGuid,\r
+  OUT       EFI_FV_FILE_ATTRIBUTES        *Attributes,\r
+  OUT       UINTN                         *Size\r
+);\r
+\r
+/**\r
+  The GetInfo() function returns information of type\r
+  InformationType for the requested firmware volume. If the volume\r
+  does not support the requested information type, then\r
+  EFI_UNSUPPORTED is returned. If the buffer is not large enough\r
+  to hold the requested structure, EFI_BUFFER_TOO_SMALL is\r
+  returned and the BufferSize is set to the size of buffer that is\r
+  required to make the request. The information types defined by\r
+  this specification are required information types that all file\r
+  systems must support.\r
+\r
+  @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+              instance that is the file handle the requested\r
+              information is for.\r
+  \r
+  @param InformationType  The type identifier for the\r
+                          information being requested.\r
+  \r
+  @param BufferSize   On input, the size of Buffer. On output,\r
+                      the amount of data returned in Buffer. In\r
+                      both cases, the size is measured in bytes.\r
+  \r
+  @param Buffer   A pointer to the data buffer to return. The\r
+                  buffer's type is indicated by InformationType.\r
+  \r
+  \r
+  @retval EFI_SUCCESS   The information was retrieved.\r
+  \r
+  @retval EFI_UNSUPPORTED   The InformationType is not known.\r
+  \r
+  @retval EFI_NO_MEDIA  The device has no medium.\r
+  \r
+  @retval EFI_DEVICE_ERROR  The device reported an error.\r
+  \r
+  @retval EFI_VOLUME_CORRUPTED  The file system structures are\r
+                                corrupted.\r
+  \r
+  @retval EFI_BUFFER_TOO_SMALL  The BufferSize is too small to\r
+                                read the current directory\r
+                                entry. BufferSize has been\r
+                                updated with the size needed to\r
+                                complete the request.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_GET_INFO) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN CONST  EFI_GUID                      *InformationType,\r
+  IN OUT    UINTN                         *BufferSize,\r
+  OUT       VOID                          *Buffer\r
+);\r
+\r
+\r
+/**\r
+\r
+  The SetInfo() function sets information of type InformationType\r
+  on the requested firmware volume.\r
+\r
+\r
+  @param This   A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
+                instance that is the file handle the information\r
+                is for.\r
+\r
+  @param InformationType  The type identifier for the\r
+                          information being set.\r
+\r
+  @param BufferSize   The size, in bytes, of Buffer.\r
+\r
+  @param Buffer A pointer to the data buffer to write. The\r
+                buffer's type is indicated by InformationType.\r
+\r
+  @retval EFI_SUCCESS The information was set.\r
+\r
+  @retval EFI_UNSUPPORTED The InformationType is not known.\r
+\r
+  @retval EFI_NO_MEDIA  The device has no medium.\r
+\r
+  @retval EFI_DEVICE_ERROR  The device reported an error.\r
+\r
+  @retval EFI_VOLUME_CORRUPTED  The file system structures are\r
+                                corrupted.\r
+\r
+\r
+  @retval EFI_WRITE_PROTECTED The media is read only.\r
+\r
+  @retval EFI_VOLUME_FULL   The volume is full.\r
+\r
+  @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the\r
+                              size of the type indicated by\r
+                              InformationType.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FV_SET_INFO) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN CONST  EFI_GUID                      *InformationType,\r
+  IN        UINTN                         BufferSize,\r
+  IN CONST  VOID                          *Buffer\r
+);\r
+\r
+\r
+/**\r
+  The Firmware Volume Protocol contains the file-level\r
+  abstraction to the firmware volume as well as some firmware\r
+  volume attribute reporting and configuration services. The\r
+  Firmware Volume Protocol is the interface used by all parts of\r
+  DXE that are not directly involved with managing the firmware\r
+  volume itself. This abstraction allows many varied types of\r
+  firmware volume implementations. A firmware volume may be a\r
+  flash device or it may be a file in the UEFI system partition,\r
+  for example. This level of firmware volume implementation\r
+  detail is not visible to the consumers of the Firmware Volume\r
+  Protocol.\r
+\r
+  @param  GetVolumeAttributes   Retrieves volume capabilities\r
+                                and current settings. See the\r
+                                GetVolumeAttributes() function\r
+                                description.\r
+\r
+  @param  SetVolumeAttributes   Modifies the current settings of\r
+                                the firmware volume. See the\r
+                                SetVolumeAttributes() function\r
+                                description.\r
+\r
+  @param  ReadFile  Reads an entire file from the firmware\r
+                    volume. See the ReadFile() function\r
+                    description.\r
+\r
+  @param  ReadSection   Reads a single section from a file into\r
+                        a buffer.\r
+\r
+  @param  WriteFile   Writes an entire file into the firmware\r
+                      volume. See the WriteFile() function\r
+                      description.\r
+\r
+  @param  GetNextFile Provides service to allow searching the\r
+                      firmware volume. See the GetNextFile()\r
+                      function description.\r
+\r
+  @param  KeySize   Data field that indicates the size in bytes\r
+                    of the Key input buffer for the\r
+                    GetNextFile() API.\r
+\r
+  @param  ParentHandle  Handle of the parent firmware volume.\r
+                        Type EFI_HANDLE is defined in\r
+                        InstallProtocolInterface() in the UEFI\r
+                        2.0 specification.\r
+\r
+  @param  GetInfo   Gets the requested file or volume\r
+                    information. See the GetInfo() function\r
+                    description.\r
+  @param  SetInfo   Sets the requested file information. See the\r
+                    SetInfo() function description.\r
+\r
+**/\r
+struct _EFI_FIRMWARE_VOLUME2_PROTOCOL {\r
+  EFI_FV_GET_ATTRIBUTES   GetVolumeAttributes;\r
+  EFI_FV_SET_ATTRIBUTES   SetVolumeAttributes;\r
+  EFI_FV_READ_FILE        ReadFile;\r
+  EFI_FV_READ_SECTION     ReadSection;\r
+  EFI_FV_WRITE_FILE       WriteFile;\r
+  EFI_FV_GET_NEXT_FILE    GetNextFile;\r
+  UINT32                  KeySize;\r
+  EFI_HANDLE              ParentHandle;\r
+  EFI_FV_GET_INFO         GetInfo;\r
+  EFI_FV_SET_INFO         SetInfo;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiFirmwareVolume2ProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/FirmwareVolumeBlock.h b/MdePkg/Include/Protocol/FirmwareVolumeBlock.h
new file mode 100644 (file)
index 0000000..2e85222
--- /dev/null
@@ -0,0 +1,428 @@
+/** @file\r
+  This file provides control over block-oriented firmware devices.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  FirmwareVolumeBlock.h\r
+\r
+  @par Revision Reference: PI\r
+  Version 1.00.\r
+\r
+**/\r
+\r
+#ifndef __FIRMWARE_VOLUME_BLOCK_H__\r
+#define __FIRMWARE_VOLUME_BLOCK_H__\r
+\r
+\r
+#define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \\r
+  { 0xDE28BC59, 0x6228, 0x41BD, 0xBD, {0xF6, 0xA3, 0xB9, 0xAD,0xB5, 0x8D, 0xA1 } }\r
+\r
+\r
+typedef struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL;\r
+\r
+/**\r
+  The GetAttributes() function retrieves the attributes and\r
+  current settings of the block. Status Codes Returned\r
+\r
+  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+                instance.\r
+\r
+  @param Attributes Pointer to EFI_FVB_ATTRIBUTES in which the\r
+                    attributes and current settings are\r
+                    returned. Type EFI_FVB_ATTRIBUTES is defined\r
+                    in EFI_FIRMWARE_VOLUME_HEADER.\r
+\r
+  @retval EFI_SUCCESS The firmware volume attributes were\r
+                      returned.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FVB_GET_ATTRIBUTES) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  OUT       EFI_FVB_ATTRIBUTES                  *Attributes\r
+);\r
+\r
+\r
+/**\r
+  The SetAttributes() function sets configurable firmware volume\r
+  attributes and returns the new settings of the firmware volume.\r
+\r
+  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+                instance.\r
+\r
+  @param Attributes   On input, Attributes is a pointer to\r
+                      EFI_FVB_ATTRIBUTES that contains the\r
+                      desired firmware volume settings. On\r
+                      successful return, it contains the new\r
+                      settings of the firmware volume. Type\r
+                      EFI_FVB_ATTRIBUTES is defined in\r
+                      EFI_FIRMWARE_VOLUME_HEADER.\r
+\r
+  \r
+  @retval EFI_SUCCESS The firmware volume attributes were\r
+                      returned.\r
+\r
+  @retval EFI_INVALID_PARAMETER The attributes requested are in\r
+                                conflict with the capabilities\r
+                                as declared in the firmware\r
+                                volume header.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FVB_SET_ATTRIBUTES) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  IN OUT    EFI_FVB_ATTRIBUTES                  *Attributes\r
+);\r
+\r
+\r
+/**\r
+  The GetPhysicalAddress() function retrieves the base address of\r
+  a memory-mapped firmware volume. This function should be called\r
+  only for memory-mapped firmware volumes.\r
+\r
+  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+                nstance.\r
+  \r
+  @param Address  Pointer to a caller-allocated\r
+                  EFI_PHYSICAL_ADDRESS that, on successful\r
+                  return from GetPhysicalAddress(), contains the\r
+                  base address of the firmware volume. Type\r
+                  EFI_PHYSICAL_ADDRESS is defined in\r
+                  AllocatePages() in the UEFI 2.0 specification.\r
+  \r
+  @retval EFI_SUCCESS The firmware volume base address is\r
+                      returned.\r
+  \r
+  @retval EFI_NOT_SUPPORTED The firmware volume is not memory\r
+                            mapped.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FVB_GET_PHYSICAL_ADDRESS) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  OUT       EFI_PHYSICAL_ADDRESS                *Address\r
+);\r
+\r
+/**\r
+  The GetBlockSize() function retrieves the size of the requested\r
+  block. It also returns the number of additional blocks with\r
+  the identical size. The GetBlockSize() function is used to\r
+  retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER).\r
+\r
+\r
+  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+                instance.\r
+\r
+  @param Lba  Indicates the block for which to return the size.\r
+              Type EFI_LBA is defined in the BLOCK_IO Protocol\r
+              (section 11.6) in the UEFI 2.0 specification.\r
+\r
+  @param BlockSize  Pointer to a caller-allocated UINTN in which\r
+                    the size of the block is returned.\r
+\r
+  @param NumberOfBlocks Pointer to a caller-allocated UINTN in\r
+                        which the number of consecutive blocks,\r
+                        starting with Lba, is returned. All\r
+                        blocks in this range have a size of\r
+                        BlockSize.\r
+\r
+  \r
+  @retval EFI_SUCCESS The firmware volume base address is\r
+                      returned.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   The requested LBA is out of\r
+                                  range.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FVB_GET_BLOCK_SIZE) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  IN CONST  EFI_LBA                             Lba,\r
+  OUT       UINTN                               *BlockSize,\r
+  OUT       UINTN                               *NumberOfBlocks\r
+);\r
+\r
+\r
+/**\r
+  The Read() function reads the requested number of bytes from the\r
+  requested block and stores them in the provided buffer.\r
+  Implementations should be mindful that the firmware volume\r
+  might be in the ReadDisabled state. If it is in this state,\r
+  the Read() function must return the status code\r
+  EFI_ACCESS_DENIED without modifying the contents of the\r
+  buffer. The Read() function must also prevent spanning block\r
+  boundaries. If a read is requested that would span a block\r
+  boundary, the read must read up to the boundary but not\r
+  beyond. The output parameter NumBytes must be set to correctly\r
+  indicate the number of bytes actually read. The caller must be\r
+  aware that a read may be partially completed.\r
+\r
+  @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+              instance. Lba The starting logical block index\r
+              from which to read. Type EFI_LBA is defined in the\r
+              BLOCK_IO Protocol (section 11.6) in the UEFI 2.0\r
+              specification.\r
+\r
+  @param Offset Offset into the block at which to begin reading.\r
+\r
+  @param NumBytes Pointer to a UINTN. At entry, *NumBytes\r
+                  contains the total size of the buffer. At\r
+                  exit, *NumBytes contains the total number of\r
+                  bytes read.\r
+\r
+  @param Buffer   Pointer to a caller-allocated buffer that will\r
+                  be used to hold the data that is read.\r
+\r
+  @retval EFI_SUCCESS The firmware volume was read successfully\r
+                      and contents are in Buffer.\r
+  \r
+  @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA\r
+                              boundary. On output, NumBytes\r
+                              contains the total number of bytes\r
+                              returned in Buffer.\r
+  \r
+  @retval EFI_ACCESS_DENIED   The firmware volume is in the\r
+                              ReadDisabled state.\r
+  \r
+  @retval EFI_DEVICE_ERROR    The block device is not\r
+                              functioning correctly and could\r
+                              not be read.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FVB_READ) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  IN CONST  EFI_LBA                             Lba,\r
+  IN CONST  UINTN                               Offset,\r
+  IN OUT    UINTN                               *NumBytes,\r
+  OUT       UINT8                               *Buffer\r
+);\r
+\r
+\r
+\r
+/**\r
+  The Write() function writes the specified number of bytes from\r
+  the provided buffer to the specified block and offset. If the\r
+  firmware volume is sticky write, the caller must ensure that\r
+  all the bits of the specified range to write are in the\r
+  EFI_FVB_ERASE_POLARITY state before calling the Write()\r
+  function, or else the result will be unpredictable. This\r
+  unpredictability arises because, for a sticky-write firmware\r
+  volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY\r
+  state but it cannot flip it back again. In general, before\r
+  calling the Write() function, the caller should call the\r
+  EraseBlocks() function first to erase the specified block to\r
+  write. A block erase cycle will transition bits from the\r
+  (NOT)EFI_FVB_ERASE_POLARITY state back to the\r
+  EFI_FVB_ERASE_POLARITY state. Implementations should be\r
+  mindful that the firmware volume might be in the WriteDisabled\r
+  state. If it is in this state, the Write() function must\r
+  return the status code EFI_ACCESS_DENIED without modifying the\r
+  contents of the firmware volume. The Write() function must\r
+  also prevent spanning block boundaries. If a write is\r
+  requested that spans a block boundary, the write must store up\r
+  to the boundary but not beyond. The output parameter NumBytes\r
+  must be set to correctly indicate the number of bytes actually\r
+  written. The caller must be aware that a write may be\r
+  partially completed. All writes, partial or otherwise, must be\r
+  fully flushed to the hardware before the Write() service\r
+  returns.\r
+\r
+  @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+              instance.\r
+  \r
+  @param Lba  The starting logical block index to write to. Type\r
+              EFI_LBA is defined in the BLOCK_IO Protocol\r
+              (section 11.6) in the UEFI 2.0 specification.\r
+              Offset Offset into the block at which to begin\r
+              writing.\r
+  \r
+  @param NumBytes Pointer to a UINTN. At entry, *NumBytes\r
+                  contains the total size of the buffer. At\r
+                  exit, *NumBytes contains the total number of\r
+                  bytes actually written.\r
+  \r
+  @param Buffer Pointer to a caller-allocated buffer that\r
+                contains the source for the write.\r
+  \r
+  @retval EFI_SUCCESS The firmware volume was written\r
+                      successfully.\r
+  \r
+  @retval EFI_BAD_BUFFER_SIZE The write was attempted across an\r
+                              LBA boundary. On output, NumBytes\r
+                              contains the total number of bytes\r
+                              actually written.\r
+  \r
+  @retval EFI_ACCESS_DENIED   The firmware volume is in the\r
+                              WriteDisabled state.\r
+  \r
+  @retval EFI_DEVICE_ERROR    The block device is malfunctioning\r
+                              and could not be written.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FVB_WRITE) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  IN CONST  EFI_LBA                             Lba,\r
+  IN CONST  UINTN                               Offset,\r
+  IN OUT    UINTN                               *NumBytes,\r
+  IN CONST  UINT8                               *Buffer\r
+);\r
+\r
+\r
+\r
+\r
+//\r
+// EFI_LBA_LIST_TERMINATOR\r
+//\r
+#define EFI_LBA_LIST_TERMINATOR   0xFFFFFFFFFFFFFFFFULL\r
+\r
+\r
+/**\r
+  The EraseBlocks() function erases one or more blocks as denoted\r
+  by the variable argument list. The entire parameter list of\r
+  blocks must be verified before erasing any blocks. If a block is\r
+  requested that does not exist within the associated firmware\r
+  volume (it has a larger index than the last block of the\r
+  firmware volume), the EraseBlocks() function must return the\r
+  status code EFI_INVALID_PARAMETER without modifying the contents\r
+  of the firmware volume. Implementations should be mindful that\r
+  the firmware volume might be in the WriteDisabled state. If it\r
+  is in this state, the EraseBlocks() function must return the\r
+  status code EFI_ACCESS_DENIED without modifying the contents of\r
+  the firmware volume. All calls to EraseBlocks() must be fully\r
+  flushed to the hardware before the EraseBlocks() service\r
+  returns.\r
+\r
+  @param This   Indicates the EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL\r
+                instance.\r
+\r
+  @param ...    The variable argument list is a list of tuples.\r
+                Each tuple describes a range of LBAs to erase\r
+                and consists of the following:\r
+                - An EFI_LBA that indicates the starting LBA\r
+                - A UINTN that indicates the number of blocks to\r
+                  erase\r
+\r
+                The list is terminated with an\r
+                EFI_LBA_LIST_TERMINATOR. For example, the\r
+                following indicates that two ranges of blocks\r
+                (5-7 and 10-11) are to be erased: EraseBlocks\r
+                (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR);\r
+\r
+  @retval EFI_SUCCESS The erase request was successfully\r
+                      completed.\r
+  \r
+  @retval EFI_ACCESS_DENIED   The firmware volume is in the\r
+                              WriteDisabled state.\r
+  @retval EFI_DEVICE_ERROR  The block device is not functioning\r
+                            correctly and could not be written.\r
+                            The firmware device may have been\r
+                            partially erased.\r
+  @retval EFI_INVALID_PARAMETER One or more of the LBAs listed\r
+                                in the variable argument list do\r
+                                not exist in the firmware volume.  \r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_FVB_ERASE_BLOCKS) (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  ...\r
+);\r
+\r
+\r
+\r
+/**\r
+  The Firmware Volume Block Protocol is the low-level interface\r
+  to a firmware volume. File-level access to a firmware volume\r
+  should not be done using the Firmware Volume Block Protocol.\r
+  Normal access to a firmware volume must use the Firmware\r
+  Volume Protocol. Typically, only the file system driver that\r
+  produces the Firmware Volume Protocol will bind to the\r
+  Firmware Volume Block Protocol. The Firmware Volume Block\r
+  Protocol provides the following:\r
+  - Byte-level read/write functionality.\r
+  - Block-level erase functionality.\r
+  - It further exposes device-hardening features, such as may be\r
+    equired to protect the firmware from unwanted overwriting\r
+    and/or erasure.\r
+  - It is useful to layer a file system driver on top of the\r
+    Firmware Volume Block Protocol.\r
+\r
+  This file system driver produces the Firmware Volume Protocol,\r
+  which provides file-level access to a firmware volume. The\r
+  Firmware Volume Protocol abstracts the file system that is\r
+  used to format the firmware volume and the hardware\r
+  device-hardening features that may be present.\r
+\r
+\r
+  @param GetPhysicalAddress   Retrieves the memory-mapped\r
+                              address of the firmware volume.\r
+                              See the GetPhysicalAddress()\r
+                              function description. \r
+\r
+  @param GetBlockSize   Retrieves the size for a specific block.\r
+                        Also returns the number of consecutive\r
+                        similarly sized blocks. See the\r
+                        GetBlockSize() function description.\r
+\r
+  @param Read   Reads n bytes into a buffer from the firmware\r
+                volume hardware. See the Read() function\r
+                description.\r
+\r
+  @param Write  Writes n bytes from a buffer into the firmware\r
+                volume hardware. See the Write() function\r
+                description.\r
+\r
+  @param EraseBlocks  Erases specified block(s) and sets all\r
+                      values as indicated by the\r
+                      EFI_FVB_ERASE_POLARITY bit. See the\r
+                      EraseBlocks() function description. Type\r
+                      EFI_FVB_ERASE_POLARITY is defined in\r
+                      EFI_FIRMWARE_VOLUME_HEADER. ParentHandle\r
+                      Handle of the parent firmware volume. Type\r
+                      EFI_HANDLE is defined in\r
+                      InstallProtocolInterface() in the UEFI 2.0\r
+                      specification.\r
+  \r
+  @param GetAttributes Retrieves the current volume attributes.\r
+                       See the GetAttributes() function\r
+                       description.\r
+  \r
+  @param SetAttributes Sets the current volume attributes. See\r
+                       the SetAttributes() function description.\r
+  \r
+\r
+**/\r
+struct _EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL {\r
+  EFI_FVB_GET_ATTRIBUTES        GetAttributes;\r
+  EFI_FVB_SET_ATTRIBUTES        SetAttributes;\r
+  EFI_FVB_GET_PHYSICAL_ADDRESS  GetPhysicalAddress;\r
+  EFI_FVB_GET_BLOCK_SIZE        GetBlockSize;\r
+  EFI_FVB_READ                  Read;\r
+  EFI_FVB_WRITE                 Write;\r
+  EFI_FVB_ERASE_BLOCKS          EraseBlocks;\r
+  EFI_HANDLE                    ParentHandle;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiFirmwareVolumeBlockProtocolGuid;\r
+\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/FormBrowser.h b/MdePkg/Include/Protocol/FormBrowser.h
new file mode 100644 (file)
index 0000000..61d7e8f
--- /dev/null
@@ -0,0 +1,207 @@
+/** @file\r
+\r
+  The file provides services to call for drivers to leverage the\r
+  EFI configuration driver interface.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: FormBrowser.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_FORM_BROWSER_H__\r
+#define __EFI_FORM_BROWSER_H__\r
+\r
+\r
+#define EFI_FORM_BROWSER_PROTOCOL_GUID \\r
+  { 0xe5a1333e, 0xe1b4, 0x4e55, { 0xce, 0xeb, 0x35, 0xc3, 0xef, 0x13, 0x34, 0x43 } }\r
+\r
+\r
+typedef struct _EFI_FORM_BROWSER_PROTOCOL   EFI_FORM_BROWSER_PROTOCOL;\r
+\r
+\r
+\r
+/**\r
+   \r
+  @param LeftColumn   Value that designates the text column\r
+                      where the browser window will begin from\r
+                      the left-hand side of the screen\r
+                      RightColumn Value that designates the text\r
+                      column where the browser window will end\r
+                      on the right-hand side of the screen.\r
+\r
+  @param TopRow   Value that designates the text row from the\r
+                  top of the screen where the browser window\r
+                  will start.\r
+\r
+  @param BottomRow  Value that designates the text row from the\r
+                    bottom of the screen where the browser\r
+                    window will end. \r
+**/\r
+typedef struct {\r
+  UINTN   LeftColumn;\r
+  UINTN   RightColumn;\r
+  UINTN   TopRow;\r
+  UINTN   BottomRow;\r
+} EFI_SCREEN_DESCRIPTOR;\r
+\r
+/**\r
+   \r
+  This function is the primary interface to the internal\r
+  forms-based browser. By calling this routine, one is directing\r
+  the browser to use a variety of passed-in information or\r
+  primarily use the HII database as the source of information.\r
+\r
+  @param This   A pointer to the EFI_FORM_BROWSER_PROTOCOL\r
+                instance.\r
+\r
+  @param Handle   A pointer to an array of HII handles to\r
+                  display. This value should correspond to the\r
+                  value of the HII form package that is required\r
+                  to be displayed.\r
+\r
+  @param HandleCount  The number of handles in the array\r
+                      specified by Handle.\r
+\r
+  @param SingleUse  If FALSE, the browser operates as a standard\r
+                    forms processor and exits only when\r
+                    explicitly requested by the user. If TRUE,\r
+                    the browser will return immediately after\r
+                    processing the first user-generated\r
+                    selection.\r
+\r
+  @param ScreenDimensions   Allows the browser to be called so\r
+                            that it occupies a portion of the\r
+                            physical screen instead of\r
+                            dynamically determining the screen\r
+                            dimensions. If the input values\r
+                            violate the platform policy then the\r
+                            dimensions will be dynamically\r
+                            adjusted to comply.\r
+\r
+  @param ResetRequired  This BOOLEAN value will tell the caller\r
+                        if a reset is required based on the data\r
+                        that might have been changed. The\r
+                        ResetRequired parameter is primarily\r
+                        applicable for configuration\r
+                        applications, and is an optional\r
+                        parameter.\r
+\r
+  @retval EFI_SUCCESS   The function completed successfully\r
+  \r
+  @retval EFI_NOT_FOUND   The variable was not found.\r
+  \r
+  @retval EFI_BUFFER_TOO_SMALL  The DataSize is too small for\r
+                                the result. DataSize has been\r
+                                updated with the size needed to\r
+                                complete the request.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   One of the parameters has an\r
+                                  invalid value.\r
+  \r
+  @retval EFI_DEVICE_ERROR  The variable could not be saved due\r
+                            to a hardware failure.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SEND_FORM) (\r
+  IN CONST  EFI_FORM_BROWSER_PROTOCOL *This,\r
+  IN CONST  EFI_HII_HANDLE            *Handle,\r
+  IN CONST  UINTN                     HandleCount,\r
+  IN CONST  BOOLEAN                   SingleUse,\r
+  IN CONST  EFI_SCREEN_DESCRIPTOR     *ScreenDimensions, OPTIONAL\r
+  OUT       BOOLEAN                   *ResetRequired OPTIONAL\r
+);\r
+\r
+\r
+/**\r
+   \r
+  This routine is called by a routine which was called by the\r
+  browser. This routine called this service in the browser to\r
+  retrieve or set certain uncommitted state information.\r
+\r
+  @param This   A pointer to the EFI_FORM_BROWSER_PROTOCOL\r
+                instance.\r
+\r
+  @param ResultsDataSize  A pointer to the size of the buffer\r
+                          associated with ResultsData. \r
+\r
+  @param ResultsData  A string returned from an IFR browser or\r
+                      equivalent. The results string will have\r
+                      no routing information in them.\r
+\r
+  @param RetrieveData   A BOOLEAN field which allows an agent to\r
+                        retrieve (if RetrieveData = TRUE) data\r
+                        from the uncommitted browser state\r
+                        information or set (if RetrieveData =\r
+                        FALSE) data in the uncommitted browser\r
+                        state information.\r
+\r
+  @param VariableGuid   An optional field to indicate the target\r
+                        variable GUID name to use.\r
+\r
+  @param VariableName   An optional field to indicate the target\r
+                        human-readable variable name.\r
+\r
+\r
+  @retval EFI_SUCCESS   The results have been distributed or are\r
+                        awaiting distribution.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  The ResultsDataSize specified\r
+                                was too small to contain the\r
+                                results data.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_BROWSER_CALLBACK ) (\r
+  IN CONST  EFI_FORM_BROWSER_PROTOCOL *This,\r
+  IN OUT    UINTN                     *ResultsDataSize,\r
+  IN OUT    EFI_STRING                ResultsData,\r
+  IN CONST  BOOLEAN                   RetrieveData,\r
+  IN CONST  EFI_GUID                  *VariableGuid, OPTIONAL\r
+  IN CONST  CHAR16                    *VariableName OPTIONAL\r
+);\r
+\r
+/**\r
+   \r
+  This protocol is the interface to call for drivers to leverage\r
+  the EFI configuration driver interface.\r
+\r
+  @param SendForm   Provides direction to the configuration\r
+                    driver whether to use the HII database or to\r
+                    use a passed-in set of data. This functions\r
+                    also establishes a pointer to the calling\r
+                    driver's callback interface. See the\r
+                    SendForm() function description.\r
+\r
+  @param BrowserCallback  Routine used to expose internal\r
+                          configuration state of the browser.\r
+                          This is primarily used by callback\r
+                          handler routines which were called by\r
+                          the browser and in-turn need to get\r
+                          additional information from the\r
+                          browser itself. See the\r
+                          BrowserCallback() function\r
+                          description.\r
+\r
+**/\r
+struct _EFI_FORM_BROWSER_PROTOCOL {\r
+  EFI_SEND_FORM         SendForm;\r
+  EFI_BROWSER_CALLBACK  BrowserCallback;\r
+} ;\r
+\r
+\r
+extern EFI_GUID gEfiFormBrowserProtocolGuid;\r
+\r
+#endif\r
+\r
+\r
diff --git a/MdePkg/Include/Protocol/GraphicsOutput.h b/MdePkg/Include/Protocol/GraphicsOutput.h
new file mode 100644 (file)
index 0000000..1b4e1fc
--- /dev/null
@@ -0,0 +1,194 @@
+/** @file\r
+  Graphics Output Protocol from the UEFI 2.0 specification.\r
+\r
+  Abstraction of a very simple graphics device.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  GraphicsOutput.h\r
+\r
+**/\r
+\r
+#ifndef __GRAPHICS_OUTPUT_H__\r
+#define __GRAPHICS_OUTPUT_H__\r
+\r
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \\r
+  { \\r
+    0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \\r
+  }\r
+\r
+typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;\r
+\r
+typedef struct {\r
+  UINT32            RedMask;\r
+  UINT32            GreenMask;\r
+  UINT32            BlueMask;\r
+  UINT32            ReservedMask;\r
+} EFI_PIXEL_BITMASK;\r
+\r
+typedef enum {\r
+  PixelRedGreenBlueReserved8BitPerColor,\r
+  PixelBlueGreenRedReserved8BitPerColor,\r
+  PixelBitMask,\r
+  PixelBltOnly,\r
+  PixelFormatMax\r
+} EFI_GRAPHICS_PIXEL_FORMAT;\r
+\r
+typedef struct {\r
+  UINT32                     Version;\r
+  UINT32                     HorizontalResolution;\r
+  UINT32                     VerticalResolution;\r
+  EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;\r
+  EFI_PIXEL_BITMASK          PixelInformation;\r
+  UINT32                     PixelsPerScanLine;\r
+} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;\r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  ModeNumber The mode number to return information on.\r
+  @param  SizeOfInfo A pointer to the size, in bytes, of the Info buffer.\r
+  @param  Info       A pointer to callee allocated buffer that returns information about ModeNumber.\r
+\r
+  @retval EFI_SUCCESS           Mode information returned.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Info buffer was too small.\r
+  @retval EFI_DEVICE_ERROR      A hardware error occurred trying to retrieve the video mode.\r
+  @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()\r
+  @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (\r
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,\r
+  IN  UINT32                                ModeNumber,\r
+  OUT UINTN                                 *SizeOfInfo,\r
+  OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info\r
+  )\r
+;\r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  ModeNumber        The mode number to be set.\r
+\r
+  @retval EFI_SUCCESS       Graphics mode was changed.\r
+  @retval EFI_DEVICE_ERROR  The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED   ModeNumber is not supported by this device.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (\r
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
+  IN  UINT32                       ModeNumber\r
+  )\r
+;\r
+\r
+typedef struct {\r
+  UINT8 Blue;\r
+  UINT8 Green;\r
+  UINT8 Red;\r
+  UINT8 Reserved;\r
+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;\r
+\r
+typedef union {\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;\r
+  UINT32                        Raw;\r
+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;\r
+\r
+typedef enum {\r
+  EfiBltVideoFill,\r
+  EfiBltVideoToBltBuffer,\r
+  EfiBltBufferToVideo, \r
+  EfiBltVideoToVideo,\r
+  EfiGraphicsOutputBltOperationMax\r
+} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;\r
+\r
+/**\r
+  The following table defines actions for BltOperations:\r
+\r
+  <B>EfiBltVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY) \r
+  directly to every pixel of the video display rectangle \r
+  (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). \r
+  Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+\r
+  <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle \r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in \r
+  the BltBuffer rectangle (DestinationX, DestinationY ) \r
+  (DestinationX + Width, DestinationY + Height). If DestinationX or \r
+  DestinationY is not zero then Delta must be set to the length in bytes \r
+  of a row in the BltBuffer.\r
+\r
+  <B>EfiBltBufferToVideo</B> - Write data from the  BltBuffer rectangle \r
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the \r
+  video display rectangle (DestinationX, DestinationY) \r
+  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is \r
+  not zero then Delta must be set to the length in bytes of a row in the \r
+  BltBuffer.\r
+\r
+  <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)\r
+  (SourceX + Width, SourceY + Height) .to the video display rectangle \r
+  (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). \r
+  The BltBuffer and Delta  are not used in this mode.\r
+\r
+  @param  This         Protocol instance pointer.\r
+  @param  BltBuffer    Buffer containing data to blit into video buffer. This\r
+                       buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
+  @param  BltOperation Operation to perform on BlitBuffer and video memory\r
+  @param  SourceX      X coordinate of source for the BltBuffer.\r
+  @param  SourceY      Y coordinate of source for the BltBuffer.\r
+  @param  DestinationX X coordinate of destination for the BltBuffer.\r
+  @param  DestinationY Y coordinate of destination for the BltBuffer.\r
+  @param  Width        Width of rectangle in BltBuffer in pixels.\r
+  @param  Height       Hight of rectangle in BltBuffer in pixels.\r
+  @param  Delta        OPTIONAL\r
+\r
+  @retval EFI_SUCCESS           The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR      A hardware error occured writting to the video buffer.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (\r
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL            *This,\r
+  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL           *BltBuffer,   OPTIONAL\r
+  IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION       BltOperation,\r
+  IN  UINTN                                   SourceX,\r
+  IN  UINTN                                   SourceY,\r
+  IN  UINTN                                   DestinationX,\r
+  IN  UINTN                                   DestinationY,\r
+  IN  UINTN                                   Width,\r
+  IN  UINTN                                   Height,\r
+  IN  UINTN                                   Delta         OPTIONAL\r
+  );\r
+\r
+typedef struct {\r
+  UINT32                                 MaxMode;\r
+  UINT32                                 Mode;\r
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   *Info;\r
+  UINTN                                  SizeOfInfo;\r
+  EFI_PHYSICAL_ADDRESS                   FrameBufferBase;\r
+  UINTN                                  FrameBufferSize;\r
+} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;\r
+\r
+struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE  QueryMode;\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE    SetMode;\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT         Blt;\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE        *Mode;\r
+};\r
+\r
+extern EFI_GUID gEfiGraphicsOutputProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/GuidedSectionExtaction.h b/MdePkg/Include/Protocol/GuidedSectionExtaction.h
new file mode 100644 (file)
index 0000000..595bebc
--- /dev/null
@@ -0,0 +1,144 @@
+/** @file\r
+  If a GUID-defined section is encountered when doing section\r
+  extraction, the section extraction driver calls the appropriate\r
+  instance of the GUIDed Section Extraction Protocol to extract\r
+  the section stream contained therein.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  GuidedSectionExtaction.h\r
+\r
+  @par Revision Reference: PI\r
+  Version 1.00.\r
+\r
+**/\r
+\r
+#ifndef __GUID_SECTION_EXTRACTION_PROTOCOL_H__\r
+#define __GUID_SECTION_EXTRACTION_PROTOCOL_H__\r
+\r
+//\r
+// The protocol interface structures are identified by associating \r
+// them with a GUID. Each instance of a protocol with a given \r
+// GUID must have the same interface structure. While all instances \r
+// of the GUIDed Section Extraction Protocol must have the same \r
+// interface structure, they do not all have the same GUID. The \r
+// GUID that is associated with an instance of the GUIDed Section \r
+// Extraction Protocol is used to correlate it with the GUIDed \r
+// section type that it is intended to process. \r
+//\r
+\r
+typedef struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL;\r
+\r
+\r
+/**\r
+  The ExtractSection() function processes the input section and\r
+  allocates a buffer from the pool in which it returns the section\r
+  contents. If the section being extracted contains\r
+  authentication information (the section's\r
+  GuidedSectionHeader.Attributes field has the\r
+  EFI_GUIDED_SECTION_AUTH_STATUS_VALID bit set), the values\r
+  returned in AuthenticationStatus must reflect the results of\r
+  the authentication operation. Depending on the algorithm and\r
+  size of the encapsulated data, the time that is required to do\r
+  a full authentication may be prohibitively long for some\r
+  classes of systems. To indicate this, use\r
+  EFI_SECURITY_POLICY_PROTOCOL_GUID, which may be published by\r
+  the security policy driver (see the Platform Initialization\r
+  Driver Execution Environment Core Interface Specification for\r
+  more details and the GUID definition). If the\r
+  EFI_SECURITY_POLICY_PROTOCOL_GUID exists in the handle\r
+  database, then, if possible, full authentication should be\r
+  skipped and the section contents simply returned in the\r
+  OutputBuffer. In this case, the\r
+  EFI_AUTH_STATUS_PLATFORM_OVERRIDE bit AuthenticationStatus\r
+  must be set on return. ExtractSection() is callable only from\r
+  EFI_TPL_NOTIFY and below. Behavior of ExtractSection() at any\r
+  EFI_TPL above EFI_TPL_NOTIFY is undefined. Type EFI_TPL is\r
+  defined in RaiseTPL() in the UEFI 2.0 specification.\r
+\r
+  \r
+  @param This   Indicates the\r
+                EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.\r
+  \r
+  @param InputSection Buffer containing the input GUIDed section\r
+                      to be processed. OutputBuffer OutputBuffer\r
+                      is allocated from boot services pool\r
+                      memory and contains the new section\r
+                      stream. The caller is responsible for\r
+                      freeing this buffer.\r
+\r
+  @param OutputSize   A pointer to a caller-allocated UINTN in\r
+                      which the size of OutputBuffer allocation\r
+                      is stored. If the function returns\r
+                      anything other than EFI_SUCCESS, the value\r
+                      of OutputSize is undefined.\r
+\r
+  @param AuthenticationStatus A pointer to a caller-allocated\r
+                              UINT32 that indicates the\r
+                              authentication status of the\r
+                              output buffer. If the input\r
+                              section's\r
+                              GuidedSectionHeader.Attributes\r
+                              field has the\r
+                              EFI_GUIDED_SECTION_AUTH_STATUS_VAL\r
+                              bit as clear, AuthenticationStatus\r
+                              must return zero. Both local bits\r
+                              (19:16) and aggregate bits (3:0)\r
+                              in AuthenticationStatus are\r
+                              returned by ExtractSection().\r
+                              These bits reflect the status of\r
+                              the extraction operation. The bit\r
+                              pattern in both regions must be\r
+                              the same, as the local and\r
+                              aggregate authentication statuses\r
+                              have equivalent meaning at this\r
+                              level. If the function returns\r
+                              anything other than EFI_SUCCESS,\r
+                              the value of AuthenticationStatus\r
+                              is undefined.\r
+\r
+\r
+  @retval EFI_SUCCESS The InputSection was successfully\r
+                      processed and the section contents were\r
+                      returned.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  The system has insufficient\r
+                                resources to process the\r
+                                request.\r
+\r
+  @retval EFI_INVALID_PARAMETER The GUID in InputSection does\r
+                                not match this instance of the\r
+                                GUIDed Section Extraction\r
+                                Protocol.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXTRACT_GUIDED_SECTION)(\r
+  IN CONST  EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL  *This,\r
+  IN CONST  VOID                                    *InputSection,\r
+  OUT       VOID                                    **OutputBuffer,\r
+  OUT       UINTN                                   *OutputSize,\r
+  OUT       UINT32                                  *AuthenticationStatus\r
+);\r
+\r
+\r
+/**\r
+  \r
+  Takes the GUIDed section as input and produces the section\r
+  stream data. See the ExtractSection() function description.\r
+\r
+**/\r
+struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL {\r
+  EFI_EXTRACT_GUIDED_SECTION  ExtractSection;\r
+};\r
+\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Hash.h b/MdePkg/Include/Protocol/Hash.h
new file mode 100644 (file)
index 0000000..9355da4
--- /dev/null
@@ -0,0 +1,149 @@
+/** @file\r
+  EFI_HASH_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.\r
+  EFI_HASH_PROTOCOL as defined in UEFI 2.0.\r
+  The EFI Hash Service Binding Protocol is used to locate hashing services support \r
+  provided by a driver and create and destroy instances of the EFI Hash Protocol \r
+  so that a multiple drivers can use the underlying hashing services.\r
+  The EFI Service Binding Protocol defines the generic Service Binding Protocol functions.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Hash.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_HASH_PROTOCOL_H__\r
+#define __EFI_HASH_PROTOCOL_H__\r
+\r
+#define EFI_HASH_SERVICE_BINDING_PROTOCOL \\r
+  { \\r
+    0x42881c98, 0xa4f3, 0x44b0, {0xa3, 0x9d, 0xdf, 0xa1, 0x86, 0x67, 0xd8, 0xcd } \\r
+  }\r
+  \r
+#define EFI_HASH_PROTOCOL_GUID \\r
+  { \\r
+    0xc5184932, 0xdba5, 0x46db, {0xa5, 0xba, 0xcc, 0x0b, 0xda, 0x9c, 0x14, 0x35 } \\r
+  }\r
+\r
+#define EFI_HASH_ALGORITHM_SHA1_GUID \\r
+  { \\r
+    0x2ae9d80f, 0x3fb2, 0x4095, {0xb7, 0xb1, 0xe9, 0x31, 0x57, 0xb9, 0x46, 0xb6 } \\r
+  }\r
+\r
+#define EFI_HASH_ALGORITHM_SHA224_GUID \\r
+  { \\r
+    0x8df01a06, 0x9bd5, 0x4bf7, {0xb0, 0x21, 0xdb, 0x4f, 0xd9, 0xcc, 0xf4, 0x5b } \\r
+  } \r
+\r
+#define EFI_HASH_ALGORITHM_SHA256_GUID \\r
+  { \\r
+    0x51aa59de, 0xfdf2, 0x4ea3, {0xbc, 0x63, 0x87, 0x5f, 0xb7, 0x84, 0x2e, 0xe9 } \\r
+  } \r
+\r
+#define EFI_HASH_ALGORITHM_SHA384_GUID \\r
+  { \\r
+    0xefa96432, 0xde33, 0x4dd2, {0xae, 0xe6, 0x32, 0x8c, 0x33, 0xdf, 0x77, 0x7a } \\r
+  } \r
+\r
+#define EFI_HASH_ALGORITHM_SHA512_GUID \\r
+  { \\r
+    0xcaa4381e, 0x750c, 0x4770, {0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21, 0x30 } \\r
+  }\r
+\r
+#define EFI_HASH_ALGORTIHM_MD5_GUID \\r
+  { \\r
+    0xaf7c79c, 0x65b5, 0x4319, {0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, 0xd7 } \\r
+  }\r
+\r
+typedef struct _EFI_HASH_PROTOCOL EFI_HASH_PROTOCOL;\r
+\r
+typedef UINT8  EFI_MD5_HASH[16];\r
+typedef UINT8  EFI_SHA1_HASH[20];\r
+typedef UINT8  EFI_SHA224_HASH[28];\r
+typedef UINT8  EFI_SHA256_HASH[32];\r
+typedef UINT8  EFI_SHA384_HASH[48];\r
+typedef UINT8  EFI_SHA512_HASH[64];\r
+\r
+typedef union {\r
+  EFI_MD5_HASH     *Md5Hash;\r
+  EFI_SHA1_HASH    *Sha1Hash;\r
+  EFI_SHA224_HASH  *Sha224Hash;\r
+  EFI_SHA256_HASH  *Sha256Hash;\r
+  EFI_SHA384_HASH  *Sha384Hash;\r
+  EFI_SHA512_HASH  *Sha512Hash;\r
+} EFI_HASH_OUTPUT;\r
+\r
+/**\r
+  Returns the size of the hash which results from a specific algorithm.\r
+\r
+  @param  This                  Points to this instance of EFI_HASH_PROTOCOL.\r
+  @param  HashAlgorithm         Points to the EFI_GUID which identifies the algorithm to use.\r
+  @param  HashSize              Holds the returned size of the algorithm's hash.\r
+\r
+  @retval EFI_SUCCESS           Hash size returned successfully.\r
+  @retval EFI_INVALID_PARAMETER HashSize is NULL\r
+  @retval EFI_UNSUPPORTED       The algorithm specified by HashAlgorithm is not supported \r
+                                by this driver.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HASH_GET_HASH_SIZE) (\r
+  IN  CONST EFI_HASH_PROTOCOL     *This,\r
+  IN  CONST EFI_GUID              *HashAlgorithm,\r
+  OUT UINTN                       *HashSize\r
+  )\r
+;      \r
+\r
+/**\r
+  Returns the size of the hash which results from a specific algorithm.\r
+\r
+  @param  This          Points to this instance of EFI_HASH_PROTOCOL.\r
+  @param  HashAlgorithm Points to the EFI_GUID which identifies the algorithm to use.\r
+  @param  Extend        Specifies whether to create a new hash (FALSE) or extend the specified\r
+                        existing hash (TRUE).\r
+  @param  Message       Points to the start of the message.\r
+  @param  MessageSize   The size of Message, in bytes.\r
+  @param  Hash          On input, if Extend is TRUE, then this holds the hash to extend. On\r
+                        output, holds the resulting hash computed from the message.\r
+\r
+  @retval EFI_SUCCESS           Hash returned successfully.\r
+  @retval EFI_INVALID_PARAMETER Message or Hash is NULL\r
+  @retval EFI_UNSUPPORTED       The algorithm specified by HashAlgorithm is not supported by this\r
+                                 driver. Or extend is TRUE and the algorithm doesn't support extending the hash.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HASH_HASH) (\r
+  IN CONST EFI_HASH_PROTOCOL      *This,\r
+  IN CONST EFI_GUID               *HashAlgorithm,\r
+  IN BOOLEAN                      Extend,\r
+  IN CONST UINT8                  *Message,\r
+  IN UINT64                       MessageSize,\r
+  IN OUT EFI_HASH_OUTPUT          *Hash\r
+  )\r
+;    \r
+\r
+struct _EFI_HASH_PROTOCOL {\r
+  EFI_HASH_GET_HASH_SIZE          GetHashSize;\r
+  EFI_HASH_HASH                   Hash;\r
+};\r
+\r
+extern EFI_GUID gEfiHashServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiHashProtocolGuid;\r
+extern EFI_GUID gEfiHashAlgorithmSha1Guid;\r
+extern EFI_GUID gEfiHashAlgorithmSha224Guid;\r
+extern EFI_GUID gEfiHashAlgorithmSha256Guid;\r
+extern EFI_GUID gEfiHashAlgorithmSha384Guid;\r
+extern EFI_GUID gEfiHashAlgorithmSha512Guid;\r
+extern EFI_GUID gEfiHashAlgorithmMD5Guid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/HiiConfigAccess.h b/MdePkg/Include/Protocol/HiiConfigAccess.h
new file mode 100644 (file)
index 0000000..84ea39f
--- /dev/null
@@ -0,0 +1,233 @@
+/** @file\r
+\r
+  The file provides services to forward results to PCOL-based\r
+  handler if EFI HII results processing protocol invokes this\r
+  protocol.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: HiiConfigAccess.h\r
+\r
+**/\r
+\r
+\r
+#ifndef __EFI_HII_CONFIG_ACCESS_H__\r
+#define __EFI_HII_CONFIG_ACCESS_H__\r
+\r
+#define EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID  \\r
+  { 0x330d4706, 0xf2a0, 0x4e4f, { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } }\r
+\r
+typedef struct _EFI_HII_CONFIG_ACCESS_PROTOCOL  EFI_HII_CONFIG_ACCESS_PROTOCOL;\r
+\r
+/**\r
+   \r
+  This function allows the caller to request the current\r
+  configuration for one or more named elements. The resulting\r
+  string is in <ConfigAltResp> format. Any and all alternative\r
+  configuration strings shall also be appended to the end of the\r
+  current configuration string. If they are, they must appear\r
+  after the current configuration. They must contain the same\r
+  routing (GUID, NAME, PATH) as the current configuration string.\r
+  They must have an additional description indicating the type of\r
+  alternative configuration the string represents,\r
+  "ALTCFG=<StringToken>". That <StringToken> (when\r
+  converted from Hex UNICODE to binary) is a reference to a\r
+  string in the associated string pack.\r
+\r
+  @param This   Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+\r
+  @param Request  A null-terminated Unicode string in\r
+                  <ConfigRequest> format. Note that this\r
+                  includes the routing information as well as\r
+                  the configurable name / value pairs. It is\r
+                  invalid for this string to be in\r
+                  <MultiConfigRequest> format.\r
+\r
+  @param Progress   On return, points to a character in the\r
+                    Request string. Points to the string's null\r
+                    terminator if request was successful. Points\r
+                    to the most recent "&" before the first\r
+                    failing name / value pair (or the beginning\r
+                    of the string if the failure is in the first\r
+                    name / value pair) if the request was not\r
+                    successful\r
+\r
+  @param Results  A null-terminated Unicode string in\r
+                  <ConfigAltResp> format which has all values\r
+                  filled in for the names in the Request string.\r
+                  String to be allocated by the called function.\r
+\r
+  @retval EFI_SUCCESS   The Results string is filled with the\r
+                        values corresponding to all requested\r
+                        names.\r
+\r
+  @retval EFI_OUT_OF_MEMORY   Not enough memory to store the\r
+                              parts of the results that must be\r
+                              stored awaiting possible future\r
+                              protocols.\r
+\r
+  @retval EFI_INVALID_PARAMETER   For example, passing in a NULL\r
+                                  for the Request parameter\r
+                                  would result in this type of\r
+                                  error. In this case, the\r
+                                  Progress parameter would be\r
+                                  set to NULL. \r
+\r
+  @retval EFI_NOT_FOUND   Routing data doesn't match any\r
+                          known driver. Progress set to the\r
+                          first character in the routing header.\r
+                          Note: There is no requirement that the\r
+                          driver validate the routing data. It\r
+                          must skip the <ConfigHdr> in order to\r
+                          process the names.\r
+\r
+  @retval EFI_INVALID_PARAMETER   Illegal syntax. Progress set\r
+                                  to most recent & before the\r
+                                  error or the beginning of the\r
+                                  string.\r
+\r
+  @retval EFI_INVALID_PARAMETER   Unknown name. Progress points\r
+                                  to the & before the name in\r
+                                  question.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_HII_ACCESS_EXTRACT_CONFIG ) (\r
+  IN CONST  EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,\r
+  IN CONST  EFI_STRING                      Request,\r
+  OUT       EFI_STRING                      *Progress,\r
+  OUT       EFI_STRING                      *Results\r
+);\r
+\r
+\r
+/**\r
+   \r
+  This function applies changes in a driver's configuration.\r
+  Input is a Configuration, which has the routing data for this\r
+  driver followed by name / value configuration pairs. The driver\r
+  must apply those pairs to its configurable storage. If the\r
+  driver's configuration is stored in a linear block of data\r
+  and the driver????s name / value pairs are in <BlockConfig>\r
+  format, it may use the ConfigToBlock helper function (above) to\r
+  simplify the job.\r
+\r
+  @param This   Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+\r
+  @param Configuration  A null-terminated Unicode string in\r
+                        <ConfigString> format. Progress a\r
+                        pointer to a string filled in with the\r
+                        offset of the most recent '&' before the\r
+                        first failing name / value pair (or the\r
+                        beginn ing of the string if the failure\r
+                        is in the first name / value pair) or\r
+                        the terminating NULL if all was\r
+                        successful.\r
+\r
+  @retval EFI_SUCCESS   The results have been distributed or are\r
+                        awaiting distribution.\r
+  \r
+  @retval EFI_OUT_OF_MEMORY   Not enough memory to store the\r
+                              parts of the results that must be\r
+                              stored awaiting possible future\r
+                              protocols.\r
+  \r
+  @retval EFI_INVALID_PARAMETERS  Passing in a NULL for the\r
+                                  Results parameter would result\r
+                                  in this type of error.\r
+  \r
+  @retval EFI_NOT_FOUND   Target for the specified routing data\r
+                          was not found\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_HII_ACCESS_ROUTE_CONFIG ) (\r
+  IN CONST  EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,\r
+  IN CONST  EFI_STRING                      Configuration,\r
+  OUT       EFI_STRING                      *Progress\r
+);\r
+\r
+/**\r
+   \r
+  This function is called to provide results data to the driver.\r
+  This data consists of a unique key that is used to identify\r
+  which data is either being passed back or being asked for.\r
+\r
+  @param This   Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+\r
+  @param KeyValue   A unique value which is sent to the original\r
+                    exporting driver so that it can identify the\r
+                    type of data to expect. The format of the\r
+                    data tends to vary based on the opcode that\r
+                    generated the callback.\r
+\r
+  @param Data   A pointer to the data being sent to the original\r
+                exporting driver. The format of the data should\r
+                be the same as that of the question invoking the\r
+                callback and will be known to the recipient.\r
+\r
+  @retval EFI_SUCCESS   The firmware has successfully stored the\r
+                        variable and its data as defined by the\r
+                        Attributes.\r
+\r
+  @retval EFI_INVALID_PARAMETER   An invalid combination of\r
+                                  Attributes bits was supplied,\r
+                                  or the DataSize exceeds the\r
+                                  maximum allowed.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough storage is available\r
+                                to hold the variable and its\r
+                                data.\r
+\r
+  @retval EFI_DEVICE_ERROR  The variable could not be saved due\r
+                            to a hardware failure.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FORM_CALLBACK) (\r
+  IN CONST  EFI_HII_CONFIG_ACCESS_PROTOCOL  *This,\r
+  IN CONST  UINT16                          KeyValue,\r
+  IN CONST  VOID                            *Data\r
+);\r
+/**\r
+   \r
+  This protocol provides a callable interface between the HII and\r
+  drivers. Only drivers which provide IFR data to HII are required\r
+  to publish this protocol.\r
+\r
+  @param ExtractConfig  This function breaks apart the UNICODE\r
+                        request strings routing them to the\r
+                        appropriate drivers. This function is\r
+                        analogous to the similarly named\r
+                        function in the HII Routing Protocol.\r
+  \r
+  @param RouteConfig  This function breaks apart the UNICODE\r
+                      results strings and returns configuration\r
+                      information as specified by the request.\r
+  \r
+  @param Callback   This function is called from the\r
+                    configuration browser to communicate certain\r
+                    activities that were initiated by a user.\r
+\r
+\r
+**/\r
+struct _EFI_HII_CONFIG_ACCESS_PROTOCOL {\r
+  EFI_HII_ACCESS_ROUTE_CONFIG    ExtractConfig;\r
+  EFI_HII_ACCESS_EXTRACT_CONFIG  RouteConfig;\r
+  EFI_FORM_CALLBACK       Callback;\r
+} ;\r
+\r
+extern EFI_GUID gEfiHiiConfigAccessProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/HiiConfigRouting.h b/MdePkg/Include/Protocol/HiiConfigRouting.h
new file mode 100644 (file)
index 0000000..e17dc31
--- /dev/null
@@ -0,0 +1,363 @@
+/** @file\r
+  The file provides services to manage the movement of\r
+  configuration data from drivers to configuration applications.\r
+  It then serves as the single point to receive configuration\r
+  information from configuration applications, routing the\r
+  results to the appropriate drivers.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: HiiConfigRouting.h\r
+\r
+**/\r
+\r
+#ifndef __HII_CONFIG_ROUTING_H__\r
+#define __HII_CONFIG_ROUTING_H__\r
+\r
+#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \\r
+  { 0x587e72d7, 0xcc50, 0x4f79, { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } }\r
+\r
+\r
+typedef struct _EFI_HII_CONFIG_ROUTING_PROTOCOL EFI_HII_CONFIG_ROUTING_PROTOCOL;\r
+\r
+\r
+/**\r
+   \r
+  This function allows the caller to request the current\r
+  configuration for one or more named elements from one or more\r
+  drivers. The resulting string is in the standard HII\r
+  configuration string format. If Successful Results contains an\r
+  equivalent string with "=" and the values associated with all\r
+  names added in. The expected implementation is for each\r
+  <ConfigRequest> substring in the Request, call the HII\r
+  Configuration Routing Protocol ExtractProtocol function for the\r
+  driver corresponding to the <ConfigHdr> at the start of the\r
+  <ConfigRequest> substring. The request fails if no driver\r
+  matches the <ConfigRequest> substring. Note: Alternative\r
+  configuration strings may also be appended to the end of the\r
+  current configuration string. If they are, they must appear\r
+  after the current configuration. They must contain the same\r
+  routing (GUID, NAME, PATH) as the current configuration string.\r
+  They must have an additional description indicating the type of\r
+  alternative configuration the string represents,\r
+  "ALTCFG=<StringToken>". That <StringToken> (when converted from\r
+  Hex UNICODE to binary) is a reference to a string in the\r
+  associated string pack. As an example, assume that the Request\r
+  string is:\r
+  GUID=...&NAME=00480050&PATH=...&Fred&George&Ron&Neville A result\r
+  might be:\r
+  GUID=...&NAME=00480050&PATH=...&Fred=16&George=16&Ron=12&Neville=11&\r
+  GUID=...&NAME=00480050&PATH=...&ALTCFG=0037&Fred=12&Neville=7\r
+\r
+  @param This   Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
+                instance.\r
+\r
+  @param Request  A null-terminated Unicode string in\r
+                  <MultiConfigRequest> format.\r
+\r
+  @param Progress   On return, points to a character in the\r
+                    Request string. Points to the string's null\r
+                    terminator if request was successful. Points\r
+                    to the most recent '&' before the first\r
+                    failing name / value pair (or the beginning\r
+                    of the string if the failure is in the first\r
+                    name / value pair) if the request was not\r
+                    successful\r
+\r
+  @param Results    Null-terminated Unicode string in\r
+                    <MultiConfigAltResp> format which has all\r
+                    values filled in for the names in the\r
+                    Request string. String to be allocated by\r
+                    the called function.\r
+\r
+  @retval EFI_SUCCESS   The Results string is filled with the\r
+                        values corresponding to all requested\r
+                        names.\r
+\r
+  @retval EFI_OUT_OF_MEMORY   Not enough memory to store the\r
+                              parts of the results that must be\r
+                              stored awaiting possible future\r
+                              protocols.\r
+\r
+  @retval EFI_INVALID_PARAMETER   For example, passing in a NULL\r
+                                  for the Request parameter\r
+                                  would result in this type of\r
+                                  error. The Progress parameter\r
+                                  is set to NULL. EFI_NOT_FOUND\r
+                                  Routing data doesn't match any\r
+                                  known driver. Progress set to\r
+                                  the "G" in "GUID" of the\r
+                                  routing header that doesn't\r
+                                  match. Note: There is no\r
+                                  requirement that all routing\r
+                                  data be validated before any\r
+                                  configuration extraction.\r
+\r
+  @retval EFI_INVALID_PARAMETER   Illegal syntax. Progress set\r
+                                  to most recent & before the\r
+                                  error or the beginning of the\r
+                                  string.\r
+  @retval EFI_INVALID_PARAMETER   Unknown name.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_HII_ROUTING_EXTRACT_CONFIG ) (\r
+  IN CONST  EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
+  IN CONST  EFI_STRING                      *Request,\r
+  OUT       EFI_STRING                      *Progress,\r
+  OUT       EFI_STRING                      *Results\r
+);\r
+\r
+/**\r
+   \r
+  This function allows the caller to request the current\r
+  configuration for all of the current HII database. The results\r
+  include both the current and alternate configurations as\r
+  described in ExtractConfig() above. Implementation note: This\r
+  call has deceptively few inputs but the implementation is likely\r
+  to be somewhat complex. The requirement is to scan all IFR in\r
+  the HII database to determine the list of names and then request\r
+  the configuration using the corresponding drivers??\r
+  EFI_HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig() interfaces below.\r
+  \r
+  @param This   Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
+                instance.\r
+  \r
+  @param Results  A null-terminated Unicode string in\r
+                  <MultiConfigAltResp> format which has all\r
+                  values filled in for the names in the Request\r
+                  string. String to be allocated by this\r
+                  function. De-allocation is up to the caller.\r
+  \r
+  @retval EFI_SUCCESS   The Results string is filled with the\r
+                        values corresponding to all requested\r
+                        names.\r
+  \r
+  @retval EFI_OUT_OF_MEMORY   Not enough memory to store the\r
+                              parts of the results that must be\r
+                              stored awaiting possible future\r
+                              protocols.\r
+  \r
+  @retval EFI_INVALID_PARAMETERS  For example, passing in a NULL\r
+                                  for the Results parameter\r
+                                  would result in this type of\r
+                                  error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_HII_ROUTING_EXPORT_CONFIG ) (\r
+  IN CONST  EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
+  OUT       EFI_STRING                      *Results\r
+);\r
+\r
+/**\r
+   \r
+  This function routes the results of processing forms to the\r
+  appropriate targets. It scans for <ConfigHdr> within the string\r
+  and passes the header and subsequent body to the driver whose\r
+  location is described in the <ConfigHdr>. Many <ConfigHdr>s may\r
+  appear as a single request. The expected implementation is to\r
+  hand off the various <ConfigResp> substrings to the\r
+  Configuration Access Protocol RouteConfig routine corresponding\r
+  to the driver whose routing information is defined by the\r
+  <ConfigHdr> in turn.\r
+\r
+  @param This   Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
+                instance.\r
+\r
+  @param Configuration  A null-terminated Unicode string in\r
+                        <MulltiConfigResp> format.\r
+\r
+  @param Progress   A pointer to a string filled in with the\r
+                    offset of the most recent '&' before the\r
+                    first failing name / value pair (or the\r
+                    beginning of the string if the failure is in\r
+                    the first name / value pair) or the\r
+                    terminating NULL if all was successful.\r
+\r
+  @retval EFI_SUCCESS   The results have been distributed or are\r
+                        awaiting distribution.\r
+  \r
+  @retval EFI_OUT_OF_MEMORY   Not enough memory to store the\r
+                              parts of the results that must be\r
+                              stored awaiting possible future\r
+                              protocols.\r
+  \r
+  @retval EFI_INVALID_PARAMETERS  Passing in a NULL for the\r
+                                  Results parameter would result\r
+                                  in this type of error.\r
+  \r
+  @retval EFI_NOT_FOUND   Target for the specified routing data\r
+                          was not found\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_HII_ROUTING_ROUTE_CONFIG ) (\r
+  IN CONST  EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
+  IN CONST  EFI_STRING                      Configuration,\r
+  OUT       EFI_STRING                      *Progress\r
+);\r
+\r
+\r
+/**\r
+   \r
+  This function extracts the current configuration from a block of\r
+  bytes. To do so, it requires that the ConfigRequest string\r
+  consists of a list of <BlockName> formatted names. It uses the\r
+  offset in the name to determine the index into the Block to\r
+  start the extraction and the width of each name to determine the\r
+  number of bytes to extract. These are mapped to a UNICODE value\r
+  using the equivalent of the C "%x" format (with optional leading\r
+  spaces). The call fails if, for any (offset, width) pair in\r
+  ConfigRequest, offset+value >= BlockSize.\r
+\r
+  @param This   Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
+                instance.\r
+\r
+  @param ConfigRequest  A null-terminated Unicode string in\r
+                        <ConfigRequest> format.\r
+\r
+  @param Block  Array of bytes defining the block's\r
+                configuration.\r
+\r
+  @param BlockSize  Length in bytes of Block.\r
+\r
+  @param Config   Filled-in configuration string. String\r
+                  allocated by the function. Returned only if\r
+                  call is successful.\r
+\r
+  @param Progress   A pointer to a string filled in with the\r
+                    offset of the most recent '&' before the\r
+                    first failing name / value pair (or the\r
+                    beginning of the string if the failure is in\r
+                    the first name / value pair) or the\r
+                    terminating NULL if all was successful.\r
+\r
+  @retval EFI_SUCCESS   The request succeeded. Progress points\r
+                        to the null terminator at the end of the\r
+                        ConfigRequest string.\r
+  @retval EFI_OUT_OF_MEMORY   Not enough memory to allocate\r
+                              Config. Progress points to the\r
+                              first character of ConfigRequest.\r
+\r
+  @retval EFI_INVALID_PARAMETERS  Passing in a NULL for the\r
+                                  ConfigRequest or Block\r
+                                  parameter would result in this\r
+                                  type of error. Progress points\r
+                                  to the first character of\r
+                                  ConfigRequest.\r
+\r
+  @retval EFI_NOT_FOUND   Target for the specified routing data\r
+                          was not found. Progress points to the\r
+                          'G' in "GUID" of the errant routing\r
+                          data. EFI_DEVICE_ERROR Block not large\r
+                          enough. Progress undefined.\r
+\r
+  @retval EFI_INVALID_PARAMETER   Encountered non <BlockName>\r
+                                  formatted string. Block is\r
+                                  left updated and Progress\r
+                                  points at the '&' preceding\r
+                                  the first non-<BlockName>.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_HII_ROUTING_BLOCK_TO_CONFIG ) (\r
+  IN CONST  EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
+  IN CONST  EFI_STRING                      ConfigRequest,\r
+  IN CONST  UINT8                           *Block,\r
+  IN CONST  UINTN                           BlockSize,\r
+  OUT       EFI_STRING                      **Config,\r
+  OUT       EFI_STRING                      *Progress\r
+);\r
+\r
+\r
+\r
+/**\r
+   \r
+  This function maps a configuration containing a series of\r
+  <BlockConfig> formatted name value pairs in ConfigResp into a\r
+  Block so it may be stored in a linear mapped storage such as a\r
+  UEFI Variable. If present, the function skips GUID, NAME, and\r
+  PATH in <ConfigResp>. It stops when it finds a non-<BlockConfig>\r
+  name / value pair (after skipping the routing header) or when it\r
+  reaches the end of the string.\r
+  Example Assume an existing block containing: 00 01 02 03 04 05\r
+  And the ConfigResp string is:\r
+  OFFSET=4&WIDTH=1&VALUE=7&OFFSET=0&WIDTH=2&VALUE=AA55\r
+  The results are\r
+  55 AA 02 07 04 05\r
+\r
+  @param This   Points to the EFI_HII_CONFIG_ROUTING_PROTOCOL\r
+                instance.\r
+\r
+  @param ConfigResp   A  null-terminated Unicode string in\r
+                      <ConfigResp> format.\r
+\r
+  @param CurrentBlock   A possibly null array of bytes\r
+                        representing the current block. Only\r
+                        bytes referenced in the ConfigResp\r
+                        string in the block are modified. If\r
+                        this parameter is null or if the\r
+                        BlockLength parameter is (on input)\r
+                        shorter than required by the\r
+                        Configuration string, only the BlockSize\r
+                        parameter is updated and an appropriate\r
+                        status (see below) is returned.\r
+\r
+  @param BlockSize  The length of the Block in units of UINT8.\r
+                    On input, this is the size of the Block. On\r
+                    output, if successful, contains the index of\r
+                    the last modified byte in the Block.\r
+\r
+  @param Progress   On return, points to an element of the\r
+                    ConfigResp string filled in with the offset\r
+                    of the most recent "&" before the first\r
+                    failing name / value pair (or the beginning\r
+                    of the string if the failure is in the first\r
+                    name / value pair) or the terminating NULL\r
+                    if all was successful.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI * EFI_HII_ROUTING_CONFIG_TO_BLOCK ) (\r
+  IN CONST  EFI_HII_CONFIG_ROUTING_PROTOCOL *This,\r
+  IN CONST  EFI_STRING                      *ConfigResp,\r
+  IN CONST  UINT8                           *Block,\r
+  IN OUT    UINTN                           *BlockSize,\r
+  OUT       EFI_STRING                      *Progress\r
+);\r
+\r
+\r
+/**\r
+   \r
+  This protocol defines the configuration routing interfaces\r
+  between external applications and the HII. There may only be one\r
+  instance of this protocol in the system.\r
+\r
+**/\r
+struct _EFI_HII_CONFIG_ROUTING_PROTOCOL {\r
+  EFI_HII_ROUTING_EXTRACT_CONFIG  ExtractConfig;\r
+  EFI_HII_ROUTING_EXPORT_CONFIG   ExportConfig;\r
+  EFI_HII_ROUTING_ROUTE_CONFIG    RouteConfig;\r
+  EFI_HII_ROUTING_BLOCK_TO_CONFIG BlockToConfig;\r
+  EFI_HII_ROUTING_CONFIG_TO_BLOCK ConfigToBlock;\r
+};\r
+\r
+extern EFI_GUID gEfiHiiConfigRoutingProtocolGuid;\r
+\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/HiiDatabase.h b/MdePkg/Include/Protocol/HiiDatabase.h
new file mode 100644 (file)
index 0000000..666c44d
--- /dev/null
@@ -0,0 +1,2209 @@
+/** @file\r
+  The file provides Database manager for HII-related data\r
+  structures.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: HiiDatabase.h\r
+\r
+**/\r
+\r
+#ifndef __HII_DATABASE_H__\r
+#define __HII_DATABASE_H__\r
+\r
+#define EFI_HII_DATABASE_PROTOCOL_GUID \\r
+  { 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } }\r
+\r
+\r
+typedef struct _EFI_HII_DATABASE_PROTOCOL EFI_HII_DATABASE_PROTOCOL;\r
+\r
+//\r
+// ConfigurationS of HII.\r
+// \r
+#define GLYPH_WIDTH         8\r
+#define GLYPH_HEIGHT        19\r
+\r
+/**\r
+    \r
+  Each package starts with a header, as defined above, which  \r
+  indicates the size and type of the package. When added to a  \r
+  pointer pointing to the start of the header, Length points at  \r
+  the next package. The package lists form a package list when  \r
+  concatenated together and terminated with an  \r
+  EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The  \r
+  type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII  \r
+  packages, whose contents are determined by the Guid. The range  \r
+  of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN  \r
+  through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system  \r
+  firmware implementers.  \r
+  \r
+  @param Length The size of the package in bytes.\r
+  \r
+  @param Type   The package type. See EFI_HII_PACKAGE_TYPE_x,\r
+                below.\r
+  \r
+  @param Data   The package data, the format of which is\r
+                determined by Type.\r
+  \r
+**/\r
+typedef struct {\r
+  UINT32  Length:24;\r
+  UINT32  Type:8;\r
+  // UINT8  Data[...];\r
+} EFI_HII_PACKAGE_HEADER;\r
+\r
+//\r
+// EFI_HII_PACKAGE_TYPE_x.\r
+// \r
+#define EFI_HII_PACKAGE_TYPE_ALL      0x00\r
+#define EFI_HII_PACKAGE_TYPE_GUID     0x01\r
+#define EFI_HII_PACKAGE_FORM_CONFIG   0x02\r
+#define EFI_HII_PACKAGE_FORM_APP      0x03\r
+#define EFI_HII_PACKAGE_STRINGS       0x04\r
+#define EFI_HII_PACKAGE_FONTS         0x05\r
+#define EFI_HII_PACKAGE_IMAGES        0x06\r
+#define EFI_HII_PACKAGE_SIMPLE_FONTS  0x07\r
+#define EFI_HII_PACKAGE_DEVICE_PATH   0x08\r
+#define EFI_HII_PACKAGE_END           0x09\r
+#define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN   0xE0\r
+#define EFI_HII_PACKAGE_TYPE_SYSTEM_END     0xFF\r
+\r
+\r
+/**\r
+  \r
+  This header uniquely identifies the package list.and is placed   \r
+  in front of a list of packages. Package lists with the same   \r
+  PackageListGuid value should contain the same data set. Updated   \r
+  versions should have updated GUIDs.   \r
+  \r
+  @param PackageListGuid  The unique identifier applied to the\r
+                          list of packages which follows.\r
+  \r
+  \r
+  @param PackageLength    The size of the package list (in\r
+                         bytes), including the header.\r
+\r
+**/\r
+typedef struct {\r
+  EFI_GUID  PackageListGuid;\r
+  UINT32    PackagLength;\r
+} EFI_HII_PACKAGE_LIST_HEADER;\r
+\r
+/**\r
+\r
+  The fonts must be presented in Unicode sort order. That is,\r
+  the primary sort key is the UnicodeWeight and the secondary\r
+  sort key is the SurrogateWeight. It is up to developers who\r
+  manage fonts to choose efficient mechanisms for accessing\r
+  fonts. The contiguous presentation can easily be used because\r
+  narrow and wide glyphs are not intermixed, so a binary search\r
+  is possible (hence the requirement that the glyphs be sorted\r
+  by weight).\r
+\r
+  @param Header   The header contains a Length and Type field.\r
+                  In the case of a font package, the type will\r
+                  be EFI_HII_PACKAGE_SIMPLE_FONTS and the length\r
+                  will be the total size of the font package\r
+                  including the size of the narrow and wide\r
+                  glyphs. See EFI_HII_PACKAGE_HEADER.\r
+\r
+  @param NumberOfNarrowGlyphs   The number of NarrowGlyphs that\r
+                                are included in the font package.\r
+\r
+  @param NumberOfWideGlyphs   The number of WideGlyphs that are\r
+                              included in the font package.\r
+\r
+  @param NarrowGlyphs   An array of EFI_NARROW_GLYPH entries.\r
+                        The number of entries is specified by\r
+                        NumberOfNarrowGlyphs.\r
+\r
+  @param WideGlyphs   An array of EFI_WIDE_GLYPH entries. The\r
+                      number of entries is specified by\r
+                      NumberOfWideGlyphs. To calculate the\r
+                      offset of WideGlyphs, use the offset of\r
+                      NarrowGlyphs and add the size of\r
+                      EFI_NARROW_GLYPH multiplied by the\r
+                      NumberOfNarrowGlyphs.\r
+\r
+*/\r
+typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {\r
+  EFI_HII_PACKAGE_HEADER  Header;\r
+  UINT16                  NumberOfNarrowGlyphs;\r
+  UINT16                  NumberOfWideGlyphs;\r
+  // EFI_NARROW_GLYPH         NarrowGlyphs[];\r
+  // EFI_WIDE_GLYPH           WideGlyphs[];\r
+} EFI_HII_SIMPLE_FONT_PACKAGE_HDR;\r
+\r
+//\r
+// Contents of EFI_NARROW_GLYPH.Attributes\r
+//\r
+#define EFI_GLYPH_NON_SPACING 0x01\r
+#define EFI_GLYPH_WIDE        0x02\r
+\r
+/**\r
+\r
+  Glyphs are represented by two structures, one each for the two\r
+  sizes of glyphs. The narrow glyph (EFI_NARROW_GLYPH) is the\r
+  normal glyph used for text display.\r
+\r
+  @param UnicodeWeight  The Unicode representation of the glyph.\r
+                        The term weight is the technical term\r
+                        for a character value.\r
+\r
+  @param Attributes   The data element containing the glyph\r
+                      definitions; see Related Definitions\r
+                      below.\r
+\r
+  @param GlyphCol1  The column major glyph representation of the\r
+                    character. Bits   with values of one\r
+                    indicate that the corresponding pixel is to\r
+                    be on when normally displayed; those with\r
+                    zero are off.\r
+\r
+**/\r
+typedef struct {\r
+  CHAR16  UnicodeWeight;\r
+  UINT8   Attributes;\r
+  UINT8   GlyphCol1[19];\r
+} EFI_NARROW_GLYPH;\r
+\r
+/**\r
+   \r
+  Glyphs are represented via the two structures, one each for the\r
+  two sizes of glyphs. The wide glyph (EFI_WIDE_GLYPH) is large\r
+  enough to display logographic characters.\r
+\r
+  @param UnicodeWeight  The Unicode representation of the glyph.\r
+                        The term weight is the technical term\r
+                        for a character value.\r
+\r
+  @param Attributes   The data element containing the glyph\r
+                      definitions; see Related Definitions in\r
+                      EFI_NARROW_GLYPH for attribute values.\r
+  \r
+  @param GlyphCol1, GlyphCol2   The column major glyph\r
+                                representation of the character.\r
+                                Bits with values of one indicate\r
+                                that the corresponding pixel is\r
+                                to be on when normally\r
+                                displayed; those with zero are\r
+                                off.\r
+  \r
+  @param Pad  Ensures that sizeof(EFI_WIDE_GLYPH) is twice the\r
+              sizeof(EFI_NARROW_GLYPH). The contents of Pad must\r
+              bezero.\r
+\r
+\r
+**/\r
+typedef struct {\r
+  CHAR16  UnicodeWeight;\r
+  UINT8   Attributes;\r
+  UINT8   GlyphCol1[GLYPH_HEIGHT];\r
+  UINT8   GlyphCol2[GLYPH_HEIGHT];\r
+  UINT8   Pad[3];\r
+} EFI_WIDE_GLYPH;\r
+\r
+\r
+//\r
+// EFI_HII_FONT_STYLE\r
+// \r
+typedef UINT32  EFI_HII_FONT_STYLE;\r
+#define EFI_HII_FONT_STYLE_BOLD       0x00000001\r
+#define EFI_HII_FONT_STYLE_ITALIC     0x00000002\r
+#define EFI_HII_FONT_STYLE_EMBOSS     0x00010000\r
+#define EFI_HII_FONT_STYLE_OUTLINE    0x00020000\r
+#define EFI_HII_FONT_STYLE_SHADOW     0x00040000\r
+#define EFI_HII_FONT_STYLE_UNDERLINE  0x00080000\r
+#define EFI_HII_FONT_STYLE_DBL_UNDER  0x00100000\r
+\r
+//\r
+// EFI_HII_GLYPH_BLOCK.BlockType\r
+// \r
+#define EFI_HII_GIBT_END            0x00\r
+#define EFI_HII_GIBT_GLYPH          0x10\r
+#define EFI_HII_GIBT_GLYPHS         0x11\r
+#define EFI_HII_GIBT_GLYPH_DEFAULT  0x12\r
+#define EFI_HII_GIBT_GLYPHS_DEFAULT 0x13\r
+#define EFI_HII_GIBT_DUPLICATE      0x20\r
+#define EFI_HII_GIBT_SKIP2          0x21 \r
+#define EFI_HII_GIBT_SKIP1          0x22\r
+#define EFI_HII_GIBT_DEFAULTS       0x23\r
+#define EFI_HII_GIBT_EXT1           0x30\r
+#define EFI_HII_GIBT_EXT2           0x31\r
+#define EFI_HII_GIBT_EXT4           0x32\r
+\r
+/**\r
+\r
+  EFI_HII_GIBT_END block is found. When processing the glyph\r
+  blocks, each block refers to the current character value\r
+  (CharValueCurrent), which is initially set to one (1). Glyph\r
+  blocks of an unknown type should be skipped. If they cannot be\r
+  skipped, then processing halts.\r
+\r
+**/\r
+typedef struct _EFI_HII_GLYPH_BLOCK {\r
+  UINT8 BlockType;\r
+  UINT8 BlockBody[1];\r
+} EFI_HII_GLYPH_BLOCK;\r
+\r
+\r
+/**\r
+\r
+  @param Width  Width of the character or character cell, in\r
+                pixels. For fixed-pitch fonts, this is the same\r
+                as the advance.\r
+\r
+  @param Height   Height of the character or character cell, in\r
+                  pixels.\r
+\r
+  @param OffsetX  Offset to the horizontal edge of the character\r
+                  cell.\r
+\r
+  @param OffsetY  Offset to the vertical edge of the character\r
+                  cell.\r
+\r
+  @param AdvanceX   Number of pixels to advance to the right\r
+                    when moving from the origin of the current\r
+                    glyph to the origin of the next glyph.\r
+   \r
+**/\r
+typedef struct _EFI_HII_GLYPH_INFO {\r
+  UINT16  Width;\r
+  UINT16  Height;\r
+  INT16   OffsetX;\r
+  INT16   OffsetY;\r
+  INT16   AdvanceX;\r
+} EFI_HII_GLYPH_INFO;\r
+\r
+\r
+/**\r
+   \r
+  Changes the default cell information used for subsequent\r
+  EFI_HII_GIBT_GLYPH_DEFAULT and EFI_HII_GIBT_GLYPHS_DEFAULT glyph\r
+  blocks. The cell information described by Cell remains in effect\r
+  until the next EFI_HII_GIBT_DEFAULTS is found. Prior to the\r
+  first EFI_HII_GIBT_DEFAULTS block, the cell information in the\r
+  fixed header are used.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_DEFAULTS.\r
+  \r
+  @param Cell   The new default cell information which will be\r
+                applied to all subsequent GLYPH_DEFAULT and\r
+                GLYPHS_DEFAULT blocks.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK   Header;\r
+  EFI_HII_GLYPH_INFO    Cell;\r
+} EFI_HII_GIBT_DEFAULTS_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  Indicates that the glyph with character value CharValueCurrent\r
+  has the same glyph as a previously defined character value and\r
+  increments CharValueCurrent by one.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_DUPLICATE.\r
+\r
+  @param CharValue  The previously defined character value with\r
+                    the exact same glyph.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_DUPLICATE_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK   Header;\r
+  CHAR16                CharValue;\r
+} EFI_HII_GIBT_DUPLICATE_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  Any glyphs with a character value greater than or equal to\r
+  CharValueCurrent are empty.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_END.\r
+\r
+**/\r
+typedef struct _EFI_GLYPH_GIBT_END_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK   Header;\r
+} EFI_GLYPH_GIBT_END_BLOCK;\r
+\r
+/**\r
+  \r
+  These are reserved for future expansion, with length bytes\r
+  included so that they can be easily skipped.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_EXT1,\r
+                  EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4.\r
+\r
+  @param Length   Size of the glyph block, in bytes.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_EXT1_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK Header;\r
+  UINT8               BlockType2;\r
+  UINT8               Length;\r
+} EFI_HII_GIBT_EXT1_BLOCK;\r
+\r
+\r
+/**\r
+  \r
+  These are reserved for future expansion, with length bytes\r
+  included so that they can be easily skipped.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_EXT1,\r
+                  EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4.\r
+\r
+  @param Length   Size of the glyph block, in bytes.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_EXT2_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK Header;\r
+  UINT8               BlockType2;\r
+  UINT16              Length;\r
+} EFI_HII_GIBT_EXT2_BLOCK;\r
+\r
+/**\r
+  \r
+  These are reserved for future expansion, with length bytes\r
+  included so that they can be easily skipped.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_EXT1,\r
+                  EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4.\r
+\r
+  @param Length   Size of the glyph block, in bytes.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_EXT4_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK Header;\r
+  UINT8               BlockType2;\r
+  UINT32              Length;\r
+} EFI_HII_GIBT_EXT4_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This block provides the bitmap for the character with the value\r
+  CharValueCurrent and increments CharValueCurrent by one. Each\r
+  glyph contains a glyph width and height, a drawing offset,\r
+  number of pixels to advance after drawing and then the encoded\r
+  bitmap.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_GLYPH.\r
+\r
+  @param Cell   Contains the width and height of the encoded\r
+                bitmap (Cell.Width and Cell.Height), the number\r
+                of pixels (signed) right of the character cell\r
+                origin where the left edge of the bitmap should\r
+                be placed (Cell.OffsetX), the number of pixels\r
+                above the character cell origin where the top\r
+                edge of the bitmap should be placed\r
+                (Cell.OffsetY) and the number of pixels (signed)\r
+                to move right to find the origin for the next\r
+                charactercell (Cell.AdvanceX).\r
+\r
+  @param GlyphCount   The number of glyph bitmaps.\r
+\r
+  @param BitmapData   The bitmap data specifies a series of\r
+                      pixels, one bit per pixel, left-to-right,\r
+                      top-tobottom. Each glyph bitmap only\r
+                      encodes the portion of the bitmap enclosed\r
+                      by its character-bounding box, but the\r
+                      entire glyph is padded out to the nearest\r
+                      byte. The number of bytes per bitmap can\r
+                      be calculated as: ((Cell.Width + 7)/8) *\r
+                      Cell.Height.\r
+\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK   Header;\r
+  EFI_HII_GLYPH_INFO    Cell;\r
+  UINT16                GlyphCount;\r
+  UINT8                 BitmapData[1];\r
+} EFI_HII_GIBT_GLYPH_BLOCK;\r
+\r
+/**\r
+   \r
+  Provides the bitmaps for the characters with the values\r
+  CharValueCurrent through CharValueCurrent + Count -1 and\r
+  increments CharValueCurrent by Count. These glyphs have\r
+  identical cell information and the encoded bitmaps are exactly\r
+  the same number of byes.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_GLYPHS.\r
+\r
+  @param Cell     Contains the width and height of the encoded\r
+                  bitmap (Cell.Width and Cell.Height), the\r
+                  number of pixels (signed) right of the\r
+                  character cell origin where the left edge of\r
+                  the bitmap should be placed (Cell.OffsetX),\r
+                  the number of pixels above the character cell\r
+                  origin where the top edge of the bitmap should\r
+                  be placed (Cell.OffsetY) and the number of\r
+                  pixels(signed) to move right to find the\r
+                  origin for the next character cell\r
+                  (Cell.AdvanceX).\r
+\r
+  @param BitmapData   The bitmap data specifies a series of\r
+                      pixels, one bit per pixel, left-to-right,\r
+                      top-tobottom, for each glyph. Each glyph\r
+                      bitmap only encodes the portion of the\r
+                      bitmap enclosed by its character-bounding\r
+                      box. The number of bytes per bitmap can be\r
+                      calculated as: ((Cell.Width + 7)/8) *\r
+                      Cell.Height.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK   Header;\r
+  EFI_HII_GLYPH_INFO    Cell;\r
+  UINT8                 BitmapData[1];\r
+} EFI_HII_GIBT_GLYPHS_BLOCK;\r
+\r
+/**\r
+   \r
+  Provides the bitmap for the character with the value\r
+  CharValueCurrent and increments CharValueCurrent by 1. This\r
+  glyph uses the default cell information. The default cell\r
+  information is found in the font header or the most recently\r
+  processed EFI_HII_GIBT_DEFAULTS.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType = EFI_HII_GIBT_GLYPH_DEFAULT.\r
+\r
+  @param BitmapData   The bitmap data specifies a series of\r
+                      pixels, one bit per pixel, left-to-right,\r
+                      top-tobottom. Each glyph bitmap only\r
+                      encodes the portion of the bitmap enclosed\r
+                      by its character-bounding box. The number\r
+                      of bytes per bitmap can be calculated as:\r
+                      ((Global.Cell.Width + 7)/8) *\r
+                      Global.Cell.Height.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK Header;\r
+  UINT8               BitmapData[1];\r
+} EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK;\r
+\r
+\r
+\r
+\r
+/**\r
+   \r
+  Provides the bitmaps for the characters with the values\r
+  CharValueCurrent through CharValueCurrent + Count -1 and\r
+  increments CharValueCurrent by Count. These glyphs use the\r
+  default cell information and the encoded bitmaps have exactly\r
+  the same number of byes.\r
+\r
+  @param Header   Standard glyph block header, where\r
+                  Header.BlockType =\r
+                  EFI_HII_GIBT_GLYPHS_DEFAULT.\r
+\r
+  @param Count    Number of glyphs in the glyph block.\r
+\r
+  @param BitmapData   The bitmap data specifies a series of\r
+                      pixels, one bit per pixel, left-to-right,\r
+                      top-tobottom, for each glyph. Each glyph\r
+                      bitmap only encodes the portion of the\r
+                      bitmap enclosed by its character-bounding\r
+                      box. The number of bytes per bitmap can be\r
+                      calculated as: ((Global.Cell.Width + 7)/8)\r
+                      Global.Cell.Height.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK Header;\r
+  UINT16              Count;\r
+  UINT8               BitmapData[1];\r
+} EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK;\r
+\r
+/**\r
+   \r
+  Increments the current character value CharValueCurrent by the\r
+  number specified.\r
+\r
+  @param Header   Standard glyph block header, where BlockType =\r
+                  EFI_HII_GIBT_SKIP1 or EFI_HII_GIBT_SKIP2.\r
+\r
+  @param SkipCount  The unsigned 8- or 16-bit value to add to\r
+                    CharValueCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_SKIP2_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK Header;\r
+  UINT16              SkipCount;\r
+} EFI_HII_GIBT_SKIP2_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  Increments the current character value CharValueCurrent by the\r
+  number specified.\r
+\r
+  @param Header   Standard glyph block header, where BlockType =\r
+                  EFI_HII_GIBT_SKIP1 or EFI_HII_GIBT_SKIP2.\r
+\r
+  @param SkipCount  The unsigned 8- or 16-bit value to add to\r
+                    CharValueCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_GIBT_SKIP1_BLOCK {\r
+  EFI_HII_GLYPH_BLOCK Header;\r
+  UINT8               SkipCount;\r
+} EFI_HII_GIBT_SKIP1_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This package is created by NewPackageList() when the package\r
+  list is first added to the HII database by locating the\r
+  EFI_DEVICE_PATH_PROTOCOL attached to the driver handle passed in\r
+  to that function.\r
+  \r
+**/\r
+typedef EFI_DEVICE_PATH_PROTOCOL  EFI_HII_DEVICE_PATH_PACKAGE_HDR;\r
+\r
+\r
+/**\r
+   \r
+  This is a free-form package type designed to allow extensibility\r
+  by allowing the format to be specified using Guid.\r
+\r
+  @param Guid   Identifier which describes the remaining data\r
+                within the package.\r
+\r
+**/\r
+typedef struct _EFI_HII_GUID_PACKAGE_HDR {\r
+  EFI_GUID Guid;\r
+} EFI_HII_GUID_PACKAGE_HDR;\r
+\r
+\r
+/**\r
+   \r
+  The Strings package record describes the mapping between string\r
+  identifiers and the actual text of the strings themselves. The\r
+  package consists of three parts: a fixed header, the string\r
+  information and the font information.\r
+\r
+  @param Header   The standard package header, where Header.Type\r
+                  = EFI_HII_PACKAGE_STRINGS.\r
+\r
+  @param HdrSize  Size of this header.\r
+\r
+  @param StringInfoOffset   Offset, relative to the start of\r
+                            this header, of the string information.\r
+\r
+  @param LanguageWindow   Specifies the default values placed in\r
+                          the static and dynamic windows before\r
+                          processing each SCSU-encoded strings.\r
+\r
+\r
+  @param LanguageName   String identifier within the current\r
+                        string package of the full name of the\r
+                        language specified by Language. Language\r
+                        Language of the strings, as specified by\r
+                        RFC 3066.\r
+\r
+**/\r
+typedef struct _EFI_HII_STRING_PACKAGE_HDR {\r
+  EFI_HII_PACKAGE_HEADER  Header;\r
+  UINT32                  HdrSize;\r
+  UINT32                  StringInfoOffset;\r
+  CHAR16                  LanguageWindow[16];\r
+  EFI_STRING_ID           LanguageName;\r
+  CHAR8 Language[1];\r
+} EFI_HII_STRING_PACKAGE_HDR;\r
+\r
+\r
+\r
+/**\r
+\r
+  The fixed header consists of a standard record header and then\r
+  the character values in this section, the flags (including the\r
+  encoding method) and the offsets of the glyph information, the\r
+  glyph bitmaps and the character map.\r
+\r
+  @param Header   The standard package header, where Header.Size\r
+                  EFI_HII_PACKAGE_FONTS.\r
+\r
+  @param HdrSize  Size of this header.\r
+\r
+  @param GlyphInfoOffset  The offset, relative to the start of\r
+                          this header, of a series of\r
+                          variable-length glyph blocks, each\r
+                          describing information about the\r
+                          bitmap associated with a glyph.\r
+\r
+  @param Cell   This contains the measurement of the widest and\r
+                tallest characters in the font (Cell.Width and\r
+                Cell.Height). It also contains the offset to the\r
+                horizontal and vertical origin point of the\r
+                character cell (Cell.OffsetX and Cell.OffsetY).\r
+                Finally, it contains the default AdvanceX. The\r
+                individual glyph's OffsetX and OffsetY value is\r
+                added to this position to determine where to\r
+                draw the top-left pixel of the character's\r
+                glyph. The character glyph's AdvanceX is added\r
+                to this position to determine the origin point\r
+                for the next character.\r
+\r
+  @param FontStyle  The design style of the font, 1 bit per\r
+                    style. See EFI_HII_FONT_STYLE.\r
+\r
+  @param FontFamily   The null-terminated string with the name\r
+                      of the font family to which the font\r
+                      belongs.\r
+\r
+**/\r
+typedef struct _EFI_HII_FONT_PACKAGE_HDR {\r
+  EFI_HII_PACKAGE_HEADER  Header;\r
+  UINT32                  HdrSize;\r
+  UINT32                  GlyphBlockOffset;\r
+  EFI_HII_GLYPH_INFO      Cell;\r
+  EFI_HII_FONT_STYLE      FontStyle;\r
+  CHAR16                  FontFamily[1];\r
+} EFI_HII_FONT_PACKAGE_HDR;\r
+\r
+\r
+//\r
+// EFI_HII_STRING_BLOCK.BlockType\r
+// \r
+#define FI_HII_SIBT_END                 0x00\r
+#define EFI_HII_SIBT_STRING_SCSU        0x10\r
+#define EFI_HII_SIBT_STRING_SCSU_FONT   0x11\r
+#define EFI_HII_SIBT_STRINGS_SCSU       0x12\r
+#define EFI_HII_SIBT_STRINGS_SCSU_FONT  0x13\r
+#define EFI_HII_SIBT_STRING_UCS2        0x14\r
+#define EFI_HII_SIBT_STRING_UCS2_FONT   0x15\r
+#define EFI_HII_SIBT_STRINGS_UCS2       0x16\r
+#define EFI_HII_SIBT_STRINGS_UCS2_FONT  0x17\r
+#define EFI_HII_SIBT_DUPLICATE          0x20\r
+#define EFI_HII_SIBT_SKIP2              0x21\r
+#define EFI_HII_SIBT_SKIP1              0x22\r
+#define EFI_HII_SIBT_EXT1               0x30\r
+#define EFI_HII_SIBT_EXT2               0x31\r
+#define EFI_HII_SIBT_EXT4               0x32\r
+#define EFI_HII_SIBT_FONT               0x40\r
+\r
+/**\r
+   \r
+  String blocks specify the text and font for the current string\r
+  identifier and increment to the next string identifier.\r
+**/\r
+typedef struct {\r
+  UINT8   BlockType;\r
+  UINT8   BlockBody[1];\r
+} EFI_HII_STRING_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  Indicates that the string with string identifier\r
+  StringIdCurrent is the same as a previously defined string and\r
+  increments StringIdCurrent by one.\r
+  \r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_DUPLICATE.\r
+  \r
+  @param StringId   The string identifier of a previously\r
+                    defined string with the exact same string\r
+                    text. Description\r
+\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  EFI_STRING_ID         StringId;\r
+} EFI_HII_SIBT_DUPLICATE_BLOCK;\r
+\r
+/**\r
+   \r
+  Any strings with a string identifier greater than or equal to\r
+  StringIdCurrent are empty.\r
+\r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_END.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_END_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+} EFI_HII_SIBT_END_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  These are reserved for future expansion, with length bytes\r
+  included so that they can be easily skip\r
+\r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_EXT1,\r
+                  EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4.\r
+  \r
+  @param Length   Size of the string block, in bytes.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_EXT1_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT8                 BlockType2;\r
+  UINT8                 Length;\r
+} EFI_HII_SIBT_EXT1_BLOCK;\r
+\r
+/**\r
+   \r
+  These are reserved for future expansion, with length bytes\r
+  included so that they can be easily skip\r
+\r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_EXT1,\r
+                  EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4.\r
+  \r
+  @param Length   Size of the string block, in bytes.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_EXT2_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT8                 BlockType2;\r
+  UINT16                Length;\r
+} EFI_HII_SIBT_EXT2_BLOCK;\r
+\r
+/**\r
+   \r
+  These are reserved for future expansion, with length bytes\r
+  included so that they can be easily skip\r
+\r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_EXT1,\r
+                  EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4.\r
+  \r
+  @param Length   Size of the string block, in bytes.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_EXT4_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT8                 BlockType2;\r
+  UINT32                Length;\r
+} EFI_HII_SIBT_EXT4_BLOCK;\r
+\r
+/**\r
+   \r
+  Associates a font identifier FontId with a font name FontName,\r
+  size FontSize and style FontStyle. This font identifier may be\r
+  used with the string blocks. The font identifier 0 is the\r
+  default font for those string blocks which do not specify a font\r
+  identifier.\r
+\r
+  @param Header   Standard extended header, where\r
+                  Header.BlockType = EFI_HII_SIBT_FONT.\r
+\r
+  @param FontId   Font identifier, which must be unique within\r
+                  the font package.\r
+\r
+  @param FontSize   Character cell size, in pixels, of the font.\r
+\r
+  @param FontStyle  Font style.\r
+\r
+  @param FontName   Null-terminated font family name.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_FONT_BLOCK {\r
+  EFI_HII_SIBT_EXT2_BLOCK   Header;\r
+  UINT8                     FontId;\r
+  UINT16                    FontSize;\r
+  EFI_HII_FONT_STYLE        FontStyle;\r
+  CHAR16                    FontName[1];\r
+} EFI_HII_SIBT_FONT_BLOCK;\r
+\r
+/**\r
+   \r
+  Increments the current string identifier StringIdCurrent by the\r
+  number specified.\r
+\r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_SKIP1.\r
+  \r
+  @param SkipCount  The unsigned 8-bit value to add to\r
+                    StringIdCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_SKIP1_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT8                 SkipCount;\r
+} EFI_HII_SIBT_SKIP1_BLOCK;\r
+\r
+/**\r
+\r
+  Increments the current string identifier StringIdCurrent by\r
+  the number specified.\r
+\r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_SKIP2.\r
+\r
+  @param SkipCount  The unsigned 16-bit value to add to\r
+                    StringIdCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_SKIP2_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT16                SkipCount;\r
+} EFI_HII_SIBT_SKIP2_BLOCK;\r
+\r
+/**\r
+   \r
+  This string block provides the SCSU-encoded text for the string\r
+  in the default font with string identifier StringIdCurrent and\r
+  increments StringIdCurrent by one.\r
+\r
+  @param Header   Standard header where Header.BlockType =\r
+                  EFI_HII_SIBT_STRING_SCSU.\r
+\r
+  @param StringText   The string text is a null-terminated\r
+                      string, which is assigned to the string\r
+                      identifier StringIdCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_STRING_SCSU_BLOCK {\r
+  EFI_HII_STRING_BLOCK Header;\r
+  UINT8 StringText[1];\r
+} EFI_HII_SIBT_STRING_SCSU_BLOCK;\r
+\r
+\r
+/**\r
+\r
+  This string block provides the SCSU-encoded text for the string\r
+  in the font specified by FontIdentifier with string identifier\r
+  StringIdCurrent and increments StringIdCurrent by one.\r
+\r
+  @param Header   Standard string block header, where\r
+                  Header.BlockType = EFI_HII_SIBT_STRING_SCSU_FONT.\r
+\r
+  @param FontIdentifier   The identifier of the font to be used\r
+                          as the starting font for the entire\r
+                          string. The identifier must either be\r
+                          0 for the default font or an\r
+                          identifier previously specified by an\r
+                          EFI_HII_SIBT_FONT block. Any string\r
+                          characters that deviates from this\r
+                          font family, size or style must\r
+                          provide an explicit control character.\r
+\r
+  @param StringText   The string text is a null-terminated\r
+                      encoded string, which is assigned to the\r
+                      string identifier StringIdCurrent.\r
+\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT8                 FontIdentifier;\r
+  UINT8                 StringText[1];\r
+} EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This string block provides the SCSU-encoded text for StringCount\r
+  strings which have the default font and which have sequential\r
+  string identifiers. The strings are assigned the identifiers,\r
+  starting with StringIdCurrent and continuing through\r
+  StringIdCurrent + StringCount ??C 1. StringIdCurrent is\r
+  incremented by StringCount.\r
+\r
+  @param Header   Standard header where Header.BlockType =\r
+                  EFI_HII_SIBT_STRINGS_SCSU.\r
+\r
+  @param StringCount  Number of strings in StringText.\r
+\r
+  @param StringText   The strings, where each string is a\r
+                      null-terminated encoded string.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_STRINGS_SCSU_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT16                StringCount;\r
+  UINT8                 StringText[1];\r
+} EFI_HII_SIBT_STRINGS_SCSU_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This string block provides the SCSU-encoded text for StringCount\r
+  strings which have the font specified by FontIdentifier and\r
+  which have sequential string identifiers. The strings are\r
+  assigned the identifiers, starting with StringIdCurrent and\r
+  continuing through StringIdCurrent + StringCount ??C 1.\r
+  StringIdCurrent is incremented by StringCount.\r
+\r
+  @param Header   Standard header where Header.BlockType =\r
+                  EFI_HII_SIBT_STRINGS_SCSU_FONT.\r
+\r
+  @param StringCount  Number of strings in StringText.\r
+\r
+  @param FontIdentifier   The identifier of the font to be used\r
+                          as the starting font for the entire\r
+                          string. The identifier must either be\r
+                          0 for the default font or an\r
+                          identifier previously specified by an\r
+                          EFI_HII_SIBT_FONT block. Any string\r
+                          characters that deviates from this\r
+                          font family, size or style must\r
+                          provide an explicit control character.\r
+\r
+  @param StringText   The strings, where each string is a\r
+                      null-terminated encoded string.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT16                StringCount;\r
+  UINT8                 FontIdentifier;\r
+  UINT8                 StringText[1];\r
+} EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This string block provides the UCS-2 encoded text for the string\r
+  in the default font with string identifier StringIdCurrent and\r
+  increments StringIdCurrent by one.\r
+\r
+  @param Header   Standard header where Header.BlockType =\r
+                  EFI_HII_SIBT_STRING_UCS2.\r
+\r
+  @param StringText   The string text is a null-terminated UCS-2\r
+                      string, which is assigned to the string\r
+                      identifier StringIdCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_STRING_UCS2_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  CHAR16                StringText[1];\r
+} EFI_HII_SIBT_STRING_UCS2_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This string block provides the UCS-2 encoded text for the string\r
+  in the font specified by FontIdentifier with string identifier\r
+  StringIdCurrent and increments StringIdCurrent by one\r
+\r
+  @param Header   Standard header where Header.BlockType =\r
+                  EFI_HII_SIBT_STRING_UCS2_FONT.\r
+\r
+  @param FontIdentifier   The identifier of the font to be used\r
+                          as the starting font for the entire\r
+                          string. The identifier must either be\r
+                          0 for the default font or an\r
+                          identifier previously specified by an\r
+                          EFI_HII_SIBT_FONT block. Any string\r
+                          characters that deviates from this\r
+                          font family, size or style must\r
+                          provide an explicit control character.\r
+\r
+  @param StringText   The string text is a null-terminated UCS-2\r
+                      string, which is assigned to the string\r
+                      identifier StringIdCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT8                 FontIdentifier;\r
+  CHAR16                StringText[1];\r
+} EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This string block provides the UCS-2 encoded text for the\r
+  strings in the default font with string identifiers\r
+  StringIdCurrent to StringIdCurrent + StringCount - 1 and\r
+  increments StringIdCurrent by StringCount.\r
+\r
+  @param Header   Standard header where Header.BlockType =\r
+                  EFI_HII_SIBT_STRINGS_UCS2.\r
+\r
+  @param StringCount  Number of strings in StringText.\r
+\r
+  @param StringText   The string text is a series of\r
+                      null-terminated UCS-2 strings, which are\r
+                      assigned to the string identifiers\r
+                      StringIdCurrent.to StringIdCurrent +\r
+                      StringCount - 1.\r
+  \r
+**/\r
+typedef struct _EFI_HII_SIBT_STRINGS_UCS2_BLOCK {\r
+  EFI_HII_STRING_BLOCK  Header;\r
+  UINT16                StringCount;\r
+  CHAR16                StringText[1];\r
+} EFI_HII_SIBT_STRINGS_UCS2_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  The fixed header consists of a standard record header and the\r
+  offsets of the image and palette information.\r
+\r
+  @param Header   Standard package header, where Header.Type =\r
+                  EFI_HII_PACKAGE_IMAGES. ImageInfoOffset\r
+                  Offset, relative to this header, of the image\r
+                  information. If this is zero, then there are\r
+                  no images in the package.\r
+\r
+  @param PaletteInfoOffset  Offset, relative to this header, of\r
+                            the palette information. If this is\r
+                            zero, then there are no palettes in\r
+                            the image package.\r
+\r
+**/\r
+typedef struct _EFI_HII_IMAGE_PACKAGE_HDR {\r
+  EFI_HII_PACKAGE_HEADER  Header;\r
+  UINT32                  ImageInfoOffset;\r
+  UINT32                  PaletteInfoOffset;\r
+} EFI_HII_IMAGE_PACKAGE_HDR;\r
+\r
+\r
+//\r
+// EFI_HII_IMAGE_BLOCK\r
+// \r
+typedef struct _EFI_HII_IMAGE_BLOCK {\r
+  UINT8   BlockType;\r
+  UINT8   BlockBody[1];\r
+} EFI_HII_IMAGE_BLOCK;\r
+\r
+//\r
+// EFI_HII_IMAGE_BLOCK.BlockType.\r
+// \r
+#define EFI_HII_IIBT_END                0x00\r
+#define EFI_HII_IIBT_IMAGE_1BIT         0x10\r
+#define EFI_HII_IIBT_IMAGE_1BIT_TRANS   0x11\r
+#define EFI_HII_IIBT_IMAGE_4BIT         0x12\r
+#define EFI_HII_IIBT_IMAGE_4BIT_TRANS   0x13\r
+#define EFI_HII_IIBT_IMAGE_8BIT         0x14\r
+#define EFI_HII_IIBT_IMAGE_8BIT_TRANS   0x15\r
+#define EFI_HII_IIBT_IMAGE_24BIT        0x16\r
+#define EFI_HII_IIBT_IMAGE_24BIT_TRANS  0x17\r
+#define EFI_HII_IIBT_IMAGE_JPEG         0x18\r
+#define EFI_HII_IIBT_DUPLICATE          0x20\r
+#define EFI_HII_IIBT_SKIP2              0x21\r
+#define EFI_HII_IIBT_SKIP1              0x22\r
+#define EFI_HII_IIBT_EXT1               0x30\r
+#define EFI_HII_IIBT_EXT2               0x31\r
+#define EFI_HII_IIBT_EXT4               0x32\r
+\r
+\r
+/**\r
+   \r
+  Any images with an image identifier greater than or equal to\r
+  ImageIdCurrent are empty.\r
+\r
+  @param Header   Standard image block header, where\r
+                  Header.BlockType = EFI_HII_IIBT_END.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_END_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK   Header;\r
+} EFI_HII_IIBT_END_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  Future extensions for image records which need a length-byte\r
+  length use this prefix.\r
+\r
+  @param Header   Standard image block header, where\r
+                  Header.BlockType = EFI_HII_IIBT_EXT1,\r
+                  EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4.\r
+  \r
+  @param Length   Size of the image block, in bytes, including\r
+                  the image block header.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_EXT1_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK Header;\r
+  UINT8               BlockType2;\r
+  UINT8               Length;\r
+} EFI_HII_IIBT_EXT1_BLOCK;\r
+\r
+/**\r
+   \r
+  Future extensions for image records which need a length-byte\r
+  length use this prefix.\r
+\r
+  @param Header   Standard image block header, where\r
+                  Header.BlockType = EFI_HII_IIBT_EXT1,\r
+                  EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4.\r
+  \r
+  @param Length   Size of the image block, in bytes, including\r
+                  the image block header.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_EXT2_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK Header;\r
+  UINT8               BlockType2;\r
+  UINT16              Length;\r
+} EFI_HII_IIBT_EXT2_BLOCK;\r
+\r
+/**\r
+   \r
+  Future extensions for image records which need a length-byte\r
+  length use this prefix.\r
+\r
+  @param Header   Standard image block header, where\r
+                  Header.BlockType = EFI_HII_IIBT_EXT1,\r
+                  EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4.\r
+  \r
+  @param Length   Size of the image block, in bytes, including\r
+                  the image block header.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_EXT4_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK Header;\r
+  UINT8               BlockType2;\r
+  UINT32              Length;\r
+} EFI_HII_IIBT_EXT4_BL0CK;\r
+\r
+//\r
+// EFI_HII_IIBT_IMAGE_1BIT_BASE\r
+// \r
+typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BASE {\r
+  UINT16 Width;\r
+  UINT16 Height;\r
+  // UINT8 Data[...];\r
+} EFI_HII_IIBT_IMAGE_1BIT_BASE;\r
+\r
+/**\r
+\r
+  This record assigns the 1-bit-per-pixel bitmap data to the\r
+  ImageIdCurrent identifier and increment ImageIdCurrent by one.\r
+  The data in the EFI_HII_IMAGE_1BIT_TRANS structure is exactly\r
+  the same as the EFI_HII_IMAGE_1BIT structure, the difference is\r
+  how the data is treated. The bitmap pixel value 0 is the\r
+  transparency value and will not be written to the\r
+  screen. The bitmap pixel value 1 will be translated to the color\r
+  specified by Palette.\r
+\r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_IMAGE_1BIT_TRANS.\r
+\r
+  @param PaletteIndex   Index of the palette in the palette\r
+                        information.\r
+\r
+  @param Bitmap   The bitmap specifies a series of pixels, one\r
+                  bit per pixel, left-to-right, top-to-bottom,\r
+                  and is padded out to the nearest byte. The\r
+                  number of bytes per bitmap can be calculated\r
+                  as: ((Width + 7)/8) * Height.\r
+\r
+**/\r
+typedef struct _EFI_HII_IBIT_IMAGE_1BIT_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK           Header;\r
+  UINT8                         PaletteIndex;\r
+  EFI_HII_IIBT_IMAGE_1BIT_BASE  Bitmap;\r
+} EFI_HII_IIBT_IMAGE_1BIT_BLOCK;\r
+\r
+typedef EFI_HII_IIBT_IMAGE_1BIT_BLOCK   EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK;\r
+\r
+\r
+//\r
+// EFI_HII_RGB_PIXEL\r
+// \r
+typedef struct _EFI_HII_RGB_PIXEL {\r
+  UINT8 b;\r
+  UINT8 g;\r
+  UINT8 r;\r
+} EFI_HII_RGB_PIXEL;\r
+\r
+//\r
+// FI_HII_IIBT_IMAGE_24BIT_BASE\r
+// \r
+typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BASE {\r
+  UINT16 Width;\r
+  UINT16 Height;\r
+  // EFI_HII_RGB_PIXEL Bitmap[...];\r
+} EFI_HII_IIBT_IMAGE_24BIT_BASE;\r
+\r
+/**\r
+\r
+  This record assigns the 24-bit-per-pixel bitmap data to the   \r
+  ImageIdCurrent identifier and increment ImageIdCurrent by one.   \r
+  The image's upper left hand corner pixel is composed of the\r
+  first three bitmap bytes. The first byte is the pixel????s blue   \r
+  component value, the next byte is the pixel????s green component   \r
+  value, and the third byte is the pixel's red component value\r
+  (B,G,R). Each color component value can vary from 0x00 (color   \r
+  off) to 0xFF (color full on), allowing 16.8 millions colors that   \r
+  can be specified.\r
+\r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_IMAGE_24BIT. Bitmap The bitmap\r
+                  specifies a series of pixels, 24 bits per\r
+                  pixel, left-to-right, top-to-bottom. The\r
+                  number of bytes per bitmap can be calculated\r
+                  as: (Width * 3) * Height.\r
+\r
+  @param Type     See EFI_HII_RGB_PIXEL definition.\r
+\r
+**/\r
+typedef struct {\r
+  EFI_HII_IMAGE_BLOCK           Header;\r
+  EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;\r
+} EFI_HII_IIBT_IMAGE_24BIT_BLOCK;\r
+\r
+typedef EFI_HII_IIBT_IMAGE_24BIT_BLOCK EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK;\r
+\r
+\r
+\r
+//\r
+// EFI_HII_IIBT_IMAGE_4BIT_BASE\r
+// \r
+typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BASE {\r
+  UINT16 Width;\r
+  UINT16 Height;\r
+  // UINT8 Data[...];\r
+} EFI_HII_IIBT_IMAGE_4BIT_BASE;\r
+\r
+/**\r
+   \r
+  This record assigns the 4-bit-per-pixel bitmap data to the\r
+  ImageIdCurrent identifier using the specified palette and\r
+  increment ImageIdCurrent by one. The image????s upper left hand\r
+  corner pixel is the most significant nibble of the first bitmap\r
+  byte.\r
+\r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_IMAGE_4BIT.\r
+\r
+  @param PaletteIndex   Index of the palette in the palette\r
+                        information.\r
+\r
+  @param Bitmap   The bitmap specifies a series of pixels, four\r
+                  bits per pixel, left-to-right, top-to-bottom,\r
+                  and is padded out to the nearest byte. The\r
+                  number of bytes per bitmap can be calculated\r
+                  as: ((Width + 1)/2) Height.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK           Header;\r
+  UINT8                         PaletteIndex;\r
+  EFI_HII_IIBT_IMAGE_4BIT_BASE  Bitmap;\r
+} EFI_HII_IIBT_IMAGE_4BIT_BLOCK;\r
+\r
+typedef EFI_HII_IIBT_IMAGE_4BIT_BLOCK EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK;\r
+\r
+\r
+\r
+//\r
+// EFI_HII_IIBT_IMAGE_8BIT_BASE \r
+// \r
+typedef struct _EFI_HII_IIBT_IMAGE_8BIT_BASE {\r
+  UINT16  Width;\r
+  UINT16  Height;\r
+  // UINT8 Data[...];\r
+} EFI_HII_IIBT_IMAGE_8BIT_BASE;\r
+\r
+/**\r
+   \r
+  This record assigns the 8-bit-per-pixel bitmap data to the\r
+  ImageIdCurrent identifier using the specified palette and\r
+  increment ImageIdCurrent by one. The image????s upper left hand\r
+  corner pixel is the first bitmap byte.\r
+\r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_IMAGE_8BIT.\r
+\r
+  @param PaletteIndex   Index of the palette in the palette\r
+                        information.\r
+\r
+  @param Bitmap   The bitmap specifies a series of pixels, eight\r
+                  bits per pixel, left-to-right, top-to-bottom.\r
+                  The number of bytes per bitmap can be\r
+                  calculated as: Width * Height.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_IMAGE_8BIT_PALETTE {\r
+  EFI_HII_IMAGE_BLOCK           Header;\r
+  UINT8                         PaletteIndex;\r
+  EFI_HII_IIBT_IMAGE_8BIT_BASE  Bitmap;\r
+} EFI_HII_IIBT_IMAGE_8BIT_PALETTE;\r
+\r
+typedef EFI_HII_IIBT_IMAGE_8BIT_PALETTE   EFI_HII_IIBT_IMAGE_8BIT_TRANS_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  Indicates that the image with image ID ImageValueCurrent has the\r
+  same image as a previously defined image ID and increments\r
+  ImageValueCurrent by one\r
+\r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_DUPLICATE.\r
+\r
+  @param ImageId  The previously defined image ID with the exact\r
+                  same image.\r
+\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_DUPLICATE_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK   Header;\r
+  EFI_IMAGE_ID          ImageId;\r
+} EFI_HII_IIBT_DUPLICATE_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This record assigns the JPEG image data to the ImageIdCurrent\r
+  identifier and increment ImageIdCurrent by one. The JPEG decoder\r
+  is only required to cover the basic JPEG encoding types, which\r
+  are produced by standard available paint packages (for example:\r
+  MSPaint under Windows from Microsoft). This would include JPEG\r
+  encoding of high (1:1:1) and medium (4:1:1) quality with only\r
+  three components (R,G,B) ??C no support for the special gray\r
+  component encoding.\r
+\r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_IMAGE_JPEG.\r
+  \r
+  @param Size   Specifies the size of the JPEG encoded data.\r
+  \r
+  @param Data   JPEG encoded data with ????JFIF???? signature at\r
+                offset 6 in the data block. The JPEG encoded\r
+                data, specifies type of encoding and final size\r
+                of true-color image.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_JPEG {\r
+  EFI_HII_IMAGE_BLOCK Header;\r
+  UINT32              Size;\r
+  //UINT8 Data[ Â¡Â­ ];\r
+} EFI_HII_IIBT_JPEG;\r
+\r
+\r
+/**\r
+   \r
+  Increments the current image ID ImageIdCurrent by the number\r
+  specified.\r
+  \r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_SKIP1.\r
+  \r
+  @param SkipCount  The unsigned 8-bit value to add  to\r
+                    ImageIdCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_SKIP1_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK Header;\r
+  UINT8               SkipCount;\r
+} EFI_HII_IIBT_SKIP1_BLOCK;\r
+\r
+/**\r
+  \r
+  Increments the current image ID ImageIdCurrent by the number\r
+  specified.\r
+  \r
+  @param Header   Standard image header, where Header.BlockType\r
+                  = EFI_HII_IIBT_SKIP2.\r
+  \r
+  @param SkipCount  The unsigned 16-bit value to add to\r
+                    ImageIdCurrent.\r
+\r
+**/\r
+typedef struct _EFI_HII_IIBT_SKIP2_BLOCK {\r
+  EFI_HII_IMAGE_BLOCK   Header;\r
+  UINT16                SkipCount;\r
+} EFI_HII_IIBT_SKIP2_BLOCK;\r
+\r
+\r
+/**\r
+   \r
+  This fixed header is followed by zero or more variable-length\r
+  palette information records. The structures are assigned a\r
+  number 1 to n.\r
+\r
+  @param PaletteCount   Number of palettes.\r
+\r
+**/\r
+typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER {\r
+  UINT16  PaletteCount;\r
+} EFI_HII_IMAGE_PALETTE_INFO_HEADER;\r
+\r
+/**\r
+   \r
+  Each palette information record is an array of 24-bit color\r
+  structures. The first entry (PaletteValue[0]) corresponds to\r
+  color 0 in the source image; the second entry (PaletteValue[1])\r
+  corresponds to color 1, etc. Each palette entry is a three byte\r
+  entry, with the first byte equal to the blue component of the\r
+  color, followed by green, and finally red (B,G,R). Each color\r
+  component value can vary from 0x00 (color off) to 0xFF (color\r
+  full on), allowing 16.8 millions colors that can be specified.\r
+\r
+  @param PaletteSize  Size of the palette information.\r
+  \r
+  @param PaletteValue   Array of color values.\r
+  \r
+**/\r
+typedef struct _EFI_HII_IMAGE_PALETTE_INFO {\r
+  UINT16 PaletteSize;\r
+  // EFI_HII_RGB_PIXEL PaletteValue[...];\r
+} EFI_HII_IMAGE_PALETTE_INFO;\r
+\r
+\r
+\r
+//\r
+// EFI_HII_DATABASE_NOTIFY_TYPE\r
+// \r
+typedef UINTN   EFI_HII_DATABASE_NOTIFY_TYPE;\r
+#define EFI_HII_DATABASE_NOTIFY_NEW_PACK    0x00000001\r
+#define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002\r
+#define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004\r
+#define EFI_HII_DATABASE_NOTIFY_ADD_PACK    0x00000008\r
+/**\r
+   \r
+  Functions which are registered to receive notification of\r
+  database events have this prototype. The actual event is encoded\r
+  in NotifyType. The following table describes how PackageType,\r
+  PackageGuid, Handle, and Package are used for each of the\r
+  notification types.\r
+\r
+  @param PackageType  Package type of the notification.\r
+\r
+  @param PackageGuid  If PackageType is\r
+                      EFI_HII_PACKAGE_TYPE_GUID, then this is\r
+                      the pointer to the GUID from the Guid\r
+                      field of EFI_HII_PACKAGE_GUID_HEADER.\r
+                      Otherwise, it must be NULL.\r
+\r
+  @param Package  Points to the package referred to by the\r
+                  notification Handle The handle of the package\r
+                  list which contains the specified package.\r
+\r
+  @param NotifyType   The type of change concerning the\r
+                      database. See\r
+                      EFI_HII_DATABASE_NOTIFY_TYPE.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_DATABASE_NOTIFY) (\r
+  IN CONST  UINT8                         PackageType,\r
+  IN CONST  EFI_GUID                      *PackageGuid,\r
+  IN CONST  EFI_HII_PACKAGE_HEADER        *Package,\r
+  IN CONST  EFI_HII_HANDLE                Handle,\r
+  IN CONST  EFI_HII_DATABASE_NOTIFY_TYPE  NotifyType\r
+);\r
+\r
+/**\r
+\r
+  This function adds the packages in the package list to the\r
+  database and returns a handle. If there is a\r
+  EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then\r
+  this function will create a package of type\r
+  EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For\r
+  each package in the package list, registered functions with the\r
+  notification type NEW_PACK and having the same package type will\r
+  be called. For each call to NewPackageList(), there should be a\r
+  corresponding call to\r
+  EFI_HII_DATABASE_PROTOCOL.RemovePackageList().\r
+\r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+\r
+  @param PackageList  A pointer to an\r
+                      EFI_HII_PACKAGE_LIST_HEADER structure.\r
+\r
+  @param DriverHandle   Associate the package list with this EFI\r
+                        handle Handle A pointer to the\r
+                        EFI_HII_HANDLE instance.\r
+\r
+  @retval EFI_SUCCESS   The package list associated with the\r
+                        Handle was added to the HII database.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate necessary\r
+                                resources for the new database\r
+                                contents.\r
+\r
+  @retval EFI_INVALID_PARAMETER   PackageList is NULL or Handle\r
+                                  is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_NEW_PACK) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL   *This,\r
+  IN CONST  EFI_HII_PACKAGE_LIST_HEADER *PackageList,\r
+  IN CONST  EFI_HANDLE                  DriverHandle,\r
+  OUT       EFI_HII_HANDLE              *Handle\r
+);\r
+\r
+\r
+/**\r
+\r
+  This function removes the package list that is associated with a\r
+  handle Handle from the HII database. Before removing the\r
+  package, any registered functions with the notification type\r
+  REMOVE_PACK and the same package type will be called. For each\r
+  call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should\r
+  be a corresponding call to RemovePackageList.\r
+\r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+  \r
+  @param Handle   The handle that was registered to the data\r
+                  that is requested for removal.\r
+  \r
+  @retval EFI_SUCCESS   The data associated with the Handle was\r
+                        removed from the HII database.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   The Handle was not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_REMOVE_PACK) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_HII_HANDLE            Handle\r
+);\r
+\r
+\r
+/**\r
+   \r
+  This function updates the existing package list (which has the\r
+  specified Handle) in the HII databases, using the new package\r
+  list specified by PackageList. The update process has the\r
+  following steps: Collect all the package types in the package\r
+  list specified by PackageList. A package type consists of the\r
+  Type field of EFI_HII_PACKAGE_HEADER and, if the Type is\r
+  EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in\r
+  EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within\r
+  the existing package list in the HII database specified by\r
+  Handle. If a package??s type matches one of the types collected\r
+  in step 1, then perform the following steps:\r
+  - Call any functions registered with the notification type\r
+  REMOVE_PACK.\r
+  - Remove the package from the package list and the HII\r
+  database.\r
+  Add all of the packages within the new package list specified\r
+  by PackageList, using the following steps:\r
+  - Add the package to the package list and the HII database.\r
+  - Call any functions registered with the notification type\r
+  ADD_PACK.\r
+\r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+  \r
+  @param Handle   The handle that was registered to the data\r
+                  that is requested for removal.\r
+  \r
+  @param PackageList  A pointer to an EFI_HII_PACKAGE_LIST\r
+                      package.\r
+  \r
+  @retval EFI_SUCCESS   The HII database was successfully\r
+                        updated.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate enough memory\r
+                                for the updated database.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   The Handle was not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_UPDATE_PACK) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL   *This,\r
+  IN CONST  EFI_HII_HANDLE              Handle,\r
+  IN CONST  EFI_HII_PACKAGE_LIST_HEADER *PackageList\r
+);\r
+\r
+\r
+/**\r
+  \r
+  This function returns a list of the package handles of the   \r
+  specified type that are currently active in the database. The   \r
+  pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package   \r
+  handles to be listed.\r
+  \r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+  \r
+  @param PackageType  Specifies the package type of the packages\r
+                      to list or EFI_HII_PACKAGE_TYPE_ALL for\r
+                      all packages to be listed.\r
+  \r
+  @param PackageGuid  If PackageType is\r
+                      EFI_HII_PACKAGE_TYPE_GUID, then this is\r
+                      the pointer to the GUID which must match\r
+                      the Guid field of\r
+                      EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
+                      must be NULL.\r
+  \r
+  @param HandleBufferLength   On input, a pointer to the length\r
+                              of the handle buffer. On output,\r
+                              the length of the handle buffer\r
+                              that is required for the handles\r
+                              found.\r
+\r
+  @param Handle   An array of EFI_HII_HANDLE instances returned.\r
+\r
+\r
+  @retval EFI_SUCCESS   Handle was updated successfully.\r
+\r
+  @retval EFI_BUFFER_TOO_SMALL  The HandleBufferLength parameter\r
+                                indicates that Handle is too\r
+                                small to support the number of\r
+                                handles. HandleBufferLength is\r
+                                updated with a value that will\r
+                                enable the data to fit.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_LIST_PACKS) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  UINT8                     PackageType,\r
+  IN CONST  EFI_GUID                  *PackageGuid,\r
+  IN OUT    UINTN                     *HandleBufferLength,\r
+  OUT       EFI_HII_HANDLE            *Handle\r
+);\r
+\r
+\r
+\r
+\r
+\r
+\r
+/**\r
+\r
+  This function will export one or all package lists in the\r
+  database to a buffer. For each package list exported, this\r
+  function will call functions registered with EXPORT_PACK and\r
+  then copy the package list to the buffer. The registered\r
+  functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()\r
+  to modify the package list before it is copied to the buffer. If\r
+  the specified BufferSize is too small, then the status\r
+  EFI_OUT_OF_RESOURCES will be returned and the actual package\r
+  size will be returned in BufferSize.\r
+\r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+\r
+  @param Handle   An EFI_HII_HANDLE that corresponds to the\r
+                  desired package list in the HII database to\r
+                  export or NULL to indicate all package lists\r
+                  should be exported. \r
+\r
+  @param BufferSize   On input, a pointer to the length of the\r
+                      buffer. On output, the length of the\r
+                      buffer that is required for the exported\r
+                      data.\r
+\r
+  @param Buffer   A pointer to a buffer that will contain the\r
+                  results of the export function.\r
+  \r
+  \r
+  @retval EFI_SUCCESS   Package exported.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  BufferSize is too small to hold\r
+                                the package.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_EXPORT_PACKS) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_HII_HANDLE            Handle,\r
+  IN OUT    UINTN                     *BufferSize,\r
+  OUT       EFI_HII_PACKAGE_HEADER    *Buffer\r
+);\r
+\r
+\r
+/**\r
+   \r
+  \r
+  This function registers a function which will be called when\r
+  specified actions related to packages of the specified type\r
+  occur in the HII database. By registering a function, other\r
+  HII-related drivers are notified when specific package types\r
+  are added, removed or updated in the HII database. Each driver\r
+  or application which registers a notification should use\r
+  EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before\r
+  exiting.\r
+  \r
+  \r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+\r
+  @param PackageType  The package type. See\r
+                      EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER. \r
+\r
+  @param PackageGuid  If PackageType is\r
+                      EFI_HII_PACKAGE_TYPE_GUID, then this is\r
+                      the pointer to the GUID which must match\r
+                      the Guid field of\r
+                      EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it\r
+                      must be NULL.\r
+\r
+  @param PackageNotifyFn  Points to the function to be called\r
+                          when the event specified by\r
+                          NotificationType occurs. See\r
+                          EFI_HII_DATABASE_NOTIFY.\r
+\r
+  @param NotifyType   Describes the types of notification which\r
+                      this function will be receiving. See\r
+                      EFI_HII_DATABASE_NOTIFY_TYPE for more a\r
+                      list of types.\r
+\r
+  @param NotifyHandle   Points to the unique handle assigned to\r
+                        the registered notification. Can be used\r
+                        in\r
+                        EFI_HII_DATABASE_PROTOCOL.UnregisterPack\r
+                        to stop notifications.\r
+\r
+\r
+  @retval EFI_SUCCESS   Notification registered successfully.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate necessary\r
+                                data structures.\r
+\r
+  @retval EFI_INVALID_PARAMETER   PackageGuid is not NULL when\r
+                                  PackageType is not\r
+                                  EFI_HII_PACKAGE_TYPE_GUID.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_REGISTER_NOTIFY) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL     *This,\r
+  IN CONST  UINT8                         PackageType,\r
+  IN CONST  EFI_GUID                      *PackageGuid,\r
+  IN CONST  EFI_HII_DATABASE_NOTIFY       PackageNotifyFn,\r
+  IN CONST  EFI_HII_DATABASE_NOTIFY_TYPE  NotifyType,\r
+  OUT       EFI_HANDLE                    *NotifyHandle\r
+);\r
+\r
+\r
+/**\r
+   \r
+  Removes the specified HII database package-related notification.\r
+  \r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+  \r
+  @param NotificationHandle   The handle of the notification\r
+                              function being unregistered.\r
+  \r
+  @retval EFI_SUCCESS   Unregister the notification\r
+                        Successsfully\r
+  \r
+  @retval EFI_INVALID_PARAMETER   The Handle is invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_UNREGISTER_NOTIFY) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_HANDLE                NotificationHandle\r
+);\r
+\r
+\r
+/**\r
+   \r
+  @param Header   The general pack header which defines both the\r
+                  type of pack and the length of the entire\r
+                  pack.\r
+\r
+  @param LayoutCount  The number of keyboard layouts contained\r
+                      in the entire keyboard pack.\r
+\r
+  @param Layout   An array of LayoutCount number of keyboard\r
+                  layouts.\r
+\r
+**/\r
+typedef struct {\r
+  EFI_HII_PACKAGE_HEADER  Header;\r
+  UINT16                  LayoutCount;\r
+  // EFI_HII_KEYBOARD_LAYOUT Layout[...];\r
+} EFI_HII_KEYBOARD_PACK;\r
+\r
+/**\r
+   \r
+  @param LayoutLength   The length of the current keyboard\r
+                        layout.\r
+\r
+  @param Guid   The unique ID associated with this keyboard\r
+                layout.\r
+\r
+  @param LayoutDescriptorString   An offset location (0 is the\r
+                                  beginning of the\r
+                                  EFI_KEYBOARD_LAYOUT instance)\r
+                                  of the string which describes\r
+                                  this keyboard layout. The data\r
+                                  that is being referenced is in\r
+                                  EFI_DESCRIPTION_STRING_BUNDLE\r
+                                  format.\r
+\r
+  @param DescriptorCount  The number of Descriptor entries in\r
+                          this layout.\r
+\r
+  @param Descriptors  An array of key descriptors.\r
+\r
+**/\r
+typedef struct {\r
+  UINT16              LayoutLength;\r
+  EFI_GUID            Guid;\r
+  RELOFST             LayoutDescriptorString;\r
+  UINT8               DescriptorCount;\r
+  // EFI_KEY_DESCRIPTOR   Descriptors[...];\r
+} EFI_HII_KEYBOARD_LAYOUT;\r
+\r
+\r
+/**\r
+   \r
+  @param Language   The language to associate with\r
+                    DescriptionString.\r
+\r
+  @param Space  A space (U-0x0020) character to force as a\r
+                separator between the Language field and the\r
+                formal description string.\r
+\r
+  @param DescriptionString  A null-terminated description\r
+                            string.\r
+\r
+**/\r
+typedef struct {\r
+  CHAR16  Language[3];\r
+  CHAR16  Space;\r
+  CHAR16  DescriptionString[1];\r
+} EFI_DESCRIPTION_STRING;\r
+\r
+/**\r
+   \r
+  @param DescriptionCount   The number of description strings.\r
+\r
+  @param DescriptionString  An array of language-specific\r
+                            description strings.\r
+\r
+**/\r
+typedef struct {\r
+  UINT16                  DescriptionCount;\r
+  // EFI_DESCRIPTION_STRING   DescriptionString[];\r
+} EFI_DESCRIPTION_STRING_BUNDLE;\r
+\r
+/**\r
+\r
+  See the figure below for which key corresponds to the values in\r
+  the enumeration above. For example, EfiKeyLCtrl corresponds to\r
+  the left control key in the lower-left corner of the keyboard,\r
+  EfiKeyFour corresponds to the 4 key on the numeric keypad, and\r
+  EfiKeySLck corresponds to the Scroll Lock key in the upper-right\r
+  corner of the keyboard.\r
+\r
+**/\r
+typedef enum {\r
+  EfiKeyLCtrl, EfiKeyA0, EfiKeyLAlt, EfiKeySpaceBar,\r
+  EfiKeyA2, EfiKeyA3, EfiKeyA4, EfiKeyRCtrl, EfiKeyLeftArrow,\r
+  EfiKeyDownArrow, EfiKeyRightArrow, EfiKeyZero,\r
+  EfiKeyPeriod, EfiKeyEnter, EfiKeyLShift, EfiKeyB0,\r
+  EfiKeyB1, EfiKeyB2, EfiKeyB3, EfiKeyB4, EfiKeyB5, EfiKeyB6,\r
+  EfiKeyB7, EfiKeyB8, EfiKeyB9, EfiKeyB10, EfiKeyRshift,\r
+  EfiKeyUpArrow, EfiKeyOne, EfiKeyTwo, EfiKeyThree,\r
+  EfiKeyCapsLock, EfiKeyC1, EfiKeyC2, EfiKeyC3, EfiKeyC4,\r
+  EfiKeyC5, EfiKeyC6, EfiKeyC7, EfiKeyC8, EfiKeyC9,\r
+  EfiKeyC10, EfiKeyC11, EfiKeyC12, EfiKeyFour, EfiKeyFive,\r
+  EfiKeySix, EfiKeyPlus, EfiKeyTab, EfiKeyD1, EfiKeyD2,\r
+  EfiKeyD3, EfiKeyD4, EfiKeyD5, EfiKeyD6, EfiKeyD7, EfiKeyD8,\r
+  EfiKeyD9, EfiKeyD10, EfiKeyD11, EfiKeyD12, EfiKeyD13,\r
+  EfiKeyDel, EfiKeyEnd, EfiKeyPgDn, EfiKeySeven, EfiKeyEight,\r
+  EfiKeyNine, EfiKeyE0, EfiKeyE1, EfiKeyE2, EfiKeyE3,\r
+  EfiKeyE4, EfiKeyE5, EfiKeyE6, EfiKeyE7, EfiKeyE8, EfiKeyE9,\r
+  EfiKeyE10, EfiKeyE11, EfiKeyE12, EfiKeyBackSpace,\r
+  EfiKeyIns, EfiKeyHome, EfiKeyPgUp, EfiKeyNLck, EfiKeySlash,\r
+  EfiKeyAsterisk, EfiKeyMinus, EfiKeyEsc, EfiKeyF1, EfiKeyF2,\r
+  EfiKeyF3, EfiKeyF4, EfiKeyF5, EfiKeyF6, EfiKeyF7, EfiKeyF8,\r
+  EfiKeyF9, EfiKeyF10, EfiKeyF11, EfiKeyF12, EfiKeyPrint,\r
+  EfiKeySLck, EfiKeyPause\r
+} EFI_KEY;\r
+\r
+/**\r
+   \r
+  @param Key Used to describe a physical key on a keyboard.\r
+\r
+  @param Unicode  Unicode value for the Key.\r
+\r
+  @param ShiftedUnicode   Unicode value for the key with the\r
+                          shift key being held down. \r
+\r
+  @param AltGrUnicode   Unicode value for the key with the\r
+                        Alt-GR being held down.\r
+\r
+  @param ShiftedAltGrUnicode  Unicode value for the key with the\r
+                              Alt-GR and shift keys being held down.\r
+\r
+  @param Modifier   Modifier keys are defined to allow for\r
+                    special functionality that is not\r
+                    necessarily accomplished by a printable\r
+                    character. Many of these modifier keys are\r
+                    flags to toggle certain state bits on and\r
+                    off inside of a keyboard driver.\r
+  \r
+**/\r
+typedef struct {\r
+  EFI_KEY Key;\r
+  CHAR16  Unicode;\r
+  CHAR16  ShiftedUnicode;\r
+  CHAR16  AltGrUnicode;\r
+  CHAR16  ShiftedAltGrUnicode;\r
+  UINT16  Modifier;\r
+} EFI_KEY_DESCRIPTOR;\r
+\r
+\r
+//\r
+// Modifier values\r
+//\r
+#define EFI_NULL_MODIFIER                 0x0000\r
+#define EFI_LEFT_CONTROL_MODIFIER         0x0001\r
+#define EFI_RIGHT_CONTROL_MODIFIER        0x0002\r
+#define EFI_LEFT_ALT_MODIFIER             0x0003\r
+#define EFI_RIGHT_ALT_MODIFIER            0x0004\r
+#define EFI_ALT_GR_MODIFIER               0x0005\r
+#define EFI_INSERT_MODIFIER               0x0006\r
+#define EFI_DELETE_MODIFIER               0x0007\r
+#define EFI_PAGE_DOWN_MODIFIER            0x0008\r
+#define EFI_PAGE_UP_MODIFIER              0x0009\r
+#define EFI_HOME_MODIFIER                 0x000A\r
+#define EFI_END_MODIFIER                  0x000B\r
+#define EFI_LEFT_SHIFT_MODIFIER           0x000C\r
+#define EFI_RIGHT_SHIFT_MODIFIER          0x000D\r
+#define EFI_CAPS_LOCK_MODIFIER            0x000E\r
+#define EFI_NUM_LOCK _MODIFIER            0x000F\r
+#define EFI_LEFT_ARROW_MODIFIER           0x0010\r
+#define EFI_RIGHT_ARROW_MODIFIER          0x0011\r
+#define EFI_DOWN_ARROW_MODIFIER           0x0012\r
+#define EFI_UP_ARROW_MODIFIER             0X0013\r
+#define EFI_NS_KEY_MODIFIER               0x0014\r
+#define EFI_NS_KEY_DEPENDENCY_MODIFIER    0x0015\r
+#define EFI_FUNCTION_KEY_ONE_MODIFIER     0x0016\r
+#define EFI_FUNCTION_KEY_TWO_MODIFIER     0x0017\r
+#define EFI_FUNCTION_KEY_THREE_MODIFIER   0x0018\r
+#define EFI_FUNCTION_KEY_FOUR_MODIFIER    0x0019\r
+#define EFI_FUNCTION_KEY_FIVE_MODIFIER    0x001A\r
+#define EFI_FUNCTION_KEY_SIX_MODIFIER     0x001B\r
+#define EFI_FUNCTION_KEY_SEVEN_MODIFIER   0x001C\r
+#define EFI_FUNCTION_KEY_EIGHT_MODIFIER   0x001D\r
+#define EFI_FUNCTION_KEY_NINE_MODIFIER    0x001E\r
+#define EFI_FUNCTION_KEY_TEN_MODIFIER     0x001F\r
+#define EFI_FUNCTION_KEY_ELEVEN_MODIFIER  0x0020\r
+#define EFI_FUNCTION_KEY_TWELVE_MODIFIER  0x0021\r
+//\r
+// Keys that have multiple control functions based on modifier\r
+// settings are handled in the keyboard driver implementation.\r
+// For instance PRINT_KEY might have a modifier held down and\r
+// is still a nonprinting character, but might have an alternate\r
+// control function like SYSREQUEST\r
+//\r
+#define EFI_PRINT_MODIFIER                0x0022\r
+#define EFI_SYS_REQUEST_MODIFIER          0x0023\r
+#define EFI_SCROLL_LOCK_MODIFIER          0x0024\r
+#define EFI_PAUSE_MODIFIER                0x0025\r
+#define EFI_BREAK_MODIFIER                0x0026\r
+\r
+\r
+\r
+/**\r
+   \r
+  This routine retrieves an array of GUID values for each keyboard\r
+  layout that was previously registered in the system.\r
+\r
+  @param This   A pointer to the EFI_HII_PROTOCOL instance.\r
+\r
+  @param KeyGuidBufferLength  On input, a pointer to the length\r
+                              of the keyboard GUID buffer. On\r
+                              output, the length of the handle\r
+                              buffer that is required for the\r
+                              handles found. KeyGuidBuffer An\r
+                              array of keyboard layout GUID\r
+                              instances returned.\r
+\r
+  @retval EFI_SUCCESS   KeyGuidBuffer was updated successfully.\r
+  \r
+  @retval EFI_BUFFER_TOO_SMALL  The KeyGuidBufferLength\r
+                                parameter indicates that\r
+                                KeyGuidBuffer is too small to\r
+                                support the number of GUIDs.\r
+                                KeyGuidBufferLength is updated\r
+                                with a value that will enable\r
+                                the data to fit.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN OUT    UINT16                    *KeyGuidBufferLength,\r
+  OUT       EFI_GUID                  *KeyGuidBuffer\r
+);\r
+\r
+\r
+/**\r
+   \r
+  This routine retrieves the requested keyboard layout. The layout\r
+  is a physical description of the keys on a keyboard and the\r
+  character(s) that are associated with a particular set of key\r
+  strokes.\r
+\r
+  @param This   A pointer to the EFI_HII_PROTOCOL instance.\r
+  \r
+  @param KeyGuid  A pointer to the unique ID associated with a\r
+                  given keyboard layout. If KeyGuid is NULL then\r
+                  the current layout will be retrieved.\r
+  \r
+  @param KeyboardLayout A pointer to a buffer containing the\r
+                        retrieved keyboard layout. below.\r
+  \r
+  @retval EFI_SUCCESS   The keyboard layout was retrieved\r
+                        successfully.\r
+  \r
+  @retval EFI_NOT_FOUND   The requested keyboard layout was not\r
+                          found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_GUID                  *KeyGuid,\r
+  OUT       EFI_HII_KEYBOARD_LAYOUT   *KeyboardLayout\r
+);\r
+\r
+/**\r
+   \r
+  This routine sets the default keyboard layout to the one\r
+  referenced by KeyGuid. When this routine is called, an event\r
+  will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID\r
+  group type. This is so that agents which are sensitive to the\r
+  current keyboard layout being changed can be notified of this\r
+  change.\r
+\r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+\r
+  @param KeyGuid  A pointer to the unique ID associated with a\r
+                  given keyboard layout.\r
+\r
+\r
+  @retval EFI_SUCCESS   The current keyboard layout was\r
+                        successfully set.\r
+  \r
+  @retval EFI_NOT_FOUND   The referenced keyboard layout was not\r
+                          found, so action was taken.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_GUID                  *KeyGuid\r
+);\r
+\r
+/**\r
+   \r
+  Return the EFI handle associated with a package list.\r
+  \r
+  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL\r
+                instance.\r
+  \r
+  @param PackageListHandle  An EFI_HII_HANDLE that corresponds\r
+                            to the desired package list in the\r
+                            HIIdatabase.\r
+  \r
+  @param DriverHandle   On return, contains the EFI_HANDLE which\r
+                        was registered with the package list in\r
+                        NewPackageList().\r
+  \r
+  @retval EFI_SUCCESS   The DriverHandle was returned\r
+                        successfully.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   The PackageListHandle was not\r
+                                  valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_PACK_HANDLE) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_HII_HANDLE            PackageListHandle,\r
+  OUT       EFI_HANDLE                *DriverHandle\r
+);\r
+\r
+/**\r
+   \r
+  @param NewPackageList Add a new package list to the HII\r
+                        database.\r
+\r
+  @param RemovePackageList  Remove a package list from the HII\r
+                            database.\r
+\r
+  @param UpdatePackageList  Update a package list in the HII\r
+                            database.\r
+\r
+  @param ListPackageLists   List the handles of the package\r
+                            lists within the HII database. \r
+\r
+  @param ExportPackageLists Export package lists from the HII\r
+                            database.\r
+\r
+  @param RegisterPackageNotify  Register notification when\r
+                                packages of a certain type are\r
+                                installed.\r
+\r
+  @param UnregisterPackageNotify  Unregister notification of\r
+                                  packages.\r
+\r
+  @param FindKeyboardLayouts  Retrieves a list of the keyboard\r
+                              layouts in the system.\r
+\r
+  @param GetKeyboardLayout  Allows a program to extract the\r
+                            current keyboard layout. See the\r
+                            GetKeyboardLayout() function\r
+                            description.\r
+\r
+  @param SetKeyboardLayout  Changes the current keyboard layout.\r
+                            See the SetKeyboardLayout() function\r
+\r
+\r
+**/\r
+struct _EFI_HII_DATABASE_PROTOCOL {\r
+  EFI_HII_NEW_PACK                NewPackageList;\r
+  EFI_HII_REMOVE_PACK             RemovePackageList;\r
+  EFI_HII_UPDATE_PACK             UpdatePackageList;\r
+  EFI_HII_LIST_PACKS              ListPackageLists;\r
+  EFI_HII_EXPORT_PACKS            ExportPackageLists;\r
+  EFI_HII_REGISTER_NOTIFY         RegisterPackageNotify;\r
+  EFI_HII_UNREGISTER_NOTIFY       UnregisterPackageNotify;\r
+  EFI_HII_FIND_KEYBOARD_LAYOUTS   FindKeyboardLayouts;\r
+  EFI_HII_GET_KEYBOARD_LAYOUT     GetKeyboardLayout;\r
+  EFI_HII_SET_KEYBOARD_LAYOUT     SetKeyboardLayout;\r
+  EFI_HII_GET_PACK_HANDLE         GetPackageHandle;\r
+};\r
+\r
+extern EFI_GUID gEfiHiiDatabaseProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/HiiFont.h b/MdePkg/Include/Protocol/HiiFont.h
new file mode 100644 (file)
index 0000000..d581d53
--- /dev/null
@@ -0,0 +1,527 @@
+/** @file\r
+  The file provides services to retrieve font information.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: HiiFont.h\r
+\r
+**/\r
+\r
+#ifndef __HII_FONT_H__\r
+#define __HII_FONT_H__\r
+\r
+#include <Protocol/HiiImage.h>\r
+\r
+#define EFI_HII_FONT_PROTOCOL_GUID \\r
+{ 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } }\r
+\r
+typedef struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL;\r
+\r
+\r
+//\r
+// EFI_HII_OUT_FLAGS\r
+// \r
+typedef UINT32  EFI_HII_OUT_FLAGS;\r
+#define EFI_HII_OUT_FLAG_CLIP         0x00000001\r
+#define EFI_HII_OUT_FLAG_WRAP         0x00000002\r
+#define EFI_HII_OUT_FLAG_CLEAN_Y      0x00000004\r
+#define EFI_HII_OUT_FLAG_CLEAN_X      0x00000008\r
+#define EFI_HII_OUT_FLAG_TRANSPARENT  0x00000010\r
+#define EFI_HII_IGNORE_IF_NO_GLYPH    0x00000020\r
+#define EFI_HII_IGNORE_LINE_BREAK     0x00000040\r
+#define EFI_HII_DIRECT_TO_SCREEN      0x00000080\r
+\r
+/**\r
+\r
+  Definition of EFI_HII_ROW_INFO.\r
+\r
+  @param StartIndex The index of the first character in the\r
+                    string which is displayed on the line.\r
+\r
+  @param EndIndex The index of the last character in the string\r
+                  which is displayed on the line. If this is the\r
+                  same as StartIndex, then no characters are\r
+                  displayed.\r
+\r
+  @param LineHeight The height of the line, in pixels.\r
+\r
+  @param LineWidth  The width of the text on the line, in\r
+                    pixels.\r
+\r
+  @param BaselineOffset The number of pixels above the bottom of\r
+                        the row of the font baseline or 0 if\r
+                        none.\r
+\r
+**/\r
+typedef struct _EFI_HII_ROW_INFO {\r
+  UINTN   StartIndex;\r
+  UINTN   EndIndex;\r
+  UINTN   LineHeight;\r
+  UINTN   LineWidth;\r
+  UINTN   BaselineOffset;\r
+} EFI_HII_ROW_INFO;\r
+\r
+//\r
+// EFI_FONT_INFO_MASK\r
+// \r
+typedef UINT32  EFI_FONT_INFO_MASK;\r
+#define EFI_FONT_INFO_SYS_FONT        0x00000001\r
+#define EFI_FONT_INFO_SYS_SIZE        0x00000002\r
+#define EFI_FONT_INFO_SYS_STYLE       0x00000004\r
+#define EFI_FONT_INFO_SYS_FORE_COLOR  0x00000010\r
+#define EFI_FONT_INFO_SYS_BACK_COLOR  0x00000020\r
+#define EFI_FONT_INFO_RESIZE          0x00001000\r
+#define EFI_FONT_INFO_RESTYLE         0x00002000\r
+#define EFI_FONT_INFO_ANY_FONT        0x00010000\r
+#define EFI_FONT_INFO_ANY_SIZE        0x00020000\r
+#define EFI_FONT_INFO_ANY_STYLE       0x00040000\r
+\r
+//\r
+// EFI_FONT_INFO\r
+// \r
+typedef struct {\r
+  UINT32  FontStyle;\r
+  UINT16  FontSize;\r
+  CHAR16  FontName[1];\r
+} EFI_FONT_INFO;\r
+\r
+/**\r
+  This structure is used for describing the way in which a string\r
+  should be rendered in a particular font. FontInfo specifies the\r
+  basic font information and ForegroundColor and BackgroundColor\r
+  specify the color in which they should be displayed. The flags\r
+  in FontInfoMask describe where the system default should be\r
+  supplied instead of the specified information. The flags also\r
+  describe what options can be used to make a match between the\r
+  font requested and the font available. If EFI_FONT_INFO_SYS_FONT\r
+  is specified, then the font name in FontInfo is ignored and the\r
+  system font name is used. This flag cannot be used with\r
+  EFI_FONT_INFO_ANY_FONT. If EFI_FONT_INFO_SYS_SIZE is specified,\r
+  then the font height specified in FontInfo is ignored and the\r
+  system font height is used instead. This flag cannot be used\r
+  with EFI_FONT_INFO_ANY_SIZE. If EFI_FONT_INFO_SYS_STYLE is\r
+  specified, then the font style in FontInfo is ignored and the\r
+  system font style is used. This flag cannot be used with\r
+  EFI_FONT_INFO_ANY_STYLE. If EFI_FONT_INFO_SYS_FORE_COLOR is\r
+  specified, then ForegroundColor is ignored and the system\r
+  foreground color is used. If EFI_FONT_INFO_SYS_BACK_COLOR is\r
+  specified, then BackgroundColor is ignored and the system\r
+  background color is used. If EFI_FONT_INFO_RESIZE is specified,\r
+  then the system may attempt to stretch or shrink a font to meet\r
+  the size requested. This flag cannot be used with\r
+  EFI_FONT_INFO_ANY_SIZE. If EFI_FONT_INFO_RESTYLE is specified,\r
+  then the system may attempt to remove some of the specified\r
+  styles in order to meet the style requested. This flag cannot be\r
+  used with EFI_FONT_INFO_ANY_STYLE. If EFI_FONT_INFO_ANY_FONT is\r
+  specified, then the system may attempt to match with any font.\r
+  This flag cannot be used with EFI_FONT_INFO_SYS_FONT. If\r
+  EFI_FONT_INFO_ANY_SIZE is specified, then the system may attempt\r
+  to match with any font size. This flag cannot be used with\r
+  EFI_FONT_INFO_SYS_SIZE or EFI_FONT_INFO_RESIZE. If\r
+  EFI_FONT_INFO_ANY_STYLE is specified, then the system may\r
+  attempt to match with any font style. This flag cannot be used\r
+  with EFI_FONT_INFO_SYS_STYLE or EFI_FONT_INFO_RESTYLE.\r
+\r
+  @param FontInfo Points to the font information or NULL if the\r
+                  string should use the default system font.\r
+  \r
+  @param ForegroundColor  The color of the "on" pixels in the\r
+                          glyph in the bitmap.\r
+  \r
+  @param BackgroundColor  The color of the "off" pixels in the\r
+                          glyph in the bitmap.\r
+  \r
+  @param FontInfoMask   The font information mask determines\r
+                        which portion of the font information\r
+                        will be used and what to do if the\r
+                        specific font is not available.\r
+  \r
+**/\r
+typedef struct _EFI_FONT_DISPLAY_INFO {\r
+  EFI_FONT_INFO                 FontInfo;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL ForegroundColor;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundColor;\r
+  EFI_FONT_INFO_MASK            FontInfoMask;\r
+} EFI_FONT_DISPLAY_INFO;\r
+\r
+/**\r
+\r
+  This function renders a string to a bitmap or the screen using\r
+  the specified font, color and options. It either draws the\r
+  string and glyphs on an existing bitmap, allocates a new bitmap\r
+  or uses the screen. The strings can be clipped or wrapped.\r
+  Optionally, the function also returns the information about each\r
+  row and the character position on that row. If\r
+  EFI_HII_OUT_FLAG_CLIP is set, then text will be formatted only\r
+  based on explicit line breaks and all pixels which would lie\r
+  outside the bounding box specified by Width and Height are\r
+  ignored. The information in the RowInfoArray only describes\r
+  characters which are at least partially displayed. For the final\r
+  row, the LineHeight and BaseLine may describe pixels which are\r
+  outside the limit specified by Height (unless\r
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is specified) even though those\r
+  pixels were not drawn. The LineWidth may describe pixels which\r
+  are outside the limit specified by Width (unless\r
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_X is specified) even though those\r
+  pixels were not drawn. If EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set,\r
+  then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP so that\r
+  if a character????s right-most on pixel cannot fit, then it will\r
+  not be drawn at all. This flag requires that\r
+  EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_CLIP_CLEAN_Y\r
+  is set, then it modifies the behavior of EFI_HII_OUT_FLAG_CLIP\r
+  so that if a row????s bottom-most pixel cannot fit, then it will\r
+  not be drawn at all. This flag requires that\r
+  EFI_HII_OUT_FLAG_CLIP be set. If EFI_HII_OUT_FLAG_WRAP is set,\r
+  then text will be wrapped at the right-most line-break\r
+  opportunity prior to a character whose right-most extent would\r
+  exceed Width. If no line-break opportunity can be found, then\r
+  the text will behave as if EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set.\r
+  This flag cannot be used with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If\r
+  EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is\r
+  ignored and all ????off???? pixels in the character????s drawn\r
+  will use the pixel value from Blt. This flag cannot be used if\r
+  Blt is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set,\r
+  then characters which have no glyphs are not drawn. Otherwise,\r
+  they are replaced with Unicode character 0xFFFD (REPLACEMENT\r
+  CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit\r
+  line break characters will be ignored. If\r
+  EFI_HII_DIRECT_TO_SCREEN is set, then the string will be written\r
+  directly to the output device specified by Screen. Otherwise the\r
+  string will be rendered to the bitmap specified by Bitmap.\r
+\r
+  @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
+\r
+  @param Flags  Describes how the string is to be drawn.\r
+\r
+  @param String Points to the null-terminated string to be\r
+                displayed.\r
+\r
+  @param StringInfo Points to the string output information,\r
+                    including the color and font. If NULL, then\r
+                    the string will be output in the default\r
+                    system font and color.\r
+\r
+  @param Blt  If this points to a non-NULL on entry, this points\r
+              to the image, which is Width pixels wide and\r
+              Height pixels high. The string will be drawn onto\r
+              this image and EFI_HII_OUT_FLAG_CLIP is implied.\r
+              If this points to a NULL on entry, then a buffer\r
+              will be allocated to hold the generated image and\r
+              the pointer updated on exit. It is the caller's\r
+              responsibility to free this buffer.\r
+\r
+  @param BltX, BltY Specifies the offset from the left and top\r
+                    edge of the image of the first character\r
+                    cell in the image.\r
+\r
+  @param RowInfoArray If this is non-NULL on entry, then on\r
+                    exit, this will point to an allocated buffer\r
+                    containing row information and\r
+                    RowInfoArraySize will be updated to contain\r
+                    the number of elements. This array describes\r
+                    the characters which were at least partially\r
+                    drawn and the heights of the rows. It is the\r
+                    caller's responsibility to free this buffer.\r
+\r
+  @param RowInfoArraySize If this is non-NULL on entry, then on\r
+                          exit it contains the number of\r
+                          elements in RowInfoArray.\r
+\r
+  @param ColumnInfoArray If this is non-NULL, then on return it\r
+                          will be filled with the horizontal\r
+                          offset for each character in the\r
+                          string on the row where it is\r
+                          displayed. Non-printing characters\r
+                          will have the offset ~0. The caller is\r
+                          responsible to allocate a buffer large\r
+                          enough so that there is one entry for\r
+                          each character in the string, not\r
+                          including the null-terminator. It is\r
+                          possible when character display is\r
+                          normalized that some character cells\r
+                          overlap.\r
+\r
+  @retval EFI_SUCCESS The string was successfully updated.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output\r
+                                buffer for RowInfoArray or Blt.\r
+  \r
+  @retval EFI_INVALID_PARAMETER The String or Blt or Height or\r
+                                Width was NULL.\r
+\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_STRING_TO_IMAGE) (\r
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,\r
+  IN CONST  EFI_HII_OUT_FLAGS     Flags,\r
+  IN CONST  EFI_STRING            String,\r
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfo,\r
+  IN OUT    EFI_IMAGE_OUTPUT      **Blt,\r
+  IN CONST  UINTN                 BltX,\r
+  IN CONST  UINTN                 BltY,\r
+  OUT       EFI_HII_ROW_INFO      **RowInfoArray OPTIONAL,\r
+  OUT       UINTN                 *RowInfoArraySize OPTIONAL,\r
+  OUT       UINTN                 *ColumnInfoArray OPTIONAL\r
+);\r
+\r
+\r
+\r
+/**\r
+\r
+  This function renders a string as a bitmap or to the screen\r
+  and can clip or wrap the string. The bitmap is either supplied\r
+  by the caller or else is allocated by the function. The\r
+  strings are drawn with the font, size and style specified and\r
+  can be drawn transparently or opaquely. The function can also\r
+  return information about each row and each character's\r
+  position on the row. If EFI_HII_OUT_FLAG_CLIP is set, then\r
+  text will be formatted only based on explicit line breaks and\r
+  all pixels which would lie outside the bounding box specified\r
+  by Width and Height are ignored. The information in the\r
+  RowInfoArray only describes characters which are at least\r
+  partially displayed. For the final row, the LineHeight and\r
+  BaseLine may describe pixels which are outside the limit\r
+  specified by Height (unless EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is\r
+  specified) even though those pixels were not drawn. If\r
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set, then it modifies the\r
+  behavior of EFI_HII_OUT_FLAG_CLIP so that if a character????s\r
+  right-most on pixel cannot fit, then it will not be drawn at\r
+  all. This flag requires that EFI_HII_OUT_FLAG_CLIP be set. If\r
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_Y is set, then it modifies the\r
+  behavior of EFI_HII_OUT_FLAG_CLIP so that if a row????s bottom\r
+  most pixel cannot fit, then it will not be drawn at all. This\r
+  flag requires that EFI_HII_OUT_FLAG_CLIP be set. Draft for\r
+  Review HII Protocols Version 2.1 November 3, 2006 1285 If\r
+  EFI_HII_OUT_FLAG_WRAP is set, then text will be wrapped at the\r
+  right-most line-break opportunity prior to a character whose\r
+  right-most extent would exceed Width. If no line-break\r
+  opportunity can be found, then the text will behave as if\r
+  EFI_HII_OUT_FLAG_CLIP_CLEAN_X is set. This flag cannot be used\r
+  with EFI_HII_OUT_FLAG_CLIP_CLEAN_X. If\r
+  EFI_HII_OUT_FLAG_TRANSPARENT is set, then BackgroundColor is\r
+  ignored and all off¡± pixels in the character¡¯s glyph will\r
+  use the pixel value from Blt. This flag cannot be used if Blt\r
+  is NULL upon entry. If EFI_HII_IGNORE_IF_NO_GLYPH is set, then\r
+  characters which have no glyphs are not drawn. Otherwise, they\r
+  are replaced with Unicode character 0xFFFD (REPLACEMENT\r
+  CHARACTER). If EFI_HII_IGNORE_LINE_BREAK is set, then explicit\r
+  line break characters will be ignored. If\r
+  EFI_HII_DIRECT_TO_SCREEN is set, then the string will be\r
+  written directly to the output device specified by Screen.\r
+  Otherwise the string will be rendered to the bitmap specified\r
+  by Bitmap.\r
+\r
+\r
+  @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
+\r
+  @param Flags  Describes how the string is to be drawn.\r
+\r
+  @param PackageList  The package list in the HII database to\r
+                      search for the specified string.\r
+\r
+  @param StringId   The string's id, which is unique within\r
+                    PackageList.\r
+\r
+  @param Language   Points to the language for the retrieved\r
+                    string. If NULL, then the current system\r
+                    language is used.\r
+\r
+  @param StringInfo Points to the string output information,\r
+                    including the color and font. If NULL, then\r
+                    the string will be output in the default\r
+                    system font and color.\r
+\r
+  @param Blt  If this points to a non-NULL on entry, this points\r
+              to the image, which is Width pixels wide and\r
+              Height pixels high. The string will be drawn onto\r
+              this image and EFI_HII_OUT_FLAG_CLIP is implied.\r
+              If this points to a NULL on entry, then a buffer\r
+              will be allocated to hold the generated image and\r
+              the pointer updated on exit. It is the caller's\r
+              responsibility to free this buffer.\r
+\r
+  @param BltX, BltY Specifies the offset from the left and top\r
+                    edge of the output image of the first\r
+                    character cell in the image.\r
+\r
+  @param RowInfoArray If this is non-NULL on entry, then on\r
+                      exit, this will point to an allocated\r
+                      buffer containing row information and\r
+                      RowInfoArraySize will be updated to\r
+                      contain the number of elements. This array\r
+                      describes the characters which were at\r
+                      least partially drawn and the heights of\r
+                      the rows. It is the caller's\r
+                      responsibility to free this buffer.\r
+\r
+  @param RowInfoArraySize If this is non-NULL on entry, then on\r
+                          exit it contains the number of\r
+                          elements in RowInfoArray.\r
+\r
+  @param ColumnInfoArray  If non-NULL, on return it is filled\r
+                          with the horizontal offset for each\r
+                          character in the string on the row\r
+                          where it is displayed. Non-printing\r
+                          characters will have the offset ~0.\r
+                          The caller is responsible to allocate\r
+                          a buffer large enough so that there is\r
+                          one entry for each character in the\r
+                          string, not including the\r
+                          null-terminator. It is possible when\r
+                          character display is normalized that\r
+                          some character cells overlap.\r
+\r
+\r
+  @retval EFI_SUCCESS The string was successfully updated.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output\r
+                                buffer for RowInfoArray or Blt.\r
+\r
+  @retval EFI_INVALID_PARAMETER The String or Blt or Height or\r
+                                Width was NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_STRING_ID_TO_IMAGE) (\r
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,\r
+  IN CONST  EFI_HII_OUT_FLAGS     Flags,\r
+  IN CONST  EFI_HII_HANDLE        PackageList,\r
+  IN CONST  EFI_STRING_ID         StringId,\r
+  IN CONST  CHAR8                 *Language,\r
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfo       OPTIONAL,\r
+  IN OUT    EFI_IMAGE_OUTPUT      **Blt,\r
+  IN CONST  UINTN                 BltX,\r
+  IN CONST  UINTN                 BltY,\r
+  OUT       EFI_HII_ROW_INFO      **RowInfoArray    OPTIONAL,\r
+  OUT       UINTN                 *RowInfoArraySize OPTIONAL,\r
+  OUT       UINTN                 *ColumnInfoArray  OPTIONAL\r
+);\r
+\r
+\r
+/**\r
+\r
+  Convert the glyph for a single character into a bitmap.\r
+\r
+  @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
+\r
+  @param Char Character to retrieve.\r
+\r
+  @param StringInfo Points to the string font and color\r
+                    information or NULL if the string should use\r
+                    the default system font and color.\r
+\r
+  @param Blt  Thus must point to a NULL on entry. A buffer will\r
+              be allocated to hold the output and the pointer\r
+              updated on exit. It is the caller's responsibility\r
+              to free this buffer.\r
+\r
+  @param Baseline Number of pixels from the bottom of the bitmap\r
+                  to the baseline.\r
+\r
+\r
+  @retval EFI_SUCCESS Glyph bitmap created.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate the output\r
+                                buffer Blt.\r
+\r
+  @retval EFI_WARN_UNKNOWN_GLYPH  The glyph was unknown and was\r
+                                  replaced with the glyph for\r
+                                  Unicode character 0xFFFD.\r
+\r
+  @retval EFI_INVALID_PARAMETER Blt is NULL or Width is NULL or\r
+                                Height is NULL\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_GLYPH) (\r
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,\r
+  IN CONST  CHAR16                Char,\r
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfo,\r
+  OUT       EFI_IMAGE_OUTPUT      **Blt,\r
+  OUT       UINTN                 *Baseline OPTIONAL\r
+);\r
+\r
+/**\r
+\r
+  This function iterates through fonts which match the specified\r
+  font, using the specified criteria. If String is non-NULL, then\r
+  all of the characters in the string must exist in order for a\r
+  candidate font to be returned.\r
+\r
+  @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.\r
+\r
+  @param FontHandle On entry, points to the font handle returned\r
+                    by a previous call to GetFontInfo() or NULL\r
+                    to start with the first font. On return,\r
+                    points to the returned font handle or points\r
+                    to NULL if there are no more matching fonts.\r
+\r
+  @param StringInfoIn Upon entry, points to the font to return\r
+                      information about.\r
+\r
+  @param StringInfoOut  Upon return, contains the matching\r
+                        font's information. If NULL, then no\r
+                        information is returned.\r
+\r
+  @param String Points to the string which will be tested to\r
+                determine if all characters are available. If\r
+                NULL, then any font is acceptable.\r
+  \r
+  @retval EFI_SUCCESS Matching font returned successfully.\r
+  \r
+  @retval EFI_NOT_FOUND No matching font was found.\r
+  \r
+  @retval EFI_INVALID_PARAMETER FontHandle is NULL or\r
+                                StringInfoIn is NULL\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_FONT_INFO) (\r
+  IN CONST  EFI_HII_FONT_PROTOCOL *This,\r
+  IN OUT    EFI_FONT_HANDLE       *FontHandle,\r
+  IN CONST  EFI_FONT_DISPLAY_INFO *StringInfoIn,\r
+  OUT       EFI_FONT_DISPLAY_INFO *StringInfoOut,\r
+  IN CONST  EFI_STRING            *String OPTIONAL\r
+);\r
+\r
+/**\r
+\r
+  The protocol provides the service to retrieve the font\r
+  informations;\r
+\r
+  @param StringToImage  Render a string to a bitmap or to the\r
+                        display.\r
+\r
+  @param StringIdToImage  Render a string to a bitmap or to the\r
+                          display.\r
+  @param GetGlyph Return a specific glyph in a specific font.\r
+\r
+  @param GetFontInfo  Return font information for a specific\r
+                      font.\r
+\r
+**/\r
+struct _EFI_HII_FONT_PROTOCOL {\r
+  EFI_HII_STRING_TO_IMAGE     StringToImage;\r
+  EFI_HII_STRING_ID_TO_IMAGE  StringIdToImage;\r
+  EFI_HII_GET_GLYPH           GetGlyph;\r
+  EFI_HII_GET_FONT_INFO       GetFontInfo;\r
+};\r
+\r
+extern EFI_GUID gEfiHiiFontProtocolGuid;\r
+\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/HiiImage.h b/MdePkg/Include/Protocol/HiiImage.h
new file mode 100644 (file)
index 0000000..ed511c7
--- /dev/null
@@ -0,0 +1,382 @@
+/** @file\r
+  The file provides services to access to images in the images database.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: HiiImage.h\r
+\r
+**/\r
+\r
+#ifndef __HII_IMAGE_H__\r
+#define __HII_IMAGE_H__\r
+\r
+\r
+#define EFI_HII_IMAGE_PROTOCOL_GUID \\r
+  { 0x31a6406a, 0x6bdf, 0x4e46, { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } }\r
+\r
+typedef struct _EFI_HII_IMAGE_PROTOCOL EFI_HII_IMAGE_PROTOCOL;\r
+\r
+\r
+//\r
+// Flags in EFI_IMAGE_INPUT\r
+// \r
+#define EFI_IMAGE_TRANSPARENT 0x00000001\r
+\r
+/**\r
+   \r
+  Definition of EFI_IMAGE_INPUT.\r
+   \r
+  @param Flags  Describe image characteristics. If\r
+                EFI_IMAGE_TRANSPARENT is set, then the image was\r
+                designed for transparent display.\r
+\r
+  @param Width  Image width, in pixels. \r
+\r
+  @param Height Image height, in pixels.\r
+\r
+  @param Bitmap The actual bitmap, organized left-to-right,\r
+                top-to-bottom. The size of the bitmap is\r
+                Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).\r
+\r
+   \r
+**/\r
+typedef struct _EFI_IMAGE_INPUT {\r
+  UINT32  Flags;\r
+  UINT16  Width;\r
+  UINT16  Height;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL   *Bitmap;\r
+} EFI_IMAGE_INPUT;\r
+\r
+\r
+/**\r
+\r
+  This function adds the image Image to the group of images\r
+  owned by PackageList, and returns a new image identifier\r
+  (ImageId).\r
+\r
+  @param This   A pointer to the EFI_HII_IMAGE_PROTOCOL\r
+                instance. PackageList Handle of the package list\r
+                where this image will be added.\r
+\r
+  @param ImageId  On return, contains the new image id, which is\r
+                  unique within PackageList.\r
+\r
+  @param Image  Points to the image.\r
+\r
+  @retval EFI_SUCCESS             The new image was added\r
+                                  successfully\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES    Could not add the image.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   Image is NULL or ImageId is\r
+                                  NULL.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_NEW_IMAGE) (\r
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,\r
+  IN CONST  EFI_HII_HANDLE          PackageList,\r
+  OUT       EFI_IMAGE_ID            *ImageId,\r
+  IN CONST  EFI_IMAGE_INPUT         *Image\r
+);\r
+\r
+/**\r
+\r
+  This function retrieves the image specified by ImageId which\r
+  is associated with the specified PackageList and copies it\r
+  into the buffer specified by Image. If the image specified by\r
+  ImageId is not present in the specified PackageList, then\r
+  EFI_NOT_FOUND is returned. If the buffer specified by\r
+  ImageSize is too small to hold the image, then\r
+  EFI_BUFFER_TOO_SMALL will be returned. ImageSize will be\r
+  updated to the size of buffer actually required to hold the\r
+  image.\r
+\r
+  @param This   A pointer to the EFI_HII_IMAGE_PROTOCOL\r
+                instance.\r
+  \r
+  @param PackageList  The package list in the HII database to\r
+                      search for the specified image.\r
+  \r
+  @param ImageId  The image's id, which is unique within\r
+                  PackageList.\r
+  \r
+  @param Image  Points to the new image.\r
+  \r
+  @param ImageSize  On entry, points to the size of the buffer\r
+                    pointed to by Image, in bytes. On return,\r
+                    points to the length of the image, in bytes.\r
+  \r
+  \r
+  @retval EFI_SUCCESS   The image was returned successfully.\r
+  \r
+  @retval EFI_NOT_FOUND The image specified by ImageId is not\r
+                        available.\r
+  \r
+  @retval EFI_BUFFER_TOO_SMALL  The buffer specified by\r
+                                ImageLength is too small to hold\r
+                                the image.\r
+  \r
+  @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_IMAGE) (\r
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,\r
+  IN CONST  EFI_HII_HANDLE          PackageList,\r
+  IN CONST  EFI_IMAGE_ID            ImageId,\r
+  OUT       EFI_IMAGE_INPUT         *Image,\r
+  OUT       UINTN                   *ImageSize\r
+);\r
+\r
+/**\r
+   \r
+  This function updates the image specified by ImageId in the\r
+  specified PackageListHandle to the image specified by Image.\r
+\r
+\r
+  @param This   A pointer to the EFI_HII_IMAGE_PROTOCOL\r
+                instance.\r
+\r
+  @param PackageList  The package list containing the images.\r
+\r
+  @param ImageId  The image id, which is unique within\r
+                  PackageList.\r
+\r
+  @param Image  Points to the image.\r
+\r
+  @retval EFI_SUCCESS The image was successfully updated.\r
+  \r
+  @retval EFI_NOT_FOUND   The image specified by ImageId is not\r
+                          in the database.\r
+  \r
+  @retval EFI_INVALID_PARAMETER   The Image or Language was\r
+                                  NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_SET_IMAGE) (\r
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,\r
+  IN CONST  EFI_HII_HANDLE          PackageList,\r
+  IN CONST  EFI_IMAGE_ID            ImageId,\r
+  IN CONST  EFI_IMAGE_INPUT         Image\r
+);\r
+\r
+\r
+//\r
+// EFI_HII_DRAW_FLAGS\r
+// \r
+typedef UINT32  EFI_HII_DRAW_FLAGS;\r
+\r
+#define EFI_HII_DRAW_FLAG_CLIP          0x00000001\r
+#define EFI_HII_DRAW_FLAG_TRANSPARENT   0x00000030\r
+#define EFI_HII_DRAW_FLAG_DEFAULT       0x00000000\r
+#define EFI_HII_DRAW_FLAG_FORCE_TRANS   0x00000001\r
+#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE  0x00000002\r
+#define EFI_HII_DIRECT_TO_SCREEN        0x00000080\r
+\r
+\r
+/**\r
+   \r
+  Definition of EFI_IMAGE_OUTPUT.\r
+   \r
+  @param Width  Width of the output image.\r
+\r
+  @param Height Height of the output image.\r
+\r
+  @param Bitmap Points to the output bitmap.\r
+\r
+  @param Screen Points to the EFI_GRAPHICS_OUTPUT_PROTOCOL which\r
+                describes the screen on which to draw the\r
+                specified image.\r
+\r
+**/\r
+typedef struct _EFI_IMAGE_OUTPUT {\r
+  UINT16  Width;\r
+  UINT16  Height;\r
+  union {\r
+    EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;\r
+    EFI_GRAPHICS_OUTPUT_PROTOCOL  *Screen;\r
+  } Image;\r
+} EFI_IMAGE_OUTPUT;\r
+\r
+\r
+/**\r
+   \r
+  This function renders an image to a bitmap or the screen using\r
+  the specified color and options. It draws the image on an\r
+  existing bitmap, allocates a new bitmap or uses the screen. The\r
+  images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then\r
+  all pixels drawn outside the bounding box specified by Width and\r
+  Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT is set,\r
+  then all ????off???? pixels in the images drawn will use the\r
+  pixel value from Blt. This flag cannot be used if Blt is NULL\r
+  upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then the image\r
+  will be written directly to the output device specified by\r
+  Screen. Otherwise the image will be rendered to the bitmap\r
+  specified by Bitmap.\r
+\r
+\r
+  @param This   A pointer to the EFI_HII_IMAGE_PROTOCOL\r
+                instance.\r
+  \r
+  @param Flags  Describes how the image is to be drawn.\r
+                EFI_HII_DRAW_FLAGS is defined in Related\r
+                Definitions, below.\r
+  \r
+  @param Image  Points to the image to be displayed. \r
+  \r
+  @param Blt  If this points to a non-NULL on entry, this points\r
+              to the image, which is Width pixels wide and\r
+              Height pixels high. The image will be drawn onto\r
+              this image and EFI_HII_DRAW_FLAG_CLIP is implied.\r
+              If this points to a NULL on entry, then a buffer\r
+              will be allocated to hold the generated image and\r
+              the pointer updated on exit. It is the caller????s\r
+              responsibility to free this buffer.\r
+\r
+  @param BltX, BltY   Specifies the offset from the left and top\r
+                      edge of the image of the first pixel in\r
+                      the image.\r
+\r
+  @retval EFI_SUCCESS   The image was successfully updated.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output\r
+                                buffer for RowInfoArray or Blt.\r
+\r
+  @retval EFI_INVALID_PARAMETER The Image or Blt or Height or\r
+                                Width was NULL.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_DRAW_IMAGE) (\r
+  IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,\r
+  IN CONST  EFI_HII_DRAW_FLAGS      Flags,\r
+  IN CONST  EFI_IMAGE_INPUT         Image,\r
+  IN OUT    EFI_IMAGE_OUTPUT        **Blt,\r
+  IN CONST  UINTN                   BltX,\r
+  IN CONST  UINTN                   BltY\r
+);\r
+\r
+/**\r
+   \r
+  This function renders an image as a bitmap or to the screen and\r
+  can clip the image. The bitmap is either supplied by the caller\r
+  or else is allocated by the function. The images can be drawn\r
+  transparently or opaquely. If EFI_HII_DRAW_FLAG_CLIP is set,\r
+  then all pixels drawn outside the bounding box specified by\r
+  Width and Height are ignored. If EFI_HII_DRAW_FLAG_TRANSPARENT\r
+  is set, then all "off" pixels in the character's glyph will\r
+  use the pixel value from Blt. This flag cannot be used if Blt\r
+  is NULL upon entry. If EFI_HII_DIRECT_TO_SCREEN is set, then\r
+  the image will be written directly to the output device\r
+  specified by Screen. Otherwise the image will be rendered to\r
+  the bitmap specified by Bitmap.\r
+  This function renders an image to a bitmap or the screen using\r
+  the specified color and options. It draws the image on an\r
+  existing bitmap, allocates a new bitmap or uses the screen. The\r
+  images can be clipped. If EFI_HII_DRAW_FLAG_CLIP is set, then\r
+  all pixels drawn outside the bounding box specified by Width and\r
+  Height are ignored. The EFI_HII_DRAW_FLAG_TRANSPARENT flag\r
+  determines whether the image will be drawn transparent or\r
+  opaque. If EFI_HII_DRAW_FLAG_FORCE_TRANS is set, then the image\r
+  will be drawn so that all ????off???? pixels in the image will\r
+  be drawn using the pixel value from Blt and all other pixels\r
+  will be copied. If EFI_HII_DRAW_FLAG_FORCE_OPAQUE is set, then\r
+  the image????s pixels will be copied directly to the\r
+  destination. If EFI_HII_DRAW_FLAG_DEFAULT is set, then the image\r
+  will be drawn transparently or opaque, depending on the\r
+  image????s transparency setting (see EFI_IMAGE_TRANSPARENT).\r
+  Images cannot be drawn transparently if Blt is NULL. If\r
+  EFI_HII_DIRECT_TO_SCREEN is set, then the image will be written\r
+  directly to the output device specified by Screen. Otherwise the\r
+  image will be rendered to the bitmap specified by Bitmap.\r
+\r
+  @param This   A pointer to the EFI_HII_IMAGE_PROTOCOL\r
+                instance.\r
+\r
+  @param Flags  Describes how the image is to be drawn.\r
+\r
+  @param PackageList  The package list in the HII database to\r
+                      search for the specified image.\r
+\r
+  @param ImageId  The image's id, which is unique within\r
+                  PackageList.\r
+\r
+  @param Blt  If this points to a non-NULL on entry, this points\r
+              to the image, which is Width pixels wide and\r
+              Height pixels high. The image will be drawn onto\r
+              this image and EFI_HII_DRAW_FLAG_CLIP is implied.\r
+              If this points to a NULL on entry, then a buffer\r
+              will be allocated to hold the generated image and\r
+              the pointer updated on exit. It is the caller's\r
+              responsibility to free this buffer.\r
+\r
+  @param BltX, BltY   Specifies the offset from the left and top\r
+                      edge of the output image of the first\r
+                      pixel in the image.\r
+\r
+  @retval EFI_SUCCESS   The image was successfully updated.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output\r
+                                buffer for RowInfoArray or Blt.\r
+  \r
+  @retval EFI_INVALID_PARAMETER The Image or Blt or Height or\r
+                                Width was NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_DRAW_IMAGE_ID) (\r
+IN CONST  EFI_HII_IMAGE_PROTOCOL  *This,\r
+IN CONST  EFI_HII_DRAW_FLAGS      Flags,\r
+IN CONST  EFI_HII_HANDLE          PackageList,\r
+IN CONST  EFI_IMAGE_ID            ImageId,\r
+IN OUT    EFI_IMAGE_OUTPUT        **Blt,\r
+IN CONST  UINTN                   BltX,\r
+IN CONST  UINTN                   BltY\r
+);\r
+\r
+\r
+/**\r
+  \r
+  services to access to images in the images database.\r
+\r
+  @param NewImage   Add a new image.\r
+\r
+  @param GetImage   Retrieve an image and related font\r
+                    information.\r
+\r
+  @param SetImage   Change an image. EFI_INVALID_LANGUAGE The\r
+                    language specified by FirstLanguage is not\r
+                    present in the specified package list.\r
+                    EFI_INVALID_PARAMETER FirstLanguage is NULL\r
+                    or SecondLanguage is NULL.\r
+\r
+**/\r
+struct _EFI_HII_IMAGE_PROTOCOL {\r
+  EFI_HII_NEW_IMAGE     NewImage;\r
+  EFI_HII_GET_IMAGE     GetImage;\r
+  EFI_HII_SET_IMAGE     SetImage;\r
+  EFI_HII_DRAW_IMAGE    DrawImage;\r
+  EFI_HII_DRAW_IMAGE_ID DrawImageId;\r
+};\r
+\r
+extern EFI_GUID gEfiHiiImageProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/HiiString.h b/MdePkg/Include/Protocol/HiiString.h
new file mode 100644 (file)
index 0000000..06ff124
--- /dev/null
@@ -0,0 +1,303 @@
+/** @file\r
+  The file provides services to manipulate string data.\r
+  \r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: HiiString.h\r
+\r
+**/\r
+\r
+#ifndef __HII_STRING_H__\r
+#define __HII_STRING_H__\r
+\r
+#define EFI_HII_STRING_PROTOCOL_GUID \\r
+  { 0xfd96974, 0x23aa, 0x4cdc, { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } }\r
+\r
+\r
+typedef struct _EFI_HII_STRING_PROTOCOL EFI_HII_STRING_PROTOCOL;\r
+\r
+\r
+\r
+/**\r
+  This function adds the string String to the group of strings\r
+  owned by PackageList, with the specified font information\r
+  StringFontInfo and returns a new string id.\r
+\r
+  @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
+\r
+  @param PackageList  Handle of the package list where this\r
+                      string will be added.\r
+\r
+  @param Language Points to the language for the new string.\r
+\r
+  @param String   Points to the new null-terminated string.\r
+\r
+  @param StringFontInfo Points to the new string's font\r
+                        information or NULL if the string should\r
+                        have the default system font, size and\r
+                        style. StringId On return, contains the\r
+                        new strings id, which is unique within\r
+                        PackageList.\r
+\r
+  @retval EFI_SUCCESS The new string was added successfully\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  Could not add the string.\r
+  \r
+  @retval EFI_INVALID_PARAMETER String is NULL or StringId is\r
+                                NULL or Language is NULL.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_NEW_STRING) (\r
+  IN CONST  EFI_HII_STRING_PROTOCOL   *This,\r
+  IN CONST  EFI_HII_HANDLE            PackageList,\r
+  OUT       EFI_STRING_ID             *StringId\r
+  IN CONST  CHAR8                     *Language,\r
+  IN CONST  EFI_STRING                String,\r
+  IN CONST  EFI_FONT_INFO             *StringFontInfo OPTIONAL,\r
+);\r
+\r
+\r
+/**\r
+\r
+  This function retrieves the string specified by StringId which\r
+  is associated with the specified PackageList in the language\r
+  Language and copies it into the buffer specified by String. If\r
+  the string specified by StringId is not present in the\r
+  specified PackageList, then EFI_NOT_FOUND is returned. If the\r
+  string specified by StringId is present, but not in the\r
+  specified language then EFI_INVALID_LANGUAGE is returned. If\r
+  the buffer specified by StringSize is too small to hold the\r
+  string, then EFI_BUFFER_TOO_SMALL will be returned. StringSize\r
+  will be updated to the size of buffer actually required to\r
+  hold the string.\r
+\r
+  @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
+  \r
+  @param PackageList  The package list in the HII database to\r
+                      search for the specified string.\r
+  \r
+  @param Language   Points to the language for the retrieved\r
+                    string.\r
+  \r
+  @param StringId   The string's id, which is unique within\r
+                    PackageList.\r
+  \r
+  @param String   Points to the new null-terminated string.\r
+  \r
+  @param StringSize On entry, points to the size of the buffer\r
+                    pointed to by String, in bytes. On return,\r
+                    points to the length of the string, in\r
+                    bytes.\r
+  \r
+  @param StringFontInfo   Points to the string's font\r
+                          information or NULL if the string font\r
+                          information is not desired.\r
+  \r
+  @retval EFI_SUCCESS The string was returned successfully.\r
+  \r
+  @retval EFI_NOT_FOUND The string specified by StringId is not\r
+                        available.\r
+  \r
+  @retval EFI_INVALID_LANGUAGE  The string specified by StringId\r
+                                is available but not in the\r
+                                specified language.\r
+  \r
+  @retval EFI_BUFFER_TOO_SMALL  The buffer specified by\r
+                                StringLength is too small to\r
+                                hold the string.\r
+  \r
+  @retval EFI_INVALID_PARAMETER The String or Language was NULL.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_STRING) (\r
+  IN CONST  EFI_HII_STRING_PROTOCOL *This,\r
+  IN CONST  CHAR8                   *Language,\r
+  IN CONST  EFI_HII_HANDLE          PackageList,\r
+  IN CONST  EFI_STRING_ID           StringId,\r
+  OUT       EFI_STRING              String,\r
+  IN OUT    UINTN                   StringSize,\r
+  OUT       EFI_FONT_INFO           *StringFontInfo OPTIONAL\r
+);\r
+\r
+/**\r
+  This function updates the string specified by StringId in the\r
+  specified PackageList to the text specified by String and,\r
+  optionally, the font information specified by StringFontInfo.\r
+  There is no way to change the font information without changing\r
+  the string text.\r
+\r
+  @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
+\r
+  @param PackageList  The package list containing the strings.\r
+\r
+  @param Language Points to the language for the updated string.\r
+\r
+  @param StringId The string id, which is unique within\r
+                  PackageList.\r
+\r
+  @param String   Points to the new null-terminated string.\r
+\r
+  @param StringFontInfo Points to the string's font information\r
+                        or NULL if the string font information\r
+                        is not changed.\r
+\r
+  @retval EFI_SUCCESS   The string was successfully updated.\r
+  \r
+  @retval EFI_NOT_FOUND The string specified by StringId is not\r
+                        in the database.\r
+  \r
+  @retval EFI_INVALID_PARAMETER The String or Language was NULL.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  The system is out of resources\r
+                                to accomplish the task.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_SET_STRING) (\r
+  IN CONST  EFI_HII_STRING_PROTOCOL *This,\r
+  IN CONST  EFI_HII_HANDLE          PackageList,\r
+  IN CONST  EFI_STRING_ID           StringId,\r
+  IN CONST  CHAR8                   *Language,\r
+  IN CONST  EFI_STRING              String,\r
+  IN CONST  EFI_FONT_INFO           *StringFontInfo OPTIONAL\r
+);\r
+\r
+\r
+/**\r
+\r
+  This function returns the list of supported languages.\r
+\r
+  @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
+\r
+  @param PackageList  The package list to examine.\r
+\r
+  @param Languages  Points to the buffer to hold the returned\r
+                    string.\r
+\r
+  @param LanguageSize   On entry, points to the size of the\r
+                        buffer pointed to by Languages, in\r
+                        bytes. On return, points to the length\r
+                        of Languages, in bytes.\r
+\r
+\r
+  @retval EFI_SUCCESS The languages were returned successfully.\r
+  \r
+  @retval EFI_BUFFER_TOO_SMALL  The LanguagesSize is too small\r
+                                to hold the list of supported\r
+                                languages. LanguageSize is\r
+                                updated to contain the required\r
+                                size.\r
+  \r
+  @retval EFI_INVALID_PARAMETER Languages is NULL.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_HII_GET_LANGUAGES) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_HII_HANDLE            PackageList,\r
+  IN OUT    CHAR8                     *Languages,\r
+  IN OUT    UINTN                     LanguagesSize\r
+);\r
+\r
+\r
+/**\r
+\r
+  Each string package has associated with it a single primary\r
+  language and zero or more secondary languages. This routine\r
+  returns the secondary languages associated with a package list.\r
+\r
+  @param This   A pointer to the EFI_HII_STRING_PROTOCOL\r
+                instance.\r
+\r
+  @param PackageList  The package list to examine.\r
+\r
+  @param FirstLanguage  Points to the primary language.\r
+\r
+  @param Languages  are specified in the format specified in\r
+                    Appendix M of the UEFI 2.0 specification.\r
+\r
+  @param SecondaryLanguages Points to the buffer to hold the\r
+                            returned list of secondary languages\r
+                            for the specified FirstLanguage. If\r
+                            there are no secondary languages,\r
+                            the function returns successfully,\r
+                            but this is set to NULL.\r
+\r
+  @param SecondaryLanguageSize  On entry, points to the size of\r
+                                the buffer pointed to by\r
+                                Languages, in bytes. On return,\r
+                                points to the length of\r
+                                Languages in bytes.\r
+\r
+  @retval EFI_SUCCESS   Secondary languages correctly returned\r
+\r
+  @retval EFI_BUFFER_TOO_SMALL  The buffer specified by\r
+                                SecondLanguagesSize is too small\r
+                                to hold the returned\r
+                                information. SecondLanguageSize\r
+                                is updated to hold the size of\r
+                                the buffer required.\r
+\r
+  @retval EFI_INVALID_LANGUAGE  The language specified by\r
+                                FirstLanguage is not present in\r
+                                the specified package list.\r
+\r
+  @retval EFI_INVALID_PARAMETER FirstLanguage is NULL or\r
+                                SecondLanguage is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_GET_2ND_LANGUAGES) (\r
+  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,\r
+  IN CONST  EFI_HII_HANDLE            PackageList,\r
+  IN CONST  CHAR8                     *FirstLanguage;\r
+  IN OUT    CHAR8                     *SecondLanguages,\r
+  IN OUT    UINTN                     SecondLanguagesSize\r
+);\r
+\r
+\r
+/**\r
+  Services to manipulate the string.\r
+   \r
+  @param NewString  Add a new string. GetString Retrieve a\r
+                    string and related string information.\r
+\r
+  @param SetString  Change a string. \r
+\r
+  @param GetLanguages   List the languages for a particular\r
+                        package list.\r
+\r
+  @param GetSecondaryLanguages  List supported secondary\r
+                                languages for a particular\r
+                                primary language.\r
+\r
+**/\r
+struct _EFI_HII_STRING_PROTOCOL {\r
+  EFI_HII_NEW_STRING        NewString;\r
+  EFI_HII_GET_STRING        GetString;\r
+  EFI_HII_SET_STRING        SetString;\r
+  EFI_HII_GET_LANGUAGES     GetLanguages;\r
+  EFI_HII_GET_2ND_LANGUAGES GetSecondaryLanguages;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiHiiStringProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/IP4.h b/MdePkg/Include/Protocol/IP4.h
new file mode 100644 (file)
index 0000000..e0f6134
--- /dev/null
@@ -0,0 +1,414 @@
+/** @file\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  IP4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_IP4_PROTOCOL_H__\r
+#define __EFI_IP4_PROTOCOL_H__\r
+\r
+#include <Protocol/ManagedNetwork.h>\r
+\r
+#define EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0xc51711e7, 0xb4bf, 0x404a, {0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } \\r
+  }\r
+\r
+#define EFI_IP4_PROTOCOL_GUID \\r
+  { \\r
+    0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \\r
+  }\r
+\r
+typedef struct _EFI_IP4_PROTOCOL EFI_IP4_PROTOCOL;\r
+  \r
+typedef struct {\r
+  EFI_HANDLE              InstanceHandle;\r
+  EFI_IPv4_ADDRESS        Ip4Address;\r
+  EFI_IPv4_ADDRESS        SubnetMask;\r
+} EFI_IP4_ADDRESS_PAIR; \r
+\r
+typedef struct {\r
+  EFI_HANDLE              DriverHandle;\r
+  UINT32                  AddressCount;\r
+  EFI_IP4_ADDRESS_PAIR    AddressPairs[1];\r
+} EFI_IP4_VARIABLE_DATA;\r
+\r
+typedef struct {\r
+  UINT8                   DefaultProtocol;\r
+  BOOLEAN                 AcceptAnyProtocol;\r
+  BOOLEAN                 AcceptIcmpErrors;\r
+  BOOLEAN                 AcceptBroadcast;\r
+  BOOLEAN                 AcceptPromiscuous;\r
+  BOOLEAN                 UseDefaultAddress;\r
+  EFI_IPv4_ADDRESS        StationAddress;\r
+  EFI_IPv4_ADDRESS        SubnetMask;\r
+  UINT8                   TypeOfService;\r
+  UINT8                   TimeToLive;\r
+  BOOLEAN                 DoNotFragment;\r
+  BOOLEAN                 RawData;\r
+  UINT32                  ReceiveTimeout;\r
+  UINT32                  TransmitTimeout;\r
+} EFI_IP4_CONFIG_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS        SubnetAddress;\r
+  EFI_IPv4_ADDRESS        SubnetMask;\r
+  EFI_IPv4_ADDRESS        GatewayAddress;\r
+} EFI_IP4_ROUTE_TABLE;\r
+\r
+typedef struct {\r
+  UINT8                   Type;\r
+  UINT8                   Code;\r
+} EFI_IP4_ICMP_TYPE;\r
+\r
+typedef struct {\r
+  BOOLEAN                 IsStarted;\r
+  EFI_IP4_CONFIG_DATA     ConfigData;\r
+  BOOLEAN                 IsConfigured;\r
+  UINT32                  GroupCount;\r
+  EFI_IPv4_ADDRESS        *GroupTable;\r
+  UINT32                  RouteCount;\r
+  EFI_IP4_ROUTE_TABLE     *RouteTable;\r
+  UINT32                  IcmpTypeCount;\r
+  EFI_IP4_ICMP_TYPE       *IcmpTypeList;\r
+} EFI_IP4_MODE_DATA;\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+#ifdef EFI_NET_LITTLE_ENDIAN\r
+  UINT8                   HeaderLength:4;\r
+  UINT8                   Version:4;\r
+#else \r
+  UINT8                   Version:4;\r
+  UINT8                   HeaderLength:4;\r
+#endif\r
+  UINT8                   TypeOfService;\r
+  UINT16                  TotalLength;\r
+  UINT16                  Identification;\r
+  UINT16                  Fragmentation;\r
+  UINT8                   TimeToLive;\r
+  UINT8                   Protocol;\r
+  UINT16                  Checksum;\r
+  EFI_IPv4_ADDRESS        SourceAddress;\r
+  EFI_IPv4_ADDRESS        DestinationAddress;\r
+} EFI_IP4_HEADER;\r
+#pragma pack()\r
+\r
+\r
+typedef struct {\r
+  UINT32                  FragmentLength;\r
+  VOID                    *FragmentBuffer;\r
+} EFI_IP4_FRAGMENT_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_TIME               TimeStamp;\r
+  EFI_EVENT              RecycleSignal;\r
+  UINT32                 HeaderLength;\r
+  EFI_IP4_HEADER         *Header;\r
+  UINT32                 OptionsLength;\r
+  VOID                   *Options;\r
+  UINT32                 DataLength;\r
+  UINT32                 FragmentCount;\r
+  EFI_IP4_FRAGMENT_DATA  FragmentTable[1];\r
+} EFI_IP4_RECEIVE_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS       SourceAddress;\r
+  EFI_IPv4_ADDRESS       GatewayAddress;\r
+  UINT8                  Protocol;\r
+  UINT8                  TypeOfService;\r
+  UINT8                  TimeToLive;\r
+  BOOLEAN                DoNotFragment;\r
+} EFI_IP4_OVERRIDE_DATA;\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS       DestinationAddress;\r
+  EFI_IP4_OVERRIDE_DATA  *OverrideData;      //OPTIONAL\r
+  UINT32                 OptionsLength;      //OPTIONAL\r
+  VOID                   *OptionsBuffer;     //OPTIONAL\r
+  UINT32                 TotalDataLength;\r
+  UINT32                 FragmentCount;\r
+  EFI_IP4_FRAGMENT_DATA  FragmentTable[1];\r
+} EFI_IP4_TRANSMIT_DATA;\r
+\r
+typedef struct {\r
+  EFI_EVENT                Event;\r
+  EFI_STATUS               Status;\r
+  union {\r
+    EFI_IP4_RECEIVE_DATA   *RxData;\r
+    EFI_IP4_TRANSMIT_DATA  *TxData;\r
+  } Packet;\r
+} EFI_IP4_COMPLETION_TOKEN;\r
+\r
+/**\r
+  Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.\r
+\r
+  @param  This          Pointer to the EFI_IP4_PROTOCOL instance.\r
+  @param  Ip4ModeData   Pointer to the EFI IPv4 Protocol mode data structure.\r
+  @param  MnpConfigData Pointer to the managed network configuration data structure.\r
+  @param  SnpData       Pointer to the simple network mode data structure.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  The required mode data could not be allocated.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_GET_MODE_DATA) (\r
+  IN CONST  EFI_IP4_PROTOCOL                *This,\r
+  OUT       EFI_IP4_MODE_DATA               *Ip4ModeData     OPTIONAL,\r
+  OUT       EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData   OPTIONAL,\r
+  OUT       EFI_SIMPLE_NETWORK_MODE         *SnpModeData     OPTIONAL\r
+  )\r
+;  \r
+\r
+/**\r
+  Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.\r
+\r
+  @param  This         Pointer to the EFI_IP4_PROTOCOL instance.\r
+  @param  IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.\r
+\r
+  @retval EFI_SUCCESS           The driver instance was successfully opened.\r
+  @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_UNSUPPORTED       One or more of the following conditions is TRUE:\r
+                                A configuration protocol (DHCP, BOOTP, RARP, etc.) could\r
+                                not be located when clients choose to use the default IPv4\r
+                                address. This EFI IPv4 Protocol implementation does not\r
+                                support this requested filter or timeout setting.\r
+  @retval EFI_OUT_OF_RESOURCES  The EFI IPv4 Protocol driver instance data could not be allocated.\r
+  @retval EFI_ALREADY_STARTED   The interface is already open and must be stopped before the\r
+                                IPv4 address or subnet mask can be changed. The interface must\r
+                                also be stopped when switching to/from raw packet mode.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred. The EFI IPv4\r
+                                 Protocol driver instance is not opened.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_CONFIGURE) (\r
+  IN EFI_IP4_PROTOCOL    *This,\r
+  IN EFI_IP4_CONFIG_DATA *IpConfigData     OPTIONAL\r
+  )\r
+;  \r
+\r
+/**\r
+  Joins and leaves multicast groups.\r
+\r
+  @param  This                  Pointer to the EFI_IP4_PROTOCOL instance.\r
+  @param  JoinFlag              Set to TRUE to join the multicast group session and FALSE to leave.\r
+  @param  GroupAddress          Pointer to the IPv4 multicast address.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following is TRUE:\r
+                                - This is NULL.\r
+                                - JoinFlag is TRUE and GroupAddress is NULL.\r
+                                - GroupAddress is not NULL and *GroupAddress is\r
+                                not a multicast IPv4 address.\r
+  @retval EFI_NOT_STARTED       This instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_OUT_OF_RESOURCES  System resources could not be allocated.\r
+  @retval EFI_UNSUPPORTED       This EFI IPv4 Protocol implementation does not support multicast groups.\r
+  @retval EFI_ALREADY_STARTED   The group address is already in the group table (when\r
+                                JoinFlag is TRUE).\r
+  @retval EFI_NOT_FOUND         The group address is not in the group table (when JoinFlag is FALSE).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_GROUPS) (\r
+  IN EFI_IP4_PROTOCOL    *This,\r
+  IN BOOLEAN             JoinFlag,\r
+  IN EFI_IPv4_ADDRESS    *GroupAddress  OPTIONAL\r
+  )\r
+;    \r
+\r
+/**\r
+  Adds and deletes routing table entries.\r
+\r
+  @param  This                   Pointer to the EFI_IP4_PROTOCOL instance.\r
+  @param  DeleteRoute            Set to TRUE to delete this route from the routing table. Set to\r
+                                 FALSE to add this route to the routing table. SubnetAddress\r
+                                 and SubnetMask are used as the key to each route entry.\r
+  @param  SubnetAddress          The address of the subnet that needs to be routed.\r
+  @param  SubnetMask             The subnet mask of SubnetAddress.\r
+  @param  GatewayAddress         The unicast gateway IPv4 address for this route.\r
+\r
+  @retval EFI_SUCCESS            The operation completed successfully.\r
+  @retval EFI_NOT_STARTED        The driver instance has not been started.\r
+  @retval EFI_NO_MAPPING         When using the default address, configuration (DHCP, BOOTP,\r
+                                 RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:\r
+                                 - This is NULL.\r
+                                 - SubnetAddress is NULL.\r
+                                 - SubnetMask is NULL.\r
+                                 - GatewayAddress is NULL.\r
+                                 - *SubnetAddress is not a valid subnet address.\r
+                                 - *SubnetMask is not a valid subnet mask.\r
+                                 - *GatewayAddress is not a valid unicast IPv4 address.\r
+  @retval EFI_OUT_OF_RESOURCES   Could not add the entry to the routing table.\r
+  @retval EFI_NOT_FOUND          This route is not in the routing table (when DeleteRoute is TRUE).\r
+  @retval EFI_ACCESS_DENIED      The route is already defined in the routing table (when\r
+                                  DeleteRoute is FALSE).\r
+                                 \r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_ROUTES) (\r
+  IN EFI_IP4_PROTOCOL    *This,\r
+  IN BOOLEAN             DeleteRoute,\r
+  IN EFI_IPv4_ADDRESS    *SubnetAddress,\r
+  IN EFI_IPv4_ADDRESS    *SubnetMask,\r
+  IN EFI_IPv4_ADDRESS    *GatewayAddress  \r
+  )\r
+;  \r
+\r
+/**\r
+  Places outgoing data packets into the transmit queue.\r
+\r
+  @param  This  Pointer to the EFI_IP4_PROTOCOL instance.\r
+  @param  Token Pointer to the transmit token.\r
+\r
+  @retval  EFI_SUCCESS           The data has been queued for transmission.\r
+  @retval  EFI_NOT_STARTED       This instance has not been started.\r
+  @retval  EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,\r
+                                 RARP, etc.) is not finished yet.\r
+  @retval  EFI_INVALID_PARAMETER One or more pameters are invalid.\r
+  @retval  EFI_ACCESS_DENIED     The transmit completion token with the same Token.Event\r
+                                 was already in the transmit queue.\r
+  @retval  EFI_NOT_READY         The completion token could not be queued because the transmit\r
+                                 queue is full. \r
+  @retval  EFI_NOT_FOUND         Not route is found to destination address.\r
+  @retval  EFI_OUT_OF_RESOURCES  Could not queue the transmit data.\r
+  @retval  EFI_BUFFER_TOO_SMALL  Token.Packet.TxData.TotalDataLength is too\r
+                                 short to transmit.\r
+  @retval  EFI_BAD_BUFFER_SIZE   The length of the IPv4 header + option length + total data length is\r
+                                 greater than MTU (or greater than the maximum packet size if\r
+                                 Token.Packet.TxData.OverrideData.\r
+                                 DoNotFragment is TRUE.)\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_TRANSMIT) (\r
+  IN EFI_IP4_PROTOCOL          *This,\r
+  IN EFI_IP4_COMPLETION_TOKEN  *Token\r
+  )\r
+;    \r
+\r
+/**\r
+  Places a receiving request into the receiving queue.\r
+\r
+  @param  This  Pointer to the EFI_IP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that is associated with the receive data descriptor.\r
+\r
+  @retval EFI_SUCCESS           The receive completion token was cached.\r
+  @retval EFI_NOT_STARTED       This EFI IPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP, RARP, etc.)\r
+                                is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - Token is NULL.\r
+                                - Token.Event is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  The receive completion token could not be queued due to a lack of system\r
+                                resources (usually memory).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+                                The EFI IPv4 Protocol instance has been reset to startup defaults.\r
+                                EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already\r
+                                in the receive queue.\r
+  @retval EFI_NOT_READY         The receive request could not be queued because the receive queue is full.\r
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_RECEIVE) (\r
+  IN EFI_IP4_PROTOCOL          *This,\r
+  IN EFI_IP4_COMPLETION_TOKEN  *Token\r
+  )\r
+;      \r
+\r
+/**\r
+  Abort an asynchronous transmit or receive request.\r
+\r
+  @param  This  Pointer to the EFI_IP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that has been issued by\r
+                EFI_IP4_PROTOCOL.Transmit() or\r
+                EFI_IP4_PROTOCOL.Receive(). If NULL, all pending\r
+                tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is\r
+                defined in EFI_IP4_PROTOCOL.Transmit().\r
+\r
+  @retval EFI_SUCCESS           The asynchronous I/O request was aborted and\r
+                                Token.->Event was signaled. When Token is NULL, all\r
+                                pending requests were aborted and their events were signaled.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_NOT_STARTED       This instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_NOT_FOUND         When Token is not NULL, the asynchronous I/O request was\r
+                                not found in the transmit or receive queue. It has either completed\r
+                                or was not issued by Transmit() and Receive().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_CANCEL) (\r
+  IN EFI_IP4_PROTOCOL          *This,\r
+  IN EFI_IP4_COMPLETION_TOKEN  *Token OPTIONAL\r
+  )\r
+;      \r
+  \r
+/**\r
+  Polls for incoming data packets and processes outgoing data packets.\r
+\r
+  @param  This Pointer to the EFI_IP4_PROTOCOL instance.\r
+\r
+  @retval  EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval  EFI_NOT_STARTED       This EFI IPv4 Protocol instance has not been started.\r
+  @retval  EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,\r
+                                 RARP, etc.) is not finished yet.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval  EFI_NOT_READY         No incoming or outgoing data is processed.\r
+  @retval  EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.\r
+                                 Consider increasing the polling rate.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_POLL) (\r
+  IN EFI_IP4_PROTOCOL          *This\r
+  )\r
+;  \r
+\r
+struct _EFI_IP4_PROTOCOL {\r
+  EFI_IP4_GET_MODE_DATA        GetModeData;\r
+  EFI_IP4_CONFIGURE            Configure;\r
+  EFI_IP4_GROUPS               Groups;\r
+  EFI_IP4_ROUTES               Routes;\r
+  EFI_IP4_TRANSMIT             Transmit;\r
+  EFI_IP4_RECEIVE              Receive;\r
+  EFI_IP4_CANCEL               Cancel;\r
+  EFI_IP4_POLL                 Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiIp4ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiIp4ProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/IP4Config.h b/MdePkg/Include/Protocol/IP4Config.h
new file mode 100644 (file)
index 0000000..a783e9b
--- /dev/null
@@ -0,0 +1,123 @@
+/** @file\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  IP4Config.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_IP4CONFIG_PROTOCOL_H__\r
+#define __EFI_IP4CONFIG_PROTOCOL_H__\r
+\r
+#include <Protocol/Ip4.h>\r
+\r
+#define EFI_IP4_CONFIG_PROTOCOL_GUID \\r
+  { \\r
+    0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } \\r
+  }\r
+\r
+typedef struct _EFI_IP4_CONFIG_PROTOCOL EFI_IP4_CONFIG_PROTOCOL;\r
+\r
+#define IP4_CONFIG_VARIABLE_ATTRIBUTES \\r
+        (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | \\r
+         EFI_VARIABLE_RUNTIME_ACCESS )\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS             StationAddress;\r
+  EFI_IPv4_ADDRESS             SubnetMask;\r
+  UINT32                       RouteTableSize;\r
+  EFI_IP4_ROUTE_TABLE          *RouteTable;    //OPTIONAL\r
+} EFI_IP4_IPCONFIG_DATA;\r
+\r
+\r
+/**\r
+  Starts running the configuration policy for the EFI IPv4 Protocol driver.\r
+\r
+  @param  This          Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.\r
+  @param  DoneEvent     Event that will be signaled when the EFI IPv4 Protocol driver\r
+                        configuration policy completes execution. This event must be of\r
+                        type EVT_NOTIFY_SIGNAL.\r
+  @param  ReconfigEvent Event that will be signaled when the EFI IPv4 Protocol driver\r
+                        configuration needs to be updated. This event must be of type\r
+                        EVT_NOTIFY_SIGNAL.\r
+\r
+  @retval EFI_SUCCESS           The configuration policy for the EFI IPv4 Protocol driver is now\r
+                                running.\r
+  @retval EFI_INVALID_PARAMETER This, DoneEvent, or ReconfigEvent is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_ALREADY_STARTED   The configuration policy for the EFI IPv4 Protocol driver was\r
+                                already started.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system error or network error occurred.\r
+  @retval EFI_UNSUPPORTED       This interface does not support the EFI IPv4 Protocol driver\r
+                                 configuration.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_CONFIG_START) (\r
+  IN EFI_IP4_CONFIG_PROTOCOL   *This,\r
+  IN EFI_EVENT                 DoneEvent,\r
+  IN EFI_EVENT                 ReconfigEvent \r
+  )\r
+;    \r
+\r
+/**\r
+  Stops running the configuration policy for the EFI IPv4 Protocol driver.\r
+\r
+  @param  This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The configuration policy for the EFI IPv4 Protocol driver has been stopped.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_NOT_STARTED       The configuration policy for the EFI IPv4 Protocol driver was not started.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_CONFIG_STOP) (\r
+  IN EFI_IP4_CONFIG_PROTOCOL   *This \r
+  )\r
+;   \r
+\r
+/**\r
+  Returns the default configuration data (if any) for the EFI IPv4 Protocol driver.\r
+\r
+  @param  This             Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.\r
+  @param  IpConfigDataSize On input, the size of the IpConfigData buffer.\r
+                           On output, the count of bytes that were written into the IpConfigData buffer.\r
+  @param  IpConfigData     Pointer to the EFI IPv4 Configuration Protocol driver\r
+                           configuration data structure.\r
+\r
+  @retval EFI_SUCCESS           The EFI IPv4 Protocol driver configuration has been returned.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_NOT_STARTED       The configuration policy for the EFI IPv4 Protocol driver is not\r
+                                running.\r
+  @retval EFI_NOT_READY         EFI IPv4 Protocol driver configuration is still running.\r
+  @retval EFI_ABORTED           EFI IPv4 Protocol driver configuration could not complete.\r
+  @retval EFI_BUFFER_TOO_SMALL  *IpConfigDataSize is smaller than the configuration data\r
+                                buffer or IpConfigData is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IP4_CONFIG_GET_DATA) (\r
+  IN EFI_IP4_CONFIG_PROTOCOL   *This,\r
+  IN OUT UINTN                 *IpConfigDataSize,\r
+  OUT EFI_IP4_IPCONFIG_DATA    *IpConfigData    OPTIONAL \r
+  )\r
+;    \r
+\r
+struct _EFI_IP4_CONFIG_PROTOCOL {\r
+  EFI_IP4_CONFIG_START         Start;\r
+  EFI_IP4_CONFIG_STOP          Stop;\r
+  EFI_IP4_CONFIG_GET_DATA      GetData;\r
+};\r
+\r
+extern EFI_GUID gEfiIp4ConfigProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/IScsiInitatorName.h b/MdePkg/Include/Protocol/IScsiInitatorName.h
new file mode 100644 (file)
index 0000000..1481cd2
--- /dev/null
@@ -0,0 +1,92 @@
+/** @file\r
+  EFI_ISCSI_INITIATOR_NAME_PROTOCOL as defined in UEFI 2.0.\r
+  It rovides the ability to get and set the iSCSI Initiator Name.                                                  \r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  IScsiInitatorName.h\r
+\r
+**/\r
+\r
+#ifndef __ISCSI_INITIATOR_NAME_H__\r
+#define __ISCSI_INITIATOR_NAME_H__\r
+\r
+#define EFI_ISCSI_INITIATOR_NAME_PROTOCOL_GUID \\r
+{ \\r
+  0x59324945, 0xec44, 0x4c0d, {0xb1, 0xcd, 0x9d, 0xb1, 0x39, 0xdf, 0x7, 0xc } \\r
+}\r
+\r
+typedef struct _EFI_ISCSI_INITIATOR_NAME_PROTOCOL EFI_ISCSI_INITIATOR_NAME_PROTOCOL;\r
+\r
+/**\r
+  Retrieves the current set value of iSCSI Initiator Name.\r
+\r
+  @param  This       Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.\r
+  @param  BufferSize Size of the buffer in bytes pointed to by Buffer / Actual size of the\r
+                     variable data buffer.\r
+  @param  Buffer     Pointer to the buffer for data to be read.\r
+\r
+  @retval EFI_SUCCESS           Data was successfully retrieved into the provided buffer and the\r
+                                BufferSize was sufficient to handle the iSCSI initiator name\r
+  @retval EFI_BUFFER_TOO_SMALL  BufferSize is too small for the result.\r
+  @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL.\r
+  @retval EFI_DEVICE_ERROR      The iSCSI initiator name could not be retrieved due to a hardware error.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_ISCSI_INITIATOR_NAME_GET) (\r
+  IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,\r
+  IN OUT UINTN                         *BufferSize,\r
+  OUT VOID                             *Buffer\r
+  )\r
+;\r
+\r
+  \r
+\r
+/**\r
+  Sets the iSCSI Initiator Name.\r
+\r
+  @param  This       Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.\r
+  @param  BufferSize Size of the buffer in bytes pointed to by Buffer.\r
+  @param  Buffer     Pointer to the buffer for data to be written.\r
+\r
+  @retval EFI_SUCCESS           Data was successfully stored by the protocol.\r
+  @retval EFI_UNSUPPORTED       Platform policies do not allow for data to be written.\r
+  @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL, or BufferSize exceeds the maximum allowed limit.\r
+  @retval EFI_DEVICE_ERROR      The data could not be stored due to a hardware error.\r
+  @retval EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the data.\r
+  @retval EFI_PROTOCOL_ERROR    Input iSCSI initiator name does not adhere to RFC 3720\r
+                                (and other related protocols)\r
+\r
+**/\r
+typedef EFI_STATUS\r
+(EFIAPI *EFI_ISCSI_INITIATOR_NAME_SET) (\r
+  IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,\r
+  IN OUT UINTN                         *BufferSize,\r
+  IN VOID                              *Buffer\r
+  )\r
+;  \r
+\r
+struct _EFI_ISCSI_INITIATOR_NAME_PROTOCOL {\r
+  EFI_ISCSI_INITIATOR_NAME_GET         Get;\r
+  EFI_ISCSI_INITIATOR_NAME_SET         Set;\r
+};\r
+\r
+extern EFI_GUID gEfiIScsiInitiatorNameProtocolGuid;\r
+\r
+#endif\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/MdePkg/Include/Protocol/LoadFile.h b/MdePkg/Include/Protocol/LoadFile.h
new file mode 100644 (file)
index 0000000..346039f
--- /dev/null
@@ -0,0 +1,83 @@
+/** @file\r
+  Load File protocol as defined in the EFI 1.0 specification.\r
+\r
+  Load file protocol exists to supports the addition of new boot devices, \r
+  and to support booting from devices that do not map well to file system. \r
+  Network boot is done via a LoadFile protocol.\r
+\r
+  EFI 1.0 can boot from any device that produces a LoadFile protocol.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  LoadFile.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_LOAD_FILE_PROTOCOL_H__\r
+#define __EFI_LOAD_FILE_PROTOCOL_H__\r
+\r
+#define LOAD_FILE_PROTOCOL_GUID \\r
+  { \\r
+    0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \\r
+  }\r
+\r
+//\r
+// Protocol Guid Name defined by UEFI 2.0 spec.\r
+//\r
+#define EFI_LOAD_FILE_PROTOCOL_GUID LOAD_FILE_PROTOCOL_GUID\r
+\r
+typedef struct _EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL;\r
+\r
+/**\r
+  Causes the driver to load a specified file.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  FilePath   The device specific path of the file to load.\r
+  @param  BootPolicy If TRUE, indicates that the request originates from the\r
+                     boot manager is attempting to load FilePath as a boot\r
+                     selection. If FALSE, then FilePath must match as exact file\r
+                     to be loaded.\r
+  @param  BufferSize On input the size of Buffer in bytes. On output with a return\r
+                     code of EFI_SUCCESS, the amount of data transferred to\r
+                     Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,\r
+                     the size of Buffer required to retrieve the requested file.\r
+  @param  Buffer     The memory buffer to transfer the file to. IF Buffer is NULL,\r
+                     then no the size of the requested file is returned in\r
+                     BufferSize.\r
+\r
+  @retval EFI_SUCCESS           The file was loaded.\r
+  @retval EFI_UNSUPPORTED       The device does not support the provided BootPolicy\r
+  @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or\r
+                                BufferSize is NULL.\r
+  @retval EFI_NO_MEDIA          No medium was present to load the file.\r
+  @retval EFI_DEVICE_ERROR      The file was not loaded due to a device error.\r
+  @retval EFI_NO_RESPONSE       The remote system did not respond.\r
+  @retval EFI_NOT_FOUND         The file was not found\r
+  @retval EFI_ABORTED           The file load process was manually cancelled.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LOAD_FILE) (\r
+  IN EFI_LOAD_FILE_PROTOCOL           *This,\r
+  IN EFI_DEVICE_PATH_PROTOCOL         *FilePath,\r
+  IN BOOLEAN                          BootPolicy,\r
+  IN OUT UINTN                        *BufferSize,\r
+  IN VOID                             *Buffer OPTIONAL\r
+  )\r
+;\r
+\r
+struct _EFI_LOAD_FILE_PROTOCOL {\r
+  EFI_LOAD_FILE LoadFile;\r
+};\r
+\r
+extern EFI_GUID gEfiLoadFileProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/ManagedNetwork.h b/MdePkg/Include/Protocol/ManagedNetwork.h
new file mode 100644 (file)
index 0000000..ab6dba6
--- /dev/null
@@ -0,0 +1,316 @@
+/** @file\r
+  EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.\r
+  EFI_MANAGED_NETWORK_PROTOCOL as defined in UEFI 2.0.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  ManagedNetwork.h\r
+\r
+**/\r
+\r
+#ifndef _EFI_MANAGED_NETWORK_PROTOCOL_H\r
+#define _EFI_MANAGED_NETWORK_PROTOCOL_H\r
+\r
+#include <Protocol/SimpleNetwork.h>\r
+\r
+#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } \\r
+  }\r
+\r
+#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \\r
+  { \\r
+    0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x7, 0x8, 0x92, 0xe0, 0x5e } \\r
+  }\r
+\r
+typedef struct _EFI_MANAGED_NETWORK_PROTOCOL EFI_MANAGED_NETWORK_PROTOCOL;\r
+\r
+typedef struct {\r
+  UINT32     ReceivedQueueTimeoutValue;\r
+  UINT32     TransmitQueueTimeoutValue;\r
+  UINT16     ProtocolTypeFilter;\r
+  BOOLEAN    EnableUnicastReceive;\r
+  BOOLEAN    EnableMulticastReceive;\r
+  BOOLEAN    EnableBroadcastReceive;\r
+  BOOLEAN    EnablePromiscuousReceive;\r
+  BOOLEAN    FlushQueuesOnReset;\r
+  BOOLEAN    EnableReceiveTimestamps;\r
+  BOOLEAN    DisableBackgroundPolling;\r
+} EFI_MANAGED_NETWORK_CONFIG_DATA;\r
+\r
+typedef struct {\r
+  EFI_TIME      Timestamp;\r
+  EFI_EVENT     RecycleEvent;\r
+  UINT32        PacketLength;\r
+  UINT32        HeaderLength;\r
+  UINT32        AddressLength;\r
+  UINT32        DataLength;\r
+  BOOLEAN       BroadcastFlag;\r
+  BOOLEAN       MulticastFlag;\r
+  BOOLEAN       PromiscuousFlag;\r
+  UINT16        ProtocolType;\r
+  VOID          *DestinationAddress;\r
+  VOID          *SourceAddress;\r
+  VOID          *MediaHeader;\r
+  VOID          *PacketData;\r
+} EFI_MANAGED_NETWORK_RECEIVE_DATA;\r
+\r
+typedef struct {\r
+  UINT32        FragmentLength;\r
+  VOID          *FragmentBuffer;\r
+} EFI_MANAGED_NETWORK_FRAGMENT_DATA;\r
+\r
+typedef struct {\r
+  EFI_MAC_ADDRESS                   *DestinationAddress; //OPTIONAL\r
+  EFI_MAC_ADDRESS                   *SourceAddress;      //OPTIONAL\r
+  UINT16                            ProtocolType;        //OPTIONAL\r
+  UINT32                            DataLength;\r
+  UINT16                            HeaderLength;        //OPTIONAL\r
+  UINT16                            FragmentCount;\r
+  EFI_MANAGED_NETWORK_FRAGMENT_DATA FragmentTable[1];\r
+} EFI_MANAGED_NETWORK_TRANSMIT_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_EVENT                             Event;\r
+  EFI_STATUS                            Status;\r
+  union {\r
+    EFI_MANAGED_NETWORK_RECEIVE_DATA    *RxData;\r
+    EFI_MANAGED_NETWORK_TRANSMIT_DATA   *TxData;\r
+  } Packet;\r
+} EFI_MANAGED_NETWORK_COMPLETION_TOKEN;\r
+\r
+/**\r
+  Returns the operational parameters for the current MNP child driver.\r
+\r
+  @param  This          Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+  @param  MnpConfigData Pointer to storage for MNP operational parameters.\r
+  @param  SnpModeData   Pointer to storage for SNP operational parameters.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_UNSUPPORTED       The requested feature is unsupported in this MNP implementation.\r
+  @retval EFI_NOT_STARTED       This MNP child driver instance has not been configured. The default\r
+                                values are returned in MnpConfigData if it is not NULL.\r
+  @retval Other                 The mode data could not be read.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_GET_MODE_DATA) (\r
+  IN  EFI_MANAGED_NETWORK_PROTOCOL     *This,\r
+  OUT EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL,\r
+  OUT EFI_SIMPLE_NETWORK_MODE          *SnpModeData    OPTIONAL \r
+  )\r
+;  \r
+\r
+/**\r
+  Sets or clears the operational parameters for the MNP child driver.\r
+\r
+  @param  This          Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+  @param  MnpConfigData Pointer to configuration data that will be assigned to the MNP\r
+                        child driver instance. If NULL, the MNP child driver instance is\r
+                        reset to startup defaults and all pending transmit and receive\r
+                        requests are flushed.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources (usually memory) could not be\r
+                                allocated.\r
+  @retval EFI_UNSUPPORTED       The requested feature is unsupported in this [MNP]\r
+                                implementation.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+  @retval Other                 The MNP child driver instance has been reset to startup defaults.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE) (\r
+  IN EFI_MANAGED_NETWORK_PROTOCOL     *This,\r
+  IN EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL \r
+  )\r
+;    \r
+    \r
+/**\r
+  Translates an IP multicast address to a hardware (MAC) multicast address.\r
+\r
+  @param  This       Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+  @param  Ipv6Flag   Set to TRUE to if IpAddress is an IPv6 multicast address.\r
+                     Set to FALSE if IpAddress is an IPv4 multicast address.\r
+  @param  IpAddress  Pointer to the multicast IP address (in network byte order) to convert.\r
+  @param  MacAddress Pointer to the resulting multicast MAC address.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - IpAddress is NULL.\r
+                                - *IpAddress is not a valid multicast IP address.\r
+                                - MacAddress is NULL.\r
+  @retval EFI_NOT_STARTED       This MNP child driver instance has not been configured.\r
+  @retval EFI_UNSUPPORTED       The requested feature is unsupported in this MNP implementation.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+  @retval Other                 The address could not be converted.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC) (\r
+  IN  EFI_MANAGED_NETWORK_PROTOCOL  *This,\r
+  IN  BOOLEAN                       Ipv6Flag,\r
+  IN  EFI_IP_ADDRESS                *IpAddress,\r
+  OUT EFI_MAC_ADDRESS               *MacAddress \r
+  )\r
+;      \r
+\r
+/**\r
+  Enables and disables receive filters for multicast address.\r
+\r
+  @param  This       Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+  @param  JoinFlag   Set to TRUE to join this multicast group.\r
+                     Set to FALSE to leave this multicast group.\r
+  @param  MacAddress Pointer to the multicast MAC group (address) to join or leave.\r
+\r
+  @retval EFI_SUCCESS           The requested operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - JoinFlag is TRUE and MacAddress is NULL.\r
+                                - *MacAddress is not a valid multicast MAC address.\r
+  @retval EFI_NOT_STARTED       This MNP child driver instance has not been configured.\r
+  @retval EFI_ALREADY_STARTED   The supplied multicast group is already joined.\r
+  @retval EFI_NOT_FOUND         The supplied multicast group is not joined.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.  \r
+  @retval EFI_UNSUPPORTED       The requested feature is unsupported in this MNP implementation.\r
+  @retval Other                 The requested operation could not be completed.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_GROUPS) (\r
+  IN EFI_MANAGED_NETWORK_PROTOCOL  *This,\r
+  IN BOOLEAN                       JoinFlag,\r
+  IN EFI_MAC_ADDRESS               *MacAddress  OPTIONAL \r
+  )\r
+;      \r
+  \r
+/**\r
+  Places asynchronous outgoing data packets into the transmit queue.\r
+\r
+  @param  This  Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+  @param  Token Pointer to a token associated with the transmit data descriptor.\r
+\r
+  @retval EFI_SUCCESS           The transmit completion token was cached.\r
+  @retval EFI_NOT_STARTED       This MNP child driver instance has not been configured.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_ACCESS_DENIED     The transmit completion token is already in the transmit queue.\r
+  @retval EFI_OUT_OF_RESOURCES  The transmit data could not be queued due to a lack of system resources\r
+                                (usually memory).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval EFI_NOT_READY         The transmit request could not be queued because the transmit queue is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT) (\r
+  IN EFI_MANAGED_NETWORK_PROTOCOL          *This,\r
+  IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN  *Token \r
+  )\r
+;      \r
+    \r
+/**\r
+  Places an asynchronous receiving request into the receiving queue.\r
+\r
+  @param  This  Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+  @param  Token Pointer to a token associated with the receive data descriptor.\r
+\r
+  @retval EFI_SUCCESS           The receive completion token was cached.\r
+  @retval EFI_NOT_STARTED       This MNP child driver instance has not been configured.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - Token is NULL.\r
+                                - Token.Event is NULL\r
+  @retval EFI_OUT_OF_RESOURCES  The transmit data could not be queued due to a lack of system resources\r
+                                (usually memory).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval EFI_ACCESS_DENIED     The receive completion token was already in the receive queue.\r
+  @retval EFI_NOT_READY         The receive request could not be queued because the receive queue is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_RECEIVE) (\r
+  IN EFI_MANAGED_NETWORK_PROTOCOL          *This,\r
+  IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN  *Token \r
+  )\r
+;      \r
+   \r
+\r
+/**\r
+  Aborts an asynchronous transmit or receive request.\r
+\r
+  @param  This  Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+  @param  Token Pointer to a token that has been issued by\r
+                EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or\r
+                EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If\r
+                NULL, all pending tokens are aborted.\r
+\r
+  @retval  EFI_SUCCESS           The asynchronous I/O request was aborted and Token.Event\r
+                                 was signaled. When Token is NULL, all pending requests were\r
+                                 aborted and their events were signaled.\r
+  @retval  EFI_NOT_STARTED       This MNP child driver instance has not been configured.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_NOT_FOUND         When Token is not NULL, the asynchronous I/O request was\r
+                                 not found in the transmit or receive queue. It has either completed\r
+                                 or was not issued by Transmit() and Receive().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_CANCEL) (\r
+  IN EFI_MANAGED_NETWORK_PROTOCOL          *This,\r
+  IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN  *Token  OPTIONAL \r
+  )\r
+;   \r
+\r
+/**\r
+  Polls for incoming data packets and processes outgoing data packets.\r
+\r
+  @param  This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS      Incoming or outgoing data was processed.\r
+  @retval EFI_NOT_STARTED  This MNP child driver instance has not been configured.\r
+  @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
+  @retval EFI_NOT_READY    No incoming or outgoing data was processed. Consider increasing\r
+                           the polling rate.\r
+  @retval EFI_TIMEOUT      Data was dropped out of the transmit and/or receive queue.\r
+                            Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MANAGED_NETWORK_POLL) (\r
+  IN EFI_MANAGED_NETWORK_PROTOCOL    *This \r
+  )\r
+;     \r
+\r
+struct _EFI_MANAGED_NETWORK_PROTOCOL {\r
+  EFI_MANAGED_NETWORK_GET_MODE_DATA       GetModeData;\r
+  EFI_MANAGED_NETWORK_CONFIGURE           Configure;\r
+  EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC     McastIpToMac;\r
+  EFI_MANAGED_NETWORK_GROUPS              Groups;\r
+  EFI_MANAGED_NETWORK_TRANSMIT            Transmit;\r
+  EFI_MANAGED_NETWORK_RECEIVE             Receive;\r
+  EFI_MANAGED_NETWORK_CANCEL              Cancel;\r
+  EFI_MANAGED_NETWORK_POLL                Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiManagedNetworkProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Metronome.h b/MdePkg/Include/Protocol/Metronome.h
new file mode 100644 (file)
index 0000000..c4a1f71
--- /dev/null
@@ -0,0 +1,98 @@
+/** @file\r
+  Metronome Architectural Protocol as defined in DXE CIS\r
+\r
+  This code abstracts the DXE core to provide delay services.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Metronome.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_METRONOME_H__\r
+#define __ARCH_PROTOCOL_METRONOME_H__\r
+\r
+//\r
+// Global ID for the Metronome Architectural Protocol\r
+//\r
+#define EFI_METRONOME_ARCH_PROTOCOL_GUID \\r
+  { 0x26baccb2, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }\r
+\r
+//\r
+// Declare forward reference for the Metronome Architectural Protocol\r
+//\r
+typedef struct _EFI_METRONOME_ARCH_PROTOCOL   EFI_METRONOME_ARCH_PROTOCOL;\r
+\r
+/**\r
+  The WaitForTick() function waits for the number of ticks specified by \r
+  TickNumber from a known time source in the platform.  If TickNumber of \r
+  ticks are detected, then EFI_SUCCESS is returned.  The actual time passed \r
+  between entry of this function and the first tick is between 0 and \r
+  TickPeriod 100 nS units.  If you want to guarantee that at least TickPeriod \r
+  time has elapsed, wait for two ticks.  This function waits for a hardware \r
+  event to determine when a tick occurs.  It is possible for interrupt \r
+  processing, or exception processing to interrupt the execution of the \r
+  WaitForTick() function.  Depending on the hardware source for the ticks, it \r
+  is possible for a tick to be missed.  This function cannot guarantee that \r
+  ticks will not be missed.  If a timeout occurs waiting for the specified \r
+  number of ticks, then EFI_TIMEOUT is returned.\r
+\r
+  @param  This             The EFI_METRONOME_ARCH_PROTOCOL instance.\r
+  @param  TickNumber       Number of ticks to wait.\r
+\r
+  @retval EFI_SUCCESS           The wait for the number of ticks specified by TickNumber\r
+                                succeeded.\r
+  @retval EFI_TIMEOUT           A timeout occurred waiting for the specified number of ticks.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_METRONOME_WAIT_FOR_TICK) (\r
+   IN EFI_METRONOME_ARCH_PROTOCOL   *This,\r
+   IN UINT32                        TickNumber\r
+  );\r
+\r
+//\r
+//\r
+\r
+/**\r
+  Interface stucture for the Metronome Architectural Protocol.\r
+\r
+  @par Protocol Description:\r
+  This protocol provides access to a known time source in the platform to the\r
+  core.  The core uses this known time source to produce core services that \r
+  require calibrated delays.  \r
+\r
+  @param WaitForTick\r
+  Waits for a specified number of ticks from a known time source \r
+  in the platform.  The actual time passed between entry of this \r
+  function and the first tick is between 0 and TickPeriod 100 nS \r
+  units.  If you want to guarantee that at least TickPeriod time \r
+  has elapsed, wait for two ticks.\r
+\r
+  @param TickPeriod\r
+  The period of platform's known time source in 100 nS units.  \r
+  This value on any platform must be at least 10 uS, and must not \r
+  exceed 200 uS.  The value in this field is a constant that must \r
+  not be modified after the Metronome architectural protocol is \r
+  installed.  All consumers must treat this as a read-only field.\r
+\r
+**/\r
+struct _EFI_METRONOME_ARCH_PROTOCOL {\r
+  EFI_METRONOME_WAIT_FOR_TICK  WaitForTick;\r
+  UINT32                       TickPeriod;\r
+};\r
+\r
+extern EFI_GUID gEfiMetronomeArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/MonotonicCounter.h b/MdePkg/Include/Protocol/MonotonicCounter.h
new file mode 100644 (file)
index 0000000..d253740
--- /dev/null
@@ -0,0 +1,33 @@
+/** @file\r
+  Monotonic Counter Architectural Protocol as defined in DXE CIS\r
+\r
+  This code provides the services required to access the systems monotonic counter\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  MonotonicCounter.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_MONTONIC_COUNTER_H__\r
+#define __ARCH_PROTOCOL_MONTONIC_COUNTER_H__\r
+\r
+///\r
+/// Global ID for the Monotonic Counter Architectural Protocol\r
+///\r
+#define EFI_MONTONIC_COUNTER_ARCH_PROTOCOL_GUID \\r
+  {0x1da97072, 0xbddc, 0x4b30, {0x99, 0xf1, 0x72, 0xa0, 0xb5, 0x6f, 0xff, 0x2a} }\r
+  \r
+extern EFI_GUID gEfiMonotonicCounterArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Mtftp4.h b/MdePkg/Include/Protocol/Mtftp4.h
new file mode 100644 (file)
index 0000000..18ae20b
--- /dev/null
@@ -0,0 +1,507 @@
+/** @file\r
+  EFI Multicast Trivial File Tranfer Protocol Definition\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Mtftp4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_MTFTP4_PROTOCOL_H__\r
+#define __EFI_MTFTP4_PROTOCOL_H__\r
+\r
+#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } \\r
+  }\r
+\r
+#define EFI_MTFTP4_PROTOCOL_GUID \\r
+  { \\r
+    0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b } \\r
+  }\r
+\r
+typedef struct _EFI_MTFTP4_PROTOCOL EFI_MTFTP4_PROTOCOL;\r
+typedef struct _EFI_MTFTP4_TOKEN EFI_MTFTP4_TOKEN;\r
+\r
+//\r
+//MTFTP4 packet opcode definition\r
+//\r
+#define EFI_MTFTP4_OPCODE_RRQ                     1\r
+#define EFI_MTFTP4_OPCODE_WRQ                     2\r
+#define EFI_MTFTP4_OPCODE_DATA                    3\r
+#define EFI_MTFTP4_OPCODE_ACK                     4\r
+#define EFI_MTFTP4_OPCODE_ERROR                   5\r
+#define EFI_MTFTP4_OPCODE_OACK                    6\r
+#define EFI_MTFTP4_OPCODE_DIR                     7\r
+#define EFI_MTFTP4_OPCODE_DATA8                   8\r
+#define EFI_MTFTP4_OPCODE_ACK8                    9\r
+\r
+//\r
+// MTFTP4 error code definition\r
+//\r
+#define EFI_MTFTP4_ERRORCODE_NOT_DEFINED          0\r
+#define EFI_MTFTP4_ERRORCODE_FILE_NOT_FOUND       1\r
+#define EFI_MTFTP4_ERRORCODE_ACCESS_VIOLATION     2\r
+#define EFI_MTFTP4_ERRORCODE_DISK_FULL            3\r
+#define EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION    4\r
+#define EFI_MTFTP4_ERRORCODE_UNKNOWN_TRANSFER_ID  5\r
+#define EFI_MTFTP4_ERRORCODE_FILE_ALREADY_EXISTS  6\r
+#define EFI_MTFTP4_ERRORCODE_NO_SUCH_USER         7\r
+#define EFI_MTFTP4_ERRORCODE_REQUEST_DENIED       8\r
+\r
+//\r
+// MTFTP4 pacekt definitions\r
+//\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+  UINT16                  OpCode;\r
+  UINT8                   Filename[1];\r
+} EFI_MTFTP4_REQ_HEADER;\r
+\r
+typedef struct {\r
+  UINT16                  OpCode;\r
+  UINT8                   Data[1];\r
+} EFI_MTFTP4_OACK_HEADER;\r
+\r
+typedef struct {\r
+  UINT16                  OpCode;\r
+  UINT16                  Block;\r
+  UINT8                   Data[1];\r
+} EFI_MTFTP4_DATA_HEADER;\r
+\r
+typedef struct {\r
+  UINT16                  OpCode;\r
+  UINT16                  Block[1];\r
+} EFI_MTFTP4_ACK_HEADER;\r
+\r
+typedef struct {\r
+  UINT16                  OpCode;\r
+  UINT64                  Block;\r
+  UINT8                   Data[1];\r
+} EFI_MTFTP4_DATA8_HEADER;\r
+\r
+typedef struct {\r
+  UINT16                  OpCode;\r
+  UINT64                  Block[1];\r
+} EFI_MTFTP4_ACK8_HEADER;\r
+\r
+typedef struct {\r
+  UINT16                  OpCode;\r
+  UINT16                  ErrorCode;\r
+  UINT8                   ErrorMessage[1];\r
+} EFI_MTFTP4_ERROR_HEADER;\r
+\r
+typedef union {\r
+  UINT16                  OpCode;\r
+  EFI_MTFTP4_REQ_HEADER   Rrq;\r
+  EFI_MTFTP4_REQ_HEADER   Wrq;\r
+  EFI_MTFTP4_OACK_HEADER  Oack;\r
+  EFI_MTFTP4_DATA_HEADER  Data;\r
+  EFI_MTFTP4_ACK_HEADER   Ack;\r
+  EFI_MTFTP4_DATA8_HEADER Data8;\r
+  EFI_MTFTP4_ACK8_HEADER  Ack8;\r
+  EFI_MTFTP4_ERROR_HEADER Error;\r
+} EFI_MTFTP4_PACKET;\r
+\r
+#pragma pack()\r
+\r
+//\r
+// MTFTP4 option definition\r
+//\r
+typedef struct {\r
+  UINT8                   *OptionStr;\r
+  UINT8                   *ValueStr;\r
+} EFI_MTFTP4_OPTION;\r
+\r
+\r
+typedef struct {\r
+  BOOLEAN                 UseDefaultSetting;\r
+  EFI_IPv4_ADDRESS        StationIp;\r
+  EFI_IPv4_ADDRESS        SubnetMask;\r
+  UINT16                  LocalPort;\r
+  EFI_IPv4_ADDRESS        GatewayIp;\r
+  EFI_IPv4_ADDRESS        ServerIp;\r
+  UINT16                  InitialServerPort;\r
+  UINT16                  TryCount;\r
+  UINT16                  TimeoutValue;\r
+} EFI_MTFTP4_CONFIG_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_MTFTP4_CONFIG_DATA  ConfigData;\r
+  UINT8                   SupportedOptionCount;  \r
+  UINT8                   **SupportedOptoins;\r
+  UINT8                   UnsupportedOptionCount;  \r
+  UINT8                   **UnsupportedOptoins;\r
+} EFI_MTFTP4_MODE_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS        GatewayIp;\r
+  EFI_IPv4_ADDRESS        ServerIp;\r
+  UINT16                  ServerPort;\r
+  UINT16                  TryCount;\r
+  UINT16                  TimeoutValue;\r
+} EFI_MTFTP4_OVERRIDE_DATA;\r
+\r
+//\r
+// Protocol interfaces definition\r
+//\r
+\r
+/**\r
+  a callback function that is provided by the caller to intercept               \r
+  the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the\r
+  EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept       \r
+  EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to    \r
+  EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() or ReadDirectory().                   \r
+\r
+  @param  This        Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  Token       The token that the caller provided in the\r
+                      EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile()\r
+                      or ReadDirectory() function.\r
+  @param  PacketLen   Indicates the length of the packet.\r
+  @param  Packet      Pointer to an MTFTPv4 packet.\r
+\r
+  @retval EFI_SUCCESS Operation sucess\r
+  @retval Others      Abort transfer process\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_CHECK_PACKET)( \r
+  IN EFI_MTFTP4_PROTOCOL  *This,\r
+  IN EFI_MTFTP4_TOKEN     *Token,\r
+  IN UINT16               PacketLen,\r
+  IN EFI_MTFTP4_PACKET    *Paket\r
+  )\r
+;\r
+\r
+/**\r
+  Timeout callback funtion.            \r
+\r
+  @param  This           Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  Token          The token that is provided in the\r
+                         EFI_MTFTP4_PROTOCOL.ReadFile() or\r
+                         EFI_MTFTP4_PROTOCOL.WriteFile() or\r
+                         EFI_MTFTP4_PROTOCOL.ReadDirectory() functions\r
+                         by the caller.\r
+                         \r
+  @retval EFI_SUCCESS   Operation sucess\r
+  @retval Others        Aborts download process.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_TIMEOUT_CALLBACK)( \r
+  IN EFI_MTFTP4_PROTOCOL  *This,\r
+  IN EFI_MTFTP4_TOKEN     *Token\r
+  )\r
+;\r
+\r
+/**\r
+  a callback function that the caller provides to feed data to the\r
+  EFI_MTFTP4_PROTOCOL.WriteFile() function.\r
+\r
+  @param  This   Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  Token  The token provided in the\r
+                 EFI_MTFTP4_PROTOCOL.WriteFile() by the caller.\r
+  @param  Length Indicates the length of the raw data wanted on input, and the\r
+                 length the data available on output.\r
+  @param  Buffer Pointer to the buffer where the data is stored.\r
+\r
+  @retval EFI_SUCCESS Operation sucess\r
+  @retval Others      Aborts session.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_PACKET_NEEDED)( \r
+  IN  EFI_MTFTP4_PROTOCOL *This,\r
+  IN  EFI_MTFTP4_TOKEN    *Token,\r
+  IN  OUT UINT16          *Length,\r
+  OUT VOID                **Buffer\r
+  )\r
+;\r
+\r
+\r
+/**\r
+  Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.\r
+\r
+  @param  This     Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  ModeData Pointer to storage for the EFI MTFTPv4 Protocol driver mode data.\r
+\r
+  @retval EFI_SUCCESS           The configuration data was successfully returned.\r
+  @retval EFI_OUT_OF_RESOURCES  The required mode data could not be allocated.\r
+  @retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_GET_MODE_DATA)(\r
+  IN  EFI_MTFTP4_PROTOCOL     *This,\r
+  OUT EFI_MTFTP4_MODE_DATA    *ModeData\r
+  )\r
+;\r
+\r
+\r
+/**\r
+  Initializes, changes, or resets the default operational setting for this \r
+  EFI MTFTPv4 Protocol driver instance.\r
+\r
+  @param  This            Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  MtftpConfigData Pointer to the configuration data structure.\r
+\r
+  @retval EFI_SUCCESS           The EFI MTFTPv4 Protocol driver was configured successfully.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_ACCESS_DENIED     The EFI configuration could not be changed at this time because\r
+                                there is one MTFTP background operation in progress.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) has not finished yet.\r
+  @retval EFI_UNSUPPORTED       A configuration protocol (DHCP, BOOTP, RARP, etc.) could not\r
+                                be located when clients choose to use the default address\r
+                                settings.\r
+  @retval EFI_OUT_OF_RESOURCES  The EFI MTFTPv4 Protocol driver instance data could not be\r
+                                allocated.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred. The EFI\r
+                                 MTFTPv4 Protocol driver instance is not configured.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_CONFIGURE)(\r
+  IN EFI_MTFTP4_PROTOCOL       *This,\r
+  IN EFI_MTFTP4_CONFIG_DATA    *MtftpConfigData OPTIONAL\r
+  )\r
+;   \r
+    \r
+    \r
+/**\r
+  Gets information about a file from an MTFTPv4 server.\r
+\r
+  @param  This         Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  OverrideData Data that is used to override the existing parameters. If NULL,\r
+                       the default parameters that were set in the\r
+                       EFI_MTFTP4_PROTOCOL.Configure() function are used.\r
+  @param  Filename     Pointer to ASCIIZ file name string.\r
+  @param  ModeStr      Pointer to ASCIIZ mode string. If NULL, "octet" will be used.\r
+  @param  OptionCount  Number of option/value string pairs in OptionList.\r
+  @param  OptionList   Pointer to array of option/value string pairs. Ignored if\r
+                       OptionCount is zero.\r
+  @param  PacketLength The number of bytes in the returned packet.\r
+  @param  Packet       The pointer to the received packet. This buffer must be freed by\r
+                       the caller.\r
+\r
+  @retval EFI_SUCCESS           An MTFTPv4 OACK packet was received and is in the Buffer.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_UNSUPPORTED       One or more options in the OptionList are in the\r
+                                unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
+  @retval EFI_NOT_STARTED       The EFI MTFTPv4 Protocol driver has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) has not finished yet.\r
+  @retval EFI_ACCESS_DENIED     The previous operation has not completed yet.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_TFTP_ERROR        An MTFTPv4 ERROR packet was received and is in the buffer.\r
+  @retval EFI_ICMP_ERROR        An ICMP ERROR packet was received and is in the Buffer.\r
+  @retval EFI_PROTOCOL_ERROR    An unexpected MTFTPv4 packet was received and is in the buffer.\r
+  @retval EFI_TIMEOUT           No responses were received from the MTFTPv4 server.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_GET_INFO)(\r
+  IN  EFI_MTFTP4_PROTOCOL      *This,\r
+  IN  EFI_MTFTP4_OVERRIDE_DATA *OverrideData   OPTIONAL,\r
+  IN  UINT8                    *Filename,\r
+  IN  UINT8                    *ModeStr        OPTIONAL,\r
+  IN  UINT8                    OptionCount,\r
+  IN  EFI_MTFTP4_OPTION        *OptionList,\r
+  OUT UINT32                   *PacketLength,\r
+  OUT EFI_MTFTP4_PACKET        **Packet        OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Parses the options in an MTFTPv4 OACK packet.\r
+\r
+  @param  This         Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  PacketLen    Length of the OACK packet to be parsed.\r
+  @param  Packet       Pointer to the OACK packet to be parsed.\r
+  @param  OptionCount  Pointer to the number of options in following OptionList.\r
+  @param  OptionList   Pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot\r
+                       Service FreePool() to release each option if they are not\r
+                       needed any more.\r
+\r
+  @retval EFI_SUCCESS           The OACK packet was valid and the OptionCount and\r
+                                OptionList parameters have been updated.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - PacketLen is 0.\r
+                                - Packet is NULL or Packet is not a valid MTFTPv4 packet.\r
+                                - OptionCount is NULL.\r
+  @retval EFI_NOT_FOUND         No options were found in the OACK packet.\r
+  @retval EFI_OUT_OF_RESOURCES  Storage for the OptionList array cannot be allocated.\r
+  @retval EFI_PROTOCOL_ERROR    One or more of the option fields is invalid.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_PARSE_OPTIONS)(\r
+  IN  EFI_MTFTP4_PROTOCOL      *This,\r
+  IN  UINT32                   PacketLen,\r
+  IN  EFI_MTFTP4_PACKET        *Packet,\r
+  OUT UINT32                   *OptionCount,\r
+  OUT EFI_MTFTP4_OPTION        **OptionList OPTIONAL\r
+  )\r
+;  \r
+\r
+\r
+/**\r
+  Downloads a file from an MTFTPv4 server.\r
+\r
+  @param  This  Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  Token Pointer to the token structure to provide the parameters that are\r
+                used in this operation.\r
+\r
+  @retval EFI_SUCCESS          The data file has been transferred successfully.\r
+  @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
+  @retval EFI_BUFFER_TOO_SMALL BufferSize is not large enough to hold the downloaded data\r
+                               in downloading process.\r
+  @retval EFI_ABORTED          Current operation is aborted by user.\r
+  @retval EFI_ICMP_ERROR       An ICMP ERROR packet was received.\r
+  @retval EFI_TIMEOUT          No responses were received from the MTFTPv4 server.\r
+  @retval EFI_TFTP_ERROR       An MTFTPv4 ERROR packet was received.\r
+  @retval EFI_DEVICE_ERROR     An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_READ_FILE)(\r
+  IN EFI_MTFTP4_PROTOCOL       *This,\r
+  IN EFI_MTFTP4_TOKEN          *Token\r
+  )\r
+;  \r
+  \r
+\r
+\r
+/**\r
+  Sends a file to an MTFTPv4 server.\r
+\r
+  @param  This  Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  Token Pointer to the token structure to provide the parameters that are\r
+                used in this operation.\r
+\r
+  @retval EFI_SUCCESS           The upload session has started.\r
+  @retval EFI_UNSUPPORTED       The operation is not supported by this implementation.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_UNSUPPORTED       One or more options in the Token.OptionList are in\r
+                                the unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
+  @retval EFI_NOT_STARTED       The EFI MTFTPv4 Protocol driver has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_ALREADY_STARTED   This Token is already being used in another MTFTPv4 session.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_ACCESS_DENIED     The previous operation has not completed yet.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_WRITE_FILE)(\r
+  IN EFI_MTFTP4_PROTOCOL       *This,\r
+  IN EFI_MTFTP4_TOKEN          *Token\r
+  )\r
+;  \r
+  \r
+\r
+/**\r
+  Downloads a data file "directory" from an MTFTPv4 server. May be unsupported in some EFI\r
+  implementations.                                                                                                                                                                                 \r
+\r
+  @param  This  Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+  @param  Token Pointer to the token structure to provide the parameters that are\r
+                used in this operation.\r
+\r
+  @retval EFI_SUCCESS           The MTFTPv4 related file "directory" has been downloaded.\r
+  @retval EFI_UNSUPPORTED       The operation is not supported by this implementation.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_UNSUPPORTED       One or more options in the Token.OptionList are in\r
+                                the unsupported list of structure EFI_MTFTP4_MODE_DATA.\r
+  @retval EFI_NOT_STARTED       The EFI MTFTPv4 Protocol driver has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_ALREADY_STARTED   This Token is already being used in another MTFTPv4 session.\r
+  @retval EFI_OUT_OF_RESOURCES  Required system resources could not be allocated.\r
+  @retval EFI_ACCESS_DENIED     The previous operation has not completed yet.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network error or system error occurred.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS \r
+(EFIAPI *EFI_MTFTP4_READ_DIRECTORY)(\r
+  IN EFI_MTFTP4_PROTOCOL       *This,\r
+  IN EFI_MTFTP4_TOKEN          *Token\r
+  )\r
+;    \r
+\r
+/**\r
+  Polls for incoming data packets and processes outgoing data packets.\r
+\r
+  @param  This Pointer to the EFI_MTFTP4_PROTOCOL instance.\r
+\r
+  @retval  EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval  EFI_NOT_STARTED       This EFI MTFTPv4 Protocol instance has not been started.\r
+  @retval  EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                 RARP, etc.) is not finished yet.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval  EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.\r
+                                 Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_MTFTP4_POLL) (\r
+  IN EFI_MTFTP4_PROTOCOL       *This\r
+  )\r
+;                                                                                                                 \r
+                                                                                                                  \r
+  \r
+struct _EFI_MTFTP4_PROTOCOL {\r
+  EFI_MTFTP4_GET_MODE_DATA     GetModeData;\r
+  EFI_MTFTP4_CONFIGURE         Configure;\r
+  EFI_MTFTP4_GET_INFO          GetInfo;\r
+  EFI_MTFTP4_PARSE_OPTIONS     ParseOptions;\r
+  EFI_MTFTP4_READ_FILE         ReadFile;\r
+  EFI_MTFTP4_WRITE_FILE        WriteFile;\r
+  EFI_MTFTP4_READ_DIRECTORY    ReadDirectory;\r
+  EFI_MTFTP4_POLL              Poll;\r
+};\r
+\r
+struct _EFI_MTFTP4_TOKEN {\r
+  OUT EFI_STATUS                  Status;\r
+  IN  EFI_EVENT                   Event;\r
+  IN  EFI_MTFTP4_OVERRIDE_DATA    *OverrideData;\r
+  IN  UINT8                       *Filename;\r
+  IN  UINT8                       *ModeStr;\r
+  IN  UINT32                      OptionCount;\r
+  IN  EFI_MTFTP4_OPTION           *OptionList;\r
+  IN  OUT UINT64                  BufferSize;\r
+  IN  OUT VOID                    *Buffer;\r
+  IN  EFI_MTFTP4_CHECK_PACKET     CheckPacket;\r
+  IN  EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback;\r
+  IN  EFI_MTFTP4_PACKET_NEEDED    PacketNeeded;\r
+};\r
+\r
+extern EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiMtftp4ProtocolGuid;  \r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h b/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
new file mode 100644 (file)
index 0000000..98f1c59
--- /dev/null
@@ -0,0 +1,92 @@
+/** @file\r
+  Revision history:\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module name:\r
+\r
+  EfiNetworkInterfaceIdentifier.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_NETWORK_INTERFACE_IDENTIFER_H__\r
+#define __EFI_NETWORK_INTERFACE_IDENTIFER_H__\r
+\r
+\r
+#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID \\r
+  { \\r
+    0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 } \\r
+  }\r
+\r
+#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION    0x00010000\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL  EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL;\r
+\r
+typedef enum {\r
+  EfiNetworkInterfaceUndi = 1\r
+} EFI_NETWORK_PROTOCOL_TYPE;\r
+\r
+struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL {\r
+\r
+  UINT64  Revision;\r
+  //\r
+  // Revision of the network interface identifier protocol interface.\r
+  //\r
+  UINT64  ID;\r
+  //\r
+  // Address of the first byte of the identifying structure for this\r
+  // network interface.  This is set to zero if there is no structure.\r
+  //\r
+  // For PXE/UNDI this is the first byte of the !PXE structure.\r
+  //\r
+  UINT64  ImageAddr;\r
+  //\r
+  // Address of the UNrelocated driver/ROM image.  This is set\r
+  // to zero if there is no driver/ROM image.\r
+  //\r
+  // For 16-bit UNDI, this is the first byte of the option ROM in\r
+  // upper memory.\r
+  //\r
+  // For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM\r
+  // image.\r
+  //\r
+  // For H/W UNDI, this is set to zero.\r
+  //\r
+  UINT32  ImageSize;\r
+  //\r
+  // Size of the UNrelocated driver/ROM image of this network interface.\r
+  // This is set to zero if there is no driver/ROM image.\r
+  //\r
+  CHAR8   StringId[4];\r
+  //\r
+  // 4 char ASCII string to go in class identifier (option 60) in DHCP\r
+  // and Boot Server discover packets.\r
+  // For EfiNetworkInterfaceUndi this field is "UNDI".\r
+  // For EfiNetworkInterfaceSnp this field is "SNPN".\r
+  //\r
+  UINT8   Type;\r
+  UINT8   MajorVer;\r
+  UINT8   MinorVer;\r
+  //\r
+  // Information to be placed into the PXE DHCP and Discover packets.\r
+  // This is the network interface type and version number that will\r
+  // be placed into DHCP option 94 (client network interface identifier).\r
+  //\r
+  BOOLEAN Ipv6Supported;\r
+  UINT8   IfNum;  // interface number to be used with pxeid structure\r
+};\r
+\r
+extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid;\r
+extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid_31;\r
+\r
+#endif // _EFI_NII_H\r
diff --git a/MdePkg/Include/Protocol/Pcd.h b/MdePkg/Include/Protocol/Pcd.h
new file mode 100644 (file)
index 0000000..7741df1
--- /dev/null
@@ -0,0 +1,860 @@
+/** @file\r
+  Platform Configuration Database (PCD) Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Pcd.h\r
+\r
+**/\r
+\r
+#ifndef __PCD_H__\r
+#define __PCD_H__\r
+\r
+extern EFI_GUID gPcdProtocolGuid;\r
+\r
+#define PCD_PROTOCOL_GUID \\r
+  { 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7 } }\r
+\r
+#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
+\r
+\r
+/**\r
+  Sets the SKU value for subsequent calls to set or get PCD token values.\r
+\r
+  SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. \r
+  SetSku() is normally called only once by the system.\r
+\r
+  For each item (token), the database can hold a single value that applies to all SKUs, \r
+  or multiple values, where each value is associated with a specific SKU Id. Items with multiple, \r
+  SKU-specific values are called SKU enabled. \r
+  \r
+  The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.  \r
+  For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the \r
+  single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the \r
+  last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, \r
+  the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been \r
+  set for that Id, the results are unpredictable.\r
+\r
+  @param[in]  SkuId The SKU value that will be used when the PCD service will retrieve and \r
+              set values associated with a PCD token.\r
+\r
+  @retval VOID\r
+\r
+**/\r
+typedef \r
+VOID\r
+(EFIAPI *PCD_PROTOCOL_SET_SKU) (\r
+  IN  UINTN                  SkuId\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 8-bit value for a given PCD token.\r
+\r
+  Retrieves the current byte-sized value for a PCD token number.  \r
+  If the TokenNumber is invalid, the results are unpredictable.\r
+  \r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The UINT8 value.\r
+  \r
+**/\r
+typedef\r
+UINT8\r
+(EFIAPI *PCD_PROTOCOL_GET8) (\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 16-bit value for a given PCD token.\r
+\r
+  Retrieves the current 16-bits value for a PCD token number.  \r
+  If the TokenNumber is invalid, the results are unpredictable.\r
+  \r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The UINT16 value.\r
+  \r
+**/\r
+typedef\r
+UINT16\r
+(EFIAPI *PCD_PROTOCOL_GET16) (\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 32-bit value for a given PCD token.\r
+\r
+  Retrieves the current 32-bits value for a PCD token number.  \r
+  If the TokenNumber is invalid, the results are unpredictable.\r
+  \r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The UINT32 value.\r
+  \r
+**/\r
+typedef\r
+UINT32\r
+(EFIAPI *PCD_PROTOCOL_GET32) (\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 64-bit value for a given PCD token.\r
+\r
+  Retrieves the current 64-bits value for a PCD token number.  \r
+  If the TokenNumber is invalid, the results are unpredictable.\r
+  \r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The UINT64 value.\r
+  \r
+**/\r
+typedef\r
+UINT64\r
+(EFIAPI *PCD_PROTOCOL_GET64) (\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves a pointer to a value for a given PCD token.\r
+\r
+  Retrieves the current pointer to the buffer for a PCD token number.  \r
+  Do not make any assumptions about the alignment of the pointer that \r
+  is returned by this function call.  If the TokenNumber is invalid, \r
+  the results are unpredictable.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The pointer to the buffer to be retrived.\r
+  \r
+**/\r
+typedef\r
+VOID *\r
+(EFIAPI *PCD_PROTOCOL_GET_POINTER) (\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves a Boolean value for a given PCD token.\r
+\r
+  Retrieves the current boolean value for a PCD token number.  \r
+  Do not make any assumptions about the alignment of the pointer that \r
+  is returned by this function call.  If the TokenNumber is invalid, \r
+  the results are unpredictable.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The Boolean value.\r
+  \r
+**/\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *PCD_PROTOCOL_GET_BOOLEAN) (\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves the size of the value for a given PCD token.\r
+\r
+  Retrieves the current size of a particular PCD token.  \r
+  If the TokenNumber is invalid, the results are unpredictable.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The size of the value for the PCD token.\r
+  \r
+**/\r
+typedef\r
+UINTN\r
+(EFIAPI *PCD_PROTOCOL_GET_SIZE) (\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 8-bit value for a given PCD token.\r
+\r
+  Retrieves the 8-bit value of a particular PCD token.  \r
+  If the TokenNumber is invalid or the token space\r
+  specified by Guid does not exist, the results are \r
+  unpredictable.\r
+\r
+  @param[in]  Guid The token space for the token number.\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The size 8-bit value for the PCD token.\r
+  \r
+**/\r
+typedef\r
+UINT8\r
+(EFIAPI *PCD_PROTOCOL_GET_EX_8) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 16-bit value for a given PCD token.\r
+\r
+  Retrieves the 16-bit value of a particular PCD token.  \r
+  If the TokenNumber is invalid or the token space\r
+  specified by Guid does not exist, the results are \r
+  unpredictable.\r
+\r
+  @param[in]  Guid The token space for the token number.\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The size 16-bit value for the PCD token.\r
+  \r
+**/\r
+typedef\r
+UINT16\r
+(EFIAPI *PCD_PROTOCOL_GET_EX_16) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 32-bit value for a given PCD token.\r
+\r
+  Retrieves the 32-bit value of a particular PCD token.  \r
+  If the TokenNumber is invalid or the token space\r
+  specified by Guid does not exist, the results are \r
+  unpredictable.\r
+\r
+  @param[in]  Guid The token space for the token number.\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The size 32-bit value for the PCD token.\r
+  \r
+**/typedef\r
+UINT32\r
+(EFIAPI *PCD_PROTOCOL_GET_EX_32) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an 64-bit value for a given PCD token.\r
+\r
+  Retrieves the 64-bit value of a particular PCD token.  \r
+  If the TokenNumber is invalid or the token space\r
+  specified by Guid does not exist, the results are \r
+  unpredictable.\r
+\r
+  @param[in]  Guid The token space for the token number.\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The size 64-bit value for the PCD token.\r
+  \r
+**/\r
+typedef\r
+UINT64\r
+(EFIAPI *PCD_PROTOCOL_GET_EX_64) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves a pointer to a value for a given PCD token.\r
+\r
+  Retrieves the current pointer to the buffer for a PCD token number.  \r
+  Do not make any assumptions about the alignment of the pointer that \r
+  is returned by this function call.  If the TokenNumber is invalid, \r
+  the results are unpredictable.\r
+\r
+  @param[in]  Guid The token space for the token number.\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The pointer to the buffer to be retrived.\r
+  \r
+**/\r
+typedef\r
+VOID *\r
+(EFIAPI *PCD_PROTOCOL_GET_EX_POINTER) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves an Boolean value for a given PCD token.\r
+\r
+  Retrieves the Boolean value of a particular PCD token.  \r
+  If the TokenNumber is invalid or the token space\r
+  specified by Guid does not exist, the results are \r
+  unpredictable.\r
+\r
+  @param[in]  Guid The token space for the token number.\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The size Boolean value for the PCD token.\r
+  \r
+**/\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *PCD_PROTOCOL_GET_EX_BOOLEAN) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves the size of the value for a given PCD token.\r
+\r
+  Retrieves the current size of a particular PCD token.  \r
+  If the TokenNumber is invalid, the results are unpredictable.\r
+\r
+  @param[in]  Guid The token space for the token number.\r
+  @param[in]  TokenNumber The PCD token number. \r
+\r
+  @return The size of the value for the PCD token.\r
+  \r
+**/\r
+typedef\r
+UINTN\r
+(EFIAPI *PCD_PROTOCOL_GET_EX_SIZE) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 8-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET8) (\r
+  IN UINTN             TokenNumber,\r
+  IN UINT8             Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 16-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET16) (\r
+  IN UINTN              TokenNumber,\r
+  IN UINT16             Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 32-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET32) (\r
+  IN UINTN              TokenNumber,\r
+  IN UINT32             Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 64-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET64) (\r
+  IN UINTN             TokenNumber,\r
+  IN UINT64            Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets a value of a specified size for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.  \r
+                              On input, if the SizeOfValue is greater than the maximum size supported \r
+                              for this TokenNumber then the output value of SizeOfValue will reflect \r
+                              the maximum size supported for this TokenNumber.\r
+  @param[in]  Buffer The buffer to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_POINTER) (\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an Boolean value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_BOOLEAN) (\r
+  IN UINTN             TokenNumber,\r
+  IN BOOLEAN           Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 8-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_EX_8) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber,\r
+  IN UINT8             Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 16-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_EX_16) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber,\r
+  IN UINT16            Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 32-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_EX_32) (\r
+  IN CONST EFI_GUID     *Guid,\r
+  IN UINTN              TokenNumber,\r
+  IN UINT32             Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an 64-bit value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_EX_64) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber,\r
+  IN UINT64            Value\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets a value of a specified size for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.  \r
+                              On input, if the SizeOfValue is greater than the maximum size supported \r
+                              for this TokenNumber then the output value of SizeOfValue will reflect \r
+                              the maximum size supported for this TokenNumber.\r
+  @param[in]  Buffer The buffer to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_EX_POINTER) (\r
+  IN      CONST EFI_GUID    *Guid,\r
+  IN      UINTN             TokenNumber,\r
+  IN OUT  UINTN             *SizeOfBuffer,\r
+  IN      VOID              *Buffer\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Sets an Boolean value for a given PCD token.\r
+\r
+  When the PCD service sets a value, it will check to ensure that the \r
+  size of the value being set is compatible with the Token's existing definition.  \r
+  If it is not, an error will be returned.\r
+\r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Value The value to set for the PCD token.\r
+\r
+  @retval EFI_SUCCESS  Procedure returned successfully.\r
+  @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
+                                  being set was incompatible with a call to this function.  \r
+                                  Use GetSize() to retrieve the size of the target data.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_SET_EX_BOOLEAN) (\r
+  IN CONST EFI_GUID    *Guid,\r
+  IN UINTN             TokenNumber,\r
+  IN BOOLEAN           Value\r
+  );\r
+  \r
+\r
+\r
+/**\r
+  Callback on SET function prototype definition.\r
+\r
+  This notification function serves two purposes. \r
+  Firstly, it notifies the module which did the registration that the value \r
+  of this PCD token has been set. Secondly, it provides a mechanism for the \r
+  module which did the registration to intercept the set operation and override \r
+  the value been set if necessary. After the invocation of the callback function, \r
+  TokenData will be used by PCD service DXE driver to modify the internal data in \r
+  PCD database.\r
+\r
+  @param[in]  CallBackGuid The PCD token GUID being set.\r
+  @param[in]  CallBackToken The PCD token number being set.\r
+  @param[in, out]  TokenData A pointer to the token data being set.\r
+  @param[in]  TokenDataSize The size, in bytes, of the data being set.\r
+\r
+  @retval VOID\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *PCD_PROTOCOL_CALLBACK) (\r
+  IN      CONST EFI_GUID   *CallBackGuid, OPTIONAL\r
+  IN      UINTN            CallBackToken,\r
+  IN  OUT VOID             *TokenData,\r
+  IN      UINTN            TokenDataSize\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Specifies a function to be called anytime the value of a designated token is changed.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  CallBackFunction The function prototype called when the value associated with the CallBackToken is set.  \r
+\r
+  @retval EFI_SUCCESS  The PCD service has successfully established a call event \r
+                        for the CallBackToken requested.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_CALLBACK_ONSET) (\r
+  IN  CONST EFI_GUID          *Guid, OPTIONAL\r
+  IN  UINTN                   TokenNumber,\r
+  IN  PCD_PROTOCOL_CALLBACK   CallBackFunction\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Cancels a previously set callback function for a particular PCD token number.\r
+\r
+  @param[in]  TokenNumber The PCD token number. \r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in]  CallBackFunction The function prototype called when the value associated with the CallBackToken is set.  \r
+\r
+  @retval EFI_SUCCESS  The PCD service has successfully established a call event \r
+                        for the CallBackToken requested.\r
+  @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_CANCEL_CALLBACK) (\r
+  IN  CONST EFI_GUID          *Guid, OPTIONAL\r
+  IN  UINTN                   TokenNumber,\r
+  IN  PCD_PROTOCOL_CALLBACK   CallBackFunction\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves the next valid PCD token for a given namespace.\r
+\r
+  @param[in]  Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
+  @param[in,out]  TokenNumber A pointer to the PCD token number to use to find the subsequent token number.  \r
+                  If the input token namespace or token number does not exist on the platform, \r
+                  an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token, \r
+                  have the pointer reference a TokenNumber value of 0. If the input token number is 0 and \r
+                  there is no valid token number for this token namespace,  *TokenNumber will be assigned to \r
+                  0 and the function return EFI_SUCCESS. If the token number is the last valid token number, \r
+                  *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.\r
+\r
+  @retval EFI_SUCCESS  The PCD service retrieved the next valid token number. Or the input token number \r
+                        is already the last valid token number in the PCD database. \r
+                        In the later case, *TokenNumber is updated with the value of 0.\r
+  @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKEN) (\r
+  IN      CONST EFI_GUID      *Guid, OPTIONAL\r
+  IN OUT  UINTN               *TokenNumber\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves the next valid PCD token namespace for a given namespace.\r
+\r
+  @param[in, out]  Guid An indirect pointer to EFI_GUID.  On input it designates \r
+                    a known token namespace from which the search will start. On output, \r
+                    it designates the next valid token namespace on the platform. If the input \r
+                    token namespace does not exist on the platform, an error is returned and \r
+                    the value of *Guid is undefined. If *Guid is NULL, then the GUID of the \r
+                    first token space of the current platform is assigned to *Guid the function \r
+                    return EFI_SUCCESS. If  *Guid is NULL  and there is no namespace exist in \r
+                    the platform other than the default (NULL) tokennamespace, *Guid is unchanged \r
+                    and the function return EFI_SUCCESS. If this input token namespace is the last \r
+                    namespace on the platform, *Guid will be assigned to NULL and the function return \r
+                    EFI_SUCCESS. \r
+\r
+  @retval EFI_SUCCESS  The PCD service retrieved the next valid token space Guid. \r
+                        Or the input token space Guid is already the last valid token space Guid \r
+                        in the PCD database. In the later case, *Guid is updated with the value of NULL.\r
+  @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE) (\r
+  IN  OUT    CONST EFI_GUID      **Guid\r
+  );\r
+\r
+\r
+\r
+//\r
+// Interface structure for the PCD Protocol\r
+//\r
+typedef struct {\r
+  PCD_PROTOCOL_SET_SKU              SetSku;\r
+\r
+  PCD_PROTOCOL_GET8                 Get8;\r
+  PCD_PROTOCOL_GET16                Get16;\r
+  PCD_PROTOCOL_GET32                Get32;\r
+  PCD_PROTOCOL_GET64                Get64;\r
+  PCD_PROTOCOL_GET_POINTER          GetPtr;\r
+  PCD_PROTOCOL_GET_BOOLEAN          GetBool;\r
+  PCD_PROTOCOL_GET_SIZE             GetSize;\r
+\r
+  PCD_PROTOCOL_GET_EX_8             Get8Ex;\r
+  PCD_PROTOCOL_GET_EX_16            Get16Ex;\r
+  PCD_PROTOCOL_GET_EX_32            Get32Ex;\r
+  PCD_PROTOCOL_GET_EX_64            Get64Ex;\r
+  PCD_PROTOCOL_GET_EX_POINTER       GetPtrEx;\r
+  PCD_PROTOCOL_GET_EX_BOOLEAN       GetBoolEx;\r
+  PCD_PROTOCOL_GET_EX_SIZE          GetSizeEx;\r
+\r
+  PCD_PROTOCOL_SET8                 Set8;\r
+  PCD_PROTOCOL_SET16                Set16;\r
+  PCD_PROTOCOL_SET32                Set32;\r
+  PCD_PROTOCOL_SET64                Set64;\r
+  PCD_PROTOCOL_SET_POINTER          SetPtr;\r
+  PCD_PROTOCOL_SET_BOOLEAN          SetBool;\r
+\r
+  PCD_PROTOCOL_SET_EX_8             Set8Ex;\r
+  PCD_PROTOCOL_SET_EX_16            Set16Ex;\r
+  PCD_PROTOCOL_SET_EX_32            Set32Ex;\r
+  PCD_PROTOCOL_SET_EX_64            Set64Ex;\r
+  PCD_PROTOCOL_SET_EX_POINTER       SetPtrEx;\r
+  PCD_PROTOCOL_SET_EX_BOOLEAN       SetBoolEx;\r
+\r
+  PCD_PROTOCOL_CALLBACK_ONSET       CallbackOnSet;\r
+  PCD_PROTOCOL_CANCEL_CALLBACK      CancelCallback;\r
+  PCD_PROTOCOL_GET_NEXT_TOKEN       GetNextToken;\r
+  PCD_PROTOCOL_GET_NEXT_TOKENSPACE  GetNextTokenSpace;\r
+} PCD_PROTOCOL;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/PciIo.h b/MdePkg/Include/Protocol/PciIo.h
new file mode 100644 (file)
index 0000000..147f6b2
--- /dev/null
@@ -0,0 +1,503 @@
+/** @file\r
+  EFI PCI I/O Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  PciIo.h\r
+\r
+**/\r
+\r
+#ifndef __PCI_IO_H__\r
+#define __PCI_IO_H__\r
+\r
+//\r
+// Global ID for the PCI I/O Protocol\r
+//\r
+#define EFI_PCI_IO_PROTOCOL_GUID \\r
+  { \\r
+    0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \\r
+  }\r
+\r
+typedef struct _EFI_PCI_IO_PROTOCOL  EFI_PCI_IO_PROTOCOL;\r
+\r
+//\r
+// Prototypes for the PCI I/O Protocol\r
+//\r
+typedef enum {\r
+  EfiPciIoWidthUint8      = 0,\r
+  EfiPciIoWidthUint16,\r
+  EfiPciIoWidthUint32,\r
+  EfiPciIoWidthUint64,\r
+  EfiPciIoWidthFifoUint8,\r
+  EfiPciIoWidthFifoUint16,\r
+  EfiPciIoWidthFifoUint32,\r
+  EfiPciIoWidthFifoUint64,\r
+  EfiPciIoWidthFillUint8,\r
+  EfiPciIoWidthFillUint16,\r
+  EfiPciIoWidthFillUint32,\r
+  EfiPciIoWidthFillUint64,\r
+  EfiPciIoWidthMaximum\r
+} EFI_PCI_IO_PROTOCOL_WIDTH;\r
+\r
+//\r
+// Complete PCI address generater\r
+//\r
+#define EFI_PCI_IO_PASS_THROUGH_BAR               0xff    // Special BAR that passes a memory or I/O cycle through unchanged\r
+#define EFI_PCI_IO_ATTRIBUTE_MASK                 0x077f  // All the following I/O and Memory cycles\r
+#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO   0x0001  // I/O cycles 0x0000-0x00FF (10 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO               0x0002  // I/O cycles 0x0100-0x03FF or greater (10 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO       0x0004  // I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY           0x0008  // MEM cycles 0xA0000-0xBFFFF (24 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO               0x0010  // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO       0x0020  // I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO     0x0040  // I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080  // Map a memory range so write are combined\r
+#define EFI_PCI_IO_ATTRIBUTE_IO                   0x0100  // Enable the I/O decode bit in the PCI Config Header\r
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY               0x0200  // Enable the Memory decode bit in the PCI Config Header\r
+#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER           0x0400  // Enable the DMA bit in the PCI Config Header\r
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        0x0800  // Map a memory range so all r/w accesses are cached\r
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       0x1000  // Disable a memory range\r
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      0x2000  // Clear for an add-in PCI Device\r
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM         0x4000  // Clear for a physical PCI Option ROM accessed through ROM BAR\r
+#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE   0x8000  // Clear for PCI controllers that can not genrate a DAC\r
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16            0x10000 // I/O cycles 0x0100-0x03FF or greater (16 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16    0x20000 // I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)\r
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16            0x30000 // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)\r
+\r
+#define EFI_PCI_DEVICE_ENABLE                     (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER)\r
+#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)\r
+\r
+//\r
+// *******************************************************\r
+// EFI_PCI_IO_PROTOCOL_OPERATION\r
+// *******************************************************\r
+//\r
+typedef enum {\r
+  EfiPciIoOperationBusMasterRead,\r
+  EfiPciIoOperationBusMasterWrite,\r
+  EfiPciIoOperationBusMasterCommonBuffer,\r
+  EfiPciIoOperationMaximum\r
+} EFI_PCI_IO_PROTOCOL_OPERATION;\r
+\r
+//\r
+// *******************************************************\r
+// EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION\r
+// *******************************************************\r
+//\r
+typedef enum {\r
+  EfiPciIoAttributeOperationGet,\r
+  EfiPciIoAttributeOperationSet,\r
+  EfiPciIoAttributeOperationEnable,\r
+  EfiPciIoAttributeOperationDisable,\r
+  EfiPciIoAttributeOperationSupported,\r
+  EfiPciIoAttributeOperationMaximum\r
+} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;\r
+\r
+/**                                                                 \r
+  Reads from the memory space of a PCI controller. Returns when either the polling exit criteria is\r
+  satisfied or after a defined duration.                                                           \r
+          \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.\r
+  @param  Width                 Signifies the width of the memory or I/O operations.\r
+  @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the\r
+                                base address for the memory operation to perform.                   \r
+  @param  Offset                The offset within the selected BAR to start the memory operation.\r
+  @param  Mask                  Mask used for the polling criteria.\r
+  @param  Value                 The comparison value used for the polling exit criteria.\r
+  @param  Delay                 The number of 100 ns units to poll.\r
+  @param  Result                Pointer to the last value read from the memory location.\r
+                                \r
+  @retval EFI_SUCCESS           The last data returned from the access matched the poll exit criteria.\r
+  @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.\r
+  @retval EFI_UNSUPPORTED       Offset is not valid for the BarIndex of this PCI controller.\r
+  @retval EFI_TIMEOUT           Delay expired before a match occurred.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM) (\r
+  IN EFI_PCI_IO_PROTOCOL           *This,\r
+  IN  EFI_PCI_IO_PROTOCOL_WIDTH    Width,\r
+  IN  UINT8                        BarIndex,\r
+  IN  UINT64                       Offset,\r
+  IN  UINT64                       Mask,\r
+  IN  UINT64                       Value,\r
+  IN  UINT64                       Delay,\r
+  OUT UINT64                       *Result\r
+  );\r
+\r
+/**                                                                 \r
+  Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.\r
+          \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.\r
+  @param  Width                 Signifies the width of the memory or I/O operations.\r
+  @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the\r
+                                base address for the memory or I/O operation to perform.                    \r
+  @param  Offset                The offset within the selected BAR to start the memory or I/O operation.                                \r
+  @param  Count                 The number of memory or I/O operations to perform.\r
+  @param  Buffer                For read operations, the destination buffer to store the results. For write\r
+                                operations, the source buffer to write data from.                          \r
+  \r
+  @retval EFI_SUCCESS           The data was read from or written to the PCI controller.\r
+  @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.\r
+  @retval EFI_UNSUPPORTED       The address range specified by Offset, Width, and Count is not\r
+                                valid for the PCI BAR specified by BarIndex.                  \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM) (\r
+  IN EFI_PCI_IO_PROTOCOL              *This,\r
+  IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,\r
+  IN     UINT8                        BarIndex,\r
+  IN     UINT64                       Offset,\r
+  IN     UINTN                        Count,\r
+  IN OUT VOID                         *Buffer\r
+  );\r
+\r
+typedef struct {\r
+  EFI_PCI_IO_PROTOCOL_IO_MEM  Read;\r
+  EFI_PCI_IO_PROTOCOL_IO_MEM  Write;\r
+} EFI_PCI_IO_PROTOCOL_ACCESS;\r
+\r
+/**                                                                 \r
+  Enable a PCI driver to access PCI controller registers in PCI configuration space.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.  \r
+  @param  Width                 Signifies the width of the memory operations.\r
+  @param  Offset                The offset within the PCI configuration space for the PCI controller.\r
+  @param  Count                 The number of PCI configuration operations to perform.\r
+  @param  Buffer                For read operations, the destination buffer to store the results. For write\r
+                                operations, the source buffer to write data from.\r
+  \r
+                                  \r
+  @retval EFI_SUCCESS           The data was read from or written to the PCI controller.\r
+  @retval EFI_UNSUPPORTED       The address range specified by Offset, Width, and Count is not\r
+                                valid for the PCI configuration header of the PCI controller.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.                                 \r
+  @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.                                \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG) (\r
+  IN EFI_PCI_IO_PROTOCOL              *This,\r
+  IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,\r
+  IN     UINT32                       Offset,\r
+  IN     UINTN                        Count,\r
+  IN OUT VOID                         *Buffer\r
+  );\r
+\r
+typedef struct {\r
+  EFI_PCI_IO_PROTOCOL_CONFIG  Read;\r
+  EFI_PCI_IO_PROTOCOL_CONFIG  Write;\r
+} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;\r
+\r
+/**                                                                 \r
+  Enables a PCI driver to copy one region of PCI memory space to another region of PCI\r
+  memory space.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.\r
+  @param  Width                 Signifies the width of the memory operations.\r
+  @param  DestBarIndex          The BAR index in the standard PCI Configuration header to use as the\r
+                                base address for the memory operation to perform.                   \r
+  @param  DestOffset            The destination offset within the BAR specified by DestBarIndex to\r
+                                start the memory writes for the copy operation.                   \r
+  @param  SrcBarIndex           The BAR index in the standard PCI Configuration header to use as the\r
+                                base address for the memory operation to perform.                   \r
+  @param  SrcOffset             The source offset within the BAR specified by SrcBarIndex to start\r
+                                the memory reads for the copy operation.                          \r
+  @param  Count                 The number of memory operations to perform. Bytes moved is Width\r
+                                size * Count, starting at DestOffset and SrcOffset.             \r
+                                \r
+  @retval EFI_SUCCESS           The data was copied from one memory region to another memory region.\r
+  @retval EFI_UNSUPPORTED       DestBarIndex not valid for this PCI controller.\r
+  @retval EFI_UNSUPPORTED       SrcBarIndex not valid for this PCI controller.\r
+  @retval EFI_UNSUPPORTED       The address range specified by DestOffset, Width, and Count\r
+                                is not valid for the PCI BAR specified by DestBarIndex.    \r
+  @retval EFI_UNSUPPORTED       The address range specified by SrcOffset, Width, and Count is\r
+                                not valid for the PCI BAR specified by SrcBarIndex.          \r
+  @retval EFI_INVALID_PARAMETER Width is invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM) (\r
+  IN EFI_PCI_IO_PROTOCOL              *This,\r
+  IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,\r
+  IN     UINT8                        DestBarIndex,\r
+  IN     UINT64                       DestOffset,\r
+  IN     UINT8                        SrcBarIndex,\r
+  IN     UINT64                       SrcOffset,\r
+  IN     UINTN                        Count\r
+  );\r
+\r
+/**                                                                 \r
+  Provides the PCI controller-Cspecific addresses needed to access system memory.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.\r
+  @param  Operation             Indicates if the bus master is going to read or write to system memory.\r
+  @param  HostAddress           The system memory address to map to the PCI controller.\r
+  @param  NumberOfBytes         On input the number of bytes to map. On output the number of bytes\r
+                                that were mapped.                                                 \r
+  @param  DeviceAddress         The resulting map address for the bus master PCI controller to use to\r
+                                access the hosts HostAddress.                                        \r
+  @param  Mapping               A resulting value to pass to Unmap().\r
+                                  \r
+  @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.\r
+  @retval EFI_UNSUPPORTED       The HostAddress cannot be mapped as a common buffer.                                \r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_MAP) (\r
+  IN EFI_PCI_IO_PROTOCOL                *This,\r
+  IN     EFI_PCI_IO_PROTOCOL_OPERATION  Operation,\r
+  IN     VOID                           *HostAddress,\r
+  IN OUT UINTN                          *NumberOfBytes,\r
+  OUT    EFI_PHYSICAL_ADDRESS           *DeviceAddress,\r
+  OUT    VOID                           **Mapping\r
+  );\r
+\r
+/**                                                                 \r
+  Completes the Map() operation and releases any corresponding resources.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.                                      \r
+  @param  Mapping               The mapping value returned from Map().\r
+                                  \r
+  @retval EFI_SUCCESS           The range was unmapped.\r
+  @retval EFI_DEVICE_ERROR      The data was not committed to the target system memory.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP) (\r
+  IN EFI_PCI_IO_PROTOCOL           *This,\r
+  IN  VOID                         *Mapping\r
+  );\r
+\r
+/**                                                                 \r
+  Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer\r
+  mapping.                                                                       \r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.\r
+  @param  Type                  This parameter is not used and must be ignored.\r
+  @param  MemoryType            The type of memory to allocate, EfiBootServicesData or\r
+                                EfiRuntimeServicesData.                               \r
+  @param  Pages                 The number of pages to allocate.                                \r
+  @param  HostAddress           A pointer to store the base system memory address of the\r
+                                allocated range.                                        \r
+  @param  Attributes            The requested bit mask of attributes for the allocated range.\r
+                                  \r
+  @retval EFI_SUCCESS           The requested memory pages were allocated.\r
+  @retval EFI_UNSUPPORTED       Attributes is unsupported. The only legal attribute bits are\r
+                                MEMORY_WRITE_COMBINE and MEMORY_CACHED.                     \r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.  \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER) (\r
+  IN EFI_PCI_IO_PROTOCOL           *This,\r
+  IN  EFI_ALLOCATE_TYPE            Type,\r
+  IN  EFI_MEMORY_TYPE              MemoryType,\r
+  IN  UINTN                        Pages,\r
+  OUT VOID                         **HostAddress,\r
+  IN  UINT64                       Attributes\r
+  );\r
+\r
+/**                                                                 \r
+  Frees memory that was allocated with AllocateBuffer().\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.  \r
+  @param  Pages                 The number of pages to free.                                \r
+  @param  HostAddress           The base system memory address of the allocated range.                                    \r
+                                  \r
+  @retval EFI_SUCCESS           The requested memory pages were freed.\r
+  @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages\r
+                                was not allocated with AllocateBuffer().\r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER) (\r
+  IN EFI_PCI_IO_PROTOCOL           *This,\r
+  IN  UINTN                        Pages,\r
+  IN  VOID                         *HostAddress\r
+  );\r
+\r
+/**                                                                 \r
+  Flushes all PCI posted write transactions from a PCI host bridge to system memory.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.  \r
+                                  \r
+  @retval EFI_SUCCESS           The PCI posted write transactions were flushed from the PCI host\r
+                                bridge to system memory.                                        \r
+  @retval EFI_DEVICE_ERROR      The PCI posted write transactions were not flushed from the PCI\r
+                                host bridge due to a hardware error.                           \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH) (\r
+  IN EFI_PCI_IO_PROTOCOL  *This\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves this PCI controller's current PCI bus number, device number, and function number.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.  \r
+  @param  SegmentNumber         The PCI controller's current PCI segment number.\r
+  @param  BusNumber             The PCI controller's current PCI bus number.\r
+  @param  DeviceNumber          The PCI controller's current PCI device number.\r
+  @param  FunctionNumber        The PCI controller's current PCI function number.\r
+                                  \r
+  @retval EFI_SUCCESS           The PCI controller location was returned.                                                       \r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                              \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION) (\r
+  IN EFI_PCI_IO_PROTOCOL          *This,\r
+  OUT UINTN                       *SegmentNumber,\r
+  OUT UINTN                       *BusNumber,\r
+  OUT UINTN                       *DeviceNumber,\r
+  OUT UINTN                       *FunctionNumber\r
+  );\r
+\r
+/**                                                                 \r
+  Performs an operation on the attributes that this PCI controller supports. The operations include\r
+  getting the set of supported attributes, retrieving the current attributes, setting the current  \r
+  attributes, enabling attributes, and disabling attributes.                                       \r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.  \r
+  @param  Operation             The operation to perform on the attributes for this PCI controller.\r
+  @param  Attributes            The mask of attributes that are used for Set, Enable, and Disable\r
+                                operations.                                                      \r
+  @param  Result                A pointer to the result mask of attributes that are returned for the Get\r
+                                and Supported operations.                                               \r
+                                  \r
+  @retval EFI_SUCCESS           The operation on the PCI controller's attributes was completed.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                              \r
+  @retval EFI_UNSUPPORTED       one or more of the bits set in                               \r
+                                Attributes are not supported by this PCI controller or one of\r
+                                its parent bridges when Operation is Set, Enable or Disable.\r
+                                       \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) (\r
+  IN EFI_PCI_IO_PROTOCOL                       *This,\r
+  IN  EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION  Operation,\r
+  IN  UINT64                                   Attributes,\r
+  OUT UINT64                                   *Result OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Gets the attributes that this PCI controller supports setting on a BAR using\r
+  SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.  \r
+  @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the\r
+                                base address for resource range. The legal range for this field is 0..5.\r
+  @param  Supports              A pointer to the mask of attributes that this PCI controller supports\r
+                                setting for this BAR with SetBarAttributes().                        \r
+  @param  Resources             A pointer to the ACPI 2.0 resource descriptors that describe the current\r
+                                configuration of this BAR of the PCI controller.                        \r
+                                  \r
+  @retval EFI_SUCCESS           If Supports is not NULL, then the attributes that the PCI       \r
+                                controller supports are returned in Supports. If Resources      \r
+                                is not NULL, then the ACPI 2.0 resource descriptors that the PCI\r
+                                controller is currently using are returned in Resources.          \r
+  @retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.\r
+  @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to allocate\r
+                                Resources.                                                 \r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES) (\r
+  IN EFI_PCI_IO_PROTOCOL             *This,\r
+  IN  UINT8                          BarIndex,\r
+  OUT UINT64                         *Supports, OPTIONAL\r
+  OUT VOID                           **Resources OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Sets the attributes for a range of a BAR on a PCI controller.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.  \r
+  @param  Attributes            The mask of attributes to set for the resource range specified by\r
+                                BarIndex, Offset, and Length.                                    \r
+  @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the\r
+                                base address for resource range. The legal range for this field is 0..5.\r
+  @param  Offset                A pointer to the BAR relative base address of the resource range to be\r
+                                modified by the attributes specified by Attributes.                   \r
+  @param  Length                A pointer to the length of the resource range to be modified by the\r
+                                attributes specified by Attributes.                                \r
+                                  \r
+  @retval EFI_SUCCESS           The set of attributes specified by Attributes for the resource      \r
+                                range specified by BarIndex, Offset, and Length were                \r
+                                set on the PCI controller, and the actual resource range is returned\r
+                                in Offset and Length.                                               \r
+  @retval EFI_INVALID_PARAMETER Offset or Length is NULL.\r
+  @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to set the attributes on the\r
+                                resource range specified by BarIndex, Offset, and          \r
+                                Length.                                                    \r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES) (\r
+  IN EFI_PCI_IO_PROTOCOL              *This,\r
+  IN     UINT64                       Attributes,\r
+  IN     UINT8                        BarIndex,\r
+  IN OUT UINT64                       *Offset,\r
+  IN OUT UINT64                       *Length\r
+  );\r
+\r
+//\r
+// Interface structure for the PCI I/O Protocol\r
+//\r
+struct _EFI_PCI_IO_PROTOCOL {\r
+  EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollMem;\r
+  EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollIo;\r
+  EFI_PCI_IO_PROTOCOL_ACCESS              Mem;\r
+  EFI_PCI_IO_PROTOCOL_ACCESS              Io;\r
+  EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS       Pci;\r
+  EFI_PCI_IO_PROTOCOL_COPY_MEM            CopyMem;\r
+  EFI_PCI_IO_PROTOCOL_MAP                 Map;\r
+  EFI_PCI_IO_PROTOCOL_UNMAP               Unmap;\r
+  EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER     AllocateBuffer;\r
+  EFI_PCI_IO_PROTOCOL_FREE_BUFFER         FreeBuffer;\r
+  EFI_PCI_IO_PROTOCOL_FLUSH               Flush;\r
+  EFI_PCI_IO_PROTOCOL_GET_LOCATION        GetLocation;\r
+  EFI_PCI_IO_PROTOCOL_ATTRIBUTES          Attributes;\r
+  EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES  GetBarAttributes;\r
+  EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES  SetBarAttributes;\r
+  UINT64                                  RomSize;\r
+  VOID                                    *RomImage;\r
+};\r
+\r
+extern EFI_GUID gEfiPciIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/PciRootBridgeIo.h b/MdePkg/Include/Protocol/PciRootBridgeIo.h
new file mode 100644 (file)
index 0000000..af3d9ed
--- /dev/null
@@ -0,0 +1,384 @@
+/** @file\r
+  PCI Root Bridge I/O protocol as defined in the EFI 1.1 specification.\r
+\r
+  PCI Root Bridge I/O protocol is used by PCI Bus Driver to perform PCI Memory, PCI I/O, \r
+  and PCI Configuration cycles on a PCI Root Bridge. It also provides services to perform \r
+  defferent types of bus mastering DMA\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  PciRootBridgeIo.h\r
+\r
+**/\r
+\r
+#ifndef __PCI_ROOT_BRIDGE_IO_H__\r
+#define __PCI_ROOT_BRIDGE_IO_H__\r
+\r
+#define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \\r
+  { \\r
+    0x2f707ebb, 0x4a1a, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL;\r
+\r
+typedef enum {\r
+  EfiPciWidthUint8,\r
+  EfiPciWidthUint16,\r
+  EfiPciWidthUint32,\r
+  EfiPciWidthUint64,\r
+  EfiPciWidthFifoUint8,\r
+  EfiPciWidthFifoUint16,\r
+  EfiPciWidthFifoUint32,\r
+  EfiPciWidthFifoUint64,\r
+  EfiPciWidthFillUint8,\r
+  EfiPciWidthFillUint16,\r
+  EfiPciWidthFillUint32,\r
+  EfiPciWidthFillUint64,\r
+  EfiPciWidthMaximum\r
+} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH;\r
+\r
+typedef enum {\r
+  EfiPciOperationBusMasterRead,\r
+  EfiPciOperationBusMasterWrite,\r
+  EfiPciOperationBusMasterCommonBuffer,\r
+  EfiPciOperationBusMasterRead64,\r
+  EfiPciOperationBusMasterWrite64,\r
+  EfiPciOperationBusMasterCommonBuffer64,\r
+  EfiPciOperationMaximum\r
+} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION;\r
+\r
+#define EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO          0x0001\r
+#define EFI_PCI_ATTRIBUTE_ISA_IO                      0x0002\r
+#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO              0x0004\r
+#define EFI_PCI_ATTRIBUTE_VGA_MEMORY                  0x0008\r
+#define EFI_PCI_ATTRIBUTE_VGA_IO                      0x0010\r
+#define EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO              0x0020\r
+#define EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO            0x0040\r
+#define EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE        0x0080\r
+#define EFI_PCI_ATTRIBUTE_MEMORY_CACHED               0x0800\r
+#define EFI_PCI_ATTRIBUTE_MEMORY_DISABLE              0x1000\r
+#define EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE          0x8000\r
+\r
+#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)\r
+\r
+#define EFI_PCI_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER (~EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER)\r
+\r
+#define EFI_PCI_ADDRESS(bus, dev, func, reg) \\r
+    ((UINT64) ((((UINTN) bus) << 24) + (((UINTN) dev) << 16) + (((UINTN) func) << 8) + ((UINTN) reg)))\r
+\r
+typedef struct {\r
+  UINT8   Register;\r
+  UINT8   Function;\r
+  UINT8   Device;\r
+  UINT8   Bus;\r
+  UINT32  ExtendedRegister;\r
+} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS;\r
+\r
+/**                                                                 \r
+  Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is\r
+  satisfied or after a defined duration.\r
+          \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Width                 Signifies the width of the memory or I/O operations.\r
+  @param  Address               The base address of the memory or I/O operations.  \r
+  @param  Mask                  Mask used for the polling criteria.\r
+  @param  Value                 The comparison value used for the polling exit criteria.\r
+  @param  Delay                 The number of 100 ns units to poll.\r
+  @param  Result                Pointer to the last value read from the memory location.\r
+                                \r
+  @retval EFI_SUCCESS           The last data returned from the access matched the poll exit criteria.\r
+  @retval EFI_TIMEOUT           Delay expired before a match occurred.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL           *This,\r
+  IN  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH    Width,\r
+  IN  UINT64                                   Address,\r
+  IN  UINT64                                   Mask,\r
+  IN  UINT64                                   Value,\r
+  IN  UINT64                                   Delay,\r
+  OUT UINT64                                   *Result\r
+  );\r
+\r
+/**                                                                 \r
+  Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.\r
+          \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Width                 Signifies the width of the memory operations.\r
+  @param  Address               The base address of the memory operations.                                  \r
+  @param  Count                 The number of memory operations to perform.\r
+  @param  Buffer                For read operations, the destination buffer to store the results. For write\r
+                                operations, the source buffer to write data from.                          \r
+  \r
+  @retval EFI_SUCCESS           The data was read from or written to the PCI root bridge.  \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              *This,\r
+  IN     EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH    Width,\r
+  IN     UINT64                                   Address,\r
+  IN     UINTN                                    Count,\r
+  IN OUT VOID                                     *Buffer\r
+  );\r
+\r
+typedef struct {\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM  Read;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM  Write;\r
+} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS;\r
+\r
+/**                                                                 \r
+  Enables a PCI driver to copy one region of PCI root bridge memory space to another region of PCI\r
+  root bridge memory space.                                                                       \r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.\r
+  @param  Width                 Signifies the width of the memory operations.\r
+  @param  DestAddress           The destination address of the memory operation.                                \r
+  @param  SrcAddress            The source address of the memory operation.                                \r
+  @param  Count                 The number of memory operations to perform.    \r
+                                \r
+  @retval EFI_SUCCESS           The data was copied from one memory region to another memory region.  \r
+  @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              *This,\r
+  IN     EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH    Width,\r
+  IN     UINT64                                   DestAddress,\r
+  IN     UINT64                                   SrcAddress,\r
+  IN     UINTN                                    Count\r
+  );\r
+\r
+/**                                                                 \r
+  Provides the PCI controller-Cspecific addresses required to access system memory from a\r
+  DMA bus master.                                                                        \r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Operation             Indicates if the bus master is going to read or write to system memory.\r
+  @param  HostAddress           The system memory address to map to the PCI controller.\r
+  @param  NumberOfBytes         On input the number of bytes to map. On output the number of bytes\r
+                                that were mapped.                                                 \r
+  @param  DeviceAddress         The resulting map address for the bus master PCI controller to use to\r
+                                access the hosts HostAddress.                                        \r
+  @param  Mapping               A resulting value to pass to Unmap().\r
+                                  \r
+  @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.\r
+  @retval EFI_UNSUPPORTED       The HostAddress cannot be mapped as a common buffer.                                \r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL                *This,\r
+  IN     EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION  Operation,\r
+  IN     VOID                                       *HostAddress,\r
+  IN OUT UINTN                                      *NumberOfBytes,\r
+  OUT    EFI_PHYSICAL_ADDRESS                       *DeviceAddress,\r
+  OUT    VOID                                       **Mapping\r
+  );\r
+\r
+/**                                                                 \r
+  Completes the Map() operation and releases any corresponding resources.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Mapping               The mapping value returned from Map().\r
+                                  \r
+  @retval EFI_SUCCESS           The range was unmapped.\r
+  @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().\r
+  @retval EFI_DEVICE_ERROR      The data was not committed to the target system memory.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL           *This,\r
+  IN  VOID                                     *Mapping\r
+  );\r
+\r
+/**                                                                 \r
+  Allocates pages that are suitable for an EfiPciOperationBusMasterCommonBuffer or\r
+  EfiPciOperationBusMasterCommonBuffer64 mapping.                                 \r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Type                  This parameter is not used and must be ignored.\r
+  @param  MemoryType            The type of memory to allocate, EfiBootServicesData or\r
+                                EfiRuntimeServicesData.                               \r
+  @param  Pages                 The number of pages to allocate.                                \r
+  @param  HostAddress           A pointer to store the base system memory address of the\r
+                                allocated range.                                        \r
+  @param  Attributes            The requested bit mask of attributes for the allocated range.\r
+                                  \r
+  @retval EFI_SUCCESS           The requested memory pages were allocated.\r
+  @retval EFI_UNSUPPORTED       Attributes is unsupported. The only legal attribute bits are\r
+                                MEMORY_WRITE_COMBINE and MEMORY_CACHED.                     \r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.  \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              *This,\r
+  IN     EFI_ALLOCATE_TYPE                        Type,\r
+  IN     EFI_MEMORY_TYPE                          MemoryType,\r
+  IN     UINTN                                    Pages,\r
+  IN OUT VOID                                     **HostAddress,\r
+  IN     UINT64                                   Attributes\r
+  );\r
+\r
+/**                                                                 \r
+  Frees memory that was allocated with AllocateBuffer().\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Pages                 The number of pages to free.                                \r
+  @param  HostAddress           The base system memory address of the allocated range.                                    \r
+                                  \r
+  @retval EFI_SUCCESS           The requested memory pages were freed.\r
+  @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages\r
+                                was not allocated with AllocateBuffer().\r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL           *This,\r
+  IN  UINTN                                    Pages,\r
+  IN  VOID                                     *HostAddress\r
+  );\r
+\r
+/**                                                                 \r
+  Flushes all PCI posted write transactions from a PCI host bridge to system memory.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+                                  \r
+  @retval EFI_SUCCESS           The PCI posted write transactions were flushed from the PCI host\r
+                                bridge to system memory.                                        \r
+  @retval EFI_DEVICE_ERROR      The PCI posted write transactions were not flushed from the PCI\r
+                                host bridge due to a hardware error.                           \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  *This\r
+  );\r
+\r
+/**                                                                 \r
+  Gets the attributes that a PCI root bridge supports setting with SetAttributes(), and the\r
+  attributes that a PCI root bridge is currently using.                                    \r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Supports              A pointer to the mask of attributes that this PCI root bridge supports\r
+                                setting with SetAttributes().                                         \r
+  @param  Attributes            A pointer to the mask of attributes that this PCI root bridge is currently\r
+                                using.                                                                      \r
+                                \r
+  @retval EFI_SUCCESS           If Supports is not NULL, then the attributes that the PCI root     \r
+                                bridge supports is returned in Supports. If Attributes is          \r
+                                not NULL, then the attributes that the PCI root bridge is currently\r
+                                using is returned in Attributes.                                   \r
+  @retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.\r
+                                \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL           *This,\r
+  OUT UINT64                                   *Supports,\r
+  OUT UINT64                                   *Attributes\r
+  );\r
+\r
+/**                                                                 \r
+  Sets attributes for a resource range on a PCI root bridge.\r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Attributes            The mask of attributes to set.\r
+  @param  ResourceBase          A pointer to the base address of the resource range to be modified by the\r
+                                attributes specified by Attributes.\r
+  @param  ResourceLength        A pointer to the length of the resource range to be modified by the\r
+                                attributes specified by Attributes.                                                                                                              \r
+                                \r
+  @retval EFI_SUCCESS           The set of attributes specified by Attributes for the resource   \r
+                                range specified by ResourceBase and ResourceLength               \r
+                                were set on the PCI root bridge, and the actual resource range is\r
+                                returned in ResuourceBase and ResourceLength.                    \r
+  @retval EFI_UNSUPPORTED       A bit is set in Attributes that is not supported by the PCI Root\r
+                                Bridge.                                                         \r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to set the attributes on the                              \r
+                                resource range specified by BaseAddress and Length.        \r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                               \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES) (\r
+  IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL              *This,\r
+  IN     UINT64                                   Attributes,\r
+  IN OUT UINT64                                   *ResourceBase,\r
+  IN OUT UINT64                                   *ResourceLength\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the current resource settings of this PCI root bridge in the form of a set of ACPI 2.0\r
+  resource descriptors.                                                                           \r
+            \r
+  @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  @param  Resources             A pointer to the ACPI 2.0 resource descriptors that describe the current\r
+                                configuration of this PCI root bridge.                                  \r
+                                \r
+  @retval EFI_SUCCESS           The current configuration of this PCI root bridge was returned in\r
+                                Resources.                                                                                                                       \r
+  @retval EFI_UNSUPPORTED       The current configuration of this PCI root bridge could not be\r
+                                retrieved.                                                                          \r
+                                       \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION) (\r
+  IN  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL          *This,\r
+  OUT VOID                                     **Resources\r
+  );\r
+\r
+struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL {\r
+  EFI_HANDLE                                      ParentHandle;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM     PollMem;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM     PollIo;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS          Mem;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS          Io;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS          Pci;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM        CopyMem;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP             Map;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP           Unmap;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER     FreeBuffer;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH           Flush;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES  GetAttributes;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES  SetAttributes;\r
+  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION   Configuration;\r
+  UINT32                                          SegmentNumber;\r
+};\r
+\r
+extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/PlatformDriverOverride.h b/MdePkg/Include/Protocol/PlatformDriverOverride.h
new file mode 100644 (file)
index 0000000..1015c50
--- /dev/null
@@ -0,0 +1,135 @@
+/** @file\r
+  Platform Driver Override protocol as defined in the EFI 1.1 specification.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  PlatformDriverOverride.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_H__\r
+#define __EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_H__\r
+\r
+//\r
+// Global ID for the Platform Driver Override Protocol\r
+//\r
+#define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID \\r
+  { \\r
+    0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL  EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL;\r
+\r
+//\r
+// Prototypes for the Platform Driver Override Protocol\r
+//\r
+\r
+/**                                                                 \r
+  Retrieves the image handle of the platform override driver for a controller in the system.\r
+    \r
+  @param  This                  A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_\r
+                                PROTOCOL instance.                            \r
+  @param  ControllerHandle      The device handle of the controller to check if a driver override\r
+                                exists.                                                          \r
+  @param  DriverImageHandle     On input, a pointer to the previous driver image handle returned\r
+                                by GetDriver(). On output, a pointer to the next driver         \r
+                                image handle.                                                   \r
+                                \r
+  @retval EFI_SUCCESS           The driver override for ControllerHandle was returned in\r
+                                DriverImageHandle.                                      \r
+  @retval EFI_NOT_FOUND         A driver override for ControllerHandle was not found.\r
+  @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not a valid handle.\r
+  @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a\r
+                                previous call to GetDriver().                           \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER) (\r
+  IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL              *This,\r
+  IN     EFI_HANDLE                                     ControllerHandle,\r
+  IN OUT EFI_HANDLE                                     *DriverImageHandle\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the device path of the platform override driver for a controller in the system.\r
+    \r
+  @param  This                  A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_\r
+                                PROTOCOL instance.                            \r
+  @param  ControllerHandle      The device handle of the controller to check if a driver override\r
+                                exists.                                                          \r
+  @param  DriverImageHandle     On input, a pointer to the previous driver image handle returned\r
+                                by GetDriverPath(). On output, a pointer to the next driver         \r
+                                device path.\r
+                                \r
+  @retval EFI_SUCCESS           The driver override for ControllerHandle was returned in\r
+                                DriverImageHandle.                                      \r
+  @retval EFI_UNSUPPORTED       The operation is not supported.                                \r
+  @retval EFI_NOT_FOUND         A driver override for ControllerHandle was not found.\r
+  @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not a valid handle.\r
+  @retval EFI_INVALID_PARAMETER DriverImagePath is not a device path that was returned on a\r
+                                previous call to GetDriverPath().                          \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH) (\r
+  IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL              *This,\r
+  IN     EFI_HANDLE                                     ControllerHandle,\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL                       **DriverImagePath\r
+  );\r
+\r
+/**                                                                 \r
+  Used to associate a driver image handle with a device path that was returned on a prior call to the\r
+  GetDriverPath() service. This driver image handle will then be available through the               \r
+  GetDriver() service.                                                                               \r
+    \r
+  @param  This                  A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_\r
+                                PROTOCOL instance.                            \r
+  @param  ControllerHandle      The device handle of the controller.                                                             \r
+  @param  DriverImagePath       A pointer to the driver device path that was returned in a prior\r
+                                call to GetDriverPath().                                                                        \r
+  @param  DriverImageHandle     The driver image handle that was returned by LoadImage()\r
+                                when the driver specified by DriverImagePath was loaded \r
+                                into memory.                                            \r
+                                \r
+  @retval EFI_SUCCESS           The association between DriverImagePath and                   \r
+                                DriverImageHandle was established for the controller specified\r
+                                by ControllerHandle.                                                                            \r
+  @retval EFI_UNSUPPORTED       The operation is not supported.                                \r
+  @retval EFI_NOT_FOUND         DriverImagePath is not a device path that was returned on a prior\r
+                                call to GetDriverPath() for the controller specified by          \r
+                                ControllerHandle.                                                \r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid device handle.\r
+  @retval EFI_INVALID_PARAMETER DriverImagePath is not a valid device path.\r
+  @retval EFI_INVALID_PARAMETER DriverImageHandle is not a valid image handle.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED) (\r
+  IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL          *This,\r
+  IN EFI_HANDLE                                     ControllerHandle,\r
+  IN EFI_DEVICE_PATH_PROTOCOL                       *DriverImagePath,\r
+  IN EFI_HANDLE                                     DriverImageHandle\r
+  );\r
+\r
+//\r
+// Interface structure for the Platform Driver Override Protocol\r
+//\r
+struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL {\r
+  EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER       GetDriver;\r
+  EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH  GetDriverPath;\r
+  EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED    DriverLoaded;\r
+};\r
+\r
+extern EFI_GUID gEfiPlatformDriverOverrideProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h b/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
new file mode 100644 (file)
index 0000000..078946e
--- /dev/null
@@ -0,0 +1,397 @@
+/** @file\r
+  The file provides the protocol to retrieve configuration\r
+  information for a device that a UEFI driver is about to start.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  PlatformToDriverConfiguration.h\r
+\r
+**/\r
+\r
+#ifndef __PLATFORM_TO_DRIVER_CONFIGUARTION_H__\r
+#define __PLATFORM_TO_DRIVER_CONFIGUARTION_H__\r
+\r
+#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL_GUID  \\r
+  { 0x642cd590, 0x8059, 0x4c0a, { 0xa9, 0x58, 0xc5, 0xec, 0x7, 0xd2, 0x3c, 0x4b } }\r
+\r
+\r
+typedef struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL;\r
+\r
+\r
+/**\r
+  The UEFI driver must call Query early in the Start() function\r
+  before any time consuming operations are performed. If\r
+  ChildHandle is NULL the driver is requesting information from\r
+  the platform about the ControllerHandle that is being started.\r
+  Information returned from Query may lead to the drivers Start()\r
+  function failing. If the UEFI driver is a bus driver and\r
+  producing a ChildHandle the driver must call Query after the\r
+  child handle has been created and an EFI_DEVICE_PATH_PROTOCOL\r
+  has been placed on that handle, but before any time consuming\r
+  operation is performed. If information return by Query may lead\r
+  the driver to decide to not create the ChildHandle. The driver\r
+  must then cleanup and remove the ChildHandle from the system.\r
+  The UEFI driver repeatedly calls Query, processes the\r
+  information returned by the platform, and calls Response passing\r
+  in the arguments returned from Query. The Instance value passed\r
+  into Response must be the same value returned from the\r
+  corresponding call to Query. The UEFI driver must continuously\r
+  call Query and Response until EFI_NOT_FOUND is returned by\r
+  Query. The only value of Instance that has meaning to the UEFI\r
+  driver is zero. An Instance value of zero means return the first\r
+  ParameterBlock in the set of unprocessed parameter blocks. If a\r
+  ParameterBlock has been processed via a Query and corresponding\r
+  Response call it must not be returned again via a Query call.\r
+\r
+  @param This   A pointer to the\r
+                EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL\r
+                instance.\r
+  \r
+  @param ControllerHandle   The handle the platform will return\r
+                            configuration information about.\r
+  \r
+  @param ChildHandle  The handle of the child controller to\r
+                      return information on. This is an optional\r
+                      parameter that may be NULL. It will be\r
+                      NULL for device drivers, and for bus\r
+                      drivers that attempt to get options for\r
+                      the bus controller. It will not be NULL\r
+                      for a bus driver that attempts to get\r
+                      options for one of its child controllers.\r
+  \r
+  \r
+  @param Instance   Pointer to the Instance value. On output the\r
+                    instance associated with the parameter data\r
+                    return. On input zero means return the first\r
+                    query data or pass in a valid instance\r
+                    number returned from a previous call to\r
+                    Query.\r
+\r
+  @param ParameterTypeGuid  An EFI_GUID that defines the\r
+                            contents of ParameterBlock. UEFI\r
+                            drivers must use the\r
+                            ParameterTypeGuid to determine how\r
+                            to parser the ParameterBlock.\r
+\r
+  @param ParameterBlock   The platform returns a pointer to the\r
+                          ParameterBlock structure which\r
+                          contains details about the\r
+                          configuration parameters specific to\r
+                          the ParameterTypeGuid. This structure\r
+                          is defined based on the protocol and\r
+                          may be different for different\r
+                          protocols. UEFI driver decodes this\r
+                          structure and its contents based on\r
+                          ProtocolGuid. ParameterBlock is\r
+                          allocated by the platform and the\r
+                          platform is responsible for freeing\r
+                          the ParameterBlock after Result is\r
+                          called.\r
+\r
+  @param ParameterBlockSize   The platform returns the size of\r
+                              the ParameterBlock in bytes.\r
+\r
+\r
+  @retval EFI_SUCCESS   The platform return parameter\r
+                        information for ControllerHandle.\r
+\r
+  @retval EFI_NOT_FOUND No more unread Instance exists.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Instance is NULL.\r
+\r
+  @retval EFI_DEVICE_ERROR  A device error occurred while\r
+                            attempting to return parameter block\r
+                            information for the controller\r
+                            specified by ControllerHandle and\r
+                            ChildHandle.\r
+\r
+  @retval EFI_OUT_RESOURCES There are not enough resources\r
+                            available to set the configuration\r
+                            options for the controller specified\r
+                            by ControllerHandle and ChildHandle.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY) (\r
+  IN CONST  EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,\r
+  IN CONST  EFI_HANDLE  ControllerHandle,\r
+  IN CONST  EFI_HANDLE  ChildHandle OPTIONAL,\r
+  IN OUT    UINTN       *Instance,\r
+  IN OUT    EFI_GUID    **ParameterTypeGuid,\r
+  IN OUT    VOID        **ParameterBlock,\r
+  IN OUT    UINTN       *ParameterBlockSize\r
+);\r
+\r
+/**\r
+\r
+  @param EfiPlatformConfigurationActionNone\r
+          The controller specified by ControllerHandle is still\r
+          in a usable state, it's configuration has been updated\r
+          via parsing the ParameterBlock. If required by the\r
+          parameter block and the module supports an NVRAM store\r
+          the configuration information from PB was successfully\r
+          saved to the NVRAM. No actions are required before\r
+          this controller can be used again with the updated\r
+          configuration settings.\r
+\r
+\r
+  @param EfiPlatformConfigurationStopController \r
+          The driver has detected that the controller specified\r
+          by ControllerHandle  is not in a usable state, and it\r
+          needs to be stopped. The calling agent can use the\r
+          DisconnectControservice to perform this operation, and\r
+          it should be performed as soon as possible.\r
+\r
+  @param EfiPlatformConfigurationRestartController\r
+          This controller specified by ControllerHandle needs to\r
+          be stopped and restarted before it can be used again.\r
+          The calling agent can use the DisconnectController()\r
+          and ConnectController() services to perform this\r
+          operation. The restart operation can be delayed  until\r
+          all of the configuratiooptions have been set.\r
+\r
+\r
+  @param EfiPlatformConfigurationRestartPlatform\r
+          A configuration change has been made that requires the\r
+          platform to be restarted before the controller\r
+          specified by ControllerHandle can be used again. The\r
+          calling agent can use the ResetSystem() services to\r
+          perform this operation. The restart operation can be\r
+          delayed until all of the configuration options have\r
+          been set.\r
+\r
+  @param EfiPlatformConfigurationActionNvramFailed \r
+          The controller specified by ControllerHandle is still\r
+          in a usable state; its configuration has been updated\r
+          via parsing the ParameterBlock. The driver tried to\r
+          update the driver's private NVRAM store with\r
+          information from ParameterBlock and failed. No actions\r
+          are required before this controller can be used again\r
+          with the updated configuration settings, but these\r
+          configuration settings are not guaranteed to persist\r
+          after ControllerHandle is stopped.\r
+\r
+**/\r
+typedef enum {\r
+  EfiPlatformConfigurationActionNone              = 0,\r
+  EfiPlatformConfigurationActionStopController    = 1,\r
+  EfiPlatformConfigurationActionRestartController = 2,\r
+  EfiPlatformConfigurationActionRestartPlatform   = 3,\r
+  EfiPlatformConfigurationActionNvramFailed       = 4,\r
+  EfiPlatformConfigurationActionMaximum\r
+} EFI_PLATFORM_CONFIGURATION_ACTION;\r
+\r
+\r
+/**\r
+  The UEFI driver repeatedly calls Query, processes the\r
+  information returned by the platform, and calls Response passing\r
+  in the arguments returned from Query. The UEFI driver must\r
+  continuously call Query until EFI_NOT_FOUND is returned. For\r
+  every call to Query that returns EFI_SUCCESS a corrisponding\r
+  call to Response is required passing in the same\r
+  ContollerHandle, ChildHandle, Instance, ParameterTypeGuid,\r
+  ParameterBlock, and ParameterBlockSize. The UEFI driver may\r
+  update values in ParameterBlock based on rules defined by\r
+  ParameterTypeGuid. The platform is responsible for freeing\r
+  ParameterBlock and the UEFI driver must not try to free it\r
+\r
+  @param This   A pointer to the\r
+                EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL\r
+                instance.\r
+\r
+  @param ControllerHandle The handle the driver is returning\r
+                          configuration information about.\r
+\r
+  @param ChildHandle  The handle of the child controller to\r
+                      return information on. This is an optional\r
+                      parameter that may be NULL. It will be\r
+                      NULL for device drivers, and for bus\r
+                      drivers that attempt to get options for\r
+                      the bus controller. It will not be NULL\r
+                      for a bus driver that attempts to get\r
+                      options for one of its child controllers.\r
+                      Instance Instance data returned from\r
+                      Query().\r
+\r
+  @param ParameterTypeGuid ParameterTypeGuid returned from\r
+                           Query.\r
+\r
+  @param ParameterBlock ParameterBlock returned from Query.\r
+\r
+  @param ParameterBlockSize The ParameterBlock size returned\r
+                            from Query.\r
+\r
+  @param Configuration  ActionThe driver tells the platform what\r
+                        action is required for ParameterBlock to\r
+                        take effect.\r
+  \r
+  \r
+  @retval EFI_SUCCESS The platform return parameter information\r
+                      for ControllerHandle.\r
+  \r
+  @retval EFI_NOT_FOUND Instance was not found.\r
+  \r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid\r
+                                EFI_HANDLE.\r
+  \r
+  @retval EFI_INVALID_PARAMETER Instance is zero.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE) (\r
+  IN CONST  EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,\r
+  IN CONST  EFI_HANDLE  ControllerHandle,\r
+  IN CONST  EFI_HANDLE  ChildHandle OPTIONAL,\r
+  IN CONST  UINTN       *Instance,\r
+  IN CONST  EFI_GUID    *ParameterTypeGuid,\r
+  IN CONST  VOID        *ParameterBlock,\r
+  IN CONST  UINTN       ParameterBlockSize ,\r
+  IN CONST  EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction\r
+);\r
+\r
+\r
+/**\r
+  The EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is used by the\r
+  UEFI driver to query the platform for configuration information.\r
+  The UEFI driver calls Query() multiple times to get\r
+  configuration information from the platform. For every call to\r
+  Query() there must be a matching call to Response() so the\r
+  UEFI driver can inform the platform how it used the\r
+  information passed in from Query(). It¡¯s legal for a UEFI\r
+  driver to use Response() to inform the platform it does not\r
+  understand the data returned via Query() and thus no action was\r
+  taken.\r
+\r
+  @param  Query   Called by the UEFI Driver Start() function to\r
+                  get configuration information from the\r
+                  platform.\r
+  \r
+  @param  Response  Called by the UEFI Driver Start() function\r
+                    to let the platform know how UEFI driver\r
+                    processed the data return from Query.\r
+  \r
+\r
+**/\r
+struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL {\r
+  EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY    Query;\r
+  EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE Response;\r
+};\r
+\r
+\r
+\r
+#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_CLP_GUID   \\r
+  {0x345ecc0e, 0xcb6, 0x4b75, { 0xbb, 0x57, 0x1b, 0x12, 0x9c, 0x47, 0x33,0x3e } }\r
+\r
+/**\r
+   \r
+  ParameterTypeGuid provides the support for parameters\r
+  communicated through the DMTF SM CLP Specification 1.0 Final\r
+  Standard to be used to configure the UEFI driver. In this\r
+  section the producer of the\r
+  EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is platform\r
+  firmware and the consumer is the UEFI driver. Note: if future\r
+  versions of the DMTF SM CLP Specification require changes to the\r
+  parameter block definition, newer ParameterTypeGuid will be\r
+  used.\r
+\r
+  @param CLPCommand   A pointer to the DMTF SM CLP command line\r
+                      null-terminated string that the driver is\r
+                      required to parse and process when this\r
+                      EFI_SUCCESS The platform return parameter\r
+                      information for ControllerHandle.\r
+                      EFI_NOT_FOUND Instance was not found.\r
+                      EFI_INVALID_PARAMETER ControllerHandle is\r
+                      not a valid EFI_HANDLE.\r
+                      EFI_INVALID_PARAMETER Instance is zero.\r
+                      function is called. See the DMTF SM CLP\r
+                      Specification 1.0 Final Standard for\r
+                      details on the format and syntax of the\r
+                      CLP command line string. CLPCommand buffer\r
+                      is allocated by the producer of the\r
+                      EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOOL.\r
+\r
+  @param CLPCommandLength   The length of the CLP Command in\r
+                            bytes.\r
+\r
+  @param CLPReturnString  A pointer to the CLP return status\r
+                          string that the driver is required to\r
+                          provide to the calling agent. The\r
+                          calling agent may parse and/ or pass\r
+                          this for processing and user feedback.\r
+                          The SM CLP Command Response string\r
+                          buffer is filled in by the UEFI driver\r
+                          in the "keyword=value" format\r
+                          described in the SM CLP Specification,\r
+                          unless otherwise requested via the SM\r
+                          CLP Coutput option in the Command Line\r
+                          string buffer. UEFI driver's support\r
+                          for this default "keyword=value"\r
+                          output format is required if the UEFI\r
+                          driver supports this protocol, while\r
+                          support for other SM CLP output\r
+                          formats is optional (the UEFI Driver\r
+                          should return an EFI_UNSUPPORTED if\r
+                          the SM CLP Coutput option requested by\r
+                          the caller is not supported by the\r
+                          UEFI Driver). CLPReturnString buffer\r
+                          is allocated by the consumer of the\r
+                          EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC\r
+                          OL and undefined prior to the call to\r
+                          Response().\r
+\r
+  @param CLPReturnStringLength  The length of the CLP return\r
+                                status string in bytes.\r
+\r
+  @param CLPReturnStatus  SM CLP Command Status (see DMTF SM CLP\r
+                          Specification 1.0 Final Standard -\r
+                          Table 4) CLPErrorValue SM CLP\r
+                          Processing Error Value (see DMTF SM\r
+                          CLP Specification 1.0 Final Standard -\r
+                          Table 6). This field is filled in by\r
+                          the consumer of the\r
+                          EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC \r
+                          OL and undefined prior to the call to\r
+                          Response().\r
+\r
+  @param CLPMessageCode   Bit 15: OEM Message Code Flag 0 =\r
+                          Message Code is an SM CLP Probable\r
+                          Cause Value. (see SM CLP Specification\r
+                          Table 11) 1 = Message Code is OEM\r
+                          Specific Bits 14-0: Message Code This\r
+                          field is filled in by the consumer of\r
+                          the\r
+                          EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC\r
+                          OL and undefined prior to the call to\r
+                          Response().\r
+\r
+**/\r
+typedef struct {\r
+  CHAR8   *CLPCommand;\r
+  UINT32  CLPCommandLength;\r
+  CHAR8   *CLPReturnString;\r
+  UINT32  CLPReturnStringLength;\r
+  UINT8   CLPCmdStatus;\r
+  UINT8   CLPErrorValue;\r
+  UINT16  CLPMsgCode;\r
+} EFI_CONFIGURE_CLP_PARAMETER_BLK;\r
+\r
+\r
+\r
+extern EFI_GUID gEfiPlatformToDriverConfigurationClpGuid;\r
+\r
+extern EFI_GUID gEfiPlatformToDriverConfigurationProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/PxeBaseCode.h b/MdePkg/Include/Protocol/PxeBaseCode.h
new file mode 100644 (file)
index 0000000..7fb2a80
--- /dev/null
@@ -0,0 +1,622 @@
+/** @file\r
+  EFI PXE Base Code Protocol definitions.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  PxeBaseCode.h\r
+\r
+**/\r
+#ifndef __PXE_BASE_CODE_PROTOCOL_H__\r
+#define __PXE_BASE_CODE_PROTOCOL_H__\r
+\r
+//\r
+// PXE Base Code protocol\r
+//\r
+#define EFI_PXE_BASE_CODE_PROTOCOL_GUID \\r
+  { \\r
+    0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE_PROTOCOL;\r
+\r
+//\r
+// Default IP TTL and ToS.\r
+//\r
+#define DEFAULT_TTL 16\r
+#define DEFAULT_ToS 0\r
+\r
+//\r
+// ICMP error format\r
+//\r
+typedef struct {\r
+  UINT8   Type;\r
+  UINT8   Code;\r
+  UINT16  Checksum;\r
+  union {\r
+    UINT32  reserved;\r
+    UINT32  Mtu;\r
+    UINT32  Pointer;\r
+    struct {\r
+      UINT16  Identifier;\r
+      UINT16  Sequence;\r
+    } Echo;\r
+  } u;\r
+  UINT8 Data[494];\r
+} EFI_PXE_BASE_CODE_ICMP_ERROR;\r
+\r
+//\r
+// TFTP error format\r
+//\r
+typedef struct {\r
+  UINT8 ErrorCode;\r
+  CHAR8 ErrorString[127];\r
+} EFI_PXE_BASE_CODE_TFTP_ERROR;\r
+\r
+//\r
+// IP Receive Filter definitions\r
+//\r
+#define EFI_PXE_BASE_CODE_MAX_IPCNT 8\r
+\r
+typedef struct {\r
+  UINT8           Filters;\r
+  UINT8           IpCnt;\r
+  UINT16          reserved;\r
+  EFI_IP_ADDRESS  IpList[EFI_PXE_BASE_CODE_MAX_IPCNT];\r
+} EFI_PXE_BASE_CODE_IP_FILTER;\r
+\r
+#define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP            0x0001\r
+#define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST             0x0002\r
+#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS           0x0004\r
+#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008\r
+\r
+//\r
+// ARP Cache definitions\r
+//\r
+typedef struct {\r
+  EFI_IP_ADDRESS  IpAddr;\r
+  EFI_MAC_ADDRESS MacAddr;\r
+} EFI_PXE_BASE_CODE_ARP_ENTRY;\r
+\r
+typedef struct {\r
+  EFI_IP_ADDRESS  IpAddr;\r
+  EFI_IP_ADDRESS  SubnetMask;\r
+  EFI_IP_ADDRESS  GwAddr;\r
+} EFI_PXE_BASE_CODE_ROUTE_ENTRY;\r
+\r
+//\r
+// UDP definitions\r
+//\r
+typedef UINT16  EFI_PXE_BASE_CODE_UDP_PORT;\r
+\r
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP    0x0001\r
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT  0x0002\r
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP   0x0004\r
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008\r
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER    0x0010\r
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT  0x0020\r
+\r
+//\r
+// Discover() definitions\r
+//\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP         0\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS      1\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM         2\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI           3\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO        4\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD          5\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM          6\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG  7\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW       8\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9         9\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10        10\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11        11\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12       12\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL    13\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT       14\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO             15\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT           16\r
+//\r
+// 17 through 32767 are reserved\r
+// 32768 through 65279 are for vendor use\r
+// 65280 through 65534 are reserved\r
+//\r
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST   65535\r
+\r
+#define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK     0x7FFF\r
+#define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL  0x0000\r
+\r
+//\r
+// Discover() server list structure.\r
+//\r
+typedef struct {\r
+  UINT16          Type;\r
+  BOOLEAN         AcceptAnyResponse;\r
+  UINT8           Reserved;\r
+  EFI_IP_ADDRESS  IpAddr;\r
+} EFI_PXE_BASE_CODE_SRVLIST;\r
+\r
+//\r
+// Discover() information override structure.\r
+//\r
+typedef struct {\r
+  BOOLEAN                   UseMCast;\r
+  BOOLEAN                   UseBCast;\r
+  BOOLEAN                   UseUCast;\r
+  BOOLEAN                   MustUseList;\r
+  EFI_IP_ADDRESS            ServerMCastIp;\r
+  UINT16                    IpCnt;\r
+  EFI_PXE_BASE_CODE_SRVLIST SrvList[1];\r
+} EFI_PXE_BASE_CODE_DISCOVER_INFO;\r
+\r
+//\r
+// Mtftp() definitions\r
+//\r
+typedef enum {\r
+  EFI_PXE_BASE_CODE_TFTP_FIRST,\r
+  EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,\r
+  EFI_PXE_BASE_CODE_TFTP_READ_FILE,\r
+  EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,\r
+  EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY,\r
+  EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE,\r
+  EFI_PXE_BASE_CODE_MTFTP_READ_FILE,\r
+  EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY,\r
+  EFI_PXE_BASE_CODE_MTFTP_LAST\r
+} EFI_PXE_BASE_CODE_TFTP_OPCODE;\r
+\r
+typedef struct {\r
+  EFI_IP_ADDRESS              MCastIp;\r
+  EFI_PXE_BASE_CODE_UDP_PORT  CPort;\r
+  EFI_PXE_BASE_CODE_UDP_PORT  SPort;\r
+  UINT16                      ListenTimeout;\r
+  UINT16                      TransmitTimeout;\r
+} EFI_PXE_BASE_CODE_MTFTP_INFO;\r
+\r
+//\r
+// PXE Base Code Mode structure\r
+//\r
+#define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES   8\r
+#define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8\r
+\r
+typedef struct {\r
+  BOOLEAN                       Started;\r
+  BOOLEAN                       Ipv6Available;\r
+  BOOLEAN                       Ipv6Supported;\r
+  BOOLEAN                       UsingIpv6;\r
+  BOOLEAN                       BisSupported;\r
+  BOOLEAN                       BisDetected;\r
+  BOOLEAN                       AutoArp;\r
+  BOOLEAN                       SendGUID;\r
+  BOOLEAN                       DhcpDiscoverValid;\r
+  BOOLEAN                       DhcpAckReceived;\r
+  BOOLEAN                       ProxyOfferReceived;\r
+  BOOLEAN                       PxeDiscoverValid;\r
+  BOOLEAN                       PxeReplyReceived;\r
+  BOOLEAN                       PxeBisReplyReceived;\r
+  BOOLEAN                       IcmpErrorReceived;\r
+  BOOLEAN                       TftpErrorReceived;\r
+  BOOLEAN                       MakeCallbacks;\r
+  UINT8                         TTL;\r
+  UINT8                         ToS;\r
+  EFI_IP_ADDRESS                StationIp;\r
+  EFI_IP_ADDRESS                SubnetMask;\r
+  EFI_PXE_BASE_CODE_PACKET      DhcpDiscover;\r
+  EFI_PXE_BASE_CODE_PACKET      DhcpAck;\r
+  EFI_PXE_BASE_CODE_PACKET      ProxyOffer;\r
+  EFI_PXE_BASE_CODE_PACKET      PxeDiscover;\r
+  EFI_PXE_BASE_CODE_PACKET      PxeReply;\r
+  EFI_PXE_BASE_CODE_PACKET      PxeBisReply;\r
+  EFI_PXE_BASE_CODE_IP_FILTER   IpFilter;\r
+  UINT32                        ArpCacheEntries;\r
+  EFI_PXE_BASE_CODE_ARP_ENTRY   ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];\r
+  UINT32                        RouteTableEntries;\r
+  EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];\r
+  EFI_PXE_BASE_CODE_ICMP_ERROR  IcmpError;\r
+  EFI_PXE_BASE_CODE_TFTP_ERROR  TftpError;\r
+} EFI_PXE_BASE_CODE_MODE;\r
+\r
+//\r
+// PXE Base Code Interface Function definitions\r
+//\r
+\r
+/**                                                                 \r
+  Enables the use of the PXE Base Code Protocol functions.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  UseIpv6               Specifies the type of IP addresses that are to be used during the session\r
+                                that is being started. Set to TRUE for IPv6 addresses, and FALSE for     \r
+                                IPv4 addresses.                                                                                                   \r
+                                \r
+  @retval EFI_SUCCESS           The PXE Base Code Protocol was started.\r
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this oper  \r
+  @retval EFI_UNSUPPORTED       UseIpv6 is TRUE, but the Ipv6Supported field of the\r
+                                EFI_PXE_BASE_CODE_MODE structure is FALSE.  \r
+  @retval EFI_ALREADY_STARTED   The PXE Base Code Protocol is already in the started state.                                   \r
+  @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid\r
+                                EFI_PXE_BASE_CODE_PROTOCOL structure.      \r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough memory or other resources to start the                                          \r
+                                PXE Base Code Protocol.                                         \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_START) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,\r
+  IN BOOLEAN                               UseIpv6\r
+  );\r
+\r
+/**                                                                 \r
+  Disables the use of the PXE Base Code Protocol functions.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
\r
+  @retval EFI_SUCCESS           The PXE Base Code Protocol was stopped.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is already in the stopped state.  \r
+  @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid\r
+                                EFI_PXE_BASE_CODE_PROTOCOL structure.                  \r
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.                                \r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_STOP) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL    *This\r
+  );\r
+\r
+/**                                                                 \r
+  Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request / acknowledge) or DHCPv6\r
+  S.A.R.R (solicit / advertise / request / reply) sequence.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  SortOffers            TRUE if the offers received should be sorted. Set to FALSE to try the\r
+                                offers in the order that they are received.                          \r
\r
+  @retval EFI_SUCCESS           Valid DHCP has completed.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid\r
+                                EFI_PXE_BASE_CODE_PROTOCOL structure.                  \r
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.                                \r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough memory to complete the DHCP Protocol.\r
+  @retval EFI_ABORTED           The callback function aborted the DHCP Protocol.\r
+  @retval EFI_TIMEOUT           The DHCP Protocol timed out.\r
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the DHCP session.\r
+  @retval EFI_NO_RESPONSE       Valid PXE offer was not received.\r
+                                     \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_DHCP) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,\r
+  IN BOOLEAN                               SortOffers\r
+  );\r
+\r
+/**                                                                 \r
+  Attempts to complete the PXE Boot Server and/or boot image discovery sequence.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  Type                  The type of bootstrap to perform.\r
+  @param  Layer                 Pointer to the boot server layer number to discover, which must be\r
+                                PXE_BOOT_LAYER_INITIAL when a new server type is being            \r
+                                discovered.                                                       \r
+  @param  UseBis                TRUE if Boot Integrity Services are to be used. FALSE otherwise.                                \r
+  @param  Info                  Pointer to a data structure that contains additional information on the\r
+                                type of discovery operation that is to be performed.                   \r
+                                  \r
+  @retval EFI_SUCCESS           The Discovery sequence has been completed.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                \r
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.                                \r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough memory to complete Discovery.\r
+  @retval EFI_ABORTED           The callback function aborted the Discovery sequence.\r
+  @retval EFI_TIMEOUT           The Discovery sequence timed out.\r
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the PXE discovery\r
+                                session.                                                  \r
+                                       \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL           *This,\r
+  IN UINT16                               Type,\r
+  IN UINT16                               *Layer,\r
+  IN BOOLEAN                              UseBis,\r
+  IN EFI_PXE_BASE_CODE_DISCOVER_INFO      *Info   OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Used to perform TFTP and MTFTP services.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  Operation             The type of operation to perform.\r
+  @param  BufferPtr             A pointer to the data buffer.                                                                     \r
+  @param  Overwrite             Only used on write file operations. TRUE if a file on a remote server can\r
+                                be overwritten.                                                          \r
+  @param  BufferSize            For get-file-size operations, *BufferSize returns the size of the\r
+                                requested file.                                                  \r
+  @param  BlockSize             The requested block size to be used during a TFTP transfer.\r
+  @param  ServerIp              The TFTP / MTFTP server IP address.\r
+  @param  Filename              A Null-terminated ASCII string that specifies a directory name or a file\r
+                                name.                                                                   \r
+  @param  Info                  Pointer to the MTFTP information.\r
+  @param  DontUseBuffer         Set to FALSE for normal TFTP and MTFTP read file operation.                       \r
+                                  \r
+  @retval EFI_SUCCESS           The TFTP/MTFTP operation was completed.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                \r
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.                                \r
+  @retval EFI_BUFFER_TOO_SMALL  The buffer is not large enough to complete the read operation.   \r
+  @retval EFI_ABORTED           The callback function aborted the TFTP/MTFTP operation.\r
+  @retval EFI_TIMEOUT           The TFTP/MTFTP operation timed out.\r
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the MTFTP session.\r
+  @retval EFI_TFTP_ERROR        A TFTP error packet was received during the MTFTP session.\r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_MTFTP) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL                *This,\r
+  IN EFI_PXE_BASE_CODE_TFTP_OPCODE             Operation,\r
+  IN OUT VOID                                  *BufferPtr OPTIONAL,\r
+  IN BOOLEAN                                   Overwrite,\r
+  IN OUT UINT64                                *BufferSize,\r
+  IN UINTN                                     *BlockSize OPTIONAL,\r
+  IN EFI_IP_ADDRESS                            *ServerIp,\r
+  IN UINT8                                     *Filename  OPTIONAL,\r
+  IN EFI_PXE_BASE_CODE_MTFTP_INFO              *Info      OPTIONAL,\r
+  IN BOOLEAN                                   DontUseBuffer\r
+  );\r
+\r
+/**                                                                 \r
+  Writes a UDP packet to the network interface.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  OpFlags               The UDP operation flags. \r
+  @param  DestIp                The destination IP address.\r
+  @param  DestPort              The destination UDP port number.                                                                         \r
+  @param  GatewayIp             The gateway IP address.                                                 \r
+  @param  SrcIp                 The source IP address.\r
+  @param  SrcPort               The source UDP port number.\r
+  @param  HeaderSize            An optional field which may be set to the length of a header at\r
+                                HeaderPtr to be prefixed to the data at BufferPtr.             \r
+  @param  HeaderPtr             If HeaderSize is not NULL, a pointer to a header to be prefixed to the\r
+                                data at BufferPtr.                                                    \r
+  @param  BufferSize            A pointer to the size of the data at BufferPtr.\r
+  @param  BufferPtr             A pointer to the data to be written.\r
+                                  \r
+  @retval EFI_SUCCESS           The UDP Write operation was completed.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                \r
+  @retval EFI_BAD_BUFFER_SIZE   The buffer is too long to be transmitted.  \r
+  @retval EFI_ABORTED           The callback function aborted the UDP Write operation.\r
+  @retval EFI_TIMEOUT           The UDP Write operation timed out.\r
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the UDP write session.  \r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL                *This,\r
+  IN UINT16                                    OpFlags,\r
+  IN EFI_IP_ADDRESS                            *DestIp,\r
+  IN EFI_PXE_BASE_CODE_UDP_PORT                *DestPort,\r
+  IN EFI_IP_ADDRESS                            *GatewayIp,  OPTIONAL\r
+  IN EFI_IP_ADDRESS                            *SrcIp,      OPTIONAL\r
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT            *SrcPort,    OPTIONAL\r
+  IN UINTN                                     *HeaderSize, OPTIONAL\r
+  IN VOID                                      *HeaderPtr,  OPTIONAL\r
+  IN UINTN                                     *BufferSize,\r
+  IN VOID                                      *BufferPtr\r
+  );\r
+\r
+/**                                                                 \r
+  Reads a UDP packet from the network interface.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  OpFlags               The UDP operation flags. \r
+  @param  DestIp                The destination IP address.\r
+  @param  DestPort              The destination UDP port number.                                                                         \r
+  @param  GatewayIp             The gateway IP address.                                                 \r
+  @param  SrcIp                 The source IP address.\r
+  @param  SrcPort               The source UDP port number.\r
+  @param  HeaderSize            An optional field which may be set to the length of a header at\r
+                                HeaderPtr to be prefixed to the data at BufferPtr.             \r
+  @param  HeaderPtr             If HeaderSize is not NULL, a pointer to a header to be prefixed to the\r
+                                data at BufferPtr.                                                    \r
+  @param  BufferSize            A pointer to the size of the data at BufferPtr.\r
+  @param  BufferPtr             A pointer to the data to be read.\r
+                                  \r
+  @retval EFI_SUCCESS           The UDP Write operation was completed.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                \r
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.\r
+  @retval EFI_BUFFER_TOO_SMALL  The packet is larger than Buffer can hold.\r
+  @retval EFI_ABORTED           The callback function aborted the UDP Read operation.\r
+  @retval EFI_TIMEOUT           The UDP Read operation timed out.  \r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL                *This,\r
+  IN UINT16                                    OpFlags,\r
+  IN OUT EFI_IP_ADDRESS                        *DestIp,     OPTIONAL\r
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT            *DestPort,   OPTIONAL\r
+  IN OUT EFI_IP_ADDRESS                        *SrcIp,      OPTIONAL\r
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT            *SrcPort,    OPTIONAL\r
+  IN UINTN                                     *HeaderSize, OPTIONAL\r
+  IN VOID                                      *HeaderPtr,  OPTIONAL\r
+  IN OUT UINTN                                 *BufferSize,\r
+  IN VOID                                      *BufferPtr\r
+  );\r
+\r
+/**                                                                 \r
+  Updates the IP receive filters of a network device and enables software filtering.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  NewFilter             Pointer to the new set of IP receive filters.\r
+  \r
+  @retval EFI_SUCCESS           The IP receive filter settings were updated.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                  \r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,\r
+  IN EFI_PXE_BASE_CODE_IP_FILTER           *NewFilter\r
+  );\r
+\r
+/**                                                                 \r
+  Uses the ARP protocol to resolve a MAC address.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  IpAddr                Pointer to the IP address that is used to resolve a MAC address.\r
+  @param  MacAddr               If not NULL, a pointer to the MAC address that was resolved with the\r
+                                ARP protocol.                                                       \r
+                                  \r
+  @retval EFI_SUCCESS           The IP or MAC address was resolved.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                \r
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.  \r
+  @retval EFI_ABORTED           The callback function aborted the ARP Protocol.\r
+  @retval EFI_TIMEOUT           The ARP Protocol encountered a timeout condition.\r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_ARP) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,\r
+  IN EFI_IP_ADDRESS                        *IpAddr,\r
+  IN EFI_MAC_ADDRESS                       *MacAddr OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Updates the parameters that affect the operation of the PXE Base Code Protocol.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  NewAutoArp            If not NULL, a pointer to a value that specifies whether to replace the\r
+                                current value of AutoARP.                                              \r
+  @param  NewSendGUID           If not NULL, a pointer to a value that specifies whether to replace the\r
+                                current value of SendGUID.                                             \r
+  @param  NewTTL                If not NULL, a pointer to be used in place of the current value of TTL,\r
+                                the "time to live" field of the IP header.                           \r
+  @param  NewToS                If not NULL, a pointer to be used in place of the current value of ToS,\r
+                                the "type of service" field of the IP header.                        \r
+  @param  NewMakeCallback       If not NULL, a pointer to a value that specifies whether to replace the\r
+                                current value of the MakeCallback field of the Mode structure.                                                                \r
+                                  \r
+  @retval EFI_SUCCESS           The new parameters values were updated.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                  \r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,\r
+  IN BOOLEAN                               *NewAutoArp,     OPTIONAL\r
+  IN BOOLEAN                               *NewSendGUID,    OPTIONAL\r
+  IN UINT8                                 *NewTTL,         OPTIONAL\r
+  IN UINT8                                 *NewToS,         OPTIONAL\r
+  IN BOOLEAN                               *NewMakeCallback OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Updates the station IP address and/or subnet mask values of a network device.\r
+    \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  NewStationIp          Pointer to the new IP address to be used by the network device.  \r
+  @param  NewSubnetMask         Pointer to the new subnet mask to be used by the network device.                                 \r
+                                  \r
+  @retval EFI_SUCCESS           The new station IP address and/or subnet mask were updated.\r
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.                                  \r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,\r
+  IN EFI_IP_ADDRESS                        *NewStationIp,   OPTIONAL\r
+  IN EFI_IP_ADDRESS                        *NewSubnetMask   OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Updates the contents of the cached DHCP and Discover packets.\r
+    \r
+  @param  This                   Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.\r
+  @param  NewDhcpDiscoverValid   Pointer to a value that will replace the current\r
+                                 DhcpDiscoverValid field.                        \r
+  @param  NewDhcpAckReceived     Pointer to a value that will replace the current\r
+                                 DhcpAckReceived field.                          \r
+  @param  NewProxyOfferReceived  Pointer to a value that will replace the current\r
+                                 ProxyOfferReceived field.                       \r
+  @param  NewPxeDiscoverValid    Pointer to a value that will replace the current     \r
+                                 ProxyOfferReceived field.                       \r
+  @param  NewPxeReplyReceived    Pointer to a value that will replace the current\r
+                                 PxeReplyReceived field.                         \r
+  @param  NewPxeBisReplyReceived Pointer to a value that will replace the current\r
+                                 PxeBisReplyReceived field.                      \r
+  @param  NewDhcpDiscover        Pointer to the new cached DHCP Discover packet contents.   \r
+  @param  NewDhcpAck             Pointer to the new cached DHCP Ack packet contents.\r
+  @param  NewProxyOffer          Pointer to the new cached Proxy Offer packet contents.\r
+  @param  NewPxeDiscover         Pointer to the new cached PXE Discover packet contents.\r
+  @param  NewPxeReply            Pointer to the new cached PXE Reply packet contents.\r
+  @param  NewPxeBisReply         Pointer to the new cached PXE BIS Reply packet contents.\r
+                                   \r
+  @retval EFI_SUCCESS            The cached packet contents were updated.\r
+  @retval EFI_NOT_STARTED        The PXE Base Code Protocol is in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER  This is NULL or not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.\r
+                                                                      \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) (\r
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,\r
+  BOOLEAN                                  *NewDhcpDiscoverValid,   OPTIONAL\r
+  BOOLEAN                                  *NewDhcpAckReceived,     OPTIONAL\r
+  BOOLEAN                                  *NewProxyOfferReceived,  OPTIONAL\r
+  BOOLEAN                                  *NewPxeDiscoverValid,    OPTIONAL\r
+  BOOLEAN                                  *NewPxeReplyReceived,    OPTIONAL\r
+  BOOLEAN                                  *NewPxeBisReplyReceived, OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET              *NewDhcpDiscover,        OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET              *NewDhcpAck,             OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET              *NewProxyOffer,          OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET              *NewPxeDiscover,         OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET              *NewPxeReply,            OPTIONAL\r
+  IN EFI_PXE_BASE_CODE_PACKET              *NewPxeBisReply          OPTIONAL\r
+  );\r
+\r
+//\r
+// PXE Base Code Protocol structure\r
+//\r
+#define EFI_PXE_BASE_CODE_INTERFACE_REVISION  0x00010000\r
+#define EFI_PXE_BASE_CODE_PROTOCOL_REVISION   EFI_PXE_BASE_CODE_INTERFACE_REVISION\r
+\r
+struct _EFI_PXE_BASE_CODE_PROTOCOL {\r
+  UINT64                            Revision;\r
+  EFI_PXE_BASE_CODE_START           Start;\r
+  EFI_PXE_BASE_CODE_STOP            Stop;\r
+  EFI_PXE_BASE_CODE_DHCP            Dhcp;\r
+  EFI_PXE_BASE_CODE_DISCOVER        Discover;\r
+  EFI_PXE_BASE_CODE_MTFTP           Mtftp;\r
+  EFI_PXE_BASE_CODE_UDP_WRITE       UdpWrite;\r
+  EFI_PXE_BASE_CODE_UDP_READ        UdpRead;\r
+  EFI_PXE_BASE_CODE_SET_IP_FILTER   SetIpFilter;\r
+  EFI_PXE_BASE_CODE_ARP             Arp;\r
+  EFI_PXE_BASE_CODE_SET_PARAMETERS  SetParameters;\r
+  EFI_PXE_BASE_CODE_SET_STATION_IP  SetStationIp;\r
+  EFI_PXE_BASE_CODE_SET_PACKETS     SetPackets;\r
+  EFI_PXE_BASE_CODE_MODE            *Mode;\r
+};\r
+\r
+extern EFI_GUID gEfiPxeBaseCodeProtocolGuid;\r
+\r
+#endif \r
diff --git a/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h b/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h
new file mode 100644 (file)
index 0000000..7f16701
--- /dev/null
@@ -0,0 +1,94 @@
+/** @file\r
+  EFI PXE Base Code CallBack Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  PxeBaseCodeCallBack.h\r
+\r
+**/\r
+\r
+#ifndef _PXE_BASE_CODE_CALLBACK_H_\r
+#define _PXE_BASE_CODE_CALLBACK_H_\r
+\r
+//\r
+// Call Back Definitions\r
+//\r
+#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID \\r
+  { \\r
+    0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+//\r
+// Revision Number\r
+//\r
+#define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION 0x00010000\r
+#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION  \\r
+        EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION\r
+\r
+//\r
+// Protocol definition\r
+//\r
+typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL  EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL;\r
+\r
+typedef enum {\r
+  EFI_PXE_BASE_CODE_FUNCTION_FIRST,\r
+  EFI_PXE_BASE_CODE_FUNCTION_DHCP,\r
+  EFI_PXE_BASE_CODE_FUNCTION_DISCOVER,\r
+  EFI_PXE_BASE_CODE_FUNCTION_MTFTP,\r
+  EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE,\r
+  EFI_PXE_BASE_CODE_FUNCTION_UDP_READ,\r
+  EFI_PXE_BASE_CODE_FUNCTION_ARP,\r
+  EFI_PXE_BASE_CODE_FUNCTION_IGMP,\r
+  EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST\r
+} EFI_PXE_BASE_CODE_FUNCTION;\r
+\r
+typedef enum {\r
+  EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST,\r
+  EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,\r
+  EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT,\r
+  EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST\r
+} EFI_PXE_BASE_CODE_CALLBACK_STATUS;\r
+\r
+/**                                                                 \r
+  Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has\r
+  received, or is waiting to receive a packet.                                                 \r
+  \r
+  @param  This                  Pointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance.\r
+  @param  Function              The PXE Base Code Protocol function that is waiting for an event.                                                              \r
+  @param  Received              TRUE if the callback is being invoked due to a receive event. FALSE if\r
+                                the callback is being invoked due to a transmit event.                \r
+  @param  PacketLen             The length, in bytes, of Packet. This field will have a value of zero if\r
+                                this is a wait for receive event.                                       \r
+  @param  Packet                If Received is TRUE, a pointer to the packet that was just received;\r
+                                otherwise a pointer to the packet that is about to be transmitted.  \r
+                                  \r
+  @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation    \r
+  @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT    if Function specifies an abort operation\r
+                                   \r
+**/\r
+typedef \r
+EFI_PXE_BASE_CODE_CALLBACK_STATUS \r
+(EFIAPI *EFI_PXE_CALLBACK)(\r
+  IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL  *This,\r
+  IN EFI_PXE_BASE_CODE_FUNCTION           Function,\r
+  IN BOOLEAN                              Received,\r
+  IN UINT32                               PacketLen,\r
+  IN EFI_PXE_BASE_CODE_PACKET             *Packet     OPTIONAL\r
+  );\r
+\r
+struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL {\r
+  UINT64            Revision;\r
+  EFI_PXE_CALLBACK  Callback;\r
+};\r
+\r
+extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid;\r
+\r
+#endif \r
+\r
diff --git a/MdePkg/Include/Protocol/RealTimeClock.h b/MdePkg/Include/Protocol/RealTimeClock.h
new file mode 100644 (file)
index 0000000..dc968e1
--- /dev/null
@@ -0,0 +1,41 @@
+/** @file\r
+  Real Time clock Architectural Protocol as defined in DXE CIS\r
+\r
+  This code abstracts time and data functions. Used to provide\r
+  Time and date related EFI runtime services.\r
+\r
+  The GetTime (), SetTime (), GetWakeupTime (), and SetWakeupTime () EFI 1.0\r
+  services are added to the EFI system table and the \r
+  EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL_GUID protocol is registered with a NULL \r
+  pointer.\r
+\r
+  No CRC of the EFI system table is required, as it is done in the DXE core.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  RealTimeClock.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_REAL_TIME_CLOCK_H__\r
+#define __ARCH_PROTOCOL_REAL_TIME_CLOCK_H__\r
+\r
+//\r
+// Global ID for the Real Time Clock Architectural Protocol\r
+//\r
+#define EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL_GUID \\r
+  { 0x27CFAC87, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }\r
+\r
+extern EFI_GUID gEfiRealTimeClockArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Reset.h b/MdePkg/Include/Protocol/Reset.h
new file mode 100644 (file)
index 0000000..80befae
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  Reset Architectural Protocol as defined in the DXE CIS\r
+\r
+  Used to provide ResetSystem runtime services\r
+\r
+  The ResetSystem () EFI 1.0 service is added to the EFI system table and the \r
+  EFI_RESET_ARCH_PROTOCOL_GUID protocol is registered with a NULL pointer.\r
+\r
+  No CRC of the EFI system table is required, as it is done in the DXE core.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Reset.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_RESET_H__\r
+#define __ARCH_PROTOCOL_RESET_H__\r
+\r
+//\r
+// Global ID for the Reset Architectural Protocol\r
+//\r
+#define EFI_RESET_ARCH_PROTOCOL_GUID  \\r
+  { 0x27CFAC88, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }\r
+\r
+extern EFI_GUID gEfiResetArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Runtime.h b/MdePkg/Include/Protocol/Runtime.h
new file mode 100644 (file)
index 0000000..1f7504a
--- /dev/null
@@ -0,0 +1,126 @@
+/** @file\r
+  Runtime Architectural Protocol as defined in DXE CIS\r
+\r
+  This code is used to produce the EFI 1.0 runtime virtual switch over\r
+\r
+  This driver must add SetVirtualAddressMap () and ConvertPointer () to\r
+  the EFI system table. This driver is not responcible for CRCing the \r
+  EFI system table.\r
+\r
+  This driver will add EFI_RUNTIME_ARCH_PROTOCOL_GUID protocol with a \r
+  pointer to the Runtime Arch Protocol instance structure. The protocol\r
+  member functions are used by the DXE core to export information need\r
+  by this driver to produce the runtime transition to virtual mode\r
+  calling.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Runtime.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_RUNTIME_H__\r
+#define __ARCH_PROTOCOL_RUNTIME_H__\r
+\r
+//\r
+// Global ID for the Runtime Architectural Protocol\r
+//\r
+#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \\r
+  { 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 } }\r
+\r
+typedef struct _EFI_RUNTIME_ARCH_PROTOCOL  EFI_RUNTIME_ARCH_PROTOCOL;\r
+\r
+//\r
+// LIST_ENTRY from BaseType \r
+//\r
+typedef LIST_ENTRY EFI_LIST_ENTRY;\r
+\r
+typedef struct _EFI_RUNTIME_IMAGE_ENTRY  EFI_RUNTIME_IMAGE_ENTRY;\r
+\r
+struct _EFI_RUNTIME_IMAGE_ENTRY {\r
+  VOID                    *ImageBase;\r
+  UINT64                  ImageSize;\r
+  VOID                    *RelocationData;\r
+  EFI_HANDLE              Handle;\r
+  EFI_LIST_ENTRY          Link;\r
+};\r
+\r
+typedef struct _EFI_RUNTIME_EVENT_ENTRY  EFI_RUNTIME_EVENT_ENTRY;\r
+\r
+struct _EFI_RUNTIME_EVENT_ENTRY {\r
+  UINT32                  Type;\r
+  EFI_TPL                 NotifyTpl;\r
+  EFI_EVENT_NOTIFY        NotifyFunction;\r
+  VOID                    *NotifyContext;\r
+  EFI_EVENT               *Event;\r
+  EFI_LIST_ENTRY          Link;\r
+};\r
+\r
+//\r
+// Interface stucture for the Runtime Architectural Protocol\r
+//\r
+/**\r
+  @par Protocol Description:\r
+  Allows the runtime functionality of the DXE Foundation to be contained in a \r
+  separate driver. It also provides hooks for the DXE Foundation to export \r
+  information that is needed at runtime. As such, this protocol allows the DXE \r
+  Foundation to manage runtime drivers and events. This protocol also implies \r
+  that the runtime services required to transition to virtual mode, \r
+  SetVirtualAddressMap() and ConvertPointer(), have been registered into the \r
+  EFI Runtime Table in the EFI System Partition.  This protocol must be produced \r
+  by a runtime DXE driver and may only be consumed by the DXE Foundation.\r
+\r
+  @param ImageHead\r
+  A list of type EFI_RUNTIME_IMAGE_ENTRY.\r
+\r
+  @param EventHead\r
+  A list of type EFI_RUNTIME_EVENT_ENTRY.\r
+\r
+  @param MemoryDescriptorSize\r
+  Size of a memory descriptor that is return by GetMemoryMap().\r
+\r
+  @param MemoryDescriptorVersion\r
+  Version of a memory descriptor that is return by GetMemoryMap().\r
+\r
+  @param MemoryMapSize \r
+  Size of the memory map in bytes contained in MemoryMapPhysical and MemoryMapVirtual. \r
+\r
+  @param MemoryMapPhysical\r
+  Pointer to a runtime buffer that contains a copy of \r
+  the memory map returned via GetMemoryMap().\r
+\r
+  @param MemoryMapVirtual\r
+  Pointer to MemoryMapPhysical that is updated to virtual mode after SetVirtualAddressMap().\r
+\r
+  @param VirtualMode\r
+  Boolean that is TRUE if SetVirtualAddressMap() has been called.\r
+\r
+  @param AtRuntime\r
+  Boolean that is TRUE if ExitBootServices () has been called.\r
+\r
+**/\r
+struct _EFI_RUNTIME_ARCH_PROTOCOL {\r
+  EFI_LIST_ENTRY          ImageHead;\r
+  EFI_LIST_ENTRY          EventHead;\r
+  UINTN                   MemoryDescriptorSize;\r
+  UINT32                  MemoryDesciptorVersion;\r
+  UINTN                   MemoryMapSize;\r
+  EFI_MEMORY_DESCRIPTOR   *MemoryMapPhysical;\r
+  EFI_MEMORY_DESCRIPTOR   *MemoryMapVirtual;\r
+  BOOLEAN                 VirtualMode;\r
+  BOOLEAN                 AtRuntime;\r
+};\r
+\r
+extern EFI_GUID gEfiRuntimeArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/ScsiIo.h b/MdePkg/Include/Protocol/ScsiIo.h
new file mode 100644 (file)
index 0000000..e1019ba
--- /dev/null
@@ -0,0 +1,233 @@
+/** @file\r
+  EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  ScsiIo.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_SCSI_IO_PROTOCOL_H__\r
+#define __EFI_SCSI_IO_PROTOCOL_H__\r
+\r
+#define EFI_SCSI_IO_PROTOCOL_GUID \\r
+  { \\r
+    0x932f4736, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \\r
+  }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL;\r
+\r
+//\r
+// SCSI Data Direction definition\r
+//\r
+#define EFI_SCSI_IO_DATA_DIRECTION_READ                        0\r
+#define EFI_SCSI_IO_DATA_DIRECTION_WRITE                       1\r
+#define EFI_SCSI_IO_DATA_DIRECTION_BIDIRECTIONAL               2\r
+\r
+//\r
+// SCSI Host Adapter Status definition\r
+//\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK                     0x00\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND        0x09    // timeout when processing the command\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT                0x0b    // timeout when waiting for the command processing\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT         0x0d    // a message reject was received when processing command\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET              0x0e    // a bus reset was detected\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR           0x0f\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED   0x10    // the adapter failed in issuing request sense command\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT      0x11    // selection timeout\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN  0x12    // data overrun or data underrun\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE               0x13    // Unexepected bus free\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR            0x14    // Target bus phase sequence failure\r
+#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER                  0x7f\r
+\r
+\r
+//\r
+// SCSI Target Status definition\r
+//\r
+#define EFI_SCSI_IO_STATUS_TARGET_GOOD                         0x00\r
+#define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION              0x02    // check condition\r
+#define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET                0x04    // condition met\r
+#define EFI_SCSI_IO_STATUS_TARGET_BUSY                         0x08    // busy\r
+#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE                 0x10    // intermediate\r
+#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET   0x14    // intermediate-condition met\r
+#define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT         0x18    // reservation conflict\r
+#define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED           0x22    // command terminated\r
+#define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL                   0x28    // queue full\r
+\r
+typedef struct {\r
+  UINT64                              Timeout;\r
+  VOID                                *InDataBuffer;\r
+  VOID                                *OutDataBuffer;\r
+  VOID                                *SenseData;\r
+  VOID                                *Cdb;\r
+  UINT32                              InTransferLength;\r
+  UINT32                              OutTransferLength;\r
+  UINT8                               CdbLength;\r
+  UINT8                               DataDirection;\r
+  UINT8                               HostAdapterStatus;\r
+  UINT8                               TargetStatus;\r
+  UINT8                               SenseDataLength;\r
+} EFI_SCSI_IO_SCSI_REQUEST_PACKET;\r
+\r
+/**\r
+  Retrieves the device type information of the SCSI Controller.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  DeviceType A pointer to the device type information\r
+                     retrieved from the SCSI Controller.\r
+\r
+  @retval EFI_SUCCESS           Retrieves the device type information successfully.\r
+  @retval EFI_INVALID_PARAMETER The DeviceType is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE) (\r
+  IN  EFI_SCSI_IO_PROTOCOL            *This,\r
+  OUT UINT8                           *DeviceType\r
+  )\r
+;\r
+\r
+/**\r
+  Retrieves the device location in the SCSI channel.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target A pointer to the Target ID of a SCSI device\r
+                 on the SCSI channel.\r
+  @param  Lun    A pointer to the LUN of the SCSI device on\r
+                 the SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           Retrieves the device location successfully.\r
+  @retval EFI_INVALID_PARAMETER The Target or Lun is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION) (\r
+  IN EFI_SCSI_IO_PROTOCOL           *This,\r
+  IN OUT UINT8                      **Target,\r
+  OUT UINT64                        *Lun\r
+  )\r
+;\r
+\r
+/**\r
+  Resets the SCSI Bus that the SCSI Controller is attached to.\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS      The SCSI bus is reset successfully.\r
+  @retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.\r
+  @retval EFI_UNSUPPORTED  The bus reset operation is not supported by the\r
+                           SCSI Host Controller.\r
+  @retval EFI_TIMEOUT      A timeout occurred while attempting to reset\r
+                            the SCSI bus.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS) (\r
+  IN EFI_SCSI_IO_PROTOCOL     *This\r
+  )\r
+;\r
+\r
+/**\r
+  Resets the SCSI Controller that the device handle specifies.\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS      Reset the SCSI controller successfully.\r
+  @retval EFI_DEVICE_ERROR Errors are encountered when resetting the\r
+                           SCSI Controller.\r
+  @retval EFI_UNSUPPORTED  The SCSI bus does not support a device\r
+                           reset operation.\r
+  @retval EFI_TIMEOUT      A timeout occurred while attempting to\r
+                           reset the SCSI Controller.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE) (\r
+  IN EFI_SCSI_IO_PROTOCOL     *This\r
+  )\r
+;\r
+\r
+\r
+/**\r
+  Sends a SCSI Request Packet to the SCSI Controller for execution.\r
+\r
+  @param  This    Protocol instance pointer.\r
+  @param  Packet  The SCSI request packet to send to the SCSI\r
+                  Controller specified by the device handle.\r
+  @param  Event   If the SCSI bus where the SCSI device is attached\r
+                  does not support non-blocking I/O, then Event is\r
+                  ignored, and blocking I/O is performed.\r
+                  If Event is NULL, then blocking I/O is performed.\r
+                  If Event is not NULL and non-blocking I/O is\r
+                  supported, then non-blocking I/O is performed,\r
+                  and Event will be signaled when the SCSI Request\r
+                  Packet completes.\r
+\r
+  @retval EFI_SUCCESS               The SCSI Request Packet was sent by the host\r
+                                    successfully, and TransferLength bytes were\r
+                                    transferred to/from DataBuffer.See\r
+                                    HostAdapterStatus, TargetStatus,\r
+                                    SenseDataLength, and SenseData in that order\r
+                                    for additional status information.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL The SCSI Request Packet was executed,\r
+                                    but the entire DataBuffer could not be transferred.\r
+                                    The actual number of bytes transferred is returned\r
+                                    in TransferLength. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent because\r
+                                    there are too many SCSI Command Packets already\r
+                                    queued.The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR          A device error occurred while attempting to send\r
+                                    the SCSI Request Packet. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+  @retval EFI_INVALID_PARAMETER     The contents of CommandPacket are invalid.\r
+                                    The SCSI Request Packet was not sent, so no\r
+                                    additional status information is available.\r
+  @retval EFI_UNSUPPORTED           The command described by the SCSI Request Packet\r
+                                    is not supported by the SCSI initiator(i.e., SCSI\r
+                                    Host Controller). The SCSI Request Packet was not\r
+                                    sent, so no additional status information is\r
+                                    available.\r
+  @retval EFI_TIMEOUT               A timeout occurred while waiting for the SCSI\r
+                                    Request Packet to execute. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND) (\r
+  IN EFI_SCSI_IO_PROTOCOL                   *This,\r
+  IN OUT  EFI_SCSI_IO_SCSI_REQUEST_PACKET   *Packet,\r
+  IN EFI_EVENT                              Event  OPTIONAL\r
+  )\r
+;\r
+\r
+struct _EFI_SCSI_IO_PROTOCOL {\r
+  EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE      GetDeviceType;\r
+  EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION  GetDeviceLocation;\r
+  EFI_SCSI_IO_PROTOCOL_RESET_BUS            ResetBus;\r
+  EFI_SCSI_IO_PROTOCOL_RESET_DEVICE         ResetDevice;\r
+  EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND    ExecuteSCSICommand;    \r
+  UINT32                                    IoAlign;\r
+};\r
+\r
+extern EFI_GUID gEfiScsiIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/ScsiPassThru.h b/MdePkg/Include/Protocol/ScsiPassThru.h
new file mode 100644 (file)
index 0000000..a5aa6c4
--- /dev/null
@@ -0,0 +1,312 @@
+/** @file\r
+  SCSI Pass Through protocol.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  ScsiPassThru.h\r
+\r
+**/\r
+\r
+#ifndef __SCSI_PASS_THROUGH_H__\r
+#define __SCSI_PASS_THROUGH_H__\r
+\r
+#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \\r
+  { \\r
+    0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77 } \\r
+  }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_SCSI_PASS_THRU_PROTOCOL  EFI_SCSI_PASS_THRU_PROTOCOL;\r
+\r
+#define EFI_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL    0x0001\r
+#define EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL     0x0002\r
+#define EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO  0x0004\r
+\r
+//\r
+// SCSI Host Adapter Status definition\r
+//\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_OK                     0x00\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND        0x09  // timeout when processing the command\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT                0x0b  // timeout when waiting for the command processing\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT         0x0d  // a message reject was received when processing command\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_RESET              0x0e  // a bus reset was detected\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR           0x0f\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED   0x10  // the adapter failed in issuing request sense command\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT      0x11  // selection timeout\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN  0x12  // data overrun or data underrun\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_FREE               0x13  // Unexepected bus free\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR            0x14  // Target bus phase sequence failure\r
+#define EFI_SCSI_STATUS_HOST_ADAPTER_OTHER                  0x7f\r
+\r
+//\r
+// SCSI Target Status definition\r
+//\r
+#define EFI_SCSI_STATUS_TARGET_GOOD                       0x00\r
+#define EFI_SCSI_STATUS_TARGET_CHECK_CONDITION            0x02  // check condition\r
+#define EFI_SCSI_STATUS_TARGET_CONDITION_MET              0x04  // condition met\r
+#define EFI_SCSI_STATUS_TARGET_BUSY                       0x08  // busy\r
+#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE               0x10  // intermediate\r
+#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14  // intermediate-condition met\r
+#define EFI_SCSI_STATUS_TARGET_RESERVATION_CONFLICT       0x18  // reservation conflict\r
+#define EFI_SCSI_STATUS_TARGET_COMMOND_TERMINATED         0x22  // command terminated\r
+#define EFI_SCSI_STATUS_TARGET_QUEUE_FULL                 0x28  // queue full\r
+\r
+typedef struct {\r
+  UINT64  Timeout;\r
+  VOID    *DataBuffer;\r
+  VOID    *SenseData;\r
+  VOID    *Cdb;\r
+  UINT32  TransferLength;\r
+  UINT8   CdbLength;\r
+  UINT8   DataDirection;\r
+  UINT8   HostAdapterStatus;\r
+  UINT8   TargetStatus;\r
+  UINT8   SenseDataLength;\r
+} EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
+\r
+typedef struct {\r
+  CHAR16  *ControllerName;\r
+  CHAR16  *ChannelName;\r
+  UINT32  AdapterId;\r
+  UINT32  Attributes;\r
+  UINT32  IoAlign;\r
+} EFI_SCSI_PASS_THRU_MODE;\r
+\r
+/**\r
+  Sends a SCSI Request Packet to a SCSI device that is attached to \r
+  the SCSI channel. This function supports both blocking I/O and \r
+  non-blocking I/O.  The blocking I/O functionality is required, \r
+  and the non-blocking I/O functionality is optional.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target The Target ID of the SCSI device to\r
+                 send the SCSI Request Packet.\r
+  @param  Lun    The LUN of the SCSI device to send the\r
+                 SCSI Request Packet.\r
+  @param  Packet A pointer to the SCSI Request Packet to send\r
+                 to the SCSI device specified by Target and Lun.\r
+  @param  Event  If non-blocking I/O is not supported then Event\r
+                 is ignored, and blocking I/O is performed.\r
+                 If Event is NULL, then blocking I/O is performed.\r
+                 If Event is not NULL and non blocking I/O is\r
+                 supported, then non-blocking I/O is performed,\r
+                 and Event will be signaled when the SCSI Request\r
+                 Packet completes\r
+\r
+  @retval EFI_SUCCESS               The SCSI Request Packet was sent by the host, and\r
+                                    TransferLength bytes were transferred to/from\r
+                                    DataBuffer.See HostAdapterStatus, TargetStatus,\r
+                                    SenseDataLength,and SenseData in that order\r
+                                    for additional status information.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL The SCSI Request Packet was executed, but the\r
+                                    entire DataBuffer could not be transferred.\r
+                                    The actual number of bytes transferred is returned\r
+                                    in TransferLength. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent because\r
+                                    there are too many SCSI Request Packets already\r
+                                    queued.  The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR          A device error occurred while attempting to send\r
+                                    the SCSI Request Packet. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+  @retval EFI_INVALID_PARAMETER     Target, Lun, or the contents of ScsiRequestPacket\r
+                                    are invalid. The SCSI Request Packet was not sent,\r
+                                    so no additional status information is available.\r
+  @retval EFI_UNSUPPORTED           The command described by the SCSI Request Packet\r
+                                    is not supported by the host adapter. The SCSI\r
+                                    Request Packet was not sent, so no additional\r
+                                    status information is available.\r
+  @retval EFI_TIMEOUT               A timeout occurred while waiting for the SCSI\r
+                                    Request Packet to execute. See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in\r
+                                    that order for additional status information.\r
+                                    \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_PASSTHRU) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL                          *This,\r
+  IN UINT32                                               Target,\r
+  IN UINT64                                               Lun,\r
+  IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET           *Packet,\r
+  IN EFI_EVENT                                            Event   OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Used to retrieve the list of legal Target IDs for SCSI devices \r
+  on a SCSI channel.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target On input, a pointer to the Target ID of a\r
+                 SCSI device present on the SCSI channel.\r
+                 On output, a pointer to the Target ID of\r
+                 the next SCSI device present on a SCSI channel.\r
+                 An input value of 0xFFFFFFFF retrieves the\r
+                 Target ID of the first SCSI device present on\r
+                 a SCSI channel.\r
+  @param  Lun    On input, a pointer to the LUN of a SCSI device\r
+                 present on the SCSI channel.On output, a pointer\r
+                 to the LUN of the next SCSI device present on a\r
+                 SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           The Target ID of the next SCSI device on the SCSI\r
+                                channel was returned in Target and Lun.\r
+  @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.\r
+  @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF, and Target and Lun were\r
+                                 not returned on a previous call to GetNextDevice().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL            *This,\r
+  IN OUT UINT32                             *Target,\r
+  IN OUT UINT64                             *Lun\r
+  )\r
+;\r
+\r
+/**\r
+  Used to allocate and build a device path node for a SCSI device \r
+  on a SCSI channel.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  Target     The Target ID of the SCSI device for which\r
+                     a device path node is to be allocated and built.\r
+  @param  Lun        The LUN of the SCSI device for which a device\r
+                     path node is to be allocated and built.\r
+  @param  DevicePath A pointer to a single device path node that\r
+                     describes the SCSI device specified by\r
+                     Target and Lun. This function is responsible\r
+                     for allocating the buffer DevicePath with the boot\r
+                     service AllocatePool().  It is the caller's\r
+                     responsibility to free DevicePath when the caller\r
+                     is finished with DevicePath.\r
+\r
+  @retval EFI_SUCCESS           The device path node that describes the SCSI device\r
+                                specified by Target and Lun was allocated and\r
+                                returned in DevicePath.\r
+  @retval EFI_NOT_FOUND         The SCSI devices specified by Target and Lun does\r
+                                not exist on the SCSI channel.\r
+  @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate\r
+                                DevicePath.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL            *This,\r
+  IN     UINT32                             Target,\r
+  IN     UINT64                             Lun,\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL           **DevicePath\r
+  )\r
+;\r
+\r
+/**\r
+  Used to translate a device path node to a Target ID and LUN.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  DevicePath A pointer to the device path node that\r
+                     describes a SCSI device on the SCSI channel.\r
+  @param  Target     A pointer to the Target ID of a SCSI device\r
+                     on the SCSI channel.\r
+  @param  Lun        A pointer to the LUN of a SCSI device on\r
+                     the SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           DevicePath was successfully translated to a\r
+                                Target ID and LUN, and they were returned\r
+                                in Target and Lun.\r
+  @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
+  @retval EFI_INVALID_PARAMETER Target is NULL.\r
+  @retval EFI_INVALID_PARAMETER Lun is NULL.\r
+  @retval EFI_UNSUPPORTED       This driver does not support the device path\r
+                                node type in DevicePath.\r
+  @retval EFI_NOT_FOUND         A valid translation from DevicePath to a\r
+                                Target ID and LUN does not exist.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_GET_TARGET_LUN) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL            *This,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL              *DevicePath,\r
+  OUT UINT32                                *Target,\r
+  OUT UINT64                                *Lun\r
+  )\r
+;\r
+\r
+/**\r
+  Resets a SCSI channel.This operation resets all the \r
+  SCSI devices connected to the SCSI channel.\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS      The SCSI channel was reset.\r
+  @retval EFI_UNSUPPORTED  The SCSI channel does not support\r
+                           a channel reset operation.\r
+  @retval EFI_DEVICE_ERROR A device error occurred while\r
+                           attempting to reset the SCSI channel.\r
+  @retval EFI_TIMEOUT      A timeout occurred while attempting\r
+                           to reset the SCSI channel.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_RESET_CHANNEL) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL             *This\r
+  )\r
+;\r
+\r
+/**\r
+  Resets a SCSI device that is connected to a SCSI channel.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  Target The Target ID of the SCSI device to reset.\r
+  @param  Lun    The LUN of the SCSI device to reset.\r
+\r
+  @retval EFI_SUCCESS           The SCSI device specified by Target and\r
+                                Lun was reset.\r
+  @retval EFI_UNSUPPORTED       The SCSI channel does not support a target\r
+                                reset operation.\r
+  @retval EFI_INVALID_PARAMETER Target or Lun are invalid.\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting\r
+                                to reset the SCSI device specified by Target\r
+                                and Lun.\r
+  @retval EFI_TIMEOUT           A timeout occurred while attempting to reset\r
+                                the SCSI device specified by Target and Lun.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SCSI_PASS_THRU_RESET_TARGET) (\r
+  IN EFI_SCSI_PASS_THRU_PROTOCOL             *This,\r
+  IN UINT32                                  Target,\r
+  IN UINT64                                  Lun\r
+  )\r
+;\r
+\r
+struct _EFI_SCSI_PASS_THRU_PROTOCOL {\r
+  EFI_SCSI_PASS_THRU_MODE               *Mode;\r
+  EFI_SCSI_PASS_THRU_PASSTHRU           PassThru;\r
+  EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE    GetNextDevice;\r
+  EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH  BuildDevicePath;\r
+  EFI_SCSI_PASS_THRU_GET_TARGET_LUN     GetTargetLun;\r
+  EFI_SCSI_PASS_THRU_RESET_CHANNEL      ResetChannel;\r
+  EFI_SCSI_PASS_THRU_RESET_TARGET       ResetTarget;\r
+};\r
+\r
+extern EFI_GUID gEfiScsiPassThruProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/ScsiPassThruExt.h b/MdePkg/Include/Protocol/ScsiPassThruExt.h
new file mode 100644 (file)
index 0000000..a59b61e
--- /dev/null
@@ -0,0 +1,331 @@
+/** @file\r
+  EFI_EXT_SCSI_PASS_THRU_PROTOCOL as defined in UEFI 2.0.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  ScsiPassThruExt.h\r
+\r
+**/\r
+\r
+#ifndef __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
+#define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__\r
+\r
+#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \\r
+  { \\r
+    0x1d3de7f0, 0x0807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } \\r
+  }\r
+\r
+typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL;\r
+\r
+#define TARGET_MAX_BYTES                             0x10\r
+\r
+#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL   0x0001\r
+#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL    0x0002\r
+#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004\r
+\r
+//\r
+// DataDirection\r
+//\r
+#define EFI_EXT_SCSI_DATA_DIRECTION_READ             0\r
+#define EFI_EXT_SCSI_DATA_DIRECTION_WRITE            1\r
+#define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL    2\r
+//\r
+// HostAdapterStatus\r
+//\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK                    0x00\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND       0x09\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT               0x0b\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT        0x0d\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET             0x0e\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR          0x0f\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED  0x10\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT     0x11\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE              0x13\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR           0x14\r
+#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER                 0x7f\r
+//\r
+// TargetStatus\r
+//\r
+#define EFI_EXT_SCSI_STATUS_TARGET_GOOD                        0x00\r
+#define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION             0x02\r
+#define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET               0x04\r
+#define EFI_EXT_SCSI_STATUS_TARGET_BUSY                        0x08\r
+#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE                0x10\r
+#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET  0x14\r
+#define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT        0x18\r
+#define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL               0x28\r
+#define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE                  0x30\r
+#define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED                0x40\r
+\r
+typedef struct {\r
+  UINT32 AdapterId;\r
+  UINT32 Attributes;\r
+  UINT32 IoAlign;\r
+} EFI_EXT_SCSI_PASS_THRU_MODE;\r
+\r
+typedef struct {\r
+  UINT64 Timeout;\r
+  VOID   *InDataBuffer;\r
+  VOID   *OutDataBuffer;\r
+  VOID   *SenseData;\r
+  VOID   *Cdb;\r
+  UINT32 InTransferLength;\r
+  UINT32 OutTransferLength;\r
+  UINT8  CdbLength;\r
+  UINT8  DataDirection;\r
+  UINT8  HostAdapterStatus;\r
+  UINT8  TargetStatus;\r
+  UINT8  SenseDataLength;\r
+} EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;\r
+\r
+/**\r
+  Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function   \r
+  supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
+  nonblocking I/O functionality is optional.                                                             \r
+\r
+  @param  This    A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param  Target  The Target is an array of size TARGET_MAX_BYTES and it represents\r
+                  the id of the SCSI device to send the SCSI Request Packet. Each\r
+                  transport driver may chose to utilize a subset of this size to suit the needs\r
+                  of transport target representation. For example, a Fibre Channel driver\r
+                  may use only 8 bytes (WWN) to represent an FC target.\r
+  @param  Lun     The LUN of the SCSI device to send the SCSI Request Packet.\r
+  @param  Packet  A pointer to the SCSI Request Packet to send to the SCSI device\r
+                  specified by Target and Lun.\r
+  @param  Event   If nonblocking I/O is not supported then Event is ignored, and blocking\r
+                  I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
+                  Event is not NULL and non blocking I/O is supported, then\r
+                  nonblocking I/O is performed, and Event will be signaled when the\r
+                  SCSI Request Packet completes.\r
+\r
+  @retval EFI_SUCCESS           The SCSI Request Packet was sent by the host. For bi-directional\r
+                                commands, InTransferLength bytes were transferred from\r
+                                InDataBuffer. For write and bi-directional commands,\r
+                                OutTransferLength bytes were transferred by\r
+                                OutDataBuffer.\r
+  @retval EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was not executed. The number of bytes that\r
+                                could be transferred is returned in InTransferLength. For write\r
+                                and bi-directional commands, OutTransferLength bytes were\r
+                                transferred by OutDataBuffer.\r
+  @retval EFI_NOT_READY         The SCSI Request Packet could not be sent because there are too many\r
+                                SCSI Request Packets already queued. The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to send the SCSI Request\r
+                                Packet.\r
+  @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
+  @retval EFI_UNSUPPORTED       The command described by the SCSI Request Packet is not supported\r
+                                by the host adapter. This includes the case of Bi-directional SCSI\r
+                                commands not supported by the implementation. The SCSI Request\r
+                                Packet was not sent, so no additional status information is available.\r
+  @retval EFI_TIMEOUT           A timeout occurred while waiting for the SCSI Request Packet to execute.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU) (\r
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL                *This,\r
+  IN UINT8                                          *Target,\r
+  IN UINT64                                         Lun,\r
+  IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
+  IN EFI_EVENT                                      Event     OPTIONAL\r
+  )\r
+;      \r
+\r
+/**\r
+  Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These       \r
+  can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
+  Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the       \r
+  Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI    \r
+  channel.                                                                                               \r
+\r
+  @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param  Target On input, a pointer to the Target ID (an array of size\r
+                 TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
+                 On output, a pointer to the Target ID (an array of\r
+                 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
+                 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
+                 Target array retrieves the Target ID of the first SCSI device present on a\r
+                 SCSI channel.\r
+  @param  Lun    On input, a pointer to the LUN of a SCSI device present on the SCSI\r
+                 channel. On output, a pointer to the LUN of the next SCSI device present\r
+                 on a SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           The Target ID and LUN of the next SCSI device on the SCSI\r
+                                channel was returned in Target and Lun.\r
+  @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
+                                not returned on a previous call to GetNextTargetLun().\r
+  @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN) (\r
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL                *This,\r
+  IN OUT UINT8                                      **Target,\r
+  IN OUT UINT64                                     *Lun\r
+  )\r
+;   \r
+\r
+/**\r
+  Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
+\r
+  @param  This       A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param  Target     The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
+                     Target ID of the SCSI device for which a device path node is to be\r
+                     allocated and built. Transport drivers may chose to utilize a subset of\r
+                     this size to suit the representation of targets. For example, a Fibre\r
+                     Channel driver may use only 8 bytes (WWN) in the array to represent a\r
+                     FC target.\r
+  @param  Lun        The LUN of the SCSI device for which a device path node is to be\r
+                     allocated and built.\r
+  @param  DevicePath A pointer to a single device path node that describes the SCSI device\r
+                     specified by Target and Lun. This function is responsible for\r
+                     allocating the buffer DevicePath with the boot service\r
+                     AllocatePool(). It is the caller's responsibility to free\r
+                     DevicePath when the caller is finished with DevicePath.\r
+\r
+  @retval EFI_SUCCESS           The device path node that describes the SCSI device specified by\r
+                                Target and Lun was allocated and returned in\r
+                                DevicePath.\r
+  @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
+  @retval EFI_NOT_FOUND         The SCSI devices specified by Target and Lun does not exist\r
+                                on the SCSI channel.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate DevicePath.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH) (\r
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,\r
+  IN UINT8                                         *Target,\r
+  IN UINT64                                        Lun,\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL                  **DevicePath\r
+  )\r
+;     \r
+\r
+/**\r
+  Used to translate a device path node to a Target ID and LUN.\r
+\r
+  @param  This       A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param  DevicePath A pointer to a single device path node that describes the SCSI device\r
+                     on the SCSI channel.\r
+  @param  Target     A pointer to the Target Array which represents the ID of a SCSI device\r
+                     on the SCSI channel.\r
+  @param  Lun        A pointer to the LUN of a SCSI device on the SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           DevicePath was successfully translated to a Target ID and\r
+                                LUN, and they were returned in Target and Lun.\r
+  @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
+  @retval EFI_NOT_FOUND         A valid translation from DevicePath to a Target ID and LUN\r
+                                does not exist.\r
+  @retval EFI_UNSUPPORTED       This driver does not support the device path node type in\r
+                                 DevicePath.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN) (\r
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,\r
+  IN EFI_DEVICE_PATH_PROTOCOL                      *DevicePath,\r
+  OUT UINT8                                        **Target,\r
+  OUT UINT64                                       *Lun\r
+  )\r
+;       \r
+\r
+/**\r
+  Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
+\r
+  @param  This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS      The SCSI channel was reset.\r
+  @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
+  @retval EFI_TIMEOUT      A timeout occurred while attempting to reset the SCSI channel.\r
+  @retval EFI_UNSUPPORTED  The SCSI channel does not support a channel reset operation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL) (\r
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This\r
+  )\r
+;    \r
+  \r
+/**\r
+  Resets a SCSI logical unit that is connected to a SCSI channel.\r
+\r
+  @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param  Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r
+                 target port ID of the SCSI device containing the SCSI logical unit to\r
+                 reset. Transport drivers may chose to utilize a subset of this array to suit\r
+                 the representation of their targets.\r
+  @param  Lun    The LUN of the SCSI device to reset.\r
+\r
+  @retval EFI_SUCCESS           The SCSI device specified by Target and Lun was reset.\r
+  @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
+  @retval EFI_TIMEOUT           A timeout occurred while attempting to reset the SCSI device\r
+                                specified by Target and Lun.\r
+  @retval EFI_UNSUPPORTED       The SCSI channel does not support a target reset operation.\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to reset the SCSI device\r
+                                 specified by Target and Lun.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN) (\r
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,\r
+  IN UINT8                                         *Target,\r
+  IN UINT64                                        Lun\r
+  )\r
+;         \r
+\r
+/**\r
+  Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either     \r
+  be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
+  for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to     \r
+  see if a SCSI device is actually present at that location on the SCSI channel.                         \r
+\r
+  @param  This   A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
+  @param  Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
+                 On output, a pointer to the Target ID (an array of\r
+                 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
+                 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
+                 Target array retrieves the Target ID of the first SCSI device present on a\r
+                 SCSI channel.\r
+\r
+  @retval EFI_SUCCESS           The Target ID of the next SCSI device on the SCSI\r
+                                channel was returned in Target.\r
+  @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
+  @retval EFI_TIMEOUT           Target array is not all 0xF, and Target were not\r
+                                returned on a previous call to GetNextTarget().\r
+  @retval EFI_NOT_FOUND         There are no more SCSI devices on this SCSI channel.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET) (\r
+  IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL               *This,\r
+  IN OUT UINT8                                     **Target\r
+  )\r
+;          \r
+  \r
+struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {\r
+  EFI_EXT_SCSI_PASS_THRU_MODE                *Mode;\r
+  EFI_EXT_SCSI_PASS_THRU_PASSTHRU            PassThru;\r
+  EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;\r
+  EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH   BuildDevicePath;\r
+  EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN      GetTargetLun;\r
+  EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL       ResetChannel;\r
+  EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN    ResetTargetLun;\r
+  EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET     GetNextTarget;\r
+};\r
+\r
+extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Security.h b/MdePkg/Include/Protocol/Security.h
new file mode 100644 (file)
index 0000000..ec981b4
--- /dev/null
@@ -0,0 +1,132 @@
+/** @file\r
+  Security Architectural Protocol as defined in the DXE CIS\r
+\r
+  Used to provide Security services.  Specifically, dependening upon the \r
+  authentication state of a discovered driver in a Firmware Volume, the \r
+  portable DXE Core Dispatcher will call into the Security Architectural \r
+  Protocol (SAP) with the authentication state of the driver.\r
+\r
+  This call-out allows for OEM-specific policy decisions to be made, such\r
+  as event logging for attested boots, locking flash in response to discovering\r
+  an unsigned driver or failed signature check, or other exception response.\r
+\r
+  The SAP can also change system behavior by having the DXE core put a driver\r
+  in the Schedule-On-Request (SOR) state.  This will allow for later disposition \r
+  of the driver by platform agent, such as Platform BDS.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Security.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_SECURITY_H__\r
+#define __ARCH_PROTOCOL_SECURITY_H__\r
+\r
+//\r
+// Global ID for the Security Code Architectural Protocol\r
+//\r
+#define EFI_SECURITY_ARCH_PROTOCOL_GUID  \\r
+  { 0xA46423E3, 0x4617, 0x49f1, {0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } }\r
+\r
+typedef struct _EFI_SECURITY_ARCH_PROTOCOL    EFI_SECURITY_ARCH_PROTOCOL;\r
+\r
+/**\r
+  The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r
+  policy from the DXE core response to an attempt to use a file that returns a \r
+  given status for the authentication check from the section extraction protocol.  \r
+\r
+  The possible responses in a given SAP implementation may include locking \r
+  flash upon failure to authenticate, attestation logging for all signed drivers, \r
+  and other exception operations.  The File parameter allows for possible logging \r
+  within the SAP of the driver.\r
+\r
+  If File is NULL, then EFI_INVALID_PARAMETER is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is not safe for the DXE Core to use under any circumstances, \r
+  then EFI_ACCESS_DENIED is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is not safe for the DXE Core to use right now, but it \r
+  might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is \r
+  returned.\r
+\r
+  @param  This             The EFI_SECURITY_ARCH_PROTOCOL instance.\r
+  @param  AuthenticationStatus \r
+                           This is the authentication type returned from the Section\r
+                           Extraction protocol. See the Section Extraction Protocol\r
+                           Specification for details on this type.\r
+  @param  File             This is a pointer to the device path of the file that is\r
+                           being dispatched. This will optionally be used for logging.\r
+\r
+  @retval EFI_SUCCESS           The file specified by File did authenticate, and the\r
+                                platform policy dictates that the DXE Core may use File.\r
+  @retval EFI_INVALID_PARAMETER Driver is NULL.\r
+  @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and\r
+                                the platform policy dictates that File should be placed\r
+                                in the untrusted state. A file may be promoted from\r
+                                the untrusted to the trusted state at a future time\r
+                                with a call to the Trust() DXE Service.\r
+  @retval EFI_ACCESS_DENIED     The file specified by File did not authenticate, and\r
+                                the platform policy dictates that File should not be\r
+                                used for any purpose.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_SECURITY_FILE_AUTHENTICATION_STATE) (\r
+  IN EFI_SECURITY_ARCH_PROTOCOL     *This,\r
+  IN  UINT32                        AuthenticationStatus,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL      *File\r
+  )\r
+;\r
+\r
+//\r
+// Interface stucture for the Timer Architectural Protocol\r
+//\r
+/**\r
+  @par Protocol Description:\r
+\r
+  The EFI_SECURITY_ARCH_PROTOCOL is used to abstract platform-specific policy\r
+  from the DXE core.  This includes locking flash upon failure to authenticate, \r
+  attestation logging, and other exception operations.\r
+\r
+  The driver that produces the EFI_SECURITY_ARCH_PROTOCOL may also optionally \r
+  install the EFI_SECURITY_POLICY_PROTOCOL_GUID onto a new handle with a NULL \r
+  interface.  The existence of this GUID in the protocol database means that \r
+  the GUIDed Section Extraction Protocol should authenticate the contents of \r
+  an Authentication Section.  The expectation is that the GUIDed Section \r
+  Extraction protocol will look for the existence of the EFI_SECURITY_POLICY_ \r
+  PROTOCOL_GUID in the protocol database.  If it exists, then the publication \r
+  thereof is taken as an injunction to attempt an authentication of any section \r
+  wrapped in an Authentication Section.  See the Firmware File System \r
+  Specification for details on the GUIDed Section Extraction Protocol and \r
+  Authentication Sections.\r
+\r
+  @par Protocol Parameters:\r
+\r
+  FileAuthenticationState - This service is called upon fault with respect to \r
+  the authentication of a section of a file.\r
+\r
+**/\r
+struct _EFI_SECURITY_ARCH_PROTOCOL {\r
+  EFI_SECURITY_FILE_AUTHENTICATION_STATE  FileAuthenticationState;\r
+};\r
+\r
+extern EFI_GUID gEfiSecurityArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SecurityPolicy.h b/MdePkg/Include/Protocol/SecurityPolicy.h
new file mode 100644 (file)
index 0000000..b46267e
--- /dev/null
@@ -0,0 +1,31 @@
+/** @file\r
+  Security Policy protocol as defined in the DXE CIS\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SecurityPolicy.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef _SECURITY_POLICY_H_\r
+#define _SECURITY_POLICY_H_\r
+\r
+//\r
+// Security policy protocol GUID definition\r
+//\r
+#define EFI_SECURITY_POLICY_PROTOCOL_GUID  \\r
+  {0x78E4D245, 0xCD4D, 0x4a05, {0xA2, 0xBA, 0x47, 0x43, 0xE8, 0x6C, 0xFC, 0xAB} }\r
+\r
+extern EFI_GUID gEfiSecurityPolicyProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SerialIo.h b/MdePkg/Include/Protocol/SerialIo.h
new file mode 100644 (file)
index 0000000..89a7340
--- /dev/null
@@ -0,0 +1,266 @@
+/** @file\r
+  Serial IO protocol as defined in the EFI 1.0 specification.\r
+\r
+  Abstraction of a basic serial device. Targeted at 16550 UART, but\r
+  could be much more generic.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SerialIo.h\r
+\r
+**/\r
+\r
+#ifndef __SERIAL_IO_PROTOCOL_H__\r
+#define __SERIAL_IO_PROTOCOL_H__\r
+\r
+#define EFI_SERIAL_IO_PROTOCOL_GUID \\r
+  { \\r
+    0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD } \\r
+  }\r
+\r
+typedef struct _EFI_SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL;\r
+\r
+//\r
+// Serial IO Data structures\r
+//\r
+typedef enum {\r
+  DefaultParity,\r
+  NoParity,\r
+  EvenParity,\r
+  OddParity,\r
+  MarkParity,\r
+  SpaceParity\r
+} EFI_PARITY_TYPE;\r
+\r
+typedef enum {\r
+  DefaultStopBits,\r
+  OneStopBit,\r
+  OneFiveStopBits,\r
+  TwoStopBits\r
+} EFI_STOP_BITS_TYPE;\r
+\r
+//\r
+// define for Control bits, grouped by read only, write only, and read write\r
+//\r
+//\r
+// Read Only\r
+//\r
+#define EFI_SERIAL_CLEAR_TO_SEND        0x00000010\r
+#define EFI_SERIAL_DATA_SET_READY       0x00000020\r
+#define EFI_SERIAL_RING_INDICATE        0x00000040\r
+#define EFI_SERIAL_CARRIER_DETECT       0x00000080\r
+#define EFI_SERIAL_INPUT_BUFFER_EMPTY   0x00000100\r
+#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY  0x00000200\r
+\r
+//\r
+// Write Only\r
+//\r
+#define EFI_SERIAL_REQUEST_TO_SEND      0x00000002\r
+#define EFI_SERIAL_DATA_TERMINAL_READY  0x00000001\r
+\r
+//\r
+// Read Write\r
+//\r
+#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE     0x00001000\r
+#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE     0x00002000\r
+#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x00004000\r
+\r
+//\r
+// Serial IO Member Functions\r
+//\r
+/**\r
+  Reset the serial device.\r
+\r
+  @param  This              Protocol instance pointer.\r
+                            \r
+  @retval EFI_SUCCESS       The device was reset.\r
+  @retval EFI_DEVICE_ERROR  The serial device could not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERIAL_RESET) (\r
+  IN EFI_SERIAL_IO_PROTOCOL *This\r
+  )\r
+;\r
+\r
+/**\r
+  Sets the baud rate, receive FIFO depth, transmit/receice time out, parity, \r
+  data buts, and stop bits on a serial device.\r
+\r
+  @param  This             Protocol instance pointer.\r
+  @param  BaudRate         The requested baud rate. A BaudRate value of 0 will use the the\r
+                           device's default interface speed.\r
+  @param  ReveiveFifoDepth The requested depth of the FIFO on the receive side of the\r
+                           serial interface. A ReceiveFifoDepth value of 0 will use\r
+                           the device's dfault FIFO depth.\r
+  @param  Timeout          The requested time out for a single character in microseconds.\r
+                           This timeout applies to both the transmit and receive side of the\r
+                           interface. A Timeout value of 0 will use the device's default time\r
+                           out value.\r
+  @param  Parity           The type of parity to use on this serial device. A Parity value of\r
+                           DefaultParity will use the device's default parity value.\r
+  @param  DataBits         The number of data bits to use on the serial device. A DataBits\r
+                           vaule of 0 will use the device's default data bit setting.\r
+  @param  StopBits         The number of stop bits to use on this serial device. A StopBits\r
+                           value of DefaultStopBits will use the device's default number of\r
+                           stop bits.\r
+\r
+  @retval EFI_SUCCESS      The device was reset.\r
+  @retval EFI_DEVICE_ERROR The serial device could not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) (\r
+  IN EFI_SERIAL_IO_PROTOCOL         *This,\r
+  IN UINT64                         BaudRate,\r
+  IN UINT32                         ReceiveFifoDepth,\r
+  IN UINT32                         Timeout,\r
+  IN EFI_PARITY_TYPE                Parity,\r
+  IN UINT8                          DataBits,\r
+  IN EFI_STOP_BITS_TYPE             StopBits\r
+  )\r
+;\r
+\r
+/**\r
+  Set the control bits on a serial device\r
+\r
+  @param  This             Protocol instance pointer.\r
+  @param  Control          Set the bits of Control that are settable.\r
+\r
+  @retval EFI_SUCCESS      The new control bits were set on the serial device.\r
+  @retval EFI_UNSUPPORTED  The serial device does not support this operation.\r
+  @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) (\r
+  IN EFI_SERIAL_IO_PROTOCOL         *This,\r
+  IN UINT32                         Control\r
+  )\r
+;\r
+\r
+/**\r
+  Retrieves the status of thecontrol bits on a serial device\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  Control           A pointer to return the current Control signals from the serial device.\r
+                            \r
+  @retval EFI_SUCCESS       The control bits were read from the serial device.\r
+  @retval EFI_DEVICE_ERROR  The serial device is not functioning correctly.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) (\r
+  IN EFI_SERIAL_IO_PROTOCOL         *This,\r
+  OUT UINT32                        *Control\r
+  )\r
+;\r
+\r
+/**\r
+  Writes data to a serial device.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  BufferSize        On input, the size of the Buffer. On output, the amount of\r
+                            data actually written.\r
+  @param  Buffer            The buffer of data to write\r
+\r
+  @retval EFI_SUCCESS       The data was written.\r
+  @retval EFI_DEVICE_ERROR  The device reported an error.\r
+  @retval EFI_TIMEOUT       The data write was stopped due to a timeout.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERIAL_WRITE) (\r
+  IN EFI_SERIAL_IO_PROTOCOL         *This,\r
+  IN OUT UINTN                      *BufferSize,\r
+  IN VOID                           *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Writes data to a serial device.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  BufferSize        On input, the size of the Buffer. On output, the amount of\r
+                            data returned in Buffer.\r
+  @param  Buffer            The buffer to return the data into.\r
+\r
+  @retval EFI_SUCCESS       The data was read.\r
+  @retval EFI_DEVICE_ERROR  The device reported an error.\r
+  @retval EFI_TIMEOUT       The data write was stopped due to a timeout.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERIAL_READ) (\r
+  IN EFI_SERIAL_IO_PROTOCOL         *This,\r
+  IN OUT UINTN                      *BufferSize,\r
+  OUT VOID                          *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  The data values in SERIAL_IO_MODE are read-only and are updated by the code \r
+  that produces the SERIAL_IO_PROTOCOL member functions.\r
+\r
+  ControlMask - A mask fo the Control bits that the device supports. The device\r
+  must always support the Input Buffer Empty control bit.\r
+  TimeOut  - If applicable, the number of microseconds to wait before timing out\r
+  a Read or Write operation.\r
+  BaudRate - If applicable, the current baud rate setting of the device; otherwise,\r
+  baud rate has the value of zero to indicate that device runs at the\r
+  device's designed speed.\r
+  ReceiveFifoDepth - The number of characters the device will buffer on input\r
+  DataBits - The number of characters the device will buffer on input\r
+  Parity   - If applicable, this is the EFI_PARITY_TYPE that is computed or \r
+  checked as each character is transmitted or reveived. If the device\r
+  does not support parity the value is the default parity value.\r
+  StopBits - If applicable, the EFI_STOP_BITS_TYPE number of stop bits per\r
+  character. If the device does not support stop bits the value is\r
+  the default stop bit values.\r
+\r
+**/\r
+typedef struct {\r
+  UINT32  ControlMask;\r
+\r
+  //\r
+  // current Attributes\r
+  //\r
+  UINT32  Timeout;\r
+  UINT64  BaudRate;\r
+  UINT32  ReceiveFifoDepth;\r
+  UINT32  DataBits;\r
+  UINT32  Parity;\r
+  UINT32  StopBits;\r
+} EFI_SERIAL_IO_MODE;\r
+\r
+#define SERIAL_IO_INTERFACE_REVISION    0x00010000\r
+#define EFI_SERIAL_IO_PROTOCOL_REVISION SERIAL_IO_INTERFACE_REVISION\r
+\r
+struct _EFI_SERIAL_IO_PROTOCOL {\r
+  UINT32                      Revision;\r
+  EFI_SERIAL_RESET            Reset;\r
+  EFI_SERIAL_SET_ATTRIBUTES   SetAttributes;\r
+  EFI_SERIAL_SET_CONTROL_BITS SetControl;\r
+  EFI_SERIAL_GET_CONTROL_BITS GetControl;\r
+  EFI_SERIAL_WRITE            Write;\r
+  EFI_SERIAL_READ             Read;\r
+\r
+  EFI_SERIAL_IO_MODE          *Mode;\r
+};\r
+\r
+extern EFI_GUID gEfiSerialIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/ServiceBinding.h b/MdePkg/Include/Protocol/ServiceBinding.h
new file mode 100644 (file)
index 0000000..57ce92f
--- /dev/null
@@ -0,0 +1,74 @@
+/** @file\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  ServiceBinding.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_SERVICE_BINDING_H__\r
+#define __EFI_SERVICE_BINDING_H__\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_SERVICE_BINDING_PROTOCOL EFI_SERVICE_BINDING_PROTOCOL;\r
+\r
+/**\r
+  Creates a child handle with a set of I/O services.\r
+\r
+  @param  This        Protocol instance pointer.\r
+  @param  ChildHandle Pointer to the handle of the child to create.  If it is NULL,\r
+                      then a new handle is created.  If it is not NULL, then the\r
+                      I/O services are added to the existing child handle.\r
+\r
+  @retval EFI_SUCCES            The child handle was created with the I/O services\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create\r
+                                the child\r
+  @retval other                 The child handle was not created\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) (\r
+  IN     EFI_SERVICE_BINDING_PROTOCOL  *This,\r
+  IN OUT EFI_HANDLE                    *ChildHandle\r
+  )\r
+;\r
+\r
+/**\r
+  Destroys a child handle with a set of I/O services.\r
+\r
+  @param  This        Protocol instance pointer.\r
+  @param  ChildHandle Handle of the child to destroy\r
+\r
+  @retval EFI_SUCCES            The I/O services were removed from the child handle\r
+  @retval EFI_UNSUPPORTED       The child handle does not support the I/O services\r
+                                that are being removed.\r
+  @retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.\r
+  @retval EFI_ACCESS_DENIED     The child handle could not be destroyed because its\r
+                                I/O services are being used.\r
+  @retval other                 The child handle was not destroyed\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) (\r
+  IN EFI_SERVICE_BINDING_PROTOCOL          *This,\r
+  IN EFI_HANDLE                            ChildHandle\r
+  )\r
+;\r
+\r
+struct _EFI_SERVICE_BINDING_PROTOCOL {\r
+  EFI_SERVICE_BINDING_CREATE_CHILD         CreateChild;\r
+  EFI_SERVICE_BINDING_DESTROY_CHILD        DestroyChild;\r
+};\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SimpleFileSystem.h b/MdePkg/Include/Protocol/SimpleFileSystem.h
new file mode 100644 (file)
index 0000000..add8ad6
--- /dev/null
@@ -0,0 +1,328 @@
+/** @file\r
+  SimpleFileSystem protocol as defined in the EFI 1.0 specification.\r
+\r
+  The SimpleFileSystem protocol is the programatic access to the FAT (12,16,32) \r
+  file system specified in EFI 1.0. It can also be used to abstract a file  \r
+  system other than FAT.\r
+\r
+  EFI 1.0 can boot from any valid EFI image contained in a SimpleFileSystem\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SimpleFileSystem.h\r
+\r
+**/\r
+\r
+#ifndef __SIMPLE_FILE_SYSTEM_H__\r
+#define __SIMPLE_FILE_SYSTEM_H__\r
+\r
+#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \\r
+  { \\r
+    0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;\r
+typedef struct _EFI_FILE  EFI_FILE;\r
+typedef struct _EFI_FILE  *EFI_FILE_HANDLE;\r
+typedef struct _EFI_FILE  EFI_FILE_PROTOCOL;\r
+\r
+/**\r
+  Open the root directory on a volume.\r
+\r
+  @param  This Protocol instance pointer.\r
+  @param  Root Returns an Open file handle for the root directory\r
+\r
+  @retval EFI_SUCCESS          The device was opened.\r
+  @retval EFI_UNSUPPORTED      This volume does not suppor the file system.\r
+  @retval EFI_NO_MEDIA         The device has no media.\r
+  @retval EFI_DEVICE_ERROR     The device reported an error.\r
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
+  @retval EFI_ACCESS_DENIED    The service denied access to the file\r
+  @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME) (\r
+  IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL    *This,\r
+  OUT EFI_FILE                          **Root\r
+  )\r
+;\r
+\r
+#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION  0x00010000\r
+\r
+struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {\r
+  UINT64                                      Revision;\r
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume;\r
+};\r
+\r
+/**\r
+  Open the root directory on a volume.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  NewHandle  Returns File Handle for FileName\r
+  @param  FileName   Null terminated string. "\", ".", and ".." are supported\r
+  @param  OpenMode   Open mode for file.\r
+  @param  Attributes Only used for EFI_FILE_MODE_CREATE\r
+\r
+  @retval EFI_SUCCESS          The device was opened.\r
+  @retval EFI_NOT_FOUND        The specified file could not be found on the device\r
+  @retval EFI_NO_MEDIA         The device has no media.\r
+  @retval EFI_MEDIA_CHANGED    The media has changed\r
+  @retval EFI_DEVICE_ERROR     The device reported an error.\r
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
+  @retval EFI_ACCESS_DENIED    The service denied access to the file\r
+  @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources\r
+  @retval EFI_VOLUME_FULL      The volume is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_OPEN) (\r
+  IN EFI_FILE                 *This,\r
+  OUT EFI_FILE                **NewHandle,\r
+  IN CHAR16                   *FileName,\r
+  IN UINT64                   OpenMode,\r
+  IN UINT64                   Attributes\r
+  )\r
+;\r
+\r
+//\r
+// Open modes\r
+//\r
+#define EFI_FILE_MODE_READ    0x0000000000000001ULL\r
+#define EFI_FILE_MODE_WRITE   0x0000000000000002ULL\r
+#define EFI_FILE_MODE_CREATE  0x8000000000000000ULL\r
+\r
+//\r
+// File attributes\r
+//\r
+#define EFI_FILE_READ_ONLY  0x0000000000000001ULL\r
+#define EFI_FILE_HIDDEN     0x0000000000000002ULL\r
+#define EFI_FILE_SYSTEM     0x0000000000000004ULL\r
+#define EFI_FILE_RESERVED   0x0000000000000008ULL\r
+#define EFI_FILE_DIRECTORY  0x0000000000000010ULL\r
+#define EFI_FILE_ARCHIVE    0x0000000000000020ULL\r
+#define EFI_FILE_VALID_ATTR 0x0000000000000037ULL\r
+\r
+/**\r
+  Close the file handle\r
+\r
+  @param  This          Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS   The device was opened.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_CLOSE) (\r
+  IN EFI_FILE  *This\r
+  )\r
+;\r
+\r
+/**\r
+  Close and delete the file handle\r
+\r
+  @param  This                     Protocol instance pointer.\r
+                                   \r
+  @retval EFI_SUCCESS              The device was opened.\r
+  @retval EFI_WARN_DELETE_FAILURE  The handle was closed but the file was not deleted\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_DELETE) (\r
+  IN EFI_FILE  *This\r
+  )\r
+;\r
+\r
+/**\r
+  Read data from the file.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  BufferSize On input size of buffer, on output amount of data in buffer.\r
+  @param  Buffer     The buffer in which data is read.\r
+\r
+  @retval EFI_SUCCESS          Data was read.\r
+  @retval EFI_NO_MEDIA         The device has no media\r
+  @retval EFI_DEVICE_ERROR     The device reported an error\r
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
+  @retval EFI_BUFFER_TO_SMALL  BufferSize is too small. BufferSize contains required size\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_READ) (\r
+  IN EFI_FILE                 *This,\r
+  IN OUT UINTN                *BufferSize,\r
+  OUT VOID                    *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Write data from to the file.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  BufferSize On input size of buffer, on output amount of data in buffer.\r
+  @param  Buffer     The buffer in which data to write.\r
+\r
+  @retval EFI_SUCCESS          Data was written.\r
+  @retval EFI_UNSUPPORT        Writes to Open directory are not supported\r
+  @retval EFI_NO_MEDIA         The device has no media\r
+  @retval EFI_DEVICE_ERROR     The device reported an error\r
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
+  @retval EFI_WRITE_PROTECTED  The device is write protected\r
+  @retval EFI_ACCESS_DENIED    The file was open for read only\r
+  @retval EFI_VOLUME_FULL      The volume is full\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_WRITE) (\r
+  IN EFI_FILE                 *This,\r
+  IN OUT UINTN                *BufferSize,\r
+  IN VOID                     *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Set a files current position\r
+\r
+  @param  This            Protocol instance pointer.\r
+  @param  Position        Byte possition from the start of the file\r
+                          \r
+  @retval EFI_SUCCESS     Data was written.\r
+  @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_SET_POSITION) (\r
+  IN EFI_FILE                 *This,\r
+  IN UINT64                   Position\r
+  )\r
+;\r
+\r
+/**\r
+  Get a files current position\r
+\r
+  @param  This            Protocol instance pointer.\r
+  @param  Position        Byte possition from the start of the file\r
+                          \r
+  @retval EFI_SUCCESS     Data was written.\r
+  @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_GET_POSITION) (\r
+  IN EFI_FILE                 *This,\r
+  OUT UINT64                  *Position\r
+  )\r
+;\r
+\r
+/**\r
+  Get information about a file\r
+\r
+  @param  This            Protocol instance pointer.\r
+  @param  InformationType Type of info to return in Buffer\r
+  @param  BufferSize      On input size of buffer, on output amount of data in buffer.\r
+  @param  Buffer          The buffer to return data.\r
+\r
+  @retval EFI_SUCCESS          Data was returned.\r
+  @retval EFI_UNSUPPORT        InformationType is not supported\r
+  @retval EFI_NO_MEDIA         The device has no media\r
+  @retval EFI_DEVICE_ERROR     The device reported an error\r
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
+  @retval EFI_WRITE_PROTECTED  The device is write protected\r
+  @retval EFI_ACCESS_DENIED    The file was open for read only\r
+  @retval EFI_BUFFER_TOO_SMALL Buffer was too small, required size returned in BufferSize\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_GET_INFO) (\r
+  IN EFI_FILE                 *This,\r
+  IN EFI_GUID                 *InformationType,\r
+  IN OUT UINTN                *BufferSize,\r
+  OUT VOID                    *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Set information about a file\r
+\r
+  @param  File            Protocol instance pointer.\r
+  @param  InformationType Type of info in Buffer\r
+  @param  BufferSize      Size of buffer.\r
+  @param  Buffer          The data to write.\r
+\r
+  @retval EFI_SUCCESS          Data was returned.\r
+  @retval EFI_UNSUPPORT        InformationType is not supported\r
+  @retval EFI_NO_MEDIA         The device has no media\r
+  @retval EFI_DEVICE_ERROR     The device reported an error\r
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
+  @retval EFI_WRITE_PROTECTED  The device is write protected\r
+  @retval EFI_ACCESS_DENIED    The file was open for read only\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_SET_INFO) (\r
+  IN EFI_FILE                 *This,\r
+  IN EFI_GUID                 *InformationType,\r
+  IN UINTN                    BufferSize,\r
+  IN VOID                     *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Flush data back for the file handle\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS          Data was written.\r
+  @retval EFI_UNSUPPORT        Writes to Open directory are not supported\r
+  @retval EFI_NO_MEDIA         The device has no media\r
+  @retval EFI_DEVICE_ERROR     The device reported an error\r
+  @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
+  @retval EFI_WRITE_PROTECTED  The device is write protected\r
+  @retval EFI_ACCESS_DENIED    The file was open for read only\r
+  @retval EFI_VOLUME_FULL      The volume is full\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_FILE_FLUSH) (\r
+  IN EFI_FILE  *This\r
+  )\r
+;\r
+\r
+#define EFI_FILE_HANDLE_REVISION   0x00010000\r
+#define EFI_FILE_PROTOCOL_REVISION EFI_FILE_HANDLE_REVISION\r
+\r
+struct _EFI_FILE {\r
+  UINT64                Revision;\r
+  EFI_FILE_OPEN         Open;\r
+  EFI_FILE_CLOSE        Close;\r
+  EFI_FILE_DELETE       Delete;\r
+  EFI_FILE_READ         Read;\r
+  EFI_FILE_WRITE        Write;\r
+  EFI_FILE_GET_POSITION GetPosition;\r
+  EFI_FILE_SET_POSITION SetPosition;\r
+  EFI_FILE_GET_INFO     GetInfo;\r
+  EFI_FILE_SET_INFO     SetInfo;\r
+  EFI_FILE_FLUSH        Flush;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SimpleNetwork.h b/MdePkg/Include/Protocol/SimpleNetwork.h
new file mode 100644 (file)
index 0000000..0da64bb
--- /dev/null
@@ -0,0 +1,580 @@
+/** @file\r
+  Simple Network protocol as defined in the EFI 1.0 specification.\r
+\r
+  Basic network device abstraction.\r
+\r
+  Rx    - Received\r
+  Tx    - Transmit\r
+  MCast - MultiCast\r
+  ...\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SimpleNetwork.h\r
+\r
+**/\r
+\r
+#ifndef __SIMPLE_NETWORK_H__\r
+#define __SIMPLE_NETWORK_H__\r
+\r
+#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \\r
+  { \\r
+    0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } \\r
+  }\r
+\r
+typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL  EFI_SIMPLE_NETWORK_PROTOCOL;\r
+\r
+//\r
+// Simple Network Protocol data structures\r
+//\r
+typedef struct {\r
+  //\r
+  // Total number of frames received.  Includes frames with errors and\r
+  // dropped frames.\r
+  //\r
+  UINT64  RxTotalFrames;\r
+\r
+  //\r
+  // Number of valid frames received and copied into receive buffers.\r
+  //\r
+  UINT64  RxGoodFrames;\r
+\r
+  //\r
+  // Number of frames below the minimum length for the media.\r
+  // This would be <64 for ethernet.\r
+  //\r
+  UINT64  RxUndersizeFrames;\r
+\r
+  //\r
+  // Number of frames longer than the maxminum length for the\r
+  // media.  This would be >1500 for ethernet.\r
+  //\r
+  UINT64  RxOversizeFrames;\r
+\r
+  //\r
+  // Valid frames that were dropped because receive buffers were full.\r
+  //\r
+  UINT64  RxDroppedFrames;\r
+\r
+  //\r
+  // Number of valid unicast frames received and not dropped.\r
+  //\r
+  UINT64  RxUnicastFrames;\r
+\r
+  //\r
+  // Number of valid broadcast frames received and not dropped.\r
+  //\r
+  UINT64  RxBroadcastFrames;\r
+\r
+  //\r
+  // Number of valid mutlicast frames received and not dropped.\r
+  //\r
+  UINT64  RxMulticastFrames;\r
+\r
+  //\r
+  // Number of frames w/ CRC or alignment errors.\r
+  //\r
+  UINT64  RxCrcErrorFrames;\r
+\r
+  //\r
+  // Total number of bytes received.  Includes frames with errors\r
+  // and dropped frames.\r
+  //\r
+  UINT64  RxTotalBytes;\r
+\r
+  //\r
+  // Transmit statistics.\r
+  //\r
+  UINT64  TxTotalFrames;\r
+  UINT64  TxGoodFrames;\r
+  UINT64  TxUndersizeFrames;\r
+  UINT64  TxOversizeFrames;\r
+  UINT64  TxDroppedFrames;\r
+  UINT64  TxUnicastFrames;\r
+  UINT64  TxBroadcastFrames;\r
+  UINT64  TxMulticastFrames;\r
+  UINT64  TxCrcErrorFrames;\r
+  UINT64  TxTotalBytes;\r
+\r
+  //\r
+  // Number of collisions detection on this subnet.\r
+  //\r
+  UINT64  Collisions;\r
+\r
+  //\r
+  // Number of frames destined for unsupported protocol.\r
+  //\r
+  UINT64  UnsupportedProtocol;\r
+\r
+} EFI_NETWORK_STATISTICS;\r
+\r
+typedef enum {\r
+  EfiSimpleNetworkStopped,\r
+  EfiSimpleNetworkStarted,\r
+  EfiSimpleNetworkInitialized,\r
+  EfiSimpleNetworkMaxState\r
+} EFI_SIMPLE_NETWORK_STATE;\r
+\r
+#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST                0x01\r
+#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST              0x02\r
+#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST              0x04\r
+#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS            0x08\r
+#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST  0x10\r
+\r
+#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT              0x01\r
+#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT             0x02\r
+#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT              0x04\r
+#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT             0x08\r
+\r
+#define MAX_MCAST_FILTER_CNT                              16\r
+typedef struct {\r
+  UINT32          State;\r
+  UINT32          HwAddressSize;\r
+  UINT32          MediaHeaderSize;\r
+  UINT32          MaxPacketSize;\r
+  UINT32          NvRamSize;\r
+  UINT32          NvRamAccessSize;\r
+  UINT32          ReceiveFilterMask;\r
+  UINT32          ReceiveFilterSetting;\r
+  UINT32          MaxMCastFilterCount;\r
+  UINT32          MCastFilterCount;\r
+  EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];\r
+  EFI_MAC_ADDRESS CurrentAddress;\r
+  EFI_MAC_ADDRESS BroadcastAddress;\r
+  EFI_MAC_ADDRESS PermanentAddress;\r
+  UINT8           IfType;\r
+  BOOLEAN         MacAddressChangeable;\r
+  BOOLEAN         MultipleTxSupported;\r
+  BOOLEAN         MediaPresentSupported;\r
+  BOOLEAN         MediaPresent;\r
+} EFI_SIMPLE_NETWORK_MODE;\r
+\r
+//\r
+// Protocol Member Functions\r
+//\r
+/**\r
+  Changes the state of a network interface from "stopped" to "started".\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS           The network interface was started.\r
+  @retval EFI_ALREADY_STARTED   The network interface is already in the started state.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_START) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  *This\r
+  )\r
+;\r
+\r
+/**\r
+  Changes the state of a network interface from "started" to "stopped".\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS           The network interface was stopped.\r
+  @retval EFI_ALREADY_STARTED   The network interface is already in the stopped state.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_STOP) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  *This\r
+  )\r
+;\r
+\r
+/**\r
+  Resets a network adapter and allocates the transmit and receive buffers \r
+  required by the network interface; optionally, also requests allocation \r
+  of additional transmit and receive buffers.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  ExtraRxBufferSize The size, in bytes, of the extra receive buffer space\r
+                            that the driver should allocate for the network interface.\r
+                            Some network interfaces will not be able to use the extra\r
+                            buffer, and the caller will not know if it is actually\r
+                            being used.\r
+  @param  ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space\r
+                            that the driver should allocate for the network interface.\r
+                            Some network interfaces will not be able to use the extra\r
+                            buffer, and the caller will not know if it is actually\r
+                            being used.\r
+\r
+  @retval EFI_SUCCESS           The network interface was initialized.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started\r
+  @retval EFI_OUT_OF_RESOURCES  There was not enough memory for the transmit and\r
+                                receive buffers.   .\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL                    *This,\r
+  IN UINTN                                          ExtraRxBufferSize  OPTIONAL,\r
+  IN UINTN                                          ExtraTxBufferSize  OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Resets a network adapter and re-initializes it with the parameters that were \r
+  provided in the previous call to Initialize().  \r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ExtendedVerification Indicates that the driver may perform a more\r
+                               exhaustive verification operation of the device\r
+                               during reset.\r
+\r
+  @retval EFI_SUCCESS           The network interface was reset.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_RESET) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL   *This,\r
+  IN BOOLEAN                       ExtendedVerification\r
+  )\r
+;\r
+\r
+/**\r
+  Resets a network adapter and leaves it in a state that is safe for \r
+  another driver to initialize.\r
+\r
+  @param  This Protocol instance pointer.\r
+\r
+  @retval EFI_SUCCESS           The network interface was shutdown.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL  *This\r
+  )\r
+;\r
+\r
+/**\r
+  Manages the multicast receive filters of a network interface.\r
+\r
+  @param  This             Protocol instance pointer.\r
+  @param  Enable           A bit mask of receive filters to enable on the network interface.\r
+  @param  Disable          A bit mask of receive filters to disable on the network interface.\r
+  @param  ResetMCastFilter Set to TRUE to reset the contents of the multicast receive\r
+                           filters on the network interface to their default values.\r
+  @param  McastFilterCnt   Number of multicast HW MAC addresses in the new\r
+                           MCastFilter list. This value must be less than or equal to\r
+                           the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This\r
+                           field is optional if ResetMCastFilter is TRUE.\r
+  @param  MCastFilter      A pointer to a list of new multicast receive filter HW MAC\r
+                           addresses. This list will replace any existing multicast\r
+                           HW MAC address list. This field is optional if\r
+                           ResetMCastFilter is TRUE.\r
+\r
+  @retval EFI_SUCCESS           The multicast receive filter list was updated.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL                             *This,\r
+  IN UINT32                                                  Enable,\r
+  IN UINT32                                                  Disable,\r
+  IN BOOLEAN                                                 ResetMCastFilter,\r
+  IN UINTN                                                   MCastFilterCnt     OPTIONAL,\r
+  IN EFI_MAC_ADDRESS                                         *MCastFilter OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Modifies or resets the current station address, if supported.\r
+\r
+  @param  This  Protocol instance pointer.\r
+  @param  Reset Flag used to reset the station address to the network interfaces\r
+                permanent address.\r
+  @param  New   New station address to be used for the network interface.\r
+\r
+  @retval EFI_SUCCESS           The network interfaces station address was updated.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL            *This,\r
+  IN BOOLEAN                                Reset,\r
+  IN EFI_MAC_ADDRESS                        *New OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Resets or collects the statistics on a network interface.\r
+\r
+  @param  This            Protocol instance pointer.\r
+  @param  Reset           Set to TRUE to reset the statistics for the network interface.\r
+  @param  StatisticsSize  On input the size, in bytes, of StatisticsTable. On\r
+                          output the size, in bytes, of the resulting table of\r
+                          statistics.\r
+  @param  StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that\r
+                          contains the statistics.\r
+\r
+  @retval EFI_SUCCESS           The statistics were collected from the network interface.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer\r
+                                size needed to hold the statistics is returned in\r
+                                StatisticsSize.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,\r
+  IN BOOLEAN                              Reset,\r
+  IN OUT UINTN                            *StatisticsSize   OPTIONAL,\r
+  OUT EFI_NETWORK_STATISTICS              *StatisticsTable  OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Converts a multicast IP address to a multicast HW MAC address.\r
+\r
+  @param  This Protocol instance pointer.\r
+  @param  IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set\r
+               to FALSE if the multicast IP address is IPv4 [RFC 791].\r
+  @param  IP   The multicast IP address that is to be converted to a multicast\r
+               HW MAC address.\r
+  @param  MAC  The multicast HW MAC address that is to be generated from IP.\r
+\r
+  @retval EFI_SUCCESS           The multicast IP address was mapped to the multicast\r
+                                HW MAC address.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer\r
+                                size needed to hold the statistics is returned in\r
+                                StatisticsSize.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,\r
+  IN BOOLEAN                              IPv6,\r
+  IN EFI_IP_ADDRESS                       *IP,\r
+  OUT EFI_MAC_ADDRESS                     *MAC\r
+  )\r
+;\r
+\r
+/**\r
+  Performs read and write operations on the NVRAM device attached to a \r
+  network interface.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  ReadWrite  TRUE for read operations, FALSE for write operations.\r
+  @param  Offset     Byte offset in the NVRAM device at which to start the read or\r
+                     write operation. This must be a multiple of NvRamAccessSize and\r
+                     less than NvRamSize.\r
+  @param  BufferSize The number of bytes to read or write from the NVRAM device.\r
+                     This must also be a multiple of NvramAccessSize.\r
+  @param  Buffer     A pointer to the data buffer.\r
+\r
+  @retval EFI_SUCCESS           The NVRAM access was performed.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,\r
+  IN BOOLEAN                              ReadWrite,\r
+  IN UINTN                                Offset,\r
+  IN UINTN                                BufferSize,\r
+  IN OUT VOID                             *Buffer\r
+  )\r
+;\r
+\r
+/**\r
+  Reads the current interrupt status and recycled transmit buffer status from \r
+  a network interface.\r
+\r
+  @param  This            Protocol instance pointer.\r
+  @param  InterruptStatus A pointer to the bit mask of the currently active interrupts\r
+                          If this is NULL, the interrupt status will not be read from\r
+                          the device. If this is not NULL, the interrupt status will\r
+                          be read from the device. When the  interrupt status is read,\r
+                          it will also be cleared. Clearing the transmit  interrupt\r
+                          does not empty the recycled transmit buffer array.\r
+  @param  TxBuf           Recycled transmit buffer address. The network interface will\r
+                          not transmit if its internal recycled transmit buffer array\r
+                          is full. Reading the transmit buffer does not clear the\r
+                          transmit interrupt. If this is NULL, then the transmit buffer\r
+                          status will not be read. If there are no transmit buffers to\r
+                          recycle and TxBuf is not NULL, * TxBuf will be set to NULL.\r
+\r
+  @retval EFI_SUCCESS           The status of the network interface was retrieved.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,\r
+  OUT UINT32                              *InterruptStatus OPTIONAL,\r
+  OUT VOID                                **TxBuf OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Places a packet in the transmit queue of a network interface.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  HeaderSize The size, in bytes, of the media header to be filled in by\r
+                     the Transmit() function. If HeaderSize is non-zero, then it\r
+                     must be equal to This->Mode->MediaHeaderSize and the DestAddr\r
+                     and Protocol parameters must not be NULL.\r
+  @param  BufferSize The size, in bytes, of the entire packet (media header and\r
+                     data) to be transmitted through the network interface.\r
+  @param  Buffer     A pointer to the packet (media header followed by data) to be\r
+                     transmitted. This parameter cannot be NULL. If HeaderSize is zero,\r
+                     then the media header in Buffer must already be filled in by the\r
+                     caller. If HeaderSize is non-zero, then the media header will be\r
+                     filled in by the Transmit() function.\r
+  @param  SrcAddr    The source HW MAC address. If HeaderSize is zero, then this parameter\r
+                     is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then\r
+                     This->Mode->CurrentAddress is used for the source HW MAC address.\r
+  @param  DsetAddr   The destination HW MAC address. If HeaderSize is zero, then this\r
+                     parameter is ignored.\r
+  @param  Protocol   The type of header to build. If HeaderSize is zero, then this\r
+                     parameter is ignored. See RFC 1700, section "Ether Types", for\r
+                     examples.\r
+\r
+  @retval EFI_SUCCESS           The packet was placed on the transmit queue.\r
+  @retval EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval EFI_NOT_READY         The network interface is too busy to accept this transmit request.                      \r
+  @retval EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.\r
+  @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,\r
+  IN UINTN                                HeaderSize,\r
+  IN UINTN                                BufferSize,\r
+  IN VOID                                 *Buffer,\r
+  IN EFI_MAC_ADDRESS                      *SrcAddr  OPTIONAL,\r
+  IN EFI_MAC_ADDRESS                      *DestAddr OPTIONAL,\r
+  IN UINT16                               *Protocol OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Receives a packet from a network interface.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  HeaderSize The size, in bytes, of the media header received on the network\r
+                     interface. If this parameter is NULL, then the media header size\r
+                     will not be returned.\r
+  @param  BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in\r
+                     bytes, of the packet that was received on the network interface.\r
+  @param  Buffer     A pointer to the data buffer to receive both the media header and\r
+                     the data.\r
+  @param  SrcAddr    The source HW MAC address. If this parameter is NULL, the\r
+                     HW MAC source address will not be extracted from the media\r
+                     header.\r
+  @param  DsetAddr   The destination HW MAC address. If this parameter is NULL,\r
+                     the HW MAC destination address will not be extracted from the\r
+                     media header.\r
+  @param  Protocol   The media header type. If this parameter is NULL, then the\r
+                     protocol will not be extracted from the media header. See\r
+                     RFC 1700 section "Ether Types" for examples.\r
+\r
+  @retval  EFI_SUCCESS           The received data was stored in Buffer, and BufferSize has\r
+                                 been updated to the number of bytes received.\r
+  @retval  EFI_NOT_STARTED       The network interface has not been started.\r
+  @retval  EFI_NOT_READY         The network interface is too busy to accept this transmit\r
+                                 request.\r
+  @retval  EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.\r
+  @retval  EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
+  @retval  EFI_DEVICE_ERROR      The command could not be sent to the network interface.\r
+  @retval  EFI_UNSUPPORTED       This function is not supported by the network interface.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) (\r
+  IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,\r
+  OUT UINTN                               *HeaderSize OPTIONAL,\r
+  IN OUT UINTN                            *BufferSize,\r
+  OUT VOID                                *Buffer,\r
+  OUT EFI_MAC_ADDRESS                     *SrcAddr    OPTIONAL,\r
+  OUT EFI_MAC_ADDRESS                     *DestAddr   OPTIONAL,\r
+  OUT UINT16                              *Protocol   OPTIONAL\r
+  )\r
+;\r
+\r
+#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION  0x00010000\r
+\r
+struct _EFI_SIMPLE_NETWORK_PROTOCOL {\r
+  UINT64                              Revision;\r
+  EFI_SIMPLE_NETWORK_START            Start;\r
+  EFI_SIMPLE_NETWORK_STOP             Stop;\r
+  EFI_SIMPLE_NETWORK_INITIALIZE       Initialize;\r
+  EFI_SIMPLE_NETWORK_RESET            Reset;\r
+  EFI_SIMPLE_NETWORK_SHUTDOWN         Shutdown;\r
+  EFI_SIMPLE_NETWORK_RECEIVE_FILTERS  ReceiveFilters;\r
+  EFI_SIMPLE_NETWORK_STATION_ADDRESS  StationAddress;\r
+  EFI_SIMPLE_NETWORK_STATISTICS       Statistics;\r
+  EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC  MCastIpToMac;\r
+  EFI_SIMPLE_NETWORK_NVDATA           NvData;\r
+  EFI_SIMPLE_NETWORK_GET_STATUS       GetStatus;\r
+  EFI_SIMPLE_NETWORK_TRANSMIT         Transmit;\r
+  EFI_SIMPLE_NETWORK_RECEIVE          Receive;\r
+  EFI_EVENT                           WaitForPacket;\r
+  EFI_SIMPLE_NETWORK_MODE             *Mode;\r
+};\r
+\r
+extern EFI_GUID gEfiSimpleNetworkProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SimplePointer.h b/MdePkg/Include/Protocol/SimplePointer.h
new file mode 100644 (file)
index 0000000..a0e0804
--- /dev/null
@@ -0,0 +1,97 @@
+/** @file\r
+  Simple Pointer protocol from the EFI 1.1 specification.\r
+\r
+  Abstraction of a very simple pointer device like a mice or tracekballs.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SimplePointer.h\r
+\r
+**/\r
+\r
+#ifndef __SIMPLE_POINTER_H__\r
+#define __SIMPLE_POINTER_H__\r
+\r
+#define EFI_SIMPLE_POINTER_PROTOCOL_GUID \\r
+  { \\r
+    0x31878c87, 0xb75, 0x11d5, {0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_SIMPLE_POINTER_PROTOCOL  EFI_SIMPLE_POINTER_PROTOCOL;\r
+\r
+//\r
+// Data structures\r
+//\r
+typedef struct {\r
+  INT32   RelativeMovementX;\r
+  INT32   RelativeMovementY;\r
+  INT32   RelativeMovementZ;\r
+  BOOLEAN LeftButton;\r
+  BOOLEAN RightButton;\r
+} EFI_SIMPLE_POINTER_STATE;\r
+\r
+typedef struct {\r
+  UINT64  ResolutionX;\r
+  UINT64  ResolutionY;\r
+  UINT64  ResolutionZ;\r
+  BOOLEAN LeftButton;\r
+  BOOLEAN RightButton;\r
+} EFI_SIMPLE_POINTER_MODE;\r
+\r
+/**                                                                 \r
+  Resets the pointer device hardware.\r
+    \r
+  @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL\r
+                                instance.                                   \r
+  @param  ExtendedVerification  Indicates that the driver may perform a more exhaustive\r
+                                verification operation of the device during reset.                                       \r
+                                \r
+  @retval EFI_SUCCESS           The device was reset.\r
+  @retval EFI_DEVICE_ERROR      The device is not functioning correctly and could not be reset.  \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_POINTER_RESET) (\r
+  IN EFI_SIMPLE_POINTER_PROTOCOL            *This,\r
+  IN BOOLEAN                                ExtendedVerification\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the current state of a pointer device.\r
+    \r
+  @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL\r
+                                instance.                                   \r
+  @param  State                 A pointer to the state information on the pointer device.\r
+                                \r
+  @retval EFI_SUCCESS           The state of the pointer device was returned in State.\r
+  @retval EFI_NOT_READY         The state of the pointer device has not changed since the last call to\r
+                                GetState().                                                           \r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to retrieve the pointer device's\r
+                                current state.                                                           \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) (\r
+  IN EFI_SIMPLE_POINTER_PROTOCOL          *This,\r
+  IN OUT EFI_SIMPLE_POINTER_STATE         *State\r
+  );\r
+\r
+struct _EFI_SIMPLE_POINTER_PROTOCOL {\r
+  EFI_SIMPLE_POINTER_RESET      Reset;\r
+  EFI_SIMPLE_POINTER_GET_STATE  GetState;\r
+  EFI_EVENT                     WaitForInput;\r
+  EFI_SIMPLE_POINTER_MODE       *Mode;\r
+};\r
+\r
+extern EFI_GUID gEfiSimplePointerProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SimpleTextIn.h b/MdePkg/Include/Protocol/SimpleTextIn.h
new file mode 100644 (file)
index 0000000..3e7f016
--- /dev/null
@@ -0,0 +1,125 @@
+/** @file\r
+  Simple Text In protocol from the EFI 1.0 specification.\r
+\r
+  Abstraction of a very simple input device like a keyboard or serial\r
+  terminal.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SimpleTextIn.h\r
+\r
+**/\r
+\r
+#ifndef __SIMPLE_TEXT_IN_PROTOCOL_H__\r
+#define __SIMPLE_TEXT_IN_PROTOCOL_H__\r
+\r
+#define EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID \\r
+  { \\r
+    0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID\r
+\r
+typedef struct _EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_IN_PROTOCOL;\r
+typedef struct _EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL;\r
+\r
+//\r
+// Data structures\r
+//\r
+typedef struct {\r
+  UINT16  ScanCode;\r
+  CHAR16  UnicodeChar;\r
+} EFI_INPUT_KEY;\r
+\r
+//\r
+// Required unicode control chars\r
+//\r
+#define CHAR_NULL             0x0000\r
+#define CHAR_BACKSPACE        0x0008\r
+#define CHAR_TAB              0x0009\r
+#define CHAR_LINEFEED         0x000A\r
+#define CHAR_CARRIAGE_RETURN  0x000D\r
+\r
+//\r
+// EFI Scan codes\r
+//\r
+#define SCAN_NULL       0x0000\r
+#define SCAN_UP         0x0001\r
+#define SCAN_DOWN       0x0002\r
+#define SCAN_RIGHT      0x0003\r
+#define SCAN_LEFT       0x0004\r
+#define SCAN_HOME       0x0005\r
+#define SCAN_END        0x0006\r
+#define SCAN_INSERT     0x0007\r
+#define SCAN_DELETE     0x0008\r
+#define SCAN_PAGE_UP    0x0009\r
+#define SCAN_PAGE_DOWN  0x000A\r
+#define SCAN_F1         0x000B\r
+#define SCAN_F2         0x000C\r
+#define SCAN_F3         0x000D\r
+#define SCAN_F4         0x000E\r
+#define SCAN_F5         0x000F\r
+#define SCAN_F6         0x0010\r
+#define SCAN_F7         0x0011\r
+#define SCAN_F8         0x0012\r
+#define SCAN_F9         0x0013\r
+#define SCAN_F10        0x0014\r
+#define SCAN_F11        0x0015\r
+#define SCAN_F12        0x0016\r
+#define SCAN_ESC        0x0017\r
+\r
+/**\r
+  Reset the input device and optionaly run diagnostics\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ExtendedVerification Driver may perform diagnostics on reset.\r
+\r
+  @retval EFI_SUCCESS          The device was reset.\r
+  @retval EFI_DEVICE_ERROR     The device is not functioning properly and could not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INPUT_RESET) (\r
+  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,\r
+  IN BOOLEAN                              ExtendedVerification\r
+  )\r
+;\r
+\r
+/**\r
+  Reads the next keystroke from the input device. The WaitForKey Event can \r
+  be used to test for existance of a keystroke via WaitForEvent () call.\r
+\r
+  @param  This Protocol instance pointer.\r
+  @param  Key  Driver may perform diagnostics on reset.\r
+\r
+  @retval EFI_SUCCESS      The keystroke information was returned.\r
+  @retval EFI_NOT_READY    There was no keystroke data availiable.\r
+  @retval EFI_DEVICE_ERROR The keydtroke information was not returned due to\r
+                           hardware errors.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INPUT_READ_KEY) (\r
+  IN EFI_SIMPLE_TEXT_IN_PROTOCOL          *This,\r
+  OUT EFI_INPUT_KEY                       *Key\r
+  )\r
+;\r
+\r
+struct _EFI_SIMPLE_TEXT_IN_PROTOCOL {\r
+  EFI_INPUT_RESET     Reset;\r
+  EFI_INPUT_READ_KEY  ReadKeyStroke;\r
+  EFI_EVENT           WaitForKey;\r
+};\r
+\r
+extern EFI_GUID gEfiSimpleTextInProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SimpleTextInEx.h b/MdePkg/Include/Protocol/SimpleTextInEx.h
new file mode 100644 (file)
index 0000000..3aa4ecc
--- /dev/null
@@ -0,0 +1,318 @@
+/** @file\r
+  The file defines the protocol to obtain input from the\r
+  ConsoleIn device. The EFI specification requires that the\r
+  EFI_SIMPLE_TEXT_INPUT_PROTOCOL supports the same languages as\r
+  the corresponding\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name: SimpleTextInEx.h\r
+\r
+**/\r
+\r
+#ifndef __SIMPLE_TEXT_IN_EX_H__\r
+#define __SIMPLE_TEXT_IN_EX_H__\r
+\r
+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \\r
+  {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }\r
+\r
+\r
+typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;\r
+\r
+/**\r
+  The Reset() function resets the input device hardware. As part\r
+  of initialization process, the firmware/device will make a quick\r
+  but reasonable attempt to verify that the device is functioning.\r
+  If the ExtendedVerification flag is TRUE the firmware may take\r
+  an extended amount of time to verify the device is operating on\r
+  reset. Otherwise the reset operation is to occur as quickly as\r
+  possible. The hardware verification process is not defined by\r
+  this specification and is left up to the platform firmware or\r
+  driver to implement.\r
+\r
+  @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r
+              instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r
+              is defined in this section.\r
+\r
+  @param ExtendedVerification Indicates that the driver may\r
+                              perform a more exhaustive\r
+                              verification operation of the\r
+                              device during reset.\r
+\r
+\r
+  @retval EFI_SUCCESS The device was reset.\r
+  \r
+  @retval EFI_DEVICE_ERROR  The device is not functioning\r
+                            correctly and could not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INPUT_RESET_EX) (\r
+  IN CONST  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+  IN CONST  BOOLEAN                           ExtendedVerification\r
+);\r
+\r
+\r
+//\r
+// EFI_KEY_TOGGLE_STATE\r
+//\r
+typedef UINT8   EFI_KEY_TOGGLE_STATE;\r
+#define TOGGLE_STATE_VALID    0x80\r
+#define SCROLL_LOCK_ACTIVE    0x01\r
+#define NUM_LOCK_ACTIVE       0x02\r
+#define CAPS_LOCK_ACTIVE      0x04\r
+\r
+/**\r
+  Definition of EFI_KEY_STATE\r
+\r
+  @param KeyShiftState  Reflects the currently pressed shift\r
+                        modifiers for the input device. The\r
+                        returned value is valid only if the high\r
+                        order bit has been set.\r
+\r
+  @param KeyToggleState Reflects the current internal state of\r
+                        various toggled attributes. The returned\r
+                        value is valid only if the high order\r
+                        bit has been set.\r
+\r
+**/\r
+typedef struct _EFI_KEY_STATE {\r
+  UINT32                KeyShiftState;\r
+  EFI_KEY_TOGGLE_STATE  KeyToggleState;\r
+} EFI_KEY_STATE;\r
+\r
+/**\r
+  Definition of EFI_KEY_DATA.\r
+\r
+  @param Key  The EFI scan code and Unicode value returned from\r
+              the input device.\r
+\r
+  @param KeyState The current state of various toggled\r
+                  attributes as well as input modifier values.\r
+\r
+**/\r
+typedef struct {\r
+  EFI_INPUT_KEY   Key;\r
+  EFI_KEY_STATE   KeyState;\r
+} EFI_KEY_DATA;\r
+\r
+//\r
+// Shift State.\r
+//\r
+// Any Shift or Toggle State that is valid should have\r
+// high order bit set.\r
+//\r
+#define SHIFT_STATE_VALID     0x80000000\r
+#define RIGHT_SHIFT_PRESSED   0x00000001\r
+#define LEFT_SHIFT_PRESSED    0x00000002\r
+#define RIGHT_CONTROL_PRESSED 0x00000004\r
+#define LEFT_CONTROL_PRESSED  0x00000008\r
+#define RIGHT_ALT_PRESSED     0x00000010\r
+#define LEFT_ALT_PRESSED      0x00000020\r
+#define RIGHT_LOGO_PRESSED    0x00000040\r
+#define LEFT_LOGO_PRESSED     0x00000080\r
+#define MENU_KEY_PRESSED      0x00000100\r
+#define SYS_REQ_PRESSED       0x00000200\r
+\r
+/**\r
+  The function reads the next keystroke from the input device. If\r
+  there is no pending keystroke the function returns\r
+  EFI_NOT_READY. If there is a pending keystroke, then\r
+  KeyData.Key.ScanCode is the EFI scan code defined in Error!\r
+  Reference source not found.. The KeyData.Key.UnicodeChar is the\r
+  actual printable character or is zero if the key does not\r
+  represent a printable character (control key, function key,\r
+  etc.). The KeyData.KeyState is shift state for the character\r
+  reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .\r
+  When interpreting the data from this function, it should be\r
+  noted that if a class of printable characters that are\r
+  normally adjusted by shift modifiers (e.g. Shift Key + "f"\r
+  key) would be presented solely as a KeyData.Key.UnicodeChar\r
+  without the associated shift state. So in the previous example\r
+  of a Shift Key + "f" key being pressed, the only pertinent\r
+  data returned would be KeyData.Key.UnicodeChar with the value\r
+  of "F". This of course would not typically be the case for\r
+  non-printable characters such as the pressing of the Right\r
+  Shift Key + F10 key since the corresponding returned data\r
+  would be reflected both in the KeyData.KeyState.KeyShiftState\r
+  and KeyData.Key.ScanCode values. UEFI drivers which implement\r
+  the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return\r
+  KeyData.Key and KeyData.KeyState values. These drivers must\r
+  always return the most current state of\r
+  KeyData.KeyState.KeyShiftState and\r
+  KeyData.KeyState.KeyToggleState. It should also be noted that\r
+  certain input devices may not be able to produce shift or toggle\r
+  state information, and in those cases the high order bit in the\r
+  respective Toggle and Shift state fields should not be active.\r
+\r
+  \r
+  @param This   A pointer to the\r
+                EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance.\r
+\r
+  @param KeyData  A pointer to a buffer that is filled in with\r
+                  the keystroke state data for the key that was\r
+                  pressed.\r
+\r
+  \r
+  @retval EFI_SUCCESS     The keystroke information was\r
+                          returned.\r
+  \r
+  @retval EFI_NOT_READY   There was no keystroke data available.\r
+                          EFI_DEVICE_ERROR The keystroke\r
+                          information was not returned due to\r
+                          hardware errors.\r
+\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_INPUT_READ_KEY_EX) (\r
+  IN CONST  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+  OUT       EFI_KEY_DATA                      *KeyData\r
+);\r
+\r
+/**\r
+  The SetState() function allows the input device hardware to\r
+  have state settings adjusted.\r
+  \r
+  @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r
+              instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r
+              is defined in this section.\r
+  \r
+  @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to\r
+                        set the state for the input device.\r
+  \r
+  \r
+  @retval EFI_SUCCESS The device state was set appropriately.\r
+\r
+  @retval EFI_DEVICE_ERROR  The device is not functioning\r
+                            correctly and could not have the\r
+                            setting adjusted.\r
+\r
+  @retval EFI_UNSUPPORTED   The device does not support the\r
+                            ability to have its state set.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SET_STATE) (\r
+  IN CONST  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+  IN CONST  EFI_KEY_TOGGLE_STATE              *KeyToggleState\r
+);\r
+\r
+//\r
+// EFI_KEY_NOTIFY\r
+//\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_KEY_NOTIFY_FUNCTION) (\r
+  IN CONST  EFI_KEY_DATA *KeyData\r
+);\r
+\r
+/**\r
+  The RegisterKeystrokeNotify() function registers a function\r
+  which will be called when a specified keystroke will occur.\r
+  \r
+  @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r
+              instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r
+              is defined in this section.\r
+  \r
+  @param KeyData  A pointer to a buffer that is filled in with\r
+                  the keystroke information for the key that was\r
+                  pressed.\r
+  \r
+  @param KeyNotificationFunction  Points to the function to be\r
+                                  called when the key sequence\r
+                                  is typed specified by KeyData.\r
+  \r
+  \r
+  @param NotifyHandle Points to the unique handle assigned to\r
+                      the registered notification.\r
+  \r
+  @retval EFI_SUCCESS           The device state was set\r
+                                appropriately.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  Unable to allocate necessary\r
+                                data structures.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) (\r
+  IN CONST  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+  IN CONST  EFI_KEY_DATA            *KeyData,\r
+  IN CONST  EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r
+  OUT       EFI_HANDLE              *NotifyHandle\r
+);\r
+\r
+/**\r
+  The UnregisterKeystrokeNotify() function removes the\r
+  notification which was previously registered.\r
+  \r
+  @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX\r
+              instance.\r
+  \r
+  @param NotificationHandle The handle of the notification\r
+                            function being unregistered.\r
+  \r
+  @retval EFI_SUCCESS The device state was set appropriately.\r
+  \r
+  @retval EFI_INVALID_PARAMETER The NotificationHandle is\r
+                                invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) (\r
+IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+IN EFI_HANDLE NotificationHandle\r
+);\r
+\r
+\r
+/**\r
+  The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn\r
+  device. It is an extension to the Simple Text Input protocol\r
+  which allows a variety of extended shift state information to be\r
+  returned.\r
+\r
+  @param Reset  Reset the ConsoleIn device. See Reset().\r
+\r
+  @param ReadKeyStrokeEx  Returns the next input character. See\r
+                          ReadKeyStrokeEx().\r
+\r
+  @param WaitForKeyEx   Event to use with WaitForEvent() to wait\r
+                        for a key to be available.\r
+\r
+  @param SetState   Set the EFI_KEY_TOGGLE_STATE state settings\r
+                    for the input device.\r
+\r
+  @param RegisterKeyNotify  Register a notification function to\r
+                            be called when a given key sequence\r
+                            is hit.\r
+\r
+  @param UnregisterKeyNotifyRemoves   A specific notification\r
+                                      function.\r
+\r
+**/\r
+struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL{\r
+  EFI_INPUT_RESET_EX              Reset;\r
+  EFI_INPUT_READ_KEY_EX           ReadKeyStrokeEx;\r
+  EFI_EVENT                       WaitForKeyEx;\r
+  EFI_SET_STATE                   SetState;\r
+  EFI_REGISTER_KEYSTROKE_NOTIFY   RegisterKeyNotify;\r
+  EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/SimpleTextOut.h b/MdePkg/Include/Protocol/SimpleTextOut.h
new file mode 100644 (file)
index 0000000..b568865
--- /dev/null
@@ -0,0 +1,390 @@
+/** @file\r
+  Simple Text Out protocol from the EFI 1.0 specification.\r
+\r
+  Abstraction of a very simple text based output device like VGA text mode or\r
+  a serial terminal. The Simple Text Out protocol instance can represent\r
+  a single hardware device or a virtual device that is an agregation\r
+  of multiple physical devices.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SimpleTextOut.h\r
+\r
+**/\r
+\r
+#ifndef __SIMPLE_TEXT_OUT_H__\r
+#define __SIMPLE_TEXT_OUT_H__\r
+\r
+#define EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID \\r
+  { \\r
+    0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID  EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID\r
+\r
+typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUT_PROTOCOL;\r
+typedef struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;\r
+\r
+//\r
+// Define's for required EFI Unicode Box Draw characters\r
+//\r
+#define BOXDRAW_HORIZONTAL                  0x2500\r
+#define BOXDRAW_VERTICAL                    0x2502\r
+#define BOXDRAW_DOWN_RIGHT                  0x250c\r
+#define BOXDRAW_DOWN_LEFT                   0x2510\r
+#define BOXDRAW_UP_RIGHT                    0x2514\r
+#define BOXDRAW_UP_LEFT                     0x2518\r
+#define BOXDRAW_VERTICAL_RIGHT              0x251c\r
+#define BOXDRAW_VERTICAL_LEFT               0x2524\r
+#define BOXDRAW_DOWN_HORIZONTAL             0x252c\r
+#define BOXDRAW_UP_HORIZONTAL               0x2534\r
+#define BOXDRAW_VERTICAL_HORIZONTAL         0x253c\r
+#define BOXDRAW_DOUBLE_HORIZONTAL           0x2550\r
+#define BOXDRAW_DOUBLE_VERTICAL             0x2551\r
+#define BOXDRAW_DOWN_RIGHT_DOUBLE           0x2552\r
+#define BOXDRAW_DOWN_DOUBLE_RIGHT           0x2553\r
+#define BOXDRAW_DOUBLE_DOWN_RIGHT           0x2554\r
+#define BOXDRAW_DOWN_LEFT_DOUBLE            0x2555\r
+#define BOXDRAW_DOWN_DOUBLE_LEFT            0x2556\r
+#define BOXDRAW_DOUBLE_DOWN_LEFT            0x2557\r
+#define BOXDRAW_UP_RIGHT_DOUBLE             0x2558\r
+#define BOXDRAW_UP_DOUBLE_RIGHT             0x2559\r
+#define BOXDRAW_DOUBLE_UP_RIGHT             0x255a\r
+#define BOXDRAW_UP_LEFT_DOUBLE              0x255b\r
+#define BOXDRAW_UP_DOUBLE_LEFT              0x255c\r
+#define BOXDRAW_DOUBLE_UP_LEFT              0x255d\r
+#define BOXDRAW_VERTICAL_RIGHT_DOUBLE       0x255e\r
+#define BOXDRAW_VERTICAL_DOUBLE_RIGHT       0x255f\r
+#define BOXDRAW_DOUBLE_VERTICAL_RIGHT       0x2560\r
+#define BOXDRAW_VERTICAL_LEFT_DOUBLE        0x2561\r
+#define BOXDRAW_VERTICAL_DOUBLE_LEFT        0x2562\r
+#define BOXDRAW_DOUBLE_VERTICAL_LEFT        0x2563\r
+#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE      0x2564\r
+#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL      0x2565\r
+#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL      0x2566\r
+#define BOXDRAW_UP_HORIZONTAL_DOUBLE        0x2567\r
+#define BOXDRAW_UP_DOUBLE_HORIZONTAL        0x2568\r
+#define BOXDRAW_DOUBLE_UP_HORIZONTAL        0x2569\r
+#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE  0x256a\r
+#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL  0x256b\r
+#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL  0x256c\r
+\r
+//\r
+// EFI Required Block Elements Code Chart\r
+//\r
+#define BLOCKELEMENT_FULL_BLOCK   0x2588\r
+#define BLOCKELEMENT_LIGHT_SHADE  0x2591\r
+\r
+//\r
+// EFI Required Geometric Shapes Code Chart\r
+//\r
+#define GEOMETRICSHAPE_UP_TRIANGLE    0x25b2\r
+#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba\r
+#define GEOMETRICSHAPE_DOWN_TRIANGLE  0x25bc\r
+#define GEOMETRICSHAPE_LEFT_TRIANGLE  0x25c4\r
+\r
+//\r
+// EFI Required Arrow shapes\r
+//\r
+#define ARROW_LEFT  0x2190\r
+#define ARROW_UP    0x2191\r
+#define ARROW_RIGHT 0x2192\r
+#define ARROW_DOWN  0x2193\r
+\r
+//\r
+// EFI Console Colours\r
+//\r
+#define EFI_BLACK                 0x00\r
+#define EFI_BLUE                  0x01\r
+#define EFI_GREEN                 0x02\r
+#define EFI_CYAN                  (EFI_BLUE | EFI_GREEN)\r
+#define EFI_RED                   0x04\r
+#define EFI_MAGENTA               (EFI_BLUE | EFI_RED)\r
+#define EFI_BROWN                 (EFI_GREEN | EFI_RED)\r
+#define EFI_LIGHTGRAY             (EFI_BLUE | EFI_GREEN | EFI_RED)\r
+#define EFI_BRIGHT                0x08\r
+#define EFI_DARKGRAY              (EFI_BRIGHT)\r
+#define EFI_LIGHTBLUE             (EFI_BLUE | EFI_BRIGHT)\r
+#define EFI_LIGHTGREEN            (EFI_GREEN | EFI_BRIGHT)\r
+#define EFI_LIGHTCYAN             (EFI_CYAN | EFI_BRIGHT)\r
+#define EFI_LIGHTRED              (EFI_RED | EFI_BRIGHT)\r
+#define EFI_LIGHTMAGENTA          (EFI_MAGENTA | EFI_BRIGHT)\r
+#define EFI_YELLOW                (EFI_BROWN | EFI_BRIGHT)\r
+#define EFI_WHITE                 (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)\r
+\r
+#define EFI_TEXT_ATTR(f, b)       ((f) | ((b) << 4))\r
+\r
+#define EFI_BACKGROUND_BLACK      0x00\r
+#define EFI_BACKGROUND_BLUE       0x10\r
+#define EFI_BACKGROUND_GREEN      0x20\r
+#define EFI_BACKGROUND_CYAN       (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)\r
+#define EFI_BACKGROUND_RED        0x40\r
+#define EFI_BACKGROUND_MAGENTA    (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)\r
+#define EFI_BACKGROUND_BROWN      (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)\r
+#define EFI_BACKGROUND_LIGHTGRAY  (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)\r
+\r
+//\r
+// We currently define attributes from 0 - 7F for color manipulations\r
+// To internally handle the local display characteristics for a particular character, we are defining\r
+// Bit 7 to signify the local glyph representation for a character.  If turned on, glyphs will be\r
+// pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)\r
+// If bit 7 is off, the narrow glyph database will be used.  This does NOT affect information that is sent to\r
+// non-local displays (e.g. serial or LAN consoles).\r
+//\r
+#define EFI_WIDE_ATTRIBUTE  0x80\r
+\r
+/**\r
+  Reset the text output device hardware and optionaly run diagnostics\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  ExtendedVerification Driver may perform more exhaustive verfication\r
+                               operation of the device during reset.\r
+\r
+  @retval EFI_SUCCESS          The text output device was reset.\r
+  @retval EFI_DEVICE_ERROR     The text output device is not functioning correctly and\r
+                               could not be reset.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_RESET) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN BOOLEAN                                ExtendedVerification\r
+  )\r
+;\r
+\r
+/**\r
+  Write a Unicode string to the output device.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  String The NULL-terminated Unicode string to be displayed on the output\r
+                 device(s). All output devices must also support the Unicode\r
+                 drawing defined in this file.\r
+\r
+  @retval EFI_SUCCESS             The string was output to the device.\r
+  @retval EFI_DEVICE_ERROR        The device reported an error while attempting to output\r
+                                  the text.\r
+  @retval EFI_UNSUPPORTED         The output device's mode is not currently in a\r
+                                  defined text mode.\r
+  @retval EFI_WARN_UNKNOWN_GLYPH  This warning code indicates that some of the\r
+                                  characters in the Unicode string could not be\r
+                                  rendered and were skipped.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_STRING) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN CHAR16                                 *String\r
+  )\r
+;\r
+\r
+/**\r
+  Verifies that all characters in a Unicode string can be output to the \r
+  target device.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  String The NULL-terminated Unicode string to be examined for the output\r
+                 device(s).\r
+\r
+  @retval EFI_SUCCESS      The device(s) are capable of rendering the output string.\r
+  @retval EFI_UNSUPPORTED  Some of the characters in the Unicode string cannot be\r
+                           rendered by one or more of the output devices mapped\r
+                           by the EFI handle.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_TEST_STRING) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN CHAR16                                 *String\r
+  )\r
+;\r
+\r
+/**\r
+  Returns information for an available text mode that the output device(s)\r
+  supports.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  ModeNumber The mode number to return information on.\r
+  @param  Columns    Returns the geometry of the text output device for the\r
+                     requested ModeNumber.\r
+  @param  Rows       Returns the geometry of the text output device for the\r
+                     requested ModeNumber.\r
+                                          \r
+  @retval EFI_SUCCESS      The requested mode information was returned.\r
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED  The mode number was not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_QUERY_MODE) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN UINTN                                  ModeNumber,\r
+  OUT UINTN                                 *Columns,\r
+  OUT UINTN                                 *Rows\r
+  )\r
+;\r
+\r
+/**\r
+  Sets the output device(s) to a specified mode.\r
+\r
+  @param  This       Protocol instance pointer.\r
+  @param  ModeNumber The mode number to set.\r
+\r
+  @retval EFI_SUCCESS      The requested text mode was set.\r
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED  The mode number was not valid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_SET_MODE) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN UINTN                                  ModeNumber\r
+  )\r
+;\r
+\r
+/**\r
+  Sets the background and foreground colors for the OutputString () and\r
+  ClearScreen () functions.\r
+\r
+  @param  This      Protocol instance pointer.\r
+  @param  Attribute The attribute to set. Bits 0..3 are the foreground color, and\r
+                    bits 4..6 are the background color. All other bits are undefined\r
+                    and must be zero. The valid Attributes are defined in this file.\r
+\r
+  @retval EFI_SUCCESS     The attribute was set.\r
+  @retval EFI_DEVICE_     ERROR The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED The attribute requested is not defined.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN UINTN                                  Attribute\r
+  )\r
+;\r
+\r
+/**\r
+  Clears the output device(s) display to the currently selected background \r
+  color.\r
+\r
+  @param  This              Protocol instance pointer.\r
+                           \r
+  @retval  EFI_SUCCESS      The operation completed successfully.\r
+  @retval  EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+  @retval  EFI_UNSUPPORTED  The output device is not in a valid text mode.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_CLEAR_SCREEN) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *This\r
+  )\r
+;\r
+\r
+/**\r
+  Sets the current coordinates of the cursor position\r
+\r
+  @param  This        Protocol instance pointer.\r
+  @param  Column      The position to set the cursor to. Must be greater than or\r
+                      equal to zero and less than the number of columns and rows\r
+                      by QueryMode ().\r
+  @param  Row         The position to set the cursor to. Must be greater than or\r
+                      equal to zero and less than the number of columns and rows\r
+                      by QueryMode ().\r
+\r
+  @retval EFI_SUCCESS      The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED  The output device is not in a valid text mode, or the\r
+                           cursor position is invalid for the current mode.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN UINTN                                  Column,\r
+  IN UINTN                                  Row\r
+  )\r
+;\r
+\r
+/**\r
+  Makes the cursor visible or invisible\r
+\r
+  @param  This    Protocol instance pointer.\r
+  @param  Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is\r
+                  set to be invisible.\r
+\r
+  @retval EFI_SUCCESS      The operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the\r
+                           request, or the device does not support changing\r
+                           the cursor mode.\r
+  @retval EFI_UNSUPPORTED  The output device is not in a valid text mode.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TEXT_ENABLE_CURSOR) (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL           *This,\r
+  IN BOOLEAN                                Visible\r
+  )\r
+;\r
+\r
+/**\r
+  Mode Structure pointed to by Simple Text Out protocol.\r
+\r
+  MaxMode   - The number of modes supported by QueryMode () and SetMode ().\r
+  Mode      - The text mode of the output device(s).\r
+  Attribute - The current character output attribute\r
+  CursorColumn  - The cursor's column.\r
+  CursorRow     - The cursor's row.\r
+  CursorVisible - The cursor is currently visbile or not.\r
+\r
+**/\r
+typedef struct {\r
+  INT32   MaxMode;\r
+\r
+  //\r
+  // current settings\r
+  //\r
+  INT32   Mode;\r
+  INT32   Attribute;\r
+  INT32   CursorColumn;\r
+  INT32   CursorRow;\r
+  BOOLEAN CursorVisible;\r
+} EFI_SIMPLE_TEXT_OUTPUT_MODE;\r
+\r
+struct _EFI_SIMPLE_TEXT_OUT_PROTOCOL {\r
+  EFI_TEXT_RESET                Reset;\r
+\r
+  EFI_TEXT_STRING               OutputString;\r
+  EFI_TEXT_TEST_STRING          TestString;\r
+\r
+  EFI_TEXT_QUERY_MODE           QueryMode;\r
+  EFI_TEXT_SET_MODE             SetMode;\r
+  EFI_TEXT_SET_ATTRIBUTE        SetAttribute;\r
+\r
+  EFI_TEXT_CLEAR_SCREEN         ClearScreen;\r
+  EFI_TEXT_SET_CURSOR_POSITION  SetCursorPosition;\r
+  EFI_TEXT_ENABLE_CURSOR        EnableCursor;\r
+\r
+  //\r
+  // Current mode\r
+  //\r
+  EFI_SIMPLE_TEXT_OUTPUT_MODE   *Mode;\r
+};\r
+\r
+extern EFI_GUID gEfiSimpleTextOutProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/SmbusHc.h b/MdePkg/Include/Protocol/SmbusHc.h
new file mode 100644 (file)
index 0000000..d000975
--- /dev/null
@@ -0,0 +1,311 @@
+/** @file\r
+  The file provides basic SMBus host controller management \r
+  and basic data transactions over the SMBus.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  SmbusHc.h\r
+\r
+  @par Revision Reference: PI\r
+  Version 1.00.\r
+\r
+**/\r
+\r
+#ifndef __SMBUS_HC_H__\r
+#define __SMBUS_HC_H__\r
+\r
+#include <Ppi/Smbus2.h>\r
+\r
+#define EFI_SMBUS_HC_PROTOCOL_GUID \\r
+  {0xe49d33ed, 0x513d, 0x4634, { 0xb6, 0x98, 0x6f, 0x55, 0xaa, 0x75, 0x1c, 0x1b} }\r
+\r
+typedef struct _EFI_SMBUS_HC_PROTOCOL EFI_SMBUS_HC_PROTOCOL;\r
+\r
+/**\r
+     \r
+  The Execute() function provides a standard way to execute an\r
+  operation as defined in the System Management Bus (SMBus)\r
+  Specification. The resulting transaction will be either that\r
+  the SMBus slave devices accept this transaction or that this\r
+  function returns with error. Status Codes Returned\r
+  \r
+  @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
+              SlaveAddress The SMBus slave address of the device\r
+              with which to communicate. Type\r
+              EFI_SMBUS_DEVICE_ADDRESS is defined in\r
+              EFI_PEI_SMBUS_PPI.Execute() in the Platform\r
+              Initialization SMBus PPI Specification.\r
+\r
+  @param Command  This command is transmitted by the SMBus host\r
+                  controller to the SMBus slave device and the\r
+                  interpretation is SMBus slave device specific.\r
+                  It can mean the offset to a list of functions\r
+                  inside an SMBus slave device. Not all\r
+                  operations or slave devices support this\r
+                  command's registers. Type\r
+                  EFI_SMBUS_DEVICE_COMMAND is defined in\r
+                  EFI_PEI_SMBUS_PPI.Execute() in the Platform\r
+                  Initialization SMBus PPI Specification.\r
+                  Operation Signifies which particular SMBus\r
+                  hardware protocol instance that it will use to\r
+                  execute the SMBus transactions. This SMBus\r
+                  hardware protocol is defined by the SMBus\r
+                  Specification and is not related to PI\r
+                  Architecture. Type EFI_SMBUS_OPERATION is\r
+                  defined in EFI_PEI_SMBUS_PPI.Execute() in the\r
+                  Platform Initialization SMBus PPI\r
+                  Specification.\r
+\r
+  @param PecCheck   Defines if Packet Error Code (PEC) checking\r
+                    is required for this operation. SMBus Host\r
+                    Controller Code Definitions Version 1.0\r
+                    August 21, 2006 13 Length Signifies the\r
+                    number of bytes that this operation will do.\r
+                    The maximum number of bytes can be revision\r
+                    specific and operation specific. This field\r
+                    will contain the actual number of bytes that\r
+                    are executed for this operation. Not all\r
+                    operations require this argument.\r
+\r
+  @param Buffer   Contains the value of data to execute to the\r
+                  SMBus slave device. Not all operations require\r
+                  this argument. The length of this buffer is\r
+                  identified by Length.\r
+  \r
+  \r
+  @retval EFI_SUCCESS   The last data that was returned from the\r
+                        access matched the poll exit criteria.\r
+\r
+  @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r
+                        incorrect).\r
+\r
+  @retval EFI_TIMEOUT   Timeout expired before the operation was\r
+                        completed. Timeout is determined by the\r
+                        SMBus host controller device.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be\r
+                                completed due to a lack of\r
+                                resources.\r
+\r
+  @retval EFI_DEVICE_ERROR  The request was not completed\r
+                            because a failure that was reflected\r
+                            in the Host Status Register bit.\r
+                            Device errors are a result of a\r
+                            transaction collision, illegal\r
+                            command field, unclaimed cycle (host\r
+                            initiated), or bus errors\r
+                            (collisions).\r
+\r
+  @retval EFI_INVALID_PARAMETER Operation is not defined in\r
+                                EFI_SMBUS_OPERATION.\r
+\r
+  @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for\r
+                                operations except for\r
+                                EfiSmbusQuickRead and\r
+                                EfiSmbusQuickWrite. Length is\r
+                                outside the range of valid\r
+                                values.\r
+\r
+  @retval EFI_UNSUPPORTED   The SMBus operation or PEC is not\r
+                            supported. \r
+\r
+  @retval EFI_BUFFER_TOO_SMALL  Buffer is not sufficient for\r
+                                this operation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBUS_HC_EXECUTE_OPERATION) (\r
+  IN CONST  EFI_SMBUS_HC_PROTOCOL     *This,\r
+  IN CONST  EFI_SMBUS_DEVICE_ADDRESS  SlaveAddress,\r
+  IN CONST  EFI_SMBUS_DEVICE_COMMAND  Command,\r
+  IN CONST  EFI_SMBUS_OPERATION       Operation,\r
+  IN CONST  BOOLEAN                   PecCheck,\r
+  IN OUT    UINTN                     *Length,\r
+  IN OUT    VOID                      *Buffer\r
+);\r
+\r
+\r
+\r
+/**\r
+   \r
+  The ArpDevice() function provides a standard way for a device driver to enumerate the entire\r
+  SMBus or specific devices on the bus.\r
+  \r
+  \r
+  @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
+\r
+  @param ArpAll   A Boolean expression that indicates if the\r
+                  host drivers need to enumerate all the devices\r
+                  or enumerate only the device that is\r
+                  identified by SmbusUdid. If ArpAll is TRUE,\r
+                  SmbusUdid and SlaveAddress are optional. If\r
+                  ArpAll is FALSE, ArpDevice will enumerate\r
+                  SmbusUdid and the address will be at\r
+                  SlaveAddress.\r
+\r
+  @param SmbusUdid  The Unique Device Identifier (UDID) that is\r
+                    associated with this device. Type\r
+                    EFI_SMBUS_UDID is defined in\r
+                    EFI_PEI_SMBUS_PPI.ArpDevice() in the\r
+                    Platform Initialization SMBus PPI\r
+                    Specification.\r
+\r
+  @param SlaveAddress   The SMBus slave address that is\r
+                        associated with an SMBus UDID.\r
+\r
+\r
+\r
+  @retval EFI_SUCCESS   The last data that was returned from the\r
+                        access matched the poll exit criteria.\r
+\r
+  @retval EFI_CRC_ERROR Checksum is not correct (PEC is\r
+                        incorrect).\r
+\r
+  @retval EFI_TIMEOUT   Timeout expired before the operation was\r
+                        completed. Timeout is determined by the\r
+                        SMBus host controller device.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be\r
+                                completed due to a lack of\r
+                                resources.\r
+\r
+  @retval EFI_DEVICE_ERROR  The request was not completed\r
+                            because a failure was reflected in\r
+                            the Host Status Register bit. Device\r
+                            Errors are a result of a transaction\r
+                            collision, illegal command field,\r
+                            unclaimed cycle (host initiated), or\r
+                            bus errors (collisions).\r
+\r
+  @retval EFI_UNSUPPORTED   ArpDevice, GetArpMap, and Notify are\r
+                            not implemented by this driver.\r
+   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE) (\r
+  IN CONST  EFI_SMBUS_HC_PROTOCOL     *This,\r
+  IN CONST  BOOLEAN                   ArpAll,\r
+  IN CONST  EFI_SMBUS_UDID            *SmbusUdid,   OPTIONAL\r
+  IN OUT    EFI_SMBUS_DEVICE_ADDRESS  *SlaveAddress OPTIONAL\r
+);\r
+\r
+\r
+/**\r
+  The GetArpMap() function returns the mapping of all the SMBus devices that were enumerated\r
+  by the SMBus host driver.\r
+  \r
+  @param This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
+  \r
+  @param Length   Size of the buffer that contains the SMBus\r
+                  device map.\r
+  \r
+  @param SmbusDeviceMap The pointer to the device map as\r
+                        enumerated by the SMBus controller\r
+                        driver.\r
+  \r
+  @retval EFI_SUCCESS   The SMBus returned the current device\r
+                        map.\r
+  \r
+  @retval EFI_UNSUPPORTED   ArpDevice, GetArpMap, and Notify are\r
+                            not implemented by this driver.\r
+  \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP) (\r
+  IN CONST  EFI_SMBUS_HC_PROTOCOL   *This,\r
+  IN OUT    UINTN                   *Length,\r
+  IN OUT    EFI_SMBUS_DEVICE_MAP    **SmbusDeviceMap\r
+);\r
+\r
+\r
+\r
+//\r
+// EFI_SMBUS_NOTIFY_FUNCTION\r
+//\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBUS_NOTIFY_FUNCTION) (\r
+  IN CONST  EFI_SMBUS_DEVICE_ADDRESS  SlaveAddress,\r
+  IN CONST  UINTN                     Data\r
+);\r
+\r
+\r
+/**\r
+   \r
+  The Notify() function registers all the callback functions to\r
+  allow the bus driver to call these functions when the \r
+  SlaveAddress/Data pair happens.\r
+  \r
+  @param  This A pointer to the EFI_SMBUS_HC_PROTOCOL instance.\r
+  \r
+  @param  SlaveAddress  Address that the host controller detects\r
+                        as sending a message and calls all the registered function.\r
+\r
+  @param  Data  Data that the host controller detects as sending\r
+                message and calls all the registered function.\r
+\r
+\r
+  @param  NotifyFunction  The function to call when the bus\r
+                          driver detects the SlaveAddress and\r
+                          Data pair.\r
+\r
+  @retval EFI_SUCCESS   NotifyFunction was registered.\r
+  \r
+  @retval EFI_UNSUPPORTED   ArpDevice, GetArpMap, and Notify are\r
+                            not implemented by this driver.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SMBUS_HC_PROTOCOL_NOTIFY) (\r
+  IN CONST  EFI_SMBUS_HC_PROTOCOL     *This,\r
+  IN CONST  EFI_SMBUS_DEVICE_ADDRESS  SlaveAddress,\r
+  IN CONST  UINTN                     Data,\r
+  IN CONST  EFI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
+);\r
+\r
+\r
+/**\r
+  The EFI_SMBUS_HC_PROTOCOL provides SMBus host controller management and basic data\r
+  transactions over SMBus. There is one EFI_SMBUS_HC_PROTOCOL instance for each SMBus\r
+  host controller.\r
+\r
+  @param Execute  Executes the SMBus operation to an SMBus slave\r
+                  device. See the Execute() function description.\r
+  \r
+  @param ArpDevice  Allows an SMBus 2.0 device(s) to be Address\r
+                    Resolution Protocol (ARP).\r
+  \r
+  @param GetArpMap  Allows a driver to retrieve the address that\r
+                    was allocated by the SMBus host controller\r
+                    during enumeration/ARP. See the GetArpMap()\r
+                    function description.\r
+  \r
+  @param  Notify    Allows a driver to register for a callback\r
+                    to the SMBus host controller driver when the\r
+                    bus issues a notification to the bus\r
+                    controller driver. See the Notify() function\r
+                    description.\r
+**/\r
+struct _EFI_SMBUS_HC_PROTOCOL {\r
+  EFI_SMBUS_HC_EXECUTE_OPERATION    Execute;\r
+  EFI_SMBUS_HC_PROTOCOL_ARP_DEVICE  ArpDevice;\r
+  EFI_SMBUS_HC_PROTOCOL_GET_ARP_MAP GetArpMap;\r
+  EFI_SMBUS_HC_PROTOCOL_NOTIFY      Notify;\r
+};\r
+\r
+\r
+extern EFI_GUID gEfiSmbusHcProtocolGuid;\r
+\r
+#endif\r
+\r
diff --git a/MdePkg/Include/Protocol/StatusCode.h b/MdePkg/Include/Protocol/StatusCode.h
new file mode 100644 (file)
index 0000000..6bfaeae
--- /dev/null
@@ -0,0 +1,77 @@
+/** @file\r
+  Status code Runtime Protocol as defined in the DXE CIS\r
+\r
+  The StatusCode () Tiano service is added to the EFI system table and the \r
+  EFI_STATUS_CODE_ARCH_PROTOCOL_GUID protocol is registered with a NULL \r
+  pointer.\r
+\r
+  No CRC of the EFI system table is required, as it is done in the DXE core.\r
+\r
+  This code abstracts Status Code reporting.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  StatusCode.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __STATUS_CODE_RUNTIME_PROTOCOL_H__\r
+#define __STATUS_CODE_RUNTIME_PROTOCOL_H__\r
+\r
+#define EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID  \\r
+{ 0xd2b2b828, 0x826, 0x48a7,  { 0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24, 0xf0 } }\r
+\r
+/**\r
+  Provides an interface that a software module can call to report a status code.\r
+\r
+  @param  Type             Indicates the type of status code being reported.\r
+  @param  Value            Describes the current status of a hardware or software entity.\r
+                           This included information about the class and subclass that is used to\r
+                           classify the entity as well as an operation.\r
+  @param  Instance         The enumeration of a hardware or software entity within\r
+                           the system. Valid instance numbers start with 1.\r
+  @param  CallerId         This optional parameter may be used to identify the caller.\r
+                           This parameter allows the status code driver to apply different rules to\r
+                           different callers.\r
+  @param  Data             This optional parameter may be used to pass additional data.\r
+\r
+  @retval EFI_SUCCESS           The function completed successfully\r
+  @retval EFI_DEVICE_ERROR      The function should not be completed due to a device error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS \r
+(EFIAPI *EFI_REPORT_STATUS_CODE) (\r
+  IN EFI_STATUS_CODE_TYPE     Type,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 *CallerId  OPTIONAL,\r
+  IN EFI_STATUS_CODE_DATA     *Data      OPTIONAL\r
+  );\r
+\r
+/**\r
+  @par Protocol Description:\r
+  Provides the service required to report a status code to the platform firmware.\r
+  This protocol must be produced by a runtime DXE driver and may be consumed \r
+  only by the DXE Foundation.\r
+\r
+  @param  ReportStatusCode Emit a status code.\r
+\r
+**/\r
+typedef struct _EFI_STATUS_CODE_PROTOCOL {\r
+  EFI_REPORT_STATUS_CODE         ReportStatusCode;\r
+} EFI_STATUS_CODE_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiStatusCodeRuntimeProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/TapeIo.h b/MdePkg/Include/Protocol/TapeIo.h
new file mode 100644 (file)
index 0000000..919c95b
--- /dev/null
@@ -0,0 +1,236 @@
+/** @file\r
+  EFI_TAPE_IO_PROTOCOL as defined in the UEFI 2.0.\r
+  Provide services to control and access a tape device.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  TapeIo.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_TAPE_IO_PROTOCOL_H__\r
+#define __EFI_TAPE_IO_PROTOCOL_H__\r
+\r
+#define EFI_TAPE_IO_PROTOCOL_GUID \\r
+  { \\r
+    0x1e93e633, 0xd65a, 0x459e, {0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \\r
+  }\r
+\r
+typedef struct _EFI_TAPE_IO_PROTOCOL EFI_TAPE_IO_PROTOCOL;\r
+\r
+typedef struct {\r
+  UINT64     Signature;\r
+  UINT32     Revision;\r
+  UINT32     BootDescSize;\r
+  UINT32     BootDescCRC;\r
+  EFI_GUID   TapeGUID;\r
+  EFI_GUID   TapeType;\r
+  EFI_GUID   TapeUnique;\r
+  UINT32     BLLocation;\r
+  UINT32     BLBlocksize;\r
+  UINT32     BLFilesize;\r
+  CHAR8      OSVersion[40];\r
+  CHAR8      AppVersion[40];\r
+  CHAR8      CreationDate[10];\r
+  CHAR8      CreationTime[10];\r
+  CHAR8      SystemName[256];  // UTF-8\r
+  CHAR8      TapeTitle[120];   // UTF-8\r
+  CHAR8      pad[468];         // pad to 1024\r
+} TAPE_HEADER;\r
+\r
+/**\r
+  Reads from the tape.\r
+\r
+  @param  This       A pointer to the EFI_TAPE_IO_PROTOCOL instance.\r
+  @param  BufferSize Size of the buffer in bytes pointed to by Buffer.\r
+  @param  Buffer     Pointer to the buffer for data to be read into.\r
+\r
+  @retval EFI_SUCCESS           Data was successfully transferred from the media.\r
+  @retval EFI_END_OF_FILE       A filemark was encountered which limited the data\r
+                                transferred by the read operation or the head is positioned\r
+                                just after a filemark.\r
+  @retval EFI_NO_MEDIA          No media is loaded in the device.\r
+  @retval EFI_NOT_READY         The transfer failed since the device was not ready (e.g. not\r
+                                online). The transfer may be retried at a later time.\r
+  @retval EFI_UNSUPPORTED       The device does not support this type of transfer.\r
+  @retval EFI_TIMEOUT           The transfer failed to complete within the timeout specified.\r
+  @retval EFI_MEDIA_CHANGED     The media in the device was changed since the last access.\r
+                                The transfer was aborted since the current position of the\r
+                                media may be incorrect.\r
+  @retval EFI_INVALID_PARAMETER A NULL Buffer was specified with a non-zero\r
+                                BufferSize or the device is operating in fixed block\r
+                                size mode and the BufferSize was not a multiple of\r
+                                device's fixed block size\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to transfer data\r
+                                from the media.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TAPE_READ) (\r
+  IN EFI_TAPE_IO_PROTOCOL *This,\r
+  IN OUT UINTN            *BufferSize,\r
+  OUT VOID                *Buffer\r
+  )\r
+;    \r
+\r
+/**\r
+  Writes to the tape.\r
+\r
+  @param  This       A pointer to the EFI_TAPE_IO_PROTOCOL instance.\r
+  @param  BufferSize Size of the buffer in bytes pointed to by Buffer.\r
+  @param  Buffer     Pointer to the buffer for data to be written from.\r
+\r
+  @retval EFI_SUCCESS           Data was successfully transferred to the media.\r
+  @retval EFI_END_OF_MEDIA      The logical end of media has been reached. Data may have\r
+                                been successfully transferred to the media.\r
+  @retval EFI_NO_MEDIA          No media is loaded in the device.\r
+  @retval EFI_NOT_READY         The transfer failed since the device was not ready (e.g. not\r
+                                online). The transfer may be retried at a later time.\r
+  @retval EFI_UNSUPPORTED       The device does not support this type of transfer.\r
+  @retval EFI_TIMEOUT           The transfer failed to complete within the timeout specified.\r
+  @retval EFI_MEDIA_CHANGED     The media in the device was changed since the last access.\r
+                                The transfer was aborted since the current position of the\r
+                                media may be incorrect.\r
+  @retval EFI_WRITE_PROTECTED   The media in the device is write-protected. The transfer\r
+                                was aborted since a write cannot be completed.\r
+  @retval EFI_INVALID_PARAMETER A NULL Buffer was specified with a non-zero\r
+                                BufferSize or the device is operating in fixed block\r
+                                size mode and the BufferSize was not a multiple of\r
+                                device's fixed block size\r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to transfer data\r
+                                from the media.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TAPE_WRITE) (\r
+  IN EFI_TAPE_IO_PROTOCOL *This,\r
+  IN UINTN                *BufferSize,\r
+  IN VOID                 *Buffer\r
+  )\r
+; \r
+  \r
+\r
+/**\r
+  Rewinds the tape.\r
+\r
+  @param  This A pointer to the EFI_TAPE_IO_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS      The media was successfully repositioned.\r
+  @retval EFI_NO_MEDIA     No media is loaded in the device.\r
+  @retval EFI_NOT_READY    Repositioning the media failed since the device was not\r
+                           ready (e.g. not online). The transfer may be retried at a later time.\r
+  @retval EFI_UNSUPPORTED  The device does not support this type of media repositioning.\r
+  @retval EFI_TIMEOUT      Repositioning of the media did not complete within the timeout specified.\r
+  @retval EFI_DEVICE_ERROR A device error occurred while attempting to reposition the media.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TAPE_REWIND) (\r
+  IN EFI_TAPE_IO_PROTOCOL *This\r
+  )\r
+;   \r
+\r
+\r
+/**\r
+  Positions the tape.\r
+\r
+  @param  This      A pointer to the EFI_TAPE_IO_PROTOCOL instance.\r
+  @param  Direction Direction and number of data blocks or filemarks to space over on media.\r
+  @param  Type      Type of mark to space over on media.\r
+\r
+  @retval EFI_SUCCESS       The media was successfully repositioned.\r
+  @retval EFI_END_OF_MEDIA  Beginning or end of media was reached before the\r
+                            indicated number of data blocks or filemarks were found.\r
+  @retval EFI_NO_MEDIA      No media is loaded in the device.\r
+  @retval EFI_NOT_READY     The reposition failed since the device was not ready (e.g. not\r
+                            online). The reposition may be retried at a later time.\r
+  @retval EFI_UNSUPPORTED   The device does not support this type of repositioning.\r
+  @retval EFI_TIMEOUT       The repositioning failed to complete within the timeout specified.\r
+  @retval EFI_MEDIA_CHANGED The media in the device was changed since the last access.\r
+                            Repositioning the media was aborted since the current\r
+                            position of the media may be incorrect.\r
+  @retval EFI_DEVICE_ERROR  A device error occurred while attempting to reposition the media.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TAPE_SPACE) (\r
+  IN EFI_TAPE_IO_PROTOCOL *This,\r
+  INTN                    Direction,\r
+  UINTN                   Type\r
+  )\r
+;   \r
+\r
+\r
+/**\r
+  Writes filemarks to the media.\r
+\r
+  @param  This  A pointer to the EFI_TAPE_IO_PROTOCOL instance.\r
+  @param  Count Number of filemarks to write to the media.\r
+\r
+  @retval EFI_SUCCESS       Data was successfully transferred from the media.\r
+  @retval EFI_NO_MEDIA      No media is loaded in the device.\r
+  @retval EFI_NOT_READY     The transfer failed since the device was not ready (e.g. not\r
+                            online). The transfer may be retried at a later time.\r
+  @retval EFI_UNSUPPORTED   The device does not support this type of repositioning.\r
+  @retval EFI_TIMEOUT       The transfer failed to complete within the timeout specified.\r
+  @retval EFI_MEDIA_CHANGED The media in the device was changed since the last access.\r
+                            The transfer was aborted since the current position of the\r
+                            media may be incorrect.\r
+  @retval EFI_DEVICE_ERROR  A device error occurred while attempting to transfer data from the media.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TAPE_WRITEFM) (\r
+  IN EFI_TAPE_IO_PROTOCOL *This,\r
+  IN UINTN                Count\r
+  )\r
+;   \r
+\r
+\r
+/**\r
+  Resets the tape device.\r
+\r
+  @param  This                 A pointer to the EFI_TAPE_IO_PROTOCOL instance.\r
+  @param  ExtendedVerification Indicates whether the parent bus should also be reset.\r
+\r
+  @retval  EFI_SUCCESS      The bus and/or device were successfully reset.\r
+  @retval  EFI_NO_MEDIA     No media is loaded in the device.\r
+  @retval  EFI_NOT_READY    The reset failed since the device and/or bus was not ready.\r
+                            The reset may be retried at a later time.\r
+  @retval  EFI_UNSUPPORTED  The device does not support this type of reset.\r
+  @retval  EFI_TIMEOUT      The reset did not complete within the timeout allowed.\r
+  @retval  EFI_DEVICE_ERROR A device error occurred while attempting to reset the bus and/or device.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TAPE_RESET) (\r
+  IN EFI_TAPE_IO_PROTOCOL *This,\r
+  IN BOOLEAN              ExtendedVerification\r
+  )\r
+;    \r
+\r
+struct _EFI_TAPE_IO_PROTOCOL {\r
+  EFI_TAPE_READ           TapeRead;\r
+  EFI_TAPE_WRITE          TapeWrite;\r
+  EFI_TAPE_REWIND         TapeRewind;\r
+  EFI_TAPE_SPACE          TapeSpace;\r
+  EFI_TAPE_WRITEFM        TapeWriteFM;\r
+  EFI_TAPE_RESET          TapeReset;\r
+};\r
+\r
+extern EFI_GUID gEfiTapeIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Tcp4.h b/MdePkg/Include/Protocol/Tcp4.h
new file mode 100644 (file)
index 0000000..42aebdc
--- /dev/null
@@ -0,0 +1,510 @@
+/** @file\r
+  EFI TCPv4 Protocol Definition\r
+  The EFI TCPv4 Service Binding Protocol is used to locate EFI TCPv4 Protocol drivers to create\r
+  and destroy child of the driver to communicate with other host using TCP protocol.      \r
+  The EFI TCPv4 Protocol provides services to send and receive data stream.     \r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Tcp4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_TCP4_PROTOCOL_H__\r
+#define __EFI_TCP4_PROTOCOL_H__\r
+\r
+#include <Protocol/Ip4.h>\r
+\r
+#define EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x00720665, 0x67EB, 0x4a99, {0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } \\r
+  }\r
+\r
+#define EFI_TCP4_PROTOCOL_GUID \\r
+  { \\r
+    0x65530BC7, 0xA359, 0x410f, {0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } \\r
+  }\r
+\r
+typedef struct _EFI_TCP4_PROTOCOL EFI_TCP4_PROTOCOL;\r
+\r
+typedef struct {\r
+  EFI_HANDLE        InstanceHandle;\r
+  EFI_IPv4_ADDRESS        LocalAddress;\r
+  UINT16                  LocalPort;\r
+  EFI_IPv4_ADDRESS        RemoteAddress;\r
+  UINT16                  RemotePort;\r
+} EFI_TCP4_SERVICE_POINT;\r
+\r
+typedef struct {\r
+  EFI_HANDLE              DriverHandle;\r
+  UINT32                  ServiceCount;\r
+  EFI_TCP4_SERVICE_POINT  Services[1];\r
+} EFI_TCP4_VARIABLE_DATA;\r
+\r
+typedef struct {\r
+  BOOLEAN                 UseDefaultAddress;\r
+  EFI_IPv4_ADDRESS        StationAddress;\r
+  EFI_IPv4_ADDRESS        SubnetMask;\r
+  UINT16                  StationPort;\r
+  EFI_IPv4_ADDRESS        RemoteAddress;\r
+  UINT16                  RemotePort;\r
+  BOOLEAN                 ActiveFlag;\r
+} EFI_TCP4_ACCESS_POINT;\r
+\r
+typedef struct {\r
+  UINTN                   ReceiveBufferSize;\r
+  UINTN                   SendBufferSize;\r
+  UINTN                   MaxSynBackLog;\r
+  UINTN                   ConnectionTimeout;\r
+  UINTN                   DataRetries;\r
+  UINTN                   FinTimeout;\r
+  UINTN                   TimeWaitTimeout;\r
+  UINTN                   KeepAliveProbes;\r
+  UINTN                   KeepAliveTime;\r
+  UINTN                   KeepAliveInterval;\r
+  BOOLEAN                 EnableNagle;\r
+  BOOLEAN                 EnableTimeStamp;\r
+  BOOLEAN                 EnableWindowScaling;\r
+  BOOLEAN                 EnableSelectiveAck;\r
+  BOOLEAN                 EnablePathMtuDiscovery;\r
+} EFI_TCP4_OPTION;\r
+\r
+typedef struct {\r
+  //\r
+  // I/O parameters\r
+  //\r
+  UINT8                   TypeOfService;\r
+  UINT8                   TimeToLive;\r
+\r
+  //\r
+  // Access Point\r
+  //\r
+  EFI_TCP4_ACCESS_POINT   AccessPoint;\r
+                          \r
+  //                      \r
+  // TCP Control Options  \r
+  //                      \r
+  EFI_TCP4_OPTION         *ControlOption;\r
+} EFI_TCP4_CONFIG_DATA;\r
+\r
+typedef enum {\r
+  Tcp4StateClosed         = 0,\r
+  Tcp4StateListen         = 1,\r
+  Tcp4StateSynSent        = 2,\r
+  Tcp4StateSynReceived    = 3,\r
+  Tcp4StateEstablished    = 4,\r
+  Tcp4StateFinWait1       = 5,\r
+  Tcp4StateFinWait2       = 6,\r
+  Tcp4StateClosing        = 7,\r
+  Tcp4StateTimeWait       = 8,\r
+  Tcp4StateCloseWait      = 9,\r
+  Tcp4StateLastAck        = 10\r
+} EFI_TCP4_CONNECTION_STATE;\r
+\r
+typedef struct {\r
+  EFI_EVENT   Event;\r
+  EFI_STATUS  Status;\r
+} EFI_TCP4_COMPLETION_TOKEN;\r
+\r
+typedef struct {\r
+  EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
+} EFI_TCP4_CONNECTION_TOKEN;\r
+\r
+typedef struct {\r
+  EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
+  EFI_HANDLE                NewChildHandle;\r
+} EFI_TCP4_LISTEN_TOKEN;\r
+\r
+typedef struct {\r
+  UINTN FragmentLength;\r
+  VOID  *FragmentBuffer;\r
+} EFI_TCP4_FRAGMENT_DATA;\r
+\r
+typedef struct {\r
+  BOOLEAN                   UrgentFlag;\r
+  IN OUT UINTN              DataLength;\r
+  UINTN                     FragmentCount;\r
+  EFI_TCP4_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_TCP4_RECEIVE_DATA;    \r
+\r
+typedef struct {            \r
+  BOOLEAN                   Push;\r
+  BOOLEAN                   Urgent;\r
+  UINTN                     DataLength;\r
+  UINTN                     FragmentCount;\r
+  EFI_TCP4_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_TCP4_TRANSMIT_DATA;\r
+\r
+typedef struct {\r
+  EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
+  union {\r
+    EFI_TCP4_RECEIVE_DATA   *RxData;\r
+    EFI_TCP4_TRANSMIT_DATA  *TxData;\r
+  } Packet;\r
+} EFI_TCP4_IO_TOKEN;\r
+\r
+typedef struct {\r
+  EFI_TCP4_COMPLETION_TOKEN CompletionToken;\r
+  BOOLEAN                   AbortOnClose;\r
+} EFI_TCP4_CLOSE_TOKEN;\r
+\r
+//\r
+// Interface definition for TCP4 protocol\r
+//\r
+\r
+/**\r
+  Get the current operational status.\r
+\r
+  @param  This           Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  Tcp4State      Pointer to the buffer to receive the current TCP state.\r
+  @param  Tcp4ConfigData Pointer to the buffer to receive the current TCP configuration.\r
+  @param  Ip4ModeData    Pointer to the buffer to receive the current IPv4 configuration\r
+                         data used by the TCPv4 instance.\r
+  @param  MnpConfigData  Pointer to the buffer to receive the current MNP configuration\r
+                         data used indirectly by the TCPv4 instance.\r
+  @param  SnpModeData    Pointer to the buffer to receive the current SNP configuration\r
+                         data used indirectly by the TCPv4 instance.\r
+\r
+  @retval EFI_SUCCESS           The mode data was read.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_NOT_STARTED       No configuration data is available because this instance hasn't\r
+                                 been started.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_GET_MODE_DATA) (\r
+  IN CONST  EFI_TCP4_PROTOCOL                  *This,\r
+  OUT       EFI_TCP4_CONNECTION_STATE          *Tcp4State      OPTIONAL,\r
+  OUT       EFI_TCP4_CONFIG_DATA               *Tcp4ConfigData OPTIONAL,\r
+  OUT       EFI_IP4_MODE_DATA                  *Ip4ModeData    OPTIONAL,\r
+  OUT       EFI_MANAGED_NETWORK_CONFIG_DATA    *MnpConfigData  OPTIONAL,\r
+  OUT       EFI_SIMPLE_NETWORK_MODE            *SnpModeData    OPTIONAL\r
+  )\r
+;\r
+  \r
+/**\r
+  Initialize or brutally reset the operational parameters for this EFI TCPv4 instance.\r
+\r
+  @param  This           Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  Tcp4ConfigData Pointer to the configure data to configure the instance.\r
+\r
+  @retval EFI_SUCCESS           The operational settings are set, changed, or reset\r
+                                successfully.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (through\r
+                                DHCP, BOOTP, RARP, etc.) is not finished yet.\r
+  @retval EFI_ACCESS_DENIED     Configuring TCP instance when it is configured without\r
+                                calling Configure() with NULL to reset it.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred.\r
+  @retval EFI_UNSUPPORTED       One or more of the control options are not supported in\r
+                                the implementation.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough system resources when\r
+                                executing Configure().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_CONFIGURE) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN EFI_TCP4_CONFIG_DATA                *TcpConfigData OPTIONAL\r
+  )\r
+;\r
+    \r
+\r
+/**\r
+  Add or delete a route entry to the route table\r
+\r
+  @param  This           Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  DeleteRoute    Set it to TRUE to delete this route from the routing table. Set it to\r
+                         FALSE to add this route to the routing table.\r
+                         DestinationAddress and SubnetMask are used as the\r
+                         keywords to search route entry.\r
+  @param  SubnetAddress  The destination network.\r
+  @param  SubnetMask     The subnet mask of the destination network.\r
+  @param  GatewayAddress The gateway address for this route. It must be on the same\r
+                         subnet with the station address unless a direct route is specified.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_NOT_STARTED       The EFI TCPv4 Protocol instance has not been configured.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - SubnetAddress is NULL.\r
+                                - SubnetMask is NULL.\r
+                                - GatewayAddress is NULL.\r
+                                - *SubnetAddress is not NULL a valid subnet address.\r
+                                - *SubnetMask is not a valid subnet mask.\r
+                                - *GatewayAddress is not a valid unicast IP address or it\r
+                                is not in the same subnet.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough resources to add the entry to the\r
+                                routing table.\r
+  @retval EFI_NOT_FOUND         This route is not in the routing table.\r
+  @retval EFI_ACCESS_DENIED     The route is already defined in the routing table.\r
+  @retval EFI_UNSUPPORTED       The TCP driver does not support this operation.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_ROUTES) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN BOOLEAN                             DeleteRoute,\r
+  IN EFI_IPv4_ADDRESS                    *SubnetAddress,\r
+  IN EFI_IPv4_ADDRESS                    *SubnetMask,\r
+  IN EFI_IPv4_ADDRESS                    *GatewayAddress\r
+  )\r
+;  \r
+\r
+/**\r
+  Initiate a nonblocking TCP connection request for an active TCP instance.\r
+\r
+  @param  This                  Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  ConnectionToken       Pointer to the connection token to return when the TCP three\r
+                                way handshake finishes.\r
+                                 \r
+  @retval EFI_SUCCESS           The connection request is successfully initiated and the state\r
+                                - of this TCPv4 instance has been changed to\r
+                                - Tcp4StateSynSent.\r
+  @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.\r
+  @retval EFI_ACCESS_DENIED     One or more of the following conditions are TRUE:\r
+                                - This instance is not configured as an active one.\r
+                                - This instance is not in Tcp4StateClosed state.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
+                                - This is NULL.\r
+                                - ConnectionToken is NULL.\r
+                                - ConnectionToken->CompletionToken.Event is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  The driver can't allocate enough resource to initiate the activeopen.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_CONNECT) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN EFI_TCP4_CONNECTION_TOKEN           *ConnectionToken\r
+  )\r
+;  \r
+  \r
+\r
+/**\r
+  Listen on the passive instance to accept an incoming connection request. This is a nonblocking operation.\r
+\r
+  @param  This        Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  ListenToken Pointer to the listen token to return when operation finishes.\r
+\r
+  @retval EFI_SUCCESS           The listen token has been queued successfully.\r
+  @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.\r
+  @retval EFI_ACCESS_DENIED     One or more of the following are TRUE:\r
+                                - This instance is not a passive instance.\r
+                                - This instance is not in Tcp4StateListen state.\r
+                                - The same listen token has already existed in the listen\r
+                                token queue of this TCP instance.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
+                                - This is NULL.\r
+                                - ListenToken is NULL.\r
+                                - ListentToken->CompletionToken.Event is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough resource to finish the operation.\r
+  @retval EFI_DEVICE_ERROR      Any unexpected and not belonged to above category error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_ACCEPT) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN EFI_TCP4_LISTEN_TOKEN               *ListenToken\r
+  )\r
+;    \r
+\r
+/**\r
+  Queues outgoing data into the transmit queue.\r
+\r
+  @param  This  Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  Token Pointer to the completion token to queue to the transmit queue.\r
+\r
+  @retval EFI_SUCCESS             The data has been queued for transmission.\r
+  @retval EFI_NOT_STARTED         This EFI TCPv4 Protocol instance has not been configured.\r
+  @retval EFI_NO_MAPPING          When using a default address, configuration (DHCP, BOOTP,\r
+                                  RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER   One or more of the following are TRUE:\r
+                                  - This is NULL.\r
+                                  - Token is NULL.\r
+                                  - Token->CompletionToken.Event is NULL.\r
+                                  - Token->Packet.TxData is NULL L.\r
+                                  - Token->Packet.FragmentCount is zero.\r
+                                  - Token->Packet.DataLength is not equal to the sum of fragment lengths.\r
+  @retval EFI_ACCESS_DENIED       One or more of the following conditions is TRUE:\r
+                                  - A transmit completion token with the same Token->CompletionToken.Event\r
+                                  was already in the transmission queue.\r
+                                  - The current instance is in Tcp4StateClosed state.\r
+                                  - The current instance is a passive one and it is in\r
+                                  Tcp4StateListen state.\r
+                                  - User has called Close() to disconnect this connection.\r
+  @retval EFI_NOT_READY           The completion token could not be queued because the\r
+                                  transmit queue is full.\r
+  @retval EFI_OUT_OF_RESOURCES    Could not queue the transmit data because of resource\r
+                                  shortage.\r
+  @retval EFI_NETWORK_UNREACHABLE There is no route to the destination network or address.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_TRANSMIT) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN EFI_TCP4_IO_TOKEN                   *Token\r
+  )\r
+;      \r
+\r
+\r
+/**\r
+  Places an asynchronous receive request into the receiving queue.\r
+\r
+  @param  This  Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that is associated with the receive data\r
+                descriptor.\r
+\r
+  @retval EFI_SUCCESS           The receive completion token was cached.\r
+  @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP, RARP,\r
+                                etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - Token is NULL.\r
+                                - Token->CompletionToken.Event is NULL.\r
+                                - Token->Packet.RxData is NULL.\r
+                                - Token->Packet.RxData->DataLength is 0.\r
+                                - The Token->Packet.RxData->DataLength is not\r
+                                the sum of all FragmentBuffer length in FragmentTable.\r
+  @retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of\r
+                               system resources (usually memory).\r
+  @retval EFI_DEVICE_ERROR     An unexpected system or network error occurred.\r
+  @retval EFI_ACCESS_DENIED    One or more of the following conditions is TRUE:\r
+                               - A receive completion token with the same Token-\r
+                               >CompletionToken.Event was already in the receive\r
+                               queue.\r
+                               - The current instance is in Tcp4StateClosed state.\r
+                               - The current instance is a passive one and it is in\r
+                               Tcp4StateListen state.\r
+                               - User has called Close() to disconnect this connection.\r
+  @retval EFI_CONNECTION_FIN   The communication peer has closed the connection and there is\r
+                               no any buffered data in the receive buffer of this instance.\r
+  @retval EFI_NOT_READY        The receive request could not be queued because the receive queue is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_RECEIVE) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN EFI_TCP4_IO_TOKEN                   *Token\r
+  )\r
+;       \r
+   \r
+/**\r
+  Disconnecting a TCP connection gracefully or reset a TCP connection. This function is a\r
+  nonblocking operation.                                                                                                                                                                        \r
+\r
+  @param  This       Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  CloseToken Pointer to the close token to return when operation finishes.\r
+\r
+  @retval EFI_SUCCESS           The Close() is called successfully.\r
+  @retval EFI_NOT_STARTED       This EFI TCPv4 Protocol instance has not been configured.\r
+  @retval EFI_ACCESS_DENIED     One or more of the following are TRUE:\r
+                                - Configure() has been called with\r
+                                TcpConfigData set to NULL and this function has\r
+                                not returned.\r
+                                - Previous Close() call on this instance has not\r
+                                finished.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:\r
+                                - This is NULL.\r
+                                - CloseToken is NULL.\r
+                                - CloseToken->CompletionToken.Event is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough resource to finish the operation.\r
+  @retval EFI_DEVICE_ERROR      Any unexpected and not belonged to above category error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_CLOSE) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN EFI_TCP4_CLOSE_TOKEN                *CloseToken\r
+  )\r
+;      \r
+\r
+/**\r
+  Abort an asynchronous connection, listen, transmission or receive request.\r
+\r
+  @param  This  Pointer to the EFI_TCP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that has been issued by\r
+                EFI_TCP4_PROTOCOL.Connect(),\r
+                EFI_TCP4_PROTOCOL.Accept(),\r
+                EFI_TCP4_PROTOCOL.Transmit() or\r
+                EFI_TCP4_PROTOCOL.Receive(). If NULL, all pending\r
+                tokens issued by above four functions will be aborted. Type\r
+                EFI_TCP4_COMPLETION_TOKEN is defined in\r
+                EFI_TCP4_PROTOCOL.Connect().\r
+\r
+  @retval  EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval  EFI_NOT_READY         No incoming or outgoing data is processed.\r
+  @retval  EFI_TIMEOUT           Data was dropped out of the transmission or receive queue.\r
+                                 Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_CANCEL) (\r
+  IN EFI_TCP4_PROTOCOL                   *This,\r
+  IN EFI_TCP4_COMPLETION_TOKEN           *Token OPTIONAL\r
+  )\r
+;      \r
+\r
+\r
+/**\r
+  Poll to receive incoming data and transmit outgoing segments.\r
+\r
+  @param  This Pointer to the EFI_TCP4_PROTOCOL instance.\r
+\r
+  @retval  EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval  EFI_NOT_READY         No incoming or outgoing data is processed.\r
+  @retval  EFI_TIMEOUT           Data was dropped out of the transmission or receive queue.\r
+                                 Consider increasing the polling rate.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_TCP4_POLL) (\r
+  IN EFI_TCP4_PROTOCOL                   *This\r
+  )\r
+;      \r
+\r
+struct _EFI_TCP4_PROTOCOL {\r
+  EFI_TCP4_GET_MODE_DATA                 GetModeData;\r
+  EFI_TCP4_CONFIGURE                     Configure;\r
+  EFI_TCP4_ROUTES                        Routes;\r
+  EFI_TCP4_CONNECT                       Connect;\r
+  EFI_TCP4_ACCEPT                        Accept;\r
+  EFI_TCP4_TRANSMIT                      Transmit;\r
+  EFI_TCP4_RECEIVE                       Receive;\r
+  EFI_TCP4_CLOSE                         Close;\r
+  EFI_TCP4_CANCEL                        Cancel;\r
+  EFI_TCP4_POLL                          Poll;\r
+};\r
+\r
+#define EFI_CONNECTION_FIN               EFIERR (104)\r
+#define EFI_CONNECTION_RESET             EFIERR (105)\r
+#define EFI_CONNECTION_REFUSED           EFIERR (106)\r
+\r
+extern EFI_GUID gEfiTcp4ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiTcp4ProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Timer.h b/MdePkg/Include/Protocol/Timer.h
new file mode 100644 (file)
index 0000000..302ae14
--- /dev/null
@@ -0,0 +1,211 @@
+/** @file\r
+  Timer Architectural Protocol as defined in the DXE CIS\r
+\r
+  This code is used to provide the timer tick for the DXE core.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Timer.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_TIMER_H__\r
+#define __ARCH_PROTOCOL_TIMER_H__\r
+\r
+//\r
+// Global ID for the Timer Architectural Protocol\r
+//\r
+#define EFI_TIMER_ARCH_PROTOCOL_GUID \\r
+  { 0x26baccb3, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }\r
+\r
+//\r
+// Declare forward reference for the Timer Architectural Protocol\r
+//\r
+typedef struct _EFI_TIMER_ARCH_PROTOCOL   EFI_TIMER_ARCH_PROTOCOL;\r
+\r
+/**\r
+  This function of this type is called when a timer interrupt fires.  This \r
+  function executes at TPL_HIGH_LEVEL.  The DXE Core will register a funtion\r
+  of tyis type to be called for the timer interrupt, so it can know how much \r
+  time has passed.  This information is used to signal timer based events.  \r
+\r
+  @param  Time             Time since the last timer interrupt in 100 ns units. This will\r
+                           typically be TimerPeriod, but if a timer interrupt is missed, and the\r
+                           EFI_TIMER_ARCH_PROTOCOL driver can detect missed interrupts, then Time\r
+                           will contain the actual amount of time since the last interrupt.\r
+\r
+  None.\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_TIMER_NOTIFY) (\r
+  IN UINT64  Time\r
+  );\r
+\r
+/**\r
+  This function registers the handler NotifyFunction so it is called every time \r
+  the timer interrupt fires.  It also passes the amount of time since the last \r
+  handler call to the NotifyFunction.  If NotifyFunction is NULL, then the \r
+  handler is unregistered.  If the handler is registered, then EFI_SUCCESS is \r
+  returned.  If the CPU does not support registering a timer interrupt handler, \r
+  then EFI_UNSUPPORTED is returned.  If an attempt is made to register a handler \r
+  when a handler is already registered, then EFI_ALREADY_STARTED is returned.  \r
+  If an attempt is made to unregister a handler when a handler is not registered, \r
+  then EFI_INVALID_PARAMETER is returned.  If an error occurs attempting to \r
+  register the NotifyFunction with the timer interrupt, then EFI_DEVICE_ERROR \r
+  is returned.\r
+\r
+  @param  This             The EFI_TIMER_ARCH_PROTOCOL instance.\r
+  @param  NotifyFunction   The function to call when a timer interrupt fires. This\r
+                           function executes at TPL_HIGH_LEVEL. The DXE Core will\r
+                           register a handler for the timer interrupt, so it can know\r
+                           how much time has passed. This information is used to\r
+                           signal timer based events. NULL will unregister the handler.\r
+\r
+  @retval EFI_SUCCESS           The timer handler was registered.\r
+  @retval EFI_UNSUPPORTED       The platform does not support timer interrupts.\r
+  @retval EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a handler is already\r
+                                registered.\r
+  @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not\r
+                                previously registered.\r
+  @retval EFI_DEVICE_ERROR      The timer handler could not be registered.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TIMER_REGISTER_HANDLER) (\r
+  IN EFI_TIMER_ARCH_PROTOCOL    *This,\r
+  IN EFI_TIMER_NOTIFY           NotifyFunction\r
+);\r
+\r
+/**\r
+  This function adjusts the period of timer interrupts to the value specified \r
+  by TimerPeriod.  If the timer period is updated, then the selected timer \r
+  period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned.  If \r
+  the timer hardware is not programmable, then EFI_UNSUPPORTED is returned.  \r
+  If an error occurs while attempting to update the timer period, then the \r
+  timer hardware will be put back in its state prior to this call, and \r
+  EFI_DEVICE_ERROR is returned.  If TimerPeriod is 0, then the timer interrupt \r
+  is disabled.  This is not the same as disabling the CPU's interrupts.  \r
+  Instead, it must either turn off the timer hardware, or it must adjust the \r
+  interrupt controller so that a CPU interrupt is not generated when the timer \r
+  interrupt fires. \r
+\r
+  @param  This             The EFI_TIMER_ARCH_PROTOCOL instance.\r
+  @param  TimerPeriod      The rate to program the timer interrupt in 100 nS units. If\r
+                           the timer hardware is not programmable, then EFI_UNSUPPORTED is\r
+                           returned. If the timer is programmable, then the timer period\r
+                           will be rounded up to the nearest timer period that is supported\r
+                           by the timer hardware. If TimerPeriod is set to 0, then the\r
+                           timer interrupts will be disabled.\r
+\r
+  @retval EFI_SUCCESS           The timer period was changed.\r
+  @retval EFI_UNSUPPORTED       The platform cannot change the period of the timer interrupt.\r
+  @retval EFI_DEVICE_ERROR      The timer period could not be changed due to a device error.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TIMER_SET_TIMER_PERIOD) (\r
+  IN EFI_TIMER_ARCH_PROTOCOL    *This,\r
+  IN UINT64                     TimerPeriod\r
+  );\r
+\r
+/**\r
+  This function retrieves the period of timer interrupts in 100 ns units, \r
+  returns that value in TimerPeriod, and returns EFI_SUCCESS.  If TimerPeriod \r
+  is NULL, then EFI_INVALID_PARAMETER is returned.  If a TimerPeriod of 0 is \r
+  returned, then the timer is currently disabled.\r
+\r
+  @param  This             The EFI_TIMER_ARCH_PROTOCOL instance.\r
+  @param  TimerPeriod      A pointer to the timer period to retrieve in 100 ns units. If\r
+                           0 is returned, then the timer is currently disabled.\r
+\r
+  @retval EFI_SUCCESS           The timer period was returned in TimerPeriod.\r
+  @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TIMER_GET_TIMER_PERIOD) (\r
+  IN EFI_TIMER_ARCH_PROTOCOL      *This,\r
+  OUT UINT64                      *TimerPeriod\r
+  );\r
+\r
+/**\r
+  This function generates a soft timer interrupt. If the platform does not support soft \r
+  timer interrupts, then EFI_UNSUPPORTED is returned. Otherwise, EFI_SUCCESS is returned. \r
+  If a handler has been registered through the EFI_TIMER_ARCH_PROTOCOL.RegisterHandler() \r
+  service, then a soft timer interrupt will be generated. If the timer interrupt is \r
+  enabled when this service is called, then the registered handler will be invoked. The \r
+  registered handler should not be able to distinguish a hardware-generated timer \r
+  interrupt from a software-generated timer interrupt.\r
+\r
+  @param  This             The EFI_TIMER_ARCH_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           The soft timer interrupt was generated.\r
+  @retval EFI_UNSUPPORTEDT      The platform does not support the generation of soft timer interrupts.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_TIMER_GENERATE_SOFT_INTERRUPT) (\r
+  IN EFI_TIMER_ARCH_PROTOCOL    *This\r
+  );\r
+\r
+\r
+/**\r
+  Interface stucture for the Timer Architectural Protocol.\r
+\r
+  @par Protocol Description:\r
+  This protocol provides the services to initialize a periodic timer \r
+  interrupt, and to register a handler that is called each time the timer\r
+  interrupt fires.  It may also provide a service to adjust the rate of the\r
+  periodic timer interrupt.  When a timer interrupt occurs, the handler is \r
+  passed the amount of time that has passed since the previous timer \r
+  interrupt.\r
+\r
+  @param RegisterHandler\r
+  Registers a handler that will be called each time the \r
+  timer interrupt fires.  TimerPeriod defines the minimum \r
+  time between timer interrupts, so TimerPeriod will also \r
+  be the minimum time between calls to the registered \r
+  handler.\r
+\r
+  @param SetTimerPeriod\r
+  Sets the period of the timer interrupt in 100 nS units.  \r
+  This function is optional, and may return EFI_UNSUPPORTED.  \r
+  If this function is supported, then the timer period will \r
+  be rounded up to the nearest supported timer period.\r
+\r
+  @param GetTimerPeriod\r
+  Retrieves the period of the timer interrupt in 100 nS units.\r
+\r
+  @param GenerateSoftInterrupt\r
+  Generates a soft timer interrupt that simulates the firing of \r
+  the timer interrupt. This service can be used to invoke the \r
+  registered handler if the timer interrupt has been masked for \r
+  a period of time.\r
+\r
+**/\r
+struct _EFI_TIMER_ARCH_PROTOCOL {\r
+  EFI_TIMER_REGISTER_HANDLER          RegisterHandler;\r
+  EFI_TIMER_SET_TIMER_PERIOD          SetTimerPeriod;\r
+  EFI_TIMER_GET_TIMER_PERIOD          GetTimerPeriod;\r
+  EFI_TIMER_GENERATE_SOFT_INTERRUPT   GenerateSoftInterrupt;\r
+};\r
+\r
+extern EFI_GUID gEfiTimerArchProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Udp4.h b/MdePkg/Include/Protocol/Udp4.h
new file mode 100644 (file)
index 0000000..9725a1b
--- /dev/null
@@ -0,0 +1,364 @@
+/** @file\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Udp4.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_UDP4_PROTOCOL_H__\r
+#define __EFI_UDP4_PROTOCOL_H__\r
+\r
+#include <Protocol/Ip4.h>\r
+//\r
+//GUID definitions\r
+//\r
+#define EFI_UDP4_SERVICE_BINDING_PROTOCOL_GUID \\r
+  { \\r
+    0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } \\r
+  }\r
+\r
+#define EFI_UDP4_PROTOCOL_GUID \\r
+  { \\r
+    0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } \\r
+  }\r
+\r
+typedef struct _EFI_UDP4_PROTOCOL EFI_UDP4_PROTOCOL; \r
+  \r
+typedef struct {\r
+  EFI_HANDLE              InstanceHandle;\r
+  EFI_IPv4_ADDRESS        LocalAddress;\r
+  UINT16                  LocalPort;\r
+  EFI_IPv4_ADDRESS        RemoteAddress;\r
+  UINT16                  RemotePort;\r
+} EFI_UDP4_SERVICE_POINT; \r
+\r
+typedef struct {\r
+  EFI_HANDLE              DriverHandle;\r
+  UINT32                  ServiceCount;\r
+  EFI_UDP4_SERVICE_POINT  Services[1];\r
+} EFI_UDP4_VARIABLE_DATA;\r
+\r
+//\r
+//ICMP error definitions\r
+//\r
+#define EFI_NETWORK_UNREACHABLE      EFIERR(100)\r
+#define EFI_HOST_UNREACHABLE         EFIERR(101) \r
+#define EFI_PROTOCOL_UNREACHABLE     EFIERR(102)\r
+#define EFI_PORT_UNREACHABLE         EFIERR(103)\r
+\r
+\r
+typedef struct {\r
+  UINT32             FragmentLength;\r
+  VOID               *FragmentBuffer;\r
+} EFI_UDP4_FRAGMENT_DATA;\r
+\r
+typedef struct {\r
+  EFI_IPv4_ADDRESS   SourceAddress;\r
+  UINT16             SourcePort;\r
+  EFI_IPv4_ADDRESS   DestinationAddress;\r
+  UINT16             DestinationPort;\r
+} EFI_UDP4_SESSION_DATA;\r
+typedef struct {\r
+  //\r
+  // Receiving Filters\r
+  //\r
+  BOOLEAN            AcceptBroadcast;\r
+  BOOLEAN            AcceptPromiscuous;\r
+  BOOLEAN            AcceptAnyPort;\r
+  BOOLEAN            AllowDuplicatePort;\r
+  //\r
+  // I/O parameters\r
+  //\r
+  UINT8              TypeOfService;\r
+  UINT8              TimeToLive;\r
+  BOOLEAN            DoNotFragment;\r
+  UINT32             ReceiveTimeout;\r
+  UINT32             TransmitTimeout;\r
+  //\r
+  // Access Point\r
+  //\r
+  BOOLEAN            UseDefaultAddress;\r
+  EFI_IPv4_ADDRESS   StationAddress;\r
+  EFI_IPv4_ADDRESS   SubnetMask;\r
+  UINT16             StationPort;\r
+  EFI_IPv4_ADDRESS   RemoteAddress;\r
+  UINT16             RemotePort;\r
+} EFI_UDP4_CONFIG_DATA;\r
+\r
+typedef struct {\r
+  EFI_UDP4_SESSION_DATA     *UdpSessionData;       //OPTIONAL\r
+  EFI_IPv4_ADDRESS          *GatewayAddress;       //OPTIONAL\r
+  UINT32                    DataLength;\r
+  UINT32                    FragmentCount; \r
+  EFI_UDP4_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_UDP4_TRANSMIT_DATA;\r
+\r
+typedef struct {\r
+  EFI_TIME                  TimeStamp;\r
+  EFI_EVENT                 RecycleSignal;\r
+  EFI_UDP4_SESSION_DATA     UdpSession;\r
+  UINT32                    DataLength;\r
+  UINT32                    FragmentCount;\r
+  EFI_UDP4_FRAGMENT_DATA    FragmentTable[1];\r
+} EFI_UDP4_RECEIVE_DATA;\r
+\r
+\r
+typedef struct {\r
+  EFI_EVENT                 Event;\r
+  EFI_STATUS                Status;\r
+  union {\r
+    EFI_UDP4_RECEIVE_DATA   *RxData;\r
+    EFI_UDP4_TRANSMIT_DATA  *TxData;\r
+  } Packet;\r
+} EFI_UDP4_COMPLETION_TOKEN;\r
+\r
+/**\r
+  Reads the current operational settings.\r
+\r
+  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Udp4ConfigData Pointer to the buffer to receive the current configuration data.\r
+  @param  Ip4ModeData    Pointer to the EFI IPv4 Protocol mode data structure.\r
+  @param  MnpConfigData  Pointer to the managed network configuration data structure.\r
+  @param  SnpModeData    Pointer to the simple network mode data structure.\r
+\r
+  @retval EFI_SUCCESS           The mode data was read.\r
+  @retval EFI_NOT_STARTED       When Udp4ConfigData is queried, no configuration data is\r
+                                available because this instance has not been started.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_GET_MODE_DATA) (\r
+  IN  EFI_UDP4_PROTOCOL                *This,\r
+  OUT EFI_UDP4_CONFIG_DATA             *Udp4ConfigData OPTIONAL,\r
+  OUT EFI_IP4_MODE_DATA                *Ip4ModeData    OPTIONAL,\r
+  OUT EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL,\r
+  OUT EFI_SIMPLE_NETWORK_MODE          *SnpModeData    OPTIONAL\r
+  )\r
+;  \r
+  \r
+\r
+/**\r
+  Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4\r
+  Protocol.\r
+\r
+  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Udp4ConfigData Pointer to the buffer to receive the current configuration data.\r
+\r
+  @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+  @retval EFI_ALREADY_STARTED   The EFI UDPv4 Protocol instance is already started/configured\r
+                                and must be stopped/reset before it can be reconfigured.\r
+  @retval EFI_ACCESS_DENIED     UdpConfigData. AllowDuplicatePort is FALSE\r
+                                and UdpConfigData.StationPort is already used by\r
+                                other instance.\r
+  @retval EFI_OUT_OF_RESOURCES  The EFI UDPv4 Protocol driver cannot allocate memory for this\r
+                                EFI UDPv4 Protocol instance.\r
+  @retval EFI_DEVICE_ERROR      An unexpected network or system error occurred and this instance\r
+                                 was not opened. \r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_CONFIGURE) (\r
+  IN EFI_UDP4_PROTOCOL      *This,\r
+  IN EFI_UDP4_CONFIG_DATA   *UdpConfigData OPTIONAL\r
+  )\r
+;  \r
+\r
+/**\r
+  Joins and leaves multicast groups.\r
+\r
+  @param  This             Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  JoinFlag         Set to TRUE to join a multicast group. Set to FALSE to leave one\r
+                           or all multicast groups.\r
+  @param  MulticastAddress Pointer to multicast group address to join or leave.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_NOT_STARTED       The EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate resources to join the group.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+                                - This is NULL.\r
+                                - JoinFlag is TRUE and MulticastAddress is NULL.\r
+                                - JoinFlag is TRUE and *MulticastAddress is not\r
+                                  a valid multicast address.\r
+  @retval EFI_ALREADY_STARTED   The group address is already in the group table (when\r
+                                JoinFlag is TRUE).\r
+  @retval EFI_NOT_FOUND         The group address is not in the group table (when JoinFlag is\r
+                                FALSE).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_GROUPS) (\r
+  IN EFI_UDP4_PROTOCOL      *This,\r
+  IN BOOLEAN                JoinFlag,\r
+  IN EFI_IPv4_ADDRESS       *MulticastAddress    OPTIONAL\r
+  )\r
+;   \r
+\r
+/**\r
+  Adds and deletes routing table entries.\r
+\r
+  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  DeleteRoute    Set to TRUE to delete this route from the routing table.\r
+                         Set to FALSE to add this route to the routing table.\r
+  @param  SubnetAddress  The destination network address that needs to be routed.\r
+  @param  SubnetMask     The subnet mask of SubnetAddress.\r
+  @param  GatewayAddress The gateway IP address for this route.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_NOT_STARTED       The EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                - RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not add the entry to the routing table.\r
+  @retval EFI_NOT_FOUND         This route is not in the routing table.\r
+  @retval EFI_ACCESS_DENIED     The route is already defined in the routing table.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_ROUTES) (\r
+  IN EFI_UDP4_PROTOCOL      *This,\r
+  IN BOOLEAN                DeleteRoute,\r
+  IN EFI_IPv4_ADDRESS       *SubnetAddress,\r
+  IN EFI_IPv4_ADDRESS       *SubnetMask,\r
+  IN EFI_IPv4_ADDRESS       *GatewayAddress\r
+  )\r
+;     \r
+\r
+/**\r
+  Polls for incoming data packets and processes outgoing data packets.\r
+\r
+  @param  This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+\r
+  @retval EFI_SUCCESS           Incoming or outgoing data was processed.\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval EFI_TIMEOUT           Data was dropped out of the transmit and/or receive queue.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_POLL) (\r
+  IN EFI_UDP4_PROTOCOL      *This\r
+  )\r
+;   \r
+\r
+/**\r
+  Places an asynchronous receive request into the receiving queue.\r
+\r
+  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that is associated with the receive data\r
+                descriptor.\r
+\r
+  @retval EFI_SUCCESS           The receive completion token was cached.\r
+  @retval EFI_NOT_STARTED       This EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP, RARP, etc.)\r
+                                is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_OUT_OF_RESOURCES  The receive completion token could not be queued due to a lack of system\r
+                                resources (usually memory).\r
+  @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
+  @retval EFI_ACCESS_DENIED     A receive completion token with the same Token.Event was already in\r
+                                the receive queue.\r
+  @retval EFI_NOT_READY         The receive request could not be queued because the receive queue is full.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_RECEIVE) (\r
+  IN EFI_UDP4_PROTOCOL          *This,\r
+  IN EFI_UDP4_COMPLETION_TOKEN  *Token\r
+  )\r
+;   \r
+\r
+/**\r
+  Queues outgoing data packets into the transmit queue.\r
+\r
+  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token Pointer to the completion token that will be placed into the\r
+                transmit queue.\r
+\r
+  @retval EFI_SUCCESS           The data has been queued for transmission.\r
+  @retval EFI_NOT_STARTED       This EFI UDPv4 Protocol instance has not been started.\r
+  @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
+                                RARP, etc.) is not finished yet.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_ACCESS_DENIED     The transmit completion token with the same\r
+                                Token.Event was already in the transmit queue.\r
+  @retval EFI_NOT_READY         The completion token could not be queued because the\r
+                                transmit queue is full.\r
+  @retval EFI_OUT_OF_RESOURCES  Could not queue the transmit data.\r
+  @retval EFI_NOT_FOUND         There is no route to the destination network or address.\r
+  @retval EFI_BAD_BUFFER_SIZE   The data length is greater than the maximum UDP packet\r
+                                size. Or the length of the IP header + UDP header + data\r
+                                length is greater than MTU if DoNotFragment is TRUE.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_TRANSMIT) (\r
+  IN EFI_UDP4_PROTOCOL           *This,\r
+  IN EFI_UDP4_COMPLETION_TOKEN   *Token\r
+  )\r
+;     \r
+\r
+/**\r
+  Aborts an asynchronous transmit or receive request.\r
+\r
+  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token Pointer to a token that has been issued by\r
+                EFI_UDP4_PROTOCOL.Transmit() or\r
+                EFI_UDP4_PROTOCOL.Receive().If NULL, all pending\r
+                tokens are aborted.\r
+\r
+  @retval  EFI_SUCCESS           The asynchronous I/O request was aborted and Token.Event\r
+                                 was signaled. When Token is NULL, all pending requests are\r
+                                 aborted and their events are signaled.\r
+  @retval  EFI_INVALID_PARAMETER This is NULL.\r
+  @retval  EFI_NOT_STARTED       This instance has not been started.\r
+  @retval  EFI_NO_MAPPING        When using the default address, configuration (DHCP, BOOTP,\r
+                                 RARP, etc.) is not finished yet.\r
+  @retval  EFI_NOT_FOUND         When Token is not NULL, the asynchronous I/O request was\r
+                                 not found in the transmit or receive queue. It has either completed\r
+                                 or was not issued by Transmit() and Receive().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UDP4_CANCEL)(\r
+  IN EFI_UDP4_PROTOCOL          *This,\r
+  IN EFI_UDP4_COMPLETION_TOKEN  *Token  OPTIONAL\r
+  )\r
+;       \r
+\r
+struct _EFI_UDP4_PROTOCOL {\r
+  EFI_UDP4_GET_MODE_DATA        GetModeData;\r
+  EFI_UDP4_CONFIGURE            Configure;\r
+  EFI_UDP4_GROUPS               Groups;\r
+  EFI_UDP4_ROUTES               Routes;\r
+  EFI_UDP4_TRANSMIT             Transmit;\r
+  EFI_UDP4_RECEIVE              Receive;\r
+  EFI_UDP4_CANCEL               Cancel;\r
+  EFI_UDP4_POLL                 Poll;\r
+};\r
+\r
+extern EFI_GUID gEfiUdp4ServiceBindingProtocolGuid;\r
+extern EFI_GUID gEfiUdp4ProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/UgaDraw.h b/MdePkg/Include/Protocol/UgaDraw.h
new file mode 100644 (file)
index 0000000..5586bdf
--- /dev/null
@@ -0,0 +1,168 @@
+/** @file\r
+  UGA Draw protocol from the EFI 1.1 specification.\r
+\r
+  Abstraction of a very simple graphics device.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  UgaDraw.h\r
+\r
+**/\r
+\r
+#ifndef __UGA_DRAW_H__\r
+#define __UGA_DRAW_H__\r
+\r
+#define EFI_UGA_DRAW_PROTOCOL_GUID \\r
+  { \\r
+    0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \\r
+  }\r
+\r
+typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;\r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This                  Protocol instance pointer.\r
+  @param  HorizontalResolution  Current video horizontal resolution in pixels\r
+  @param  VerticalResolution    Current video vertical resolution in pixels\r
+  @param  ColorDepth            Current video color depth in bits per pixel\r
+  @param  RefreshRate           Current video refresh rate in Hz.\r
+\r
+  @retval EFI_SUCCESS           Mode information returned.\r
+  @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()\r
+  @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) (\r
+  IN  EFI_UGA_DRAW_PROTOCOL *This,\r
+  OUT UINT32                *HorizontalResolution,\r
+  OUT UINT32                *VerticalResolution,\r
+  OUT UINT32                *ColorDepth,\r
+  OUT UINT32                *RefreshRate\r
+  )\r
+;\r
+\r
+/**\r
+  Return the current video mode information.\r
+\r
+  @param  This                 Protocol instance pointer.\r
+  @param  HorizontalResolution Current video horizontal resolution in pixels\r
+  @param  VerticalResolution   Current video vertical resolution in pixels\r
+  @param  ColorDepth           Current video color depth in bits per pixel\r
+  @param  RefreshRate          Current video refresh rate in Hz.\r
+\r
+  @retval EFI_SUCCESS          Mode information returned.\r
+  @retval EFI_NOT_STARTED      Video display is not initialized. Call SetMode ()\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE) (\r
+  IN  EFI_UGA_DRAW_PROTOCOL *This,\r
+  IN  UINT32                HorizontalResolution,\r
+  IN  UINT32                VerticalResolution,\r
+  IN  UINT32                ColorDepth,\r
+  IN  UINT32                RefreshRate\r
+  )\r
+;\r
+\r
+typedef struct {\r
+  UINT8 Blue;\r
+  UINT8 Green;\r
+  UINT8 Red;\r
+  UINT8 Reserved;\r
+} EFI_UGA_PIXEL;\r
+\r
+typedef union {\r
+  EFI_UGA_PIXEL Pixel;\r
+  UINT32        Raw;\r
+} EFI_UGA_PIXEL_UNION;\r
+\r
+typedef enum {\r
+  EfiUgaVideoFill,\r
+  EfiUgaVideoToBltBuffer,\r
+  EfiUgaBltBufferToVideo,\r
+  EfiUgaVideoToVideo,\r
+  EfiUgaBltMax\r
+} EFI_UGA_BLT_OPERATION;\r
+\r
+/**\r
+  Type specifying a pointer to a function to perform an UGA Blt operation.\r
+\r
+    The following table defines actions for BltOperations:\r
+\r
+    <B>EfiUgaVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY) \r
+      directly to every pixel of the video display rectangle \r
+      (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). \r
+      Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+\r
+    <B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle \r
+      (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in \r
+      the BltBuffer rectangle (DestinationX, DestinationY ) \r
+      (DestinationX + Width, DestinationY + Height). If DestinationX or \r
+      DestinationY is not zero then Delta must be set to the length in bytes \r
+      of a row in the BltBuffer.\r
+\r
+    <B>EfiUgaBltBufferToVideo</B> - Write data from the  BltBuffer rectangle \r
+      (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the \r
+      video display rectangle (DestinationX, DestinationY) \r
+      (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is \r
+      not zero then Delta must be set to the length in bytes of a row in the \r
+      BltBuffer.\r
+\r
+    <B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)\r
+     (SourceX + Width, SourceY + Height) .to the video display rectangle \r
+     (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). \r
+     The BltBuffer and Delta  are not used in this mode.\r
+\r
+\r
+    @param[in] This          - Protocol instance pointer.\r
+    @param[in] BltBuffer     - Buffer containing data to blit into video buffer. This \r
+                               buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r
+    @param[in] BltOperation  - Operation to perform on BlitBuffer and video memory\r
+    @param[in] SourceX       - X coordinate of source for the BltBuffer.\r
+    @param[in] SourceY       - Y coordinate of source for the BltBuffer.\r
+    @param[in] DestinationX  - X coordinate of destination for the BltBuffer.\r
+    @param[in] DestinationY  - Y coordinate of destination for the BltBuffer.\r
+    @param[in] Width         - Width of rectangle in BltBuffer in pixels.\r
+    @param[in] Height        - Hight of rectangle in BltBuffer in pixels.\r
+    @param[in] Delta         - OPTIONAL\r
+  \r
+    @retval EFI_SUCCESS           - The Blt operation completed.\r
+    @retval EFI_INVALID_PARAMETER - BltOperation is not valid.\r
+    @retval EFI_DEVICE_ERROR      - A hardware error occured writting to the video buffer.\r
+\r
+--*/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) (\r
+  IN  EFI_UGA_DRAW_PROTOCOL                   * This,\r
+  IN  EFI_UGA_PIXEL                           * BltBuffer, OPTIONAL\r
+  IN  EFI_UGA_BLT_OPERATION                   BltOperation,\r
+  IN  UINTN                                   SourceX,\r
+  IN  UINTN                                   SourceY,\r
+  IN  UINTN                                   DestinationX,\r
+  IN  UINTN                                   DestinationY,\r
+  IN  UINTN                                   Width,\r
+  IN  UINTN                                   Height,\r
+  IN  UINTN                                   Delta         OPTIONAL\r
+  );\r
+\r
+struct _EFI_UGA_DRAW_PROTOCOL {\r
+  EFI_UGA_DRAW_PROTOCOL_GET_MODE  GetMode;\r
+  EFI_UGA_DRAW_PROTOCOL_SET_MODE  SetMode;\r
+  EFI_UGA_DRAW_PROTOCOL_BLT       Blt;\r
+};\r
+\r
+extern EFI_GUID gEfiUgaDrawProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/UgaIo.h b/MdePkg/Include/Protocol/UgaIo.h
new file mode 100644 (file)
index 0000000..b1e7d44
--- /dev/null
@@ -0,0 +1,237 @@
+\r
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  UgaIo.h\r
+\r
+Abstract:\r
+\r
+  UGA IO protocol from the EFI 1.1 specification.\r
+\r
+  Abstraction of a very simple graphics device.\r
+\r
+--*/\r
+\r
+#ifndef __UGA_IO_H__\r
+#define __UGA_IO_H__\r
+\r
+#define EFI_UGA_IO_PROTOCOL_GUID \\r
+  { \\r
+    0x61a4d49e, 0x6f68, 0x4f1b, { 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 } \\r
+  }\r
+\r
+typedef struct _EFI_UGA_IO_PROTOCOL EFI_UGA_IO_PROTOCOL;\r
+\r
+typedef UINT32                      UGA_STATUS;\r
+\r
+typedef enum {\r
+  UgaDtParentBus          = 1,\r
+  UgaDtGraphicsController,\r
+  UgaDtOutputController,\r
+  UgaDtOutputPort,\r
+  UgaDtOther\r
+}\r
+UGA_DEVICE_TYPE, *PUGA_DEVICE_TYPE;\r
+\r
+typedef UINT32 UGA_DEVICE_ID, *PUGA_DEVICE_ID;\r
+\r
+typedef struct {\r
+  UGA_DEVICE_TYPE deviceType;\r
+  UGA_DEVICE_ID   deviceId;\r
+  UINT32          ui32DeviceContextSize;\r
+  UINT32          ui32SharedContextSize;\r
+}\r
+UGA_DEVICE_DATA, *PUGA_DEVICE_DATA;\r
+\r
+typedef struct _UGA_DEVICE {\r
+  VOID                *pvDeviceContext;\r
+  VOID                *pvSharedContext;\r
+  VOID                *pvRunTimeContext;\r
+  struct _UGA_DEVICE  *pParentDevice;\r
+  VOID                *pvBusIoServices;\r
+  VOID                *pvStdIoServices;\r
+  UGA_DEVICE_DATA     deviceData;\r
+}\r
+UGA_DEVICE, *PUGA_DEVICE;\r
+\r
+#ifndef UGA_IO_REQUEST_CODE\r
+//\r
+// Prevent conflicts with UGA typedefs.\r
+//\r
+typedef enum {\r
+  UgaIoGetVersion             = 1,\r
+  UgaIoGetChildDevice,\r
+  UgaIoStartDevice,\r
+  UgaIoStopDevice,\r
+  UgaIoFlushDevice,\r
+  UgaIoResetDevice,\r
+  UgaIoGetDeviceState,\r
+  UgaIoSetDeviceState,\r
+  UgaIoSetPowerState,\r
+  UgaIoGetMemoryConfiguration,\r
+  UgaIoSetVideoMode,\r
+  UgaIoCopyRectangle,\r
+  UgaIoGetEdidSegment,\r
+  UgaIoDeviceChannelOpen,\r
+  UgaIoDeviceChannelClose,\r
+  UgaIoDeviceChannelRead,\r
+  UgaIoDeviceChannelWrite,\r
+  UgaIoGetPersistentDataSize,\r
+  UgaIoGetPersistentData,\r
+  UgaIoSetPersistentData,\r
+  UgaIoGetDevicePropertySize,\r
+  UgaIoGetDeviceProperty,\r
+  UgaIoBtPrivateInterface\r
+}\r
+UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE;\r
+\r
+#endif\r
+\r
+typedef struct {\r
+  IN UGA_IO_REQUEST_CODE  ioRequestCode;\r
+  IN VOID                 *pvInBuffer;\r
+  IN UINT64               ui64InBufferSize;\r
+  OUT VOID                *pvOutBuffer;\r
+  IN UINT64               ui64OutBufferSize;\r
+  OUT UINT64              ui64BytesReturned;\r
+}\r
+UGA_IO_REQUEST, *PUGA_IO_REQUEST;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE) (\r
+  IN  EFI_UGA_IO_PROTOCOL  * This,\r
+  IN  UGA_DEVICE           * ParentDevice,\r
+  IN  UGA_DEVICE_DATA      * DeviceData,\r
+  IN  VOID                 *RunTimeContext,\r
+  OUT UGA_DEVICE           **Device\r
+  );\r
+\r
+/*++\r
+\r
+  Routine Description:\r
+\r
+    Dynamically allocate storage for a child UGA_DEVICE .\r
+\r
+  Arguments:\r
+\r
+    This           - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is \r
+                     defined in Section 10.7.\r
+\r
+    ParentDevice   - ParentDevice specifies a pointer to the parent device of Device.\r
+\r
+    DeviceData     - A pointer to UGA_DEVICE_DATA returned from a call to DispatchService()\r
+                     with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice.\r
+\r
+    RuntimeContext - Context to associate with Device.\r
+\r
+    Device         - The Device returns a dynamically allocated child UGA_DEVICE object\r
+                     for ParentDevice. The caller is responsible for deleting Device.\r
+      \r
+  Returns:\r
+\r
+    EFI_SUCCESS           - Device was returned.\r
+\r
+    EFI_INVALID_PARAMETER - One of the arguments was not valid.\r
+\r
+    EFI_DEVICE_ERROR      - The device had an error and could not complete the request.\r
+\r
+--*/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE) (\r
+  IN EFI_UGA_IO_PROTOCOL  * This,\r
+  IN UGA_DEVICE           * Device\r
+  );\r
+\r
+/*++\r
+\r
+  Routine Description:\r
+\r
+    Delete a dynamically allocated child UGA_DEVICE object that was allocated via\r
+    CreateDevice() .\r
+\r
+  Arguments:\r
+\r
+    This   - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is defined \r
+             in Section 10.7.\r
+\r
+    Device - The Device points to a UGA_DEVICE object that was dynamically\r
+             allocated via a CreateDevice() call.\r
+\r
+  Returns:\r
+\r
+    EFI_SUCCESS           - Device was deleted.\r
+\r
+    EFI_INVALID_PARAMETER - The Device was not allocated via CreateDevice()\r
+\r
+--*/\r
+typedef UGA_STATUS (EFIAPI *PUGA_FW_SERVICE_DISPATCH) (IN PUGA_DEVICE pDevice, IN OUT PUGA_IO_REQUEST pIoRequest);\r
+\r
+/*++\r
+\r
+  Routine Description:\r
+\r
+    This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.\r
+\r
+  Arguments:\r
+\r
+    pDevice    - pDevice specifies a pointer to a device object associated with a \r
+                 device enumerated by a pIoRequest->ioRequestCode of type \r
+                 UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL \r
+                 is represented by pDevice being set to NULL.\r
+\r
+    pIoRequest - pIoRequest points to a caller allocated buffer that contains data\r
+                 defined by pIoRequest->ioRequestCode. See Related Definitions for\r
+                 a definition of UGA_IO_REQUEST_CODE s and their associated data \r
+                 structures.\r
+\r
+  Returns:\r
+\r
+  Varies depending on pIoRequest.\r
+\r
+--*/\r
+struct _EFI_UGA_IO_PROTOCOL {\r
+  EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice;\r
+  EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice;\r
+  PUGA_FW_SERVICE_DISPATCH          DispatchService;\r
+};\r
+\r
+extern EFI_GUID gEfiUgaIoProtocolGuid;\r
+\r
+//\r
+// Data structure that is stored in the EFI Configuration Table with the\r
+// EFI_UGA_IO_PROTOCOL_GUID.  The option ROMs listed in this table may have\r
+// EBC UGA drivers.\r
+//\r
+typedef struct {\r
+  UINT32  Version;\r
+  UINT32  HeaderSize;\r
+  UINT32  SizeOfEntries;\r
+  UINT32  NumberOfEntries;\r
+} EFI_DRIVER_OS_HANDOFF_HEADER;\r
+\r
+typedef enum {\r
+  EfiUgaDriverFromPciRom,\r
+  EfiUgaDriverFromSystem,\r
+  EfiDriverHandoffMax\r
+} EFI_DRIVER_HANOFF_ENUM;\r
+\r
+typedef struct {\r
+  EFI_DRIVER_HANOFF_ENUM    Type;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  VOID                      *PciRomImage;\r
+  UINT64                    PciRomSize;\r
+} EFI_DRIVER_OS_HANDOFF;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/UnicodeCollation.h b/MdePkg/Include/Protocol/UnicodeCollation.h
new file mode 100644 (file)
index 0000000..e027803
--- /dev/null
@@ -0,0 +1,183 @@
+/** @file\r
+  Unicode Collation protocol that follows the EFI 1.0 specification.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  UnicodeCollation.h\r
+\r
+**/\r
+\r
+#ifndef __UNICODE_COLLATION_H__\r
+#define __UNICODE_COLLATION_H__\r
+\r
+#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \\r
+  { \\r
+    0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
+  }\r
+\r
+typedef struct _EFI_UNICODE_COLLATION_PROTOCOL   EFI_UNICODE_COLLATION_PROTOCOL;\r
+\r
+//\r
+// Protocol data structures and defines\r
+//\r
+#define EFI_UNICODE_BYTE_ORDER_MARK (CHAR16) (0xfeff)\r
+\r
+//\r
+// Protocol member functions\r
+//\r
+/**\r
+  Performs a case-insensitive comparison of two Null-terminated Unicode \r
+  strings.\r
+\r
+  @param  This Protocol instance pointer.\r
+  @param  Str1 A pointer to a Null-terminated Unicode string.\r
+  @param  Str2 A pointer to a Null-terminated Unicode string.\r
+\r
+  @retval 0   Str1 is equivalent to Str2\r
+  @retval >_0 Str1 is lexically greater than Str2\r
+  @retval <_0 Str1 is lexically less than Str2\r
+\r
+**/\r
+typedef\r
+INTN\r
+(EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) (\r
+  IN EFI_UNICODE_COLLATION_PROTOCOL         *This,\r
+  IN CHAR16                                 *Str1,\r
+  IN CHAR16                                 *Str2\r
+  )\r
+;\r
+\r
+/**\r
+  Performs a case-insensitive comparison of a Null-terminated Unicode \r
+  pattern string and a Null-terminated Unicode string.\r
+\r
+  @param  This    Protocol instance pointer.\r
+  @param  String  A pointer to a Null-terminated Unicode string.\r
+  @param  Pattern A pointer to a Null-terminated Unicode pattern string.\r
+\r
+  @retval TRUE    Pattern was found in String.\r
+  @retval FALSE   Pattern was not found in String.\r
+\r
+**/\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH) (\r
+  IN EFI_UNICODE_COLLATION_PROTOCOL         *This,\r
+  IN CHAR16                                 *String,\r
+  IN CHAR16                                 *Pattern\r
+  )\r
+;\r
+\r
+/**\r
+  Converts all the Unicode characters in a Null-terminated Unicode string to \r
+  lower case Unicode characters.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  String A pointer to a Null-terminated Unicode string.\r
+\r
+  NONE\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_UNICODE_COLLATION_STRLWR) (\r
+  IN EFI_UNICODE_COLLATION_PROTOCOL         *This,\r
+  IN OUT CHAR16                             *Str\r
+  )\r
+;\r
+\r
+/**\r
+  Converts all the Unicode characters in a Null-terminated Unicode string to upper\r
+  case Unicode characters.\r
+\r
+  @param  This   Protocol instance pointer.\r
+  @param  String A pointer to a Null-terminated Unicode string.\r
+\r
+  NONE\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_UNICODE_COLLATION_STRUPR) (\r
+  IN EFI_UNICODE_COLLATION_PROTOCOL         *This,\r
+  IN OUT CHAR16                             *Str\r
+  )\r
+;\r
+\r
+/**\r
+  Converts an 8.3 FAT file name in an OEM character set to a Null-terminated \r
+  Unicode string.\r
+\r
+  @param  This    Protocol instance pointer.\r
+  @param  FatSize The size of the string Fat in bytes.\r
+  @param  Fat     A pointer to a Null-terminated string that contains an 8.3 file\r
+                  name using an OEM character set.\r
+  @param  String  A pointer to a Null-terminated Unicode string. The string must\r
+                  be preallocated to hold FatSize Unicode characters.\r
+\r
+  NONE\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR) (\r
+  IN EFI_UNICODE_COLLATION_PROTOCOL         *This,\r
+  IN UINTN                                  FatSize,\r
+  IN CHAR8                                  *Fat,\r
+  OUT CHAR16                                *String\r
+  )\r
+;\r
+\r
+/**\r
+  Converts a Null-terminated Unicode string to legal characters in a FAT \r
+  filename using an OEM character set. \r
+\r
+  @param  This    Protocol instance pointer.\r
+  @param  String  A pointer to a Null-terminated Unicode string. The string must\r
+                  be preallocated to hold FatSize Unicode characters.\r
+  @param  FatSize The size of the string Fat in bytes.\r
+  @param  Fat     A pointer to a Null-terminated string that contains an 8.3 file\r
+                  name using an OEM character set.\r
+\r
+  @retval TRUE    Fat is a Long File Name\r
+  @retval FALSE   Fat is an 8.3 file name\r
+\r
+**/\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT) (\r
+  IN EFI_UNICODE_COLLATION_PROTOCOL         *This,\r
+  IN CHAR16                                 *String,\r
+  IN UINTN                                  FatSize,\r
+  OUT CHAR8                                 *Fat\r
+  )\r
+;\r
+\r
+struct _EFI_UNICODE_COLLATION_PROTOCOL {\r
+  //\r
+  // general\r
+  //\r
+  EFI_UNICODE_COLLATION_STRICOLL    StriColl;\r
+  EFI_UNICODE_COLLATION_METAIMATCH  MetaiMatch;\r
+  EFI_UNICODE_COLLATION_STRLWR      StrLwr;\r
+  EFI_UNICODE_COLLATION_STRUPR      StrUpr;\r
+\r
+  //\r
+  // for supporting fat volumes\r
+  //\r
+  EFI_UNICODE_COLLATION_FATTOSTR    FatToStr;\r
+  EFI_UNICODE_COLLATION_STRTOFAT    StrToFat;\r
+\r
+  CHAR8                             *SupportedLanguages;\r
+};\r
+\r
+extern EFI_GUID gEfiUnicodeCollationProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Usb2HostController.h b/MdePkg/Include/Protocol/Usb2HostController.h
new file mode 100644 (file)
index 0000000..f45478a
--- /dev/null
@@ -0,0 +1,546 @@
+/** @file\r
+  EFI_USB2_HC_PROTOCOL as defined in UEFI 2.0.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Usb2HostController.h\r
+\r
+**/\r
+\r
+#ifndef _USB2_HOSTCONTROLLER_H_\r
+#define _USB2_HOSTCONTROLLER_H_\r
+\r
+#include <IndustryStandard/Usb.h>\r
+#include <Protocol/UsbIo.h>\r
+\r
+#define EFI_USB2_HC_PROTOCOL_GUID \\r
+  { \\r
+    0x3e745226, 0x9818, 0x45b6, {0xa2, 0xac, 0xd7, 0xcd, 0xe, 0x8b, 0xa2, 0xbc } \\r
+  }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_USB2_HC_PROTOCOL EFI_USB2_HC_PROTOCOL;\r
+\r
+#define EFI_USB_SPEED_FULL      0x0000  // 12 Mb/s, USB 1.1 OHCI and UHCI HC.\r
+#define EFI_USB_SPEED_LOW       0x0001  // 1 Mb/s, USB 1.1 OHCI and UHCI HC.\r
+#define EFI_USB_SPEED_HIGH      0x0002  // 480 Mb/s, USB 2.0 EHCI HC.\r
+\r
+typedef struct {\r
+  UINT8      TranslatorHubAddress;\r
+  UINT8      TranslatorPortNumber;\r
+} EFI_USB2_HC_TRANSACTION_TRANSLATOR;\r
+\r
+//\r
+// Protocol definitions\r
+//\r
+\r
+/**\r
+  Retrieves the Host Controller capabilities.\r
+\r
+  @param  This           A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  MaxSpeed       Host controller data transfer speed.\r
+  @param  PortNumber     Number of the root hub ports.\r
+  @param  Is64BitCapable TRUE if controller supports 64-bit memory addressing,\r
+                         FALSE otherwise.\r
+\r
+  @retval EFI_SUCCESS           The host controller capabilities were retrieved successfully.\r
+  @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
+  @retval EFI_DEVICE_ERROR      An error was encountered while attempting to\r
+                                retrieve the capabilities.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_GET_CAPABILITY) (\r
+  IN  EFI_USB2_HC_PROTOCOL  *This,\r
+  OUT UINT8                 *MaxSpeed,\r
+  OUT UINT8                 *PortNumber,\r
+  OUT UINT8                 *Is64BitCapable\r
+  )\r
+;\r
+\r
+/**\r
+  Provides software reset for the USB host controller.\r
+\r
+  @param  This       A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  Attributes A bit mask of the reset operation to perform.\r
+\r
+  @retval EFI_SUCCESS           The reset operation succeeded.\r
+  @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
+  @retval EFI_UNSUPPORTED       The type of reset specified by Attributes is not currently\r
+                                supported by the host controller hardware.\r
+  @retval EFI_ACCESS_DENIED     Reset operation is rejected due to the debug port being configured\r
+                                and active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or\r
+                                EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Attributes can be used to\r
+                                perform reset operation for this host controller.\r
+  @retval EFI_DEVICE_ERROR      An error was encountered while attempting to\r
+                                retrieve the capabilities.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_RESET) (\r
+  IN EFI_USB2_HC_PROTOCOL   *This,\r
+  IN UINT16                 Attributes\r
+  )\r
+;\r
+\r
+/**\r
+   \r
+  @param EfiUsbHcStateHalt  The host controller is in halt\r
+                            state. No USB transactions can occur\r
+                            while in this state. The host\r
+                            controller can enter this state for\r
+                            three reasons: 1) After host\r
+                            controller hardware reset. 2)\r
+                            Explicitly set by software. 3)\r
+                            Triggered by a fatal error such as\r
+                            consistency check failure.\r
+  \r
+  \r
+  @param EfiUsbHcStateOperational   The host controller is in an\r
+                                    operational state. When in\r
+                                    this state, the host\r
+                                    controller can execute bus\r
+                                    traffic. This state must be\r
+                                    explicitly set to enable the\r
+                                    USB bus traffic.\r
+  \r
+  \r
+  @param EfiUsbHcStateSuspend   The host controller is in the\r
+                                suspend state. No USB\r
+                                transactions can occur while in\r
+                                this state. The host controller\r
+                                enters this state for the\r
+                                following reasons: 1) Explicitly\r
+                                set by software. 2) Triggered\r
+                                when there is no bus traffic for\r
+                                3 microseconds.\r
+  \r
+**/\r
+typedef enum {\r
+  EfiUsbHcStateHalt,\r
+  EfiUsbHcStateOperational,\r
+  EfiUsbHcStateSuspend,\r
+  EfiUsbHcStateMaximum\r
+} EFI_USB_HC_STATE;\r
+\r
+/**\r
+  Retrieves current state of the USB host controller.\r
+\r
+  @param  This  A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  State A pointer to the EFI_USB_HC_STATE data structure that\r
+                indicates current state of the USB host controller.\r
+\r
+  @retval EFI_SUCCESS           The state information of the host controller was returned in State.\r
+  @retval EFI_INVALID_PARAMETER State is NULL.\r
+  @retval EFI_DEVICE_ERROR      An error was encountered while attempting to retrieve the\r
+                                host controller's current state.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_GET_STATE) (\r
+  IN CONST  EFI_USB2_HC_PROTOCOL    *This,\r
+  OUT       EFI_USB_HC_STATE        *State\r
+)\r
+;  \r
+\r
+/**\r
+  Sets the USB host controller to a specific state.\r
+\r
+  @param  This  A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  State Indicates the state of the host controller that will be set.\r
+\r
+  @retval EFI_SUCCESS           The USB host controller was successfully placed in the state\r
+                                specified by State.\r
+  @retval EFI_INVALID_PARAMETER State is not valid.\r
+  @retval EFI_DEVICE_ERROR      Failed to set the state specified by State due to device error.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_SET_STATE) (\r
+  IN EFI_USB2_HC_PROTOCOL    *This,\r
+  IN EFI_USB_HC_STATE        State\r
+  )\r
+;\r
+\r
+/**\r
+  Submits control transfer to a target USB device.\r
+\r
+  @param  This                A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  DeviceAddress       Represents the address of the target device on the USB.\r
+  @param  DeviceSpeed         Indicates device speed.\r
+  @param  MaximumPacketLength Indicates the maximum packet size that the default control transfer\r
+                              endpoint is capable of sending or receiving.\r
+  @param  Request             A pointer to the USB device request that will be sent to the USB device.\r
+  @param  TransferDirection   Specifies the data direction for the transfer. There are three values\r
+                              available, EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.\r
+  @param  Data                A pointer to the buffer of data that will be transmitted to USB device or\r
+                              received from USB device.\r
+  @param  DataLength          On input, indicates the size, in bytes, of the data buffer specified by Data.\r
+                              On output, indicates the amount of data actually transferred.\r
+  @param  Translator          A pointer to the transaction translator data.\r
+  @param  TimeOut             Indicates the maximum time, in milliseconds, which the transfer is\r
+                              allowed to complete.\r
+  @param  TransferResult      A pointer to the detailed result information generated by this control\r
+                              transfer.\r
+\r
+  @retval EFI_SUCCESS           The control transfer was completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The control transfer could not be completed due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The control transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The control transfer failed due to host controller or device error.\r
+                                Caller should check TransferResult for detailed error information.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER) (\r
+  IN     EFI_USB2_HC_PROTOCOL               *This,\r
+  IN     UINT8                              DeviceAddress,\r
+  IN     UINT8                              DeviceSpeed,\r
+  IN     UINTN                              MaximumPacketLength,\r
+  IN     EFI_USB_DEVICE_REQUEST             *Request,\r
+  IN     EFI_USB_DATA_DIRECTION             TransferDirection,\r
+  IN OUT VOID                               *Data       OPTIONAL,\r
+  IN OUT UINTN                              *DataLength OPTIONAL,\r
+  IN     UINTN                              TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
+  OUT    UINT32                             *TransferResult\r
+  )\r
+;  \r
+\r
+#define EFI_USB_MAX_BULK_BUFFER_NUM 10\r
+\r
+/**\r
+  Submits bulk transfer to a bulk endpoint of a USB device.\r
+\r
+  @param  This                A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  DeviceAddress       Represents the address of the target device on the USB.\r
+  @param  EndPointAddress     The combination of an endpoint number and an endpoint direction of the\r
+                              target USB device.\r
+  @param  DeviceSpeed         Indicates device speed.\r
+  @param  MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of\r
+                              sending or receiving.\r
+  @param  DataBuffersNumber   Number of data buffers prepared for the transfer.\r
+  @param  Data                Array of pointers to the buffers of data that will be transmitted to USB\r
+                              device or received from USB device.\r
+  @param  DataLength          When input, indicates the size, in bytes, of the data buffers specified by\r
+                              Data. When output, indicates the actually transferred data size.\r
+  @param  DataToggle          A pointer to the data toggle value.\r
+  @param  Translator          A pointer to the transaction translator data.\r
+  @param  TimeOut             Indicates the maximum time, in milliseconds, which the transfer is\r
+                              allowed to complete.\r
+  @param  TransferResult      A pointer to the detailed result information of the bulk transfer.\r
+\r
+  @retval EFI_SUCCESS           The bulk transfer was completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The bulk transfer could not be submitted due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The bulk transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The bulk transfer failed due to host controller or device error.\r
+                                Caller should check TransferResult for detailed error information.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_BULK_TRANSFER) (\r
+  IN     EFI_USB2_HC_PROTOCOL               *This,\r
+  IN     UINT8                              DeviceAddress,\r
+  IN     UINT8                              EndPointAddress,\r
+  IN     UINT8                              DeviceSpeed,\r
+  IN     UINTN                              MaximumPacketLength,\r
+  IN     UINT8                              DataBuffersNumber,\r
+  IN OUT VOID                               *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
+  IN OUT UINTN                              *DataLength,\r
+  IN OUT UINT8                              *DataToggle,\r
+  IN     UINTN                              TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
+  OUT    UINT32                             *TransferResult\r
+  )\r
+;\r
+\r
+/**\r
+  Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.\r
+  Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.\r
+  \r
+  @param  This                A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  DeviceAddress       Represents the address of the target device on the USB.\r
+  @param  EndPointAddress     The combination of an endpoint number and an endpoint direction of the\r
+                              target USB device.\r
+  @param  DeviceSpeed         Indicates device speed.\r
+  @param  MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of\r
+                              sending or receiving.\r
+  @param  IsNewTransfer       If TRUE, an asynchronous interrupt pipe is built between the host and the\r
+                              target interrupt endpoint. If FALSE, the specified asynchronous interrupt\r
+                              pipe is canceled. If TRUE, and an interrupt transfer exists for the target\r
+                              end point, then EFI_INVALID_PARAMETER is returned.\r
+  @param  DataToggle          A pointer to the data toggle value.\r
+  @param  PollingInterval     Indicates the interval, in milliseconds, that the asynchronous interrupt\r
+                              transfer is polled.\r
+  @param  DataLength          Indicates the length of data to be received at the rate specified by\r
+                              PollingInterval from the target asynchronous interrupt endpoint.\r
+  @param  Translator          A pointr to the transaction translator data.\r
+  @param  CallBackFunction    The Callback function. This function is called at the rate specified by\r
+                              PollingInterval.\r
+  @param  Context             The context that is passed to the CallBackFunction. This is an\r
+                              optional parameter and may be NULL.\r
+\r
+  @retval EFI_SUCCESS           The asynchronous interrupt transfer request has been successfully\r
+                                submitted or canceled.\r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER) (\r
+  IN     EFI_USB2_HC_PROTOCOL                                *This,\r
+  IN     UINT8                                               DeviceAddress,\r
+  IN     UINT8                                               EndPointAddress,\r
+  IN     UINT8                                               DeviceSpeed,\r
+  IN     UINTN                                               MaxiumPacketLength,\r
+  IN     BOOLEAN                                             IsNewTransfer,\r
+  IN OUT UINT8                                               *DataToggle,\r
+  IN     UINTN                                               PollingInterval  OPTIONAL,\r
+  IN     UINTN                                               DataLength       OPTIONAL,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR                  *Translator      OPTIONAL,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK                     CallBackFunction OPTIONAL,\r
+  IN     VOID                                                *Context         OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.\r
+  Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.\r
+\r
+  @param  This                  A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB.\r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint direction of the\r
+                                target USB device.\r
+  @param  DeviceSpeed           Indicates device speed.\r
+  @param  MaximumPacketLength   Indicates the maximum packet size the target endpoint is capable of\r
+                                sending or receiving.\r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB device or\r
+                                received from USB device.\r
+  @param  DataLength            On input, the size, in bytes, of the data buffer specified by Data. On\r
+                                output, the number of bytes transferred.\r
+  @param  DataToggle            A pointer to the data toggle value.\r
+  @param  TimeOut               Indicates the maximum time, in milliseconds, which the transfer is\r
+                                allowed to complete.\r
+  @param  Translator            A pointr to the transaction translator data.\r
+  @param  TransferResult        A pointer to the detailed result information from the synchronous\r
+                                interrupt transfer.\r
+\r
+  @retval EFI_SUCCESS           The synchronous interrupt transfer was completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The synchronous interrupt transfer could not be submitted due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The synchronous interrupt transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The synchronous interrupt transfer failed due to host controller or device error.\r
+                                Caller should check TransferResult for detailed error information.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) (\r
+  IN     EFI_USB2_HC_PROTOCOL                        *This,\r
+  IN     UINT8                                       DeviceAddress,\r
+  IN     UINT8                                       EndPointAddress,\r
+  IN     UINT8                                       DeviceSpeed,\r
+  IN     UINTN                                       MaximumPacketLength,\r
+  IN OUT VOID                                        *Data,\r
+  IN OUT UINTN                                       *DataLength,\r
+  IN OUT UINT8                                       *DataToggle,\r
+  IN     UINTN                                       TimeOut,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR          *Translator,\r
+  OUT    UINT32                                      *TransferResult\r
+  )\r
+;\r
+\r
+#define EFI_USB_MAX_ISO_BUFFER_NUM  7\r
+#define EFI_USB_MAX_ISO_BUFFER_NUM1 2\r
+\r
+/**\r
+  Submits isochronous transfer to an isochronous endpoint of a USB device.\r
+\r
+  @param  This                  A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB.\r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint direction of the\r
+                                target USB device.\r
+  @param  DeviceSpeed           Indicates device speed.\r
+  @param  MaximumPacketLength   Indicates the maximum packet size the target endpoint is capable of\r
+                                sending or receiving.\r
+  @param  DataBuffersNumber     Number of data buffers prepared for the transfer.\r
+  @param  Data                  Array of pointers to the buffers of data that will be transmitted to USB\r
+                                device or received from USB device.\r
+  @param  DataLength            Specifies the length, in bytes, of the data to be sent to or received from\r
+                                the USB device.\r
+  @param  Translator            A pointer to the transaction translator data.\r
+  @param  TransferResult        A pointer to the detailed result information of the isochronous transfer.\r
+\r
+  @retval EFI_SUCCESS           The isochronous transfer was completed successfully.\r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The isochronous transfer could not be submitted due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The isochronous transfer cannot be completed within the one USB frame time.\r
+  @retval EFI_DEVICE_ERROR      The isochronous transfer failed due to host controller or device error.\r
+                                Caller should check TransferResult for detailed error information.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER) (\r
+  IN     EFI_USB2_HC_PROTOCOL               *This,\r
+  IN     UINT8                              DeviceAddress,\r
+  IN     UINT8                              EndPointAddress,\r
+  IN     UINT8                              DeviceSpeed,\r
+  IN     UINTN                              MaximumPacketLength,\r
+  IN     UINT8                              DataBuffersNumber,\r
+  IN OUT VOID                               *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
+  IN     UINTN                              DataLength,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
+  OUT    UINT32                             *TransferResult\r
+  )\r
+;\r
+\r
+/**\r
+  Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.\r
+\r
+  @param  This                  A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB.\r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint direction of the\r
+                                target USB device.\r
+  @param  DeviceSpeed           Indicates device speed.\r
+  @param  MaximumPacketLength   Indicates the maximum packet size the target endpoint is capable of\r
+                                sending or receiving.\r
+  @param  DataBuffersNumber     Number of data buffers prepared for the transfer.\r
+  @param  Data                  Array of pointers to the buffers of data that will be transmitted to USB\r
+                                device or received from USB device.\r
+  @param  DataLength            Specifies the length, in bytes, of the data to be sent to or received from\r
+                                the USB device.\r
+  @param  Translator            A pointer to the transaction translator data.\r
+  @param  IsochronousCallback   The Callback function. This function is called if the requested\r
+                                isochronous transfer is completed.\r
+  @param  Context               Data passed to the IsochronousCallback function. This is an\r
+                                optional parameter and may be NULL.\r
+\r
+  @retval EFI_SUCCESS           The asynchronous isochronous transfer request has been successfully\r
+                                submitted or canceled.\r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The asynchronous isochronous transfer could not be submitted due to\r
+                                a lack of resources.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER) (\r
+  IN     EFI_USB2_HC_PROTOCOL               *This,\r
+  IN     UINT8                              DeviceAddress,\r
+  IN     UINT8                              EndPointAddress,\r
+  IN     UINT8                              DeviceSpeed,\r
+  IN     UINTN                              MaximumPacketLength,\r
+  IN     UINT8                              DataBuffersNumber,\r
+  IN OUT VOID                               *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
+  IN     UINTN                              DataLength,\r
+  IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK    IsochronousCallBack,\r
+  IN     VOID                               *Context OPTIONAL\r
+  )\r
+;\r
+\r
+/**\r
+  Retrieves the current status of a USB root hub port.\r
+\r
+  @param  This       A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  PortNumber Specifies the root hub port from which the status is to be retrieved.\r
+                     This value is zero based.\r
+  @param  PortStatus A pointer to the current port status bits and port status change bits.\r
+\r
+  @retval EFI_SUCCESS           The status of the USB root hub port specified by PortNumber\r
+                                was returned in PortStatus.\r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS) (\r
+  IN CONST  EFI_USB2_HC_PROTOCOL    *This,\r
+  IN CONST  UINT8                   PortNumber,\r
+  OUT       EFI_USB_PORT_STATUS     *PortStatus\r
+  )\r
+;  \r
+\r
+/**\r
+  Sets a feature for the specified root hub port.\r
+\r
+  @param  This        A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  PortNumber  Specifies the root hub port whose feature is requested to be set. This\r
+                      value is zero based.\r
+  @param  PortFeature Indicates the feature selector associated with the feature set request.\r
+\r
+  @retval EFI_SUCCESS           The feature specified by PortFeature was set for the USB\r
+                                root hub port specified by PortNumber.\r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE) (\r
+  IN EFI_USB2_HC_PROTOCOL    *This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  )\r
+;  \r
+\r
+/**\r
+  Clears a feature for the specified root hub port.\r
+\r
+  @param  This        A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+  @param  PortNumber  Specifies the root hub port whose feature is requested to be cleared. This\r
+                      value is zero based.\r
+  @param  PortFeature Indicates the feature selector associated with the feature clear request.\r
+\r
+  @retval EFI_SUCCESS           The feature specified by PortFeature was cleared for the USB\r
+                                root hub port specified by PortNumber.\r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE) (\r
+  IN EFI_USB2_HC_PROTOCOL    *This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  )\r
+;  \r
+\r
+struct _EFI_USB2_HC_PROTOCOL {\r
+  EFI_USB2_HC_PROTOCOL_GET_CAPABILITY              GetCapability;\r
+  EFI_USB2_HC_PROTOCOL_RESET                       Reset;\r
+  EFI_USB2_HC_PROTOCOL_GET_STATE                   GetState;\r
+  EFI_USB2_HC_PROTOCOL_SET_STATE                   SetState;\r
+  EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER            ControlTransfer;\r
+  EFI_USB2_HC_PROTOCOL_BULK_TRANSFER               BulkTransfer;\r
+  EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER    AsyncInterruptTransfer;\r
+  EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER     SyncInterruptTransfer;\r
+  EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER        IsochronousTransfer;\r
+  EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER  AsyncIsochronousTransfer;\r
+  EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS     GetRootHubPortStatus;\r
+  EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE    SetRootHubPortFeature;\r
+  EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE  ClearRootHubPortFeature;\r
+  UINT16                                           MajorRevision;\r
+  UINT16                                           MinorRevision;\r
+};\r
+\r
+extern EFI_GUID gEfiUsb2HcProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/UsbHostController.h b/MdePkg/Include/Protocol/UsbHostController.h
new file mode 100644 (file)
index 0000000..33e744a
--- /dev/null
@@ -0,0 +1,447 @@
+/** @file\r
+  EFI_USB_HC_PROTOCOL as defined in EFI 1.10.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  UsbHostController.h\r
+\r
+**/\r
+\r
+#ifndef _USB_HOSTCONTROLLER_H_\r
+#define _USB_HOSTCONTROLLER_H_\r
+\r
+#include <Protocol/Usb2HostController.h>\r
+\r
+#define EFI_USB_HC_PROTOCOL_GUID \\r
+  { \\r
+    0xf5089266, 0x1aa0, 0x4953, {0x97, 0xd8, 0x56, 0x2f, 0x8a, 0x73, 0xb5, 0x19 } \\r
+  }\r
+\r
+//\r
+// Forward reference for pure ANSI compatability\r
+//\r
+typedef struct _EFI_USB_HC_PROTOCOL EFI_USB_HC_PROTOCOL;\r
+\r
+//\r
+// Protocol definitions\r
+//\r
+\r
+/**                                                                 \r
+  Provides software reset for the USB host controller.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  Attributes            A bit mask of the reset operation to perform.\r
+                                \r
+  @retval EFI_SUCCESS           The reset operation succeeded.\r
+  @retval EFI_UNSUPPORTED       The type of reset specified by Attributes is not currently supported\r
+                                by the host controller hardware.                                    \r
+  @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
+  @retval EFI_DEVICE_ERROR      An error was encountered while attempting to perform the reset operation.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_RESET) (\r
+  IN EFI_USB_HC_PROTOCOL     *This,\r
+  IN UINT16                  Attributes\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves current state of the USB host controller.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  State                 A pointer to the EFI_USB_HC_STATE data structure that\r
+                                indicates current state of the USB host controller.  \r
+                                \r
+  @retval EFI_SUCCESS           The state information of the host controller was returned in State.\r
+  @retval EFI_INVALID_PARAMETER State is NULL.\r
+  @retval EFI_DEVICE_ERROR      An error was encountered while attempting to retrieve the host controller's\r
+                                current state.                                                                 \r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_GET_STATE) (\r
+  IN  EFI_USB_HC_PROTOCOL    *This,\r
+  OUT EFI_USB_HC_STATE       *State\r
+  );\r
+\r
+/**                                                                 \r
+  Sets the USB host controller to a specific state.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  State                 Indicates the state of the host controller that will be set.                                \r
+                                \r
+  @retval EFI_SUCCESS           The USB host controller was successfully placed in the state specified by\r
+                                State.                                                                   \r
+  @retval EFI_INVALID_PARAMETER State is NULL.\r
+  @retval EFI_DEVICE_ERROR      Failed to set the state specified by State due to device error.                                \r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_SET_STATE) (\r
+  IN EFI_USB_HC_PROTOCOL     *This,\r
+  IN EFI_USB_HC_STATE        State\r
+  );\r
+\r
+/**                                                                 \r
+  Submits control transfer to a target USB device.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB, which is\r
+                                assigned during USB enumeration.                                \r
+  @param  IsSlowDevice          Indicates whether the target device is slow device or full-speed\r
+                                device.                                                         \r
+  @param  MaximumPacketLength   Indicates the maximum packet size that the default control \r
+                                transfer endpoint is capable of sending or receiving.     \r
+  @param  Request               A pointer to the USB device request that will be sent to the USB\r
+                                device.\r
+  @param  TransferDirection     Specifies the data direction for the transfer.  \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB  \r
+                                device or received from USB device.                            \r
+  @param  DataLength            On input, indicates the size, in bytes, of the data buffer specified\r
+                                by Data. On output, indicates the amount of data actually           \r
+                                transferred.                                                        \r
+  @param  TimeOut               Indicates the maximum time, in milliseconds, which the transfer\r
+                                is allowed to complete.                                        \r
+  @param  TransferResult        A pointer to the detailed result information generated by this  \r
+                                control transfer.\r
+                                \r
+  @retval EFI_SUCCESS           The control transfer was completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The control transfer could not be completed due to a lack of resources.                                \r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_TIMEOUT           The control transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The control transfer failed due to host controller or device error.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER) (\r
+  IN     EFI_USB_HC_PROTOCOL       *This,\r
+  IN     UINT8                     DeviceAddress,\r
+  IN     BOOLEAN                   IsSlowDevice,\r
+  IN     UINT8                     MaximumPacketLength,\r
+  IN     EFI_USB_DEVICE_REQUEST    *Request,\r
+  IN     EFI_USB_DATA_DIRECTION    TransferDirection,\r
+  IN OUT VOID                      *Data       OPTIONAL,\r
+  IN OUT UINTN                     *DataLength OPTIONAL,\r
+  IN     UINTN                     TimeOut,\r
+  OUT    UINT32                    *TransferResult\r
+  );\r
+\r
+/**                                                                 \r
+  Submits bulk transfer to a bulk endpoint of a USB device.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB, which is\r
+                                assigned during USB enumeration.                                \r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint\r
+                                direction of the target USB device.                  \r
+  @param  MaximumPacketLength   Indicates the maximum packet size that the default control \r
+                                transfer endpoint is capable of sending or receiving.     \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB  \r
+                                device or received from USB device.                            \r
+  @param  DataLength            On input, indicates the size, in bytes, of the data buffer specified\r
+                                by Data. On output, indicates the amount of data actually           \r
+                                transferred.             \r
+  @param  DataToggle            A pointer to the data toggle value.                                                                           \r
+  @param  TimeOut               Indicates the maximum time, in milliseconds, which the transfer\r
+                                is allowed to complete.                                        \r
+  @param  TransferResult        A pointer to the detailed result information of the bulk transfer.\r
+                                \r
+  @retval EFI_SUCCESS           The bulk transfer was completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The bulk transfer could not be completed due to a lack of resources.                                \r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_TIMEOUT           The bulk transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The bulk transfer failed due to host controller or device error.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_BULK_TRANSFER) (\r
+  IN     EFI_USB_HC_PROTOCOL    *This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     UINT8                  MaximumPacketLength,\r
+  IN OUT VOID                   *Data,\r
+  IN OUT UINTN                  *DataLength,\r
+  IN OUT UINT8                  *DataToggle,\r
+  IN     UINTN                  TimeOut,\r
+  OUT    UINT32                 *TransferResult\r
+  );\r
+\r
+/**                                                                 \r
+  Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB, which is\r
+                                assigned during USB enumeration.                                \r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint\r
+                                direction of the target USB device.   \r
+  @param  IsSlowDevice          Indicates whether the target device is slow device or full-speed\r
+                                device.                                                                          \r
+  @param  MaximumPacketLength   Indicates the maximum packet size that the default control \r
+                                transfer endpoint is capable of sending or receiving.     \r
+  @param  IsNewTransfer         If TRUE, an asynchronous interrupt pipe is built between the host                       \r
+                                and the target interrupt endpoint. If FALSE, the specified       \r
+  @param  DataToggle            A pointer to the data toggle value.      \r
+  @param  PollingInterval       Indicates the interval, in milliseconds, that the asynchronous\r
+                                interrupt transfer is polled.                                                                                                      asynchronous interrupt pipe is canceled.                         \r
+  @param  DataLength            Indicates the length of data to be received at the rate specified by\r
+                                PollingInterval from the target asynchronous interrupt              \r
+                                endpoint.                                                             \r
+  @param  CallBackFunction      The Callback function.                                \r
+  @param  Context               The context that is passed to the CallBackFunction.\r
+                                \r
+  @retval EFI_SUCCESS           The asynchronous interrupt transfer request has been successfully\r
+                                submitted or canceled.    \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.                                \r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_TIMEOUT           The bulk transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The bulk transfer failed due to host controller or device error.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER) (\r
+  IN     EFI_USB_HC_PROTOCOL                                 *This,\r
+  IN     UINT8                                               DeviceAddress,\r
+  IN     UINT8                                               EndPointAddress,\r
+  IN     BOOLEAN                                             IsSlowDevice,\r
+  IN     UINT8                                               MaxiumPacketLength,\r
+  IN     BOOLEAN                                             IsNewTransfer,\r
+  IN OUT UINT8                                               *DataToggle,\r
+  IN     UINTN                                               PollingInterval  OPTIONAL,\r
+  IN     UINTN                                               DataLength       OPTIONAL,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK                     CallBackFunction OPTIONAL,\r
+  IN     VOID                                                *Context         OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB, which is\r
+                                assigned during USB enumeration.                                \r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint\r
+                                direction of the target USB device.   \r
+  @param  IsSlowDevice          Indicates whether the target device is slow device or full-speed\r
+                                device.                                                                          \r
+  @param  MaximumPacketLength   Indicates the maximum packet size that the default control \r
+                                transfer endpoint is capable of sending or receiving.       \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                                                                                            asynchronous interrupt pipe is canceled.                         \r
+  @param  DataLength            On input, the size, in bytes, of the data buffer specified by Data.\r
+                                On output, the number of bytes transferred.                          \r
+  @param  DataToggle            A pointer to the data toggle value.                                \r
+  @param  TimeOut               Indicates the maximum time, in milliseconds, which the transfer    \r
+                                is allowed to complete.                                            \r
+  @param  TransferResult        A pointer to the detailed result information from the synchronous\r
+                                interrupt transfer.\r
+                                \r
+  @retval EFI_SUCCESS           The synchronous interrupt transfer was completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.                                  \r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_TIMEOUT           The synchronous interrupt transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The synchronous interrupt transfer failed due to host controller or device error.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) (\r
+  IN     EFI_USB_HC_PROTOCOL    *This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     BOOLEAN                IsSlowDevice,\r
+  IN     UINT8                  MaximumPacketLength,\r
+  IN OUT VOID                   *Data,\r
+  IN OUT UINTN                  *DataLength,\r
+  IN OUT UINT8                  *DataToggle,\r
+  IN     UINTN                  TimeOut,\r
+  OUT    UINT32                 *TransferResult\r
+  );\r
+\r
+/**                                                                 \r
+  Submits isochronous transfer to an isochronous endpoint of a USB device.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB, which is\r
+                                assigned during USB enumeration.                                \r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint\r
+                                direction of the target USB device.                  \r
+  @param  MaximumPacketLength   Indicates the maximum packet size that the default control \r
+                                transfer endpoint is capable of sending or receiving.       \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                                                                                            asynchronous interrupt pipe is canceled.                         \r
+  @param  DataLength            Specifies the length, in bytes, of the data to be sent to or received\r
+                                from the USB device.                                                 \r
+  @param  TransferResult        A pointer to the detailed result information from the isochronous\r
+                                transfer.\r
+                                \r
+  @retval EFI_SUCCESS           The isochronous transfer was completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The isochronous could not be completed due to a lack of resources.                                  \r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+  @retval EFI_TIMEOUT           The isochronous transfer failed due to timeout.\r
+  @retval EFI_DEVICE_ERROR      The isochronous transfer failed due to host controller or device error.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER) (\r
+  IN     EFI_USB_HC_PROTOCOL    *This,\r
+  IN     UINT8                  DeviceAddress,\r
+  IN     UINT8                  EndPointAddress,\r
+  IN     UINT8                  MaximumPacketLength,\r
+  IN OUT VOID                   *Data,\r
+  IN     UINTN                  DataLength,\r
+  OUT    UINT32                 *TransferResult\r
+  );\r
+\r
+/**                                                                 \r
+  Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  DeviceAddress         Represents the address of the target device on the USB, which is\r
+                                assigned during USB enumeration.                                \r
+  @param  EndPointAddress       The combination of an endpoint number and an endpoint\r
+                                direction of the target USB device.                  \r
+  @param  MaximumPacketLength   Indicates the maximum packet size that the default control \r
+                                transfer endpoint is capable of sending or receiving.       \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                                                                                            asynchronous interrupt pipe is canceled.                         \r
+  @param  DataLength            Specifies the length, in bytes, of the data to be sent to or received\r
+                                from the USB device.                                                 \r
+  @param  IsochronousCallback   The Callback function.\r
+  @param  Context               Data passed to the IsochronousCallback function. This is\r
+                                an optional parameter and may be NULL.\r
+                                \r
+  @retval EFI_SUCCESS           The asynchronous isochronous transfer was completed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The asynchronous isochronous could not be completed due to a lack of resources.                                  \r
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER) (\r
+  IN     EFI_USB_HC_PROTOCOL                *This,\r
+  IN     UINT8                              DeviceAddress,\r
+  IN     UINT8                              EndPointAddress,\r
+  IN     UINT8                              MaximumPacketLength,\r
+  IN OUT VOID                               *Data,\r
+  IN     UINTN                              DataLength,\r
+  IN     EFI_ASYNC_USB_TRANSFER_CALLBACK    IsochronousCallBack,\r
+  IN     VOID                               *Context OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the number of root hub ports.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  PortNumber            A pointer to the number of the root hub ports.                                \r
+                                \r
+  @retval EFI_SUCCESS           The port number was retrieved successfully.\r
+  @retval EFI_DEVICE_ERROR      An error was encountered while attempting to retrieve the port number.\r
+  @retval EFI_INVALID_PARAMETER PortNumber is NULL.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER) (\r
+  IN EFI_USB_HC_PROTOCOL    *This,\r
+  OUT UINT8                 *PortNumber\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the current status of a USB root hub port.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  PortNumber            Specifies the root hub port from which the status is to be retrieved.\r
+                                This value is zero based.\r
+  @param  PortStatus            A pointer to the current port status bits and port status change bits.                                \r
+                                \r
+  @retval EFI_SUCCESS           The status of the USB root hub port specified by PortNumber\r
+                                was returned in PortStatus.                                \r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS) (\r
+  IN EFI_USB_HC_PROTOCOL     *This,\r
+  IN  UINT8                  PortNumber,\r
+  OUT EFI_USB_PORT_STATUS    *PortStatus\r
+  );\r
+\r
+/**                                                                 \r
+  Sets a feature for the specified root hub port.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  PortNumber            Specifies the root hub port from which the status is to be retrieved.\r
+                                This value is zero based.\r
+  @param  PortFeature           Indicates the feature selector associated with the feature set\r
+                                request.\r
+                                \r
+  @retval EFI_SUCCESS           The feature specified by PortFeature was set for the USB\r
+                                root hub port specified by PortNumber.                  \r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE) (\r
+  IN EFI_USB_HC_PROTOCOL     *This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  );\r
+\r
+/**                                                                 \r
+  Clears a feature for the specified root hub port.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_HC_PROTOCOL instance.\r
+  @param  PortNumber            Specifies the root hub port from which the status is to be cleared.\r
+                                This value is zero based.\r
+  @param  PortFeature           Indicates the feature selector associated with the feature clear\r
+                                request.\r
+                                \r
+  @retval EFI_SUCCESS           The feature specified by PortFeature was cleared for the USB\r
+                                root hub port specified by PortNumber.                  \r
+  @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.\r
+                                \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE) (\r
+  IN EFI_USB_HC_PROTOCOL     *This,\r
+  IN UINT8                   PortNumber,\r
+  IN EFI_USB_PORT_FEATURE    PortFeature\r
+  );\r
+\r
+struct _EFI_USB_HC_PROTOCOL {\r
+  EFI_USB_HC_PROTOCOL_RESET                       Reset;\r
+  EFI_USB_HC_PROTOCOL_GET_STATE                   GetState;\r
+  EFI_USB_HC_PROTOCOL_SET_STATE                   SetState;\r
+  EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER            ControlTransfer;\r
+  EFI_USB_HC_PROTOCOL_BULK_TRANSFER               BulkTransfer;\r
+  EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER    AsyncInterruptTransfer;\r
+  EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER     SyncInterruptTransfer;\r
+  EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER        IsochronousTransfer;\r
+  EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER  AsyncIsochronousTransfer;\r
+  EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER     GetRootHubPortNumber;\r
+  EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS     GetRootHubPortStatus;\r
+  EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE    SetRootHubPortFeature;\r
+  EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE  ClearRootHubPortFeature;\r
+  UINT16                                          MajorRevision;\r
+  UINT16                                          MinorRevision;\r
+};\r
+\r
+extern EFI_GUID gEfiUsbHcProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h
new file mode 100644 (file)
index 0000000..48d1ba3
--- /dev/null
@@ -0,0 +1,420 @@
+/** @file\r
+  EFI Usb I/O Protocol\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  UsbIo.h\r
+\r
+**/\r
+\r
+#ifndef __USB_IO_H__\r
+#define __USB_IO_H__\r
+\r
+#include <IndustryStandard/Usb.h>\r
+\r
+//\r
+// Global ID for the USB I/O Protocol\r
+//\r
+#define EFI_USB_IO_PROTOCOL_GUID \\r
+  { \\r
+    0x2B2F68D6, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \\r
+  }\r
+\r
+typedef struct _EFI_USB_IO_PROTOCOL   EFI_USB_IO_PROTOCOL;\r
+\r
+/**                                                                 \r
+  Async USB transfer callback routine.\r
+    \r
+  @param  Data                  Data received or sent via the USB Asynchronous Transfer, if the\r
+                                transfer completed successfully.                               \r
+  @param  DataLength            The length of Data received or sent via the Asynchronous\r
+                                Transfer, if transfer successfully completes.                                           \r
+  @param  Context               Data passed from UsbAsyncInterruptTransfer() request.\r
+  @param  Status                Indicates the result of the asynchronous transfer.\r
+                                \r
+  @retval EFI_SUCCESS           The asynchronous USB transfer request has been successfully executed.  \r
+  @retval EFI_DEVICE_ERROR      The asynchronous USB transfer request failed.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ASYNC_USB_TRANSFER_CALLBACK) (\r
+  IN VOID         *Data,\r
+  IN UINTN        DataLength,\r
+  IN VOID         *Context,\r
+  IN UINT32       Status\r
+  );\r
+\r
+//\r
+// Prototype for EFI USB I/O protocol\r
+//\r
+\r
+\r
+/**                                                                 \r
+  This function is used to manage a USB device with a control transfer pipe. A control transfer is\r
+  typically used to perform device initialization and configuration.                              \r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
+  @param  Request               A pointer to the USB device request that will be sent to the USB\r
+                                device.                                                         \r
+  @param  Direction             Indicates the data direction.\r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                            \r
+  @param  Timeout               Indicating the transfer should be completed within this time frame.\r
+                                The units are in milliseconds.                                       \r
+  @param  DataLength            The size, in bytes, of the data buffer specified by Data.\r
+  @param  Status                A pointer to the result of the USB transfer.\r
+                                \r
+  @retval EFI_SUCCESS           The control transfer has been successfully executed.\r
+  @retval EFI_DEVICE_ERROR      The transfer failed. The transfer status is returned in Status.\r
+  @retval EFI_INVALID_PARAMETE  One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The control transfer fails due to timeout.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_CONTROL_TRANSFER) (\r
+  IN EFI_USB_IO_PROTOCOL                        *This,\r
+  IN EFI_USB_DEVICE_REQUEST                     *Request,\r
+  IN EFI_USB_DATA_DIRECTION                     Direction,\r
+  IN UINT32                                     Timeout,\r
+  IN OUT VOID                                   *Data OPTIONAL,\r
+  IN UINTN                                      DataLength  OPTIONAL,\r
+  OUT UINT32                                    *Status\r
+  );\r
+\r
+/**                                                                 \r
+  This function is used to manage a USB device with the bulk transfer pipe. Bulk Transfers are\r
+  typically used to transfer large amounts of data to/from USB devices.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
+  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
+                                device.                                                         \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                            \r
+  @param  DataLength            The size, in bytes, of the data buffer specified by Data.\r
+  @param  Timeout               Indicating the transfer should be completed within this time frame.\r
+                                The units are in milliseconds.                                           \r
+  @param  Status                This parameter indicates the USB transfer status.\r
+                                \r
+  @retval EFI_SUCCESS           The bulk transfer has been successfully executed.\r
+  @retval EFI_DEVICE_ERROR      The transfer failed. The transfer status is returned in Status.\r
+  @retval EFI_INVALID_PARAMETE  One or more parameters are invalid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The control transfer fails due to timeout.\r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_BULK_TRANSFER) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  IN UINT8                          DeviceEndpoint,\r
+  IN OUT VOID                       *Data,\r
+  IN OUT UINTN                      *DataLength,\r
+  IN UINTN                          Timeout,\r
+  OUT UINT32                        *Status\r
+  );\r
+\r
+/**                                                                 \r
+  This function is used to manage a USB device with an interrupt transfer pipe. An Asynchronous   \r
+  Interrupt Transfer is typically used to query a device's status at a fixed rate. For example,  \r
+  keyboard, mouse, and hub devices use this type of transfer to query their interrupt endpoints at\r
+  a fixed rate.                                                                                   \r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
+  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
+                                device.                                                         \r
+  @param  IsNewTransfer         If TRUE, a new transfer will be submitted to USB controller. If                             \r
+                                FALSE, the interrupt transfer is deleted from the device's interrupt\r
+                                transfer queue.                                                      \r
+  @param  PollingInterval       Indicates the periodic rate, in milliseconds, that the transfer is to be                        \r
+                                executed.                                                                 \r
+  @param  DataLength            Specifies the length, in bytes, of the data to be received from the\r
+                                USB device.                                                        \r
+  @param  Context               Data passed to the InterruptCallback function.\r
+  @param  InterruptCallback     The Callback function. This function is called if the asynchronous\r
+                                interrupt transfer is completed.\r
+                                \r
+  @retval EFI_SUCCESS           The asynchronous USB transfer request transfer has been successfully executed.\r
+  @retval EFI_DEVICE_ERROR      The asynchronous USB transfer request failed.   \r
+                                   \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER) (\r
+  IN EFI_USB_IO_PROTOCOL                                 *This,\r
+  IN UINT8                                               DeviceEndpoint,\r
+  IN BOOLEAN                                             IsNewTransfer,\r
+  IN UINTN                                               PollingInterval    OPTIONAL,\r
+  IN UINTN                                               DataLength         OPTIONAL,\r
+  IN EFI_ASYNC_USB_TRANSFER_CALLBACK                     InterruptCallBack  OPTIONAL,\r
+  IN VOID                                                *Context OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  This function is used to manage a USB device with an interrupt transfer pipe.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
+  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
+                                device.                                                         \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                            \r
+  @param  DataLength            On input, then size, in bytes, of the buffer Data. On output, the\r
+                                amount of data actually transferred.                             \r
+  @param  Timeout               The time out, in seconds, for this transfer.\r
+  @param  Status                This parameter indicates the USB transfer status.                                \r
+                                \r
+  @retval EFI_SUCCESS           The sync interrupt transfer has been successfully executed.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+  @retval EFI_DEVICE_ERROR      The sync interrupt transfer request failed.   \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The transfer fails due to timeout.                                                       \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_SYNC_INTERRUPT_TRANSFER) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  IN     UINT8                      DeviceEndpoint,\r
+  IN OUT VOID                       *Data,\r
+  IN OUT UINTN                      *DataLength,\r
+  IN     UINTN                      Timeout,\r
+  OUT    UINT32                     *Status\r
+  );\r
+\r
+/**                                                                 \r
+  This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
+  transfer is typically used to transfer streaming data.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
+  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
+                                device.                                                         \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                            \r
+  @param  DataLength            The size, in bytes, of the data buffer specified by Data.                                         \r
+  @param  Status                This parameter indicates the USB transfer status.                                \r
+                                \r
+  @retval EFI_SUCCESS           The isochronous transfer has been successfully executed.\r
+  @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
+  @retval EFI_DEVICE_ERROR      The transfer failed due to the reason other than timeout, The error status\r
+                                is returned in Status.                                                    \r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
+  @retval EFI_TIMEOUT           The transfer fails due to timeout.                                                       \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_ISOCHRONOUS_TRANSFER) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  IN     UINT8                      DeviceEndpoint,\r
+  IN OUT VOID                       *Data,\r
+  IN     UINTN                      DataLength,\r
+  OUT    UINT32                     *Status\r
+  );\r
+\r
+/**                                                                 \r
+  This function is used to manage a USB device with an isochronous transfer pipe. An Isochronous\r
+  transfer is typically used to transfer streaming data.                                      \r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                \r
+  @param  DeviceEndpoint        A pointer to the USB device request that will be sent to the USB\r
+                                device.                                                         \r
+  @param  Data                  A pointer to the buffer of data that will be transmitted to USB\r
+                                device or received from USB device.                            \r
+  @param  DataLength            The size, in bytes, of the data buffer specified by Data.                                         \r
+  @param  Context               Data passed to the IsochronousCallback() function.\r
+  @param  IsochronousCallback   The IsochronousCallback() function.\r
+                                \r
+  @retval EFI_SUCCESS           The asynchronous isochronous transfer has been successfully submitted\r
+                                to the system.\r
+  @retval EFI_INVALID_PARAMETER The parameter DeviceEndpoint is not valid.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be submitted due to a lack of resources.\r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER) (\r
+  IN EFI_USB_IO_PROTOCOL              *This,\r
+  IN UINT8                            DeviceEndpoint,\r
+  IN OUT VOID                         *Data,\r
+  IN     UINTN                        DataLength,\r
+  IN EFI_ASYNC_USB_TRANSFER_CALLBACK  IsochronousCallBack,\r
+  IN VOID                             *Context OPTIONAL\r
+  );\r
+\r
+/**                                                                 \r
+  Resets and reconfigures the USB controller. This function will work for all USB devices except\r
+  USB Hub Controllers.                                                                          \r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+                                \r
+  @retval EFI_SUCCESS           The USB controller was reset.                                \r
+  @retval EFI_INVALID_PARAMETER If the controller specified by This is a USB hub.\r
+  @retval EFI_DEVICE_ERROR      An error occurred during the reconfiguration process.\r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_PORT_RESET) (\r
+  IN EFI_USB_IO_PROTOCOL    *This\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the USB Device Descriptor.\r
+    \r
+  @param  This                  A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+  @param  DeviceDescriptor      A pointer to the caller allocated USB Device Descriptor.\r
+                                \r
+  @retval EFI_SUCCESS           The device descriptor was retrieved successfully.\r
+  @retval EFI_INVALID_PARAMETER DeviceDescriptor is NULL.\r
+  @retval EFI_NOT_FOUND         The device descriptor was not found. The device may not be configured.\r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_DEVICE_DESCRIPTOR) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  OUT EFI_USB_DEVICE_DESCRIPTOR     *DeviceDescriptor\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the USB Device Descriptor.\r
+    \r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+  @param  ConfigurationDescriptor A pointer to the caller allocated USB Active Configuration\r
+                                  Descriptor.                                               \r
+  @retval EFI_SUCCESS             The active configuration descriptor was retrieved successfully.\r
+  @retval EFI_INVALID_PARAMETER   ConfigurationDescriptor is NULL.\r
+  @retval EFI_NOT_FOUND           An active configuration descriptor cannot be found. The device may not\r
+                                  be configured.                                                        \r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_CONFIG_DESCRIPTOR) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  OUT EFI_USB_CONFIG_DESCRIPTOR     *ConfigurationDescriptor\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves the Interface Descriptor for a USB Device Controller. As stated earlier, an interface\r
+  within a USB device is equivalently to a USB Controller within the current configuration.      \r
+    \r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+  @param  InterfaceDescriptor     A pointer to the caller allocated USB Interface Descriptor within\r
+                                  the configuration setting.                                       \r
+  @retval EFI_SUCCESS             The interface descriptor retrieved successfully.\r
+  @retval EFI_INVALID_PARAMETER   InterfaceDescriptor is NULL.\r
+  @retval EFI_NOT_FOUND           The interface descriptor cannot be found. The device may not be\r
+                                  correctly configured.                                          \r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_INTERFACE_DESCRIPTOR) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  OUT EFI_USB_INTERFACE_DESCRIPTOR  *InterfaceDescriptor\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves an Endpoint Descriptor within a USB Controller.\r
+    \r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+  @param  EndpointIndex           Indicates which endpoint descriptor to retrieve.\r
+  @param  EndpointDescriptor      A pointer to the caller allocated USB Endpoint Descriptor of\r
+                                  a USB controller.                                           \r
+                                                    \r
+  @retval EFI_SUCCESS             The endpoint descriptor was retrieved successfully.\r
+  @retval EFI_INVALID_PARAMETER   One or more parameters are invalid.\r
+  @retval EFI_NOT_FOUND           The endpoint descriptor cannot be found. The device may not be\r
+                                  correctly configured.                                         \r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  IN  UINT8                         EndpointIndex,\r
+  OUT EFI_USB_ENDPOINT_DESCRIPTOR   *EndpointDescriptor\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves a Unicode string stored in a USB Device.\r
+    \r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+  @param  LangID                  The Language ID for the string being retrieved.\r
+  @param  StringID                The ID of the string being retrieved.                                                         \r
+  @param  String                  A pointer to a buffer allocated by this function with                \r
+                                  AllocatePool() to store the string.\r
+                                                    \r
+  @retval EFI_SUCCESS             The string was retrieved successfully.  \r
+  @retval EFI_NOT_FOUND           The string specified by LangID and StringID was not found.                                      \r
+  @retval EFI_OUT_OF_RESOURCES    There are not enough resources to allocate the return buffer String.\r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_STRING_DESCRIPTOR) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  IN  UINT16                        LangID,\r
+  IN  UINT8                         StringID,\r
+  OUT CHAR16                        **String\r
+  );\r
+\r
+/**                                                                 \r
+  Retrieves all the language ID codes that the USB device supports.\r
+    \r
+  @param  This                    A pointer to the EFI_USB_IO_PROTOCOL instance.                                  \r
+  @param  LangIDTable             Language ID for the string the caller wants to get.\r
+  @param  TableSize               The size, in bytes, of the table LangIDTable.\r
+                                                    \r
+  @retval EFI_SUCCESS             The support languages were retrieved successfully.  \r
+                                           \r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_USB_IO_GET_SUPPORTED_LANGUAGE) (\r
+  IN EFI_USB_IO_PROTOCOL            *This,\r
+  OUT UINT16                        **LangIDTable,\r
+  OUT UINT16                        *TableSize\r
+  );\r
+\r
+//\r
+//  Protocol Interface Structure\r
+//\r
+struct _EFI_USB_IO_PROTOCOL {\r
+  //\r
+  // IO transfer\r
+  //\r
+  EFI_USB_IO_CONTROL_TRANSFER           UsbControlTransfer;\r
+  EFI_USB_IO_BULK_TRANSFER              UsbBulkTransfer;\r
+  EFI_USB_IO_ASYNC_INTERRUPT_TRANSFER   UsbAsyncInterruptTransfer;\r
+  EFI_USB_IO_SYNC_INTERRUPT_TRANSFER    UsbSyncInterruptTransfer;\r
+  EFI_USB_IO_ISOCHRONOUS_TRANSFER       UsbIsochronousTransfer;\r
+  EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER UsbAsyncIsochronousTransfer;\r
+\r
+  //\r
+  // Common device request\r
+  //\r
+  EFI_USB_IO_GET_DEVICE_DESCRIPTOR      UsbGetDeviceDescriptor;\r
+  EFI_USB_IO_GET_CONFIG_DESCRIPTOR      UsbGetConfigDescriptor;\r
+  EFI_USB_IO_GET_INTERFACE_DESCRIPTOR   UsbGetInterfaceDescriptor;\r
+  EFI_USB_IO_GET_ENDPOINT_DESCRIPTOR    UsbGetEndpointDescriptor;\r
+  EFI_USB_IO_GET_STRING_DESCRIPTOR      UsbGetStringDescriptor;\r
+  EFI_USB_IO_GET_SUPPORTED_LANGUAGE     UsbGetSupportedLanguages;\r
+\r
+  //\r
+  // Reset controller's parent port\r
+  //\r
+  EFI_USB_IO_PORT_RESET                 UsbPortReset;\r
+};\r
+\r
+extern EFI_GUID gEfiUsbIoProtocolGuid;\r
+\r
+#endif\r
diff --git a/MdePkg/Include/Protocol/Variable.h b/MdePkg/Include/Protocol/Variable.h
new file mode 100644 (file)
index 0000000..13eb113
--- /dev/null
@@ -0,0 +1,39 @@
+/** @file\r
+  Variable Architectural Protocol as defined in the DXE CIS\r
+\r
+  This code is used to produce the EFI 1.0 runtime variable services\r
+\r
+  The GetVariable (), GetNextVariableName (), and SetVariable () EFI 1.0 \r
+  services are added to the EFI system table and the \r
+  EFI_VARIABLE_ARCH_PROTOCOL_GUID protocol is registered with a NULL pointer.\r
+\r
+  No CRC of the EFI system table is required, as it is done in the DXE core.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  Variable.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_VARIABLE_ARCH_H__\r
+#define __ARCH_PROTOCOL_VARIABLE_ARCH_H__\r
+\r
+//\r
+// Global ID for the Variable Architectural Protocol\r
+//\r
+#define EFI_VARIABLE_ARCH_PROTOCOL_GUID \\r
+  { 0x1e5668e2, 0x8481, 0x11d4, {0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }\r
+\r
+extern EFI_GUID gEfiVariableArchProtocolGuid;\r
+\r
+#endif \r
diff --git a/MdePkg/Include/Protocol/VariableWrite.h b/MdePkg/Include/Protocol/VariableWrite.h
new file mode 100644 (file)
index 0000000..8c21df5
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  Variable Write Architectural Protocol as defined in the DXE CIS\r
+\r
+  This code is used to produce the EFI 1.0 runtime variable services\r
+\r
+  The SetVariable () EFI 1.0 services may be updated to the EFI system table and the \r
+  EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID protocol is registered with a NULL pointer.\r
+\r
+  No CRC of the EFI system table is required, as it is done in the DXE core.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  VariableWrite.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_VARIABLE_WRITE_ARCH_H__\r
+#define __ARCH_PROTOCOL_VARIABLE_WRITE_ARCH_H__\r
+\r
+//\r
+// Global ID for the Variable Write Architectural Protocol\r
+//\r
+#define EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID \\r
+  { 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53 } }\r
+\r
+extern EFI_GUID gEfiVariableWriteArchProtocolGuid;\r
+\r
+#endif \r
diff --git a/MdePkg/Include/Protocol/WatchdogTimer.h b/MdePkg/Include/Protocol/WatchdogTimer.h
new file mode 100644 (file)
index 0000000..8e31a36
--- /dev/null
@@ -0,0 +1,165 @@
+/** @file\r
+  Watchdog Timer Architectural Protocol as defined in the DXE CIS\r
+\r
+  Used to provide system watchdog timer services\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  WatchdogTimer.h\r
+\r
+  @par Revision Reference:\r
+  Version 0.91B.\r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_WATCHDOG_TIMER_H__\r
+#define __ARCH_PROTOCOL_WATCHDOG_TIMER_H__\r
+\r
+//\r
+// Global ID for the Watchdog Timer Architectural Protocol\r
+//\r
+#define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \\r
+  { 0x665E3FF5, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }\r
+\r
+//\r
+// Declare forward reference for the Timer Architectural Protocol\r
+//\r
+typedef struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  EFI_WATCHDOG_TIMER_ARCH_PROTOCOL;\r
+\r
+/**\r
+  A function of this type is called when the watchdog timer fires if a \r
+  handler has been registered.\r
+\r
+  @param  Time             The time in 100 ns units that has passed since the watchdog\r
+                           timer was armed. For the notify function to be called, this\r
+                           must be greater than TimerPeriod.\r
+\r
+  @return None.\r
+\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *EFI_WATCHDOG_TIMER_NOTIFY) (\r
+  IN UINT64  Time\r
+  );\r
+\r
+/**\r
+  This function registers a handler that is to be invoked when the watchdog \r
+  timer fires.  By default, the EFI_WATCHDOG_TIMER protocol will call the \r
+  Runtime Service ResetSystem() when the watchdog timer fires.  If a \r
+  NotifyFunction is registered, then the NotifyFunction will be called before \r
+  the Runtime Service ResetSystem() is called.  If NotifyFunction is NULL, then \r
+  the watchdog handler is unregistered.  If a watchdog handler is registered, \r
+  then EFI_SUCCESS is returned.  If an attempt is made to register a handler \r
+  when a handler is already registered, then EFI_ALREADY_STARTED is returned.  \r
+  If an attempt is made to uninstall a handler when a handler is not installed, \r
+  then return EFI_INVALID_PARAMETER.\r
+\r
+  @param  This             The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
+  @param  NotifyFunction   The function to call when the watchdog timer fires. If this\r
+                           is NULL, then the handler will be unregistered.\r
+\r
+  @retval EFI_SUCCESS           The watchdog timer handler was registered or\r
+                                unregistered.\r
+  @retval EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a handler is already\r
+                                registered.\r
+  @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not\r
+                                previously registered.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_WATCHDOG_TIMER_REGISTER_HANDLER) (\r
+  IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  *This,\r
+  IN EFI_WATCHDOG_TIMER_NOTIFY         NotifyFunction\r
+  );\r
+\r
+/**\r
+  This function sets the amount of time to wait before firing the watchdog \r
+  timer to TimerPeriod 100 nS units.  If TimerPeriod is 0, then the watchdog \r
+  timer is disabled.\r
+\r
+  @param  This             The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
+  @param  TimerPeriod      The amount of time in 100 nS units to wait before the watchdog\r
+                           timer is fired. If TimerPeriod is zero, then the watchdog\r
+                           timer is disabled.\r
+\r
+  @retval EFI_SUCCESS           The watchdog timer has been programmed to fire in Time\r
+                                100 nS units.\r
+  @retval EFI_DEVICE_ERROR      A watchdog timer could not be programmed due to a device\r
+                                error.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD) (\r
+  IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  *This,\r
+  IN UINT64                            TimerPeriod\r
+  );\r
+\r
+/**\r
+  This function retrieves the amount of time the system will wait before firing \r
+  the watchdog timer.  This period is returned in TimerPeriod, and EFI_SUCCESS \r
+  is returned.  If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.\r
+\r
+  @param  This             The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
+  @param  TimerPeriod      A pointer to the amount of time in 100 nS units that the system\r
+                           will wait before the watchdog timer is fired. If TimerPeriod of\r
+                           zero is returned, then the watchdog timer is disabled.\r
+\r
+  @retval EFI_SUCCESS           The amount of time that the system will wait before\r
+                                firing the watchdog timer was returned in TimerPeriod.\r
+  @retval EFI_INVALID_PARAMETER TimerPeriod is NULL.\r
+\r
+**/\r
+typedef \r
+EFI_STATUS\r
+(EFIAPI *EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD) (\r
+  IN  EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  *This,\r
+  OUT UINT64                            *TimerPeriod\r
+  );\r
+\r
+\r
+/**\r
+  Interface stucture for the Watchdog Timer Architectural Protocol.\r
+\r
+  @par Protocol Description:\r
+  This protocol provides the services required to implement the Boot Service \r
+  SetWatchdogTimer().  It provides a service to set the amount of time to wait \r
+  before firing the watchdog timer, and it also provides a service to register \r
+  a handler that is invoked when the watchdog timer fires.  This protocol can \r
+  implement the watchdog timer by using the event and timer Boot Services, or \r
+  it can make use of custom hardware.  When the watchdog timer fires, control \r
+  will be passed to a handler if one has been registered.  If no handler has \r
+  been registered, or the registered handler returns, then the system will be \r
+  reset by calling the Runtime Service ResetSystem().\r
+\r
+  @param  RegisterHandler  Registers a handler that is invoked when the watchdog\r
+                           timer fires.\r
+\r
+  @param  SetTimerPeriod   Sets the amount of time in 100 ns units to wait before the\r
+                           watchdog timer is fired. If this function is supported,\r
+                           then the watchdog timer period will be rounded up to the\r
+                           nearest supported watchdog timer period.\r
+\r
+  @param  GetTimerPeriod   Retrieves the amount of time in 100 ns units that the\r
+                           system will wait before the watchdog timer is fired.\r
+\r
+**/\r
+struct _EFI_WATCHDOG_TIMER_ARCH_PROTOCOL {\r
+  EFI_WATCHDOG_TIMER_REGISTER_HANDLER  RegisterHandler;\r
+  EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD  SetTimerPeriod;\r
+  EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD  GetTimerPeriod;\r
+};\r
+\r
+extern EFI_GUID gEfiWatchdogTimerArchProtocolGuid;\r
+\r
+#endif\r
+\r
index 429cbdcf1dcbba1f3d4071769f43faa485a32cb2..9218b1d311d57364b506fe69ca15abd57673867a 100644 (file)
@@ -65,6 +65,29 @@ typedef struct {
   UINT8   Pad2;\r
 } EFI_TIME;\r
 \r
+\r
+//\r
+// Networking Definitions\r
+//\r
+typedef struct {\r
+  UINT8 Addr[4];\r
+} EFI_IPv4_ADDRESS;\r
+\r
+typedef struct {\r
+  UINT8 Addr[16];\r
+} EFI_IPv6_ADDRESS;\r
+\r
+typedef struct {\r
+  UINT8 Addr[32];\r
+} EFI_MAC_ADDRESS;\r
+\r
+typedef union {\r
+  UINT32            Addr[4];\r
+  EFI_IPv4_ADDRESS  v4;\r
+  EFI_IPv6_ADDRESS  v6;\r
+} EFI_IP_ADDRESS;\r
+\r
+\r
 //\r
 // Enumeration of EFI_STATUS.\r
 // \r
diff --git a/MdePkg/Include/Uefi/UefiDevicePath.h b/MdePkg/Include/Uefi/UefiDevicePath.h
deleted file mode 100644 (file)
index 3d27e92..0000000
+++ /dev/null
@@ -1,466 +0,0 @@
-/* @file\r
-  Device Path definitions introduced in UEFI.\r
-\r
-  This include file must only contain things defined in the UEFI 2.0 specification.\r
-  If a code construct is defined in the UEFI 2.0 specification it must be included\r
-  by this include file.\r
-\r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-  Module Name:    UefiDevicePath.h\r
-\r
-**/\r
-\r
-#ifndef __UEFI_DEVICE_PATH_H__\r
-#define __UEFI_DEVICE_PATH_H__\r
-\r
-//\r
-// Device Path information\r
-//\r
-\r
-#pragma pack(1)\r
-\r
-//\r
-// Hardware Device Paths\r
-//\r
-#define HARDWARE_DEVICE_PATH      0x01\r
-\r
-#define HW_PCI_DP                 0x01\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT8                           Function;\r
-  UINT8                           Device;\r
-} PCI_DEVICE_PATH;\r
-\r
-#define HW_PCCARD_DP              0x02\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT8                           FunctionNumber;\r
-} PCCARD_DEVICE_PATH;\r
-\r
-#define HW_MEMMAP_DP              0x03\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          MemoryType;\r
-  EFI_PHYSICAL_ADDRESS            StartingAddress;\r
-  EFI_PHYSICAL_ADDRESS            EndingAddress;\r
-} MEMMAP_DEVICE_PATH;\r
-\r
-#define HW_VENDOR_DP              0x04\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  EFI_GUID                        Guid;\r
-} VENDOR_DEVICE_PATH;\r
-\r
-#define HW_CONTROLLER_DP          0x05\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          ControllerNumber;\r
-} CONTROLLER_DEVICE_PATH;\r
-\r
-//\r
-// ACPI Device Paths\r
-//\r
-#define ACPI_DEVICE_PATH          0x02\r
-\r
-#define ACPI_DP                   0x01\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          HID;\r
-  UINT32                          UID;\r
-} ACPI_HID_DEVICE_PATH;\r
-\r
-#define ACPI_EXTENDED_DP          0x02\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          HID;\r
-  UINT32                          UID;\r
-  UINT32                          CID;\r
-  //\r
-  // Optional variable length _HIDSTR\r
-  // Optional variable length _UIDSTR\r
-  //\r
-} ACPI_EXTENDED_HID_DEVICE_PATH;\r
-\r
-//\r
-//  EISA ID Macro\r
-//  EISA ID Definition 32-bits\r
-//   bits[15:0] - three character compressed ASCII EISA ID.\r
-//   bits[31:16] - binary number\r
-//    Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'\r
-//\r
-#define PNP_EISA_ID_CONST         0x41d0\r
-#define EISA_ID(_Name, _Num)      ((UINT32) ((_Name) | (_Num) << 16))\r
-#define EISA_PNP_ID(_PNPId)       (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
-#define EFI_PNP_ID(_PNPId)        (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
-\r
-#define PNP_EISA_ID_MASK          0xffff\r
-#define EISA_ID_TO_NUM(_Id)       ((_Id) >> 16)\r
-\r
-\r
-#define ACPI_ADR_DP               0x03\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          ADR;\r
-} ACPI_ADR_DEVICE_PATH;\r
-\r
-\r
-//\r
-// Messaging Device Paths\r
-//\r
-#define MESSAGING_DEVICE_PATH     0x03\r
-\r
-#define MSG_ATAPI_DP              0x01\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT8                           PrimarySecondary;\r
-  UINT8                           SlaveMaster;\r
-  UINT16                          Lun;\r
-} ATAPI_DEVICE_PATH;\r
-\r
-#define MSG_SCSI_DP               0x02\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT16                          Pun;\r
-  UINT16                          Lun;\r
-} SCSI_DEVICE_PATH;\r
-\r
-#define MSG_FIBRECHANNEL_DP       0x03\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          Reserved;\r
-  UINT64                          WWN;\r
-  UINT64                          Lun;\r
-} FIBRECHANNEL_DEVICE_PATH;\r
-\r
-#define MSG_1394_DP               0x04\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          Reserved;\r
-  UINT64                          Guid;\r
-} F1394_DEVICE_PATH;\r
-\r
-#define MSG_USB_DP                0x05\r
-typedef struct {\r
-    EFI_DEVICE_PATH_PROTOCOL      Header;\r
-    UINT8                         ParentPortNumber;\r
-    UINT8                         InterfaceNumber;\r
-} USB_DEVICE_PATH;\r
-\r
-#define MSG_USB_CLASS_DP          0x0f\r
-typedef struct {\r
-    EFI_DEVICE_PATH_PROTOCOL      Header;\r
-    UINT16                        VendorId;\r
-    UINT16                        ProductId;\r
-    UINT8                         DeviceClass;\r
-    UINT8                         DeviceSubClass;\r
-    UINT8                         DeviceProtocol;\r
-} USB_CLASS_DEVICE_PATH;\r
-\r
-#define MSG_USB_WWID_DP           0x10\r
-typedef struct {\r
-    EFI_DEVICE_PATH_PROTOCOL      Header;\r
-    UINT16                        InterfaceNumber;\r
-    UINT16                        VendorId;\r
-    UINT16                        ProductId;\r
-    // CHAR16                     SerialNumber[...];\r
-} USB_WWID_DEVICE_PATH;\r
-\r
-\r
-#define MSG_DEVICE_LOGICAL_UNIT_DP  0x11\r
-typedef struct {\r
-    EFI_DEVICE_PATH_PROTOCOL      Header;\r
-    UINT8                         Lun;\r
-} DEVICE_LOGICAL_UNIT_DEVICE_PATH;\r
-\r
-#define MSG_SATA_DP               0x12\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT16                          HbaPortNumber;\r
-  UINT16                          PortMultiplierPort;\r
-  UINT16                          LogicalUnitNumber;\r
-} SATA_DEVICE_PATH;\r
-\r
-#define MSG_I2O_DP                0x06\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          Tid;\r
-} I2O_DEVICE_PATH;\r
-\r
-#define MSG_MAC_ADDR_DP           0x0b\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  EFI_MAC_ADDRESS                 MacAddress;\r
-  UINT8                           IfType;\r
-} MAC_ADDR_DEVICE_PATH;\r
-\r
-#define MSG_IPv4_DP               0x0c\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  EFI_IPv4_ADDRESS                LocalIpAddress;\r
-  EFI_IPv4_ADDRESS                RemoteIpAddress;\r
-  UINT16                          LocalPort;\r
-  UINT16                          RemotePort;\r
-  UINT16                          Protocol;\r
-  BOOLEAN                         StaticIpAddress;\r
-} IPv4_DEVICE_PATH;\r
-\r
-#define MSG_IPv6_DP               0x0d\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  EFI_IPv6_ADDRESS                LocalIpAddress;\r
-  EFI_IPv6_ADDRESS                RemoteIpAddress;\r
-  UINT16                          LocalPort;\r
-  UINT16                          RemotePort;\r
-  UINT16                          Protocol;\r
-  BOOLEAN                         StaticIpAddress;\r
-} IPv6_DEVICE_PATH;\r
-\r
-#define MSG_INFINIBAND_DP         0x09\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          ResourceFlags;\r
-  UINT8                           PortGid[16];\r
-  UINT64                          ServiceId;\r
-  UINT64                          TargetPortId;\r
-  UINT64                          DeviceId;\r
-} INFINIBAND_DEVICE_PATH;\r
-\r
-#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE                0x01\r
-#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT  0x02\r
-#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL           0x04\r
-#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL           0x08\r
-#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL           0x10\r
-\r
-#define MSG_UART_DP               0x0e\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          Reserved;\r
-  UINT64                          BaudRate;\r
-  UINT8                           DataBits;\r
-  UINT8                           Parity;\r
-  UINT8                           StopBits;\r
-} UART_DEVICE_PATH;\r
-\r
-//\r
-// Use VENDOR_DEVICE_PATH struct\r
-//\r
-#define MSG_VENDOR_DP             0x0a\r
-typedef VENDOR_DEVICE_PATH        VENDOR_DEFINED_DEVICE_PATH;\r
-\r
-#define DEVICE_PATH_MESSAGING_PC_ANSI     EFI_PC_ANSI_GUID\r
-#define DEVICE_PATH_MESSAGING_VT_100      EFI_VT_100_GUID\r
-#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID\r
-#define DEVICE_PATH_MESSAGING_VT_UTF8     EFI_VT_UTF8_GUID\r
-\r
-#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL   EFI_UART_DEVICE_PATH_GUID\r
-\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  EFI_GUID                        Guid;\r
-  UINT32                          FlowControlMap;\r
-} UART_FLOW_CONTROL_DEVICE_PATH;\r
-\r
-#define DEVICE_PATH_MESSAGING_SAS                 EFI_SAS_DEVICE_PATH_GUID\r
-\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  EFI_GUID                        Guid;\r
-  UINT32                          Reserved;\r
-  UINT64                          SasAddress;\r
-  UINT64                          Lun;\r
-  UINT16                          DeviceTopology;\r
-  UINT16                          RelativeTargetPort;\r
-} SAS_DEVICE_PATH;\r
-\r
-#define MSG_ISCSI_DP              0x13\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT16                          NetworkProtocol;\r
-  UINT16                          LoginOption;\r
-  UINT16                          Reserved;\r
-  UINT16                          TargetPortalGroupTag;\r
-  UINT64                          LUN;\r
-  // CHAR8                        iSCSI Target Name\r
-} ISCSI_DEVICE_PATH;\r
-\r
-#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST             0x0000\r
-#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C   0x0002\r
-#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST               0x0000\r
-#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C     0x0008\r
-#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP              0x0000\r
-#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON               0x1000\r
-#define ISCSI_LOGIN_OPTION_CHAP_BI                      0x0000\r
-#define ISCSI_LOGIN_OPTION_CHAP_UNI                     0x2000\r
-\r
-//\r
-// Media Device Path\r
-//\r
-#define MEDIA_DEVICE_PATH         0x04\r
-\r
-#define MEDIA_HARDDRIVE_DP        0x01\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          PartitionNumber;\r
-  UINT64                          PartitionStart;\r
-  UINT64                          PartitionSize;\r
-  UINT8                           Signature[16];\r
-  UINT8                           MBRType;\r
-  UINT8                           SignatureType;\r
-} HARDDRIVE_DEVICE_PATH;\r
-\r
-#define MBR_TYPE_PCAT             0x01\r
-#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02\r
-\r
-#define SIGNATURE_TYPE_MBR        0x01\r
-#define SIGNATURE_TYPE_GUID       0x02\r
-\r
-#define MEDIA_CDROM_DP            0x02\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT32                          BootEntry;\r
-  UINT64                          PartitionStart;\r
-  UINT64                          PartitionSize;\r
-} CDROM_DEVICE_PATH;\r
-\r
-//\r
-// Use VENDOR_DEVICE_PATH struct\r
-//\r
-#define MEDIA_VENDOR_DP           0x03\r
-\r
-#define MEDIA_FILEPATH_DP         0x04\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  CHAR16                          PathName[1];\r
-} FILEPATH_DEVICE_PATH;\r
-\r
-#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)\r
-\r
-#define MEDIA_PROTOCOL_DP         0x05\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  EFI_GUID                        Protocol;\r
-} MEDIA_PROTOCOL_DEVICE_PATH;\r
-\r
-\r
-#define MEDIA_PIWG_FW_VOL_DP      0x6\r
-typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;\r
-\r
-\r
-#define MEDIA_PIWG_FW_FILE_DP     0x7\r
-typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_DEVICE_PATH;\r
-\r
-//\r
-// BBS Device Path\r
-//\r
-#define BBS_DEVICE_PATH           0x05\r
-#define BBS_BBS_DP                0x01\r
-typedef struct {\r
-  EFI_DEVICE_PATH_PROTOCOL        Header;\r
-  UINT16                          DeviceType;\r
-  UINT16                          StatusFlag;\r
-  CHAR8                           String[1];\r
-} BBS_BBS_DEVICE_PATH;\r
-\r
-//\r
-// DeviceType definitions - from BBS specification\r
-//\r
-#define BBS_TYPE_FLOPPY           0x01\r
-#define BBS_TYPE_HARDDRIVE        0x02\r
-#define BBS_TYPE_CDROM            0x03\r
-#define BBS_TYPE_PCMCIA           0x04\r
-#define BBS_TYPE_USB              0x05\r
-#define BBS_TYPE_EMBEDDED_NETWORK 0x06\r
-#define BBS_TYPE_BEV              0x80\r
-#define BBS_TYPE_UNKNOWN          0xFF\r
-\r
-\r
-//\r
-// Union of all possible Device Paths and pointers to Device Paths\r
-//\r
-\r
-typedef union {\r
-  EFI_DEVICE_PATH_PROTOCOL             DevPath;\r
-  PCI_DEVICE_PATH                      Pci;\r
-  PCCARD_DEVICE_PATH                   PcCard;\r
-  MEMMAP_DEVICE_PATH                   MemMap;\r
-  VENDOR_DEVICE_PATH                   Vendor;\r
-\r
-  CONTROLLER_DEVICE_PATH               Controller;\r
-  ACPI_HID_DEVICE_PATH                 Acpi;\r
-\r
-  ATAPI_DEVICE_PATH                    Atapi;\r
-  SCSI_DEVICE_PATH                     Scsi;\r
-  FIBRECHANNEL_DEVICE_PATH             FibreChannel;\r
-\r
-  F1394_DEVICE_PATH                    F1394;\r
-  USB_DEVICE_PATH                      Usb;\r
-  SATA_DEVICE_PATH                     Sata;\r
-  USB_CLASS_DEVICE_PATH                UsbClass;\r
-  I2O_DEVICE_PATH                      I2O;\r
-  MAC_ADDR_DEVICE_PATH                 MacAddr;\r
-  IPv4_DEVICE_PATH                     Ipv4;\r
-  IPv6_DEVICE_PATH                     Ipv6;\r
-  INFINIBAND_DEVICE_PATH               InfiniBand;\r
-  UART_DEVICE_PATH                     Uart;\r
-\r
-  HARDDRIVE_DEVICE_PATH                HardDrive;\r
-  CDROM_DEVICE_PATH                    CD;\r
-\r
-  FILEPATH_DEVICE_PATH                 FilePath;\r
-  MEDIA_PROTOCOL_DEVICE_PATH           MediaProtocol;\r
-\r
-  BBS_BBS_DEVICE_PATH                  Bbs;\r
-} EFI_DEV_PATH;\r
-\r
-\r
-\r
-typedef union {\r
-  EFI_DEVICE_PATH_PROTOCOL             *DevPath;\r
-  PCI_DEVICE_PATH                      *Pci;\r
-  PCCARD_DEVICE_PATH                   *PcCard;\r
-  MEMMAP_DEVICE_PATH                   *MemMap;\r
-  VENDOR_DEVICE_PATH                   *Vendor;\r
-\r
-  CONTROLLER_DEVICE_PATH               *Controller;\r
-  ACPI_HID_DEVICE_PATH                 *Acpi;\r
-  ACPI_EXTENDED_HID_DEVICE_PATH        *ExtendedAcpi;\r
-\r
-  ATAPI_DEVICE_PATH                    *Atapi;\r
-  SCSI_DEVICE_PATH                     *Scsi;\r
-  FIBRECHANNEL_DEVICE_PATH             *FibreChannel;\r
-\r
-  F1394_DEVICE_PATH                    *F1394;\r
-  USB_DEVICE_PATH                      *Usb;\r
-  SATA_DEVICE_PATH                     *Sata;\r
-  USB_CLASS_DEVICE_PATH                *UsbClass;\r
-  I2O_DEVICE_PATH                      *I2O;\r
-  MAC_ADDR_DEVICE_PATH                 *MacAddr;\r
-  IPv4_DEVICE_PATH                     *Ipv4;\r
-  IPv6_DEVICE_PATH                     *Ipv6;\r
-  INFINIBAND_DEVICE_PATH               *InfiniBand;\r
-  UART_DEVICE_PATH                     *Uart;\r
-\r
-  HARDDRIVE_DEVICE_PATH                *HardDrive;\r
-  CDROM_DEVICE_PATH                    *CD;\r
-\r
-  FILEPATH_DEVICE_PATH                 *FilePath;\r
-  MEDIA_PROTOCOL_DEVICE_PATH           *MediaProtocol;\r
-\r
-  BBS_BBS_DEVICE_PATH                  *Bbs;\r
-  UINT8                                *Raw;\r
-} EFI_DEV_PATH_PTR;\r
-\r
-#pragma pack()\r
-\r
-\r
-#endif\r
\r
-\r
index 1f16535c77b457d2ee0676b8dfb770e24f5585ca..5b22c23429a0e32e4c49a4d67be1d02faf401380 100644 (file)
 // The following types are currently defined:\r
 //\r
 typedef UINT32  RELOFST;\r
+\r
 typedef CHAR16  *EFI_STRING;\r
+typedef UINT16  EFI_IMAGE_ID;\r
+typedef UINT16  EFI_QUESTION_ID;\r
+typedef UINT16  EFI_STRING_ID;\r
+typedef UINT16  EFI_FORM_ID;\r
+typedef UINT16  EFI_VARSTORE_ID;\r
+\r
+//\r
+// BugBug in UEFI2.1 \r
+// \r
+typedef VOID    *EFI_FONT_HANDLE;\r
+\r
 \r
 //\r
 // IFR Op codes\r
index 4eef223db0d1e809b98a9b567d050b823e3b2076..f43624284f942e4931b980153b05b96af5fa286e 100644 (file)
 #include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 \r
-//\r
-// Networking Definitions\r
-//\r
-typedef struct {\r
-  UINT8 Addr[4];\r
-} EFI_IPv4_ADDRESS;\r
-\r
-typedef struct {\r
-  UINT8 Addr[16];\r
-} EFI_IPv6_ADDRESS;\r
-\r
-typedef struct {\r
-  UINT8 Addr[32];\r
-} EFI_MAC_ADDRESS;\r
-\r
-typedef union {\r
-  UINT32            Addr[4];\r
-  EFI_IPv4_ADDRESS  v4;\r
-  EFI_IPv6_ADDRESS  v6;\r
-} EFI_IP_ADDRESS;\r
-\r
-\r
 //\r
 // Enumeration of memory allocation.\r
 // \r
@@ -1550,7 +1528,7 @@ EFI_STATUS
 #define EFI_1_02_SYSTEM_TABLE_REVISION  ((1<<16) | (02))\r
 \r
 #define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552\r
-#define EFI_RUNTIME_SERVICES_REVISION   EFI_2_00_SYSTEM_TABLE_REVISION\r
+#define EFI_RUNTIME_SERVICES_REVISION   EFI_2_10_SYSTEM_TABLE_REVISION\r
 \r
 typedef struct {\r
   EFI_TABLE_HEADER Hdr;\r
@@ -1596,7 +1574,7 @@ typedef struct {
 \r
 \r
 #define EFI_BOOT_SERVICES_SIGNATURE   0x56524553544f4f42\r
-#define EFI_BOOT_SERVICES_REVISION    ((2<<16) | (00))\r
+#define EFI_BOOT_SERVICES_REVISION    EFI_2_10_SYSTEM_TABLE_REVISION\r
 \r
 typedef struct {\r
   EFI_TABLE_HEADER  Hdr;\r