summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus
diff options
context:
space:
mode:
authorElvin Li <elvin.li@intel.com>2013-12-10 01:42:56 +0000
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2013-12-10 01:42:56 +0000
commit62eeb52af7efe656f518baf59555e29c15bfa3be (patch)
tree726c028b0ea7467d35ee6ea10a4e7a93e9f775c4 /MdeModulePkg/Bus
parent3520e03f3dbfeeda7140933129027589e893413e (diff)
downloadedk2-62eeb52af7efe656f518baf59555e29c15bfa3be.zip
edk2-62eeb52af7efe656f518baf59555e29c15bfa3be.tar.gz
edk2-62eeb52af7efe656f518baf59555e29c15bfa3be.tar.bz2
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
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r--MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c b/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c
index e153a4d..392ca2a 100644
--- a/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c
+++ b/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c
@@ -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);