linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Fix support for Cavium Octeon debugger stub (v2).

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] MIPS: Fix support for Cavium Octeon debugger stub (v2).
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 5 Aug 2009 10:41:04 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <1246906976-19979-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1246905276-8543-1-git-send-email-ddaney@caviumnetworks.com> <1246906976-19979-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
On Mon, Jul 06, 2009 at 12:02:56PM -0700, David Daney wrote:

> The Cavium Octeon bootloader has a debugger stub that requires a
> little help from the target application to break in.
> 
> If configured, when we get an interrupt on the debug uart we wake up
> the debugger.
> 
> Changes from v1: Inline octeon_get_boot_debug_flag so it compiles
>                  without CONFIG_CAVIUM_GDB.
> 
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
>  arch/mips/Kconfig.debug               |   10 ++++++
>  arch/mips/cavium-octeon/serial.c      |   53 
> ++++++++++++++++++++++++++++++++-
>  arch/mips/cavium-octeon/setup.c       |    2 +-
>  arch/mips/include/asm/octeon/octeon.h |    1 -
>  4 files changed, 63 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
> index 364ca89..f6a0e68 100644
> --- a/arch/mips/Kconfig.debug
> +++ b/arch/mips/Kconfig.debug
> @@ -42,6 +42,16 @@ config SB1XXX_CORELIS
>         Select compile flags that produce code that can be processed by the
>         Corelis mksym utility and UDB Emulator.
>  
> +config CAVIUM_GDB
> +     bool "Remote GDB debugging using the Cavium Networks Multicore GDB"
> +     depends on DEBUG_KERNEL
> +     depends on CPU_CAVIUM_OCTEON
> +     select DEBUG_INFO
> +     help
> +       If you say Y here, it will be possible to remotely debug the MIPS
> +       kernel using the Cavium Networks GDB with extended SMP support.
> +       This is only useful for kernel hackers. If unsure, say N.
> +
>  config RUNTIME_DEBUG
>       bool "Enable run-time debugging"
>       depends on DEBUG_KERNEL
> diff --git a/arch/mips/cavium-octeon/serial.c 
> b/arch/mips/cavium-octeon/serial.c
> index 8240728..2110e68 100644
> --- a/arch/mips/cavium-octeon/serial.c
> +++ b/arch/mips/cavium-octeon/serial.c
> @@ -18,11 +18,60 @@
>  
>  #include <asm/octeon/octeon.h>
>  
> +#if defined(CONFIG_CAVIUM_GDB)
> +
>  #ifdef CONFIG_GDB_CONSOLE
>  #define DEBUG_UART 0
>  #else
>  #define DEBUG_UART 1
>  #endif
> +static irqreturn_t interrupt_debug_char(int cpl, void *dev_id)
> +{
> +     unsigned long lsrval;
> +     unsigned long tmp;
> +
> +     lsrval = cvmx_read_csr(CVMX_MIO_UARTX_LSR(DEBUG_UART));
> +     if (lsrval & 1) {
> +#ifdef CONFIG_KGDB
> +             /*
> +              * The Cavium EJTAG bootmonitor stub is not compatible
> +              * with KGDB.  We should never get here.
> +              */
> +#error Illegal to use both CONFIG_KGDB and CONFIG_CAVIUM_GDB
> +#endif

#error is only acceptable to catch bugs in Kconfig or the code itself.  This
#error however is triggering on .config settings including such generated by
randconfig which is a PITA.  So rather please ensure forbidden .configs
can't be generated.  Alternatively, implement things such that both
config options can co-exist.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH] MIPS: Fix support for Cavium Octeon debugger stub (v2)., Ralf Baechle <=