arcmsr.c (d241a0e67ff3a44947931bf8c841d9786c59efd7) arcmsr.c (35689395b3d5478b3fab05080c71b13a7d57ca54)
1/*
1/*
2*****************************************************************************************
3** O.S : FreeBSD
2********************************************************************************
3** OS : FreeBSD
4** FILE NAME : arcmsr.c
5** BY : Erich Chen, Ching Huang
6** Description: SCSI RAID Device Driver for
4** FILE NAME : arcmsr.c
5** BY : Erich Chen, Ching Huang
6** Description: SCSI RAID Device Driver for
7** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x) SATA/SAS RAID HOST Adapter
8** ARCMSR RAID Host adapter
9** [RAID controller:INTEL 331(PCI-X) 341(PCI-EXPRESS) chip set]
10******************************************************************************************
11************************************************************************
7** ARECA (ARC11XX/ARC12XX/ARC13XX/ARC16XX/ARC188x)
8** SATA/SAS RAID HOST Adapter
9********************************************************************************
10********************************************************************************
12**
11**
13** Copyright (C) 2002 - 2010, Areca Technology Corporation All rights reserved.
12** Copyright (C) 2002 - 2012, Areca Technology Corporation All rights reserved.
14**
15** Redistribution and use in source and binary forms, with or without
16** modification, are permitted provided that the following conditions
17** are met:
18** 1. Redistributions of source code must retain the above copyright
19** notice, this list of conditions and the following disclaimer.
20** 2. Redistributions in binary form must reproduce the above copyright
21** notice, this list of conditions and the following disclaimer in the

--- 6 unchanged lines hidden (view full) ---

28** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT
31** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32** DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
33** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
35** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13**
14** Redistribution and use in source and binary forms, with or without
15** modification, are permitted provided that the following conditions
16** are met:
17** 1. Redistributions of source code must retain the above copyright
18** notice, this list of conditions and the following disclaimer.
19** 2. Redistributions in binary form must reproduce the above copyright
20** notice, this list of conditions and the following disclaimer in the

--- 6 unchanged lines hidden (view full) ---

27** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT
30** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31** DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY
32** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33**(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF
34** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36**************************************************************************
35********************************************************************************
37** History
38**
39** REV# DATE NAME DESCRIPTION
40** 1.00.00.00 03/31/2004 Erich Chen First release
41** 1.20.00.02 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset when PHY error
42** 1.20.00.03 04/19/2005 Erich Chen add SATA 24 Ports adapter type support
43** clean unused function
44** 1.20.00.12 09/12/2005 Erich Chen bug fix with abort command handling,

--- 23 unchanged lines hidden (view full) ---

68** 02/14/2011 Ching Huang Modified pktRequestCount
69** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it
70** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic
71** 1.20.00.23 10/28/2011 Ching Huang Added TIMEOUT_DELAY in case of too many HDDs need to start
72** 1.20.00.23 11/08/2011 Ching Huang Added report device transfer speed
73** 1.20.00.23 01/30/2012 Ching Huang Fixed Request requeued and Retrying command
74** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition
75** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter
36** History
37**
38** REV# DATE NAME DESCRIPTION
39** 1.00.00.00 03/31/2004 Erich Chen First release
40** 1.20.00.02 11/29/2004 Erich Chen bug fix with arcmsr_bus_reset when PHY error
41** 1.20.00.03 04/19/2005 Erich Chen add SATA 24 Ports adapter type support
42** clean unused function
43** 1.20.00.12 09/12/2005 Erich Chen bug fix with abort command handling,

--- 23 unchanged lines hidden (view full) ---

67** 02/14/2011 Ching Huang Modified pktRequestCount
68** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it
69** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic
70** 1.20.00.23 10/28/2011 Ching Huang Added TIMEOUT_DELAY in case of too many HDDs need to start
71** 1.20.00.23 11/08/2011 Ching Huang Added report device transfer speed
72** 1.20.00.23 01/30/2012 Ching Huang Fixed Request requeued and Retrying command
73** 1.20.00.24 06/11/2012 Ching Huang Fixed return sense data condition
74** 1.20.00.25 08/17/2012 Ching Huang Fixed hotplug device no function on type A adapter
76** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214
75** 1.20.00.26 12/14/2012 Ching Huang Added support ARC1214,1224
77******************************************************************************************
78*/
79
80#include <sys/cdefs.h>
81__FBSDID("$FreeBSD$");
82
83#if 0
84#define ARCMSR_DEBUG1 1

