[coreboot-gerrit] New patch to review for coreboot: de8fb46 Add EHCI debug receive part.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Fri Jun 7 02:07:15 CEST 2013


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3407

-gerrit

commit de8fb4676cde367288173fd5679f59d218715c32
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Fri Jun 7 02:06:39 2013 +0200

    Add EHCI debug receive part.
    
    Primarily of interest for serialice.
    
    Change-Id: I3e31941caa73e61321d3011d937eb53e768c9548
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 src/include/usbdebug.h |  1 +
 src/lib/usbdebug.c     | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/src/include/usbdebug.h b/src/include/usbdebug.h
index c3b3437..09152cd 100644
--- a/src/include/usbdebug.h
+++ b/src/include/usbdebug.h
@@ -45,4 +45,5 @@ int early_usbdebug_init(void);
 void usbdebug_tx_byte(struct ehci_debug_info *info, unsigned char data);
 void usbdebug_tx_flush(struct ehci_debug_info *info);
 int usbdebug_init(unsigned ehci_bar, unsigned offset, struct ehci_debug_info *info);
+unsigned char usbdebug_rx_byte(struct ehci_debug_info *dbg_info);
 #endif
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index 24d7967..974aba4 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -607,3 +607,25 @@ void usbdebug_tx_flush(struct ehci_debug_info *dbg_info)
 		dbg_info->bufidx = 0;
 	}
 }
+
+unsigned char usbdebug_rx_byte(struct ehci_debug_info *dbg_info)
+{
+	if (!dbg_info) {
+		/* "Find" dbg_info structure in Cache */
+		dbg_info = (struct ehci_debug_info *)
+		    (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
+	}
+
+	if (dbg_info->ehci_debug) {
+		unsigned char c = 0xff;
+		u32 pids;
+		usbdebug_tx_flush (dbg_info);
+		pids = read32((unsigned long)&((struct ehci_dbg_port *) dbg_info->ehci_debug)->pids);
+		while (dbgp_bulk_read_x (dbg_info, &c, 1) <= 0);
+		write32((unsigned long)&((struct ehci_dbg_port *) dbg_info->ehci_debug)->pids, pids);
+		usbdebug_tx_byte(dbg_info, c);
+		usbdebug_tx_flush (dbg_info);
+		return c;
+	}
+	return 0xff;
+}



More information about the coreboot-gerrit mailing list