Revision: 14952 http://sourceforge.net/p/edk2/code/14952 Author: li-elvin Date: 2013-12-10 01:42:56 +0000 (Tue, 10 Dec 2013) Log Message: ----------- 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...@intel.com> Reviewed-by: Leahy Leroy P <leroy.p.le...@intel.com> Reviewed-by: Lin Jie <jie....@intel.com> Modified Paths: -------------- trunk/edk2/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c Modified: trunk/edk2/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c =================================================================== --- trunk/edk2/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c 2013-12-09 23:00:21 UTC (rev 14951) +++ trunk/edk2/MdeModulePkg/Bus/I2c/I2cDxe/I2cHost.c 2013-12-10 01:42:56 UTC (rev 14952) @@ -930,6 +930,7 @@ I2C_HOST_CONTEXT *I2cHostContext; BOOLEAN FirstRequest; UINTN RequestPacketSize; + UINTN StartBit; SyncEvent = NULL; FirstRequest = FALSE; @@ -938,7 +939,28 @@ 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); if (Event == NULL) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ edk2-commits mailing list edk2-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-commits