diff --git a/MdePkg/Include/IndustryStandard/Tpm12.h b/MdePkg/Include/IndustryStandard/Tpm12.h index 1d489815ca..374d3131e3 100644 --- a/MdePkg/Include/IndustryStandard/Tpm12.h +++ b/MdePkg/Include/IndustryStandard/Tpm12.h @@ -1,25 +1,18 @@ -/*++ - -Copyright (c) 2005 - 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - Tpm12.h - -Abstract: - +/** + @file TPM Specification data structures (TCG TPM Specification Version 1.2 Revision 94) - See http://trustedcomputinggroup.org for latest specification updates ---*/ + Copyright (c) 2006 - 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +**/ + #ifndef _TPM12_H_ #define _TPM12_H_ diff --git a/MdePkg/Include/Library/IfrSupportLib.h b/MdePkg/Include/Library/IfrSupportLib.h index 75c7f4785b..e3885e1db3 100644 --- a/MdePkg/Include/Library/IfrSupportLib.h +++ b/MdePkg/Include/Library/IfrSupportLib.h @@ -1,24 +1,17 @@ -/*++ - -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - IfrSupportLibrary.h - -Abstract: - +/** @file The file contain all library functions and definitions for IFR opcode creation and - related Form Browser utility Operations. - ---*/ + related Form Browser utility Operations. + + Copyright (c) 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ #ifndef _IFR_SUPPORT_LIBRARY_H #define _IFR_SUPPORT_LIBRARY_H diff --git a/MdePkg/Include/Library/PeiPiLib.h b/MdePkg/Include/Library/PeiPiLib.h index a1b472ac69..c79552c597 100644 --- a/MdePkg/Include/Library/PeiPiLib.h +++ b/MdePkg/Include/Library/PeiPiLib.h @@ -23,7 +23,7 @@ The function allocate the EFI_PEI_PPI_DESCRIPTOR structure and update the fields accordingly to parameter passed in and install the PPI. - @param FvStart Unique identifier of the format of the memory-mapped firmware volume. If NULL is specified, + @param FvFormat Unique identifier of the format of the memory-mapped firmware volume. If NULL is specified, EFI_FIRMWARE_FILE_SYSTEM2_GUID is used as the Format GUID. @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. The format of this buffer is specific to the FvFormat. For diff --git a/MdePkg/Include/Protocol/TcgService.h b/MdePkg/Include/Protocol/TcgService.h index ddc4eaf286..aadd701719 100644 --- a/MdePkg/Include/Protocol/TcgService.h +++ b/MdePkg/Include/Protocol/TcgService.h @@ -1,25 +1,17 @@ -/*++ - -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - TcgService.h - -Abstract: - +/** @file TCG Service Protocol as defined in TCG_EFI_Protocol_1_20_Final - - See http://trustedcomputinggroup.org for the latest specification - ---*/ + See http://trustedcomputinggroup.org for the latest specification + + Copyright (c) 2007, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ #ifndef _TCG_SERVICE_PROTOCOL_H_ #define _TCG_SERVICE_PROTOCOL_H_ @@ -60,6 +52,31 @@ typedef UINT32 TCG_ALGORITHM_ID; // #pragma pack (pop) +/** + This service provides EFI protocol capability information, state information + about the TPM, and Event Log state information. + + @param This Indicates the calling context + @param ProtocolCapability The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY + structure and fills in the fields with the EFI protocol + capability information and the current TPM state information. + @param TCGFeatureFlags This is a pointer to the feature flags. No feature + flags are currently defined so this parameter + MUST be set to 0. However, in the future, + feature flags may be defined that, for example, + enable hash algorithm agility. + @param EventLogLocation This is a pointer to the address of the event log in memory. + @param EventLogLastEntry If the Event Log contains more than one entry, + this is a pointer to the address of the start of + the last entry in the event log in memory. + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR The command was unsuccessful. + @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. + @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small. + @retval EFI_NOT_FOUND The component was not running + +**/ typedef EFI_STATUS (EFIAPI *EFI_TCG_STATUS_CHECK) ( @@ -71,6 +88,23 @@ EFI_STATUS OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry ); +/** + This service abstracts the capability to do a hash operation on a data buffer. + + @param This Indicates the calling context + @param HashData Pointer to the data buffer to be hashed + @param HashDataLen Length of the data buffer to be hashed + @param AlgorithmId Identification of the Algorithm to use for the hashing operation + @param HashedDataLen Resultant length of the hashed data + @param HashedDataResult Resultant buffer of the hashed data + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR The command was unsuccessful. + @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. + @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small. + @retval EFI_NOT_FOUND The component was not running + +**/ typedef EFI_STATUS (EFIAPI *EFI_TCG_HASH_ALL) ( @@ -82,6 +116,25 @@ EFI_STATUS IN OUT UINT8 **HashedDataResult ); +/** + This service abstracts the capability to add an entry to the Event Log. + + @param This Indicates the calling context + @param TCGLogData Pointer to the start of the data buffer containing + the TCG_PCR_EVENT data structure. All fields in + this structure are properly filled by the caller. + @param EventNumber The event number of the event just logged + @param Flags Indicate additional flags. Only one flag has been + defined at this time, which is 0x01 and means the + extend operation should not be performed. All + other bits are reserved. + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR The command was unsuccessful. + @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. + @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small. + @retval EFI_NOT_FOUND The component was not running +**/ typedef EFI_STATUS (EFIAPI *EFI_TCG_LOG_EVENT) ( @@ -91,6 +144,21 @@ EFI_STATUS IN UINT32 Flags ); +/** + This service is a proxy for commands to the TPM. + + @param This Indicates the calling context + @param TpmInputParameterBlockSize Size of the TPM input parameter block + @param TpmInputParameterBlock Pointer to the TPM input parameter block + @param TpmOutputParameterBlockSize Size of the TPM output parameter block + @param TpmOutputParameterBlock Pointer to the TPM output parameter block + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR The command was unsuccessful. + @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. + @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small. + @retval EFI_NOT_FOUND The component was not running +**/ typedef EFI_STATUS (EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM) ( @@ -101,6 +169,29 @@ EFI_STATUS IN UINT8 *TpmOutputParameterBlock ); +/** + This service abstracts the capability to do a hash operation on a data buffer, extend a specific TPM PCR with the hash result, and add an entry to the Event Log + + @param This Indicates the calling context + @param HashData Physical address of the start of the data buffer + to be hashed, extended, and logged. + @param HashDataLen The length, in bytes, of the buffer referenced by HashData + @param AlgorithmId Identification of the Algorithm to use for the hashing operation + @param TCGLogData The physical address of the start of the data + buffer containing the TCG_PCR_EVENT data structure. + @param EventNumber The event number of the event just logged. + @param EventLogLastEntry Physical address of the first byte of the entry + just placed in the Event Log. If the Event Log was + empty when this function was called then this physical + address will be the same as the physical address of + the start of the Event Log. + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR The command was unsuccessful. + @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect. + @retval EFI_BUFFER_TOO_SMALL The receive buffer is too small. + @retval EFI_NOT_FOUND The component was not running +**/ typedef EFI_STATUS (EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT) ( @@ -113,6 +204,21 @@ EFI_STATUS OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry ); +/** + The EFI_TCG Protocol abstracts TCG activity. + + @param StatusCheck This service provides information on the TPM. + @param HashAll This service abstracts the capability to do a hash + operation on a data buffer. + @param LogEvent This service abstracts the capability to add + an entry to the Event Log. + @param PassThroughToTPM This service provides a pass-through capability + from the caller to the system¡¯s TPM. + @param HashLogExtendEvent This service abstracts the capability to do a hash + operation on a data buffer, extend a specific TPM PCR + with the hash result, and add an entry to the Event Log. + +**/ typedef struct _EFI_TCG_PROTOCOL { EFI_TCG_STATUS_CHECK StatusCheck; EFI_TCG_HASH_ALL HashAll; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index 7d6ce276ab..833b706847 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -99,10 +99,10 @@ EFI_STATUS @param Request A pointer to the USB device request that will be sent to the USB device. @param Direction Indicates the data direction. - @param Data A pointer to the buffer of data that will be transmitted to USB - device or received from USB device. @param Timeout Indicating the transfer should be completed within this time frame. The units are in milliseconds. + @param Data A pointer to the buffer of data that will be transmitted to USB + device or received from USB device. @param DataLength The size, in bytes, of the data buffer specified by Data. @param Status A pointer to the result of the USB transfer. diff --git a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c index acffa264fe..752594484c 100644 --- a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c +++ b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c @@ -1,23 +1,16 @@ -/*++ +/** @file + Provide generic extract guided section functions. -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php + Copyright (c) 2007, Intel Corporation
+ All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - - DxeExtractGuidedSectionLib.c - -Abstract: - - Provide generic extract guided section functions. - ---*/ +**/ #include diff --git a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c index a360d59d85..aa6c2fa33e 100644 --- a/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c +++ b/MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.c @@ -1,23 +1,16 @@ -/*++ +/** @file + Provide generic extract guided section functions. -Copyright (c) 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php + Copyright (c) 2007, Intel Corporation
+ All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - - PeiExtractGuidedSectionLib.c - -Abstract: - - Provide generic extract guided section functions. - ---*/ +**/ #include diff --git a/MdePkg/Library/PeiPiLib/PeiPiLib.c b/MdePkg/Library/PeiPiLib/PeiPiLib.c index d1e8611365..3030b1cd7f 100644 --- a/MdePkg/Library/PeiPiLib/PeiPiLib.c +++ b/MdePkg/Library/PeiPiLib/PeiPiLib.c @@ -32,6 +32,27 @@ CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = { NULL //ParentFileName; }; +/** + Install a EFI_PEI_FIRMWARE_VOLUME_INFO PPI to inform PEI core about the existence of a new Firmware Volume. + + The function allocate the EFI_PEI_PPI_DESCRIPTOR structure and update the fields accordingly to parameter passed + in and install the PPI. + + @param FvFormat Unique identifier of the format of the memory-mapped firmware volume. If NULL is specified, + EFI_FIRMWARE_FILE_SYSTEM2_GUID is used as the Format GUID. + @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to + process the volume. The format of this buffer is specific to the FvFormat. For + memory-mapped firmware volumes, this typically points to the first byte of the + firmware volume. + @param FvInfoSize Size of the data provided by FvInfo. For memory-mapped firmware volumes, this is + typically the size of the firmware volume. + @param ParentFvName, ParentFileName If the firmware volume originally came from a firmware file, then these point to the + parent firmware volume name and firmware volume file. If it did not originally come + from a firmware file, these should be NULL + + @retval VOID + +**/ VOID EFIAPI PiLibInstallFvInfoPpi ( diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c index 6eb21dd878..5ac34334d0 100644 --- a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c +++ b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c @@ -25,8 +25,10 @@ @param[in] ScsiIo A pointer to SCSI IO protocol. @param[in] Timeout The length of timeout period. - @param[out] SenseData A pointer to output sense data. - @param[out] SenseDataLength The length of output sense data. + @param[in out] SenseData A pointer to the sense data that + was generated by the execution of the SCSI Request Packet. + @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On + output, the number of bytes written to the SenseData buffer. @param[out] HostAdapterStatus The status of Host Adapter. @param[out] TargetStatus The status of the target. @@ -40,7 +42,7 @@ queued. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request Packet. - @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by the SCSI initiator(i.e., SCSI Host Controller). @@ -52,8 +54,8 @@ EFI_STATUS ScsiTestUnitReadyCommand ( IN EFI_SCSI_IO_PROTOCOL *ScsiIo, IN UINT64 Timeout, - OUT VOID *SenseData, - OUT UINT8 *SenseDataLength, + IN OUT VOID *SenseData, + IN OUT UINT8 *SenseDataLength, OUT UINT8 *HostAdapterStatus, OUT UINT8 *TargetStatus ) @@ -65,6 +67,13 @@ ScsiTestUnitReadyCommand ( EFI_STATUS Status; UINT8 Cdb[6]; + ASSERT (SenseDataLength != NULL); + ASSERT (HostAdapterStatus != NULL); + ASSERT (TargetStatus != NULL); + + if (ScsiIo == NULL) { + return EFI_INVALID_PARAMETER; + } ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); ZeroMem (Cdb, 6); @@ -103,10 +112,11 @@ ScsiTestUnitReadyCommand ( @param[in] ScsiIo SCSI IO Protocol to use @param[in] Timeout The length of timeout period. @param[out] SenseData A pointer to output sense data. - @param[in,out] SenseDataLength The length of output sense data. + @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On + output, the number of bytes written to the SenseData buffer. @param[out] HostAdapterStatus The status of Host Adapter. @param[out] TargetStatus The status of the target. - @param[in,out] InquirydataBuffer A pointer to inquiry data buffer. + @param[in] InquirydataBuffer A pointer to inquiry data buffer. @param[in,out] InquiryDataLength The length of inquiry data buffer. @param[in] EnableVitalProductData Boolean to enable Vital Product Data. @@ -120,7 +130,7 @@ ScsiTestUnitReadyCommand ( queued. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request Packet. - @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by the SCSI initiator(i.e., SCSI Host Controller). @@ -136,7 +146,7 @@ ScsiInquiryCommand ( IN OUT UINT8 *SenseDataLength, OUT UINT8 *HostAdapterStatus, OUT UINT8 *TargetStatus, - IN OUT VOID *InquiryDataBuffer, + IN VOID *InquiryDataBuffer, IN OUT UINT32 *InquiryDataLength, IN BOOLEAN EnableVitalProductData ) @@ -148,6 +158,15 @@ ScsiInquiryCommand ( EFI_STATUS Status; UINT8 Cdb[6]; + ASSERT (SenseDataLength != NULL); + ASSERT (HostAdapterStatus != NULL); + ASSERT (TargetStatus != NULL); + ASSERT (InquiryDataLength != NULL); + + if (ScsiIo == NULL) { + return EFI_INVALID_PARAMETER; + } + ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); ZeroMem (Cdb, 6); @@ -192,7 +211,8 @@ ScsiInquiryCommand ( @param[in] ScsiIo A pointer to SCSI IO protocol. @param[in] Timeout The length of timeout period. @param[out] SenseData A pointer to output sense data. - @param[in,out] SenseDataLength The length of output sense data. + @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On + output, the number of bytes written to the SenseData buffer. @param[out] HostAdapterStatus The status of Host Adapter. @param[out] TargetStatus The status of the target. @param[in] DataBuffer A pointer to input data buffer. @@ -211,7 +231,7 @@ ScsiInquiryCommand ( queued. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request Packet. - @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by the SCSI initiator(i.e., SCSI Host Controller). @@ -241,6 +261,15 @@ ScsiModeSense10Command ( EFI_STATUS Status; UINT8 Cdb[10]; + ASSERT (SenseDataLength != NULL); + ASSERT (HostAdapterStatus != NULL); + ASSERT (TargetStatus != NULL); + ASSERT (DataLength != NULL); + + if (ScsiIo == NULL) { + return EFI_INVALID_PARAMETER; + } + ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); ZeroMem (Cdb, 10); @@ -278,19 +307,14 @@ ScsiModeSense10Command ( /** Function to submit SCSI request sense command. - ScsiIo - A pointer to SCSI IO protocol. - Timeout - The length of timeout period. - SenseData - A pointer to output sense data. - SenseDataLength - The length of output sense data. - HostAdapterStatus - The status of Host Adapter. - TargetStatus - The status of the target. - @param[in] ScsiIo SCSI IO Protocol to use - @param[in] Timeout TODO: - @param[out] SenseData TODO: - @param[in,out] SenseDataLength TODO: - @param[out] HostAdapterStatus TODO: - @param[out] TargetStatus TODO: + @param[in] ScsiIo A pointer to SCSI IO protocol. + @param[in] Timeout The length of timeout period. + @param[in] SenseData A pointer to output sense data. + @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On + output, the number of bytes written to the SenseData buffer. + @param[out] HostAdapterStatus The status of Host Adapter. + @param[out] TargetStatus The status of the target. @retval EFI_SUCCESS Valid data returned @retval EFI_SUCCESS The status of the unit is tested successfully. @@ -303,7 +327,7 @@ ScsiModeSense10Command ( queued. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request Packet. - @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by the SCSI initiator(i.e., SCSI Host Controller). @@ -328,6 +352,14 @@ ScsiRequestSenseCommand ( EFI_STATUS Status; UINT8 Cdb[6]; + ASSERT (SenseDataLength != NULL); + ASSERT (HostAdapterStatus != NULL); + ASSERT (TargetStatus != NULL); + + if (ScsiIo == NULL) { + return EFI_INVALID_PARAMETER; + } + ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); ZeroMem (Cdb, 6); @@ -366,7 +398,8 @@ ScsiRequestSenseCommand ( @param[in] ScsiIo A pointer to SCSI IO protocol. @param[in] Timeout The length of timeout period. @param[out] SenseData A pointer to output sense data. - @param[in,out] SenseDataLength The length of output sense data. + @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On + output, the number of bytes written to the SenseData buffer. @param[out] HostAdapterStatus The status of Host Adapter. @param[out] TargetStatus The status of the target. @param[out] DataBuffer A pointer to a data buffer. @@ -383,7 +416,7 @@ ScsiRequestSenseCommand ( queued. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request Packet. - @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by the SCSI initiator(i.e., SCSI Host Controller). @@ -411,6 +444,15 @@ ScsiReadCapacityCommand ( EFI_STATUS Status; UINT8 Cdb[10]; + ASSERT (SenseDataLength != NULL); + ASSERT (HostAdapterStatus != NULL); + ASSERT (TargetStatus != NULL); + ASSERT (DataLength != NULL); + + if (ScsiIo == NULL) { + return EFI_INVALID_PARAMETER; + } + ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); ZeroMem (Cdb, 10); @@ -457,7 +499,8 @@ ScsiReadCapacityCommand ( @param[in] ScsiIo A pointer to SCSI IO protocol. @param[in] Timeout The length of timeout period. @param[out] SenseData A pointer to output sense data. - @param[in,out] SenseDataLength The length of output sense data. + @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On + output, the number of bytes written to the SenseData buffer. @param[out] HostAdapterStatus The status of Host Adapter. @param[out] TargetStatus The status of the target. @param[out] DataBuffer Read 10 command data. @@ -475,7 +518,7 @@ ScsiReadCapacityCommand ( queued. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request Packet. - @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by the SCSI initiator(i.e., SCSI Host Controller). @@ -504,6 +547,15 @@ ScsiRead10Command ( EFI_STATUS Status; UINT8 Cdb[10]; + ASSERT (SenseDataLength != NULL); + ASSERT (HostAdapterStatus != NULL); + ASSERT (TargetStatus != NULL); + ASSERT (DataLength != NULL); + + if (ScsiIo == NULL) { + return EFI_INVALID_PARAMETER; + } + ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); ZeroMem (Cdb, 10); @@ -548,7 +600,8 @@ ScsiRead10Command ( @param[in] ScsiIo SCSI IO Protocol to use @param[in] Timeout The length of timeout period. @param[out] SenseData A pointer to output sense data. - @param[in,out] SenseDataLength The length of output sense data. + @param[in out] SenseDataLength On input, the length in bytes of the SenseData buffer. On + output, the number of bytes written to the SenseData buffer. @param[out] HostAdapterStatus The status of Host Adapter. @param[out] TargetStatus The status of the target. @param[out] DataBuffer A pointer to a data buffer. @@ -566,7 +619,7 @@ ScsiRead10Command ( queued. @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request Packet. - @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid. + @retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid, or ScsiIo is NULL. @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported by the SCSI initiator(i.e., SCSI Host Controller). @@ -595,6 +648,15 @@ ScsiWrite10Command ( EFI_STATUS Status; UINT8 Cdb[10]; + ASSERT (SenseDataLength != NULL); + ASSERT (HostAdapterStatus != NULL); + ASSERT (TargetStatus != NULL); + ASSERT (DataLength != NULL); + + if (ScsiIo == NULL) { + return EFI_INVALID_PARAMETER; + } + ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); ZeroMem (Cdb, 10); diff --git a/MdePkg/Library/UefiUsbLib/Hid.c b/MdePkg/Library/UefiUsbLib/Hid.c index 7c0ee14284..9391574fe0 100644 --- a/MdePkg/Library/UefiUsbLib/Hid.c +++ b/MdePkg/Library/UefiUsbLib/Hid.c @@ -38,6 +38,10 @@ UsbGetHidDescriptor ( UINT32 Status; EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; + + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } Request.RequestType = 0x81; Request.Request = 0x06; @@ -88,6 +92,9 @@ UsbGetReportDescriptor ( EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } // // Fill Device request packet // @@ -137,6 +144,9 @@ UsbGetProtocolRequest ( EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } // // Fill Device request packet // @@ -187,6 +197,9 @@ UsbSetProtocolRequest ( EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } // // Fill Device request packet // @@ -238,6 +251,9 @@ UsbSetIdleRequest ( EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } // // Fill Device request packet // @@ -287,7 +303,10 @@ UsbGetIdleRequest ( UINT32 Status; EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; - + + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } // // Fill Device request packet // @@ -344,6 +363,9 @@ UsbSetReportRequest ( EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } // // Fill Device request packet // @@ -399,6 +421,9 @@ UsbGetReportRequest ( EFI_STATUS Result; EFI_USB_DEVICE_REQUEST Request; + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } // // Fill Device request packet // diff --git a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c index 90b0fd3ea5..a1d61d52bf 100644 --- a/MdePkg/Library/UefiUsbLib/UsbDxeLib.c +++ b/MdePkg/Library/UefiUsbLib/UsbDxeLib.c @@ -527,6 +527,10 @@ UsbClearEndpointHalt ( EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; UINT8 Index; + if (UsbIo == NULL) { + return EFI_INVALID_PARAMETER; + } + ZeroMem (&EndpointDescriptor, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR)); // // First seach the endpoint descriptor for that endpoint addr