--- 55 unchanged lines hidden (view full) ---

140#endif
141
142#if __FreeBSD_version > 500000
143#define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1);
144#else
145#define arcmsr_callout_init(a) callout_init(a);
146#endif
147
76******************************************************************************************
77*/
78
79#include <sys/cdefs.h>
80__FBSDID("$FreeBSD$");
81
82#if 0
83#define ARCMSR_DEBUG1 1

--- 55 unchanged lines hidden (view full) ---

139#endif
140
141#if __FreeBSD_version > 500000
142#define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1);
143#else
144#define arcmsr_callout_init(a) callout_init(a);
145#endif
146
148#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.26 2012-12-14"
147#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.26 2013-01-08"
149#include <dev/arcmsr/arcmsr.h>
150/*
151**************************************************************************
152**************************************************************************
153*/
154static void arcmsr_free_srb(struct CommandControlBlock *srb);
155static struct CommandControlBlock *arcmsr_get_freesrb(struct AdapterControlBlock *acb);
156static u_int8_t arcmsr_seek_cmd2abort(union ccb *abortccb);

--- 6 unchanged lines hidden (view full) ---

163static void arcmsr_interrupt(struct AdapterControlBlock *acb);
164static void arcmsr_polling_srbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_srb);
165static void arcmsr_free_resource(struct AdapterControlBlock *acb);
166static void arcmsr_bus_reset(struct AdapterControlBlock *acb);
167static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb);
168static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb);
169static void arcmsr_iop_init(struct AdapterControlBlock *acb);
170static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb);
148#include <dev/arcmsr/arcmsr.h>
149/*
150**************************************************************************
151**************************************************************************
152*/
153static void arcmsr_free_srb(struct CommandControlBlock *srb);
154static struct CommandControlBlock *arcmsr_get_freesrb(struct AdapterControlBlock *acb);
155static u_int8_t arcmsr_seek_cmd2abort(union ccb *abortccb);

--- 6 unchanged lines hidden (view full) ---

162static void arcmsr_interrupt(struct AdapterControlBlock *acb);
163static void arcmsr_polling_srbdone(struct AdapterControlBlock *acb, struct CommandControlBlock *poll_srb);
164static void arcmsr_free_resource(struct AdapterControlBlock *acb);
165static void arcmsr_bus_reset(struct AdapterControlBlock *acb);
166static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb);
167static void arcmsr_start_adapter_bgrb(struct AdapterControlBlock *acb);
168static void arcmsr_iop_init(struct AdapterControlBlock *acb);
169static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb);
171static void arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer);
170static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb, struct QBUFFER *prbuffer);
172static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb);
173static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb);
174static void arcmsr_srb_complete(struct CommandControlBlock *srb, int stand_flag);
175static void arcmsr_iop_reset(struct AdapterControlBlock *acb);
176static void arcmsr_report_sense_info(struct CommandControlBlock *srb);
177static void arcmsr_build_srb(struct CommandControlBlock *srb, bus_dma_segment_t *dm_segs, u_int32_t nseg);
178static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, union ccb *pccb);
179static int arcmsr_resume(device_t dev);

--- 27 unchanged lines hidden (view full) ---

207static device_method_t arcmsr_methods[]={
208 DEVMETHOD(device_probe, arcmsr_probe),
209 DEVMETHOD(device_attach, arcmsr_attach),
210 DEVMETHOD(device_detach, arcmsr_detach),
211 DEVMETHOD(device_shutdown, arcmsr_shutdown),
212 DEVMETHOD(device_suspend, arcmsr_suspend),
213 DEVMETHOD(device_resume, arcmsr_resume),
214
171static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb);
172static void arcmsr_abort_allcmd(struct AdapterControlBlock *acb);
173static void arcmsr_srb_complete(struct CommandControlBlock *srb, int stand_flag);
174static void arcmsr_iop_reset(struct AdapterControlBlock *acb);
175static void arcmsr_report_sense_info(struct CommandControlBlock *srb);
176static void arcmsr_build_srb(struct CommandControlBlock *srb, bus_dma_segment_t *dm_segs, u_int32_t nseg);
177static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, union ccb *pccb);
178static int arcmsr_resume(device_t dev);

