Commit 7a470277 authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.3.11: Driver management improvements via BSG

- Add BSG support for PCI loopback testing.
- Add BSG support for extended mailbox commands.
Signed-off-by: default avatarAlex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent cb5172ea
...@@ -554,6 +554,7 @@ struct lpfc_hba { ...@@ -554,6 +554,7 @@ struct lpfc_hba {
struct lpfc_dmabuf slim2p; struct lpfc_dmabuf slim2p;
MAILBOX_t *mbox; MAILBOX_t *mbox;
uint32_t *mbox_ext;
uint32_t *inb_ha_copy; uint32_t *inb_ha_copy;
uint32_t *inb_counter; uint32_t *inb_counter;
uint32_t inb_last_counter; uint32_t inb_last_counter;
...@@ -622,6 +623,7 @@ struct lpfc_hba { ...@@ -622,6 +623,7 @@ struct lpfc_hba {
uint32_t cfg_enable_hba_reset; uint32_t cfg_enable_hba_reset;
uint32_t cfg_enable_hba_heartbeat; uint32_t cfg_enable_hba_heartbeat;
uint32_t cfg_enable_bg; uint32_t cfg_enable_bg;
uint32_t cfg_hostmem_hgp;
uint32_t cfg_log_verbose; uint32_t cfg_log_verbose;
uint32_t cfg_aer_support; uint32_t cfg_aer_support;
uint32_t cfg_suppress_link_up; uint32_t cfg_suppress_link_up;
......
This diff is collapsed.
...@@ -93,9 +93,9 @@ struct get_mgmt_rev_reply { ...@@ -93,9 +93,9 @@ struct get_mgmt_rev_reply {
struct dfc_mbox_req { struct dfc_mbox_req {
uint32_t command; uint32_t command;
uint32_t mbOffset;
uint32_t inExtWLen; uint32_t inExtWLen;
uint32_t outExtWLen; uint32_t outWxtWLen;
uint8_t mbOffset;
}; };
/* Used for menlo command or menlo data. The xri is only used for menlo data */ /* Used for menlo command or menlo data. The xri is only used for menlo data */
......
...@@ -2934,6 +2934,12 @@ typedef struct { ...@@ -2934,6 +2934,12 @@ typedef struct {
/* Union of all Mailbox Command types */ /* Union of all Mailbox Command types */
#define MAILBOX_CMD_WSIZE 32 #define MAILBOX_CMD_WSIZE 32
#define MAILBOX_CMD_SIZE (MAILBOX_CMD_WSIZE * sizeof(uint32_t)) #define MAILBOX_CMD_SIZE (MAILBOX_CMD_WSIZE * sizeof(uint32_t))
/* ext_wsize times 4 bytes should not be greater than max xmit size */
#define MAILBOX_EXT_WSIZE 512
#define MAILBOX_EXT_SIZE (MAILBOX_EXT_WSIZE * sizeof(uint32_t))
#define MAILBOX_HBA_EXT_OFFSET 0x100
/* max mbox xmit size is a page size for sysfs IO operations */
#define MAILBOX_MAX_XMIT_SIZE PAGE_SIZE
typedef union { typedef union {
uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/ uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/
...@@ -3652,7 +3658,8 @@ typedef struct _IOCB { /* IOCB structure */ ...@@ -3652,7 +3658,8 @@ typedef struct _IOCB { /* IOCB structure */
/* Maximum IOCBs that will fit in SLI2 slim */ /* Maximum IOCBs that will fit in SLI2 slim */
#define MAX_SLI2_IOCB 498 #define MAX_SLI2_IOCB 498
#define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \ #define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \
(sizeof(MAILBOX_t) + sizeof(PCB_t))) (sizeof(MAILBOX_t) + sizeof(PCB_t) + \
sizeof(uint32_t) * MAILBOX_EXT_WSIZE))
/* HBQ entries are 4 words each = 4k */ /* HBQ entries are 4 words each = 4k */
#define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) * \ #define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) * \
...@@ -3660,6 +3667,7 @@ typedef struct _IOCB { /* IOCB structure */ ...@@ -3660,6 +3667,7 @@ typedef struct _IOCB { /* IOCB structure */
struct lpfc_sli2_slim { struct lpfc_sli2_slim {
MAILBOX_t mbx; MAILBOX_t mbx;
uint32_t mbx_ext_words[MAILBOX_EXT_WSIZE];
PCB_t pcb; PCB_t pcb;
IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE]; IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE];
}; };
......
...@@ -5059,6 +5059,8 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) ...@@ -5059,6 +5059,8 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
memset(phba->slim2p.virt, 0, SLI2_SLIM_SIZE); memset(phba->slim2p.virt, 0, SLI2_SLIM_SIZE);
phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx); phba->mbox = phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, mbx);
phba->mbox_ext = (phba->slim2p.virt +
offsetof(struct lpfc_sli2_slim, mbx_ext_words));
phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb)); phba->pcb = (phba->slim2p.virt + offsetof(struct lpfc_sli2_slim, pcb));
phba->IOCBs = (phba->slim2p.virt + phba->IOCBs = (phba->slim2p.virt +
offsetof(struct lpfc_sli2_slim, IOCBs)); offsetof(struct lpfc_sli2_slim, IOCBs));
......
...@@ -1216,7 +1216,7 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -1216,7 +1216,7 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
phba->pcb->feature = FEATURE_INITIAL_SLI2; phba->pcb->feature = FEATURE_INITIAL_SLI2;
/* Setup Mailbox pointers */ /* Setup Mailbox pointers */
phba->pcb->mailBoxSize = sizeof(MAILBOX_t); phba->pcb->mailBoxSize = sizeof(MAILBOX_t) + MAILBOX_EXT_SIZE;
offset = (uint8_t *)phba->mbox - (uint8_t *)phba->slim2p.virt; offset = (uint8_t *)phba->mbox - (uint8_t *)phba->slim2p.virt;
pdma_addr = phba->slim2p.phys + offset; pdma_addr = phba->slim2p.phys + offset;
phba->pcb->mbAddrHigh = putPaddrHigh(pdma_addr); phba->pcb->mbAddrHigh = putPaddrHigh(pdma_addr);
...@@ -1272,6 +1272,18 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -1272,6 +1272,18 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
* *
*/ */
if (phba->cfg_hostmem_hgp && phba->sli_rev != 3) {
phba->host_gp = &phba->mbox->us.s2.host[0];
phba->hbq_put = NULL;
offset = (uint8_t *)&phba->mbox->us.s2.host -
(uint8_t *)phba->slim2p.virt;
pdma_addr = phba->slim2p.phys + offset;
phba->pcb->hgpAddrHigh = putPaddrHigh(pdma_addr);
phba->pcb->hgpAddrLow = putPaddrLow(pdma_addr);
} else {
/* Always Host Group Pointer is in SLIM */
mb->un.varCfgPort.hps = 1;
if (phba->sli_rev == 3) { if (phba->sli_rev == 3) {
phba->host_gp = &mb_slim->us.s3.host[0]; phba->host_gp = &mb_slim->us.s3.host[0];
phba->hbq_put = &mb_slim->us.s3.hbq_put[0]; phba->hbq_put = &mb_slim->us.s3.hbq_put[0];
...@@ -1291,10 +1303,11 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -1291,10 +1303,11 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
/* write HGP data to SLIM at the required longword offset */ /* write HGP data to SLIM at the required longword offset */
memset(&hgp, 0, sizeof(struct lpfc_hgp)); memset(&hgp, 0, sizeof(struct lpfc_hgp));
for (i=0; i < phba->sli.num_rings; i++) { for (i = 0; i < phba->sli.num_rings; i++) {
lpfc_memcpy_to_slim(phba->host_gp + i, &hgp, lpfc_memcpy_to_slim(phba->host_gp + i, &hgp,
sizeof(*phba->host_gp)); sizeof(*phba->host_gp));
} }
}
/* Setup Port Group offset */ /* Setup Port Group offset */
if (phba->sli_rev == 3) if (phba->sli_rev == 3)
......
...@@ -4891,9 +4891,34 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, ...@@ -4891,9 +4891,34 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox,
mb->mbxOwner = OWN_CHIP; mb->mbxOwner = OWN_CHIP;
if (psli->sli_flag & LPFC_SLI_ACTIVE) { if (psli->sli_flag & LPFC_SLI_ACTIVE) {
/* First copy command data to host SLIM area */ /* Populate mbox extension offset word. */
if (pmbox->in_ext_byte_len || pmbox->out_ext_byte_len) {
*(((uint32_t *)mb) + pmbox->mbox_offset_word)
= (uint8_t *)phba->mbox_ext
- (uint8_t *)phba->mbox;
}
/* Copy the mailbox extension data */
if (pmbox->in_ext_byte_len && pmbox->context2) {
lpfc_sli_pcimem_bcopy(pmbox->context2,
(uint8_t *)phba->mbox_ext,
pmbox->in_ext_byte_len);
}
/* Copy command data to host SLIM area */
lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE); lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE);
} else { } else {
/* Populate mbox extension offset word. */
if (pmbox->in_ext_byte_len || pmbox->out_ext_byte_len)
*(((uint32_t *)mb) + pmbox->mbox_offset_word)
= MAILBOX_HBA_EXT_OFFSET;
/* Copy the mailbox extension data */
if (pmbox->in_ext_byte_len && pmbox->context2) {
lpfc_memcpy_to_slim(phba->MBslimaddr +
MAILBOX_HBA_EXT_OFFSET,
pmbox->context2, pmbox->in_ext_byte_len);
}
if (mb->mbxCommand == MBX_CONFIG_PORT) { if (mb->mbxCommand == MBX_CONFIG_PORT) {
/* copy command data into host mbox for cmpl */ /* copy command data into host mbox for cmpl */
lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE); lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE);
...@@ -5003,15 +5028,22 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, ...@@ -5003,15 +5028,22 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox,
if (psli->sli_flag & LPFC_SLI_ACTIVE) { if (psli->sli_flag & LPFC_SLI_ACTIVE) {
/* copy results back to user */ /* copy results back to user */
lpfc_sli_pcimem_bcopy(phba->mbox, mb, MAILBOX_CMD_SIZE); lpfc_sli_pcimem_bcopy(phba->mbox, mb, MAILBOX_CMD_SIZE);
/* Copy the mailbox extension data */
if (pmbox->out_ext_byte_len && pmbox->context2) {
lpfc_sli_pcimem_bcopy(phba->mbox_ext,
pmbox->context2,
pmbox->out_ext_byte_len);
}
} else { } else {
/* First copy command data */ /* First copy command data */
lpfc_memcpy_from_slim(mb, phba->MBslimaddr, lpfc_memcpy_from_slim(mb, phba->MBslimaddr,
MAILBOX_CMD_SIZE); MAILBOX_CMD_SIZE);
if ((mb->mbxCommand == MBX_DUMP_MEMORY) && /* Copy the mailbox extension data */
pmbox->context2) { if (pmbox->out_ext_byte_len && pmbox->context2) {
lpfc_memcpy_from_slim((void *)pmbox->context2, lpfc_memcpy_from_slim(pmbox->context2,
phba->MBslimaddr + DMP_RSP_OFFSET, phba->MBslimaddr +
mb->un.varDmp.word_cnt); MAILBOX_HBA_EXT_OFFSET,
pmbox->out_ext_byte_len);
} }
} }
...@@ -8133,6 +8165,12 @@ lpfc_sli_sp_intr_handler(int irq, void *dev_id) ...@@ -8133,6 +8165,12 @@ lpfc_sli_sp_intr_handler(int irq, void *dev_id)
if (pmb->mbox_cmpl) { if (pmb->mbox_cmpl) {
lpfc_sli_pcimem_bcopy(mbox, pmbox, lpfc_sli_pcimem_bcopy(mbox, pmbox,
MAILBOX_CMD_SIZE); MAILBOX_CMD_SIZE);
if (pmb->out_ext_byte_len &&
pmb->context2)
lpfc_sli_pcimem_bcopy(
phba->mbox_ext,
pmb->context2,
pmb->out_ext_byte_len);
} }
if (pmb->mbox_flag & LPFC_MBX_IMED_UNREG) { if (pmb->mbox_flag & LPFC_MBX_IMED_UNREG) {
pmb->mbox_flag &= ~LPFC_MBX_IMED_UNREG; pmb->mbox_flag &= ~LPFC_MBX_IMED_UNREG;
......
...@@ -110,6 +110,9 @@ typedef struct lpfcMboxq { ...@@ -110,6 +110,9 @@ typedef struct lpfcMboxq {
void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *);
uint8_t mbox_flag; uint8_t mbox_flag;
uint16_t in_ext_byte_len;
uint16_t out_ext_byte_len;
uint8_t mbox_offset_word;
struct lpfc_mcqe mcqe; struct lpfc_mcqe mcqe;
struct lpfc_mbx_nembed_sge_virt *sge_array; struct lpfc_mbx_nembed_sge_virt *sge_array;
} LPFC_MBOXQ_t; } LPFC_MBOXQ_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment