Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-16 Thread Christoph Hellwig
On Tue, Sep 16, 2014 at 10:42:08AM +0800, Ching Huang wrote:
> The [PATCH v5 2/2] was depend on [PATCH v4 1/2].
> If you skip patch 1/2, then patch 2/2 may cause line number mismatch.
> How should I do? Please advise.

Hi Ching,

[PATCH v5 2/2] applied without a problem.  Please look at my
drivers-for-3.18 branch and send any additional patches relative to
that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-16 Thread Christoph Hellwig
On Tue, Sep 16, 2014 at 10:42:08AM +0800, Ching Huang wrote:
 The [PATCH v5 2/2] was depend on [PATCH v4 1/2].
 If you skip patch 1/2, then patch 2/2 may cause line number mismatch.
 How should I do? Please advise.

Hi Ching,

[PATCH v5 2/2] applied without a problem.  Please look at my
drivers-for-3.18 branch and send any additional patches relative to
that.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-15 Thread Ching Huang
On Mon, 2014-09-15 at 10:05 -0700, Christoph Hellwig wrote:
> On Mon, Sep 15, 2014 at 03:23:36PM +0200, Tomas Henzl wrote:
> > Christoph,
> > 
> > you may add my 'reviewed-by' to the arcmsr series
> > http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
> > with the '[PATCH v5 2/2] arcmsr: simplify of updating doneq_index and 
> > postq_index'
> > ( https://lkml.org/lkml/2014/9/15/177 ) on top of the series
> > that last patch fixes the 16/17 from your git.
> > I hope the series is an iteration in the right direction.
> > Skip the the '[PATCH v4 1/2] arcmsr: simplify ioctl data read/write', Ching 
> > will repost it later.
> 
> Thanks a lot Tomas for all the review, and thanks Ching for the patches
> and updates.  I'll merge the branch and the additional patch today.
> 

Christoph,

The [PATCH v5 2/2] was depend on [PATCH v4 1/2].
If you skip patch 1/2, then patch 2/2 may cause line number mismatch.
How should I do? Please advise.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-15 Thread Christoph Hellwig
On Mon, Sep 15, 2014 at 03:23:36PM +0200, Tomas Henzl wrote:
> Christoph,
> 
> you may add my 'reviewed-by' to the arcmsr series
> http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
> with the '[PATCH v5 2/2] arcmsr: simplify of updating doneq_index and 
> postq_index'
> ( https://lkml.org/lkml/2014/9/15/177 ) on top of the series
> that last patch fixes the 16/17 from your git.
> I hope the series is an iteration in the right direction.
> Skip the the '[PATCH v4 1/2] arcmsr: simplify ioctl data read/write', Ching 
> will repost it later.

Thanks a lot Tomas for all the review, and thanks Ching for the patches
and updates.  I'll merge the branch and the additional patch today.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-15 Thread Tomas Henzl
On 09/10/2014 11:58 AM, Tomas Henzl wrote:
> On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
>> Ching,
>>
>> do you have a chance to address Thomas second concern below?  As
>> far as I can tell (Thomas, please correct me) that's the last
>> outstanding concern, and I'd really like to merge the arcmsr updates
>> for the Linux 3.18 merge window.
> Correct, still awaiting a response.

Christoph,

you may add my 'reviewed-by' to the arcmsr series
http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
with the '[PATCH v5 2/2] arcmsr: simplify of updating doneq_index and 
postq_index'
( https://lkml.org/lkml/2014/9/15/177 ) on top of the series
that last patch fixes the 16/17 from your git.
I hope the series is an iteration in the right direction.
Skip the the '[PATCH v4 1/2] arcmsr: simplify ioctl data read/write', Ching 
will repost it later.

Tomas

>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-15 Thread Tomas Henzl
On 09/10/2014 11:58 AM, Tomas Henzl wrote:
 On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
 Ching,

 do you have a chance to address Thomas second concern below?  As
 far as I can tell (Thomas, please correct me) that's the last
 outstanding concern, and I'd really like to merge the arcmsr updates
 for the Linux 3.18 merge window.
 Correct, still awaiting a response.

Christoph,

you may add my 'reviewed-by' to the arcmsr series
http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
with the '[PATCH v5 2/2] arcmsr: simplify of updating doneq_index and 
postq_index'
( https://lkml.org/lkml/2014/9/15/177 ) on top of the series
that last patch fixes the 16/17 from your git.
I hope the series is an iteration in the right direction.
Skip the the '[PATCH v4 1/2] arcmsr: simplify ioctl data read/write', Ching 
will repost it later.

Tomas


 --
 To unsubscribe from this list: send the line unsubscribe linux-scsi in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 --
 To unsubscribe from this list: send the line unsubscribe linux-scsi in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-15 Thread Christoph Hellwig
On Mon, Sep 15, 2014 at 03:23:36PM +0200, Tomas Henzl wrote:
 Christoph,
 
 you may add my 'reviewed-by' to the arcmsr series
 http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
 with the '[PATCH v5 2/2] arcmsr: simplify of updating doneq_index and 
 postq_index'
 ( https://lkml.org/lkml/2014/9/15/177 ) on top of the series
 that last patch fixes the 16/17 from your git.
 I hope the series is an iteration in the right direction.
 Skip the the '[PATCH v4 1/2] arcmsr: simplify ioctl data read/write', Ching 
 will repost it later.

Thanks a lot Tomas for all the review, and thanks Ching for the patches
and updates.  I'll merge the branch and the additional patch today.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-15 Thread Ching Huang
On Mon, 2014-09-15 at 10:05 -0700, Christoph Hellwig wrote:
 On Mon, Sep 15, 2014 at 03:23:36PM +0200, Tomas Henzl wrote:
  Christoph,
  
  you may add my 'reviewed-by' to the arcmsr series
  http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
  with the '[PATCH v5 2/2] arcmsr: simplify of updating doneq_index and 
  postq_index'
  ( https://lkml.org/lkml/2014/9/15/177 ) on top of the series
  that last patch fixes the 16/17 from your git.
  I hope the series is an iteration in the right direction.
  Skip the the '[PATCH v4 1/2] arcmsr: simplify ioctl data read/write', Ching 
  will repost it later.
 
 Thanks a lot Tomas for all the review, and thanks Ching for the patches
 and updates.  I'll merge the branch and the additional patch today.
 

Christoph,

The [PATCH v5 2/2] was depend on [PATCH v4 1/2].
If you skip patch 1/2, then patch 2/2 may cause line number mismatch.
How should I do? Please advise.



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-11 Thread Ching Huang
On Thu, 2014-09-11 at 16:21 +0200, Tomas Henzl wrote:
> On 09/11/2014 05:59 AM, Ching Huang wrote:
> > On Wed, 2014-09-10 at 11:58 +0200, Tomas Henzl wrote:
> >> On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
> >>> Ching,
> >>>
> >>> do you have a chance to address Thomas second concern below?  As
> >>> far as I can tell (Thomas, please correct me) that's the last
> >>> outstanding concern, and I'd really like to merge the arcmsr updates
> >>> for the Linux 3.18 merge window.
> >> Correct, still awaiting a response.
> > Christoph, Tomas,
> >
> > Sorry for the late reply.
> >
> > I think I misunderstand Tomas' meaning.
> > The spin lock in arcmsr_hbaD_polling_ccbdone() is necessary to protect 
> > doneq_index and have to be modified as following.
> 
> OK, so you are going to repost 16/17 ? If so, please describe all changes 
> you'll do, in that new post.
> 
By previous review, I will post two patches.
One for 13/17 and another for 16/17.
These patches are relative to 
http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
> >
> > static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
> > struct CommandControlBlock *poll_ccb)
> > {
> > bool error;
> > uint32_t poll_ccb_done = 0, poll_count = 0, flag_ccb, ccb_cdb_phy;
> > int rtn, doneq_index, index_stripped, outbound_write_pointer, toggle;
> > unsigned long flags;
> > struct ARCMSR_CDB *arcmsr_cdb;
> > struct CommandControlBlock *pCCB;
> > struct MessageUnit_D *pmu = acb->pmuD;
> >
> > polling_hbaD_ccb_retry:
> > poll_count++;
> > while (1) {
> > spin_lock_irqsave(>doneq_lock, flags);
> > outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1;
> > doneq_index = pmu->doneq_index;
> > if ((outbound_write_pointer & 0xFFF) == (doneq_index & 0xFFF)) {
> > spin_unlock_irqrestore(>doneq_lock, flags);
> > if (poll_ccb_done) {
> > rtn = SUCCESS;
> > break;
> > } else {
> > msleep(25);
> > if (poll_count > 40) {
> > rtn = FAILED;
> > break;
> > }
> > goto polling_hbaD_ccb_retry;
> > }
> > }
> > toggle = doneq_index & 0x4000;
> > index_stripped = (doneq_index & 0xFFF) + 1;
> > index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE;
> > pmu->doneq_index = index_stripped ? (index_stripped | toggle) :
> > ((index_stripped + 1) | (toggle ^ 0x4000));
> > spin_unlock_irqrestore(>doneq_lock, flags);
> > doneq_index = pmu->doneq_index;
> > flag_ccb = pmu->done_qbuffer[doneq_index & 0xFFF].addressLow;
> > ccb_cdb_phy = (flag_ccb & 0xFFF0);
> > arcmsr_cdb = (struct ARCMSR_CDB *)(acb->vir2phy_offset +
> > ccb_cdb_phy);
> > pCCB = container_of(arcmsr_cdb, struct CommandControlBlock,
> > arcmsr_cdb);
> > poll_ccb_done |= (pCCB == poll_ccb) ? 1 : 0;
> > if ((pCCB->acb != acb) ||
> > (pCCB->startdone != ARCMSR_CCB_START)) {
> > if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
> > pr_notice("arcmsr%d: scsi id = %d "
> > "lun = %d ccb = '0x%p' poll command "
> > "abort successfully\n"
> > , acb->host->host_no
> > , pCCB->pcmd->device->id
> > , (u32)pCCB->pcmd->device->lun
> > , pCCB);
> > pCCB->pcmd->result = DID_ABORT << 16;
> > arcmsr_ccb_complete(pCCB);
> > continue;
> > }
> > pr_notice("arcmsr%d: polling an illegal "
> > "ccb command done ccb = '0x%p' "
> > "ccboutstandingcount = %d\n"
> > , acb->host->host_no
> > , pCCB
> > , atomic_read(>ccboutstandingcount));
> > continue;
> > }
> > error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1)
> > ? true : false;
> > arcmsr_report_ccb_state(acb, pCCB, error);
> > }
> > return rtn;
> > }
> >
> >
> >>> --
> >>> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> >>> the body of a message to majord...@vger.kernel.org
> >>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> > --
> > To 

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-11 Thread Tomas Henzl
On 09/11/2014 05:59 AM, Ching Huang wrote:
> On Wed, 2014-09-10 at 11:58 +0200, Tomas Henzl wrote:
>> On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
>>> Ching,
>>>
>>> do you have a chance to address Thomas second concern below?  As
>>> far as I can tell (Thomas, please correct me) that's the last
>>> outstanding concern, and I'd really like to merge the arcmsr updates
>>> for the Linux 3.18 merge window.
>> Correct, still awaiting a response.
> Christoph, Tomas,
>
> Sorry for the late reply.
>
> I think I misunderstand Tomas' meaning.
> The spin lock in arcmsr_hbaD_polling_ccbdone() is necessary to protect 
> doneq_index and have to be modified as following.

OK, so you are going to repost 16/17 ? If so, please describe all changes 
you'll do, in that new post.

>
> static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
>   struct CommandControlBlock *poll_ccb)
> {
>   bool error;
>   uint32_t poll_ccb_done = 0, poll_count = 0, flag_ccb, ccb_cdb_phy;
>   int rtn, doneq_index, index_stripped, outbound_write_pointer, toggle;
>   unsigned long flags;
>   struct ARCMSR_CDB *arcmsr_cdb;
>   struct CommandControlBlock *pCCB;
>   struct MessageUnit_D *pmu = acb->pmuD;
>
> polling_hbaD_ccb_retry:
>   poll_count++;
>   while (1) {
>   spin_lock_irqsave(>doneq_lock, flags);
>   outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1;
>   doneq_index = pmu->doneq_index;
>   if ((outbound_write_pointer & 0xFFF) == (doneq_index & 0xFFF)) {
>   spin_unlock_irqrestore(>doneq_lock, flags);
>   if (poll_ccb_done) {
>   rtn = SUCCESS;
>   break;
>   } else {
>   msleep(25);
>   if (poll_count > 40) {
>   rtn = FAILED;
>   break;
>   }
>   goto polling_hbaD_ccb_retry;
>   }
>   }
>   toggle = doneq_index & 0x4000;
>   index_stripped = (doneq_index & 0xFFF) + 1;
>   index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE;
>   pmu->doneq_index = index_stripped ? (index_stripped | toggle) :
>   ((index_stripped + 1) | (toggle ^ 0x4000));
>   spin_unlock_irqrestore(>doneq_lock, flags);
>   doneq_index = pmu->doneq_index;
>   flag_ccb = pmu->done_qbuffer[doneq_index & 0xFFF].addressLow;
>   ccb_cdb_phy = (flag_ccb & 0xFFF0);
>   arcmsr_cdb = (struct ARCMSR_CDB *)(acb->vir2phy_offset +
>   ccb_cdb_phy);
>   pCCB = container_of(arcmsr_cdb, struct CommandControlBlock,
>   arcmsr_cdb);
>   poll_ccb_done |= (pCCB == poll_ccb) ? 1 : 0;
>   if ((pCCB->acb != acb) ||
>   (pCCB->startdone != ARCMSR_CCB_START)) {
>   if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
>   pr_notice("arcmsr%d: scsi id = %d "
>   "lun = %d ccb = '0x%p' poll command "
>   "abort successfully\n"
>   , acb->host->host_no
>   , pCCB->pcmd->device->id
>   , (u32)pCCB->pcmd->device->lun
>   , pCCB);
>   pCCB->pcmd->result = DID_ABORT << 16;
>   arcmsr_ccb_complete(pCCB);
>   continue;
>   }
>   pr_notice("arcmsr%d: polling an illegal "
>   "ccb command done ccb = '0x%p' "
>   "ccboutstandingcount = %d\n"
>   , acb->host->host_no
>   , pCCB
>   , atomic_read(>ccboutstandingcount));
>   continue;
>   }
>   error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1)
>   ? true : false;
>   arcmsr_report_ccb_state(acb, pCCB, error);
>   }
>   return rtn;
> }
>
>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
>>> the body of a message to majord...@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More 

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-11 Thread Ching Huang
On Thu, 2014-09-11 at 16:21 +0200, Tomas Henzl wrote:
 On 09/11/2014 05:59 AM, Ching Huang wrote:
  On Wed, 2014-09-10 at 11:58 +0200, Tomas Henzl wrote:
  On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
  Ching,
 
  do you have a chance to address Thomas second concern below?  As
  far as I can tell (Thomas, please correct me) that's the last
  outstanding concern, and I'd really like to merge the arcmsr updates
  for the Linux 3.18 merge window.
  Correct, still awaiting a response.
  Christoph, Tomas,
 
  Sorry for the late reply.
 
  I think I misunderstand Tomas' meaning.
  The spin lock in arcmsr_hbaD_polling_ccbdone() is necessary to protect 
  doneq_index and have to be modified as following.
 
 OK, so you are going to repost 16/17 ? If so, please describe all changes 
 you'll do, in that new post.
 
By previous review, I will post two patches.
One for 13/17 and another for 16/17.
These patches are relative to 
http://git.infradead.org/users/hch/scsi-queue.git/tree/arcmsr-for-3.18:/drivers/scsi/arcmsr
 
  static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
  struct CommandControlBlock *poll_ccb)
  {
  bool error;
  uint32_t poll_ccb_done = 0, poll_count = 0, flag_ccb, ccb_cdb_phy;
  int rtn, doneq_index, index_stripped, outbound_write_pointer, toggle;
  unsigned long flags;
  struct ARCMSR_CDB *arcmsr_cdb;
  struct CommandControlBlock *pCCB;
  struct MessageUnit_D *pmu = acb-pmuD;
 
  polling_hbaD_ccb_retry:
  poll_count++;
  while (1) {
  spin_lock_irqsave(acb-doneq_lock, flags);
  outbound_write_pointer = pmu-done_qbuffer[0].addressLow + 1;
  doneq_index = pmu-doneq_index;
  if ((outbound_write_pointer  0xFFF) == (doneq_index  0xFFF)) {
  spin_unlock_irqrestore(acb-doneq_lock, flags);
  if (poll_ccb_done) {
  rtn = SUCCESS;
  break;
  } else {
  msleep(25);
  if (poll_count  40) {
  rtn = FAILED;
  break;
  }
  goto polling_hbaD_ccb_retry;
  }
  }
  toggle = doneq_index  0x4000;
  index_stripped = (doneq_index  0xFFF) + 1;
  index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE;
  pmu-doneq_index = index_stripped ? (index_stripped | toggle) :
  ((index_stripped + 1) | (toggle ^ 0x4000));
  spin_unlock_irqrestore(acb-doneq_lock, flags);
  doneq_index = pmu-doneq_index;
  flag_ccb = pmu-done_qbuffer[doneq_index  0xFFF].addressLow;
  ccb_cdb_phy = (flag_ccb  0xFFF0);
  arcmsr_cdb = (struct ARCMSR_CDB *)(acb-vir2phy_offset +
  ccb_cdb_phy);
  pCCB = container_of(arcmsr_cdb, struct CommandControlBlock,
  arcmsr_cdb);
  poll_ccb_done |= (pCCB == poll_ccb) ? 1 : 0;
  if ((pCCB-acb != acb) ||
  (pCCB-startdone != ARCMSR_CCB_START)) {
  if (pCCB-startdone == ARCMSR_CCB_ABORTED) {
  pr_notice(arcmsr%d: scsi id = %d 
  lun = %d ccb = '0x%p' poll command 
  abort successfully\n
  , acb-host-host_no
  , pCCB-pcmd-device-id
  , (u32)pCCB-pcmd-device-lun
  , pCCB);
  pCCB-pcmd-result = DID_ABORT  16;
  arcmsr_ccb_complete(pCCB);
  continue;
  }
  pr_notice(arcmsr%d: polling an illegal 
  ccb command done ccb = '0x%p' 
  ccboutstandingcount = %d\n
  , acb-host-host_no
  , pCCB
  , atomic_read(acb-ccboutstandingcount));
  continue;
  }
  error = (flag_ccb  ARCMSR_CCBREPLY_FLAG_ERROR_MODE1)
  ? true : false;
  arcmsr_report_ccb_state(acb, pCCB, error);
  }
  return rtn;
  }
 
 
  --
  To unsubscribe from this list: send the line unsubscribe linux-scsi in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
  --
  To unsubscribe from this list: send the line unsubscribe linux-scsi in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
 


--
To unsubscribe from this list: send the line unsubscribe 

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-11 Thread Tomas Henzl
On 09/11/2014 05:59 AM, Ching Huang wrote:
 On Wed, 2014-09-10 at 11:58 +0200, Tomas Henzl wrote:
 On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
 Ching,

 do you have a chance to address Thomas second concern below?  As
 far as I can tell (Thomas, please correct me) that's the last
 outstanding concern, and I'd really like to merge the arcmsr updates
 for the Linux 3.18 merge window.
 Correct, still awaiting a response.
 Christoph, Tomas,

 Sorry for the late reply.

 I think I misunderstand Tomas' meaning.
 The spin lock in arcmsr_hbaD_polling_ccbdone() is necessary to protect 
 doneq_index and have to be modified as following.

OK, so you are going to repost 16/17 ? If so, please describe all changes 
you'll do, in that new post.


 static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
   struct CommandControlBlock *poll_ccb)
 {
   bool error;
   uint32_t poll_ccb_done = 0, poll_count = 0, flag_ccb, ccb_cdb_phy;
   int rtn, doneq_index, index_stripped, outbound_write_pointer, toggle;
   unsigned long flags;
   struct ARCMSR_CDB *arcmsr_cdb;
   struct CommandControlBlock *pCCB;
   struct MessageUnit_D *pmu = acb-pmuD;

 polling_hbaD_ccb_retry:
   poll_count++;
   while (1) {
   spin_lock_irqsave(acb-doneq_lock, flags);
   outbound_write_pointer = pmu-done_qbuffer[0].addressLow + 1;
   doneq_index = pmu-doneq_index;
   if ((outbound_write_pointer  0xFFF) == (doneq_index  0xFFF)) {
   spin_unlock_irqrestore(acb-doneq_lock, flags);
   if (poll_ccb_done) {
   rtn = SUCCESS;
   break;
   } else {
   msleep(25);
   if (poll_count  40) {
   rtn = FAILED;
   break;
   }
   goto polling_hbaD_ccb_retry;
   }
   }
   toggle = doneq_index  0x4000;
   index_stripped = (doneq_index  0xFFF) + 1;
   index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE;
   pmu-doneq_index = index_stripped ? (index_stripped | toggle) :
   ((index_stripped + 1) | (toggle ^ 0x4000));
   spin_unlock_irqrestore(acb-doneq_lock, flags);
   doneq_index = pmu-doneq_index;
   flag_ccb = pmu-done_qbuffer[doneq_index  0xFFF].addressLow;
   ccb_cdb_phy = (flag_ccb  0xFFF0);
   arcmsr_cdb = (struct ARCMSR_CDB *)(acb-vir2phy_offset +
   ccb_cdb_phy);
   pCCB = container_of(arcmsr_cdb, struct CommandControlBlock,
   arcmsr_cdb);
   poll_ccb_done |= (pCCB == poll_ccb) ? 1 : 0;
   if ((pCCB-acb != acb) ||
   (pCCB-startdone != ARCMSR_CCB_START)) {
   if (pCCB-startdone == ARCMSR_CCB_ABORTED) {
   pr_notice(arcmsr%d: scsi id = %d 
   lun = %d ccb = '0x%p' poll command 
   abort successfully\n
   , acb-host-host_no
   , pCCB-pcmd-device-id
   , (u32)pCCB-pcmd-device-lun
   , pCCB);
   pCCB-pcmd-result = DID_ABORT  16;
   arcmsr_ccb_complete(pCCB);
   continue;
   }
   pr_notice(arcmsr%d: polling an illegal 
   ccb command done ccb = '0x%p' 
   ccboutstandingcount = %d\n
   , acb-host-host_no
   , pCCB
   , atomic_read(acb-ccboutstandingcount));
   continue;
   }
   error = (flag_ccb  ARCMSR_CCBREPLY_FLAG_ERROR_MODE1)
   ? true : false;
   arcmsr_report_ccb_state(acb, pCCB, error);
   }
   return rtn;
 }


 --
 To unsubscribe from this list: send the line unsubscribe linux-scsi in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

 --
 To unsubscribe from this list: send the line unsubscribe linux-scsi in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-10 Thread Ching Huang
On Wed, 2014-09-10 at 11:58 +0200, Tomas Henzl wrote:
> On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
> > Ching,
> >
> > do you have a chance to address Thomas second concern below?  As
> > far as I can tell (Thomas, please correct me) that's the last
> > outstanding concern, and I'd really like to merge the arcmsr updates
> > for the Linux 3.18 merge window.
> 
> Correct, still awaiting a response.

Christoph, Tomas,

Sorry for the late reply.

I think I misunderstand Tomas' meaning.
The spin lock in arcmsr_hbaD_polling_ccbdone() is necessary to protect 
doneq_index and have to be modified as following.

static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
struct CommandControlBlock *poll_ccb)
{
bool error;
uint32_t poll_ccb_done = 0, poll_count = 0, flag_ccb, ccb_cdb_phy;
int rtn, doneq_index, index_stripped, outbound_write_pointer, toggle;
unsigned long flags;
struct ARCMSR_CDB *arcmsr_cdb;
struct CommandControlBlock *pCCB;
struct MessageUnit_D *pmu = acb->pmuD;

polling_hbaD_ccb_retry:
poll_count++;
while (1) {
spin_lock_irqsave(>doneq_lock, flags);
outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1;
doneq_index = pmu->doneq_index;
if ((outbound_write_pointer & 0xFFF) == (doneq_index & 0xFFF)) {
spin_unlock_irqrestore(>doneq_lock, flags);
if (poll_ccb_done) {
rtn = SUCCESS;
break;
} else {
msleep(25);
if (poll_count > 40) {
rtn = FAILED;
break;
}
goto polling_hbaD_ccb_retry;
}
}
toggle = doneq_index & 0x4000;
index_stripped = (doneq_index & 0xFFF) + 1;
index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE;
pmu->doneq_index = index_stripped ? (index_stripped | toggle) :
((index_stripped + 1) | (toggle ^ 0x4000));
spin_unlock_irqrestore(>doneq_lock, flags);
doneq_index = pmu->doneq_index;
flag_ccb = pmu->done_qbuffer[doneq_index & 0xFFF].addressLow;
ccb_cdb_phy = (flag_ccb & 0xFFF0);
arcmsr_cdb = (struct ARCMSR_CDB *)(acb->vir2phy_offset +
ccb_cdb_phy);
pCCB = container_of(arcmsr_cdb, struct CommandControlBlock,
arcmsr_cdb);
poll_ccb_done |= (pCCB == poll_ccb) ? 1 : 0;
if ((pCCB->acb != acb) ||
(pCCB->startdone != ARCMSR_CCB_START)) {
if (pCCB->startdone == ARCMSR_CCB_ABORTED) {
pr_notice("arcmsr%d: scsi id = %d "
"lun = %d ccb = '0x%p' poll command "
"abort successfully\n"
, acb->host->host_no
, pCCB->pcmd->device->id
, (u32)pCCB->pcmd->device->lun
, pCCB);
pCCB->pcmd->result = DID_ABORT << 16;
arcmsr_ccb_complete(pCCB);
continue;
}
pr_notice("arcmsr%d: polling an illegal "
"ccb command done ccb = '0x%p' "
"ccboutstandingcount = %d\n"
, acb->host->host_no
, pCCB
, atomic_read(>ccboutstandingcount));
continue;
}
error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1)
? true : false;
arcmsr_report_ccb_state(acb, pCCB, error);
}
return rtn;
}


> 
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-10 Thread Tomas Henzl
On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
> Ching,
>
> do you have a chance to address Thomas second concern below?  As
> far as I can tell (Thomas, please correct me) that's the last
> outstanding concern, and I'd really like to merge the arcmsr updates
> for the Linux 3.18 merge window.

Correct, still awaiting a response.

>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-10 Thread Tomas Henzl
On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
 Ching,

 do you have a chance to address Thomas second concern below?  As
 far as I can tell (Thomas, please correct me) that's the last
 outstanding concern, and I'd really like to merge the arcmsr updates
 for the Linux 3.18 merge window.

Correct, still awaiting a response.


 --
 To unsubscribe from this list: send the line unsubscribe linux-scsi in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-10 Thread Ching Huang
On Wed, 2014-09-10 at 11:58 +0200, Tomas Henzl wrote:
 On 09/09/2014 06:30 PM, Christoph Hellwig wrote:
  Ching,
 
  do you have a chance to address Thomas second concern below?  As
  far as I can tell (Thomas, please correct me) that's the last
  outstanding concern, and I'd really like to merge the arcmsr updates
  for the Linux 3.18 merge window.
 
 Correct, still awaiting a response.

Christoph, Tomas,

Sorry for the late reply.

I think I misunderstand Tomas' meaning.
The spin lock in arcmsr_hbaD_polling_ccbdone() is necessary to protect 
doneq_index and have to be modified as following.

static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
struct CommandControlBlock *poll_ccb)
{
bool error;
uint32_t poll_ccb_done = 0, poll_count = 0, flag_ccb, ccb_cdb_phy;
int rtn, doneq_index, index_stripped, outbound_write_pointer, toggle;
unsigned long flags;
struct ARCMSR_CDB *arcmsr_cdb;
struct CommandControlBlock *pCCB;
struct MessageUnit_D *pmu = acb-pmuD;

polling_hbaD_ccb_retry:
poll_count++;
while (1) {
spin_lock_irqsave(acb-doneq_lock, flags);
outbound_write_pointer = pmu-done_qbuffer[0].addressLow + 1;
doneq_index = pmu-doneq_index;
if ((outbound_write_pointer  0xFFF) == (doneq_index  0xFFF)) {
spin_unlock_irqrestore(acb-doneq_lock, flags);
if (poll_ccb_done) {
rtn = SUCCESS;
break;
} else {
msleep(25);
if (poll_count  40) {
rtn = FAILED;
break;
}
goto polling_hbaD_ccb_retry;
}
}
toggle = doneq_index  0x4000;
index_stripped = (doneq_index  0xFFF) + 1;
index_stripped %= ARCMSR_MAX_ARC1214_DONEQUEUE;
pmu-doneq_index = index_stripped ? (index_stripped | toggle) :
((index_stripped + 1) | (toggle ^ 0x4000));
spin_unlock_irqrestore(acb-doneq_lock, flags);
doneq_index = pmu-doneq_index;
flag_ccb = pmu-done_qbuffer[doneq_index  0xFFF].addressLow;
ccb_cdb_phy = (flag_ccb  0xFFF0);
arcmsr_cdb = (struct ARCMSR_CDB *)(acb-vir2phy_offset +
ccb_cdb_phy);
pCCB = container_of(arcmsr_cdb, struct CommandControlBlock,
arcmsr_cdb);
poll_ccb_done |= (pCCB == poll_ccb) ? 1 : 0;
if ((pCCB-acb != acb) ||
(pCCB-startdone != ARCMSR_CCB_START)) {
if (pCCB-startdone == ARCMSR_CCB_ABORTED) {
pr_notice(arcmsr%d: scsi id = %d 
lun = %d ccb = '0x%p' poll command 
abort successfully\n
, acb-host-host_no
, pCCB-pcmd-device-id
, (u32)pCCB-pcmd-device-lun
, pCCB);
pCCB-pcmd-result = DID_ABORT  16;
arcmsr_ccb_complete(pCCB);
continue;
}
pr_notice(arcmsr%d: polling an illegal 
ccb command done ccb = '0x%p' 
ccboutstandingcount = %d\n
, acb-host-host_no
, pCCB
, atomic_read(acb-ccboutstandingcount));
continue;
}
error = (flag_ccb  ARCMSR_CCBREPLY_FLAG_ERROR_MODE1)
? true : false;
arcmsr_report_ccb_state(acb, pCCB, error);
}
return rtn;
}


 
 
  --
  To unsubscribe from this list: send the line unsubscribe linux-scsi in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
 


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-09 Thread Christoph Hellwig
Ching,

do you have a chance to address Thomas second concern below?  As
far as I can tell (Thomas, please correct me) that's the last
outstanding concern, and I'd really like to merge the arcmsr updates
for the Linux 3.18 merge window.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-09-09 Thread Christoph Hellwig
Ching,

do you have a chance to address Thomas second concern below?  As
far as I can tell (Thomas, please correct me) that's the last
outstanding concern, and I'd really like to merge the arcmsr updates
for the Linux 3.18 merge window.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-28 Thread Tomas Henzl
On 08/28/2014 05:46 PM, Ching Huang wrote:
> On Wed, 2014-08-27 at 16:00 +0200, Tomas Henzl wrote:
>> On 08/19/2014 09:25 AM, Ching Huang wrote:
>>> From: Ching Huang 
>>>
>>> Add code for supporting Areca new Raid adapter ARC12x4 series.
>>>
>>> Signed-off-by: Ching Huang 
>>> ---
>> Hi Ching,
>> please look at the comments below -
>>
>>>  }
>>> @@ -1039,7 +1147,60 @@ static void arcmsr_done4abort_postqueue(
>>> error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? 
>>> true : false;
>>> arcmsr_drain_donequeue(acb, pCCB, error);
>>> }
>>> -   }
>>> +   }
>>> +   break;
>>> +   case ACB_ADAPTER_TYPE_D: {
>>> +   struct MessageUnit_D  *pmu = acb->pmuD;
>>> +   uint32_t ccb_cdb_phy, outbound_write_pointer;
>>> +   uint32_t doneq_index, index_stripped, addressLow, residual;
>>> +   bool error;
>>> +   struct CommandControlBlock *pCCB;
>> I have noticed this^ in this driver already before. Sometimes it makes sense
>> when a variable is declared in a 'case' block but often it is just
>> a waste of space. In this function this is the third 'bool error' declared.
>> Is there a reason for this style (this function is not the worst case) ?
> Yea, there is many variable are duplicate declaration, I will clean it up.
>>> +   outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1;
>>> +   doneq_index = pmu->doneq_index;
>>> +   residual = atomic_read(>ccboutstandingcount);
>>> +   for (i = 0; i < residual; i++) {
>>> +   while ((doneq_index & 0xFFF) !=
>>> +   (outbound_write_pointer & 0xFFF)) {
>>> +   if (doneq_index & 0x4000) {
>>> +   index_stripped = doneq_index & 0xFFF;
>>> +   index_stripped += 1;
>>> +   index_stripped %=
>>> +   ARCMSR_MAX_ARC1214_DONEQUEUE;
>>> +   pmu->doneq_index = index_stripped ?
>>> +   (index_stripped | 0x4000) :
>>> +   (index_stripped + 1);
>>> +   } else {
>>> +   index_stripped = doneq_index;
>>> +   index_stripped += 1;
>>> +   index_stripped %=
>>> +   ARCMSR_MAX_ARC1214_DONEQUEUE;
>>> +   pmu->doneq_index = index_stripped ?
>>> +   index_stripped :
>>> +   ((index_stripped | 0x4000) + 1);
>>> +   }
>>> +   doneq_index = pmu->doneq_index;
>>> +   addressLow = pmu->done_qbuffer[doneq_index &
>>> +   0xFFF].addressLow;
>>> +   ccb_cdb_phy = (addressLow & 0xFFF0);
>>> +   pARCMSR_CDB = (struct  ARCMSR_CDB *)
>>> +   (acb->vir2phy_offset + ccb_cdb_phy);
>>> +   pCCB = container_of(pARCMSR_CDB,
>>> +   struct CommandControlBlock, arcmsr_cdb);
>>> +   error = (addressLow &
>>> +   ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ?
>>> +   true : false;
>>> +   arcmsr_drain_donequeue(acb, pCCB, error);
>>> +   writel(doneq_index, 
>>> pmu->outboundlist_read_pointer);
>>> +   }
>>> +   mdelay(10);
>>> +   outbound_write_pointer =
>>> +   pmu->done_qbuffer[0].addressLow + 1;
>>> +   doneq_index = pmu->doneq_index;
>>> +   }
>>> +   pmu->postq_index = 0;
>>> +   pmu->doneq_index = 0x40FF;
>>> +   }
>>> +   break;
>>> }
>>>  }
>> ...
>>
>>>  
>>> @@ -1256,6 +1424,38 @@ static void arcmsr_post_ccb(struct Adapt
>>> writel(ccb_post_stamp, >inbound_queueport_low);
>>> }
>>> }
>>> +   break;
>>> +   case ACB_ADAPTER_TYPE_D: {
>>> +   struct MessageUnit_D  *pmu = acb->pmuD;
>>> +   u16 index_stripped;
>>> +   u16 postq_index;
>   u16 postq_index, toggle;
>>> +   unsigned long flags;
>>> +   struct InBound_SRB *pinbound_srb;
>>> +
>>> +   spin_lock_irqsave(>postq_lock, flags);
>>> +   postq_index = pmu->postq_index;
>>> +   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);
>>> +   

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-28 Thread Ching Huang
On Wed, 2014-08-27 at 16:00 +0200, Tomas Henzl wrote:
> On 08/19/2014 09:25 AM, Ching Huang wrote:
> > From: Ching Huang 
> >
> > Add code for supporting Areca new Raid adapter ARC12x4 series.
> >
> > Signed-off-by: Ching Huang 
> > ---
> 
> Hi Ching,
> please look at the comments below -
> 
> >  }
> > @@ -1039,7 +1147,60 @@ static void arcmsr_done4abort_postqueue(
> > error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? 
> > true : false;
> > arcmsr_drain_donequeue(acb, pCCB, error);
> > }
> > -   }
> > +   }
> > +   break;
> > +   case ACB_ADAPTER_TYPE_D: {
> > +   struct MessageUnit_D  *pmu = acb->pmuD;
> > +   uint32_t ccb_cdb_phy, outbound_write_pointer;
> > +   uint32_t doneq_index, index_stripped, addressLow, residual;
> > +   bool error;
> > +   struct CommandControlBlock *pCCB;
> 
> I have noticed this^ in this driver already before. Sometimes it makes sense
> when a variable is declared in a 'case' block but often it is just
> a waste of space. In this function this is the third 'bool error' declared.
> Is there a reason for this style (this function is not the worst case) ?
Yea, there is many variable are duplicate declaration, I will clean it up.
> 
> > +   outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1;
> > +   doneq_index = pmu->doneq_index;
> > +   residual = atomic_read(>ccboutstandingcount);
> > +   for (i = 0; i < residual; i++) {
> > +   while ((doneq_index & 0xFFF) !=
> > +   (outbound_write_pointer & 0xFFF)) {
> > +   if (doneq_index & 0x4000) {
> > +   index_stripped = doneq_index & 0xFFF;
> > +   index_stripped += 1;
> > +   index_stripped %=
> > +   ARCMSR_MAX_ARC1214_DONEQUEUE;
> > +   pmu->doneq_index = index_stripped ?
> > +   (index_stripped | 0x4000) :
> > +   (index_stripped + 1);
> > +   } else {
> > +   index_stripped = doneq_index;
> > +   index_stripped += 1;
> > +   index_stripped %=
> > +   ARCMSR_MAX_ARC1214_DONEQUEUE;
> > +   pmu->doneq_index = index_stripped ?
> > +   index_stripped :
> > +   ((index_stripped | 0x4000) + 1);
> > +   }
> > +   doneq_index = pmu->doneq_index;
> > +   addressLow = pmu->done_qbuffer[doneq_index &
> > +   0xFFF].addressLow;
> > +   ccb_cdb_phy = (addressLow & 0xFFF0);
> > +   pARCMSR_CDB = (struct  ARCMSR_CDB *)
> > +   (acb->vir2phy_offset + ccb_cdb_phy);
> > +   pCCB = container_of(pARCMSR_CDB,
> > +   struct CommandControlBlock, arcmsr_cdb);
> > +   error = (addressLow &
> > +   ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ?
> > +   true : false;
> > +   arcmsr_drain_donequeue(acb, pCCB, error);
> > +   writel(doneq_index, 
> > pmu->outboundlist_read_pointer);
> > +   }
> > +   mdelay(10);
> > +   outbound_write_pointer =
> > +   pmu->done_qbuffer[0].addressLow + 1;
> > +   doneq_index = pmu->doneq_index;
> > +   }
> > +   pmu->postq_index = 0;
> > +   pmu->doneq_index = 0x40FF;
> > +   }
> > +   break;
> > }
> >  }
> ...
> 
> >
> >  
> > @@ -1256,6 +1424,38 @@ static void arcmsr_post_ccb(struct Adapt
> > writel(ccb_post_stamp, >inbound_queueport_low);
> > }
> > }
> > +   break;
> > +   case ACB_ADAPTER_TYPE_D: {
> > +   struct MessageUnit_D  *pmu = acb->pmuD;
> > +   u16 index_stripped;
> > +   u16 postq_index;
u16 postq_index, toggle;
> > +   unsigned long flags;
> > +   struct InBound_SRB *pinbound_srb;
> > +
> > +   spin_lock_irqsave(>postq_lock, flags);
> > +   postq_index = pmu->postq_index;
> > +   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 = ccb->arc_cdb_size >> 

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-28 Thread Ching Huang
On Wed, 2014-08-27 at 16:00 +0200, Tomas Henzl wrote:
 On 08/19/2014 09:25 AM, Ching Huang wrote:
  From: Ching Huang ching2...@areca.com.tw
 
  Add code for supporting Areca new Raid adapter ARC12x4 series.
 
  Signed-off-by: Ching Huang ching2...@areca.com.tw
  ---
 
 Hi Ching,
 please look at the comments below -
 
   }
  @@ -1039,7 +1147,60 @@ static void arcmsr_done4abort_postqueue(
  error = (flag_ccb  ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? 
  true : false;
  arcmsr_drain_donequeue(acb, pCCB, error);
  }
  -   }
  +   }
  +   break;
  +   case ACB_ADAPTER_TYPE_D: {
  +   struct MessageUnit_D  *pmu = acb-pmuD;
  +   uint32_t ccb_cdb_phy, outbound_write_pointer;
  +   uint32_t doneq_index, index_stripped, addressLow, residual;
  +   bool error;
  +   struct CommandControlBlock *pCCB;
 
 I have noticed this^ in this driver already before. Sometimes it makes sense
 when a variable is declared in a 'case' block but often it is just
 a waste of space. In this function this is the third 'bool error' declared.
 Is there a reason for this style (this function is not the worst case) ?
Yea, there is many variable are duplicate declaration, I will clean it up.
 
  +   outbound_write_pointer = pmu-done_qbuffer[0].addressLow + 1;
  +   doneq_index = pmu-doneq_index;
  +   residual = atomic_read(acb-ccboutstandingcount);
  +   for (i = 0; i  residual; i++) {
  +   while ((doneq_index  0xFFF) !=
  +   (outbound_write_pointer  0xFFF)) {
  +   if (doneq_index  0x4000) {
  +   index_stripped = doneq_index  0xFFF;
  +   index_stripped += 1;
  +   index_stripped %=
  +   ARCMSR_MAX_ARC1214_DONEQUEUE;
  +   pmu-doneq_index = index_stripped ?
  +   (index_stripped | 0x4000) :
  +   (index_stripped + 1);
  +   } else {
  +   index_stripped = doneq_index;
  +   index_stripped += 1;
  +   index_stripped %=
  +   ARCMSR_MAX_ARC1214_DONEQUEUE;
  +   pmu-doneq_index = index_stripped ?
  +   index_stripped :
  +   ((index_stripped | 0x4000) + 1);
  +   }
  +   doneq_index = pmu-doneq_index;
  +   addressLow = pmu-done_qbuffer[doneq_index 
  +   0xFFF].addressLow;
  +   ccb_cdb_phy = (addressLow  0xFFF0);
  +   pARCMSR_CDB = (struct  ARCMSR_CDB *)
  +   (acb-vir2phy_offset + ccb_cdb_phy);
  +   pCCB = container_of(pARCMSR_CDB,
  +   struct CommandControlBlock, arcmsr_cdb);
  +   error = (addressLow 
  +   ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ?
  +   true : false;
  +   arcmsr_drain_donequeue(acb, pCCB, error);
  +   writel(doneq_index, 
  pmu-outboundlist_read_pointer);
  +   }
  +   mdelay(10);
  +   outbound_write_pointer =
  +   pmu-done_qbuffer[0].addressLow + 1;
  +   doneq_index = pmu-doneq_index;
  +   }
  +   pmu-postq_index = 0;
  +   pmu-doneq_index = 0x40FF;
  +   }
  +   break;
  }
   }
 ...
 
 
   
  @@ -1256,6 +1424,38 @@ static void arcmsr_post_ccb(struct Adapt
  writel(ccb_post_stamp, phbcmu-inbound_queueport_low);
  }
  }
  +   break;
  +   case ACB_ADAPTER_TYPE_D: {
  +   struct MessageUnit_D  *pmu = acb-pmuD;
  +   u16 index_stripped;
  +   u16 postq_index;
u16 postq_index, toggle;
  +   unsigned long flags;
  +   struct InBound_SRB *pinbound_srb;
  +
  +   spin_lock_irqsave(acb-postq_lock, flags);
  +   postq_index = pmu-postq_index;
  +   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 = ccb-arc_cdb_size  2;
  +   arcmsr_cdb-msgContext = dma_addr_lo32(cdb_phyaddr);
  +   if (postq_index  0x4000) {
  +   index_stripped = postq_index  0xFF;
  +   

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-28 Thread Tomas Henzl
On 08/28/2014 05:46 PM, Ching Huang wrote:
 On Wed, 2014-08-27 at 16:00 +0200, Tomas Henzl wrote:
 On 08/19/2014 09:25 AM, Ching Huang wrote:
 From: Ching Huang ching2...@areca.com.tw

 Add code for supporting Areca new Raid adapter ARC12x4 series.

 Signed-off-by: Ching Huang ching2...@areca.com.tw
 ---
 Hi Ching,
 please look at the comments below -

  }
 @@ -1039,7 +1147,60 @@ static void arcmsr_done4abort_postqueue(
 error = (flag_ccb  ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? 
 true : false;
 arcmsr_drain_donequeue(acb, pCCB, error);
 }
 -   }
 +   }
 +   break;
 +   case ACB_ADAPTER_TYPE_D: {
 +   struct MessageUnit_D  *pmu = acb-pmuD;
 +   uint32_t ccb_cdb_phy, outbound_write_pointer;
 +   uint32_t doneq_index, index_stripped, addressLow, residual;
 +   bool error;
 +   struct CommandControlBlock *pCCB;
 I have noticed this^ in this driver already before. Sometimes it makes sense
 when a variable is declared in a 'case' block but often it is just
 a waste of space. In this function this is the third 'bool error' declared.
 Is there a reason for this style (this function is not the worst case) ?
 Yea, there is many variable are duplicate declaration, I will clean it up.
 +   outbound_write_pointer = pmu-done_qbuffer[0].addressLow + 1;
 +   doneq_index = pmu-doneq_index;
 +   residual = atomic_read(acb-ccboutstandingcount);
 +   for (i = 0; i  residual; i++) {
 +   while ((doneq_index  0xFFF) !=
 +   (outbound_write_pointer  0xFFF)) {
 +   if (doneq_index  0x4000) {
 +   index_stripped = doneq_index  0xFFF;
 +   index_stripped += 1;
 +   index_stripped %=
 +   ARCMSR_MAX_ARC1214_DONEQUEUE;
 +   pmu-doneq_index = index_stripped ?
 +   (index_stripped | 0x4000) :
 +   (index_stripped + 1);
 +   } else {
 +   index_stripped = doneq_index;
 +   index_stripped += 1;
 +   index_stripped %=
 +   ARCMSR_MAX_ARC1214_DONEQUEUE;
 +   pmu-doneq_index = index_stripped ?
 +   index_stripped :
 +   ((index_stripped | 0x4000) + 1);
 +   }
 +   doneq_index = pmu-doneq_index;
 +   addressLow = pmu-done_qbuffer[doneq_index 
 +   0xFFF].addressLow;
 +   ccb_cdb_phy = (addressLow  0xFFF0);
 +   pARCMSR_CDB = (struct  ARCMSR_CDB *)
 +   (acb-vir2phy_offset + ccb_cdb_phy);
 +   pCCB = container_of(pARCMSR_CDB,
 +   struct CommandControlBlock, arcmsr_cdb);
 +   error = (addressLow 
 +   ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ?
 +   true : false;
 +   arcmsr_drain_donequeue(acb, pCCB, error);
 +   writel(doneq_index, 
 pmu-outboundlist_read_pointer);
 +   }
 +   mdelay(10);
 +   outbound_write_pointer =
 +   pmu-done_qbuffer[0].addressLow + 1;
 +   doneq_index = pmu-doneq_index;
 +   }
 +   pmu-postq_index = 0;
 +   pmu-doneq_index = 0x40FF;
 +   }
 +   break;
 }
  }
 ...

  
 @@ -1256,6 +1424,38 @@ static void arcmsr_post_ccb(struct Adapt
 writel(ccb_post_stamp, phbcmu-inbound_queueport_low);
 }
 }
 +   break;
 +   case ACB_ADAPTER_TYPE_D: {
 +   struct MessageUnit_D  *pmu = acb-pmuD;
 +   u16 index_stripped;
 +   u16 postq_index;
   u16 postq_index, toggle;
 +   unsigned long flags;
 +   struct InBound_SRB *pinbound_srb;
 +
 +   spin_lock_irqsave(acb-postq_lock, flags);
 +   postq_index = pmu-postq_index;
 +   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 = ccb-arc_cdb_size  2;
 +   arcmsr_cdb-msgContext = dma_addr_lo32(cdb_phyaddr);
 +   if (postq_index  0x4000) {
 +   index_stripped = postq_index  0xFF;
 +   index_stripped += 1;
 +   

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-27 Thread Tomas Henzl
On 08/19/2014 09:25 AM, Ching Huang wrote:
> From: Ching Huang 
>
> Add code for supporting Areca new Raid adapter ARC12x4 series.
>
> Signed-off-by: Ching Huang 
> ---

Hi Ching,
please look at the comments below -

>  }
> @@ -1039,7 +1147,60 @@ static void arcmsr_done4abort_postqueue(
>   error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? 
> true : false;
>   arcmsr_drain_donequeue(acb, pCCB, error);
>   }
> - }
> + }
> + break;
> + case ACB_ADAPTER_TYPE_D: {
> + struct MessageUnit_D  *pmu = acb->pmuD;
> + uint32_t ccb_cdb_phy, outbound_write_pointer;
> + uint32_t doneq_index, index_stripped, addressLow, residual;
> + bool error;
> + struct CommandControlBlock *pCCB;

I have noticed this^ in this driver already before. Sometimes it makes sense
when a variable is declared in a 'case' block but often it is just
a waste of space. In this function this is the third 'bool error' declared.
Is there a reason for this style (this function is not the worst case) ?

> + outbound_write_pointer = pmu->done_qbuffer[0].addressLow + 1;
> + doneq_index = pmu->doneq_index;
> + residual = atomic_read(>ccboutstandingcount);
> + for (i = 0; i < residual; i++) {
> + while ((doneq_index & 0xFFF) !=
> + (outbound_write_pointer & 0xFFF)) {
> + if (doneq_index & 0x4000) {
> + index_stripped = doneq_index & 0xFFF;
> + index_stripped += 1;
> + index_stripped %=
> + ARCMSR_MAX_ARC1214_DONEQUEUE;
> + pmu->doneq_index = index_stripped ?
> + (index_stripped | 0x4000) :
> + (index_stripped + 1);
> + } else {
> + index_stripped = doneq_index;
> + index_stripped += 1;
> + index_stripped %=
> + ARCMSR_MAX_ARC1214_DONEQUEUE;
> + pmu->doneq_index = index_stripped ?
> + index_stripped :
> + ((index_stripped | 0x4000) + 1);
> + }
> + doneq_index = pmu->doneq_index;
> + addressLow = pmu->done_qbuffer[doneq_index &
> + 0xFFF].addressLow;
> + ccb_cdb_phy = (addressLow & 0xFFF0);
> + pARCMSR_CDB = (struct  ARCMSR_CDB *)
> + (acb->vir2phy_offset + ccb_cdb_phy);
> + pCCB = container_of(pARCMSR_CDB,
> + struct CommandControlBlock, arcmsr_cdb);
> + error = (addressLow &
> + ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ?
> + true : false;
> + arcmsr_drain_donequeue(acb, pCCB, error);
> + writel(doneq_index, 
> pmu->outboundlist_read_pointer);
> + }
> + mdelay(10);
> + outbound_write_pointer =
> + pmu->done_qbuffer[0].addressLow + 1;
> + doneq_index = pmu->doneq_index;
> + }
> + pmu->postq_index = 0;
> + pmu->doneq_index = 0x40FF;
> + }
> + break;
>   }
>  }
...

