Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/26763 )
Change subject: sb/intel/common: More SMBus block_cmd_loop()
......................................................................
sb/intel/common: More SMBus block_cmd_loop()
Setup to different block transactions are similar
enough to have common place to call execute_command()
in.
Change-Id: I671fed280f47e6bc673eb7506f09ed6ed36d2804
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Reviewed-on: https://review.coreboot.org/c/26763
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M src/southbridge/intel/common/smbus.c
1 file changed, 24 insertions(+), 30 deletions(-)
Approvals:
build bot (Jenkins): Verified
Arthur Heymans: Looks good to me, approved
diff --git a/src/southbridge/intel/common/smbus.c b/src/southbridge/intel/common/smbus.c
index 12fb9ea..fd8b6aa 100644
--- a/src/southbridge/intel/common/smbus.c
+++ b/src/southbridge/intel/common/smbus.c
@@ -239,6 +239,27 @@
if (flags == (BLOCK_WRITE | BLOCK_I2C))
return SMBUS_ERROR;
+ /* Set number of bytes to transfer. */
+ /* Reset number of bytes to transfer so we notice later it
+ * was really updated with the transaction. */
+ if (!sw_drives_nak) {
+ if (is_write_cmd)
+ outb(max_bytes, smbus_base + SMBHSTDAT0);
+ else
+ outb(0, smbus_base + SMBHSTDAT0);
+ }
+
+ /* Send first byte from buffer, bytes_sent increments after
+ * hardware acknowledges it.
+ */
+ if (is_write_cmd)
+ outb(*buf++, smbus_base + SMBBLKDAT);
+
+ /* Start the command */
+ ret = execute_command(smbus_base);
+ if (ret < 0)
+ return ret;
+
/* Poll for transaction completion */
do {
status = inb(smbus_base + SMBHSTSTAT);
@@ -301,16 +322,7 @@
/* Set the command/address... */
outb(cmd, smbus_base + SMBHSTCMD);
- /* Reset number of bytes to transfer so we notice later it
- * was really updated with the transaction. */
- outb(0, smbus_base + SMBHSTDAT0);
-
- /* Start the command */
- ret = execute_command(smbus_base);
- if (ret < 0)
- return ret;
-
- /* Poll for transaction completion */
+ /* Execute block transaction. */
ret = block_cmd_loop(smbus_base, buf, max_bytes, BLOCK_READ);
if (ret < 0)
return ret;
@@ -339,20 +351,7 @@
/* Set the command/address... */
outb(cmd, smbus_base + SMBHSTCMD);
- /* Set number of bytes to transfer. */
- outb(bytes, smbus_base + SMBHSTDAT0);
-
- /* Send first byte from buffer, bytes_sent increments after
- * hardware acknowledges it.
- */
- outb(*buf++, smbus_base + SMBBLKDAT);
-
- /* Start the command */
- ret = execute_command(smbus_base);
- if (ret < 0)
- return ret;
-
- /* Poll for transaction completion */
+ /* Execute block transaction. */
ret = block_cmd_loop(smbus_base, (u8 *)buf, bytes, BLOCK_WRITE);
if (ret < 0)
return ret;
@@ -383,12 +382,7 @@
/* device offset */
outb(offset, smbus_base + SMBHSTDAT1);
- /* Start the command */
- ret = execute_command(smbus_base);
- if (ret < 0)
- return ret;
-
- /* Poll for transaction completion */
+ /* Execute block transaction. */
ret = block_cmd_loop(smbus_base, buf, bytes, BLOCK_READ | BLOCK_I2C);
if (ret < 0)
return ret;
--
To view, visit https://review.coreboot.org/c/coreboot/+/26763
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I671fed280f47e6bc673eb7506f09ed6ed36d2804
Gerrit-Change-Number: 26763
Gerrit-PatchSet: 7
Gerrit-Owner: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Philipp Hug has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/29494 )
Change subject: riscv: add support to select the privilege level of the payload running
......................................................................
Patch Set 28:
I like the refactoring done in this change, but I would not add Kconfigs for the privilege level. This should be determined by the type of payload.
Can you drop the Kconfig changes here, leave the refactoring and call the ramstage/rampayload in m-mode and payload in s-mode by default.
We should execute bbl as a rampayload.
--
To view, visit https://review.coreboot.org/c/coreboot/+/29494
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I96961246cd257b63cf167238aa0cf6e65272b951
Gerrit-Change-Number: 29494
Gerrit-PatchSet: 28
Gerrit-Owner: Xiang Wang <wxjstz(a)126.com>
Gerrit-Reviewer: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Philipp Hug <philipp(a)hug.cx>
Gerrit-Reviewer: Shawn C <citypw(a)gmail.com>
Gerrit-Reviewer: Xiang Wang <wxjstz(a)126.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Reviewer: ron minnich <rminnich(a)gmail.com>
Gerrit-Comment-Date: Thu, 24 Jan 2019 11:44:22 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment