1215976Sjmallett/***********************license start*************** 2232812Sjmallett * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights 3215976Sjmallett * reserved. 4215976Sjmallett * 5215976Sjmallett * 6215976Sjmallett * Redistribution and use in source and binary forms, with or without 7215976Sjmallett * modification, are permitted provided that the following conditions are 8215976Sjmallett * met: 9215976Sjmallett * 10215976Sjmallett * * Redistributions of source code must retain the above copyright 11215976Sjmallett * notice, this list of conditions and the following disclaimer. 12215976Sjmallett * 13215976Sjmallett * * Redistributions in binary form must reproduce the above 14215976Sjmallett * copyright notice, this list of conditions and the following 15215976Sjmallett * disclaimer in the documentation and/or other materials provided 16215976Sjmallett * with the distribution. 17215976Sjmallett 18232812Sjmallett * * Neither the name of Cavium Inc. nor the names of 19215976Sjmallett * its contributors may be used to endorse or promote products 20215976Sjmallett * derived from this software without specific prior written 21215976Sjmallett * permission. 22215976Sjmallett 23215976Sjmallett * This Software, including technical data, may be subject to U.S. export control 24215976Sjmallett * laws, including the U.S. Export Administration Act and its associated 25215976Sjmallett * regulations, and may be subject to export or import regulations in other 26215976Sjmallett * countries. 27215976Sjmallett 28215976Sjmallett * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 29232812Sjmallett * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 30215976Sjmallett * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO 31215976Sjmallett * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR 32215976Sjmallett * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM 33215976Sjmallett * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, 34215976Sjmallett * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF 35215976Sjmallett * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR 36215976Sjmallett * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR 37215976Sjmallett * PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 38215976Sjmallett ***********************license end**************************************/ 39215976Sjmallett 40215976Sjmallett 41215976Sjmallett#ifdef CVMX_BUILD_FOR_LINUX_KERNEL 42215976Sjmallett#include <linux/module.h> 43215976Sjmallett#include <asm/octeon/cvmx.h> 44215976Sjmallett#include <asm/octeon/cvmx-debug.h> 45215976Sjmallett 46215976Sjmallett#define cvmx_interrupt_in_isr 0 47215976Sjmallett 48215976Sjmallett#else 49215976Sjmallett#include "cvmx.h" 50215976Sjmallett#include "cvmx-debug.h" 51215976Sjmallett 52232812Sjmallett#ifndef CVMX_BUILD_FOR_TOOLCHAIN 53215976Sjmallettextern int cvmx_interrupt_in_isr; 54215976Sjmallett#else 55215976Sjmallett#define cvmx_interrupt_in_isr 0 56215976Sjmallett#endif 57215976Sjmallett 58215976Sjmallett#endif 59215976Sjmallett 60215976Sjmallett 61215976Sjmallettstatic void cvmx_debug_remote_mem_wait_for_resume(volatile cvmx_debug_core_context_t *context, cvmx_debug_state_t state) 62215976Sjmallett{ 63215976Sjmallett // 64215976Sjmallett // If we are stepping and not stepping into an interrupt and the debug 65215976Sjmallett // exception happened in an interrupt, continue the execution. 66215976Sjmallett // 67215976Sjmallett if(!state.step_isr && 68215976Sjmallett (context->cop0.debug & 0x1) && /* Single stepping */ 69215976Sjmallett !(context->cop0.debug & 0x1e) && /* Did not hit a breakpoint */ 70215976Sjmallett ((context->cop0.status & 0x2) || cvmx_interrupt_in_isr)) 71215976Sjmallett return; 72215976Sjmallett 73215976Sjmallett context->remote_controlled = 1; 74215976Sjmallett CVMX_SYNCW; 75215976Sjmallett while (context->remote_controlled) 76215976Sjmallett ; 77215976Sjmallett CVMX_SYNCW; 78215976Sjmallett} 79215976Sjmallett 80215976Sjmallettstatic void cvmx_debug_memory_change_core(int oldcore, int newcore) 81215976Sjmallett{ 82215976Sjmallett /* FIXME, this should change the core on the host side too. */ 83215976Sjmallett} 84215976Sjmallett 85215976Sjmallettcvmx_debug_comm_t cvmx_debug_remote_comm = 86215976Sjmallett{ 87215976Sjmallett .init = NULL, 88215976Sjmallett .install_break_handler = NULL, 89215976Sjmallett .needs_proxy = 0, 90215976Sjmallett .getpacket = NULL, 91215976Sjmallett .putpacket = NULL, 92215976Sjmallett .wait_for_resume = cvmx_debug_remote_mem_wait_for_resume, 93215976Sjmallett .change_core = cvmx_debug_memory_change_core, 94215976Sjmallett}; 95