Per PI 1.3 spec, when Reserved bit set in the SlaveAddress parameter, EFI_NOT_FOUND should be returned in EFI_I2C_HOST_PROTOCOL.QueueRequest().

Signed-off-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Leahy Leroy P <leroy.p.leahy@intel.com>
Reviewed-by: Lin Jie <jie.lin@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14952 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Elvin Li 2013-12-10 01:42:56 +00:00 committed by li-elvin
parent 3520e03f3d
commit 62eeb52af7
1 changed files with 22 additions and 0 deletions

View File

@ -930,6 +930,7 @@ I2cHostQueueRequest (
I2C_HOST_CONTEXT *I2cHostContext;
BOOLEAN FirstRequest;
UINTN RequestPacketSize;
UINTN StartBit;
SyncEvent = NULL;
FirstRequest = FALSE;
@ -938,6 +939,27 @@ I2cHostQueueRequest (
if (RequestPacket == NULL) {
return EFI_INVALID_PARAMETER;
}
if ((SlaveAddress & I2C_ADDRESSING_10_BIT) != 0) {
//
// 10-bit address, bits 0-9 are used for 10-bit I2C slave addresses,
// bits 10-30 are reserved bits and must be zero
//
StartBit = 10;
} else {
//
// 7-bit address, Bits 0-6 are used for 7-bit I2C slave addresses,
// bits 7-30 are reserved bits and must be zero
//
StartBit = 7;
}
if (BitFieldRead32 ((UINT32)SlaveAddress, StartBit, 30) != 0) {
//
// Reserved bit set in the SlaveAddress parameter
//
return EFI_NOT_FOUND;
}
I2cHostContext = I2C_HOST_CONTEXT_FROM_PROTOCOL (This);