--- /dev/null
+/*++\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
+ BaseCustomDecompressLibNull.c\r
+\r
+Abstract:\r
+\r
+ NULL Custom Decompress Library \r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+CustomDecompressGetInfo (\r
+ IN CONST VOID *Source,\r
+ IN UINT32 SourceSize,\r
+ OUT UINT32 *DestinationSize,\r
+ OUT UINT32 *ScratchSize\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().\r
+\r
+Arguments:\r
+\r
+ Source - The source buffer containing the compressed data.\r
+ SourceSize - The size of source buffer\r
+ DestinationSize - The size of destination buffer.\r
+ ScratchSize - The size of scratch buffer.\r
+\r
+Returns:\r
+\r
+ RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.\r
+ RETURN_INVALID_PARAMETER - The source data is corrupted\r
+\r
+--*/\r
+{\r
+ return RETURN_UNSUPPORTED;\r
+}\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+CustomDecompress (\r
+ IN CONST VOID *Source,\r
+ IN OUT VOID *Destination,\r
+ IN OUT VOID *Scratch\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().\r
+\r
+Arguments:\r
+\r
+ Source - The source buffer containing the compressed data.\r
+ Destination - The destination buffer to store the decompressed data\r
+ Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.\r
+\r
+Returns:\r
+\r
+ RETURN_SUCCESS - Decompression is successfull\r
+ RETURN_INVALID_PARAMETER - The source data is corrupted\r
+\r
+--*/\r
+{\r
+ return RETURN_UNSUPPORTED;\r
+}\r
--- /dev/null
+#/** @file\r
+# Base Custom Decompression Library\r
+#\r
+# Customer Decompress Library with NULL implementation.\r
+# Copyright (c) 2006 - 2007, Intel Corporation.\r
+#\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
+# 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
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = BaseCustomDecompressLibNull\r
+ FILE_GUID = e5566134-c75e-4ace-bad1-e23a3b335e30\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = CustomDecompressLib \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ BaseCustomDecompressLibNull.c\r
+ CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>BaseCustomDecompressLibNull</ModuleName>\r
+ <ModuleType>BASE</ModuleType>\r
+ <GuidValue>e5566134-c75e-4ace-bad1-e23a3b335e30</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Base Custom Decompression Library</Abstract>\r
+ <Description>Customer Decompress Library with NULL implementation.</Description>\r
+ <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>BaseCustomDecompressLibNull</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED">\r
+ <Keyword>CustomDecompressLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>BaseCustomDecompressLibNull.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.\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
+ 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
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <Base.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/CustomDecompressLib.h>\r
+\r
+#endif\r
--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.\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
+ 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
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/SerialPortLib.h>\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ UEFI Debug Library that uses PrintLib to send messages to CONOUT.\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\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
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+//\r
+// Define the maximum debug and assert message length that this library supports \r
+//\r
+#define MAX_DEBUG_MESSAGE_LENGTH 0x100\r
+\r
+\r
+/**\r
+\r
+ Prints a debug message to the debug output device if the specified error level is enabled.\r
+\r
+ If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print \r
+ the message specified by Format and the associated variable argument list to \r
+ the debug output device.\r
+\r
+ If Format is NULL, then ASSERT().\r
+\r
+ @param ErrorLevel The error level of the debug message.\r
+ @param Format Format string for the debug message to print.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DebugPrint (\r
+ IN UINTN ErrorLevel,\r
+ IN CONST CHAR8 *Format,\r
+ ...\r
+ )\r
+{\r
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
+ VA_LIST Marker;\r
+\r
+ //\r
+ // If Format is NULL, then ASSERT().\r
+ //\r
+ ASSERT (Format != NULL);\r
+\r
+ //\r
+ // Check driver debug mask value and global mask\r
+ //\r
+ if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) {\r
+ return;\r
+ }\r
+\r
+ //\r
+ // Convert the DEBUG() message to an ASCII String\r
+ //\r
+ VA_START (Marker, Format);\r
+ AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);\r
+ VA_END (Marker);\r
+\r
+ //\r
+ // Send the print string to a Serial Port \r
+ //\r
+ SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer));\r
+}\r
+\r
+\r
+/**\r
+\r
+ Prints an assert message containing a filename, line number, and description. \r
+ This may be followed by a breakpoint or a dead loop.\r
+\r
+ Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n" \r
+ to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of \r
+ PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if \r
+ DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then \r
+ CpuDeadLoop() is called. If neither of these bits are set, then this function \r
+ returns immediately after the message is printed to the debug output device.\r
+ DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while\r
+ processing another DebugAssert(), then DebugAssert() must return immediately.\r
+\r
+ If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.\r
+\r
+ If Description is NULL, then a <Description> string of "(NULL) Description" is printed.\r
+\r
+ @param FileName Pointer to the name of the source file that generated the assert condition.\r
+ @param LineNumber The line number in the source file that generated the assert condition\r
+ @param Description Pointer to the description of the assert condition.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+DebugAssert (\r
+ IN CONST CHAR8 *FileName,\r
+ IN UINTN LineNumber,\r
+ IN CONST CHAR8 *Description\r
+ )\r
+{\r
+ CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];\r
+\r
+ //\r
+ // Generate the ASSERT() message in Unicode format\r
+ //\r
+ AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, LineNumber, Description);\r
+\r
+ //\r
+ // Send the print string to the Console Output device\r
+ //\r
+ SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer));\r
+\r
+ //\r
+ // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
+ //\r
+ if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
+ CpuBreakpoint ();\r
+ } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
+ CpuDeadLoop ();\r
+ }\r
+}\r
+\r
+\r
+/**\r
+\r
+ Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.\r
+\r
+ This function fills Length bytes of Buffer with the value specified by \r
+ PcdDebugClearMemoryValue, and returns Buffer.\r
+\r
+ If Buffer is NULL, then ASSERT().\r
+\r
+ If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+\r
+ @param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue.\r
+ @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
+\r
+ @return Buffer\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+DebugClearMemory (\r
+ OUT VOID *Buffer,\r
+ IN UINTN Length\r
+ )\r
+{\r
+ //\r
+ // If Buffer is NULL, then ASSERT().\r
+ //\r
+ ASSERT (Buffer != NULL);\r
+\r
+ //\r
+ // SetMem() checks for the the ASSERT() condition on Length and returns Buffer\r
+ //\r
+ return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if ASSERT() macros are enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugAssertEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if DEBUG()macros are enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugPrintEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if DEBUG_CODE()macros are enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugCodeEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+}\r
+\r
+\r
+/**\r
+ \r
+ Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.\r
+\r
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of \r
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.\r
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+DebugClearMemoryEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
+}\r
--- /dev/null
+#/** @file\r
+# Debug Library for Dxe drivers\r
+#\r
+# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification\r
+# Copyright (c) 2006 - 2007, Intel Corporation.\r
+#\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
+# 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
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = DxeDebugLibSerialPort\r
+ FILE_GUID = BB83F95F-EDBC-4884-A520-CD42AF388FAE\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = DebugLib \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ DebugLib.c\r
+ CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+ SerialPortLib\r
+ BaseMemoryLib\r
+ PcdLib\r
+ PrintLib\r
+ BaseLib\r
+\r
+\r
+################################################################################\r
+#\r
+# Pcd FIXED_AT_BUILD - list of PCDs that this module is coded for.\r
+#\r
+################################################################################\r
+\r
+[PcdsFixedAtBuild.common]\r
+ PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid\r
+ PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid\r
+\r
+\r
+################################################################################\r
+#\r
+# Pcd DYNAMIC - list of PCDs that this module is coded for.\r
+#\r
+################################################################################\r
+\r
+[PcdsDynamic.common]\r
+ PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>DxeDebugLibSerialPort</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>BB83F95F-EDBC-4884-A520-CD42AF388FAE</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Debug Library for UEFI drivers</Abstract>\r
+ <Description>Library to abstract Framework extensions that conflict with UEFI 2.0 Specification</Description>\r
+ <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>DxeDebugLibSerialPort</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PrintLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PcdLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseMemoryLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>SerialPortLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>DebugLib.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+ <PcdCoded>\r
+ <PcdEntry PcdItemType="FIXED_AT_BUILD">\r
+ <C_Name>PcdDebugPropertyMask</C_Name>\r
+ <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <HelpText>The bitmask of flags that specify the enable/disable of Debug
+ Assert, Debug Print, Debug Code, Clear Memory, Assert
+ Breakpoint and Assert Deadloop.</HelpText>\r
+ </PcdEntry>\r
+ <PcdEntry PcdItemType="FIXED_AT_BUILD">\r
+ <C_Name>PcdDebugClearMemoryValue</C_Name>\r
+ <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <HelpText>The value used by DebugClearMemory () to fill a certain range
+ of memory.</HelpText>\r
+ </PcdEntry>\r
+ <PcdEntry PcdItemType="DYNAMIC">\r
+ <C_Name>PcdDebugPrintErrorLevel</C_Name>\r
+ <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <HelpText>The bitmask of flags that specify the kind of debug message
+ output when Debug Print is enabled.</HelpText>\r
+ </PcdEntry>\r
+ </PcdCoded>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID 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
+ 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
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/UsbLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+\r
+#endif\r
--- /dev/null
+#/** @file\r
+# Component description file for UefiUsb library.\r
+#\r
+# This library provides supports for common USB functions.\r
+# Copyright (c) 2006, Intel Corporation.\r
+#\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
+# 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
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = UefiUsbLib\r
+ FILE_GUID = 87eb5df9-722a-4241-ad7f-370d0b3a56d7\r
+ MODULE_TYPE = UEFI_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = UsbLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ hid.c\r
+ UsbDxeLib.c\r
+ CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+ BaseMemoryLib\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>UefiUsbLib</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>87eb5df9-722a-4241-ad7f-370d0b3a56d7</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Component description file for UsbDxeLib module</Abstract>\r
+ <Description>This library provides supports for common USB functions.</Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>UefiUsbLib</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">\r
+ <Keyword>UefiUsbLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseMemoryLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>UsbDxeLib.c</Filename>\r
+ <Filename>hid.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/*++\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
+ UsbDxeLib.c\r
+\r
+ Abstract:\r
+\r
+ Common Dxe Libarary for USB\r
+\r
+ Revision History\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+//\r
+// Get Device Descriptor\r
+//\r
+EFI_STATUS\r
+UsbGetDescriptor (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT16 Value,\r
+ IN UINT16 Index,\r
+ IN UINT16 DescriptorLength,\r
+ OUT VOID *Descriptor,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Get Descriptor\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Value - Device Request Value\r
+ Index - Device Request Index \r
+ DescriptorLength - Descriptor Length\r
+ Descriptor - Descriptor buffer to contain result\r
+ Status - Transfer Status\r
+Returns:\r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;\r
+ DevReq.Request = USB_DEV_GET_DESCRIPTOR;\r
+ DevReq.Value = Value;\r
+ DevReq.Index = Index;\r
+ DevReq.Length = DescriptorLength;\r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ Descriptor,\r
+ DescriptorLength,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Set Device Descriptor\r
+//\r
+EFI_STATUS\r
+UsbSetDescriptor (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT16 Value,\r
+ IN UINT16 Index,\r
+ IN UINT16 DescriptorLength,\r
+ IN VOID *Descriptor,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Set Descriptor\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Value - Device Request Value\r
+ Index - Device Request Index \r
+ DescriptorLength - Descriptor Length\r
+ Descriptor - Descriptor buffer to set\r
+ Status - Transfer Status\r
+Returns:\r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;\r
+ DevReq.Request = USB_DEV_SET_DESCRIPTOR;\r
+ DevReq.Value = Value;\r
+ DevReq.Index = Index;\r
+ DevReq.Length = DescriptorLength;\r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbDataOut,\r
+ TIMEOUT_VALUE,\r
+ Descriptor,\r
+ DescriptorLength,\r
+ Status\r
+ );\r
+}\r
+\r
+//\r
+// Get device Interface\r
+//\r
+EFI_STATUS\r
+UsbGetDeviceInterface (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT16 Index,\r
+ OUT UINT8 *AltSetting,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Get Device Interface\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Index - Interface index value\r
+ AltSetting - Alternate setting\r
+ Status - Trasnsfer status\r
+\r
+Returns:\r
+\r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;\r
+ DevReq.Request = USB_DEV_GET_INTERFACE;\r
+ DevReq.Index = Index;\r
+ DevReq.Length = 1;\r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ AltSetting,\r
+ 1,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Set device interface\r
+//\r
+EFI_STATUS\r
+UsbSetDeviceInterface (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT16 InterfaceNo,\r
+ IN UINT16 AltSetting,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Set Device Interface\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ InterfaceNo - Interface Number\r
+ AltSetting - Alternate setting\r
+ Status - Trasnsfer status\r
+\r
+Returns:\r
+\r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;\r
+ DevReq.Request = USB_DEV_SET_INTERFACE;\r
+ DevReq.Value = AltSetting;\r
+ DevReq.Index = InterfaceNo;\r
+ \r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbNoData,\r
+ TIMEOUT_VALUE,\r
+ NULL,\r
+ 0,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Get device configuration\r
+//\r
+EFI_STATUS\r
+UsbGetDeviceConfiguration (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ OUT UINT8 *ConfigValue,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Get Device Configuration\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ ConfigValue - Config Value\r
+ Status - Transfer Status\r
+\r
+Returns:\r
+\r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;\r
+ DevReq.Request = USB_DEV_GET_CONFIGURATION;\r
+ DevReq.Length = 1;\r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ ConfigValue,\r
+ 1,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Set device configuration\r
+//\r
+EFI_STATUS\r
+UsbSetDeviceConfiguration (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT16 Value,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Set Device Configuration\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Value - Configuration Value to set\r
+ Status - Transfer status\r
+\r
+Returns:\r
+\r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;\r
+ DevReq.Request = USB_DEV_SET_CONFIGURATION;\r
+ DevReq.Value = Value;\r
+ \r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbNoData,\r
+ TIMEOUT_VALUE,\r
+ NULL,\r
+ 0,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Set Device Feature\r
+//\r
+EFI_STATUS\r
+UsbSetDeviceFeature (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN EFI_USB_RECIPIENT Recipient,\r
+ IN UINT16 Value,\r
+ IN UINT16 Target,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Set Device Feature\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Recipient - Interface/Device/Endpoint\r
+ Value - Request value\r
+ Target - Request Index\r
+ Status - Transfer status\r
+\r
+Returns:\r
+ \r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ switch (Recipient) {\r
+\r
+ case EfiUsbDevice:\r
+ DevReq.RequestType = 0x00;\r
+ break;\r
+\r
+ case EfiUsbInterface:\r
+ DevReq.RequestType = 0x01;\r
+ break;\r
+\r
+ case EfiUsbEndpoint:\r
+ DevReq.RequestType = 0x02;\r
+ break;\r
+ }\r
+ //\r
+ // Fill device request, see USB1.1 spec\r
+ //\r
+ DevReq.Request = USB_DEV_SET_FEATURE;\r
+ DevReq.Value = Value;\r
+ DevReq.Index = Target;\r
+\r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbNoData,\r
+ TIMEOUT_VALUE,\r
+ NULL,\r
+ 0,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Clear Device Feature\r
+//\r
+EFI_STATUS\r
+UsbClearDeviceFeature (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN EFI_USB_RECIPIENT Recipient,\r
+ IN UINT16 Value,\r
+ IN UINT16 Target,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Clear Device Feature\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Recipient - Interface/Device/Endpoint\r
+ Value - Request value\r
+ Target - Request Index\r
+ Status - Transfer status\r
+\r
+Returns:\r
+ \r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ switch (Recipient) {\r
+\r
+ case EfiUsbDevice:\r
+ DevReq.RequestType = 0x00;\r
+ break;\r
+\r
+ case EfiUsbInterface:\r
+ DevReq.RequestType = 0x01;\r
+ break;\r
+\r
+ case EfiUsbEndpoint:\r
+ DevReq.RequestType = 0x02;\r
+ break;\r
+ }\r
+ //\r
+ // Fill device request, see USB1.1 spec\r
+ //\r
+ DevReq.Request = USB_DEV_CLEAR_FEATURE;\r
+ DevReq.Value = Value;\r
+ DevReq.Index = Target;\r
+\r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbNoData,\r
+ TIMEOUT_VALUE,\r
+ NULL,\r
+ 0,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Get Device Status\r
+//\r
+EFI_STATUS\r
+UsbGetDeviceStatus (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN EFI_USB_RECIPIENT Recipient,\r
+ IN UINT16 Target,\r
+ OUT UINT16 *DevStatus,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Get Device Status\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Recipient - Interface/Device/Endpoint\r
+ Target - Request index\r
+ DevStatus - Device status\r
+ Status - Transfer status\r
+\r
+Returns:\r
+ \r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ EFI_USB_DEVICE_REQUEST DevReq;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
+\r
+ switch (Recipient) {\r
+\r
+ case EfiUsbDevice:\r
+ DevReq.RequestType = 0x80;\r
+ break;\r
+\r
+ case EfiUsbInterface:\r
+ DevReq.RequestType = 0x81;\r
+ break;\r
+\r
+ case EfiUsbEndpoint:\r
+ DevReq.RequestType = 0x82;\r
+ break;\r
+ }\r
+ //\r
+ // Fill device request, see USB1.1 spec\r
+ //\r
+ DevReq.Request = USB_DEV_GET_STATUS;\r
+ DevReq.Value = 0;\r
+ DevReq.Index = Target;\r
+ DevReq.Length = 2;\r
+\r
+ return UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &DevReq,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ DevStatus,\r
+ 2,\r
+ Status\r
+ );\r
+}\r
+//\r
+// Usb Get String\r
+//\r
+EFI_STATUS\r
+UsbGetString (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT16 LangID,\r
+ IN UINT8 Index,\r
+ IN VOID *Buf,\r
+ IN UINTN BufSize,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Usb Get String\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ LangID - Language ID\r
+ Index - Request index\r
+ Buf - Buffer to store string\r
+ BufSize - Buffer size\r
+ Status - Transfer status\r
+\r
+Returns:\r
+ \r
+ EFI_INVALID_PARAMETER - Parameter is error\r
+ EFI_SUCCESS - Success\r
+ EFI_TIMEOUT - Device has no response \r
+\r
+--*/\r
+{\r
+ UINT16 Value;\r
+\r
+ if (UsbIo == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // Fill value, see USB1.1 spec\r
+ //\r
+ Value = (UINT16) ((USB_DT_STRING << 8) | Index);\r
+\r
+ return UsbGetDescriptor (\r
+ UsbIo,\r
+ Value,\r
+ LangID,\r
+ (UINT16) BufSize,\r
+ Buf,\r
+ Status\r
+ );\r
+}\r
+\r
+EFI_STATUS\r
+UsbClearEndpointHalt (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 EndpointNo,\r
+ OUT UINT32 *Status\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Clear endpoint stall\r
+\r
+Arguments:\r
+\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ EndpointNo - Endpoint Number\r
+ Status - Transfer Status\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - Can't find the Endpoint\r
+ EFI_DEVICE_ERROR - Hardware error\r
+ EFI_SUCCESS - Success\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Result;\r
+ EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;\r
+ EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;\r
+ UINT8 Index;\r
+\r
+ ZeroMem (&EndpointDescriptor, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR));\r
+ //\r
+ // First seach the endpoint descriptor for that endpoint addr\r
+ //\r
+ Result = UsbIo->UsbGetInterfaceDescriptor (\r
+ UsbIo,\r
+ &InterfaceDescriptor\r
+ );\r
+ if (EFI_ERROR (Result)) {\r
+ return Result;\r
+ }\r
+\r
+ for (Index = 0; Index < InterfaceDescriptor.NumEndpoints; Index++) {\r
+ Result = UsbIo->UsbGetEndpointDescriptor (\r
+ UsbIo,\r
+ Index,\r
+ &EndpointDescriptor\r
+ );\r
+ if (EFI_ERROR (Result)) {\r
+ continue;\r
+ }\r
+\r
+ if (EndpointDescriptor.EndpointAddress == EndpointNo) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (Index == InterfaceDescriptor.NumEndpoints) {\r
+ //\r
+ // No such endpoint\r
+ //\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ Result = UsbClearDeviceFeature (\r
+ UsbIo,\r
+ EfiUsbEndpoint,\r
+ EfiUsbEndpointHalt,\r
+ EndpointDescriptor.EndpointAddress,\r
+ Status\r
+ );\r
+\r
+ return Result;\r
+}\r
--- /dev/null
+/*++\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
+ hid.c\r
+\r
+ Abstract:\r
+\r
+ HID class request\r
+\r
+ Revision History\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+//\r
+// Function to get HID descriptor\r
+//\r
+EFI_STATUS\r
+UsbGetHidDescriptor (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 InterfaceNum,\r
+ OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Get Hid Descriptor\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ InterfaceNum - Hid interface number\r
+ HidDescriptor - Caller allocated buffer to store Usb hid descriptor\r
+ if successfully returned.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ Request.RequestType = 0x81;\r
+ Request.Request = 0x06;\r
+ Request.Value = (UINT16) (0x21 << 8);\r
+ Request.Index = InterfaceNum;\r
+ Request.Length = sizeof (EFI_USB_HID_DESCRIPTOR);\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ HidDescriptor,\r
+ sizeof (EFI_USB_HID_DESCRIPTOR),\r
+ &Status\r
+ );\r
+\r
+ return Result;\r
+\r
+}\r
+//\r
+// Function to get Report Class descriptor\r
+//\r
+EFI_STATUS\r
+UsbGetReportDescriptor (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 InterfaceNum,\r
+ IN UINT16 DescriptorSize,\r
+ OUT UINT8 *DescriptorBuffer\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ get Report Class descriptor\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL.\r
+ InterfaceNum - Report interface number.\r
+ DescriptorSize - Length of DescriptorBuffer.\r
+ DescriptorBuffer - Caller allocated buffer to store Usb report descriptor\r
+ if successfully returned.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ //\r
+ // Fill Device request packet\r
+ //\r
+ Request.RequestType = 0x81;\r
+ Request.Request = 0x06;\r
+ Request.Value = (UINT16) (0x22 << 8);\r
+ Request.Index = InterfaceNum;\r
+ Request.Length = DescriptorSize;\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ DescriptorBuffer,\r
+ DescriptorSize,\r
+ &Status\r
+ );\r
+\r
+ return Result;\r
+\r
+}\r
+//\r
+// Following are HID class request\r
+//\r
+EFI_STATUS\r
+UsbGetProtocolRequest (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 Interface,\r
+ IN UINT8 *Protocol\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Get Hid Protocol Request\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Interface - Which interface the caller wants to get protocol\r
+ Protocol - Protocol value returned.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ //\r
+ // Fill Device request packet\r
+ //\r
+ Request.RequestType = 0xa1;\r
+ //\r
+ // 10100001b;\r
+ //\r
+ Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;\r
+ Request.Value = 0;\r
+ Request.Index = Interface;\r
+ Request.Length = 1;\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ Protocol,\r
+ sizeof (UINT8),\r
+ &Status\r
+ );\r
+\r
+ return Result;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+UsbSetProtocolRequest (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 Interface,\r
+ IN UINT8 Protocol\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Set Hid Protocol Request\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Interface - Which interface the caller wants to set protocol\r
+ Protocol - Protocol value the caller wants to set.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ //\r
+ // Fill Device request packet\r
+ //\r
+ Request.RequestType = 0x21;\r
+ //\r
+ // 00100001b;\r
+ //\r
+ Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;\r
+ Request.Value = Protocol;\r
+ Request.Index = Interface;\r
+ Request.Length = 0;\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbNoData,\r
+ TIMEOUT_VALUE,\r
+ NULL,\r
+ 0,\r
+ &Status\r
+ );\r
+ return Result;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+UsbSetIdleRequest (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 Interface,\r
+ IN UINT8 ReportId,\r
+ IN UINT8 Duration\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Set Idel request.\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Interface - Which interface the caller wants to set.\r
+ ReportId - Which report the caller wants to set.\r
+ Duration - Idle rate the caller wants to set.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ //\r
+ // Fill Device request packet\r
+ //\r
+ Request.RequestType = 0x21;\r
+ //\r
+ // 00100001b;\r
+ //\r
+ Request.Request = EFI_USB_SET_IDLE_REQUEST;\r
+ Request.Value = (UINT16) ((Duration << 8) | ReportId);\r
+ Request.Index = Interface;\r
+ Request.Length = 0;\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbNoData,\r
+ TIMEOUT_VALUE,\r
+ NULL,\r
+ 0,\r
+ &Status\r
+ );\r
+ return Result;\r
+}\r
+\r
+EFI_STATUS\r
+UsbGetIdleRequest (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 Interface,\r
+ IN UINT8 ReportId,\r
+ OUT UINT8 *Duration\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Get Idel request.\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Interface - Which interface the caller wants to get.\r
+ ReportId - Which report the caller wants to get.\r
+ Duration - Idle rate the caller wants to get.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ //\r
+ // Fill Device request packet\r
+ //\r
+ Request.RequestType = 0xa1;\r
+ //\r
+ // 10100001b;\r
+ //\r
+ Request.Request = EFI_USB_GET_IDLE_REQUEST;\r
+ Request.Value = ReportId;\r
+ Request.Index = Interface;\r
+ Request.Length = 1;\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ Duration,\r
+ 1,\r
+ &Status\r
+ );\r
+\r
+ return Result;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+UsbSetReportRequest (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 Interface,\r
+ IN UINT8 ReportId,\r
+ IN UINT8 ReportType,\r
+ IN UINT16 ReportLen,\r
+ IN UINT8 *Report\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Hid Set Report request.\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Interface - Which interface the caller wants to set.\r
+ ReportId - Which report the caller wants to set.\r
+ ReportType - Type of report.\r
+ ReportLen - Length of report descriptor.\r
+ Report - Report Descriptor buffer.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ //\r
+ // Fill Device request packet\r
+ //\r
+ Request.RequestType = 0x21;\r
+ //\r
+ // 00100001b;\r
+ //\r
+ Request.Request = EFI_USB_SET_REPORT_REQUEST;\r
+ Request.Value = (UINT16) ((ReportType << 8) | ReportId);\r
+ Request.Index = Interface;\r
+ Request.Length = ReportLen;\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbDataOut,\r
+ TIMEOUT_VALUE,\r
+ Report,\r
+ ReportLen,\r
+ &Status\r
+ );\r
+\r
+ return Result;\r
+}\r
+\r
+EFI_STATUS\r
+UsbGetReportRequest (\r
+ IN EFI_USB_IO_PROTOCOL *UsbIo,\r
+ IN UINT8 Interface,\r
+ IN UINT8 ReportId,\r
+ IN UINT8 ReportType,\r
+ IN UINT16 ReportLen,\r
+ IN UINT8 *Report\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Hid Set Report request.\r
+\r
+ Arguments:\r
+ UsbIo - EFI_USB_IO_PROTOCOL\r
+ Interface - Which interface the caller wants to set.\r
+ ReportId - Which report the caller wants to set.\r
+ ReportType - Type of report.\r
+ ReportLen - Length of report descriptor.\r
+ Report - Caller allocated buffer to store Report Descriptor.\r
+\r
+ Returns:\r
+ EFI_SUCCESS\r
+ EFI_DEVICE_ERROR\r
+ EFI_TIMEOUT\r
+\r
+--*/\r
+{\r
+ UINT32 Status;\r
+ EFI_STATUS Result;\r
+ EFI_USB_DEVICE_REQUEST Request;\r
+\r
+ //\r
+ // Fill Device request packet\r
+ //\r
+ Request.RequestType = 0xa1;\r
+ //\r
+ // 10100001b;\r
+ //\r
+ Request.Request = EFI_USB_GET_REPORT_REQUEST;\r
+ Request.Value = (UINT16) ((ReportType << 8) | ReportId);\r
+ Request.Index = Interface;\r
+ Request.Length = ReportLen;\r
+\r
+ Result = UsbIo->UsbControlTransfer (\r
+ UsbIo,\r
+ &Request,\r
+ EfiUsbDataIn,\r
+ TIMEOUT_VALUE,\r
+ Report,\r
+ ReportLen,\r
+ &Status\r
+ );\r
+\r
+ return Result;\r
+}\r
${WORKSPACE}/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
${WORKSPACE}\MdePkg\Library/UefiScsiLib/UefiScsiLib.inf\r
${WORKSPACE}/MdePkg/Library/DxeMemoryLib/DxeMemoryLib.inf\r
-\r
+ ${WORKSPACE}/MdePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.inf\r
+ ${WORKSPACE}/MdePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.inf\r
+ ${WORKSPACE}/MdePkg/Library/UefiUsbLib/UefiUsbLib.inf\r
\r
[Components.IA32]\r
${WORKSPACE}\MdePkg\Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf\r
<Filename>Library/UefiDriverEntryPoint/UefiDriverEntryPoint.msa</Filename>\r
<Filename>Library/UefiLib/UefiLib.msa</Filename>\r
<Filename>Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.msa</Filename>\r
+ <Filename>Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa</Filename>\r
+ <Filename>Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa</Filename>\r
+ <Filename>Library/UefiUsbLib/UefiUsbLib.msa</Filename>\r
</MsaFiles>\r
<PackageHeaders>\r
<IncludePkgHeader ModuleType="BASE">Include/Base.h</IncludePkgHeader>\r