diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-05-29 07:07:04 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-09 18:21:31 -0400 |
commit | 14d0f0b063f5363984dd305a792854f9c23e9e97 (patch) | |
tree | 6d3e62845bc5273244f3b9ec535159cf5a8bdbc6 /drivers/message/fusion/mptbase.c | |
parent | 238ddbb98c327a7392ced5ae65216c55969749ea (diff) |
[SCSI] mpt fusion: Fixing 1078 data corruption issue for 36GB memory region
The reason for this change is there is a data corruption when four different
physical memory regions in the 36GB to 37GB region are
accessed. This is only affecting 1078.
The solution is we need to use different addressing when filling in
the scatter gather table for the effected memory regions. So instead
of snooping on all four different memory holes, we treat any physical
addresses in the 36GB address with the same algorithm.
The fix is explained below
1) Ensure that the message frames are NOT located in the trouble
region. There is no remapping available for message frames, they must
be allocated outside the problem region.
2) Ensure that Sense buffers are NOT in the trouble region. There is
no remapping available.
3) Walk through the SGE entries and if any are inside the trouble region
then they need to be remapped as discussed below.
1) Set the Local Address bit in the SGE Flags field.
MPI_SGE_FLAGS_LOCAL_ADDRESS
2) Ensure we are using 64-bit SGEs
3) Set MSb (Bit 63) of the 64-bit address, this will indicate buffer
location is Host Memory.
Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 287 |
1 files changed, 237 insertions, 50 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 5d496a99e034..a66369218c97 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -998,7 +998,7 @@ mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf) | |||
998 | 998 | ||
999 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 999 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1000 | /** | 1000 | /** |
1001 | * mpt_add_sge - Place a simple SGE at address pAddr. | 1001 | * mpt_add_sge - Place a simple 32 bit SGE at address pAddr. |
1002 | * @pAddr: virtual address for SGE | 1002 | * @pAddr: virtual address for SGE |
1003 | * @flagslength: SGE flags and data transfer length | 1003 | * @flagslength: SGE flags and data transfer length |
1004 | * @dma_addr: Physical address | 1004 | * @dma_addr: Physical address |
@@ -1006,23 +1006,117 @@ mpt_free_msg_frame(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf) | |||
1006 | * This routine places a MPT request frame back on the MPT adapter's | 1006 | * This routine places a MPT request frame back on the MPT adapter's |
1007 | * FreeQ. | 1007 | * FreeQ. |
1008 | */ | 1008 | */ |
1009 | void | 1009 | static void |
1010 | mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr) | 1010 | mpt_add_sge(void *pAddr, u32 flagslength, dma_addr_t dma_addr) |
1011 | { | 1011 | { |
1012 | if (sizeof(dma_addr_t) == sizeof(u64)) { | 1012 | SGESimple32_t *pSge = (SGESimple32_t *) pAddr; |
1013 | SGESimple64_t *pSge = (SGESimple64_t *) pAddr; | 1013 | pSge->FlagsLength = cpu_to_le32(flagslength); |
1014 | pSge->Address = cpu_to_le32(dma_addr); | ||
1015 | } | ||
1016 | |||
1017 | /** | ||
1018 | * mpt_add_sge_64bit - Place a simple 64 bit SGE at address pAddr. | ||
1019 | * @pAddr: virtual address for SGE | ||
1020 | * @flagslength: SGE flags and data transfer length | ||
1021 | * @dma_addr: Physical address | ||
1022 | * | ||
1023 | * This routine places a MPT request frame back on the MPT adapter's | ||
1024 | * FreeQ. | ||
1025 | **/ | ||
1026 | static void | ||
1027 | mpt_add_sge_64bit(void *pAddr, u32 flagslength, dma_addr_t dma_addr) | ||
1028 | { | ||
1029 | SGESimple64_t *pSge = (SGESimple64_t *) pAddr; | ||
1030 | pSge->Address.Low = cpu_to_le32 | ||
1031 | (lower_32_bits((unsigned long)(dma_addr))); | ||
1032 | pSge->Address.High = cpu_to_le32 | ||
1033 | (upper_32_bits((unsigned long)dma_addr)); | ||
1034 | pSge->FlagsLength = cpu_to_le32 | ||
1035 | ((flagslength | MPT_SGE_FLAGS_64_BIT_ADDRESSING)); | ||
1036 | } | ||
1037 | |||
1038 | /** | ||
1039 | * mpt_add_sge_64bit_1078 - Place a simple 64 bit SGE at address pAddr | ||
1040 | * (1078 workaround). | ||
1041 | * @pAddr: virtual address for SGE | ||
1042 | * @flagslength: SGE flags and data transfer length | ||
1043 | * @dma_addr: Physical address | ||
1044 | * | ||
1045 | * This routine places a MPT request frame back on the MPT adapter's | ||
1046 | * FreeQ. | ||
1047 | **/ | ||
1048 | static void | ||
1049 | mpt_add_sge_64bit_1078(void *pAddr, u32 flagslength, dma_addr_t dma_addr) | ||
1050 | { | ||
1051 | SGESimple64_t *pSge = (SGESimple64_t *) pAddr; | ||
1052 | u32 tmp; | ||
1053 | |||
1054 | pSge->Address.Low = cpu_to_le32 | ||
1055 | (lower_32_bits((unsigned long)(dma_addr))); | ||
1056 | tmp = (u32)(upper_32_bits((unsigned long)dma_addr)); | ||
1057 | |||
1058 | /* | ||
1059 | * 1078 errata workaround for the 36GB limitation | ||
1060 | */ | ||
1061 | if ((((u64)dma_addr + MPI_SGE_LENGTH(flagslength)) >> 32) == 9) { | ||
1062 | flagslength |= | ||
1063 | MPI_SGE_SET_FLAGS(MPI_SGE_FLAGS_LOCAL_ADDRESS); | ||
1064 | tmp |= (1<<31); | ||
1065 | if (mpt_debug_level & MPT_DEBUG_36GB_MEM) | ||
1066 | printk(KERN_DEBUG "1078 P0M2 addressing for " | ||
1067 | "addr = 0x%llx len = %d\n", | ||
1068 | (unsigned long long)dma_addr, | ||
1069 | MPI_SGE_LENGTH(flagslength)); | ||
1070 | } | ||
1071 | |||
1072 | pSge->Address.High = cpu_to_le32(tmp); | ||
1073 | pSge->FlagsLength = cpu_to_le32( | ||
1074 | (flagslength | MPT_SGE_FLAGS_64_BIT_ADDRESSING)); | ||
1075 | } | ||
1076 | |||
1077 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
1078 | /** | ||
1079 | * mpt_add_chain - Place a 32 bit chain SGE at address pAddr. | ||
1080 | * @pAddr: virtual address for SGE | ||
1081 | * @next: nextChainOffset value (u32's) | ||
1082 | * @length: length of next SGL segment | ||
1083 | * @dma_addr: Physical address | ||
1084 | * | ||
1085 | */ | ||
1086 | static void | ||
1087 | mpt_add_chain(void *pAddr, u8 next, u16 length, dma_addr_t dma_addr) | ||
1088 | { | ||
1089 | SGEChain32_t *pChain = (SGEChain32_t *) pAddr; | ||
1090 | pChain->Length = cpu_to_le16(length); | ||
1091 | pChain->Flags = MPI_SGE_FLAGS_CHAIN_ELEMENT; | ||
1092 | pChain->NextChainOffset = next; | ||
1093 | pChain->Address = cpu_to_le32(dma_addr); | ||
1094 | } | ||
1095 | |||
1096 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
1097 | /** | ||
1098 | * mpt_add_chain_64bit - Place a 64 bit chain SGE at address pAddr. | ||
1099 | * @pAddr: virtual address for SGE | ||
1100 | * @next: nextChainOffset value (u32's) | ||
1101 | * @length: length of next SGL segment | ||
1102 | * @dma_addr: Physical address | ||
1103 | * | ||
1104 | */ | ||
1105 | static void | ||
1106 | mpt_add_chain_64bit(void *pAddr, u8 next, u16 length, dma_addr_t dma_addr) | ||
1107 | { | ||
1108 | SGEChain64_t *pChain = (SGEChain64_t *) pAddr; | ||
1014 | u32 tmp = dma_addr & 0xFFFFFFFF; | 1109 | u32 tmp = dma_addr & 0xFFFFFFFF; |
1015 | 1110 | ||
1016 | pSge->FlagsLength = cpu_to_le32(flagslength); | 1111 | pChain->Length = cpu_to_le16(length); |
1017 | pSge->Address.Low = cpu_to_le32(tmp); | 1112 | pChain->Flags = (MPI_SGE_FLAGS_CHAIN_ELEMENT | |
1018 | tmp = (u32) ((u64)dma_addr >> 32); | 1113 | MPI_SGE_FLAGS_64_BIT_ADDRESSING); |
1019 | pSge->Address.High = cpu_to_le32(tmp); | ||
1020 | 1114 | ||
1021 | } else { | 1115 | pChain->NextChainOffset = next; |
1022 | SGESimple32_t *pSge = (SGESimple32_t *) pAddr; | 1116 | |
1023 | pSge->FlagsLength = cpu_to_le32(flagslength); | 1117 | pChain->Address.Low = cpu_to_le32(tmp); |
1024 | pSge->Address = cpu_to_le32(dma_addr); | 1118 | tmp = (u32)(upper_32_bits((unsigned long)dma_addr)); |
1025 | } | 1119 | pChain->Address.High = cpu_to_le32(tmp); |
1026 | } | 1120 | } |
1027 | 1121 | ||
1028 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1122 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -1225,7 +1319,7 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init) | |||
1225 | } | 1319 | } |
1226 | flags_length = flags_length << MPI_SGE_FLAGS_SHIFT; | 1320 | flags_length = flags_length << MPI_SGE_FLAGS_SHIFT; |
1227 | flags_length |= ioc->HostPageBuffer_sz; | 1321 | flags_length |= ioc->HostPageBuffer_sz; |
1228 | mpt_add_sge(psge, flags_length, ioc->HostPageBuffer_dma); | 1322 | ioc->add_sge(psge, flags_length, ioc->HostPageBuffer_dma); |
1229 | ioc->facts.HostPageBufferSGE = ioc_init->HostPageBufferSGE; | 1323 | ioc->facts.HostPageBufferSGE = ioc_init->HostPageBufferSGE; |
1230 | 1324 | ||
1231 | return 0; | 1325 | return 0; |
@@ -1534,21 +1628,42 @@ mpt_mapresources(MPT_ADAPTER *ioc) | |||
1534 | 1628 | ||
1535 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); | 1629 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); |
1536 | 1630 | ||
1537 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) | 1631 | if (sizeof(dma_addr_t) > 4) { |
1538 | && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { | 1632 | const uint64_t required_mask = dma_get_required_mask |
1539 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | 1633 | (&pdev->dev); |
1540 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | 1634 | if (required_mask > DMA_BIT_MASK(32) |
1541 | ioc->name)); | 1635 | && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) |
1542 | } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) | 1636 | && !pci_set_consistent_dma_mask(pdev, |
1543 | && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { | 1637 | DMA_BIT_MASK(64))) { |
1544 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | 1638 | ioc->dma_mask = DMA_BIT_MASK(64); |
1545 | ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | 1639 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT |
1546 | ioc->name)); | 1640 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", |
1641 | ioc->name)); | ||
1642 | } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) | ||
1643 | && !pci_set_consistent_dma_mask(pdev, | ||
1644 | DMA_BIT_MASK(32))) { | ||
1645 | ioc->dma_mask = DMA_BIT_MASK(32); | ||
1646 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1647 | ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | ||
1648 | ioc->name)); | ||
1649 | } else { | ||
1650 | printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", | ||
1651 | ioc->name, pci_name(pdev)); | ||
1652 | return r; | ||
1653 | } | ||
1547 | } else { | 1654 | } else { |
1548 | printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", | 1655 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) |
1549 | ioc->name, pci_name(pdev)); | 1656 | && !pci_set_consistent_dma_mask(pdev, |
1550 | pci_release_selected_regions(pdev, ioc->bars); | 1657 | DMA_BIT_MASK(32))) { |
1551 | return r; | 1658 | ioc->dma_mask = DMA_BIT_MASK(32); |
1659 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1660 | ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | ||
1661 | ioc->name)); | ||
1662 | } else { | ||
1663 | printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", | ||
1664 | ioc->name, pci_name(pdev)); | ||
1665 | return r; | ||
1666 | } | ||
1552 | } | 1667 | } |
1553 | 1668 | ||
1554 | mem_phys = msize = 0; | 1669 | mem_phys = msize = 0; |
@@ -1650,6 +1765,23 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1650 | return r; | 1765 | return r; |
1651 | } | 1766 | } |
1652 | 1767 | ||
1768 | /* | ||
1769 | * Setting up proper handlers for scatter gather handling | ||
1770 | */ | ||
1771 | if (ioc->dma_mask == DMA_BIT_MASK(64)) { | ||
1772 | if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) | ||
1773 | ioc->add_sge = &mpt_add_sge_64bit_1078; | ||
1774 | else | ||
1775 | ioc->add_sge = &mpt_add_sge_64bit; | ||
1776 | ioc->add_chain = &mpt_add_chain_64bit; | ||
1777 | ioc->sg_addr_size = 8; | ||
1778 | } else { | ||
1779 | ioc->add_sge = &mpt_add_sge; | ||
1780 | ioc->add_chain = &mpt_add_chain; | ||
1781 | ioc->sg_addr_size = 4; | ||
1782 | } | ||
1783 | ioc->SGE_size = sizeof(u32) + ioc->sg_addr_size; | ||
1784 | |||
1653 | ioc->alloc_total = sizeof(MPT_ADAPTER); | 1785 | ioc->alloc_total = sizeof(MPT_ADAPTER); |
1654 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ | 1786 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ |
1655 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; | 1787 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; |
@@ -1994,6 +2126,21 @@ mpt_resume(struct pci_dev *pdev) | |||
1994 | if (err) | 2126 | if (err) |
1995 | return err; | 2127 | return err; |
1996 | 2128 | ||
2129 | if (ioc->dma_mask == DMA_BIT_MASK(64)) { | ||
2130 | if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) | ||
2131 | ioc->add_sge = &mpt_add_sge_64bit_1078; | ||
2132 | else | ||
2133 | ioc->add_sge = &mpt_add_sge_64bit; | ||
2134 | ioc->add_chain = &mpt_add_chain_64bit; | ||
2135 | ioc->sg_addr_size = 8; | ||
2136 | } else { | ||
2137 | |||
2138 | ioc->add_sge = &mpt_add_sge; | ||
2139 | ioc->add_chain = &mpt_add_chain; | ||
2140 | ioc->sg_addr_size = 4; | ||
2141 | } | ||
2142 | ioc->SGE_size = sizeof(u32) + ioc->sg_addr_size; | ||
2143 | |||
1997 | printk(MYIOC_s_INFO_FMT "pci-resume: ioc-state=0x%x,doorbell=0x%x\n", | 2144 | printk(MYIOC_s_INFO_FMT "pci-resume: ioc-state=0x%x,doorbell=0x%x\n", |
1998 | ioc->name, (mpt_GetIocState(ioc, 1) >> MPI_IOC_STATE_SHIFT), | 2145 | ioc->name, (mpt_GetIocState(ioc, 1) >> MPI_IOC_STATE_SHIFT), |
1999 | CHIPREG_READ32(&ioc->chip->Doorbell)); | 2146 | CHIPREG_READ32(&ioc->chip->Doorbell)); |
@@ -3325,11 +3472,10 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) | |||
3325 | FWUpload_t *prequest; | 3472 | FWUpload_t *prequest; |
3326 | FWUploadReply_t *preply; | 3473 | FWUploadReply_t *preply; |
3327 | FWUploadTCSGE_t *ptcsge; | 3474 | FWUploadTCSGE_t *ptcsge; |
3328 | int sgeoffset; | ||
3329 | u32 flagsLength; | 3475 | u32 flagsLength; |
3330 | int ii, sz, reply_sz; | 3476 | int ii, sz, reply_sz; |
3331 | int cmdStatus; | 3477 | int cmdStatus; |
3332 | 3478 | int request_size; | |
3333 | /* If the image size is 0, we are done. | 3479 | /* If the image size is 0, we are done. |
3334 | */ | 3480 | */ |
3335 | if ((sz = ioc->facts.FWImageSize) == 0) | 3481 | if ((sz = ioc->facts.FWImageSize) == 0) |
@@ -3364,18 +3510,17 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) | |||
3364 | ptcsge->ImageSize = cpu_to_le32(sz); | 3510 | ptcsge->ImageSize = cpu_to_le32(sz); |
3365 | ptcsge++; | 3511 | ptcsge++; |
3366 | 3512 | ||
3367 | sgeoffset = sizeof(FWUpload_t) - sizeof(SGE_MPI_UNION) + sizeof(FWUploadTCSGE_t); | ||
3368 | |||
3369 | flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ | sz; | 3513 | flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ | sz; |
3370 | mpt_add_sge((char *)ptcsge, flagsLength, ioc->cached_fw_dma); | 3514 | ioc->add_sge((char *)ptcsge, flagsLength, ioc->cached_fw_dma); |
3371 | 3515 | request_size = offsetof(FWUpload_t, SGL) + sizeof(FWUploadTCSGE_t) + | |
3372 | sgeoffset += sizeof(u32) + sizeof(dma_addr_t); | 3516 | ioc->SGE_size; |
3373 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": Sending FW Upload (req @ %p) sgeoffset=%d \n", | 3517 | dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending FW Upload " |
3374 | ioc->name, prequest, sgeoffset)); | 3518 | " (req @ %p) fw_size=%d mf_request_size=%d\n", ioc->name, prequest, |
3519 | ioc->facts.FWImageSize, request_size)); | ||
3375 | DBG_DUMP_FW_REQUEST_FRAME(ioc, (u32 *)prequest); | 3520 | DBG_DUMP_FW_REQUEST_FRAME(ioc, (u32 *)prequest); |
3376 | 3521 | ||
3377 | ii = mpt_handshake_req_reply_wait(ioc, sgeoffset, (u32*)prequest, | 3522 | ii = mpt_handshake_req_reply_wait(ioc, request_size, (u32 *)prequest, |
3378 | reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag); | 3523 | reply_sz, (u16 *)preply, 65 /*seconds*/, sleepFlag); |
3379 | 3524 | ||
3380 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": FW Upload completed rc=%x \n", ioc->name, ii)); | 3525 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": FW Upload completed rc=%x \n", ioc->name, ii)); |
3381 | 3526 | ||
@@ -4090,18 +4235,18 @@ initChainBuffers(MPT_ADAPTER *ioc) | |||
4090 | * num_sge = num sge in request frame + last chain buffer | 4235 | * num_sge = num sge in request frame + last chain buffer |
4091 | * scale = num sge per chain buffer if no chain element | 4236 | * scale = num sge per chain buffer if no chain element |
4092 | */ | 4237 | */ |
4093 | scale = ioc->req_sz/(sizeof(dma_addr_t) + sizeof(u32)); | 4238 | scale = ioc->req_sz / ioc->SGE_size; |
4094 | if (sizeof(dma_addr_t) == sizeof(u64)) | 4239 | if (ioc->sg_addr_size == sizeof(u64)) |
4095 | num_sge = scale + (ioc->req_sz - 60) / (sizeof(dma_addr_t) + sizeof(u32)); | 4240 | num_sge = scale + (ioc->req_sz - 60) / ioc->SGE_size; |
4096 | else | 4241 | else |
4097 | num_sge = 1+ scale + (ioc->req_sz - 64) / (sizeof(dma_addr_t) + sizeof(u32)); | 4242 | num_sge = 1 + scale + (ioc->req_sz - 64) / ioc->SGE_size; |
4098 | 4243 | ||
4099 | if (sizeof(dma_addr_t) == sizeof(u64)) { | 4244 | if (ioc->sg_addr_size == sizeof(u64)) { |
4100 | numSGE = (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale + | 4245 | numSGE = (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale + |
4101 | (ioc->req_sz - 60) / (sizeof(dma_addr_t) + sizeof(u32)); | 4246 | (ioc->req_sz - 60) / ioc->SGE_size; |
4102 | } else { | 4247 | } else { |
4103 | numSGE = 1 + (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale + | 4248 | numSGE = 1 + (scale - 1) * (ioc->facts.MaxChainDepth-1) + |
4104 | (ioc->req_sz - 64) / (sizeof(dma_addr_t) + sizeof(u32)); | 4249 | scale + (ioc->req_sz - 64) / ioc->SGE_size; |
4105 | } | 4250 | } |
4106 | dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "num_sge=%d numSGE=%d\n", | 4251 | dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "num_sge=%d numSGE=%d\n", |
4107 | ioc->name, num_sge, numSGE)); | 4252 | ioc->name, num_sge, numSGE)); |
@@ -4161,12 +4306,42 @@ PrimeIocFifos(MPT_ADAPTER *ioc) | |||
4161 | dma_addr_t alloc_dma; | 4306 | dma_addr_t alloc_dma; |
4162 | u8 *mem; | 4307 | u8 *mem; |
4163 | int i, reply_sz, sz, total_size, num_chain; | 4308 | int i, reply_sz, sz, total_size, num_chain; |
4309 | u64 dma_mask; | ||
4310 | |||
4311 | dma_mask = 0; | ||
4164 | 4312 | ||
4165 | /* Prime reply FIFO... */ | 4313 | /* Prime reply FIFO... */ |
4166 | 4314 | ||
4167 | if (ioc->reply_frames == NULL) { | 4315 | if (ioc->reply_frames == NULL) { |
4168 | if ( (num_chain = initChainBuffers(ioc)) < 0) | 4316 | if ( (num_chain = initChainBuffers(ioc)) < 0) |
4169 | return -1; | 4317 | return -1; |
4318 | /* | ||
4319 | * 1078 errata workaround for the 36GB limitation | ||
4320 | */ | ||
4321 | if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078 && | ||
4322 | ioc->dma_mask > DMA_35BIT_MASK) { | ||
4323 | if (!pci_set_dma_mask(ioc->pcidev, DMA_BIT_MASK(32)) | ||
4324 | && !pci_set_consistent_dma_mask(ioc->pcidev, | ||
4325 | DMA_BIT_MASK(32))) { | ||
4326 | dma_mask = DMA_35BIT_MASK; | ||
4327 | d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT | ||
4328 | "setting 35 bit addressing for " | ||
4329 | "Request/Reply/Chain and Sense Buffers\n", | ||
4330 | ioc->name)); | ||
4331 | } else { | ||
4332 | /*Reseting DMA mask to 64 bit*/ | ||
4333 | pci_set_dma_mask(ioc->pcidev, | ||
4334 | DMA_BIT_MASK(64)); | ||
4335 | pci_set_consistent_dma_mask(ioc->pcidev, | ||
4336 | DMA_BIT_MASK(64)); | ||
4337 | |||
4338 | printk(MYIOC_s_ERR_FMT | ||
4339 | "failed setting 35 bit addressing for " | ||
4340 | "Request/Reply/Chain and Sense Buffers\n", | ||
4341 | ioc->name); | ||
4342 | return -1; | ||
4343 | } | ||
4344 | } | ||
4170 | 4345 | ||
4171 | total_size = reply_sz = (ioc->reply_sz * ioc->reply_depth); | 4346 | total_size = reply_sz = (ioc->reply_sz * ioc->reply_depth); |
4172 | dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffer sz=%d bytes, ReplyDepth=%d\n", | 4347 | dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffer sz=%d bytes, ReplyDepth=%d\n", |
@@ -4305,6 +4480,12 @@ PrimeIocFifos(MPT_ADAPTER *ioc) | |||
4305 | alloc_dma += ioc->reply_sz; | 4480 | alloc_dma += ioc->reply_sz; |
4306 | } | 4481 | } |
4307 | 4482 | ||
4483 | if (dma_mask == DMA_35BIT_MASK && !pci_set_dma_mask(ioc->pcidev, | ||
4484 | ioc->dma_mask) && !pci_set_consistent_dma_mask(ioc->pcidev, | ||
4485 | ioc->dma_mask)) | ||
4486 | d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT | ||
4487 | "restoring 64 bit addressing\n", ioc->name)); | ||
4488 | |||
4308 | return 0; | 4489 | return 0; |
4309 | 4490 | ||
4310 | out_fail: | 4491 | out_fail: |
@@ -4324,6 +4505,13 @@ out_fail: | |||
4324 | ioc->sense_buf_pool, ioc->sense_buf_pool_dma); | 4505 | ioc->sense_buf_pool, ioc->sense_buf_pool_dma); |
4325 | ioc->sense_buf_pool = NULL; | 4506 | ioc->sense_buf_pool = NULL; |
4326 | } | 4507 | } |
4508 | |||
4509 | if (dma_mask == DMA_35BIT_MASK && !pci_set_dma_mask(ioc->pcidev, | ||
4510 | DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(ioc->pcidev, | ||
4511 | DMA_BIT_MASK(64))) | ||
4512 | d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT | ||
4513 | "restoring 64 bit addressing\n", ioc->name)); | ||
4514 | |||
4327 | return -1; | 4515 | return -1; |
4328 | } | 4516 | } |
4329 | 4517 | ||
@@ -5926,7 +6114,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) | |||
5926 | ioc->name, pReq->Header.PageType, pReq->Header.PageNumber, pReq->Action)); | 6114 | ioc->name, pReq->Header.PageType, pReq->Header.PageNumber, pReq->Action)); |
5927 | } | 6115 | } |
5928 | 6116 | ||
5929 | mpt_add_sge((char *)&pReq->PageBufferSGE, flagsLength, pCfg->physAddr); | 6117 | ioc->add_sge((char *)&pReq->PageBufferSGE, flagsLength, pCfg->physAddr); |
5930 | 6118 | ||
5931 | /* Append pCfg pointer to end of mf | 6119 | /* Append pCfg pointer to end of mf |
5932 | */ | 6120 | */ |
@@ -7613,7 +7801,6 @@ EXPORT_SYMBOL(mpt_get_msg_frame); | |||
7613 | EXPORT_SYMBOL(mpt_put_msg_frame); | 7801 | EXPORT_SYMBOL(mpt_put_msg_frame); |
7614 | EXPORT_SYMBOL(mpt_put_msg_frame_hi_pri); | 7802 | EXPORT_SYMBOL(mpt_put_msg_frame_hi_pri); |
7615 | EXPORT_SYMBOL(mpt_free_msg_frame); | 7803 | EXPORT_SYMBOL(mpt_free_msg_frame); |
7616 | EXPORT_SYMBOL(mpt_add_sge); | ||
7617 | EXPORT_SYMBOL(mpt_send_handshake_request); | 7804 | EXPORT_SYMBOL(mpt_send_handshake_request); |
7618 | EXPORT_SYMBOL(mpt_verify_adapter); | 7805 | EXPORT_SYMBOL(mpt_verify_adapter); |
7619 | EXPORT_SYMBOL(mpt_GetIocState); | 7806 | EXPORT_SYMBOL(mpt_GetIocState); |