--- 27 unchanged lines hidden (view full) ---

206static device_method_t arcmsr_methods[]={
207 DEVMETHOD(device_probe, arcmsr_probe),
208 DEVMETHOD(device_attach, arcmsr_attach),
209 DEVMETHOD(device_detach, arcmsr_detach),
210 DEVMETHOD(device_shutdown, arcmsr_shutdown),
211 DEVMETHOD(device_suspend, arcmsr_suspend),
212 DEVMETHOD(device_resume, arcmsr_resume),
213
214#if __FreeBSD_version >= 803000
215 DEVMETHOD_END
215 DEVMETHOD_END
216#else
217 { 0, 0 }
218#endif
216};
217
218static driver_t arcmsr_driver={
219 "arcmsr", arcmsr_methods, sizeof(struct AdapterControlBlock)
220};
221
222static devclass_t arcmsr_devclass;
223DRIVER_MODULE(arcmsr, pci, arcmsr_driver, arcmsr_devclass, 0, 0);

--- 1152 unchanged lines hidden (view full) ---

1376 arcmsr_interrupt(acb);
1377 if( mutex == 0 )
1378 ARCMSR_LOCK_RELEASE(&acb->isr_lock);
1379}
1380/*
1381**************************************************************************
1382**************************************************************************
1383*/
219};
220
221static driver_t arcmsr_driver={
222 "arcmsr", arcmsr_methods, sizeof(struct AdapterControlBlock)
223};
224
225static devclass_t arcmsr_devclass;
226DRIVER_MODULE(arcmsr, pci, arcmsr_driver, arcmsr_devclass, 0, 0);

--- 1152 unchanged lines hidden (view full) ---

