@@ -33,7 +33,7 @@
#include <asm/system.h>
/* uncomment to have dbc_uart_dump() debug function */
-/* #define DBC_DEBUG 1 */
+#define DBC_DEBUG 1
#define DBC_POLL_INTERVAL 100 /* us */
@@ -264,6 +264,10 @@ struct dbc {
uint16_t pci_cr;
};
+#ifdef DBC_DEBUG
+static void dbc_uart_dump(void);
+#endif
+
static void *dbc_sys_map_xhc(uint64_t phys, size_t size)
{
size_t i;
@@ -900,13 +904,23 @@ static void dbc_reset_debug_port(struct dbc *dbc)
static void dbc_enable_dbc(struct dbc *dbc)
{
struct dbc_reg *reg = dbc->dbc_reg;
+ unsigned long timeout = 10000000;
wmb();
writel(readl(®->ctrl) | (1U << DBC_CTRL_DCE), ®->ctrl);
wmb();
while ( (readl(®->ctrl) & (1U << DBC_CTRL_DCE)) == 0 )
+ {
cpu_relax();
+ if (!--timeout)
+ break;
+ }
+ if (!timeout)
+ {
+ dbc_error("timeout 1\n");
+ dbc_uart_dump();
+ }
/* reset ports on initial open, to force re-enumerating by the host */
if ( !dbc->open )
@@ -916,8 +930,18 @@ static void dbc_enable_dbc(struct dbc *dbc)
writel(readl(®->portsc) | (1U << DBC_PSC_PED), ®->portsc);
wmb();
+ timeout = 1000000;
while ( (readl(®->ctrl) & (1U << DBC_CTRL_DCR)) == 0 )
+ {
cpu_relax();
+ if (!--timeout)
+ break;
+ }
+ if (!timeout)
+ {
+ dbc_error("timeout 2\n");
+ dbc_uart_dump();
+ }
}
static void dbc_disable_dbc(struct dbc *dbc)
Debug patch that shows xhci state after some arbitrary (and not very smart) timeout. DO NOT MERGE. The timeout doesn't actually prevent registering the console. Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> --- xen/drivers/char/xhci-dbc.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)