>
>  
> @@ -1256,6 +1424,38 @@ static void arcmsr_post_ccb(struct Adapt
>   writel(ccb_post_stamp, >inbound_queueport_low);
>   }
>   }
> + break;
> + case ACB_ADAPTER_TYPE_D: {
> + struct MessageUnit_D  *pmu = acb->pmuD;
> + u16 index_stripped;
> + u16 postq_index;
> + unsigned long flags;
> + struct InBound_SRB *pinbound_srb;
> +
> + spin_lock_irqsave(>postq_lock, flags);
> + postq_index = pmu->postq_index;
> + 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 = ccb->arc_cdb_size >> 2;
> + arcmsr_cdb->msgContext = dma_addr_lo32(cdb_phyaddr);
> + if (postq_index & 0x4000) {
> + index_stripped = postq_index & 0xFF;
> + index_stripped += 1;
> + 

Re: [PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-27 Thread Tomas Henzl
On 08/19/2014 09:25 AM, Ching Huang wrote:
 From: Ching Huang ching2...@areca.com.tw

 Add code for supporting Areca new Raid adapter ARC12x4 series.

 Signed-off-by: Ching Huang ching2...@areca.com.tw
 ---

Hi Ching,
please look at the comments below -

  }
 @@ -1039,7 +1147,60 @@ static void arcmsr_done4abort_postqueue(
   error = (flag_ccb  ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ? 
 true : false;
   arcmsr_drain_donequeue(acb, pCCB, error);
   }
 - }
 + }
 + break;
 + case ACB_ADAPTER_TYPE_D: {
 + struct MessageUnit_D  *pmu = acb-pmuD;
 + uint32_t ccb_cdb_phy, outbound_write_pointer;
 + uint32_t doneq_index, index_stripped, addressLow, residual;
 + bool error;
 + struct CommandControlBlock *pCCB;

I have noticed this^ in this driver already before. Sometimes it makes sense
when a variable is declared in a 'case' block but often it is just
a waste of space. In this function this is the third 'bool error' declared.
Is there a reason for this style (this function is not the worst case) ?

 + outbound_write_pointer = pmu-done_qbuffer[0].addressLow + 1;
 + doneq_index = pmu-doneq_index;
 + residual = atomic_read(acb-ccboutstandingcount);
 + for (i = 0; i  residual; i++) {
 + while ((doneq_index  0xFFF) !=
 + (outbound_write_pointer  0xFFF)) {
 + if (doneq_index  0x4000) {
 + index_stripped = doneq_index  0xFFF;
 + index_stripped += 1;
 + index_stripped %=
 + ARCMSR_MAX_ARC1214_DONEQUEUE;
 + pmu-doneq_index = index_stripped ?
 + (index_stripped | 0x4000) :
 + (index_stripped + 1);
 + } else {
 + index_stripped = doneq_index;
 + index_stripped += 1;
 + index_stripped %=
 + ARCMSR_MAX_ARC1214_DONEQUEUE;
 + pmu-doneq_index = index_stripped ?
 + index_stripped :
 + ((index_stripped | 0x4000) + 1);
 + }
 + doneq_index = pmu-doneq_index;
 + addressLow = pmu-done_qbuffer[doneq_index 
 + 0xFFF].addressLow;
 + ccb_cdb_phy = (addressLow  0xFFF0);
 + pARCMSR_CDB = (struct  ARCMSR_CDB *)
 + (acb-vir2phy_offset + ccb_cdb_phy);
 + pCCB = container_of(pARCMSR_CDB,
 + struct CommandControlBlock, arcmsr_cdb);
 + error = (addressLow 
 + ARCMSR_CCBREPLY_FLAG_ERROR_MODE1) ?
 + true : false;
 + arcmsr_drain_donequeue(acb, pCCB, error);
 + writel(doneq_index, 
 pmu-outboundlist_read_pointer);
 + }
 + mdelay(10);
 + outbound_write_pointer =
 + pmu-done_qbuffer[0].addressLow + 1;
 + doneq_index = pmu-doneq_index;
 + }
 + pmu-postq_index = 0;
 + pmu-doneq_index = 0x40FF;
 + }
 + break;
   }
  }