1379 arcmsr_interrupt(acb);
1380 if( mutex == 0 )
1381 ARCMSR_LOCK_RELEASE(&acb->isr_lock);
1382}
1383/*
1384**************************************************************************
1385**************************************************************************
1386*/
1384static void arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb,
1387static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struct AdapterControlBlock *acb,
1385 struct QBUFFER *prbuffer) {
1386
1387 u_int8_t *pQbuffer;
1388 struct QBUFFER *prbuffer) {
1389
1390 u_int8_t *pQbuffer;
1391 u_int8_t *buf1 = 0;
1392 u_int32_t *iop_data, *buf2 = 0;
1393 u_int32_t iop_len, data_len;
1394
1395 iop_data = (u_int32_t *)prbuffer->data;
1396 iop_len = (u_int32_t)prbuffer->data_len;
1397 if ( iop_len > 0 )
1398 {
1399 buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO);
1400 buf2 = (u_int32_t *)buf1;
1401 if( buf1 == NULL)
1402 return (0);
1403 data_len = iop_len;
1404 while(data_len >= 4)
1405 {
1406 *buf2++ = *iop_data++;
1407 data_len -= 4;
1408 }
1409 if(data_len)
1410 *buf2 = *iop_data;
1411 buf2 = (u_int32_t *)buf1;
1412 }
1413 while (iop_len > 0) {
1414 pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
1415 *pQbuffer = *buf1;
1416 acb->rqbuf_lastindex++;
1417 /* if last, index number set it to 0 */
1418 acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
1419 buf1++;
1420 iop_len--;
1421 }
1422 if(buf2)
1423 free( (u_int8_t *)buf2, M_DEVBUF);
1424 /* let IOP know data has been read */
1425 arcmsr_iop_message_read(acb);
1426 return (1);
1427}
1428/*
1429**************************************************************************
1430**************************************************************************
1431*/
1432static u_int32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *acb,
1433 struct QBUFFER *prbuffer) {
1434
1435 u_int8_t *pQbuffer;
1388 u_int8_t *iop_data;
1389 u_int32_t iop_len;
1390
1436 u_int8_t *iop_data;
1437 u_int32_t iop_len;
1438
1439 if(acb->adapter_type == ACB_ADAPTER_TYPE_D) {
1440 return(arcmsr_Read_iop_rqbuffer_data_D(acb, prbuffer));
1441 }
1391 iop_data = (u_int8_t *)prbuffer->data;
1392 iop_len = (u_int32_t)prbuffer->data_len;
1393 while (iop_len > 0) {
1394 pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
1395 *pQbuffer = *iop_data;
1396 acb->rqbuf_lastindex++;
1397 /* if last, index number set it to 0 */
1398 acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
1399 iop_data++;
1400 iop_len--;
1401 }
1402 /* let IOP know data has been read */
1403 arcmsr_iop_message_read(acb);
1442 iop_data = (u_int8_t *)prbuffer->data;
1443 iop_len = (u_int32_t)prbuffer->data_len;
1444 while (iop_len > 0) {
1445 pQbuffer = &acb->rqbuffer[acb->rqbuf_lastindex];
1446 *pQbuffer = *iop_data;
1447 acb->rqbuf_lastindex++;
1448 /* if last, index number set it to 0 */
1449 acb->rqbuf_lastindex %= ARCMSR_MAX_QBUFFER;
1450 iop_data++;
1451 iop_len--;
1452 }
1453 /* let IOP know data has been read */
1454 arcmsr_iop_message_read(acb);
1455 return (1);
1404}
1405/*
1406**************************************************************************
1407**************************************************************************
1408*/
1409static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb)
1410{
1411 struct QBUFFER *prbuffer;
1412 int my_empty_len;
1413
1414 /*check this iop data if overflow my rqbuffer*/
1415 ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock);
1416 prbuffer = arcmsr_get_iop_rqbuffer(acb);
1417 my_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex - 1) &
1418 (ARCMSR_MAX_QBUFFER-1);
1419 if(my_empty_len >= prbuffer->data_len) {
1456}
1457/*
1458**************************************************************************
1459**************************************************************************
1460*/
1461static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb)
1462{
1463 struct QBUFFER *prbuffer;
1464 int my_empty_len;
1465
1466 /*check this iop data if overflow my rqbuffer*/
1467 ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock);
1468 prbuffer = arcmsr_get_iop_rqbuffer(acb);
1469 my_empty_len = (acb->rqbuf_lastindex - acb->rqbuf_firstindex - 1) &
1470 (ARCMSR_MAX_QBUFFER-1);
1471 if(my_empty_len >= prbuffer->data_len) {
1420 arcmsr_Read_iop_rqbuffer_data(acb, prbuffer);
1472 if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
1473 acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
1421 } else {
1422 acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
1423 }
1424 ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock);
1425}
1426/*
1427**********************************************************************
1428**********************************************************************
1429*/
1474 } else {
1475 acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
1476 }
1477 ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock);
1478}
1479/*
1480**********************************************************************
1481**********************************************************************
1482*/
1483static void arcmsr_Write_data_2iop_wqbuffer_D(struct AdapterControlBlock *acb)
1484{
1485 u_int8_t *pQbuffer;
1486 struct QBUFFER *pwbuffer;
1487 u_int8_t *buf1 = 0;
1488 u_int32_t *iop_data, *buf2 = 0;
1489 u_int32_t allxfer_len = 0, data_len;
1490
1491 if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) {
1492 buf1 = malloc(128, M_DEVBUF, M_NOWAIT | M_ZERO);
1493 buf2 = (u_int32_t *)buf1;
1494 if( buf1 == NULL)
1495 return;
1496
1497 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ);
1498 pwbuffer = arcmsr_get_iop_wqbuffer(acb);
1499 iop_data = (u_int32_t *)pwbuffer->data;
1500 while((acb->wqbuf_firstindex != acb->wqbuf_lastindex)
1501 && (allxfer_len < 124)) {
1502 pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex];
1503 *buf1 = *pQbuffer;
1504 acb->wqbuf_firstindex++;
1505 acb->wqbuf_firstindex %= ARCMSR_MAX_QBUFFER;
1506 buf1++;
1507 allxfer_len++;
1508 }
1509 pwbuffer->data_len = allxfer_len;
1510 data_len = allxfer_len;
1511 buf1 = (u_int8_t *)buf2;
1512 while(data_len >= 4)
1513 {
1514 *iop_data++ = *buf2++;
1515 data_len -= 4;
1516 }
1517 if(data_len)
1518 *iop_data = *buf2;
1519 free( buf1, M_DEVBUF);
1520 arcmsr_iop_message_wrote(acb);
1521 }
1522}
1523/*
1524**********************************************************************
1525**********************************************************************
1526*/
1430static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb)
1431{
1432 u_int8_t *pQbuffer;
1433 struct QBUFFER *pwbuffer;
1434 u_int8_t *iop_data;
1435 int32_t allxfer_len=0;
1436
1527static void arcmsr_Write_data_2iop_wqbuffer(struct AdapterControlBlock *acb)
1528{
1529 u_int8_t *pQbuffer;
1530 struct QBUFFER *pwbuffer;
1531 u_int8_t *iop_data;
1532 int32_t allxfer_len=0;
1533
1534 if(acb->adapter_type == ACB_ADAPTER_TYPE_D) {
1535 arcmsr_Write_data_2iop_wqbuffer_D(acb);
1536 return;
1537 }
1437 if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) {
1438 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ);
1439 pwbuffer = arcmsr_get_iop_wqbuffer(acb);
1440 iop_data = (u_int8_t *)pwbuffer->data;
1441 while((acb->wqbuf_firstindex != acb->wqbuf_lastindex)
1442 && (allxfer_len < 124)) {
1443 pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex];
1444 *iop_data = *pQbuffer;

--- 703 unchanged lines hidden (view full) ---

2148 ptmpQbuffer++;
2149 allxfer_len++;
2150 }
2151 if(acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
2152 struct QBUFFER *prbuffer;
2153
2154 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
2155 prbuffer = arcmsr_get_iop_rqbuffer(acb);
1538 if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) {
1539 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READ);
1540 pwbuffer = arcmsr_get_iop_wqbuffer(acb);
1541 iop_data = (u_int8_t *)pwbuffer->data;
1542 while((acb->wqbuf_firstindex != acb->wqbuf_lastindex)
1543 && (allxfer_len < 124)) {
1544 pQbuffer = &acb->wqbuffer[acb->wqbuf_firstindex];
1545 *iop_data = *pQbuffer;

--- 703 unchanged lines hidden (view full) ---

2249 ptmpQbuffer++;
2250 allxfer_len++;
2251 }
2252 if(acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
2253 struct QBUFFER *prbuffer;
2254
2255 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
2256 prbuffer = arcmsr_get_iop_rqbuffer(acb);
2156 arcmsr_Read_iop_rqbuffer_data(acb, prbuffer);
2257 if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
2258 acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
2157 }
2158 pcmdmessagefld->cmdmessage.Length = allxfer_len;
2159 pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
2160 retvalue = ARCMSR_MESSAGE_SUCCESS;
2161 }
2162 break;
2163 case ARCMSR_MESSAGE_WRITE_WQBUFFER: {
2164 u_int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex;

--- 204 unchanged lines hidden (view full) ---

2369 ptmpQbuffer++;
2370 allxfer_len++;
2371 }
2372 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
2373 struct QBUFFER *prbuffer;
2374
2375 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
2376 prbuffer = arcmsr_get_iop_rqbuffer(acb);
2259 }
2260 pcmdmessagefld->cmdmessage.Length = allxfer_len;
2261 pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
2262 retvalue = ARCMSR_MESSAGE_SUCCESS;
2263 }
2264 break;
2265 case ARCMSR_MESSAGE_WRITE_WQBUFFER: {
2266 u_int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex;

--- 204 unchanged lines hidden (view full) ---

2471 ptmpQbuffer++;
2472 allxfer_len++;
2473 }
2474 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
2475 struct QBUFFER *prbuffer;
2476
2477 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
2478 prbuffer = arcmsr_get_iop_rqbuffer(acb);
2377 arcmsr_Read_iop_rqbuffer_data(acb, prbuffer);
2479 if(arcmsr_Read_iop_rqbuffer_data(acb, prbuffer) == 0)
2480 acb->acb_flags |= ACB_F_IOPDATA_OVERFLOW;
2378 }
2379 pcmdmessagefld->cmdmessage.Length = allxfer_len;
2380 pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
2381 retvalue = ARCMSR_MESSAGE_SUCCESS;
2382 ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock);
2383 }
2384 break;
2385 case ARCMSR_MESSAGE_WRITE_WQBUFFER: {

--- 1999 unchanged lines hidden ---
2481 }
2482 pcmdmessagefld->cmdmessage.Length = allxfer_len;
2483 pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
2484 retvalue = ARCMSR_MESSAGE_SUCCESS;
2485 ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock);
2486 }
2487 break;
2488 case ARCMSR_MESSAGE_WRITE_WQBUFFER: {

--- 1999 unchanged lines hidden ---