]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_mbox.c
[SCSI] lpfc 8.1.2: Add ERROR and WARM_START modes for diagnostic purposes.
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_mbox.c
index c27cf94795db52c7f3a520805443cb414963f356..df88b78707de61d4bccffdfb08b307b54167bede 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2005 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2006 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_transport_fc.h>
+
+#include <scsi/scsi.h>
+
 #include "lpfc_hw.h"
 #include "lpfc_sli.h"
 #include "lpfc_disc.h"
@@ -243,8 +248,7 @@ lpfc_read_sparam(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
 
        if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == 0) ||
            ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) {
-               if (mp)
-                       kfree(mp);
+               kfree(mp);
                mb->mbxCommand = MBX_READ_SPARM64;
                /* READ_SPARAM: no buffers */
                lpfc_printf_log(phba,
@@ -332,6 +336,23 @@ lpfc_read_config(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
        return;
 }
 
+/*************************************************/
+/*  lpfc_read_lnk_stat  Issue a READ LINK STATUS */
+/*                mailbox command                */
+/*************************************************/
+void
+lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
+{
+       MAILBOX_t *mb;
+
+       mb = &pmb->mb;
+       memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
+
+       mb->mbxCommand = MBX_READ_LNK_STAT;
+       mb->mbxOwner = OWN_HOST;
+       return;
+}
+
 /********************************************/
 /*  lpfc_reg_login  Issue a REG_LOGIN       */
 /*                  mailbox command         */
@@ -358,9 +379,7 @@ lpfc_reg_login(struct lpfc_hba * phba,
        /* Get a buffer to hold NPorts Service Parameters */
        if (((mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL)) == NULL) ||
            ((mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys))) == 0)) {
-               if (mp)
-                       kfree(mp);
-
+               kfree(mp);
                mb->mbxCommand = MBX_REG_LOGIN64;
                /* REG_LOGIN: no buffers */
                lpfc_printf_log(phba,
@@ -526,6 +545,7 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
        size_t offset;
        struct lpfc_hgp hgp;
        void __iomem *to_slim;
+       int i;
 
        memset(pmb, 0, sizeof(LPFC_MBOXQ_t));
        mb->mbxCommand = MBX_CONFIG_PORT;
@@ -582,7 +602,11 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
        /* write HGP data to SLIM at the required longword offset */
        memset(&hgp, 0, sizeof(struct lpfc_hgp));
        to_slim = phba->MBslimaddr + (SLIMOFF*sizeof (uint32_t));
-       lpfc_memcpy_to_slim(to_slim, &hgp, sizeof(struct lpfc_hgp));
+
+       for (i=0; i < phba->sli.num_rings; i++) {
+               lpfc_memcpy_to_slim(to_slim, &hgp, sizeof(struct lpfc_hgp));
+               to_slim += sizeof (struct lpfc_hgp);
+       }
 
        /* Setup Port Group ring pointer */
        offset = (uint8_t *)&phba->slim2p->mbx.us.s2.port -
@@ -612,6 +636,17 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
                        phba->brd_no);
 }
 
+void
+lpfc_kill_board(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
+{
+       MAILBOX_t *mb = &pmb->mb;
+
+       memset(pmb, 0, sizeof(LPFC_MBOXQ_t));
+       mb->mbxCommand = MBX_KILL_BOARD;
+       mb->mbxOwner = OWN_HOST;
+       return;
+}
+
 void
 lpfc_mbox_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
 {