diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-02-25 18:37:53 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-03 14:53:06 -0700 |
commit | 7f75d4739c3985d0aa7cd8cf97ce69e6fa5c1e6e (patch) | |
tree | c912277dcc80f0f82bf086af4aa428a797d5f2bd | |
parent | e1ecad2794d71855c8f0dabe86f8e71193225093 (diff) |
Staging: slicoss: clean up SLIC_DUMP_ENABLED
As SLIC_DUMP_ENABLED was disabled, remove the code that it was keeping
from being built as it was not ever used. This removed a lot.
Cc: Lior Dotan <liodot@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/slicoss/slic.h | 54 | ||||
-rw-r--r-- | drivers/staging/slicoss/slicdump.h | 278 | ||||
-rw-r--r-- | drivers/staging/slicoss/slicinc.h | 32 | ||||
-rw-r--r-- | drivers/staging/slicoss/slicoss.c | 1208 |
4 files changed, 2 insertions, 1570 deletions
diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 72ce9166bb6..19ba9cd29ea 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -181,17 +181,6 @@ struct slic_cmdqueue { #define SLIC_MAX_CARDS 32 #define SLIC_MAX_PORTS 4 /* Max # of ports per card */ -#if SLIC_DUMP_ENABLED -/* -Dump buffer size - -This cannot be bigger than the max DMA size the card supports, -given the current code structure in the host and ucode. -Mojave supports 16K, Oasis supports 16K-1, so -just set this at 15K, shouldnt make that much of a diff. -*/ -#define DUMP_BUF_SIZE 0x3C00 -#endif struct mcast_address { @@ -347,30 +336,6 @@ struct sliccard { u32 max_isr_xmits; u32 rcv_interrupt_yields; u32 tx_packets; -#if SLIC_DUMP_ENABLED - u32 dumpstatus; /* Result of dump UPR */ - void *cmdbuffer; - - ulong cmdbuffer_phys; - u32 cmdbuffer_physl; - u32 cmdbuffer_physh; - - u32 dump_count; - struct task_struct *dump_task_id; - u32 dump_wait_count; - uint dumpthread_running; /* has a dump thread been init'd */ - uint dump_requested; /* 0 no, 1 = reqstd 2=curr 3=done */ - u32 dumptime_start; - u32 dumptime_complete; - u32 dumptime_delta; - void *dumpbuffer; - ulong dumpbuffer_phys; - u32 dumpbuffer_physl; - u32 dumpbuffer_physh; - wait_queue_head_t dump_wq; - struct file *dumphandle; - mm_segment_t dumpfile_fs; -#endif u32 debug_ix; ushort reg_type[32]; ushort reg_offset[32]; @@ -550,25 +515,6 @@ struct adapter { struct net_device_stats stats; }; -#if SLIC_DUMP_ENABLED -#define SLIC_DUMP_REQUESTED 1 -#define SLIC_DUMP_IN_PROGRESS 2 -#define SLIC_DUMP_DONE 3 - -/**************************************************************************** - * - * Microcode crash information structure. This - * structure is written out to the card's SRAM when the microcode panic's. - * - ****************************************************************************/ -struct slic_crash_info { - ushort cpu_id; - ushort crash_pc; -}; - -#define CRASH_INFO_OFFSET 0x155C - -#endif #define UPDATE_STATS(largestat, newstat, oldstat) \ { \ diff --git a/drivers/staging/slicoss/slicdump.h b/drivers/staging/slicoss/slicdump.h deleted file mode 100644 index 92a9b44bcad..00000000000 --- a/drivers/staging/slicoss/slicdump.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * - * Copyright (c) 2000-2002 Alacritech, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY ALACRITECH, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ALACRITECH, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * NO LICENSE TO ANY ALACRITECH PATENT CLAIM IS GRANTED BY ANY COPYRIGHT - * LICENSE TO THIS OR OTHER SOFTWARE. THIS SOFTWARE MAY BE COVERED BY - * ALACRITECH PATENTS INCLUDING BUT NOT LIMITED TO U.S. PATENT NOS. 6,226,680, - * 6,247,060, 6,334,153, 6,389,479, 6,393,487, 6,427,171, 6,427,173 - * and 6,434,620. - * THIS SOFTWARE IS NOT SUBJECT TO THE GNU GENERAL PUBLIC LICENSE (GPL). - * - * The views and conclusions contained in the software and - * documentation are those of the authors and should not be - * interpreted as representing official policies, either - * expressed or implied, of Alacritech, Inc. - */ -#ifndef _SLIC_DUMP_H_ -#define _SLIC_DUMP_H_ - -#define DEBUG_SUCCESS 0 - -/*********************************************************************** - * - * Utility processor register locations - * - **********************************************************************/ -#define UTILITY_RESET 0x0 -#define UTILITY_ISP_ADDR 0x4 /* Interrupt status Pointer */ -#define UTILITY_ISR_ADDR 0x8 /* Interrupt status Register */ -#define UTILITY_ICR_ADDR 0xc /* Interrupt Control Register */ -#define UTILITY_CPR_ADDR 0x10 /* Command Pointer Register */ -#define UTILITY_DPR_ADDR 0x14 /* Data Pointer Register */ -#define UTILITY_DMP_TRQ 0x18 /* Dump queue onto ALU for analyser */ -#define UTILITY_UPP_ADDR 0x1c /* Bits 63-32 of cmd/data pointer */ - -/*********************************************************************** - * - * INIC status register bits - * - ***********************************************************************/ -#define SLIC_ISR_CC 0x10000000 /* Command complete - synchronous */ -#define SLIC_ISR_ERR 0x01000000 /* Command Error - synchronous */ -#define SLIC_ISR_CMD_MASK 0x11000000 /* Command status mask */ -#define SLIC_ISR_TPH 0x00080000 /* Transmit processor halted - async */ -#define SLIC_ISR_RPH 0x00040000 /* Receive processor halted - async */ - -/*********************************************************************** - * - * INIC Control register values - * - ***********************************************************************/ -#define SLIC_ICR_OFF 0 /* Interrupts disabled */ -#define SLIC_ICR_ON 1 /* Interrupts enabled */ -#define SLIC_ICR_MASK 2 /* Interrupts masked */ - -#define WRITE_DREG(reg, value, flush) \ -{ \ - writel((value), (reg)); \ - if ((flush)) { \ - mb(); \ - } \ -} - -/************************************************************************ - * - * Command Format - * - * Each command contains a command byte which is defined as follows: - * - * bits: 7-3 2 1-0 - * ---------------------------------------------- - * command Alt. Proc Processor - * - ************************************************************************/ - -/* - * Macro to create the command byte given the command, Alt. Proc, and - * Processor values. Note that the macro assumes that the values are - * preshifted. That is, the values for alt. proc are 0 for transmit and - * 4 for receive. - */ -#define COMMAND_BYTE(command, alt_proc, proc) ((command) | (alt_proc) | (proc)) - -/* - * Command values - */ -#define CMD_HALT 0x0 /* Send a halt to the INIC */ -#define CMD_RUN 0x8 /* Start the halted INIC */ -#define CMD_STEP 0x10 /* Single step the inic */ -#define CMD_BREAK 0x18 /* Set a breakpoint - 8 byte command */ -#define CMD_RESET_BREAK 0x20 /* Reset a breakpoint - 8 byte cmd */ -#define CMD_DUMP 0x28 /* Dump INIC memory - 8 byte command */ -#define CMD_LOAD 0x30 /* Load INIC memory - 8 byte command */ -#define CMD_MAP 0x38 /* Map out a ROM instruction - 8 BC */ -#define CMD_CAM_OPS 0x38 /* perform ops on specific CAM */ -#define CMD_XMT 0x40 /* Transmit frame */ -#define CMD_RCV 0x48 /* Receive frame */ - -/* - * Alt. Proc values - * - * When the proc value is set to the utility processor, the Alt. Proc - * specifies which processor handles the debugging. - */ -#define ALT_PROC_TRANSMIT 0x0 -#define ALT_PROC_RECEIVE 0x4 - -/* - * Proc values - */ -#define PROC_INVALID 0x0 -#define PROC_NONE 0x0 /* Gigabit use */ -#define PROC_TRANSMIT 0x1 -#define PROC_RECEIVE 0x2 -#define PROC_UTILITY 0x3 - -/****************************************************************** - * - * 8 byte command structure definitions - * - ******************************************************************/ - -/* - * Break and Reset Break command structure - */ -struct BREAK { - unsigned char command; /* Command word defined above */ - unsigned char resvd; - ushort count; /* Number of executions before break */ - u32 addr; /* Address of break point */ -}; - -/* - * Dump and Load command structure - */ -struct dump_cmd { - unsigned char cmd; /* Command word defined above */ - unsigned char desc; /* Descriptor values - defined below */ - ushort count; /* number of 4 byte words to be transferred */ - u32 addr; /* start address of dump or load */ -}; - -/* - * Receive or Transmit a frame. - */ -struct RCV_OR_XMT_FRAME { - unsigned char command; /* Command word defined above */ - unsigned char MacId; /* Mac ID of interface - transmit only */ - ushort count; /* Length of frame in bytes */ - u32 pad; /* not used */ -}; - -/* - * Values of desc field in DUMP_OR_LOAD structure - */ -#define DESC_RFILE 0x0 /* Register file */ -#define DESC_SRAM 0x1 /* SRAM */ -#define DESC_DRAM 0x2 /* DRAM */ -#define DESC_QUEUE 0x3 /* queues */ -#define DESC_REG 0x4 /* General registers (pc, status, etc) */ -#define DESC_SENSE 0x5 /* Sense register */ - -/* Descriptor field definitions for CMD_DUMP_CAM */ -#define DUMP_CAM_A 0 -#define DUMP_CAM_B 1 /* unused at present */ -#define DUMP_CAM_C 2 -#define DUMP_CAM_D 3 -#define SEARCH_CAM_A 4 -#define SEARCH_CAM_C 5 - -/* - * Map command to replace a command in ROM with a command in WCS - */ -struct MAP { - unsigned char command; /* Command word defined above */ - unsigned char not_used[3]; - ushort map_to; /* Instruction address in WCS */ - ushort map_out; /* Instruction address in ROM */ -}; - -/* - * Misc definitions - */ -#define SLIC_MAX_QUEUE 32 /* Total # of queues on the INIC (0-31)*/ -#define SLIC_4MAX_REG 512 /* Total # of 4-port file-registers */ -#define SLIC_1MAX_REG 384 /* Total # of file-registers */ -#define SLIC_GBMAX_REG 1024 /* Total # of Gbit file-registers */ -#define SLIC_NUM_REG 32 /* non-file-registers = NUM_REG in tm-simba.h */ -#define SLIC_GB_CAMA_SZE 32 -#define SLIC_GB_CAMB_SZE 16 -#define SLIC_GB_CAMAB_SZE 32 -#define SLIC_GB_CAMC_SZE 16 -#define SLIC_GB_CAMD_SZE 16 -#define SLIC_GB_CAMCD_SZE 32 - -/* - * Coredump header structure - */ -struct CORE_Q { - u32 queueOff; /* Offset of queue */ - u32 queuesize; /* size of queue */ -}; - -#define DRIVER_NAME_SIZE 32 - -struct sliccore_hdr { - unsigned char driver_version[DRIVER_NAME_SIZE]; /* Driver version string */ - u32 RcvRegOff; /* Offset of receive registers */ - u32 RcvRegsize; /* size of receive registers */ - u32 XmtRegOff; /* Offset of transmit registers */ - u32 XmtRegsize; /* size of transmit registers */ - u32 FileRegOff; /* Offset of register file */ - u32 FileRegsize; /* size of register file */ - u32 SramOff; /* Offset of Sram */ - u32 Sramsize; /* size of Sram */ - u32 DramOff; /* Offset of Dram */ - u32 Dramsize; /* size of Dram */ - CORE_Q queues[SLIC_MAX_QUEUE]; /* size and offsets of queues */ - u32 CamAMOff; /* Offset of CAM A contents */ - u32 CamASize; /* Size of Cam A */ - u32 CamBMOff; /* Offset of CAM B contents */ - u32 CamBSize; /* Size of Cam B */ - u32 CamCMOff; /* Offset of CAM C contents */ - u32 CamCSize; /* Size of Cam C */ - u32 CamDMOff; /* Offset of CAM D contents */ - u32 CamDSize; /* Size of Cam D */ -}; - -/* - * definitions needed for our kernel-mode gdb stub. - */ -/*********************************************************************** - * - * Definitions & Typedefs - * - **********************************************************************/ -#define BUFMAX 0x20000 /* 128k - size of input/output buffer */ -#define BUFMAXP2 5 /* 2**5 (32) 4K pages */ - -#define IOCTL_SIMBA_BREAK _IOW('s', 0, unsigned long) -/* #define IOCTL_SIMBA_INIT _IOW('s', 1, unsigned long) */ -#define IOCTL_SIMBA_KILL_TGT_PROC _IOW('s', 2, unsigned long) - -/*********************************************************************** - * - * Global variables - * - ***********************************************************************/ - -#define THREADRECEIVE 1 /* bit 0 of StoppedThreads */ -#define THREADTRANSMIT 2 /* bit 1 of StoppedThreads */ -#define THREADBOTH 3 /* bit 0 and 1.. */ - -#endif /* _SLIC_DUMP_H */ diff --git a/drivers/staging/slicoss/slicinc.h b/drivers/staging/slicoss/slicinc.h index 2c70d63fa5b..09e89c108ed 100644 --- a/drivers/staging/slicoss/slicinc.h +++ b/drivers/staging/slicoss/slicinc.h @@ -145,36 +145,4 @@ static int slic_upr_queue_request(struct adapter *adapter, static void slic_mcast_set_list(struct net_device *dev); static void slic_mcast_init_crc32(void); -#if SLIC_DUMP_ENABLED -static int slic_dump_thread(void *context); -static uint slic_init_dump_thread(struct sliccard *card); -static unsigned char slic_get_dump_index(char *path); -static u32 slic_dump_card(struct sliccard *card, bool resume); -static u32 slic_dump_halt(struct sliccard *card, unsigned char proc); -static u32 slic_dump_reg(struct sliccard *card, unsigned char proc); -static u32 slic_dump_data(struct sliccard *card, u32 addr, - ushort count, unsigned char desc); -static u32 slic_dump_queue(struct sliccard *card, u32 buf_phys, - u32 buf_physh, u32 queue); -static u32 slic_dump_load_queue(struct sliccard *card, u32 data, - u32 queue); -static u32 slic_dump_cam(struct sliccard *card, u32 addr, - u32 count, unsigned char desc); - -static u32 slic_dump_resume(struct sliccard *card, unsigned char proc); -static u32 slic_dump_send_cmd(struct sliccard *card, u32 cmd_phys, - u32 cmd_physh, u32 buf_phys, - u32 buf_physh); - -#define create_file(x) STATUS_SUCCESS -#define write_file(w, x, y, z) STATUS_SUCCESS -#define close_file(x) STATUS_SUCCESS -#define read_file(w, x, y, z) STATUS_SUCCESS -#define open_file(x) STATUS_SUCCESS - -/* PAGE_SIZE * 16 */ -#define DUMP_PAGE_SIZE 0xFFFF -#define DUMP_PAGE_SIZE_HALF 0x7FFE -#endif - #endif /* _SLIC_INCLUDE_H_ */ diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index e0016f79969..bef3a0b5829 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -55,7 +55,6 @@ */ -#define SLIC_DUMP_ENABLED 0 #define KLUDGE_FOR_4GB_BOUNDARY 1 #define DEBUG_MICROCODE 1 #define DBG 1 @@ -105,10 +104,6 @@ #include <linux/uaccess.h> #include "slicinc.h" -#if SLIC_DUMP_ENABLED -#include "slicdump.h" -#endif - #define SLIC_POWER_MANAGEMENT 0 static uint slic_first_init = 1; @@ -127,8 +122,6 @@ static struct net_device *head_netdevice; static struct base_driver slic_global = { {}, 0, 0, 0, 1, NULL, NULL }; static int intagg_delay = 100; static u32 dynamic_intagg; -static int errormsg; -static int goodmsg; static unsigned int rcv_count; static struct dentry *slic_debugfs; @@ -541,25 +534,12 @@ static int slic_entry_open(struct net_device *dev) card->master, adapter); if (!card->master) card->master = adapter; -#if SLIC_DUMP_ENABLED - if (!(card->dumpthread_running)) - init_waitqueue_head(&card->dump_wq); -#endif if (locked) { spin_unlock_irqrestore(&slic_global.driver_lock.lock, slic_global.driver_lock.flags); locked = 0; } -#if SLIC_DUMP_ENABLED - if (!(card->dumpthread_running)) { - DBG_MSG("attempt to initialize dump thread\n"); - status = slic_init_dump_thread(card); - /* - Even if the dump thread fails, we will continue at this point - */ - } -#endif return STATUS_SUCCESS; } @@ -672,30 +652,6 @@ static int slic_entry_halt(struct net_device *dev) #ifdef AUTOMATIC_RESET if (!card->adapters_activated) { - -#if SLIC_DUMP_ENABLED - if (card->dumpthread_running) { - uint status; - DBG_MSG("attempt to terminate dump thread pid[%x]\n", - card->dump_task_id); - status = kill_proc(card->dump_task_id->pid, SIGKILL, 1); - - if (!status) { - int count = 10 * 100; - while (card->dumpthread_running && --count) { - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); - } - - if (!count) { - DBG_MSG - ("slicmon thread cleanup FAILED \ - pid[%x]\n", - card->dump_task_id->pid); - } - } - } -#endif DBG_MSG("slicoss: %s (%s) initiate CARD_HALT\n", __func__, dev->name); @@ -737,37 +693,6 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) slic_intagg_set(adapter, intagg); return 0; } -#ifdef SLIC_USER_REQUEST_DUMP_ENABLED - case SIOCSLICDUMPCARD: - { - struct adapter *adapter = netdev_priv(dev); - struct sliccard *card; - - ASSERT(adapter); - ASSERT(adapter->card) - card = adapter->card; - - DBG_IOCTL("slic_ioctl SIOCSLIC_DUMP_CARD\n"); - - if (card->dump_requested == SLIC_DUMP_DONE) { - printk(SLICLEVEL - "SLIC Card dump to be overwritten\n"); - card->dump_requested = SLIC_DUMP_REQUESTED; - } else if ((card->dump_requested == SLIC_DUMP_REQUESTED) - || (card->dump_requested == - SLIC_DUMP_IN_PROGRESS)) { - printk(SLICLEVEL - "SLIC Card dump Requested but already \ - in progress... ignore\n"); - } else { - printk(SLICLEVEL - "SLIC Card #%d Dump Requested\n", - card->cardnum); - card->dump_requested = SLIC_DUMP_REQUESTED; - } - return 0; - } -#endif #ifdef SLIC_TRACE_DUMP_ENABLED case SIOCSLICTRACEDUMP: @@ -1418,8 +1343,7 @@ static void slic_init_cleanup(struct adapter *adapter) del_timer(&adapter->statstimer); } #endif -#if !SLIC_DUMP_ENABLED && SLIC_PING_TIMER_ENABLED -/*#if SLIC_DUMP_ENABLED && SLIC_PING_TIMER_ENABLED*/ +#if SLIC_PING_TIMER_ENABLED if (adapter->pingtimerset) { DBG_MSG("pingtimer "); adapter->pingtimerset = 0; @@ -1663,38 +1587,7 @@ static void slic_timer_ping(ulong dev) ASSERT(adapter); card = adapter->card; ASSERT(card); -#if !SLIC_DUMP_ENABLED -/*#if SLIC_DUMP_ENABLED*/ - if ((adapter->state == ADAPT_UP) && (card->state == CARD_UP)) { - int status; - if (card->pingstatus != ISR_PINGMASK) { - if (errormsg++ < 5) { - DBG_MSG - ("%s (%s) CARD HAS CRASHED PING_status == \ - %x ERRORMSG# %d\n", - __func__, adapter->netdev->name, - card->pingstatus, errormsg); - } - /* ASSERT(card->pingstatus == ISR_PINGMASK); */ - } else { - if (goodmsg++ < 5) { - DBG_MSG - ("slicoss: %s (%s) PING_status == %x \ - GOOD!!!!!!!! msg# %d\n", - __func__, adapter->netdev->name, - card->pingstatus, errormsg); - } - } - card->pingstatus = 0; - status = slic_upr_request(adapter, SLIC_UPR_PING, 0, 0, 0, 0); - - ASSERT(status == 0); - } else { - DBG_MSG("slicoss %s (%s) adapter[%p] NOT UP!!!!\n", - __func__, adapter->netdev->name, adapter); - } -#endif adapter->pingtimer.expires = jiffies + (PING_TIMER_INTERVAL * HZ); add_timer(&adapter->pingtimer); } @@ -1835,8 +1728,7 @@ static int slic_if_init(struct adapter *adapter) adapter->statstimerset = 1; } #endif -#if !SLIC_DUMP_ENABLED && SLIC_PING_TIMER_ENABLED -/*#if SLIC_DUMP_ENABLED && SLIC_PING_TIMER_ENABLED*/ +#if SLIC_PING_TIMER_ENABLED if (!adapter->pingtimerset) { DBG_MSG("slicoss: %s start card_ping_timer(slic)\n", __func__); @@ -2121,23 +2013,6 @@ static void slic_card_cleanup(struct sliccard *card) { DBG_MSG("slicoss: %s ENTER\n", __func__); -#if SLIC_DUMP_ENABLED - if (card->dumpbuffer) { - card->dumpbuffer_phys = 0; - card->dumpbuffer_physl = 0; - card->dumpbuffer_physh = 0; - kfree(card->dumpbuffer); - card->dumpbuffer = NULL; - } - if (card->cmdbuffer) { - card->cmdbuffer_phys = 0; - card->cmdbuffer_physl = 0; - card->cmdbuffer_physh = 0; - kfree(card->cmdbuffer); - card->cmdbuffer = NULL; - } -#endif - if (card->loadtimerset) { card->loadtimerset = 0; del_timer(&card->loadtimer); @@ -2616,43 +2491,6 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) */ card->pingstatus = ISR_PINGMASK; -#if SLIC_DUMP_ENABLED - if (!card->dumpbuffer) { - card->dumpbuffer = kmalloc(DUMP_PAGE_SIZE, GFP_KERNEL); - - ASSERT(card->dumpbuffer); - if (card->dumpbuffer == NULL) - return -ENOMEM; - } - /* - * Smear the shared memory structure and then obtain - * the PHYSICAL address of this structure - */ - memset(card->dumpbuffer, 0, DUMP_PAGE_SIZE); - card->dumpbuffer_phys = virt_to_bus(card->dumpbuffer); - card->dumpbuffer_physh = SLIC_GET_ADDR_HIGH(card->dumpbuffer_phys); - card->dumpbuffer_physl = SLIC_GET_ADDR_LOW(card->dumpbuffer_phys); - - /* - * Allocate COMMAND BUFFER - */ - if (!card->cmdbuffer) { - card->cmdbuffer = kmalloc(sizeof(struct dump_cmd), GFP_KERNEL); - - ASSERT(card->cmdbuffer); - if (card->cmdbuffer == NULL) - return -ENOMEM; - } - /* - * Smear the shared memory structure and then obtain - * the PHYSICAL address of this structure - */ - memset(card->cmdbuffer, 0, sizeof(struct dump_cmd)); - card->cmdbuffer_phys = virt_to_bus(card->cmdbuffer); - card->cmdbuffer_physh = SLIC_GET_ADDR_HIGH(card->cmdbuffer_phys); - card->cmdbuffer_physl = SLIC_GET_ADDR_LOW(card->cmdbuffer_phys); -#endif - /* * Lastly, mark our card state as up and return success */ @@ -3371,11 +3209,6 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) case SLIC_UPR_PING: card->pingstatus |= (isr & ISR_PINGDSMASK); break; -#if SLIC_DUMP_ENABLED - case SLIC_UPR_DUMP: - card->dumpstatus |= (isr & ISR_UPCMASK); - break; -#endif default: ASSERT(0); } @@ -3434,19 +3267,6 @@ static void slic_upr_start(struct adapter *adapter) upr->upr_data, &slic_regs->slic_addr_upper, upr->upr_data_h, FLUSH); break; -#if SLIC_DUMP_ENABLED - case SLIC_UPR_DUMP: - if (upr->upr_buffer || upr->upr_buffer_h) { - slic_reg64_write(adapter, &slic_regs->slic_dump_data, - upr->upr_buffer, - &slic_regs->slic_addr_upper, - upr->upr_buffer_h, FLUSH); - } - slic_reg64_write(adapter, &slic_regs->slic_dump_cmd, - upr->upr_data, slic_regs->slic_addr_upper, - upr->upr_data_h, FLUSH); - break; -#endif case SLIC_UPR_PING: slic_reg32_write(&slic_regs->slic_ping, 1, FLUSH); break; @@ -4771,1030 +4591,6 @@ static void slic_debug_cleanup(void) } } -/*============================================================================= - ============================================================================= - === === - === SLIC DUMP MANAGEMENT SECTION === - === === - === === - === Dump routines === - === === - === === - ============================================================================= - ============================================================================*/ - -#if SLIC_DUMP_ENABLED - -#include <stdarg.h> - -void *slic_dump_handle; /* thread handle */ - -/* - * These are the only things you should do on a core-file: use only these - * functions to write out all the necessary info. - */ -static int slic_dump_seek(struct file *SLIChandle, u32 file_offset) -{ - if (SLIChandle->f_pos != file_offset) { - /*DBG_MSG("slic_dump_seek now needed [%x : %x]\n", - (u32)SLIChandle->f_pos, (u32)file_offset); */ - if (SLIChandle->f_op->llseek) { - if (SLIChandle->f_op-> - llseek(SLIChandle, file_offset, 0) != file_offset) - return 0; - } else { - SLIChandle->f_pos = file_offset; - } - } - return 1; -} - -static int slic_dump_write(struct sliccard *card, - const void *addr, int size, u32 file_offset) -{ - int r = 1; - u32 result = 0; - struct file *SLIChandle = card->dumphandle; - -#ifdef HISTORICAL /* legacy */ - down(&SLIChandle->f_dentry->d_inode->i_sem); -#endif - if (size) { - slic_dump_seek(SLIChandle, file_offset); - - result = - SLIChandle->f_op->write(SLIChandle, addr, size, - &SLIChandle->f_pos); - - r = result == size; - } - - card->dumptime_complete = jiffies; - card->dumptime_delta = card->dumptime_complete - card->dumptime_start; - card->dumptime_start = jiffies; - -#ifdef HISTORICAL - up(&SLIChandle->f_dentry->d_inode->i_sem); -#endif - if (!r) { - DBG_ERROR("%s: addr[%p] size[%x] result[%x] file_offset[%x]\n", - __func__, addr, size, result, file_offset); - } - return r; -} - -static uint slic_init_dump_thread(struct sliccard *card) -{ - card->dump_task_id = kthread_run(slic_dump_thread, (void *)card, 0); - -/* DBG_MSG("create slic_dump_thread dump_pid[%x]\n", card->dump_pid); */ - if (IS_ERR(card->dump_task_id)) { - DBG_MSG("create slic_dump_thread FAILED \n"); - return STATUS_FAILURE; - } - - return STATUS_SUCCESS; -} - -static int slic_dump_thread(void *context) -{ - struct sliccard *card = (struct sliccard *)context; - struct adapter *adapter; - struct adapter *dump_adapter = NULL; - u32 dump_complete = 0; - u32 delay = (PING_TIMER_INTERVAL * HZ); - struct slic_regs *pregs; - u32 i; - struct slic_upr *upr, *uprnext; - u32 dump_card; - - ASSERT(card); - - card->dumpthread_running = 1; - -#ifdef HISTORICAL - lock_kernel(); - /* - * This thread doesn't need any user-level access, - * so get rid of all our resources - */ - exit_files(current); /* daemonize doesn't do exit_files */ - current->files = init_task.files; - atomic_inc(¤t->files->count); -#endif - - daemonize("%s", "slicmon"); - - /* Setup a nice name */ - strcpy(current->comm, "slicmon"); - DBG_ERROR - ("slic_dump_thread[slicmon] daemon is alive card[%p] pid[%x]\n", - card, card->dump_task_id->pid); - - /* - * Send me a signal to get me to die (for debugging) - */ - do { - /* - * If card state is not set to up, skip - */ - if (card->state != CARD_UP) { - if (card->adapters_activated) - goto wait; - else - goto end_thread; - } - /* - * Check the results of our last ping. - */ - dump_card = 0; -#ifdef SLIC_FAILURE_DUMP - if (card->pingstatus != ISR_PINGMASK) { - DBG_MSG - ("\n[slicmon] CARD #%d TIMED OUT - status " - "%x: DUMP THE CARD!\n", - card->cardnum, card->pingstatus); - dump_card = 1; - } -#else - /* - * Cause a card RESET instead? - */ - if (card->pingstatus != ISR_PINGMASK) { - /* todo. do we want to reset the card in production */ - /* DBG_MSG("\n[slicmon] CARD #%d TIMED OUT - " - status %x: RESET THE CARD!\n", card->cardnum, - card->pingstatus); */ - DBG_ERROR - ("\n[slicmon] CARD #%d TIMED OUT - status %x: " - "DUMP THE CARD!\n", - card->cardnum, card->pingstatus); - dump_card = 1; - } -#endif - if ((dump_card) - || (card->dump_requested == SLIC_DUMP_REQUESTED)) { - if (card->dump_requested == SLIC_DUMP_REQUESTED) { - DBG_ERROR - ("[slicmon]: Dump card Requested: Card %x\n", - card->cardnum); - } - if (card->pingstatus != ISR_PINGMASK) { - ushort cpuid = 0; - ushort crashpc = 0; - - if (card->adapter[0]) { - if ((card->adapter[0])->memorylength >= - CRASH_INFO_OFFSET + - sizeof(slic_crash_info)) { - char *crashptr; - p_slic_crash_info crashinfo; - - crashptr = - ((char *)card->adapter[0]-> - slic_regs) + - CRASH_INFO_OFFSET; - crashinfo = - (p_slic_crash_info) - crashptr; - cpuid = crashinfo->cpu_id; - crashpc = crashinfo->crash_pc; - } - } - DBG_ERROR - ("[slicmon]: Dump card: Card %x crashed " - "and failed to answer PING. " - "CPUID[%x] PC[%x]\n ", - card->cardnum, cpuid, crashpc); - } - - card->dump_requested = SLIC_DUMP_IN_PROGRESS; - - /* - * Set the card state to DOWN and the adapter states - * to RESET.They will check this in SimbaCheckForHang - * and initiate interface reset (which in turn will - * reinitialize the card). - */ - card->state = CARD_DOWN; - - for (i = 0; i < card->card_size; i++) { - adapter = card->adapter[i]; - if (adapter) { - slic_if_stop_queue(adapter); - - if (adapter->state == ADAPT_UP) { - adapter->state = ADAPT_RESET; - adapter->linkstate = LINK_DOWN; - DBG_ERROR - ("[slicmon]: SLIC Card[%d] " - "Port[%d] adapter[%p] " - "down\n", - (uint) card->cardnum, - (uint) i, adapter); - } -#if SLIC_GET_STATS_TIMER_ENABLED - /* free stats timer */ - if (adapter->statstimerset) { - adapter->statstimerset = 0; - del_timer(&adapter->statstimer); - } -#endif - } - } - - for (i = 0; i < card->card_size; i++) { - adapter = card->adapter[i]; - if ((adapter) && (adapter->activated)) { - pregs = adapter->slic_regs; - dump_adapter = adapter; - - /* - * If the dump status is zero, then - * the utility processor has crashed. - * If this is the case, any pending - * utilityprocessor requests will not - * complete and our dump commands will - * not be issued. - * - * To avoid this we will clear any - * pending utility processor requests - * now. - */ - if (!card->pingstatus) { - spin_lock_irqsave( - &adapter->upr_lock.lock, - adapter->upr_lock.flags); - upr = adapter->upr_list; - while (upr) { - uprnext = upr->next; - kfree(upr); - upr = uprnext; - } - adapter->upr_list = 0; - adapter->upr_busy = 0; - spin_unlock_irqrestore( - &adapter->upr_lock.lock, - adapter->upr_lock.flags); - } - - slic_dump_card(card, false); - dump_complete = 1; - } - - if (dump_complete) { - DBG_ERROR("SLIC Dump Complete\n"); - /* Only dump the card one time */ - break; - } - } - - if (dump_adapter) { - DBG_ERROR - ("slic dump completed. " - "Reenable interfaces\n"); - slic_card_init(card, dump_adapter); - - /* - * Reenable the adapters that were reset - */ - for (i = 0; i < card->card_size; i++) { - adapter = card->adapter[i]; - if (adapter) { - if (adapter->state == - ADAPT_RESET) { - DBG_ERROR - ("slicdump: SLIC " - "Card[%d] Port[%d] adapter[%p] " - "bring UP\n", - (uint) card-> - cardnum, (uint) i, - adapter); - adapter->state = - ADAPT_DOWN; - adapter->linkstate = - LINK_DOWN; - slic_entry_open - (adapter->netdev); - } - } - } - - card->dump_requested = SLIC_DUMP_DONE; - } - } else { - /* if pingstatus != ISR_PINGMASK) || dump_requested...ELSE - * We received a valid ping response. - * Clear the Pingstatus field, find a valid adapter - * structure and send another ping. - */ - for (i = 0; i < card->card_size; i++) { - adapter = card->adapter[i]; - if (adapter && (adapter->state == ADAPT_UP)) { - card->pingstatus = 0; - slic_upr_request(adapter, SLIC_UPR_PING, - 0, 0, 0, 0); - break; /* Only issue one per card */ - } - } - } -wait: - SLIC_INTERRUPTIBLE_SLEEP_ON_TIMEOUT(card->dump_wq, delay); - } while (!signal_pending(current)); - -end_thread: -/* DBG_MSG("[slicmon] slic_dump_thread card[%p] pid[%x] ENDING\n", - card, card->dump_pid); */ - card->dumpthread_running = 0; - - return 0; -} - -/* - * Read a single byte from our dump index file. This - * value is used as our suffix for our dump path. The - * value is incremented and written back to the file - */ -static unsigned char slic_get_dump_index(char *path) -{ - unsigned char index = 0; -#ifdef SLIC_DUMP_INDEX_SUPPORT - u32 status; - void *FileHandle; - u32 offset; - - offset = 0; - - /* - * Open the index file. If one doesn't exist, create it - */ - status = create_file(&FileHandle); - - if (status != STATUS_SUCCESS) - return (unsigned char) 0; - - status = read_file(FileHandle, &index, 1, &offset); - - index++; - - status = write_file(FileHandle, &index, 1, &offset); - - close_file(FileHandle); -#else - index = 0; -#endif - return index; -} - -static struct file *slic_dump_open_file(struct sliccard *card) -{ - struct file *SLIChandle = NULL; - struct dentry *dentry = NULL; - struct inode *inode = NULL; - char SLICfile[50]; - - card->dumpfile_fs = get_fs(); - - set_fs(KERNEL_DS); - - memset(SLICfile, 0, sizeof(SLICfile)); - sprintf(SLICfile, "/var/tmp/slic%d-dump-%d", card->cardnum, - (uint) card->dump_count); - card->dump_count++; - - SLIChandle = - filp_open(SLICfile, O_CREAT | O_RDWR | O_SYNC | O_LARGEFILE, 0666); - - DBG_MSG("[slicmon]: Dump Card #%d to file: %s \n", card->cardnum, - SLICfile); - -/* DBG_MSG("[slicmon] filp_open %s SLIChandle[%p]\n", SLICfile, SLIChandle);*/ - - if (IS_ERR(SLIChandle)) - goto end_slicdump; - - dentry = SLIChandle->f_dentry; - inode = dentry->d_inode; - -/* DBG_MSG("[slicmon] inode[%p] i_nlink[%x] i_mode[%x] i_op[%p] i_fop[%p]\n" - "f_op->write[%p]\n", - inode, inode->i_nlink, inode->i_mode, inode->i_op, - inode->i_fop, SLIChandle->f_op->write); */ - if (inode->i_nlink > 1) - goto close_slicdump; /* multiple links - don't dump */ -#ifdef HISTORICAL - if (!S_ISREG(inode->i_mode)) - goto close_slicdump; -#endif - if (!inode->i_op || !inode->i_fop) - goto close_slicdump; - - if (!SLIChandle->f_op->write) - goto close_slicdump; - - /* - * If we got here we have SUCCESSFULLY OPENED the dump file - */ -/* DBG_MSG("opened %s SLIChandle[%p]\n", SLICfile, SLIChandle); */ - return SLIChandle; - -close_slicdump: - DBG_MSG("[slicmon] slic_dump_open_file failed close SLIChandle[%p]\n", - SLIChandle); - filp_close(SLIChandle, NULL); - -end_slicdump: - set_fs(card->dumpfile_fs); - - return NULL; -} - -static void slic_dump_close_file(struct sliccard *card) -{ - -/* DBG_MSG("[slicmon] slic_dump_CLOSE_file close SLIChandle[%p]\n", - card->dumphandle); */ - - filp_close(card->dumphandle, NULL); - - set_fs(card->dumpfile_fs); -} - -static u32 slic_dump_card(struct sliccard *card, bool resume) -{ - struct adapter *adapter = card->master; - u32 status; - u32 queue; - u32 len, offset; - u32 sram_size, dram_size, regs; - struct sliccore_hdr corehdr; - u32 file_offset; - char *namestr; - u32 i; - u32 max_queues = 0; - u32 result; - - card->dumphandle = slic_dump_open_file(card); - - if (card->dumphandle == NULL) { - DBG_MSG("[slicmon] Cant create Dump file - dump failed\n"); - return -ENOMEM; - } - if (!card->dumpbuffer) { - DBG_MSG("[slicmon] Insufficient memory for dump\n"); - return -ENOMEM; - } - if (!card->cmdbuffer) { - DBG_MSG("[slicmon] Insufficient cmd memory for dump\n"); - return -ENOMEM; - } - - /* - * Write the file version to the core header. - */ - namestr = slic_proc_version; - for (i = 0; i < (DRIVER_NAME_SIZE - 1); i++, namestr++) { - if (!namestr) - break; - corehdr.driver_version[i] = *namestr; - } - corehdr.driver_version[i] = 0; - - file_offset = sizeof(struct sliccore_hdr); - - /* - * Issue the following debug commands to the SLIC: - * - Halt both receive and transmit - * - Dump receive registers - * - Dump transmit registers - * - Dump sram - * - Dump dram - * - Dump queues - */ - DBG_MSG("slicDump HALT Receive Processor\n"); - card->dumptime_start = jiffies; - - status = slic_dump_halt(card, PROC_RECEIVE); - if (status != STATUS_SUCCESS) { - DBG_ERROR - ("Cant halt receive sequencer - dump failed status[%x]\n", - status); - goto done; - } - - DBG_MSG("slicDump HALT Transmit Processor\n"); - status = slic_dump_halt(card, PROC_TRANSMIT); - if (status != STATUS_SUCCESS) { - DBG_ERROR("Cant halt transmit sequencer - dump failed\n"); - goto done; - } - - /* Dump receive regs */ - status = slic_dump_reg(card, PROC_RECEIVE); - if (status != STATUS_SUCCESS) { - DBG_ERROR("Cant dump receive registers - dump failed\n"); - goto done; - } - - DBG_MSG("slicDump Write Receive REGS len[%x] offset[%x]\n", - (SLIC_NUM_REG * 4), file_offset); - - result = - slic_dump_write(card, card->dumpbuffer, SLIC_NUM_REG * 4, - file_offset); - if (!result) { - DBG_ERROR - ("Cant write rcv registers to dump file - dump failed\n"); - goto done; - } - - corehdr.RcvRegOff = file_offset; - corehdr.RcvRegsize = SLIC_NUM_REG * 4; - file_offset += SLIC_NUM_REG * 4; - - /* Dump transmit regs */ - status = slic_dump_reg(card, PROC_TRANSMIT); - if (status != STATUS_SUCCESS) { - DBG_ERROR("Cant dump transmit registers - dump failed\n"); - goto done; - } - - DBG_MSG("slicDump Write XMIT REGS len[%x] offset[%x]\n", - (SLIC_NUM_REG * 4), file_offset); - - result = - slic_dump_write(card, card->dumpbuffer, SLIC_NUM_REG * 4, - file_offset); - if (!result) { - DBG_ERROR - ("Cant write xmt registers to dump file - dump failed\n"); - goto done; - } - - corehdr.XmtRegOff = file_offset; - corehdr.XmtRegsize = SLIC_NUM_REG * 4; - file_offset += SLIC_NUM_REG * 4; - - regs = SLIC_GBMAX_REG; - - corehdr.FileRegOff = file_offset; - corehdr.FileRegsize = regs * 4; - - for (offset = 0; regs;) { - len = MIN(regs, 16); /* Can only xfr 16 regs at a time */ - - status = slic_dump_data(card, offset, (ushort) len, DESC_RFILE); - - if (status != STATUS_SUCCESS) { - DBG_ERROR("Cant dump register file - dump failed\n"); - goto done; - } - - DBG_MSG("slicDump Write RegisterFile len[%x] offset[%x]\n", - (len * 4), file_offset); - - result = - slic_dump_write(card, card->dumpbuffer, len * 4, - file_offset); - if (!result) { - DBG_ERROR - ("Cant write register file to dump file - " - "dump failed\n"); - goto done; - } - - file_offset += len * 4; - offset += len; - regs -= len; - } - - dram_size = card->config.DramSize * 0x10000; - - switch (adapter->devid) { - case SLIC_2GB_DEVICE_ID: - sram_size = SLIC_SRAM_SIZE2GB; - break; - case SLIC_1GB_DEVICE_ID: - sram_size = SLIC_SRAM_SIZE1GB; - break; - default: - sram_size = 0; - ASSERT(0); - break; - } - - corehdr.SramOff = file_offset; - corehdr.Sramsize = sram_size; - - for (offset = 0; sram_size;) { - len = MIN(sram_size, DUMP_BUF_SIZE); - status = slic_dump_data(card, offset, (ushort) len, DESC_SRAM); - if (status != STATUS_SUCCESS) { - DBG_ERROR - ("[slicmon] Cant dump SRAM at offset %x - " - "dump failed\n", (uint) offset); - goto done; - } - - DBG_MSG("[slicmon] slicDump Write SRAM len[%x] offset[%x]\n", - len, file_offset); - - result = - slic_dump_write(card, card->dumpbuffer, len, file_offset); - if (!result) { - DBG_ERROR - ("[slicmon] Cant write SRAM to dump file - " - "dump failed\n"); - goto done; - } - - file_offset += len; - offset += len; - sram_size -= len; - } - - corehdr.DramOff = file_offset; - corehdr.Dramsize = dram_size; - - for (offset = 0; dram_size;) { - len = MIN(dram_size, DUMP_BUF_SIZE); - - status = slic_dump_data(card, offset, (ushort) len, DESC_DRAM); - if (status != STATUS_SUCCESS) { - DBG_ERROR - ("[slicmon] Cant dump dram at offset %x - " - "dump failed\n", (uint) offset); - goto done; - } - - DBG_MSG("slicDump Write DRAM len[%x] offset[%x]\n", len, - file_offset); - - result = - slic_dump_write(card, card->dumpbuffer, len, file_offset); - if (!result) { - DBG_ERROR - ("[slicmon] Cant write DRAM to dump file - " - "dump failed\n"); - goto done; - } - - file_offset += len; - offset += len; - dram_size -= len; - } - - max_queues = SLIC_MAX_QUEUE; - - for (queue = 0; queue < max_queues; queue++) { - u32 *qarray = (u32 *) card->dumpbuffer; - u32 qarray_physl = card->dumpbuffer_physl; - u32 qarray_physh = card->dumpbuffer_physh; - u32 qstart; - u32 qdelta; - u32 qtotal = 0; - - DBG_MSG("[slicmon] Start Dump of QUEUE #0x%x\n", (uint) queue); - - for (offset = 0; offset < (DUMP_BUF_SIZE >> 2); offset++) { - qstart = jiffies; - qdelta = 0; - - status = slic_dump_queue(card, - qarray_physl, - qarray_physh, queue); - qarray_physl += 4; - - if (status != STATUS_SUCCESS) - break; - - if (jiffies > qstart) { - qdelta = jiffies - qstart; - qtotal += qdelta; - } - } - - if (offset) - qdelta = qtotal / offset; - else - qdelta = 0; - -/* DBG_MSG(" slicDump Write QUEUE #0x%x len[%x] offset[%x] " - "avgjiffs[%x]\n", queue, (offset*4), file_offset, qdelta); */ - - result = - slic_dump_write(card, card->dumpbuffer, offset * 4, - file_offset); - - if (!result) { - DBG_ERROR - ("[slicmon] Cant write QUEUES to dump file - " - "dump failed\n"); - goto done; - } - - corehdr.queues[queue].queueOff = file_offset; - corehdr.queues[queue].queuesize = offset * 4; - file_offset += offset * 4; - -/* DBG_MSG(" Reload QUEUE #0x%x elements[%x]\n", (uint)queue, offset);*/ - /* - * Fill the queue back up - */ - for (i = 0; i < offset; i++) { - qstart = jiffies; - qdelta = 0; - - status = slic_dump_load_queue(card, qarray[i], queue); - if (status != STATUS_SUCCESS) - break; - - if (jiffies > qstart) { - qdelta = jiffies - qstart; - qtotal += qdelta; - } - } - - if (offset) - qdelta = qtotal / offset; - else - qdelta = 0; - -/* DBG_MSG(" Reload DONE avgjiffs[%x]\n", qdelta); */ - - resume = 1; - } - - len = SLIC_GB_CAMAB_SZE * 4; - status = slic_dump_cam(card, 0, len, DUMP_CAM_A); - if (status != STATUS_SUCCESS) { - DBG_ERROR("[slicmon] Can't dump CAM_A - dump failed\n"); - goto done; - } - - result = slic_dump_write(card, card->dumpbuffer, len, file_offset); - if (result) { - DBG_ERROR - ("[slicmon] Can't write CAM_A data to dump file - " - "dump failed\n"); - goto done; - } - corehdr.CamAMOff = file_offset; - corehdr.CamASize = len; - file_offset += len; - - len = SLIC_GB_CAMCD_SZE * 4; - status = slic_dump_cam(card, 0, len, DUMP_CAM_C); - if (status) { - DBG_ERROR("[slicmon] Can't dump CAM_C - dump failed\n"); - goto done; - } - - result = slic_dump_write(card, card->dumpbuffer, len, file_offset); - if (result) { - DBG_ERROR - ("[slicmon] Can't write CAM_C data to dump file - " - "dump failed\n"); - goto done; - } - corehdr.CamCMOff = file_offset; - corehdr.CamCSize = len; - file_offset += len; - -done: - /* - * Write out the core header - */ - file_offset = 0; - DBG_MSG("[slicmon] Write CoreHeader len[%x] offset[%x]\n", - (uint) sizeof(struct sliccore_hdr), file_offset); - - result = - slic_dump_write(card, &corehdr, sizeof(struct sliccore_hdr), - file_offset); - DBG_MSG("[slicmon] corehdr xoff[%x] xsz[%x]\n" - " roff[%x] rsz[%x] fileoff[%x] filesz[%x]\n" - " sramoff[%x] sramsz[%x], dramoff[%x] dramsz[%x]\n" - " corehdr_offset[%x]\n", corehdr.XmtRegOff, - corehdr.XmtRegsize, corehdr.RcvRegOff, corehdr.RcvRegsize, - corehdr.FileRegOff, corehdr.FileRegsize, corehdr.SramOff, - corehdr.Sramsize, corehdr.DramOff, corehdr.Dramsize, - (uint) sizeof(struct sliccore_hdr)); - for (i = 0; i < max_queues; i++) { - DBG_MSG("[slicmon] QUEUE 0x%x offset[%x] size[%x]\n", - (uint) i, corehdr.queues[i].queueOff, - corehdr.queues[i].queuesize); - - } - - slic_dump_close_file(card); - - if (resume) { - DBG_MSG("slicDump RESTART RECEIVE and XMIT PROCESSORS\n\n"); - slic_dump_resume(card, PROC_RECEIVE); - slic_dump_resume(card, PROC_TRANSMIT); - } - - return status; -} - -static u32 slic_dump_halt(struct sliccard *card, unsigned char proc) -{ - unsigned char *cmd = card->cmdbuffer; - - *cmd = COMMAND_BYTE(CMD_HALT, 0, proc); - - return slic_dump_send_cmd(card, - card->cmdbuffer_physl, - card->cmdbuffer_physh, 0, 0); -} - -static u32 slic_dump_resume(struct sliccard *card, unsigned char proc) -{ - unsigned char *cmd = card->cmdbuffer; - - *cmd = COMMAND_BYTE(CMD_RUN, 0, proc); - - return slic_dump_send_cmd(card, - card->cmdbuffer_physl, - card->cmdbuffer_physh, 0, 0); -} - -static u32 slic_dump_reg(struct sliccard *card, unsigned char proc) -{ - struct dump_cmd *dump = (struct dump_cmd *)card->cmdbuffer; - - dump->cmd = COMMAND_BYTE(CMD_DUMP, 0, proc); - dump->desc = DESC_REG; - dump->count = 0; - dump->addr = 0; - - return slic_dump_send_cmd(card, - card->cmdbuffer_physl, - card->cmdbuffer_physh, - card->dumpbuffer_physl, - card->dumpbuffer_physh); -} - -static u32 slic_dump_data(struct sliccard *card, - u32 addr, ushort count, unsigned char desc) -{ - struct dump_cmd *dump = (struct dump_cmd *)card->cmdbuffer; - - dump->cmd = COMMAND_BYTE(CMD_DUMP, 0, PROC_RECEIVE); - dump->desc = desc; - dump->count = count; - dump->addr = addr; - - return slic_dump_send_cmd(card, - card->cmdbuffer_physl, - card->cmdbuffer_physh, - card->dumpbuffer_physl, - card->dumpbuffer_physh); -} - -static u32 slic_dump_queue(struct sliccard *card, - u32 addr, u32 buf_physh, u32 queue) -{ - struct dump_cmd *dump = (struct dump_cmd *)card->cmdbuffer; - - dump->cmd = COMMAND_BYTE(CMD_DUMP, 0, PROC_RECEIVE); - dump->desc = DESC_QUEUE; - dump->count = 1; - dump->addr = queue; - - return slic_dump_send_cmd(card, - card->cmdbuffer_physl, - card->cmdbuffer_physh, - addr, card->dumpbuffer_physh); -} - -static u32 slic_dump_load_queue(struct sliccard *card, u32 data, - u32 queue) -{ - struct dump_cmd *load = (struct dump_cmd *) card->cmdbuffer; - - load->cmd = COMMAND_BYTE(CMD_LOAD, 0, PROC_RECEIVE); - load->desc = DESC_QUEUE; - load->count = (ushort) queue; - load->addr = data; - - return slic_dump_send_cmd(card, - card->cmdbuffer_physl, - card->cmdbuffer_physh, 0, 0); -} - -static u32 slic_dump_cam(struct sliccard *card, - u32 addr, u32 count, unsigned char desc) -{ - struct dump_cmd *dump = (struct dump_cmd *)card->cmdbuffer; - - dump->cmd = COMMAND_BYTE(CMD_CAM_OPS, 0, PROC_NONE); - dump->desc = desc; - dump->count = count; - dump->addr = 0; - - return slic_dump_send_cmd(card, - card->cmdbuffer_physl, - card->cmdbuffer_physh, - addr, card->dumpbuffer_physh); -} - -static u32 slic_dump_send_cmd(struct sliccard *card, - u32 cmd_physl, - u32 cmd_physh, - u32 buf_physl, u32 buf_physh) -{ - ulong timeout = msecs_to_jiffies(500); /* 500 msec */ - u32 attempts = 5; - u32 delay = msecs_to_jiffies(10); /* 10 msec */ - struct adapter *adapter = card->master; - - ASSERT(adapter); - do { - /* - * Zero the Dumpstatus field of the adapter structure - */ - card->dumpstatus = 0; - /* - * Issue the dump command via a utility processor request. - * - * Kludge: We use the Informationbuffer parameter to hold - * the buffer address - */ - slic_upr_request(adapter, SLIC_UPR_DUMP, cmd_physl, cmd_physh, - buf_physl, buf_physh); - - timeout += jiffies; - /* - * Spin until completion or timeout. - */ - while (!card->dumpstatus) { - int num_sleeps = 0; - - if (jiffies > timeout) { - /* - * Complete the timed-out DUMP UPR request. - */ - slic_upr_request_complete(adapter, 0); - DBG_ERROR - ("%s: TIMED OUT num_sleeps[%x] " - "status[%x]\n", - __func__, num_sleeps, STATUS_FAILURE); - - return STATUS_FAILURE; - } - num_sleeps++; - SLIC_INTERRUPTIBLE_SLEEP_ON_TIMEOUT(card->dump_wq, - delay); - } - - if (card->dumpstatus & ISR_UPCERR) { - /* - * Error (or queue empty) - */ -/* DBG_ERROR("[slicmon] %s: DUMP_STATUS & ISR_UPCERR status[%x]\n", - __func__, STATUS_FAILURE); */ - - return STATUS_FAILURE; - } else if (card->dumpstatus & ISR_UPCBSY) { - /* - * Retry - */ - DBG_ERROR("%s: ISR_UPCBUSY attempt[%x]\n", __func__, - attempts); - - attempts--; - } else { - /* - * success - */ - return STATUS_SUCCESS; - } - - } while (attempts); - - DBG_ERROR("%s: GAVE UP AFTER SEVERAL ATTEMPTS status[%x]\n", - __func__, STATUS_FAILURE); - - /* - * Gave up after several attempts - */ - return STATUS_FAILURE; -} - -#endif -/*============================================================================= - ============================================================================= - === === - === *** END **** END **** END **** END *** === - === SLIC DUMP MANAGEMENT SECTION === - === === - === === - === === - ============================================================================= - ============================================================================*/ - /******************************************************************************/ /**************** MODULE INITIATION / TERMINATION FUNCTIONS ***************/ /******************************************************************************/ |