usb: early: add support for early printk through USB3 debug port
Subsystems (4)
v2 cover usb: early: add support for early printk through USB3 debug port
xHCI debug capability (DbC) is an optional but standalone functionality provided by an xHCI host controller. With DbC hardware initialized, the system will present a debug device through the USB3 debug port (normally the first USB3 port). The debug device is fully compliant with the USB framework and provides the equivalent of a very high performance (USB3) full-duplex serial link between the debug host and target. The DbC functionality is independent of xHCI host. There isn't any precondition from xHCI host side for DbC to work.
This patch set adds support for early printk functionality through a USB3 debug port by 1) initializing and enabling the DbC hardware during early boot; 2) registering a boot console to the system so that early printk messages can go through the USB3 debug port. It also includes some lines of changes in usb_debug driver so that it can be bound when a USB3 debug device is enumerated.
This code is designed to be used only for kernel debugging when machine crashes very early before the console code is initialized. It makes the life of kernel debugging easier when people work with a modern machine without any legacy serial ports.
---
Change log:v1->v2:
- Refactor the duplicate code in xdbc_early_start() and xdbc_handle_external_reset().
- Free resources when hardware not used any more.
- Refine the user guide document.
Lu Baolu (4):
usb: dbc: early driver for xhci debug capability
x86: add support for earlyprintk via USB3 debug port
usb: serial: usb_debug: add support for dbc debug device
usb: doc: add document for USB3 debug port usage
Documentation/kernel-parameters.txt | 1 + Documentation/usb/usb3-debug-port.txt | 87 +++ arch/x86/Kconfig.debug | 14 + arch/x86/kernel/early_printk.c | 5 + arch/x86/kernel/setup.c | 7 + drivers/usb/Kconfig | 3 + drivers/usb/Makefile | 2 +- drivers/usb/early/Makefile | 1 + drivers/usb/early/xhci-dbc.c | 1097 +++++++++++++++++++++++++++++++++ drivers/usb/early/xhci-dbc.h | 206 +++++++ drivers/usb/serial/usb_debug.c | 28 +- include/linux/usb/xhci-dbgp.h | 22 + 12 files changed, 1469 insertions(+), 4 deletions(-) create mode 100644 Documentation/usb/usb3-debug-port.txt create mode 100644 drivers/usb/early/xhci-dbc.c create mode 100644 drivers/usb/early/xhci-dbc.h create mode 100644 include/linux/usb/xhci-dbgp.h
Signature · 1 line
2.1.4
PATCH RESEND v2 1/4 usb: dbc: early driver for xhci debug capability
xHCI debug capability (DbC) is an optional but standalone functionality provided by an xHCI host controller. Software learns this capability by walking through the extended capability list of the host. xHCI specification describes DbC in section 7.6.
This patch introduces the code to probe and initialize the debug capability hardware during early boot. With hardware initialized, the debug target (system on which this code is running) will present a debug device through the debug port (normally the first USB3 port). The debug device is fully compliant with the USB framework and provides the equivalent of a very high performance (USB3) full-duplex serial link between the debug host and target. The DbC functionality is independent of xHCI host. There isn't any precondition from xHCI host side for DbC to work.
This patch also includes bulk out and bulk in interfaces. These interfaces could be used to implement early printk bootconsole or hook to various system debuggers.
This code is designed to be only used for kernel debugging when machine crashes very early before the console code is initialized. For normal operation it is not recommended.
--- arch/x86/Kconfig.debug | 14 + drivers/usb/Kconfig | 3 + drivers/usb/Makefile | 2 +- drivers/usb/early/Makefile | 1 + drivers/usb/early/xhci-dbc.c | 1097 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/early/xhci-dbc.h | 206 ++++++++ include/linux/usb/xhci-dbgp.h | 22 + 7 files changed, 1344 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/early/xhci-dbc.c create mode 100644 drivers/usb/early/xhci-dbc.h create mode 100644 include/linux/usb/xhci-dbgp.h
arch/x86/Kconfig.debug +14 -0
@@ -29,6 +29,7 @@ config EARLY_PRINTK config EARLY_PRINTK_DBGP bool "Early printk via EHCI debug port" depends on EARLY_PRINTK && PCI + select USB_EARLY_PRINTK ---help--- Write kernel log output directly into the EHCI debug port.
@@ -48,6 +49,19 @@ config EARLY_PRINTK_EFI This is useful for kernel debugging when your machine crashes very early before the console code is initialized. +config EARLY_PRINTK_XDBC + bool "Early printk via xHCI debug port" + depends on EARLY_PRINTK && PCI + select USB_EARLY_PRINTK + ---help--- + Write kernel log output directly into the xHCI debug port. + + This is useful for kernel debugging when your machine crashes very + early before the console code is initialized. For normal operation + it is not recommended because it looks ugly and doesn't cooperate + with klogd/syslogd or the X server. You should normally N here, + unless you want to debug such a crash. + config X86_PTDUMP_CORE def_bool n
drivers/usb/Kconfig +3 -0
@@ -19,6 +19,9 @@ config USB_EHCI_BIG_ENDIAN_MMIO config USB_EHCI_BIG_ENDIAN_DESC bool +config USB_EARLY_PRINTK + bool + menuconfig USB_SUPPORT bool "USB support" depends on HAS_IOMEM
drivers/usb/Makefile +1 -1
@@ -48,7 +48,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/ obj-$(CONFIG_USB_SERIAL) += serial/ obj-$(CONFIG_USB) += misc/ -obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ +obj-$(CONFIG_USB_EARLY_PRINTK) += early/ obj-$(CONFIG_USB_ATM) += atm/ obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
drivers/usb/early/Makefile +1 -0
@@ -3,3 +3,4 @@ # obj-$(CONFIG_EARLY_PRINTK_DBGP) += ehci-dbgp.o +obj-$(CONFIG_EARLY_PRINTK_XDBC) += xhci-dbc.o
drivers/usb/early/xhci-dbc.c new file +1097 -0
1,097 lines not on this page · raw message
drivers/usb/early/xhci-dbc.h new file +206 -0
206 lines not on this page · raw message
include/linux/usb/xhci-dbgp.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Standalone xHCI debug capability driver +* +* Copyright (C) 2016 Intel Corporation +* +* Author: Lu Baolu <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __LINUX_XHCI_DBGP_H +#define __LINUX_XHCI_DBGP_H + +#ifdef CONFIG_EARLY_PRINTK_XDBC +int __init early_xdbc_parse_parameter (char *s); +int __init early_xdbc_setup_hardware (void ); +void __init early_xdbc_register_console (void ); +#endif /* CONFIG_EARLY_PRINTK_XDBC */ + +#endif /* __LINUX_XHCI_DBGP_H */
Signature · 1 line
2.1.4
Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability
drivers/usb/early/xhci-dbc.c line 930
Quoted 8 lines · Lu Baolu
+++
b/drivers/usb/early/xhci-dbc.cdrivers/usb/early/xhci-dbc.c new file +6
-0+static int xdbc_bulk_write (const char *bytes,int size) +{ +unsigned long flags; +int ret, timeout =0 ; + +spin_lock_irqsave (&xdbc.lock, flags);
Yikes!!
So how is this supposed to work from NMI context and the like?
(also, at the very least, that should be a raw_spinlock_t)
What do you need the spinlock for? Afaict this is a 'simple' polling event handling loop on MMIO, right?
All we really need to guarantee is that there's only a single CPU trying to do that at any one time.
Wouldn't something like:
https://marc.info/?l=linux-kernel&m=147681099108509&w=2
already take care of that? Then you can drop the lock and things will work 'nested'.
Quoted 100 lines
drivers/usb/early/xhci-dbc.c new file +100
-0+ +xdbc_handle_events (); + +/* Check completion of the previous request. */ +while (xdbc.flags &XDBC_FLAGS_OUT_PROCESS ) { +if (timeout >1000000 ) +break ; + +spin_unlock_irqrestore (&xdbc.lock, flags); +xdbc_delay (100 ); +spin_lock_irqsave (&xdbc.lock, flags); + timeout +=100 ; + +xdbc_handle_events (); + } + +if (xdbc.flags &XDBC_FLAGS_OUT_PROCESS ) { +spin_unlock_irqrestore (&xdbc.lock, flags); + +/* +* Oops, hardware wasn't able to complete the +* previous transfer. +*/ +xdbc_trace ("oops: previous transfer not completed yet\n" ); + +return -ETIMEDOUT ; + } + + ret =xdbc_bulk_transfer ((void *)bytes, size, false); + +spin_unlock_irqrestore (&xdbc.lock, flags); + +return ret; +} + +static void early_xdbc_write (struct console *con,const char *str,u32 n) +{ +int chunk, ret; +static char buf[XDBC_MAX_PACKET ]; +int use_cr =0 ; + +if (!xdbc.xdbc_reg) +return ; +memset (buf,0 ,XDBC_MAX_PACKET ); +while (n >0 ) { +for (chunk =0 ; chunk <XDBC_MAX_PACKET && n >0 ; + str++, chunk++, n--) { +if (!use_cr && *str =='\n' ) { + use_cr =1 ; + buf[chunk] ='\r' ; + str--; + n++; +continue ; + } +if (use_cr) + use_cr =0 ; + buf[chunk] = *str; + } +if (chunk >0 ) { + ret =xdbc_bulk_write (buf, chunk); +if (ret <0 ) +break ; + } + } +} + +static struct console early_xdbc_console = { + .name ="earlyxdbc" , + .write = early_xdbc_write, + .flags =CON_PRINTBUFFER , + .index =-1 , +}; + +void __init early_xdbc_register_console (void ) +{ +if (early_console) +return ; + + early_console = &early_xdbc_console; +if (early_console_keep) + early_console->flags &= ~CON_BOOT ; +else + early_console->flags |=CON_BOOT ; +register_console (early_console); +} + +static void xdbc_scrub_function (struct work_struct *work) +{ +unsigned long flags; + +spin_lock_irqsave (&xdbc.lock, flags); + +/* +* DbC is running, check the event ring and +* handle the events. +*/ +if (readl (&xdbc.xdbc_reg->control) &CTRL_DRC ) +xdbc_handle_events (); + +/*
drivers/usb/early/xhci-dbc.c line 1040
Quoted 10 lines
drivers/usb/early/xhci-dbc.c new file +10
-0+* External reset happened. Need to restart the +* debugging hardware. +*/ +if (unlikely (!(readl (&xdbc.xdbc_reg->control) &CTRL_DCE ))) +xdbc_handle_external_reset (); + +spin_unlock_irqrestore (&xdbc.lock, flags); + +queue_delayed_work (xdbc_wq, &xdbc.scrub,usecs_to_jiffies (100 )); +}
Excuse my total lack of USB knowledge, but WTH does this do and what do we need it for?
Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability
Hi Peter,
Thanks for your comments.
Quoted 10 lines · Peter Zijlstra
drivers/usb/early/xhci-dbc.c line 930
Quoted 7 lines · Lu Baolu
+++
b/drivers/usb/early/xhci-dbc.cdrivers/usb/early/xhci-dbc.c new file +6
-0+static int xdbc_bulk_write (const char *bytes,int size) +{ +unsigned long flags; +int ret, timeout =0 ; + +spin_lock_irqsave (&xdbc.lock, flags);Yikes!!
Quoted 3 lines
So how is this supposed to work from NMI context and the like?
(also, at the very least, that should be a
raw_spinlock_t)
Totally agree. We should put it as a raw_spinlock_t().
Quoted 3 lines
What do you need the spinlock for? Afaict this is a 'simple' polling event handling loop on MMIO, right?
Not only for polling registers in MMIO, but also for handling the events in the event ring. The event ring is a memory block, which is allocated during hardware initialization and saved in a register in MMIO.
There is a single event ring for all events (read completion, write completion, port status change and transfer errors etc). The debugging hardware doesn't support interrupt, so software has to poll the event ring whenever it needs to.
Event ring polling happens at least in write interface (to make sure the previous transfer has been completed), and a worker (to check the read events and other things). That's the reason why I need a spin_lock here.
Quoted 115 lines
All we really need to guarantee is that there's only a single CPU trying to do that at any one time.
Wouldn't something like:
https://marc.info/?l=linux-kernel&m=147681099108509&w=2
already take care of that? Then you can drop the lock and things will work 'nested'.
Quoted 104 lines
drivers/usb/early/xhci-dbc.c new file +104
-0+ +xdbc_handle_events (); + +/* Check completion of the previous request. */ +while (xdbc.flags &XDBC_FLAGS_OUT_PROCESS ) { +if (timeout >1000000 ) +break ; + +spin_unlock_irqrestore (&xdbc.lock, flags); +xdbc_delay (100 ); +spin_lock_irqsave (&xdbc.lock, flags); + timeout +=100 ; + +xdbc_handle_events (); + } + +if (xdbc.flags &XDBC_FLAGS_OUT_PROCESS ) { +spin_unlock_irqrestore (&xdbc.lock, flags); + +/* +* Oops, hardware wasn't able to complete the +* previous transfer. +*/ +xdbc_trace ("oops: previous transfer not completed yet\n" ); + +return -ETIMEDOUT ; + } + + ret =xdbc_bulk_transfer ((void *)bytes, size, false); + +spin_unlock_irqrestore (&xdbc.lock, flags); + +return ret; +} + +static void early_xdbc_write (struct console *con,const char *str,u32 n) +{ +int chunk, ret; +static char buf[XDBC_MAX_PACKET ]; +int use_cr =0 ; + +if (!xdbc.xdbc_reg) +return ; +memset (buf,0 ,XDBC_MAX_PACKET ); +while (n >0 ) { +for (chunk =0 ; chunk <XDBC_MAX_PACKET && n >0 ; + str++, chunk++, n--) { +if (!use_cr && *str =='\n' ) { + use_cr =1 ; + buf[chunk] ='\r' ; + str--; + n++; +continue ; + } +if (use_cr) + use_cr =0 ; + buf[chunk] = *str; + } +if (chunk >0 ) { + ret =xdbc_bulk_write (buf, chunk); +if (ret <0 ) +break ; + } + } +} + +static struct console early_xdbc_console = { + .name ="earlyxdbc" , + .write = early_xdbc_write, + .flags =CON_PRINTBUFFER , + .index =-1 , +}; + +void __init early_xdbc_register_console (void ) +{ +if (early_console) +return ; + + early_console = &early_xdbc_console; +if (early_console_keep) + early_console->flags &= ~CON_BOOT ; +else + early_console->flags |=CON_BOOT ; +register_console (early_console); +} + +static void xdbc_scrub_function (struct work_struct *work) +{ +unsigned long flags; + +spin_lock_irqsave (&xdbc.lock, flags); + +/* +* DbC is running, check the event ring and +* handle the events. +*/ +if (readl (&xdbc.xdbc_reg->control) &CTRL_DRC ) +xdbc_handle_events (); + +/* +* External reset happened. Need to restart the +* debugging hardware. +*/ +if (unlikely (!(readl (&xdbc.xdbc_reg->control) &CTRL_DCE )))
Quoted 9 lines
drivers/usb/early/xhci-dbc.c line 1040
Quoted 6 lines
drivers/usb/early/xhci-dbc.c new file +6
-0+xdbc_handle_external_reset (); + +spin_unlock_irqrestore (&xdbc.lock, flags); + +queue_delayed_work (xdbc_wq, &xdbc.scrub,usecs_to_jiffies (100 )); +}Excuse my total lack of USB knowledge, but WTH does this do and what do we need it for?
As I said above, I need a worker to check the read completion events and other hardware situations.
One hardware situation that needs to check regularly is that it might be aborted by the host controller itself. The xhci spec allows the debug hardware to share some logics with the host controller (to reduce cost?). As the result, when host controller driver resets the host (always happens in driver probe or resume) the debug hardware resets as well. Software needs to re-initialize and bring it back.
Early printk doesn't need to read anything from debug host. But if we use it for kernel debugging with kgdb (it's in my work queue), we need a read interface. We need to check the event ring regularly for read completion events.
Best regards,
Lu Baolu
Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability
Quoted 15 lines · Lu Baolu
Hi Peter,
Thanks for your comments.
Quoted 10 lines · Peter Zijlstra
drivers/usb/early/xhci-dbc.c line 930
Quoted 7 lines · Lu Baolu
+++
b/drivers/usb/early/xhci-dbc.cdrivers/usb/early/xhci-dbc.c new file +6
-0+static int xdbc_bulk_write (const char *bytes,int size) +{ +unsigned long flags; +int ret, timeout =0 ; + +spin_lock_irqsave (&xdbc.lock, flags);Yikes!!
Quoted 5 lines
Quoted 3 lines
So how is this supposed to work from NMI context and the like?
(also, at the very least, that should be a
raw_spinlock_t)Totally agree. We should put it as a
raw_spinlock_t().
Well, raw_spinlock_t still doesn't allow for NMI context operation. So ideally you'd manage without any locks at all.
Quoted 13 lines
Quoted 2 lines
What do you need the spinlock for? Afaict this is a 'simple' polling event handling loop on MMIO, right?
Not only for polling registers in MMIO, but also for handling the events in the event ring. The event ring is a memory block, which is allocated during hardware initialization and saved in a register in MMIO.
There is a single event ring for all events (read completion, write completion, port status change and transfer errors etc). The debugging hardware doesn't support interrupt, so software has to poll the event ring whenever it needs to.
Quoted 4 lines
Event ring polling happens at least in write interface (to make sure the previous transfer has been completed), and a worker (to check the read events and other things). That's the reason why I need a
spin_lockhere.
I'm not sure I understand. Sure you need someone polling, and you need only a single CPU polling at the same time.
But the serialization I pointed to provides you that.
Sure, it get a tad tricky to allow a nested context to take over processing in the middle of things, but that just means you should use some cmpxchg and stay away from stack based variables.
Quoted 39 lines
Quoted 18 lines
Quoted 18 lines
drivers/usb/early/xhci-dbc.c new file +18
-0+static void xdbc_scrub_function (struct work_struct *work) +{ +unsigned long flags; + +spin_lock_irqsave (&xdbc.lock, flags); + +/* +* DbC is running, check the event ring and +* handle the events. +*/ +if (readl (&xdbc.xdbc_reg->control) &CTRL_DRC ) +xdbc_handle_events (); + +/* +* External reset happened. Need to restart the +* debugging hardware. +*/ +if (unlikely (!(readl (&xdbc.xdbc_reg->control) &CTRL_DCE )))Quoted 9 lines
drivers/usb/early/xhci-dbc.c line 1040
Quoted 6 lines
drivers/usb/early/xhci-dbc.c new file +6
-0+xdbc_handle_external_reset (); + +spin_unlock_irqrestore (&xdbc.lock, flags); + +queue_delayed_work (xdbc_wq, &xdbc.scrub,usecs_to_jiffies (100 )); +}Excuse my total lack of USB knowledge, but WTH does this do and what do we need it for?
As I said above, I need a worker to check the read completion events and other hardware situations.
One hardware situation that needs to check regularly is that it might be aborted by the host controller itself. The xhci spec allows the debug hardware to share some logics with the host controller (to reduce cost?). As the result, when host controller driver resets the host (always happens in driver probe or resume) the debug hardware resets as well. Software needs to re-initialize and bring it back.
Quoted 4 lines
Early printk doesn't need to read anything from debug host. But if we use it for kernel debugging with kgdb (it's in my work queue), we need a read interface. We need to check the event ring regularly for read completion events.
Urgh, but this is very non-robust. Who says the workqueue stuff still works?
So now you're having your early_printk driver depend on the scheduler still working and the workqueue stuff and..
As it stands, that renders the entire thing completely useless for debugging the scheduler, workqueues and anything NMI. IOW, its completely useless full stop.
I'm already only using early_printk() because regular printk() is an unfixable piece of crap, and now you're making early_printk() useless too.
Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability
Quoted 3 lines · Peter Zijlstra
I'm already only using
early_printk()because regularprintk()is an unfixable piece of crap, and now you're makingearly_printk()useless too.
Note that the existing USB debug port stuff doesn't seem to have a single lock in. Its just polling on readl and doing writel without any serialization what so ever.
Not that I've ever actually used it (lack of the magic cable), but it at least looks like it should mostly work.
Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability
Hi Peter,
Quoted 11 lines · Peter Zijlstra
Quoted 3 lines · Peter Zijlstra
I'm already only using
early_printk()because regularprintk()is an unfixable piece of crap, and now you're makingearly_printk()useless too.Note that the existing USB debug port stuff doesn't seem to have a single lock in. Its just polling on readl and doing writel without any serialization what so ever.
Not that I've ever actually used it (lack of the magic cable), but it at least looks like it should mostly work.
Thank you again.
Your comments make sense to me. I will remove the lock and work queue usages in the new version.
Best regards,
Lu Baolu
PATCH RESEND v2 2/4 x86: add support for earlyprintk via USB3 debug port
In reply to Lu BaoluAdd support for early printk by writing debug messages to the
USB3 debug port. Users can use this type of early printk by
specifying kernel parameter of "earlyprintk=xdbc". This gives users a chance of providing debug output.
The hardware for USB3 debug port requires DMA memory blocks. This requires to delay setting up debugging hardware and registering boot console until the memblocks are filled.
--- Documentation/kernel-parameters.txt | 1 + arch/x86/kernel/early_printk.c | 5 +++++ arch/x86/kernel/setup.c | 7 +++++++ 3 files changed, 13 insertions(+)
Documentation/kernel-parameters.txt +1 -0
@@ -1178,6 +1178,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. earlyprintk=ttySn[,baudrate] earlyprintk=dbgp[debugController#] earlyprintk=pciserial,bus:device.function[,baudrate] + earlyprintk=xdbc[xhciController#] earlyprintk is useful when the kernel crashes before the normal console is initialized. It is not enabled by
arch/x86/kernel/early_printk.c +5 -0
@@ -17,6 +17,7 @@#include <asm/intel-mid.h> #include <asm/pgtable.h> #include <linux/usb/ehci_def.h> +#include <linux/usb/xhci-dbgp.h> #include <linux/efi.h> #include <asm/efi.h> #include <asm/pci_x86.h>
@@ -381,6 +382,10 @@ static int __init setup_early_printk(char *buf)if (!strncmp (buf,"efi" ,3 ))early_console_register (&early_efi_console, keep);#endif +#ifdef CONFIG_EARLY_PRINTK_XDBC +if (!strncmp (buf,"xdbc" ,4 )) +early_xdbc_parse_parameter (buf +4 ); +#endif buf++; }
arch/x86/kernel/setup.c +7 -0
@@ -70,6 +70,8 @@#include <linux/tboot.h> #include <linux/jiffies.h> +#include <linux/usb/xhci-dbgp.h> +#include <video/edid.h> #include <asm/mtrr.h>
@@ -1096,6 +1098,11 @@ void __init setup_arch(char **cmdline_p)memblock_set_current_limit (ISA_END_ADDRESS );memblock_x86_fill (); +#ifdef CONFIG_EARLY_PRINTK_XDBC +if (!early_xdbc_setup_hardware ()) +early_xdbc_register_console (); +#endif +reserve_bios_regions ();if (efi_enabled (EFI_MEMMAP )) {
Signature · 1 line
2.1.4
PATCH RESEND v2 3/4 usb: serial: usb_debug: add support for dbc debug device
In reply to Lu BaoluThis patch add dbc debug device support in usb_debug driver.
--- drivers/usb/serial/usb_debug.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/usb/serial/usb_debug.c +25 -3
@@ -32,7 +32,18 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x0525, 0x127a) }, { }, }; -MODULE_DEVICE_TABLE (usb, id_table); + +static const struct usb_device_id dbc_id_table[] = { + {USB_DEVICE (0x1d6b ,0x0004 ) }, + { }, +}; + +static const struct usb_device_id id_table_combined[] = { + {USB_DEVICE (0x0525 ,0x127a ) }, + {USB_DEVICE (0x1d6b ,0x0004 ) }, + { }, +}; +MODULE_DEVICE_TABLE (usb, id_table_combined);/* This HW really does not support a serial break, so one will be * emulated when ever the break state is set to true.
@@ -71,9 +82,20 @@ static struct usb_serial_driver debug_device = { .process_read_urb = usb_debug_process_read_urb, }; +static struct usb_serial_driver dbc_device = { + .driver = { + .owner =THIS_MODULE , + .name ="xhci_dbc" , + }, + .id_table = dbc_id_table, + .num_ports =1 , + .break_ctl = usb_debug_break_ctl, + .process_read_urb = usb_debug_process_read_urb, +}; +static struct usb_serial_driver *const serial_drivers[] = { - &debug_device,NULL + &debug_device, &dbc_device,NULL }; -module_usb_serial_driver (serial_drivers, id_table); +module_usb_serial_driver (serial_drivers, id_table_combined);MODULE_LICENSE ("GPL" );
Signature · 1 line
2.1.4
PATCH RESEND v2 4/4 usb: doc: add document for USB3 debug port usage
In reply to Lu BaoluAdd Documentation/usb/usb3-debug-port.txt. This document includes the user guide for USB3 debug port.
--- Documentation/usb/usb3-debug-port.txt | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/usb/usb3-debug-port.txt
Documentation/usb/usb3-debug-port.txt new file +87 -0
@@ -0,0 +1,87 @@ + USB3 debug port + + Lu Baolu <[email protected]> + + Last-updated: October 2016 + +GENERAL +======= + +This is a HOWTO for using USB3 debug port on x86 systems. + +Before using any kernel debugging functionalities based on USB3 +debug port, you need to check 1) whether debug port is supported +by the xHCI host, 2) which port is used for debugging purpose +(normally the first USB3 root port). You must have a USB 3.0 +super-speed A-to-A debugging cable to connect the debug target +with a debug host. In this document, a debug target stands for +the system under debugging; while, a debug host stands for a +stand-alone system that is able to talk to the debugging target +through the USB3 debug port. + +EARLY PRINTK +============ + +On debug target system, you need to customize a debugging kernel +with CONFIG_EARLY_PRINTK_XDBC enabled. And add below kernel boot +parameter. + + "earlyprintk=xdbc" + +If there are multiple xHCI controllers in the system, you can +append a host contoller index to this kernel parameter. This +index is started from 0. + +If you are going to leverage the keep option defined by the +early printk framework to keep the boot console alive after +early boot, you'd better add below kernel boot parameter. + + "usbcore.autosuspend=-1" + +On debug host side, you don't need to customize the kernel, but +you need to disable usb subsystem runtime power management by +adding below kernel boot parameter. + + "usbcore.autosuspend=-1" + +Before starting the debug target, you should connect the debug +port on debug target with a root port or port of any external hub +on the debug host. The cable used to connect these two ports +should be a USB 3.0 super-speed A-to-A debugging cable. + +During early boot of debug target, DbC (the debug engine for USB3 +debug port) hardware gets initialized. Debug host should be able +to enumerate the debug target as a debug device. Debug host will +then bind the debug device with the usb_debug driver module and +create the /dev/ttyUSB0 device. + +If device enumeration goes smoothly, you should be able to see +below kernel messages on debug host. + +# tail -f /var/log/kern.log + +[ 1815.983374] usb 4-3: new SuperSpeed USB device number 4 using xhci_hcd +[ 1815.999595] usb 4-3: LPM exit latency is zeroed, disabling LPM. +[ 1815.999899] usb 4-3: New USB device found, idVendor=1d6b, idProduct=0004 +[ 1815.999902] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 +[ 1815.999903] usb 4-3: Product: Remote GDB +[ 1815.999904] usb 4-3: Manufacturer: Linux +[ 1815.999905] usb 4-3: SerialNumber: 0001 +[ 1816.000240] usb_debug 4-3:1.0: xhci_dbc converter detected +[ 1816.000360] usb 4-3: xhci_dbc converter now attached to ttyUSB0 + +You can run below bash scripts on debug host to read the kernel +log sent from debug target. + +===== start of bash scripts ============= +#!/bin/bash + +while true ; do + while [ ! -d /sys/class/tty/ttyUSB0 ] ; do + : + done + cat /dev/ttyUSB0 >> xdbc.log +done +===== end of bash scripts =============== + +You should be able to see the early boot message in xdbc.log.
Signature · 1 line
2.1.4
Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage
Quoted 2 lines · Lu Baolu
Add
Documentation/usb/usb3-debug-port.txt. This document includes the user guide for USB3 debug port.
If you're adding completely new files, please at least consider writing them in reStructuredText, so we can easily bolt them to the Sphinx build. Just a few tweaks would be required, comments inline below.
BR,
Jani.
Quoted 14 lines
Signed-off-by Lu Baolu <[email protected]>--- Documentation/usb/usb3-debug-port.txt | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/usb/usb3-debug-port.txtDocumentation/usb/usb3-debug-port.txt new file +0
-0
Documentation/usb/usb3-debug-port.txt line 1
Quoted 1 line
Documentation/usb/usb3-debug-port.txt new file +1
-0@@ -0,0 +1,87 @@ + USB3 debug port
Make that a title with
===============
USB3 debug port
===============
Documentation/usb/usb3-debug-port.txt line 3
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Lu Baolu <[email protected]>
:Author: Lu Baolu <[email protected]>
Although git blame will give a more accurate idea after the file's been edited by others.
Documentation/usb/usb3-debug-port.txt line 5
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Last-updated: October 2016
:Date: October 2016
Again, this is what git does.
Quoted 12 lines
Documentation/usb/usb3-debug-port.txt new file +12
-0+ +GENERAL +======= + +This is a HOWTO for using USB3 debug port on x86 systems. + +Before using any kernel debugging functionalities based on USB3 +debug port, you need to check 1) whether debug port is supported +by the xHCI host, 2) which port is used for debugging purpose +(normally the first USB3 root port). You must have a USB 3.0 +super-speed A-to-A debugging cable to connect the debug target +with a debug host. In this document, a debug target stands for
Documentation/usb/usb3-debug-port.txt line 27
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+the system under debugging; while, a debug host stands for a +stand-alone system that is able to talk to the debugging target +through the USB3 debug port. + +EARLY PRINTK +============ + +On debug target system, you need to customize a debugging kernel +with CONFIG_EARLY_PRINTK_XDBC enabled. And add below kernel boot +parameter.
Add :: at the end of previous line to make the below indented block preformatted text. Ditto for the others.
Quoted 22 lines
Documentation/usb/usb3-debug-port.txt new file +22
-0+ + "earlyprintk=xdbc" + +If there are multiple xHCI controllers in the system, you can +append a host contoller index to this kernel parameter. This +index is started from 0. + +If you are going to leverage the keep option defined by the +early printk framework to keep the boot console alive after +early boot, you'd better add below kernel boot parameter. + + "usbcore.autosuspend=-1" + +On debug host side, you don't need to customize the kernel, but +you need to disable usb subsystem runtime power management by +adding below kernel boot parameter. + + "usbcore.autosuspend=-1" + +Before starting the debug target, you should connect the debug +port on debug target with a root port or port of any external hub +on the debug host. The cable used to connect these two ports
Documentation/usb/usb3-debug-port.txt line 59
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+should be a USB 3.0 super-speed A-to-A debugging cable. + +During early boot of debug target, DbC (the debug engine for USB3 +debug port) hardware gets initialized. Debug host should be able +to enumerate the debug target as a debug device. Debug host will +then bind the debug device with the usb_debug driver module and +create the /dev/ttyUSB0 device. + +If device enumeration goes smoothly, you should be able to see +below kernel messages on debug host.
Again, add :: and indent the below lines by some spaces.
Quoted 5 lines
Documentation/usb/usb3-debug-port.txt new file +5
-0+ +# tail -f /var/log/kern.log + +[ 1815.983374] usb 4-3: new SuperSpeed USB device number 4 using xhci_hcd +[ 1815.999595] usb 4-3: LPM exit latency is zeroed, disabling LPM.
Documentation/usb/usb3-debug-port.txt line 74
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+[ 1815.999899] usb 4-3: New USB device found, idVendor=1d6b, idProduct=0004 +[ 1815.999902] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 +[ 1815.999903] usb 4-3: Product: Remote GDB +[ 1815.999904] usb 4-3: Manufacturer: Linux +[ 1815.999905] usb 4-3: SerialNumber: 0001 +[ 1816.000240] usb_debug 4-3:1.0: xhci_dbc converter detected +[ 1816.000360] usb 4-3: xhci_dbc converter now attached to ttyUSB0 + +You can run below bash scripts on debug host to read the kernel +log sent from debug target.
Same here. Alternatively, if you do
.. code-block:: sh
and indent the block, you'll get syntax highlighting in the output.
Quoted 13 lines
Documentation/usb/usb3-debug-port.txt new file +13
-0+ +===== start of bash scripts ============= +#!/bin/bash + +while true ; do + while [ ! -d /sys/class/tty/ttyUSB0 ] ; do + : + done + cat /dev/ttyUSB0 >> xdbc.log +done +===== end of bash scripts =============== + +You should be able to see the early boot message in xdbc.log.
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage
Hi Jani,
Quoted 6 lines · Jani Nikula
Quoted 2 lines · Lu Baolu
Add
Documentation/usb/usb3-debug-port.txt. This document includes the user guide for USB3 debug port.If you're adding completely new files, please at least consider writing them in reStructuredText, so we can easily bolt them to the Sphinx build. Just a few tweaks would be required, comments inline below.
Thanks for your comments. I will refactor my document according to your comments.
By the way, are there any tools that I can use to check the document format?
Best regards,
Lu Baolu
Quoted 130 lines
BR,
Jani.Quoted 13 lines
Signed-off-by Lu Baolu <[email protected]>--- Documentation/usb/usb3-debug-port.txt | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/usb/usb3-debug-port.txtDocumentation/usb/usb3-debug-port.txt new file +0
-0Documentation/usb/usb3-debug-port.txt line 1
Quoted 1 line
Documentation/usb/usb3-debug-port.txt new file +1
-0@@ -0,0 +1,87 @@ + USB3 debug portMake that a title with
===============
USB3 debug port
===============Documentation/usb/usb3-debug-port.txt line 3
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Lu Baolu <[email protected]>:Author: Lu Baolu <[email protected]>
Although git blame will give a more accurate idea after the file's been edited by others.
Documentation/usb/usb3-debug-port.txt line 5
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Last-updated: October 2016:Date: October 2016
Again, this is what git does.
Quoted 12 lines
Documentation/usb/usb3-debug-port.txt new file +12
-0+ +GENERAL +======= + +This is a HOWTO for using USB3 debug port on x86 systems. + +Before using any kernel debugging functionalities based on USB3 +debug port, you need to check 1) whether debug port is supported +by the xHCI host, 2) which port is used for debugging purpose +(normally the first USB3 root port). You must have a USB 3.0 +super-speed A-to-A debugging cable to connect the debug target +with a debug host. In this document, a debug target stands forDocumentation/usb/usb3-debug-port.txt line 27
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+the system under debugging; while, a debug host stands for a +stand-alone system that is able to talk to the debugging target +through the USB3 debug port. + +EARLY PRINTK +============ + +On debug target system, you need to customize a debugging kernel +with CONFIG_EARLY_PRINTK_XDBC enabled. And add below kernel boot +parameter.Add :: at the end of previous line to make the below indented block preformatted text. Ditto for the others.
Quoted 22 lines
Documentation/usb/usb3-debug-port.txt new file +22
-0+ + "earlyprintk=xdbc" + +If there are multiple xHCI controllers in the system, you can +append a host contoller index to this kernel parameter. This +index is started from 0. + +If you are going to leverage the keep option defined by the +early printk framework to keep the boot console alive after +early boot, you'd better add below kernel boot parameter. + + "usbcore.autosuspend=-1" + +On debug host side, you don't need to customize the kernel, but +you need to disable usb subsystem runtime power management by +adding below kernel boot parameter. + + "usbcore.autosuspend=-1" + +Before starting the debug target, you should connect the debug +port on debug target with a root port or port of any external hub +on the debug host. The cable used to connect these two portsDocumentation/usb/usb3-debug-port.txt line 59
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+should be a USB 3.0 super-speed A-to-A debugging cable. + +During early boot of debug target, DbC (the debug engine for USB3 +debug port) hardware gets initialized. Debug host should be able +to enumerate the debug target as a debug device. Debug host will +then bind the debug device with the usb_debug driver module and +create the /dev/ttyUSB0 device. + +If device enumeration goes smoothly, you should be able to see +below kernel messages on debug host.Again, add :: and indent the below lines by some spaces.
Quoted 5 lines
Documentation/usb/usb3-debug-port.txt new file +5
-0+ +# tail -f /var/log/kern.log + +[ 1815.983374] usb 4-3: new SuperSpeed USB device number 4 using xhci_hcd +[ 1815.999595] usb 4-3: LPM exit latency is zeroed, disabling LPM.Documentation/usb/usb3-debug-port.txt line 74
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+[ 1815.999899] usb 4-3: New USB device found, idVendor=1d6b, idProduct=0004 +[ 1815.999902] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 +[ 1815.999903] usb 4-3: Product: Remote GDB +[ 1815.999904] usb 4-3: Manufacturer: Linux +[ 1815.999905] usb 4-3: SerialNumber: 0001 +[ 1816.000240] usb_debug 4-3:1.0: xhci_dbc converter detected +[ 1816.000360] usb 4-3: xhci_dbc converter now attached to ttyUSB0 + +You can run below bash scripts on debug host to read the kernel +log sent from debug target.Same here. Alternatively, if you do
.. code-block:: sh
and indent the block, you'll get syntax highlighting in the output.
Quoted 13 lines
Documentation/usb/usb3-debug-port.txt new file +13
-0+ +===== start of bash scripts ============= +#!/bin/bash + +while true ; do + while [ ! -d /sys/class/tty/ttyUSB0 ] ; do + : + done + cat /dev/ttyUSB0 >> xdbc.log +done +===== end of bash scripts =============== + +You should be able to see the early boot message in xdbc.log.
Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage
Quoted 10 lines · Lu Baolu
Hi Jani,
Quoted 6 lines · Jani Nikula
Quoted 2 lines · Lu Baolu
Add
Documentation/usb/usb3-debug-port.txt. This document includes the user guide for USB3 debug port.If you're adding completely new files, please at least consider writing them in reStructuredText, so we can easily bolt them to the Sphinx build. Just a few tweaks would be required, comments inline below.
Quoted 5 lines
Thanks for your comments. I will refactor my document according to your comments.
By the way, are there any tools that I can use to check the document format?
Read Documentation/kernel-documentation.rxt. Install Sphinx. Run 'make htmldocs'.
BR,
Jani.
Quoted 135 lines
Best regards,
Lu BaoluQuoted 130 lines
BR,
Jani.Quoted 13 lines
Signed-off-by Lu Baolu <[email protected]>--- Documentation/usb/usb3-debug-port.txt | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/usb/usb3-debug-port.txtDocumentation/usb/usb3-debug-port.txt new file +0
-0Documentation/usb/usb3-debug-port.txt line 1
Quoted 1 line
Documentation/usb/usb3-debug-port.txt new file +1
-0@@ -0,0 +1,87 @@ + USB3 debug portMake that a title with
===============
USB3 debug port
===============Documentation/usb/usb3-debug-port.txt line 3
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Lu Baolu <[email protected]>:Author: Lu Baolu <[email protected]>
Although git blame will give a more accurate idea after the file's been edited by others.
Documentation/usb/usb3-debug-port.txt line 5
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Last-updated: October 2016:Date: October 2016
Again, this is what git does.
Quoted 12 lines
Documentation/usb/usb3-debug-port.txt new file +12
-0+ +GENERAL +======= + +This is a HOWTO for using USB3 debug port on x86 systems. + +Before using any kernel debugging functionalities based on USB3 +debug port, you need to check 1) whether debug port is supported +by the xHCI host, 2) which port is used for debugging purpose +(normally the first USB3 root port). You must have a USB 3.0 +super-speed A-to-A debugging cable to connect the debug target +with a debug host. In this document, a debug target stands forDocumentation/usb/usb3-debug-port.txt line 27
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+the system under debugging; while, a debug host stands for a +stand-alone system that is able to talk to the debugging target +through the USB3 debug port. + +EARLY PRINTK +============ + +On debug target system, you need to customize a debugging kernel +with CONFIG_EARLY_PRINTK_XDBC enabled. And add below kernel boot +parameter.Add :: at the end of previous line to make the below indented block preformatted text. Ditto for the others.
Quoted 22 lines
Documentation/usb/usb3-debug-port.txt new file +22
-0+ + "earlyprintk=xdbc" + +If there are multiple xHCI controllers in the system, you can +append a host contoller index to this kernel parameter. This +index is started from 0. + +If you are going to leverage the keep option defined by the +early printk framework to keep the boot console alive after +early boot, you'd better add below kernel boot parameter. + + "usbcore.autosuspend=-1" + +On debug host side, you don't need to customize the kernel, but +you need to disable usb subsystem runtime power management by +adding below kernel boot parameter. + + "usbcore.autosuspend=-1" + +Before starting the debug target, you should connect the debug +port on debug target with a root port or port of any external hub +on the debug host. The cable used to connect these two portsDocumentation/usb/usb3-debug-port.txt line 59
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+should be a USB 3.0 super-speed A-to-A debugging cable. + +During early boot of debug target, DbC (the debug engine for USB3 +debug port) hardware gets initialized. Debug host should be able +to enumerate the debug target as a debug device. Debug host will +then bind the debug device with the usb_debug driver module and +create the /dev/ttyUSB0 device. + +If device enumeration goes smoothly, you should be able to see +below kernel messages on debug host.Again, add :: and indent the below lines by some spaces.
Quoted 5 lines
Documentation/usb/usb3-debug-port.txt new file +5
-0+ +# tail -f /var/log/kern.log + +[ 1815.983374] usb 4-3: new SuperSpeed USB device number 4 using xhci_hcd +[ 1815.999595] usb 4-3: LPM exit latency is zeroed, disabling LPM.Documentation/usb/usb3-debug-port.txt line 74
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+[ 1815.999899] usb 4-3: New USB device found, idVendor=1d6b, idProduct=0004 +[ 1815.999902] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 +[ 1815.999903] usb 4-3: Product: Remote GDB +[ 1815.999904] usb 4-3: Manufacturer: Linux +[ 1815.999905] usb 4-3: SerialNumber: 0001 +[ 1816.000240] usb_debug 4-3:1.0: xhci_dbc converter detected +[ 1816.000360] usb 4-3: xhci_dbc converter now attached to ttyUSB0 + +You can run below bash scripts on debug host to read the kernel +log sent from debug target.Same here. Alternatively, if you do
.. code-block:: sh
and indent the block, you'll get syntax highlighting in the output.
Quoted 13 lines
Documentation/usb/usb3-debug-port.txt new file +13
-0+ +===== start of bash scripts ============= +#!/bin/bash + +while true ; do + while [ ! -d /sys/class/tty/ttyUSB0 ] ; do + : + done + cat /dev/ttyUSB0 >> xdbc.log +done +===== end of bash scripts =============== + +You should be able to see the early boot message in xdbc.log.
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage
Hi,
Quoted 10 lines · Jani Nikula
Quoted 9 lines · Lu Baolu
Hi Jani,
Quoted 6 lines · Jani Nikula
Quoted 2 lines · Lu Baolu
Add
Documentation/usb/usb3-debug-port.txt. This document includes the user guide for USB3 debug port.If you're adding completely new files, please at least consider writing them in reStructuredText, so we can easily bolt them to the Sphinx build. Just a few tweaks would be required, comments inline below.
Quoted 7 lines
Quoted 5 lines
Thanks for your comments. I will refactor my document according to your comments.
By the way, are there any tools that I can use to check the document format?
Read
Documentation/kernel-documentation.rxt. Install Sphinx. Run 'make htmldocs'.
Got it. Thank you.
Best regards,
Lu Baolu
Quoted 137 lines
BR,
Jani.Quoted 132 lines
Best regards,
Lu BaoluQuoted 129 lines
BR,
Jani.Quoted 13 lines
Signed-off-by Lu Baolu <[email protected]>--- Documentation/usb/usb3-debug-port.txt | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/usb/usb3-debug-port.txtDocumentation/usb/usb3-debug-port.txt new file +0
-0Documentation/usb/usb3-debug-port.txt line 1
Quoted 1 line
Documentation/usb/usb3-debug-port.txt new file +1
-0@@ -0,0 +1,87 @@ + USB3 debug portMake that a title with
===============
USB3 debug port
===============Documentation/usb/usb3-debug-port.txt line 3
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Lu Baolu <[email protected]>:Author: Lu Baolu <[email protected]>
Although git blame will give a more accurate idea after the file's been edited by others.
Documentation/usb/usb3-debug-port.txt line 5
Quoted 2 lines
Documentation/usb/usb3-debug-port.txt new file +2
-0+ + Last-updated: October 2016:Date: October 2016
Again, this is what git does.
Quoted 12 lines
Documentation/usb/usb3-debug-port.txt new file +12
-0+ +GENERAL +======= + +This is a HOWTO for using USB3 debug port on x86 systems. + +Before using any kernel debugging functionalities based on USB3 +debug port, you need to check 1) whether debug port is supported +by the xHCI host, 2) which port is used for debugging purpose +(normally the first USB3 root port). You must have a USB 3.0 +super-speed A-to-A debugging cable to connect the debug target +with a debug host. In this document, a debug target stands forDocumentation/usb/usb3-debug-port.txt line 27
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+the system under debugging; while, a debug host stands for a +stand-alone system that is able to talk to the debugging target +through the USB3 debug port. + +EARLY PRINTK +============ + +On debug target system, you need to customize a debugging kernel +with CONFIG_EARLY_PRINTK_XDBC enabled. And add below kernel boot +parameter.Add :: at the end of previous line to make the below indented block preformatted text. Ditto for the others.
Quoted 22 lines
Documentation/usb/usb3-debug-port.txt new file +22
-0+ + "earlyprintk=xdbc" + +If there are multiple xHCI controllers in the system, you can +append a host contoller index to this kernel parameter. This +index is started from 0. + +If you are going to leverage the keep option defined by the +early printk framework to keep the boot console alive after +early boot, you'd better add below kernel boot parameter. + + "usbcore.autosuspend=-1" + +On debug host side, you don't need to customize the kernel, but +you need to disable usb subsystem runtime power management by +adding below kernel boot parameter. + + "usbcore.autosuspend=-1" + +Before starting the debug target, you should connect the debug +port on debug target with a root port or port of any external hub +on the debug host. The cable used to connect these two portsDocumentation/usb/usb3-debug-port.txt line 59
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+should be a USB 3.0 super-speed A-to-A debugging cable. + +During early boot of debug target, DbC (the debug engine for USB3 +debug port) hardware gets initialized. Debug host should be able +to enumerate the debug target as a debug device. Debug host will +then bind the debug device with the usb_debug driver module and +create the /dev/ttyUSB0 device. + +If device enumeration goes smoothly, you should be able to see +below kernel messages on debug host.Again, add :: and indent the below lines by some spaces.
Quoted 5 lines
Documentation/usb/usb3-debug-port.txt new file +5
-0+ +# tail -f /var/log/kern.log + +[ 1815.983374] usb 4-3: new SuperSpeed USB device number 4 using xhci_hcd +[ 1815.999595] usb 4-3: LPM exit latency is zeroed, disabling LPM.Documentation/usb/usb3-debug-port.txt line 74
Quoted 10 lines
Documentation/usb/usb3-debug-port.txt new file +10
-0+[ 1815.999899] usb 4-3: New USB device found, idVendor=1d6b, idProduct=0004 +[ 1815.999902] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 +[ 1815.999903] usb 4-3: Product: Remote GDB +[ 1815.999904] usb 4-3: Manufacturer: Linux +[ 1815.999905] usb 4-3: SerialNumber: 0001 +[ 1816.000240] usb_debug 4-3:1.0: xhci_dbc converter detected +[ 1816.000360] usb 4-3: xhci_dbc converter now attached to ttyUSB0 + +You can run below bash scripts on debug host to read the kernel +log sent from debug target.Same here. Alternatively, if you do
.. code-block:: sh
and indent the block, you'll get syntax highlighting in the output.
Quoted 13 lines
Documentation/usb/usb3-debug-port.txt new file +13
-0+ +===== start of bash scripts ============= +#!/bin/bash + +while true ; do + while [ ! -d /sys/class/tty/ttyUSB0 ] ; do + : + done + cat /dev/ttyUSB0 >> xdbc.log +done +===== end of bash scripts =============== + +You should be able to see the early boot message in xdbc.log.