...


  
 @@ -1256,6 +1424,38 @@ static void arcmsr_post_ccb(struct Adapt
   writel(ccb_post_stamp, phbcmu-inbound_queueport_low);
   }
   }
 + break;
 + case ACB_ADAPTER_TYPE_D: {
 + struct MessageUnit_D  *pmu = acb-pmuD;
 + u16 index_stripped;
 + u16 postq_index;
 + unsigned long flags;
 + struct InBound_SRB *pinbound_srb;
 +
 + spin_lock_irqsave(acb-postq_lock, flags);
 + postq_index = pmu-postq_index;
 + 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 = ccb-arc_cdb_size  2;
 + arcmsr_cdb-msgContext = dma_addr_lo32(cdb_phyaddr);
 + if (postq_index  0x4000) {
 + index_stripped = postq_index  0xFF;
 + index_stripped += 1;
 + index_stripped %= ARCMSR_MAX_ARC1214_POSTQUEUE;
 +  

[PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-19 Thread Ching Huang
From: Ching Huang 

Add code for supporting Areca new Raid adapter ARC12x4 series.

Signed-off-by: Ching Huang 
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-05-06 15:29:54.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-05-06 15:06:04.0 +0800
@@ -63,12 +63,17 @@ struct device_attribute;
 #define ARCMSR_MAX_QBUFFER 
4096
 #define ARCMSR_DEFAULT_SG_ENTRIES  
38
 #define ARCMSR_MAX_HBB_POSTQUEUE   
264
+#define ARCMSR_MAX_ARC1214_POSTQUEUE   256
+#define ARCMSR_MAX_ARC1214_DONEQUEUE   257
 #define ARCMSR_MAX_XFER_LEN
0x26000 /* 152K */
 #define ARCMSR_CDB_SG_PAGE_LENGTH  
256 
 #define ARCMST_NUM_MSIX_VECTORS4
 #ifndef PCI_DEVICE_ID_ARECA_1880
 #define PCI_DEVICE_ID_ARECA_1880 0x1880
  #endif
+#ifndef PCI_DEVICE_ID_ARECA_1214
+   #define PCI_DEVICE_ID_ARECA_12140x1214
+#endif
 /*
 
**
 **
@@ -339,6 +344,56 @@ struct FIRMWARE_INFO
 #define ARCMSR_HBCMU_MESSAGE_FIRMWARE_OK   0x8000
 /*
 ***
+**SPEC. for Areca Type D adapter
+***
+*/
+#define ARCMSR_ARC1214_CHIP_ID 0x4
+#define ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION0x8
+#define ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK  0x00034
+#define ARCMSR_ARC1214_SAMPLE_RESET0x00100
+#define ARCMSR_ARC1214_RESET_REQUEST   0x00108
+#define ARCMSR_ARC1214_MAIN_INTERRUPT_STATUS   0x00200
+#define ARCMSR_ARC1214_PCIE_F0_INTERRUPT_ENABLE0x0020C
+#define ARCMSR_ARC1214_INBOUND_MESSAGE00x00400
+#define ARCMSR_ARC1214_INBOUND_MESSAGE10x00404
+#define ARCMSR_ARC1214_OUTBOUND_MESSAGE0   0x00420
+#define ARCMSR_ARC1214_OUTBOUND_MESSAGE1   0x00424
+#define ARCMSR_ARC1214_INBOUND_DOORBELL0x00460
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL   0x00480
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ENABLE0x00484
+#define ARCMSR_ARC1214_INBOUND_LIST_BASE_LOW   0x01000
+#define ARCMSR_ARC1214_INBOUND_LIST_BASE_HIGH  0x01004
+#define ARCMSR_ARC1214_INBOUND_LIST_WRITE_POINTER  0x01018
+#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_LOW  0x01060
+#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_HIGH 0x01064
+#define ARCMSR_ARC1214_OUTBOUND_LIST_COPY_POINTER  0x0106C
+#define ARCMSR_ARC1214_OUTBOUND_LIST_READ_POINTER  0x01070
+#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_CAUSE0x01088
+#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_ENABLE   0x0108C
+#define ARCMSR_ARC1214_MESSAGE_WBUFFER 0x02000
+#define ARCMSR_ARC1214_MESSAGE_RBUFFER 0x02100
+#define ARCMSR_ARC1214_MESSAGE_RWBUFFER0x02200
+/* Host Interrupt Mask */
+#define ARCMSR_ARC1214_ALL_INT_ENABLE  0x1010
+#define ARCMSR_ARC1214_ALL_INT_DISABLE 0x
+/* Host Interrupt Status */
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ISR   0x1000
+#define ARCMSR_ARC1214_OUTBOUND_POSTQUEUE_ISR  0x0010
+/* DoorBell*/
+#define ARCMSR_ARC1214_DRV2IOP_DATA_IN_READY   0x0001
+#define ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ   0x0002
+/*inbound message 0 ready*/
+#define ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK   0x0001
+/*outbound DATA WRITE isr door bell clear*/
+#define ARCMSR_ARC1214_IOP2DRV_DATA_READ_OK0x0002
+/*outbound message 0 ready*/
+#define ARCMSR_ARC1214_IOP2DRV_MESSAGE_CMD_DONE0x0200
+/*outbound message cmd isr door bell clear*/
+/*ARCMSR_HBAMU_MESSAGE_FIRMWARE_OK*/
+#define ARCMSR_ARC1214_MESSAGE_FIRMWARE_OK 0x8000
+#define ARCMSR_ARC1214_OUTBOUND_LIST_INTERRUPT_CLEAR   0x0001
+/*
+***
 **ARECA SCSI COMMAND DESCRIPTOR BLOCK size 0x1F8 (504)
 ***
 */
@@ -496,6 +551,55 @@ struct MessageUnit_C{
uint32_tmsgcode_rwbuffer[256];  /*2200 23FF*/
 };
 /*
+*
+** Messaging Unit (MU) of Type D processor
+*
+*/
+struct InBound_SRB {
+   uint32_t addressLow; /* pointer to SRB block */
+   uint32_t addressHigh;
+   uint32_t length; /* 

[PATCH v3 16/17] arcmsr: support new adapter ARC12x4 series

2014-08-19 Thread Ching Huang
From: Ching Huang ching2...@areca.com.tw

Add code for supporting Areca new Raid adapter ARC12x4 series.

Signed-off-by: Ching Huang ching2...@areca.com.tw
---

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-05-06 15:29:54.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-05-06 15:06:04.0 +0800
@@ -63,12 +63,17 @@ struct device_attribute;
 #define ARCMSR_MAX_QBUFFER 
4096
 #define ARCMSR_DEFAULT_SG_ENTRIES  
38
 #define ARCMSR_MAX_HBB_POSTQUEUE   
264
+#define ARCMSR_MAX_ARC1214_POSTQUEUE   256
+#define ARCMSR_MAX_ARC1214_DONEQUEUE   257
 #define ARCMSR_MAX_XFER_LEN
0x26000 /* 152K */
 #define ARCMSR_CDB_SG_PAGE_LENGTH  
256 
 #define ARCMST_NUM_MSIX_VECTORS4
 #ifndef PCI_DEVICE_ID_ARECA_1880
 #define PCI_DEVICE_ID_ARECA_1880 0x1880
  #endif
+#ifndef PCI_DEVICE_ID_ARECA_1214
+   #define PCI_DEVICE_ID_ARECA_12140x1214
+#endif
 /*
 
**
 **
@@ -339,6 +344,56 @@ struct FIRMWARE_INFO
 #define ARCMSR_HBCMU_MESSAGE_FIRMWARE_OK   0x8000
 /*
 ***
+**SPEC. for Areca Type D adapter
+***
+*/
+#define ARCMSR_ARC1214_CHIP_ID 0x4
+#define ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION0x8
+#define ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK  0x00034
+#define ARCMSR_ARC1214_SAMPLE_RESET0x00100
+#define ARCMSR_ARC1214_RESET_REQUEST   0x00108
+#define ARCMSR_ARC1214_MAIN_INTERRUPT_STATUS   0x00200
+#define ARCMSR_ARC1214_PCIE_F0_INTERRUPT_ENABLE0x0020C
+#define ARCMSR_ARC1214_INBOUND_MESSAGE00x00400
+#define ARCMSR_ARC1214_INBOUND_MESSAGE10x00404
+#define ARCMSR_ARC1214_OUTBOUND_MESSAGE0   0x00420
+#define ARCMSR_ARC1214_OUTBOUND_MESSAGE1   0x00424
+#define ARCMSR_ARC1214_INBOUND_DOORBELL0x00460
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL   0x00480
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ENABLE0x00484
+#define ARCMSR_ARC1214_INBOUND_LIST_BASE_LOW   0x01000
+#define ARCMSR_ARC1214_INBOUND_LIST_BASE_HIGH  0x01004
+#define ARCMSR_ARC1214_INBOUND_LIST_WRITE_POINTER  0x01018
+#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_LOW  0x01060
+#define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_HIGH 0x01064
+#define ARCMSR_ARC1214_OUTBOUND_LIST_COPY_POINTER  0x0106C
+#define ARCMSR_ARC1214_OUTBOUND_LIST_READ_POINTER  0x01070
+#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_CAUSE0x01088
+#define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_ENABLE   0x0108C
+#define ARCMSR_ARC1214_MESSAGE_WBUFFER 0x02000
+#define ARCMSR_ARC1214_MESSAGE_RBUFFER 0x02100
+#define ARCMSR_ARC1214_MESSAGE_RWBUFFER0x02200
+/* Host Interrupt Mask */
+#define ARCMSR_ARC1214_ALL_INT_ENABLE  0x1010
+#define ARCMSR_ARC1214_ALL_INT_DISABLE 0x
+/* Host Interrupt Status */
+#define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ISR   0x1000
+#define ARCMSR_ARC1214_OUTBOUND_POSTQUEUE_ISR  0x0010
+/* DoorBell*/
+#define ARCMSR_ARC1214_DRV2IOP_DATA_IN_READY   0x0001
+#define ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ   0x0002
+/*inbound message 0 ready*/
+#define ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK   0x0001
+/*outbound DATA WRITE isr door bell clear*/
+#define ARCMSR_ARC1214_IOP2DRV_DATA_READ_OK0x0002
+/*outbound message 0 ready*/
+#define ARCMSR_ARC1214_IOP2DRV_MESSAGE_CMD_DONE0x0200
+/*outbound message cmd isr door bell clear*/
+/*ARCMSR_HBAMU_MESSAGE_FIRMWARE_OK*/
+#define ARCMSR_ARC1214_MESSAGE_FIRMWARE_OK 0x8000
+#define ARCMSR_ARC1214_OUTBOUND_LIST_INTERRUPT_CLEAR   0x0001
+/*
+***
 **ARECA SCSI COMMAND DESCRIPTOR BLOCK size 0x1F8 (504)
 ***
 */
@@ -496,6 +551,55 @@ struct MessageUnit_C{
uint32_tmsgcode_rwbuffer[256];  /*2200 23FF*/
 };
 /*
+*
+** Messaging Unit (MU) of Type D processor
+*
+*/
+struct InBound_SRB {
+   uint32_t addressLow; /* pointer to SRB block */
+