ioctl.c (143039) | ioctl.c (149871) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2003-2004 HighPoint Technologies, Inc. | 2 * Copyright (c) 2004-2005 HighPoint Technologies, Inc. |
3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/hptmv/ioctl.c 143039 2005-03-02 15:13:37Z scottl $ | 26 * $FreeBSD: head/sys/dev/hptmv/ioctl.c 149871 2005-09-07 23:33:26Z scottl $ |
27 */ 28/* 29 * ioctl.c ioctl interface implementation 30 */ 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35 | 27 */ 28/* 29 * ioctl.c ioctl interface implementation 30 */ 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35 |
36#if (__FreeBSD_version < 500000) 37#include <sys/proc.h> 38#include <sys/kthread.h> 39#include <sys/wait.h> 40#include <sys/sysproto.h> 41#endif 42 43#ifndef __KERNEL__ 44#define __KERNEL__ 45#endif 46 |
|
36#include <dev/hptmv/global.h> 37#include <dev/hptmv/hptintf.h> 38#include <dev/hptmv/osbsd.h> 39#include <dev/hptmv/access601.h> 40 41#pragma pack(1) 42 43typedef struct _HPT_REBUILD_PARAM --- 11 unchanged lines hidden (view full) --- 55 56static int hpt_get_event(PHPT_EVENT pEvent); 57static int hpt_set_array_state(DEVICEID idArray, DWORD state); 58static intrmask_t lock_driver_idle(IAL_ADAPTER_T *pAdapter); 59static void HPTLIBAPI thread_io_done(_VBUS_ARG PCommand pCmd); 60static int HPTLIBAPI R1ControlSgl(_VBUS_ARG PCommand pCmd, 61 FPSCAT_GATH pSgTable, int logical); 62 | 47#include <dev/hptmv/global.h> 48#include <dev/hptmv/hptintf.h> 49#include <dev/hptmv/osbsd.h> 50#include <dev/hptmv/access601.h> 51 52#pragma pack(1) 53 54typedef struct _HPT_REBUILD_PARAM --- 11 unchanged lines hidden (view full) --- 66 67static int hpt_get_event(PHPT_EVENT pEvent); 68static int hpt_set_array_state(DEVICEID idArray, DWORD state); 69static intrmask_t lock_driver_idle(IAL_ADAPTER_T *pAdapter); 70static void HPTLIBAPI thread_io_done(_VBUS_ARG PCommand pCmd); 71static int HPTLIBAPI R1ControlSgl(_VBUS_ARG PCommand pCmd, 72 FPSCAT_GATH pSgTable, int logical); 73 |
63static void get_disk_location(PDevice pDev, int *controller, int *channel) | 74static void 75get_disk_location(PDevice pDev, int *controller, int *channel) |
64{ 65 IAL_ADAPTER_T *pAdapTemp; 66 int i, j; 67 68 for (i=1, pAdapTemp = gIal_Adapter; pAdapTemp; pAdapTemp = pAdapTemp->next, i++) { 69 for (j=0; j<MV_SATA_CHANNELS_NUM; j++) 70 if (pDev==&pAdapTemp->VDevices[j].u.disk) { 71 *controller = i; 72 *channel = j; 73 return; 74 } 75 } 76} 77 | 76{ 77 IAL_ADAPTER_T *pAdapTemp; 78 int i, j; 79 80 for (i=1, pAdapTemp = gIal_Adapter; pAdapTemp; pAdapTemp = pAdapTemp->next, i++) { 81 for (j=0; j<MV_SATA_CHANNELS_NUM; j++) 82 if (pDev==&pAdapTemp->VDevices[j].u.disk) { 83 *controller = i; 84 *channel = j; 85 return; 86 } 87 } 88} 89 |
78static int event_queue_add(PHPT_EVENT pEvent) | 90static int 91event_queue_add(PHPT_EVENT pEvent) |
79{ 80 int p; 81 p = (event_queue_tail + 1) % MAX_EVENTS; 82 if (p==event_queue_head) 83 { 84 return -1; 85 } 86 hpt_event_queue[event_queue_tail] = *pEvent; 87 event_queue_tail = p; 88 return 0; 89} 90 | 92{ 93 int p; 94 p = (event_queue_tail + 1) % MAX_EVENTS; 95 if (p==event_queue_head) 96 { 97 return -1; 98 } 99 hpt_event_queue[event_queue_tail] = *pEvent; 100 event_queue_tail = p; 101 return 0; 102} 103 |
91static int event_queue_remove(PHPT_EVENT pEvent) | 104static int 105event_queue_remove(PHPT_EVENT pEvent) |
92{ 93 if (event_queue_head != event_queue_tail) 94 { 95 *pEvent = hpt_event_queue[event_queue_head]; 96 event_queue_head++; 97 event_queue_head %= MAX_EVENTS; 98 return 0; 99 } 100 return -1; 101} 102 | 106{ 107 if (event_queue_head != event_queue_tail) 108 { 109 *pEvent = hpt_event_queue[event_queue_head]; 110 event_queue_head++; 111 event_queue_head %= MAX_EVENTS; 112 return 0; 113 } 114 return -1; 115} 116 |
103void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param) | 117void HPTLIBAPI 118ioctl_ReportEvent(UCHAR event, PVOID param) |
104{ 105 HPT_EVENT e; 106 ZeroMemory(&e, sizeof(e)); 107 e.EventType = event; 108 switch(event) 109 { 110 case ET_INITIALIZE_ABORTED: 111 case ET_INITIALIZE_FAILED: --- 25 unchanged lines hidden (view full) --- 137 event_queue_add(&e); 138 if (event==ET_DEVICE_REMOVED) { 139 int controller, channel; 140 get_disk_location(&((PVDevice)param)->u.disk, &controller, &channel); 141 hpt_printk(("Device removed: controller %d channel %d\n", controller, channel)); 142 } 143} 144 | 119{ 120 HPT_EVENT e; 121 ZeroMemory(&e, sizeof(e)); 122 e.EventType = event; 123 switch(event) 124 { 125 case ET_INITIALIZE_ABORTED: 126 case ET_INITIALIZE_FAILED: --- 25 unchanged lines hidden (view full) --- 152 event_queue_add(&e); 153 if (event==ET_DEVICE_REMOVED) { 154 int controller, channel; 155 get_disk_location(&((PVDevice)param)->u.disk, &controller, &channel); 156 hpt_printk(("Device removed: controller %d channel %d\n", controller, channel)); 157 } 158} 159 |
145static int hpt_delete_array(_VBUS_ARG DEVICEID id, DWORD options) | 160static int 161hpt_delete_array(_VBUS_ARG DEVICEID id, DWORD options) |
146{ 147 PVDevice pArray = ID_TO_VDEV(id); 148 BOOLEAN del_block0 = (options & DAF_KEEP_DATA_IF_POSSIBLE)?0:1; 149 int i; 150 PVDevice pa; 151 | 162{ 163 PVDevice pArray = ID_TO_VDEV(id); 164 BOOLEAN del_block0 = (options & DAF_KEEP_DATA_IF_POSSIBLE)?0:1; 165 int i; 166 PVDevice pa; 167 |
152 if((id== HPT_NULL_ID) || check_VDevice_valid(pArray)) | 168 if ((id==0) || check_VDevice_valid(pArray)) |
153 return -1; 154 155 if(!mIsArray(pArray)) return -1; 156 157 if (pArray->u.array.rf_rebuilding || pArray->u.array.rf_verifying || 158 pArray->u.array.rf_initializing) 159 return -1; 160 --- 10 unchanged lines hidden (view full) --- 171 fDeleteArray(_VBUS_P pArray, del_block0); 172 return 0; 173 174} 175 176/* just to prevent driver from sending more commands */ 177static void HPTLIBAPI nothing(_VBUS_ARG void *notused){} 178 | 169 return -1; 170 171 if(!mIsArray(pArray)) return -1; 172 173 if (pArray->u.array.rf_rebuilding || pArray->u.array.rf_verifying || 174 pArray->u.array.rf_initializing) 175 return -1; 176 --- 10 unchanged lines hidden (view full) --- 187 fDeleteArray(_VBUS_P pArray, del_block0); 188 return 0; 189 190} 191 192/* just to prevent driver from sending more commands */ 193static void HPTLIBAPI nothing(_VBUS_ARG void *notused){} 194 |
179static intrmask_t lock_driver_idle(IAL_ADAPTER_T *pAdapter) | 195intrmask_t 196lock_driver_idle(IAL_ADAPTER_T *pAdapter) |
180{ 181 intrmask_t oldspl; 182 _VBUS_INST(&pAdapter->VBus) 183 oldspl = lock_driver(); 184 while (pAdapter->outstandingCommands) { 185 KdPrint(("outstandingCommands is %d, wait..\n", pAdapter->outstandingCommands)); 186 if (!mWaitingForIdle(_VBUS_P0)) CallWhenIdle(_VBUS_P nothing, 0); 187 unlock_driver(oldspl); | 197{ 198 intrmask_t oldspl; 199 _VBUS_INST(&pAdapter->VBus) 200 oldspl = lock_driver(); 201 while (pAdapter->outstandingCommands) { 202 KdPrint(("outstandingCommands is %d, wait..\n", pAdapter->outstandingCommands)); 203 if (!mWaitingForIdle(_VBUS_P0)) CallWhenIdle(_VBUS_P nothing, 0); 204 unlock_driver(oldspl); |
205/*Schedule out*/ 206#if (__FreeBSD_version < 500000) 207 YIELD_THREAD; 208#else 209 tsleep(lock_driver_idle, PPAUSE, "switch", 1); 210#endif |
|
188 oldspl = lock_driver(); 189 } 190 CheckIdleCall(_VBUS_P0); 191 return oldspl; 192} 193 194int Kernel_DeviceIoControl(_VBUS_ARG 195 DWORD dwIoControlCode, /* operation control code */ --- 17 unchanged lines hidden (view full) --- 213 struct cam_periph *periph = NULL; 214 215 if (nInBufferSize!=sizeof(DEVICEID)+sizeof(DWORD)) return -1; 216 if (nOutBufferSize!=sizeof(int)) return -1; 217 idArray = *(DEVICEID *)lpInBuffer; 218 219 pArray = ID_TO_VDEV(idArray); 220 | 211 oldspl = lock_driver(); 212 } 213 CheckIdleCall(_VBUS_P0); 214 return oldspl; 215} 216 217int Kernel_DeviceIoControl(_VBUS_ARG 218 DWORD dwIoControlCode, /* operation control code */ --- 17 unchanged lines hidden (view full) --- 236 struct cam_periph *periph = NULL; 237 238 if (nInBufferSize!=sizeof(DEVICEID)+sizeof(DWORD)) return -1; 239 if (nOutBufferSize!=sizeof(int)) return -1; 240 idArray = *(DEVICEID *)lpInBuffer; 241 242 pArray = ID_TO_VDEV(idArray); 243 |
221 if((idArray == HPT_NULL_ID) || check_VDevice_valid(pArray)) | 244 if((idArray == 0) || check_VDevice_valid(pArray)) |
222 return -1; 223 224 if(!mIsArray(pArray)) 225 return -1; 226 227 _vbus_p=pArray->pVBus; 228 pAdapter = (IAL_ADAPTER_T *)_vbus_p->OsExt; 229 230 for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++) { 231 if(pArray == _vbus_p->pVDevice[i]) 232 { 233 periph = hpt_get_periph(pAdapter->mvSataAdapter.adapterId, i); | 245 return -1; 246 247 if(!mIsArray(pArray)) 248 return -1; 249 250 _vbus_p=pArray->pVBus; 251 pAdapter = (IAL_ADAPTER_T *)_vbus_p->OsExt; 252 253 for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++) { 254 if(pArray == _vbus_p->pVDevice[i]) 255 { 256 periph = hpt_get_periph(pAdapter->mvSataAdapter.adapterId, i); |
234 if (periph != NULL && periph->refcount == 1) | 257 if (periph != NULL && periph->refcount >= 1) |
235 { 236 hpt_printk(("Can not delete a mounted device.\n")); 237 return -1; 238 } 239 } 240 /* the Mounted Disk isn't delete */ 241 } 242 --- 140 unchanged lines hidden (view full) --- 383 unlock_driver(oldspl); 384 break; 385 } 386 387 case HPT_IOCTL_ADD_DISK_TO_ARRAY: 388 { 389 PVDevice pArray = ID_TO_VDEV(((PHPT_ADD_DISK_TO_ARRAY)lpInBuffer)->idArray); 390 pAdapter=(IAL_ADAPTER_T *)pArray->pVBus->OsExt; | 258 { 259 hpt_printk(("Can not delete a mounted device.\n")); 260 return -1; 261 } 262 } 263 /* the Mounted Disk isn't delete */ 264 } 265 --- 140 unchanged lines hidden (view full) --- 406 unlock_driver(oldspl); 407 break; 408 } 409 410 case HPT_IOCTL_ADD_DISK_TO_ARRAY: 411 { 412 PVDevice pArray = ID_TO_VDEV(((PHPT_ADD_DISK_TO_ARRAY)lpInBuffer)->idArray); 413 pAdapter=(IAL_ADAPTER_T *)pArray->pVBus->OsExt; |
391 if(pArray->u.array.rf_rebuilding == HPT_NULL_ID) | 414 if(pArray->u.array.rf_rebuilding == 0) |
392 { 393 DWORD timeout = 0; 394 oldspl = lock_driver(); 395 pArray->u.array.rf_auto_rebuild = 0; 396 pArray->u.array.rf_abort_rebuild = 0; 397 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pArray, DUPLICATE); 398 unlock_driver(oldspl); 399 while (!pArray->u.array.rf_rebuilding) --- 12 unchanged lines hidden (view full) --- 412 } 413 } 414 415 if (lpBytesReturned) 416 *lpBytesReturned = nOutBufferSize; 417 return 0; 418} 419 | 415 { 416 DWORD timeout = 0; 417 oldspl = lock_driver(); 418 pArray->u.array.rf_auto_rebuild = 0; 419 pArray->u.array.rf_abort_rebuild = 0; 420 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pArray, DUPLICATE); 421 unlock_driver(oldspl); 422 while (!pArray->u.array.rf_rebuilding) --- 12 unchanged lines hidden (view full) --- 435 } 436 } 437 438 if (lpBytesReturned) 439 *lpBytesReturned = nOutBufferSize; 440 return 0; 441} 442 |
420static int hpt_get_event(PHPT_EVENT pEvent) | 443static int 444hpt_get_event(PHPT_EVENT pEvent) |
421{ 422 intrmask_t oldspl = lock_driver(); 423 int ret = event_queue_remove(pEvent); 424 unlock_driver(oldspl); 425 return ret; 426} 427 | 445{ 446 intrmask_t oldspl = lock_driver(); 447 int ret = event_queue_remove(pEvent); 448 unlock_driver(oldspl); 449 return ret; 450} 451 |
428static int hpt_set_array_state(DEVICEID idArray, DWORD state) | 452static int 453hpt_set_array_state(DEVICEID idArray, DWORD state) |
429{ 430 IAL_ADAPTER_T *pAdapter; 431 PVDevice pVDevice = ID_TO_VDEV(idArray); 432 int i; 433 DWORD timeout = 0; 434 intrmask_t oldspl; 435 | 454{ 455 IAL_ADAPTER_T *pAdapter; 456 PVDevice pVDevice = ID_TO_VDEV(idArray); 457 int i; 458 DWORD timeout = 0; 459 intrmask_t oldspl; 460 |
436 if(idArray == HPT_NULL_ID || check_VDevice_valid(pVDevice)) 437 return -1; | 461 if(idArray == 0 || check_VDevice_valid(pVDevice)) return -1; |
438 if(!mIsArray(pVDevice)) 439 return -1; 440 if(!pVDevice->vf_online || pVDevice->u.array.rf_broken) return -1; 441 442 pAdapter=(IAL_ADAPTER_T *)pVDevice->pVBus->OsExt; 443 444 switch(state) 445 { --- 23 unchanged lines hidden (view full) --- 469 } 470 } 471 472 break; 473 474 case MIRROR_REBUILD_ABORT: 475 { 476 for(i = 0; i < pVDevice->u.array.bArnMember; i++) { | 462 if(!mIsArray(pVDevice)) 463 return -1; 464 if(!pVDevice->vf_online || pVDevice->u.array.rf_broken) return -1; 465 466 pAdapter=(IAL_ADAPTER_T *)pVDevice->pVBus->OsExt; 467 468 switch(state) 469 { --- 23 unchanged lines hidden (view full) --- 493 } 494 } 495 496 break; 497 498 case MIRROR_REBUILD_ABORT: 499 { 500 for(i = 0; i < pVDevice->u.array.bArnMember; i++) { |
477 if(pVDevice->u.array.pMember[i] != NULL && pVDevice->u.array.pMember[i]->VDeviceType == VD_RAID_1) | 501 if(pVDevice->u.array.pMember[i] != 0 && pVDevice->u.array.pMember[i]->VDeviceType == VD_RAID_1) |
478 hpt_set_array_state(VDEV_TO_ID(pVDevice->u.array.pMember[i]), state); 479 } 480 481 if(pVDevice->u.array.rf_rebuilding != 1) 482 return -1; 483 484 oldspl = lock_driver(); 485 pVDevice->u.array.rf_abort_rebuild = 1; --- 94 unchanged lines hidden (view full) --- 580 581 default: 582 return -1; 583 } 584 585 return 0; 586} 587 | 502 hpt_set_array_state(VDEV_TO_ID(pVDevice->u.array.pMember[i]), state); 503 } 504 505 if(pVDevice->u.array.rf_rebuilding != 1) 506 return -1; 507 508 oldspl = lock_driver(); 509 pVDevice->u.array.rf_abort_rebuild = 1; --- 94 unchanged lines hidden (view full) --- 604 605 default: 606 return -1; 607 } 608 609 return 0; 610} 611 |
588static int HPTLIBAPI R1ControlSgl(_VBUS_ARG PCommand pCmd, FPSCAT_GATH pSgTable, int logical) | 612int HPTLIBAPI 613R1ControlSgl(_VBUS_ARG PCommand pCmd, FPSCAT_GATH pSgTable, int logical) |
589{ 590 ULONG bufferSize = SECTOR_TO_BYTE(pCmd->uCmd.R1Control.nSectors); 591 if (pCmd->uCmd.R1Control.Command==CTRL_CMD_VERIFY) 592 bufferSize<<=1; 593 if (logical) { 594 pSgTable->dSgAddress = (ULONG_PTR)pCmd->uCmd.R1Control.Buffer; 595 pSgTable->wSgSize = (USHORT)bufferSize; 596 pSgTable->wSgFlag = SG_FLAG_EOT; --- 46 unchanged lines hidden (view full) --- 643 idx++; 644 645 }while (bufferSize); 646 } 647 return 1; 648} 649 650static int End_Job=0; | 614{ 615 ULONG bufferSize = SECTOR_TO_BYTE(pCmd->uCmd.R1Control.nSectors); 616 if (pCmd->uCmd.R1Control.Command==CTRL_CMD_VERIFY) 617 bufferSize<<=1; 618 if (logical) { 619 pSgTable->dSgAddress = (ULONG_PTR)pCmd->uCmd.R1Control.Buffer; 620 pSgTable->wSgSize = (USHORT)bufferSize; 621 pSgTable->wSgFlag = SG_FLAG_EOT; --- 46 unchanged lines hidden (view full) --- 668 idx++; 669 670 }while (bufferSize); 671 } 672 return 1; 673} 674 675static int End_Job=0; |
651static void HPTLIBAPI thread_io_done(_VBUS_ARG PCommand pCmd) | 676void HPTLIBAPI 677thread_io_done(_VBUS_ARG PCommand pCmd) |
652{ 653 End_Job = 1; 654 wakeup((caddr_t)pCmd); 655} 656 | 678{ 679 End_Job = 1; 680 wakeup((caddr_t)pCmd); 681} 682 |
657void hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flags) | 683void 684hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flags) |
658{ 659 DWORD timeout = 0; 660 ULONG capacity = pArray->VDeviceCapacity / (pArray->u.array.bArnMember-1); 661 PCommand pCmd; 662 UINT result; 663 int needsync=0, retry=0, needdelete=0; 664 void *buffer = 0; 665 intrmask_t oldspl; --- 43 unchanged lines hidden (view full) --- 709 pCmd->cf_control = 1; 710 End_Job = 0; 711 712 if (pArray->VDeviceType==VD_RAID_1) 713 { 714 #define MAX_REBUILD_SECTORS 0x40 715 716 /* take care for discontinuous buffer in R1ControlSgl */ | 685{ 686 DWORD timeout = 0; 687 ULONG capacity = pArray->VDeviceCapacity / (pArray->u.array.bArnMember-1); 688 PCommand pCmd; 689 UINT result; 690 int needsync=0, retry=0, needdelete=0; 691 void *buffer = 0; 692 intrmask_t oldspl; --- 43 unchanged lines hidden (view full) --- 736 pCmd->cf_control = 1; 737 End_Job = 0; 738 739 if (pArray->VDeviceType==VD_RAID_1) 740 { 741 #define MAX_REBUILD_SECTORS 0x40 742 743 /* take care for discontinuous buffer in R1ControlSgl */ |
744 unlock_driver(oldspl); |
|
717 buffer = malloc(SECTOR_TO_BYTE(MAX_REBUILD_SECTORS), M_DEVBUF, M_NOWAIT); | 745 buffer = malloc(SECTOR_TO_BYTE(MAX_REBUILD_SECTORS), M_DEVBUF, M_NOWAIT); |
746 oldspl = lock_driver(); |
|
718 if(!buffer) { 719 FreeCommand(_VBUS_P pCmd); 720 hpt_printk(("can't allocate rebuild buffer\n")); 721 goto fail; 722 } 723 switch(flags) 724 { 725 case DUPLICATE: --- 52 unchanged lines hidden (view full) --- 778 if (!End_Job) { 779 hpt_printk(("timeout, reset\n")); 780 fResetVBus(_VBUS_P0); 781 } 782 } 783 784 result = pCmd->Result; 785 FreeCommand(_VBUS_P pCmd); | 747 if(!buffer) { 748 FreeCommand(_VBUS_P pCmd); 749 hpt_printk(("can't allocate rebuild buffer\n")); 750 goto fail; 751 } 752 switch(flags) 753 { 754 case DUPLICATE: --- 52 unchanged lines hidden (view full) --- 807 if (!End_Job) { 808 hpt_printk(("timeout, reset\n")); 809 fResetVBus(_VBUS_P0); 810 } 811 } 812 813 result = pCmd->Result; 814 FreeCommand(_VBUS_P pCmd); |
786 if (buffer) { 787 free(buffer, M_DEVBUF); 788 /* beware of goto retry_cmd below */ 789 buffer = NULL; 790 } | 815 unlock_driver(oldspl); 816 if (buffer) free(buffer, M_DEVBUF); 817 oldspl = lock_driver(); |
791 KdPrintI(("cmd finished %d", result)); 792 793 switch(result) 794 { 795 case RETURN_SUCCESS: 796 if (!pArray->u.array.rf_abort_rebuild) 797 { 798 if(pArray->u.array.RebuildSectors < capacity) --- 114 unchanged lines hidden (view full) --- 913 } 914 915 while (pAdapter->outstandingCommands) 916 { 917 KdPrintI(("currcmds is %d, wait..\n", pAdapter->outstandingCommands)); 918 /* put this to have driver stop processing system commands quickly */ 919 if (!mWaitingForIdle(_VBUS_P0)) CallWhenIdle(_VBUS_P nothing, 0); 920 unlock_driver(oldspl); | 818 KdPrintI(("cmd finished %d", result)); 819 820 switch(result) 821 { 822 case RETURN_SUCCESS: 823 if (!pArray->u.array.rf_abort_rebuild) 824 { 825 if(pArray->u.array.RebuildSectors < capacity) --- 114 unchanged lines hidden (view full) --- 940 } 941 942 while (pAdapter->outstandingCommands) 943 { 944 KdPrintI(("currcmds is %d, wait..\n", pAdapter->outstandingCommands)); 945 /* put this to have driver stop processing system commands quickly */ 946 if (!mWaitingForIdle(_VBUS_P0)) CallWhenIdle(_VBUS_P nothing, 0); 947 unlock_driver(oldspl); |
948 /*Schedule out*/ 949#if (__FreeBSD_version < 500000) 950 YIELD_THREAD; 951#else 952 tsleep(hpt_rebuild_data_block, PPAUSE, "switch", 1); 953#endif |
|
921 oldspl = lock_driver(); 922 } 923 924 if (needsync) SyncArrayInfo(pArray); 925 if(needdelete && (pArray->u.array.rf_duplicate_must_done || (flags == INITIALIZE))) 926 fDeleteArray(_VBUS_P pArray, TRUE); 927 928 Check_Idle_Call(pAdapter); 929 unlock_driver(oldspl); 930} | 954 oldspl = lock_driver(); 955 } 956 957 if (needsync) SyncArrayInfo(pArray); 958 if(needdelete && (pArray->u.array.rf_duplicate_must_done || (flags == INITIALIZE))) 959 fDeleteArray(_VBUS_P pArray, TRUE); 960 961 Check_Idle_Call(pAdapter); 962 unlock_driver(oldspl); 963} |