|
@@ -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 ***************/
|
|
|
/******************************************************************************/
|