* [PATCH 3/3] arcmsr: Fix bug of updating adapter firmware through ioctl(ARCHTTP) interface
@ 2013-08-26 4:28 黃清隆
2013-08-26 10:20 ` James Bottomley
0 siblings, 1 reply; 6+ messages in thread
From: 黃清隆 @ 2013-08-26 4:28 UTC (permalink / raw)
To: james.bottomley, linux-scsi, linux-kernel, jejb
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
From: Ching <ching2048@areca.com.tw>
Fix bug of updating adapter firmware through ioctl(ARCHTTP) interface.
Signed-off-by: Ching <ching2048@areca.com.tw>
---
[-- Attachment #2: patch3 --]
[-- Type: application/octet-stream, Size: 35274 bytes --]
diff -uprN a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c
--- a/drivers/scsi/arcmsr/arcmsr_attr.c 2012-11-29 19:35:16.000000000 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c 2013-07-16 02:31:38.000000000 +0800
@@ -86,6 +86,7 @@ arcmsr_sysfs_iop_message_read(struct fil
if ((ARCMSR_MAX_QBUFFER - acb->rqbuf_firstindex) >= 1032) {
memcpy(ptmpQbuffer, pQbuffer, 1032);
acb->rqbuf_firstindex += 1032;
+ acb->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
allxfer_len = 1032;
} else {
if (((ARCMSR_MAX_QBUFFER - acb->rqbuf_firstindex) + acb->rqbuf_lastindex) > 1032) {
@@ -116,36 +117,10 @@ arcmsr_sysfs_iop_message_read(struct fil
}
if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
struct QBUFFER __iomem *prbuffer;
- uint8_t __iomem *iop_data, *vaddr, *temp;
- int32_t data_len_residual, data_len, rqbuf_lastindex;
- acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- rqbuf_lastindex = acb->rqbuf_lastindex;
+ acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
prbuffer = arcmsr_get_iop_rqbuffer(acb);
- iop_data = (uint8_t __iomem *)prbuffer->data;
- data_len_residual = data_len = readl(&prbuffer->data_len);
- if (data_len > 0) {
- temp = vaddr = kmalloc(data_len, GFP_ATOMIC);
- do {
- memcpy(temp, iop_data, 4);
- temp += 4;
- iop_data += 4;
- data_len_residual -= 4;
- } while (data_len_residual > 0);
- pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
- temp = vaddr;
- if ((rqbuf_lastindex + data_len) > ARCMSR_MAX_QBUFFER) {
- memcpy(pQbuffer, temp, ARCMSR_MAX_QBUFFER - rqbuf_lastindex);
- temp += (ARCMSR_MAX_QBUFFER - rqbuf_lastindex);
- rqbuf_lastindex = (rqbuf_lastindex + data_len) % ARCMSR_MAX_QBUFFER;
- memcpy(&acb->rqbuffer[0], temp, rqbuf_lastindex);
- } else {
- memcpy(pQbuffer, temp, data_len);
- rqbuf_lastindex = (rqbuf_lastindex + data_len) % ARCMSR_MAX_QBUFFER;
- }
- kfree(vaddr);
- }
- acb->rqbuf_lastindex = rqbuf_lastindex;
- arcmsr_iop_message_read(acb);
+ if (arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
+ acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
}
spin_unlock_irqrestore(&acb->rqbuffer_lock, flags);
return (allxfer_len);
@@ -177,7 +152,7 @@ arcmsr_sysfs_iop_message_write(struct fi
wqbuf_lastindex = acb->wqbuf_lastindex;
wqbuf_firstindex = acb->wqbuf_firstindex;
if (wqbuf_lastindex != wqbuf_firstindex) {
- arcmsr_post_ioctldata2iop(acb);
+ arcmsr_write_ioctldata2iop(acb);
spin_unlock_irqrestore(&acb->wqbuffer_lock, flags);
return 0; /*need retry*/
} else {
@@ -198,7 +173,7 @@ arcmsr_sysfs_iop_message_write(struct fi
ACB_F_MESSAGE_WQBUFFER_CLEARED) {
acb->acb_flags &=
~ACB_F_MESSAGE_WQBUFFER_CLEARED;
- arcmsr_post_ioctldata2iop(acb);
+ arcmsr_write_ioctldata2iop(acb);
}
spin_unlock_irqrestore(&acb->wqbuffer_lock, flags);
return count;
@@ -226,10 +201,7 @@ arcmsr_sysfs_iop_message_clear(struct fi
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
- if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- arcmsr_iop_message_read(acb);
- }
+ arcmsr_clear_iop2drv_rqueue_buffer(acb);
acb->acb_flags |=
(ACB_F_MESSAGE_WQBUFFER_CLEARED
| ACB_F_MESSAGE_RQBUFFER_CLEARED
diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h 2013-08-26 19:25:02.000000000 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h 2013-08-26 19:23:50.000000000 +0800
@@ -51,7 +51,7 @@ struct device_attribute;
#else
#define ARCMSR_MAX_FREECCB_NUM 320
#endif
-#define ARCMSR_DRIVER_VERSION "Driver Version 1.30.00.02 2013/05/15"
+#define ARCMSR_DRIVER_VERSION "Driver Version 1.30.00.03 2013/08/26"
#define ARCMSR_SCSI_INITIATOR_ID 255
#define ARCMSR_MAX_XFER_SECTORS 512
#define ARCMSR_MAX_XFER_SECTORS_B 4096
@@ -796,8 +796,10 @@ struct SENSE_DATA
#define ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE 0x01
#define ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE 0x1F
-extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *);
-extern void arcmsr_iop_message_read(struct AdapterControlBlock *);
+extern void arcmsr_write_ioctldata2iop(struct AdapterControlBlock *);
+extern uint32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *,
+ struct QBUFFER __iomem *);
+extern void arcmsr_clear_iop2drv_rqueue_buffer(struct AdapterControlBlock *);
extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *);
extern struct device_attribute *arcmsr_host_attrs[];
extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c 2013-05-16 04:20:04.000000000 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2013-08-26 19:01:40.000000000 +0800
@@ -70,7 +70,7 @@
#include <scsi/scsi_transport.h>
#include <scsi/scsicam.h>
#include "arcmsr.h"
-MODULE_AUTHOR("Nick Cheng <support@areca.com.tw>");
+MODULE_AUTHOR("Nick Cheng, Ching Huang <support@areca.com.tw>");
MODULE_DESCRIPTION("Areca SAS,SATA RAID Controller Driver");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_VERSION(ARCMSR_DRIVER_VERSION);
@@ -291,6 +291,7 @@ static void arcmsr_unmap_pciregion(struc
}
case ACB_ADAPTER_TYPE_D: {
iounmap(acb->mem_base0);
+ break;
}
}
}
@@ -543,19 +544,19 @@ arcmsr_flush_adapter_cache(struct Adapte
case ACB_ADAPTER_TYPE_A: {
arcmsr_hbaA_flush_cache(acb);
- }
break;
-
+ }
case ACB_ADAPTER_TYPE_B: {
arcmsr_hbaB_flush_cache(acb);
- }
break;
+ }
case ACB_ADAPTER_TYPE_C: {
arcmsr_hbaC_flush_cache(acb);
- }
break;
+ }
case ACB_ADAPTER_TYPE_D: {
arcmsr_hbaD_flush_cache(acb);
+ break;
}
}
}
@@ -728,6 +729,7 @@ arcmsr_alloc_ccb_pool(struct AdapterCont
dma_coherent_handle = dma_coherent_handle
+ roundup_ccbsize;
}
+ break;
}
}
for (i = 0; i < ARCMSR_MAX_TARGETID; i++)
@@ -1267,21 +1269,23 @@ arcmsr_abort_allcmd(struct AdapterContro
switch (acb->adapter_type) {
case ACB_ADAPTER_TYPE_A: {
rtnval = arcmsr_hbaA_abort_allcmd(acb);
- }
break;
+ }
case ACB_ADAPTER_TYPE_B: {
rtnval = arcmsr_hbaB_abort_allcmd(acb);
- }
break;
+ }
case ACB_ADAPTER_TYPE_C: {
rtnval = arcmsr_hbaC_abort_allcmd(acb);
- }
break;
+ }
+
case ACB_ADAPTER_TYPE_D: {
rtnval = arcmsr_hbaD_abort_allcmd(acb);
- }
+ break;
+ }
}
return rtnval;
}
@@ -1696,9 +1700,8 @@ arcmsr_enable_outbound_ints(struct Adapt
writel(mask, ®->outbound_intmask);
acb->outbound_int_enable = ~(intmask_org & mask) &
0x000000ff;
- }
break;
-
+ }
case ACB_ADAPTER_TYPE_B: {
struct MessageUnit_B *reg = acb->pmuB;
mask = intmask_org | (ARCMSR_IOP2DRV_DATA_WRITE_OK |
@@ -1708,8 +1711,8 @@ arcmsr_enable_outbound_ints(struct Adapt
writel(mask, reg->iop2drv_doorbell_mask);
acb->outbound_int_enable = (intmask_org | mask) &
0x0000000f;
- }
break;
+ }
case ACB_ADAPTER_TYPE_C: {
struct MessageUnit_C __iomem *reg = acb->pmuC;
mask = ~(ARCMSR_HBCMU_UTILITY_A_ISR_MASK |
@@ -1718,12 +1721,13 @@ arcmsr_enable_outbound_ints(struct Adapt
writel(intmask_org & mask, ®->host_int_mask);
acb->outbound_int_enable = ~(intmask_org & mask) &
0x0000000f;
- }
break;
+ }
case ACB_ADAPTER_TYPE_D: {
struct MessageUnit_D __iomem *reg = acb->pmuD;
mask = ARCMSR_ARC1214_ALL_INT_ENABLE;
writel(intmask_org | mask, reg->pcief0_int_enable);
+ break;
}
}
}
@@ -1863,7 +1867,7 @@ arcmsr_post_ccb(struct AdapterControlBlo
pinbound_srb = (struct InBound_SRB *)&pmu->post_qbuffer[postq_index & 0xFF];
pinbound_srb->addressHigh = dma_addr_hi32(cdb_phyaddr);
pinbound_srb->addressLow = dma_addr_lo32(cdb_phyaddr);
- pinbound_srb->length = arccdbsize / 4;
+ pinbound_srb->length = arccdbsize >> 2;
arcmsr_cdb->msgContext = dma_addr_lo32(cdb_phyaddr);
if (postq_index & 0x4000) {
index_stripped = postq_index & 0xFF;
@@ -1878,6 +1882,7 @@ arcmsr_post_ccb(struct AdapterControlBlo
}
writel(postq_index, pmu->inboundlist_write_pointer);
spin_unlock_irqrestore(&acb->postq_lock, flags);
+ break;
}
}
}
@@ -1921,7 +1926,6 @@ arcmsr_hbaC_stop_bgrb(struct AdapterCont
"background rebulid' timeout\n"
, pACB->host->host_no);
}
- return;
}
static void
@@ -1938,7 +1942,6 @@ arcmsr_hbaD_stop_bgrb(struct AdapterCont
"rebulid' timeout\n"
, pACB->host->host_no);
}
- return;
}
static void
@@ -2124,193 +2127,174 @@ struct QBUFFER __iomem
return pqbuffer;
}
+static uint32_t
+arcmsr_Read_iop_rqbuffer_in_DWORD(struct AdapterControlBlock *acb,
+ struct QBUFFER __iomem *prbuffer) {
+
+ uint8_t *pQbuffer;
+ uint8_t *buf1 = 0;
+ uint32_t __iomem *iop_data;
+ uint32_t iop_len, data_len, *buf2 = 0;
+
+ iop_data = (uint32_t *)prbuffer->data;
+ iop_len = readl(&prbuffer->data_len);
+ if ( iop_len > 0 ) {
+ buf1 = kmalloc(128, GFP_ATOMIC);
+ buf2 = (uint32_t *)buf1;
+ if( buf1 == NULL)
+ return (0);
+ data_len = iop_len;
+ while (data_len >= 4) {
+ *buf2++ = *iop_data++;
+ data_len -= 4;
+ }
+ if(data_len)
+ *buf2 = *iop_data;
+ buf2 = (uint32_t *)buf1;
+ }
+ while (iop_len > 0) {
+ pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
+ *pQbuffer = *buf1;
+ acb->rqbuf_lastindex++;
+ /* if last, index number set it to 0 */
+ acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
+ buf1++;
+ iop_len--;
+ }
+ if (buf2)
+ kfree( (uint8_t *)buf2);
+ /* let IOP know data has been read */
+ arcmsr_iop_message_read(acb);
+ return (1);
+}
+
+uint32_t
+arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb,
+ struct QBUFFER __iomem *prbuffer) {
+
+ uint8_t *pQbuffer;
+ uint8_t __iomem *iop_data;
+ uint32_t iop_len;
+
+ if (acb->adapter_type & (ACB_ADAPTER_TYPE_C | ACB_ADAPTER_TYPE_D)) {
+ return(arcmsr_Read_iop_rqbuffer_in_DWORD(acb, prbuffer));
+ }
+ iop_data = (uint8_t *)prbuffer->data;
+ iop_len = readl(&prbuffer->data_len);
+ while (iop_len > 0) {
+ pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
+ *pQbuffer = *iop_data;
+ acb->rqbuf_lastindex++;
+ acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
+ iop_data++;
+ iop_len--;
+ }
+ arcmsr_iop_message_read(acb);
+ return (1);
+}
+
void
arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb)
{
- uint8_t __iomem *iop_data, *pQbuffer, *vaddr, *temp;
- int32_t buf_empty_len, data_len, data_len_residual;
- uint32_t rqbuf_firstindex, rqbuf_lastindex;
unsigned long flags;
struct QBUFFER __iomem *prbuffer;
+ int32_t buf_empty_len;
+
spin_lock_irqsave(&acb->rqbuffer_lock, flags);
- rqbuf_lastindex = acb->rqbuf_lastindex;
- rqbuf_firstindex = acb->rqbuf_firstindex;
prbuffer = arcmsr_get_iop_rqbuffer(acb);
- iop_data = (uint8_t __iomem *)prbuffer->data;
- data_len_residual = data_len = readl(&prbuffer->data_len);
- buf_empty_len = (rqbuf_firstindex - rqbuf_lastindex - 1) &
- (ARCMSR_MAX_QBUFFER - 1);
- if (buf_empty_len >= data_len) {
- if (data_len > 0) {
- temp = vaddr = kmalloc(data_len, GFP_ATOMIC);
- if (!vaddr) {
- goto leave;
- }
- acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- while (data_len_residual >= 4) {
- memcpy(temp, iop_data, 4);
- temp += 4;
- iop_data += 4;
- data_len_residual -= 4;
- }
- if ((data_len_residual > 0) &&
- (data_len_residual < 4)) {
- memcpy(temp, iop_data, data_len_residual);
- }
- pQbuffer = &acb->rqbuffer[rqbuf_lastindex];
- temp = vaddr;
- if ((rqbuf_lastindex + data_len) >
- ARCMSR_MAX_QBUFFER) {
- memcpy(pQbuffer, temp,
- ARCMSR_MAX_QBUFFER - rqbuf_lastindex);
- temp += (ARCMSR_MAX_QBUFFER -
- rqbuf_lastindex);
- rqbuf_lastindex = (rqbuf_lastindex + data_len)
- % ARCMSR_MAX_QBUFFER;
- memcpy(&acb->rqbuffer[0], temp,
- rqbuf_lastindex);
- } else {
- memcpy(pQbuffer, temp, data_len);
- rqbuf_lastindex = (rqbuf_lastindex + data_len)
- % ARCMSR_MAX_QBUFFER;
- }
- kfree(vaddr);
- acb->rqbuf_lastindex = rqbuf_lastindex;
- arcmsr_iop_message_read(acb);
- }
+ buf_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex -1) &
+ (ARCMSR_MAX_QBUFFER -1);
+ if (buf_empty_len >= prbuffer->data_len) {
+ if (arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
+ acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
} else {
acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
}
- leave:
spin_unlock_irqrestore(&acb->rqbuffer_lock, flags);
}
-void
-arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb)
+static void
+arcmsr_write_ioctldata2iop_in_DWORD(struct AdapterControlBlock *acb)
{
- unsigned long flags;
- spin_lock_irqsave(&acb->wqbuffer_lock, flags);
- acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED;
- if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) {
- uint8_t *pQbuffer;
- struct QBUFFER __iomem *pwbuffer;
- uint8_t __iomem *iop_data;
- int32_t allxfer_len = 0;
+ uint8_t *pQbuffer;
+ struct QBUFFER __iomem *pwbuffer;
+ uint8_t *buf1 = 0;
+ uint32_t __iomem *iop_data;
+ uint32_t allxfer_len = 0, data_len, *buf2 = 0;
+
+ if (acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READED) {
+ buf1 = kmalloc(128, GFP_ATOMIC);
+ buf2 = (uint32_t *)buf1;
+ if( buf1 == NULL)
+ return;
acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED);
pwbuffer = arcmsr_get_iop_wqbuffer(acb);
- iop_data = (uint8_t __iomem *)pwbuffer->data;
- if (acb->wqbuf_firstindex > acb->wqbuf_lastindex) {
- if ((ARCMSR_MAX_QBUFFER - acb->wqbuf_firstindex) >= 4) {
- do {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- if (acb->wqbuf_firstindex + 4
- > ARCMSR_MAX_QBUFFER) {
- memcpy(iop_data, pQbuffer,
- ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex);
- iop_data += ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex += 4;
- acb->wqbuf_firstindex %=
- ARCMSR_MAX_QBUFFER;
- memcpy(iop_data,
- &acb->wqbuffer[0],
- acb->wqbuf_firstindex);
- iop_data +=
- acb->wqbuf_firstindex;
- } else {
- if ((acb->wqbuf_lastindex
- - acb->wqbuf_firstindex) > 4) {
- memcpy(iop_data,
- pQbuffer, 4);
- acb->wqbuf_firstindex
- += 4;
- acb->wqbuf_firstindex
- %= ARCMSR_MAX_QBUFFER;
- iop_data += 4;
- } else {
- memcpy(iop_data, pQbuffer,
- acb->wqbuf_lastindex
- - acb->wqbuf_firstindex);
- allxfer_len +=
- acb->wqbuf_lastindex -
- acb->wqbuf_firstindex;
- acb->wqbuf_firstindex =
- acb->wqbuf_lastindex;
- break;
- }
- }
- allxfer_len += 4;
- } while ((acb->wqbuf_firstindex !=
- acb->wqbuf_lastindex) && (allxfer_len < 124));
- } else {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- memcpy(iop_data, pQbuffer, ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex);
- iop_data += ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex;
- allxfer_len = ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex = 0;
- do {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- if ((acb->wqbuf_lastindex -
- acb->wqbuf_firstindex) > 4) {
- memcpy(iop_data, pQbuffer, 4);
- acb->wqbuf_firstindex += 4;
- acb->wqbuf_firstindex %=
- ARCMSR_MAX_QBUFFER;
- iop_data += 4;
- } else {
- memcpy(iop_data, pQbuffer,
- acb->wqbuf_lastindex -
- acb->wqbuf_firstindex);
- allxfer_len +=
- acb->wqbuf_lastindex
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex =
- acb->wqbuf_lastindex;
- break;
- }
- allxfer_len += 4;
- } while ((acb->wqbuf_firstindex !=
- acb->wqbuf_lastindex) && (allxfer_len < 124));
- }
- } else {
- do {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- if ((acb->wqbuf_lastindex -
- acb->wqbuf_firstindex) > 4) {
- memcpy(iop_data, pQbuffer, 4);
- acb->wqbuf_firstindex += 4;
- acb->wqbuf_firstindex %=
- ARCMSR_MAX_QBUFFER;
- iop_data += 4;
- } else {
- memcpy(iop_data, pQbuffer,
- acb->wqbuf_lastindex -
- acb->wqbuf_firstindex);
- allxfer_len += acb->wqbuf_lastindex
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex =
- acb->wqbuf_lastindex;
- break;
- }
- allxfer_len += 4;
- } while ((acb->wqbuf_firstindex !=
- acb->wqbuf_lastindex) && (allxfer_len < 124));
+ iop_data = (uint32_t *)pwbuffer->data;
+ while ((acb->wqbuf_firstindex != acb->wqbuf_lastindex)
+ && (allxfer_len < 124)) {
+ pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex];
+ *buf1 = *pQbuffer;
+ acb->wqbuf_firstindex++;
+ acb->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
+ buf1++;
+ allxfer_len++;
+ }
+ data_len = allxfer_len;
+ buf1 = (uint8_t *)buf2;
+ while (data_len >= 4) {
+ *iop_data++ = *buf2++;
+ data_len -= 4;
}
+ if (data_len)
+ *iop_data = *buf2;
writel(allxfer_len, &pwbuffer->data_len);
- arcmsr_iop_message_wrote(acb);/*notice IOP the message has been written*/
+ kfree( buf1);
+ arcmsr_iop_message_wrote(acb);
}
- if (acb->wqbuf_firstindex == acb->wqbuf_lastindex) {
- acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_CLEARED;
+}
+
+void
+arcmsr_write_ioctldata2iop(struct AdapterControlBlock *acb)
+{
+ uint8_t *pQbuffer;
+ struct QBUFFER __iomem *pwbuffer;
+ uint8_t __iomem *iop_data;
+ int32_t allxfer_len=0;
+
+ if (acb->adapter_type & (ACB_ADAPTER_TYPE_C | ACB_ADAPTER_TYPE_D)) {
+ arcmsr_write_ioctldata2iop_in_DWORD(acb);
+ return;
}
+ if (acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READED) {
+ acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED);
+ pwbuffer = arcmsr_get_iop_wqbuffer(acb);
+ iop_data = (uint8_t *)pwbuffer->data;
+ while ((acb->wqbuf_firstindex != acb->wqbuf_lastindex)
+ && (allxfer_len < 124)) {
+ pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex];
+ *iop_data = *pQbuffer;
+ acb->wqbuf_firstindex++;
+ acb->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
+ iop_data++;
+ allxfer_len++;
+ }
+ writel(allxfer_len, &pwbuffer->data_len);
+ arcmsr_iop_message_wrote(acb);
+ }
+}
+
+void
+arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&acb->wqbuffer_lock, flags);
+ acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED;
+ if (acb->wqbuf_firstindex != acb->wqbuf_lastindex)
+ arcmsr_write_ioctldata2iop(acb);
+ if (acb->wqbuf_firstindex == acb->wqbuf_lastindex)
+ acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_CLEARED;
spin_unlock_irqrestore(&acb->wqbuffer_lock, flags);
}
@@ -2361,7 +2345,6 @@ arcmsr_hbaC_doorbell_isr(struct AdapterC
} while (outbound_doorbell & (ARCMSR_HBCMU_IOP2DRV_DATA_WRITE_OK
| ARCMSR_HBCMU_IOP2DRV_DATA_READ_OK
| ARCMSR_HBCMU_IOP2DRV_MESSAGE_CMD_DONE));
- return;
}
static void
@@ -2390,7 +2373,6 @@ arcmsr_hbaD_doorbell_isr(struct AdapterC
} while (outbound_doorbell & (ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK
| ARCMSR_ARC1214_IOP2DRV_DATA_READ_OK
| ARCMSR_ARC1214_IOP2DRV_MESSAGE_CMD_DONE));
- return;
}
static void
@@ -2710,132 +2692,24 @@ arcmsr_iop_parking(struct AdapterControl
}
void
-arcmsr_post_ioctldata2iop(struct AdapterControlBlock *acb)
+arcmsr_clear_iop2drv_rqueue_buffer(struct AdapterControlBlock *acb)
{
- if (acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READED) {
- if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) {
- uint8_t *pQbuffer;
- uint8_t __iomem *iop_data;
- int32_t allxfer_len = 0;
- struct QBUFFER __iomem *pwbuffer;
- acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED);
- pwbuffer = arcmsr_get_iop_wqbuffer(acb);
- iop_data = (uint8_t __iomem *)pwbuffer->data;
- if (acb->wqbuf_firstindex > acb->wqbuf_lastindex) {
- if ((ARCMSR_MAX_QBUFFER -
- acb->wqbuf_firstindex) >= 4) {
- do {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- if (acb->wqbuf_firstindex + 4 >
- ARCMSR_MAX_QBUFFER) {
- memcpy(iop_data, pQbuffer,
- ARCMSR_MAX_QBUFFER - acb->wqbuf_firstindex);
- iop_data += ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex += 4;
- acb->wqbuf_firstindex %=
- ARCMSR_MAX_QBUFFER;
- memcpy(iop_data,
- &acb->wqbuffer[0],
- acb->wqbuf_firstindex);
- iop_data +=
- acb->wqbuf_firstindex;
- } else {
- if ((acb->wqbuf_lastindex -
- acb->wqbuf_firstindex) > 4) {
- memcpy(iop_data,
- pQbuffer, 4);
- acb->wqbuf_firstindex
- += 4;
- acb->wqbuf_firstindex
- %= ARCMSR_MAX_QBUFFER;
- iop_data += 4;
- } else {
- memcpy(iop_data,
- pQbuffer,
- acb->wqbuf_lastindex
- - acb->wqbuf_firstindex);
- allxfer_len +=
- acb->wqbuf_lastindex
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex
- = acb->wqbuf_lastindex;
- break;
- }
- }
- allxfer_len += 4;
- } while ((acb->wqbuf_firstindex !=
- acb->wqbuf_lastindex) &&
- (allxfer_len < 124));
- } else {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- memcpy(iop_data, pQbuffer,
- ARCMSR_MAX_QBUFFER -
- acb->wqbuf_firstindex);
- iop_data += ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex;
- allxfer_len = ARCMSR_MAX_QBUFFER
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex = 0;
- do {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- if ((acb->wqbuf_lastindex -
- acb->wqbuf_firstindex) > 4) {
- memcpy(iop_data,
- pQbuffer, 4);
- acb->wqbuf_firstindex
- += 4;
- acb->wqbuf_firstindex
- %= ARCMSR_MAX_QBUFFER;
- iop_data += 4;
- } else {
- memcpy(iop_data, pQbuffer,
- acb->wqbuf_lastindex
- - acb->wqbuf_firstindex);
- allxfer_len +=
- acb->wqbuf_lastindex
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex =
- acb->wqbuf_lastindex;
- break;
- }
- allxfer_len += 4;
- } while ((acb->wqbuf_firstindex
- != acb->wqbuf_lastindex) &&
- (allxfer_len < 124));
- }
- } else {
- do {
- pQbuffer =
- &acb->wqbuffer[acb->wqbuf_firstindex];
- if ((acb->wqbuf_lastindex -
- acb->wqbuf_firstindex) > 4) {
- memcpy(iop_data,
- pQbuffer, 4);
- acb->wqbuf_firstindex
- += 4;
- acb->wqbuf_firstindex
- %= ARCMSR_MAX_QBUFFER;
- iop_data += 4;
- } else {
- memcpy(iop_data, pQbuffer,
- acb->wqbuf_lastindex -
- acb->wqbuf_firstindex);
- allxfer_len += acb->wqbuf_lastindex
- - acb->wqbuf_firstindex;
- acb->wqbuf_firstindex =
- acb->wqbuf_lastindex;
- break;
- }
- allxfer_len += 4;
- } while ((acb->wqbuf_firstindex !=
- acb->wqbuf_lastindex) && (allxfer_len < 124));
- }
- writel(allxfer_len, &pwbuffer->data_len);
- arcmsr_iop_message_wrote(acb);
+ uint32_t i;
+
+ if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
+ for (i=0; i < 15; i++) {
+ if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
+ acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
+ acb->rqbuf_firstindex = 0;
+ acb->rqbuf_lastindex = 0;
+ arcmsr_iop_message_read(acb);
+ mdelay(30);
+ } else if (acb->rqbuf_firstindex != acb->rqbuf_lastindex) {
+ acb->rqbuf_firstindex = 0;
+ acb->rqbuf_lastindex = 0;
+ mdelay(30);
+ } else
+ break;
}
}
}
@@ -2889,6 +2763,7 @@ arcmsr_iop_message_xfer(struct AdapterCo
acb->rqbuf_firstindex) >= 1032) {
memcpy(ptmpQbuffer, pQbuffer, 1032);
acb->rqbuf_firstindex += 1032;
+ acb->rqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
allxfer_len = 1032;
} else {
if (((ARCMSR_MAX_QBUFFER -
@@ -2941,58 +2816,16 @@ arcmsr_iop_message_xfer(struct AdapterCo
}
}
}
+ memcpy(pcmdmessagefld->messagedatabuffer, ver_addr, allxfer_len);
if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
struct QBUFFER __iomem *prbuffer;
- uint8_t __iomem *iop_data, *vaddr, *temp;
- uint32_t data_len_residual, data_len, rqbuf_lastindex;
- rqbuf_lastindex = acb->rqbuf_lastindex;
+ acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
prbuffer = arcmsr_get_iop_rqbuffer(acb);
- iop_data = (uint8_t __iomem *)prbuffer->data;
- data_len_residual = data_len = readl(&prbuffer->data_len);
- if (data_len > 0) {
- temp = vaddr = kmalloc(data_len, GFP_ATOMIC);
- if (!vaddr) {
- goto leave;
- }
- acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- while (data_len_residual >= 4) {
- memcpy(temp, iop_data, 4);
- temp += 4;
- iop_data += 4;
- data_len_residual -= 4;
- }
- if ((data_len_residual > 0) &&
- (data_len_residual < 4)) {
- memcpy(temp, iop_data,
- data_len_residual);
- }
- pQbuffer =
- &acb->rqbuffer[acb->rqbuf_lastindex];
- temp = vaddr;
- if ((rqbuf_lastindex + data_len) >
- ARCMSR_MAX_QBUFFER) {
- memcpy(pQbuffer, temp,
- ARCMSR_MAX_QBUFFER - rqbuf_lastindex);
- temp += (ARCMSR_MAX_QBUFFER -
- rqbuf_lastindex);
- rqbuf_lastindex = (rqbuf_lastindex +
- data_len) % ARCMSR_MAX_QBUFFER;
- memcpy(&acb->rqbuffer[0],
- temp, rqbuf_lastindex);
- } else {
- memcpy(pQbuffer, temp, data_len);
- rqbuf_lastindex =
- (rqbuf_lastindex + data_len) %
- ARCMSR_MAX_QBUFFER;
- }
- kfree(vaddr);
- acb->rqbuf_lastindex = rqbuf_lastindex;
- arcmsr_iop_message_read(acb);
- }
+ if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
+ acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
}
- leave:
spin_unlock_irqrestore(&acb->rqbuffer_lock, flags);
- memcpy(pcmdmessagefld->messagedatabuffer, ver_addr, allxfer_len);
+ kfree(ver_addr);
pcmdmessagefld->cmdmessage.Length = allxfer_len;
if (acb->fw_flag == FW_DEADLOCK) {
pcmdmessagefld->cmdmessage.ReturnCode =
@@ -3001,7 +2834,6 @@ arcmsr_iop_message_xfer(struct AdapterCo
pcmdmessagefld->cmdmessage.ReturnCode =
ARCMSR_MESSAGE_RETURNCODE_OK;
}
- kfree(ver_addr);
break;
}
case ARCMSR_MESSAGE_WRITE_WQBUFFER: {
@@ -3014,13 +2846,6 @@ arcmsr_iop_message_xfer(struct AdapterCo
retvalue = ARCMSR_MESSAGE_FAIL;
goto message_out;
}
- if (acb->fw_flag == FW_DEADLOCK) {
- pcmdmessagefld->cmdmessage.ReturnCode =
- ARCMSR_MESSAGE_RETURNCODE_BUS_HANG_ON;
- } else {
- pcmdmessagefld->cmdmessage.ReturnCode =
- ARCMSR_MESSAGE_RETURNCODE_OK;
- }
ptmpuserbuffer = ver_addr;
user_len = pcmdmessagefld->cmdmessage.Length;
memcpy(ptmpuserbuffer, pcmdmessagefld->messagedatabuffer,
@@ -3031,7 +2856,7 @@ arcmsr_iop_message_xfer(struct AdapterCo
if (wqbuf_lastindex != wqbuf_firstindex) {
struct SENSE_DATA *sensebuffer =
(struct SENSE_DATA *)cmd->sense_buffer;
- arcmsr_post_ioctldata2iop(acb);
+ arcmsr_write_ioctldata2iop(acb);
/* has error report sensedata */
sensebuffer->ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
sensebuffer->SenseKey = ILLEGAL_REQUEST;
@@ -3068,7 +2893,7 @@ arcmsr_iop_message_xfer(struct AdapterCo
ACB_F_MESSAGE_WQBUFFER_CLEARED) {
acb->acb_flags &=
~ACB_F_MESSAGE_WQBUFFER_CLEARED;
- arcmsr_post_ioctldata2iop(acb);
+ arcmsr_write_ioctldata2iop(acb);
}
} else {
struct SENSE_DATA *sensebuffer =
@@ -3085,16 +2910,20 @@ arcmsr_iop_message_xfer(struct AdapterCo
}
spin_unlock_irqrestore(&acb->wqbuffer_lock, flags);
kfree(ver_addr);
+ if (acb->fw_flag == FW_DEADLOCK) {
+ pcmdmessagefld->cmdmessage.ReturnCode =
+ ARCMSR_MESSAGE_RETURNCODE_BUS_HANG_ON;
+ } else {
+ pcmdmessagefld->cmdmessage.ReturnCode =
+ ARCMSR_MESSAGE_RETURNCODE_OK;
+ }
break;
}
case ARCMSR_MESSAGE_CLEAR_RQBUFFER: {
uint8_t *pQbuffer = acb->rqbuffer;
+ arcmsr_clear_iop2drv_rqueue_buffer(acb);
spin_lock_irqsave(&acb->rqbuffer_lock, flags);
- if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- arcmsr_iop_message_read(acb);
- }
acb->acb_flags |= ACB_F_MESSAGE_RQBUFFER_CLEARED;
acb->rqbuf_firstindex = 0;
acb->rqbuf_lastindex = 0;
@@ -3111,32 +2940,25 @@ arcmsr_iop_message_xfer(struct AdapterCo
}
case ARCMSR_MESSAGE_CLEAR_WQBUFFER: {
uint8_t *pQbuffer = acb->wqbuffer;
- if (acb->fw_flag == FW_DEADLOCK) {
- pcmdmessagefld->cmdmessage.ReturnCode =
- ARCMSR_MESSAGE_RETURNCODE_BUS_HANG_ON;
- } else {
- pcmdmessagefld->cmdmessage.ReturnCode =
- ARCMSR_MESSAGE_RETURNCODE_OK;
- }
spin_lock_irqsave(&acb->wqbuffer_lock, flags);
- if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- arcmsr_iop_message_read(acb);
- }
acb->acb_flags |= (ACB_F_MESSAGE_WQBUFFER_CLEARED |
ACB_F_MESSAGE_WQBUFFER_READED);
acb->wqbuf_firstindex = 0;
acb->wqbuf_lastindex = 0;
memset(pQbuffer, 0, ARCMSR_MAX_QBUFFER);
spin_unlock_irqrestore(&acb->wqbuffer_lock, flags);
+ if (acb->fw_flag == FW_DEADLOCK) {
+ pcmdmessagefld->cmdmessage.ReturnCode =
+ ARCMSR_MESSAGE_RETURNCODE_BUS_HANG_ON;
+ } else {
+ pcmdmessagefld->cmdmessage.ReturnCode =
+ ARCMSR_MESSAGE_RETURNCODE_OK;
+ }
break;
}
case ARCMSR_MESSAGE_CLEAR_ALLQBUFFER: {
uint8_t *pQbuffer;
- if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
- acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
- arcmsr_iop_message_read(acb);
- }
+ arcmsr_clear_iop2drv_rqueue_buffer(acb);
spin_lock_irqsave(&acb->rqbuffer_lock, flags);
acb->acb_flags |= ACB_F_MESSAGE_RQBUFFER_CLEARED;
acb->rqbuf_firstindex = 0;
@@ -3376,11 +3198,10 @@ arcmsr_hbaA_get_config(struct AdapterCon
iop_device_map++;
count--;
}
- pr_notice("Areca RAID Controller%d: F/W %s "
- "& Model %s\n",
+ pr_notice("Areca RAID Controller%d: Model %s, F/W %s\n",
acb->host->host_no,
- acb->firm_version,
- acb->firm_model);
+ acb->firm_model,
+ acb->firm_version);
acb->signature = readl(®->message_rwbuffer[0]);
acb->firm_request_len = readl(®->message_rwbuffer[1]);
acb->firm_numbers_queue = readl(®->message_rwbuffer[2]);
@@ -3472,11 +3293,10 @@ arcmsr_hbaB_get_config(struct AdapterCon
count--;
}
- pr_notice("Areca RAID Controller%d: "
- "F/W %s & Model %s\n",
+ pr_notice("Areca RAID Controller%d: Model %s, F/W %s\n",
acb->host->host_no,
- acb->firm_version,
- acb->firm_model);
+ acb->firm_model,
+ acb->firm_version);
acb->signature = readl(®->message_rwbuffer[1]);
/*firm_signature,1,00-03*/
@@ -3543,11 +3363,10 @@ arcmsr_hbaC_get_config(struct AdapterCon
iop_firm_version++;
count--;
}
- pr_notice("Areca RAID Controller%d: F/W %s & "
- "Model %s\n",
- pACB->host->host_no,
- pACB->firm_version,
- pACB->firm_model);
+ pr_notice("Areca RAID Controller%d: Model %s, F/W %s\n",
+ pACB->host->host_no,
+ pACB->firm_model,
+ pACB->firm_version);
pACB->firm_request_len = readl(®->msgcode_rwbuffer[1]);
pACB->firm_numbers_queue = readl(®->msgcode_rwbuffer[2]);
pACB->firm_sdram_size = readl(®->msgcode_rwbuffer[3]);
@@ -3686,8 +3505,10 @@ arcmsr_hbaD_get_config(struct AdapterCon
acb->firm_hd_channels = readl(®->msgcode_rwbuffer[5]);
/*firm_hd_channels,4,16-19*/
acb->firm_cfg_version = readl(®->msgcode_rwbuffer[25]);
- pr_notice("Areca RAID Controller%d: F/W %s & Model %s\n",
- acb->host->host_no, acb->firm_version, acb->firm_model);
+ pr_notice("Areca RAID Controller%d: Model %s, F/W %s\n",
+ acb->host->host_no,
+ acb->firm_model,
+ acb->firm_version);
return true;
}
@@ -4026,6 +3847,7 @@ arcmsr_polling_ccbdone(struct AdapterCon
}
case ACB_ADAPTER_TYPE_D: {
rtn = arcmsr_hbaD_polling_ccbdone(acb, poll_ccb);
+ break;
}
}
return rtn;
@@ -4227,7 +4049,6 @@ arcmsr_hbaA_request_device_map(struct Ad
mod_timer(&acb->eternal_timer, jiffies +
msecs_to_jiffies(6 * HZ));
}
- return;
}
static void
@@ -4258,7 +4079,6 @@ arcmsr_hbaB_request_device_map(struct Ad
mod_timer(&acb->eternal_timer, jiffies +
msecs_to_jiffies(6 * HZ));
}
- return;
}
static void
@@ -4291,7 +4111,6 @@ arcmsr_hbaC_request_device_map(struct Ad
mod_timer(&acb->eternal_timer, jiffies +
msecs_to_jiffies(6 * HZ));
}
- return;
}
static void
@@ -4321,7 +4140,6 @@ arcmsr_hbaD_request_device_map(struct Ad
mod_timer(&acb->eternal_timer, jiffies +
msecs_to_jiffies(6 * HZ));
}
- return;
}
static void
@@ -4344,6 +4162,7 @@ arcmsr_request_device_map(unsigned long
}
case ACB_ADAPTER_TYPE_D: {
arcmsr_hbaD_request_device_map(acb);
+ break;
}
}
}
@@ -4451,23 +4270,45 @@ arcmsr_clear_doorbell_queue_buffer(struc
case ACB_ADAPTER_TYPE_C: {
struct MessageUnit_C *reg =
(struct MessageUnit_C *)acb->pmuC;
- uint32_t outbound_doorbell;
+ uint32_t outbound_doorbell, i;
/* empty doorbell Qbuffer if door bell ringed */
outbound_doorbell = readl(®->outbound_doorbell);
writel(outbound_doorbell, ®->outbound_doorbell_clear);
writel(ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK,
®->inbound_doorbell);
+ for (i=0; i < 200; i++) {
+ msleep(10);
+ outbound_doorbell = readl(®->outbound_doorbell);
+ if (outbound_doorbell & ARCMSR_HBCMU_IOP2DRV_DATA_WRITE_OK) {
+ writel(outbound_doorbell,
+ ®->outbound_doorbell_clear);
+ writel(ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK,
+ ®->inbound_doorbell);
+ } else
+ break;
+ }
}
break;
case ACB_ADAPTER_TYPE_D: {
struct MessageUnit_D __iomem *reg =
(struct MessageUnit_D *)acb->pmuD;
- uint32_t outbound_doorbell;
+ uint32_t outbound_doorbell, i;
/* empty doorbell Qbuffer if door bell ringed */
outbound_doorbell = readl(reg->outbound_doorbell);
writel(outbound_doorbell, reg->outbound_doorbell);
writel(ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ,
reg->inbound_doorbell);
+ for (i=0; i < 200; i++) {
+ msleep(10);
+ outbound_doorbell = readl(reg->outbound_doorbell);
+ if (outbound_doorbell & ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK) {
+ writel(outbound_doorbell,
+ reg->outbound_doorbell);
+ writel(ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ,
+ reg->inbound_doorbell);
+ } else
+ break;
+ }
break;
}
}
@@ -4901,12 +4742,13 @@ static const char
type = "SAS";
break;
default:
- type = "X-TYPE";
+ type = "unknown";
+ raid6 = 0;
break;
}
- sprintf(buf, "Areca %s Host Adapter RAID Controller%s\n %s",
- type, raid6 ? "( RAID6 capable)" : "",
- ARCMSR_DRIVER_VERSION);
+ sprintf(buf, "Areca %s Host Adapter RAID Controller%s\narcmsr "
+ "version %s\n",type, raid6 ? "( RAID6 capable)" : "",
+ ARCMSR_DRIVER_VERSION);
return buf;
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 3/3] arcmsr: Fix bug of updating adapter firmware through ioctl(ARCHTTP) interface
2013-08-26 4:28 [PATCH 3/3] arcmsr: Fix bug of updating adapter firmware through ioctl(ARCHTTP) interface 黃清隆
@ 2013-08-26 10:20 ` James Bottomley
2013-08-26 14:19 ` [PATCH 1/2] scsi: fix warning with unused variable Seungwon Jeon
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: James Bottomley @ 2013-08-26 10:20 UTC (permalink / raw)
To: 黃清隆; +Cc: linux-scsi, linux-kernel, jejb
On Mon, 2013-08-26 at 12:28 +0800, 黃清隆 wrote:
> From: Ching <ching2048@areca.com.tw>
>
> Fix bug of updating adapter firmware through ioctl(ARCHTTP) interface.
> Signed-off-by: Ching <ching2048@areca.com.tw>
> ---
This one has a set of nasty checkpatch errors:
WARNING: please, no spaces at the start of a line
#31: FILE: drivers/scsi/arcmsr/arcmsr.h:801:
+ struct QBUFFER __iomem *);$
ERROR: space prohibited after that open parenthesis '('
#283: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2141:
+ if ( iop_len > 0 ) {
ERROR: space prohibited before that close parenthesis ')'
#283: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2141:
+ if ( iop_len > 0 ) {
ERROR: space prohibited after that open parenthesis '('
#286: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2144:
+ if( buf1 == NULL)
ERROR: space required before the open parenthesis '('
#286: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2144:
+ if( buf1 == NULL)
ERROR: return is not a function, parentheses are not required
#287: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2145:
+ return (0);
ERROR: space required before the open parenthesis '('
#293: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2151:
+ if(data_len)
ERROR: space prohibited after that open parenthesis '('
#307: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2165:
+ kfree( (uint8_t *)buf2);
ERROR: return is not a function, parentheses are not required
#310: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2168:
+ return (1);
WARNING: please, no spaces at the start of a line
#315: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2173:
+ struct QBUFFER __iomem *prbuffer) {$
WARNING: braces {} are not necessary for single statement blocks
#321: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2179:
+ if (acb->adapter_type & (ACB_ADAPTER_TYPE_C |
ACB_ADAPTER_TYPE_D)) {
+ return(arcmsr_Read_iop_rqbuffer_in_DWORD(acb,
prbuffer));
+ }
ERROR: return is not a function, parentheses are not required
#322: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2180:
+ return(arcmsr_Read_iop_rqbuffer_in_DWORD(acb,
prbuffer));
ERROR: return is not a function, parentheses are not required
#335: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2193:
+ return (1);
ERROR: need consistent spacing around '-' (ctx:WxV)
#394: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2205:
+ buf_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex
-1) &
^
ERROR: need consistent spacing around '-' (ctx:WxV)
#395: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2206:
+ (ARCMSR_MAX_QBUFFER -1);
^
ERROR: trailing whitespace
#424: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2224:
+^I$
ERROR: space prohibited after that open parenthesis '('
#428: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2228:
+ if( buf1 == NULL)
ERROR: space required before the open parenthesis '('
#428: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2228:
+ if( buf1 == NULL)
ERROR: space prohibited after that open parenthesis '('
#557: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2252:
+ kfree( buf1);
ERROR: spaces required around that '=' (ctx:VxV)
#568: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2263:
+ int32_t allxfer_len=0;
^
ERROR: trailing whitespace
#569: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2264:
+^I$
ERROR: trailing whitespace
#578: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2273:
+^I^Iwhile ((acb->wqbuf_firstindex != acb->wqbuf_lastindex) $
ERROR: spaces required around that '=' (ctx:VxV)
#759: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2700:
+ for (i=0; i < 15; i++) {
^
WARNING: line over 80 characters
#766: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2707:
+ } else if (acb->rqbuf_firstindex !=
acb->rqbuf_lastindex) {
ERROR: trailing whitespace
#770: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2711:
+^I^I^I} else $
WARNING: line over 80 characters
#779: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2766:
+ acb->rqbuf_firstindex %=
ARCMSR_MAX_QBUFFER;
WARNING: line over 80 characters
#787: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2819:
+ memcpy(pcmdmessagefld->messagedatabuffer, ver_addr,
allxfer_len);
ERROR: space required before the open parenthesis '('
#837: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:2824:
+ if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer)
== 0)
ERROR: spaces required around that '=' (ctx:VxV)
#1071: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:4279:
+ for (i=0; i < 200; i++) {
^
WARNING: msleep < 20ms can sleep for up to 20ms; see
Documentation/timers/timers-howto.txt
+ msleep(10);
WARNING: line over 80 characters
#1074: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:4282:
+ if (outbound_doorbell &
ARCMSR_HBCMU_IOP2DRV_DATA_WRITE_OK) {
ERROR: spaces required around that '=' (ctx:VxV)
#1094: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:4301:
+ for (i=0; i < 200; i++) {
^
WARNING: msleep < 20ms can sleep for up to 20ms; see
Documentation/timers/timers-howto.txt
+ msleep(10);
WARNING: line over 80 characters
#1097: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:4304:
+ if (outbound_doorbell &
ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK) {
WARNING: quoted string split across lines
#1121: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:4750:
+ sprintf(buf, "Areca %s Host Adapter RAID Controller%s\narcmsr "
+ "version %s\n",type, raid6 ? "( RAID6 capable)" : "",
ERROR: space required after that ',' (ctx:VxV)
#1121: FILE: drivers/scsi/arcmsr/arcmsr_hba.c:4750:
+ "version %s\n",type, raid6 ? "( RAID6 capable)" : "",
^
total: 25 errors, 11 warnings, 1061 lines checked
Please fix these and resend.
Thanks,
James
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] scsi: fix warning with unused variable
2013-08-26 10:20 ` James Bottomley
@ 2013-08-26 14:19 ` Seungwon Jeon
2013-08-26 14:20 ` [PATCH 2/2] scsi: replace the deprecated flush_work_sync Seungwon Jeon
2013-09-03 7:59 ` [PATCH] scsi: ufs: " Seungwon Jeon
2 siblings, 0 replies; 6+ messages in thread
From: Seungwon Jeon @ 2013-08-26 14:19 UTC (permalink / raw)
To: 'linux-scsi'; +Cc: 'James Bottomley'
drivers/scsi/scsi_error.c:246:16: warning: unused variable 'flags' [-Wunused-variable]
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
drivers/scsi/scsi_error.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index f16d1a6..83e591b 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -243,7 +243,6 @@ static void scsi_report_sense(struct scsi_device *sdev,
struct scsi_sense_hdr *sshdr)
{
enum scsi_device_event evt_type = SDEV_EVT_MAXBITS; /* i.e. none */
- unsigned long flags;
if (sshdr->sense_key == UNIT_ATTENTION) {
if (sshdr->asc == 0x3f && sshdr->ascq == 0x03) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] scsi: replace the deprecated flush_work_sync
2013-08-26 10:20 ` James Bottomley
2013-08-26 14:19 ` [PATCH 1/2] scsi: fix warning with unused variable Seungwon Jeon
@ 2013-08-26 14:20 ` Seungwon Jeon
2013-09-03 7:59 ` [PATCH] scsi: ufs: " Seungwon Jeon
2 siblings, 0 replies; 6+ messages in thread
From: Seungwon Jeon @ 2013-08-26 14:20 UTC (permalink / raw)
To: 'linux-scsi'; +Cc: 'James Bottomley', 'Tejun Heo'
flush_work_sync is replaced by flush_work with commit
4382973(workqueue: deprecate flush[_delayed]_work_sync()).
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
drivers/scsi/arcmsr/arcmsr_hba.c | 4 ++--
drivers/scsi/ufs/ufshcd.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index aac6378..e1ea1ca 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1599,7 +1599,7 @@ arcmsr_remove(struct pci_dev *pdev)
int poll_count = 0, i;
arcmsr_free_sysfs_attr(acb);
scsi_remove_host(host);
- flush_work_sync(&acb->arcmsr_do_message_isr_bh);
+ flush_work(&acb->arcmsr_do_message_isr_bh);
del_timer_sync(&acb->eternal_timer);
arcmsr_disable_outbound_ints(acb);
arcmsr_stop_adapter_bgrb(acb);
@@ -1661,7 +1661,7 @@ arcmsr_shutdown(struct pci_dev *pdev)
pci_disable_msix(pdev);
} else
free_irq(pdev->irq, acb);
- flush_work_sync(&acb->arcmsr_do_message_isr_bh);
+ flush_work(&acb->arcmsr_do_message_isr_bh);
arcmsr_stop_adapter_bgrb(acb);
arcmsr_flush_adapter_cache(acb);
}
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index a0f5ac2..1b99c0a 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2737,7 +2737,7 @@ static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd)
break;
spin_unlock_irqrestore(hba->host->host_lock, flags);
dev_dbg(hba->dev, "%s: reset in progress\n", __func__);
- flush_work_sync(&hba->eh_work);
+ flush_work(&hba->eh_work);
} while (1);
hba->ufshcd_state = UFSHCD_STATE_RESET;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] scsi: ufs: replace the deprecated flush_work_sync
2013-08-26 10:20 ` James Bottomley
2013-08-26 14:19 ` [PATCH 1/2] scsi: fix warning with unused variable Seungwon Jeon
2013-08-26 14:20 ` [PATCH 2/2] scsi: replace the deprecated flush_work_sync Seungwon Jeon
@ 2013-09-03 7:59 ` Seungwon Jeon
2013-09-03 16:41 ` Santosh Y
2 siblings, 1 reply; 6+ messages in thread
From: Seungwon Jeon @ 2013-09-03 7:59 UTC (permalink / raw)
To: 'linux-scsi'
Cc: 'James Bottomley', 'Tejun Heo',
'Vinayak Holikatti', 'Santosh Y'
flush_work_sync is replaced by flush_work with commit
4382973(workqueue: deprecate flush[_delayed]_work_sync()).
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
drivers/scsi/ufs/ufshcd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index a0f5ac2..1b99c0a 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2737,7 +2737,7 @@ static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd)
break;
spin_unlock_irqrestore(hba->host->host_lock, flags);
dev_dbg(hba->dev, "%s: reset in progress\n", __func__);
- flush_work_sync(&hba->eh_work);
+ flush_work(&hba->eh_work);
} while (1);
hba->ufshcd_state = UFSHCD_STATE_RESET;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: ufs: replace the deprecated flush_work_sync
2013-09-03 7:59 ` [PATCH] scsi: ufs: " Seungwon Jeon
@ 2013-09-03 16:41 ` Santosh Y
0 siblings, 0 replies; 6+ messages in thread
From: Santosh Y @ 2013-09-03 16:41 UTC (permalink / raw)
To: Seungwon Jeon; +Cc: linux-scsi, James Bottomley, Tejun Heo, Vinayak Holikatti
On Tue, Sep 3, 2013 at 12:59 AM, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> flush_work_sync is replaced by flush_work with commit
> 4382973(workqueue: deprecate flush[_delayed]_work_sync()).
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
> drivers/scsi/ufs/ufshcd.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index a0f5ac2..1b99c0a 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -2737,7 +2737,7 @@ static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd)
> break;
> spin_unlock_irqrestore(hba->host->host_lock, flags);
> dev_dbg(hba->dev, "%s: reset in progress\n", __func__);
> - flush_work_sync(&hba->eh_work);
> + flush_work(&hba->eh_work);
> } while (1);
>
> hba->ufshcd_state = UFSHCD_STATE_RESET;
> --
> 1.7.0.4
>
>
Acked-by: Santosh Y <santoshsy@gmail.com>
--
~Santosh
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-09-03 16:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 4:28 [PATCH 3/3] arcmsr: Fix bug of updating adapter firmware through ioctl(ARCHTTP) interface 黃清隆
2013-08-26 10:20 ` James Bottomley
2013-08-26 14:19 ` [PATCH 1/2] scsi: fix warning with unused variable Seungwon Jeon
2013-08-26 14:20 ` [PATCH 2/2] scsi: replace the deprecated flush_work_sync Seungwon Jeon
2013-09-03 7:59 ` [PATCH] scsi: ufs: " Seungwon Jeon
2013-09-03 16:41 ` Santosh Y
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).