Skip to content
  • Jason Wessel's avatar
    echi-dbgp: Add kernel debugger support for the usb debug port · 4fe1da4e
    Jason Wessel authored
    
    
    This patch adds the capability to use the usb debug port with the
    kernel debugger.  It is also still possible to use this functionality
    with or without the earlyprintk=dbgpX.  It is possible to use the
    kgdbwait boot argument to debug very early in the kernel start up code.
    
    There are two ways to use this driver extension with a kernel boot argument.
    
    1) kgdbdbgp=#   -- Where # is the number of the usb debug controller
    
       You must use sysrq-g to break into the kernel debugger on another
       connection type other than the dbgp.
    
    2) kgdbdbgp=#debugControlNum#,#Seconds#
    
       In this mode, the usb debug port is polled every #Seconds# for
       character input.  It is possible to use gdb or press control-c to
       break into the kernel debugger.
    
    From the implementation perspective there are 3 high level changes.
    
    1) Allow variable retries for the the hardware via dbgp_bulk_read().
    
       The amount of retries for the dbgp_bulk_read() needed to be
       variable instead of fixed.  We do not want to poll at all when the
       kernel is operating in interrupt driven mode.  The polling only
       occurs if the kernel was booted when specifying some number of
       seconds via the kgdbdbgp boot argument (IE kgdbdbgp=0,1).  In this
       case the loop count is reduced to 1 so as introduce the smallest
       amount of latency as possible.
    
    2) Save the bulk IN endpoint address for use by the kgdb code.
    
    3) The addition of the kgdb interface code.
    
       This consisted of adding in a character read function for the dbgp
       as well as a polling thread to allow the dbgp to interrupt the
       kernel execution.  The rest is the typical kgdb I/O api.
    
    CC: Eric Biederman <ebiederm@xmission.com>
    CC: Yinghai Lu <yhlu.kernel@gmail.com>
    CC: linux-usb@vger.kernel.org
    Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
    Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    4fe1da4e