aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h20
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c7
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c45
3 files changed, 26 insertions, 46 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index fc958a99dadb..3f05b6890214 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -2214,20 +2214,20 @@ typedef union {
2214 * SLI-2 specific structures 2214 * SLI-2 specific structures
2215 */ 2215 */
2216 2216
2217typedef struct { 2217struct lpfc_hgp {
2218 uint32_t cmdPutInx; 2218 __le32 cmdPutInx;
2219 uint32_t rspGetInx; 2219 __le32 rspGetInx;
2220} HGP; 2220};
2221 2221
2222typedef struct { 2222struct lpfc_pgp {
2223 uint32_t cmdGetInx; 2223 __le32 cmdGetInx;
2224 uint32_t rspPutInx; 2224 __le32 rspPutInx;
2225} PGP; 2225};
2226 2226
2227typedef struct _SLI2_DESC { 2227typedef struct _SLI2_DESC {
2228 HGP host[MAX_RINGS]; 2228 struct lpfc_hgp host[MAX_RINGS];
2229 uint32_t unused1[16]; 2229 uint32_t unused1[16];
2230 PGP port[MAX_RINGS]; 2230 struct lpfc_pgp port[MAX_RINGS];
2231} SLI2_DESC; 2231} SLI2_DESC;
2232 2232
2233typedef union { 2233typedef union {
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 8712a80fe747..73213030c746 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -422,7 +422,6 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba)
422 uint32_t iocbCnt; 422 uint32_t iocbCnt;
423 int i; 423 int i;
424 424
425 psli->MBhostaddr = (uint32_t *)&phba->slim2p->mbx;
426 pcbp->maxRing = (psli->num_rings - 1); 425 pcbp->maxRing = (psli->num_rings - 1);
427 426
428 iocbCnt = 0; 427 iocbCnt = 0;
@@ -528,7 +527,7 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
528 dma_addr_t pdma_addr; 527 dma_addr_t pdma_addr;
529 uint32_t bar_low, bar_high; 528 uint32_t bar_low, bar_high;
530 size_t offset; 529 size_t offset;
531 HGP hgp; 530 struct lpfc_hgp hgp;
532 void __iomem *to_slim; 531 void __iomem *to_slim;
533 532
534 memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); 533 memset(pmb, 0, sizeof(LPFC_MBOXQ_t));
@@ -584,9 +583,9 @@ lpfc_config_port(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
584 else 583 else
585 phba->slim2p->pcb.hgpAddrHigh = 0; 584 phba->slim2p->pcb.hgpAddrHigh = 0;
586 /* write HGP data to SLIM at the required longword offset */ 585 /* write HGP data to SLIM at the required longword offset */
587 memset(&hgp, 0, sizeof(HGP)); 586 memset(&hgp, 0, sizeof(struct lpfc_hgp));
588 to_slim = phba->MBslimaddr + (SLIMOFF*sizeof (uint32_t)); 587 to_slim = phba->MBslimaddr + (SLIMOFF*sizeof (uint32_t));
589 lpfc_memcpy_to_slim(to_slim, &hgp, sizeof (HGP)); 588 lpfc_memcpy_to_slim(to_slim, &hgp, sizeof(struct lpfc_hgp));
590 589
591 /* Setup Port Group ring pointer */ 590 /* Setup Port Group ring pointer */
592 offset = (uint8_t *)&phba->slim2p->mbx.us.s2.port - 591 offset = (uint8_t *)&phba->slim2p->mbx.us.s2.port -
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 8d14b28c80b9..9493ec1b17e1 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -225,8 +225,7 @@ lpfc_sli_ringtx_get(struct lpfc_hba * phba, struct lpfc_sli_ring * pring)
225static IOCB_t * 225static IOCB_t *
226lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 226lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
227{ 227{
228 MAILBOX_t *mbox = (MAILBOX_t *)phba->sli.MBhostaddr; 228 struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno];
229 PGP *pgp = (PGP *)&mbox->us.s2.port[pring->ringno];
230 uint32_t max_cmd_idx = pring->numCiocb; 229 uint32_t max_cmd_idx = pring->numCiocb;
231 IOCB_t *iocb = NULL; 230 IOCB_t *iocb = NULL;
232 231
@@ -411,9 +410,7 @@ lpfc_sli_resume_iocb(struct lpfc_hba * phba, struct lpfc_sli_ring * pring)
411static void 410static void
412lpfc_sli_turn_on_ring(struct lpfc_hba * phba, int ringno) 411lpfc_sli_turn_on_ring(struct lpfc_hba * phba, int ringno)
413{ 412{
414 PGP *pgp = 413 struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[ringno];
415 ((PGP *) &
416 (((MAILBOX_t *)phba->sli.MBhostaddr)->us.s2.port[ringno]));
417 414
418 /* If the ring is active, flag it */ 415 /* If the ring is active, flag it */
419 if (phba->sli.ring[ringno].cmdringaddr) { 416 if (phba->sli.ring[ringno].cmdringaddr) {
@@ -537,7 +534,7 @@ lpfc_sli_handle_mb_event(struct lpfc_hba * phba)
537 /* Get a Mailbox buffer to setup mailbox commands for callback */ 534 /* Get a Mailbox buffer to setup mailbox commands for callback */
538 if ((pmb = phba->sli.mbox_active)) { 535 if ((pmb = phba->sli.mbox_active)) {
539 pmbox = &pmb->mb; 536 pmbox = &pmb->mb;
540 mbox = (MAILBOX_t *) phba->sli.MBhostaddr; 537 mbox = &phba->slim2p->mbx;
541 538
542 /* First check out the status word */ 539 /* First check out the status word */
543 lpfc_sli_pcimem_bcopy(mbox, pmbox, sizeof (uint32_t)); 540 lpfc_sli_pcimem_bcopy(mbox, pmbox, sizeof (uint32_t));
@@ -905,10 +902,10 @@ static int
905lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba, 902lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba,
906 struct lpfc_sli_ring * pring, uint32_t mask) 903 struct lpfc_sli_ring * pring, uint32_t mask)
907{ 904{
905 struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno];
908 IOCB_t *irsp = NULL; 906 IOCB_t *irsp = NULL;
909 struct lpfc_iocbq *cmdiocbq = NULL; 907 struct lpfc_iocbq *cmdiocbq = NULL;
910 struct lpfc_iocbq rspiocbq; 908 struct lpfc_iocbq rspiocbq;
911 PGP *pgp;
912 uint32_t status; 909 uint32_t status;
913 uint32_t portRspPut, portRspMax; 910 uint32_t portRspPut, portRspMax;
914 int rc = 1; 911 int rc = 1;
@@ -920,10 +917,6 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba,
920 spin_lock_irqsave(phba->host->host_lock, iflag); 917 spin_lock_irqsave(phba->host->host_lock, iflag);
921 pring->stats.iocb_event++; 918 pring->stats.iocb_event++;
922 919
923 /* The driver assumes SLI-2 mode */
924 pgp = (PGP *) &((MAILBOX_t *) phba->sli.MBhostaddr)
925 ->us.s2.port[pring->ringno];
926
927 /* 920 /*
928 * The next available response entry should never exceed the maximum 921 * The next available response entry should never exceed the maximum
929 * entries. If it does, treat it as an adapter hardware error. 922 * entries. If it does, treat it as an adapter hardware error.
@@ -1075,9 +1068,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba * phba,
1075 struct lpfc_iocbq *cmdiocbp; 1068 struct lpfc_iocbq *cmdiocbp;
1076 struct lpfc_iocbq *saveq; 1069 struct lpfc_iocbq *saveq;
1077 struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list; 1070 struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list;
1078 HGP *hgp; 1071 struct lpfc_pgp *pgp = &phba->slim2p->mbx.us.s2.port[pring->ringno];
1079 PGP *pgp;
1080 MAILBOX_t *mbox;
1081 uint8_t iocb_cmd_type; 1072 uint8_t iocb_cmd_type;
1082 lpfc_iocb_type type; 1073 lpfc_iocb_type type;
1083 uint32_t status, free_saveq; 1074 uint32_t status, free_saveq;
@@ -1089,11 +1080,6 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba * phba,
1089 spin_lock_irqsave(phba->host->host_lock, iflag); 1080 spin_lock_irqsave(phba->host->host_lock, iflag);
1090 pring->stats.iocb_event++; 1081 pring->stats.iocb_event++;
1091 1082
1092 /* The driver assumes SLI-2 mode */
1093 mbox = (MAILBOX_t *) phba->sli.MBhostaddr;
1094 pgp = (PGP *) & mbox->us.s2.port[pring->ringno];
1095 hgp = (HGP *) & mbox->us.s2.host[pring->ringno];
1096
1097 /* 1083 /*
1098 * The next available response entry should never exceed the maximum 1084 * The next available response entry should never exceed the maximum
1099 * entries. If it does, treat it as an adapter hardware error. 1085 * entries. If it does, treat it as an adapter hardware error.
@@ -1771,7 +1757,6 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
1771int 1757int
1772lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) 1758lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag)
1773{ 1759{
1774 MAILBOX_t *mbox;
1775 MAILBOX_t *mb; 1760 MAILBOX_t *mb;
1776 struct lpfc_sli *psli; 1761 struct lpfc_sli *psli;
1777 uint32_t status, evtctr; 1762 uint32_t status, evtctr;
@@ -1901,15 +1886,13 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag)
1901 mb->mbxOwner = OWN_CHIP; 1886 mb->mbxOwner = OWN_CHIP;
1902 1887
1903 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 1888 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
1904
1905 /* First copy command data to host SLIM area */ 1889 /* First copy command data to host SLIM area */
1906 mbox = (MAILBOX_t *) psli->MBhostaddr; 1890 lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx, MAILBOX_CMD_SIZE);
1907 lpfc_sli_pcimem_bcopy(mb, mbox, MAILBOX_CMD_SIZE);
1908 } else { 1891 } else {
1909 if (mb->mbxCommand == MBX_CONFIG_PORT) { 1892 if (mb->mbxCommand == MBX_CONFIG_PORT) {
1910 /* copy command data into host mbox for cmpl */ 1893 /* copy command data into host mbox for cmpl */
1911 mbox = (MAILBOX_t *) psli->MBhostaddr; 1894 lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx,
1912 lpfc_sli_pcimem_bcopy(mb, mbox, MAILBOX_CMD_SIZE); 1895 MAILBOX_CMD_SIZE);
1913 } 1896 }
1914 1897
1915 /* First copy mbox command data to HBA SLIM, skip past first 1898 /* First copy mbox command data to HBA SLIM, skip past first
@@ -1946,8 +1929,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag)
1946 psli->mbox_active = NULL; 1929 psli->mbox_active = NULL;
1947 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 1930 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
1948 /* First read mbox status word */ 1931 /* First read mbox status word */
1949 mbox = (MAILBOX_t *) psli->MBhostaddr; 1932 word0 = *((volatile uint32_t *)&phba->slim2p->mbx);
1950 word0 = *((volatile uint32_t *)mbox);
1951 word0 = le32_to_cpu(word0); 1933 word0 = le32_to_cpu(word0);
1952 } else { 1934 } else {
1953 /* First read mbox status word */ 1935 /* First read mbox status word */
@@ -1984,8 +1966,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag)
1984 1966
1985 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 1967 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
1986 /* First copy command data */ 1968 /* First copy command data */
1987 mbox = (MAILBOX_t *) psli->MBhostaddr; 1969 word0 = *((volatile uint32_t *)
1988 word0 = *((volatile uint32_t *)mbox); 1970 &phba->slim2p->mbx);
1989 word0 = le32_to_cpu(word0); 1971 word0 = le32_to_cpu(word0);
1990 if (mb->mbxCommand == MBX_CONFIG_PORT) { 1972 if (mb->mbxCommand == MBX_CONFIG_PORT) {
1991 MAILBOX_t *slimmb; 1973 MAILBOX_t *slimmb;
@@ -2009,10 +1991,9 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag)
2009 } 1991 }
2010 1992
2011 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 1993 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
2012 /* First copy command data */
2013 mbox = (MAILBOX_t *) psli->MBhostaddr;
2014 /* copy results back to user */ 1994 /* copy results back to user */
2015 lpfc_sli_pcimem_bcopy(mbox, mb, MAILBOX_CMD_SIZE); 1995 lpfc_sli_pcimem_bcopy(&phba->slim2p->mbx, mb,
1996 MAILBOX_CMD_SIZE);
2016 } else { 1997 } else {
2017 /* First copy command data */ 1998 /* First copy command data */
2018 lpfc_memcpy_from_slim(mb, phba->MBslimaddr, 1999 lpfc_memcpy_from_slim(mb, phba->MBslimaddr,