[coreboot-gerrit] New patch to review for coreboot: mec: Correct the access mode for short payloads

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Mon Jul 20 22:29:42 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11012

-gerrit

commit fb7301e07627da965c55384c76b1817ecdfc6c9f
Author: Jagadish Krishnamoorthy <jagadish.krishnamoorthy at intel.com>
Date:   Sat Jul 18 11:46:37 2015 -0700

    mec: Correct the access mode for short payloads
    
    If the Host Command payload is less than 4 bytes
    and is word aligned then the payload was not transferred at all.
    EC reads the old packet and CRC mismatch occurs.
    
    In this issue, the HC command packet
    consisting of EC_CMD_REBOOT_EC as command and EC_REBOOT_COLD
    as payload encountered the same problem as above.
    Hence select byte access mode for shorter payloads.
    
    BRANCH=None
    BUG=chrome-os-partner:42396
    TEST=System should boot after
    chromeos-firmwareupdate
    
    Change-Id: I22bdb739108d31b592c20247be69c198d617d359
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: 8a43d2636b1bbfbac0384e1ea5e8853a7bd87a7f
    Original-Change-Id: I5572093436f4f4a0fc337efa943753ab4642d8e4
    Original-Signed-off-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy at intel.com>
    Original-Signed-off-by: Icarus Sparry <icarus.w.sparry at intel.com>
    Original-Reviewed-on: https://chromium-review.googlesource.com/286537
    Original-Reviewed-by: Shawn N <shawnn at chromium.org>
---
 src/ec/google/chromeec/ec_mec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ec/google/chromeec/ec_mec.c b/src/ec/google/chromeec/ec_mec.c
index 8a3b852..5d1ec3c 100644
--- a/src/ec/google/chromeec/ec_mec.c
+++ b/src/ec/google/chromeec/ec_mec.c
@@ -85,7 +85,7 @@ void mec_io_bytes(int write, u16 port, unsigned int length, u8 *buf, u8 *csum)
 	 * Long access cannot be used on misaligned data since reading B0 loads
 	 * the data register and writing B3 flushes it.
 	 */
-	if (port & 0x3)
+	if ((port & 0x3) || (length < 4))
 		access_mode = ACCESS_TYPE_BYTE;
 	else
 		access_mode = ACCESS_TYPE_LONG_AUTO_INCREMENT;



More information about the coreboot-gerrit mailing list