Deleted Added
full compact
ioctl.c (149871) ioctl.c (167086)
1/*
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 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 *
1/*
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 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 149871 2005-09-07 23:33:26Z scottl $
26 * $FreeBSD: head/sys/dev/hptmv/ioctl.c 167086 2007-02-27 17:23:29Z jhb $
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>

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

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
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>

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

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);
209 pause("switch", 1);
210#endif
211 oldspl = lock_driver();
212 }
213 CheckIdleCall(_VBUS_P0);
214 return oldspl;
215}
216
217int Kernel_DeviceIoControl(_VBUS_ARG

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

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)
423 {
210#endif
211 oldspl = lock_driver();
212 }
213 CheckIdleCall(_VBUS_P0);
214 return oldspl;
215}
216
217int Kernel_DeviceIoControl(_VBUS_ARG

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

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)
423 {
424 tsleep((caddr_t)Kernel_DeviceIoControl, PPAUSE, "pause", 1);
424 pause("pause", 1);
425 if ( timeout >= hz*3)
426 break;
427 timeout ++;
428 }
429 }
430 break;
431 }
432 }

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

481
482 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pVDevice,
483 (UCHAR)((pVDevice->u.array.CriticalMembers || pVDevice->VDeviceType == VD_RAID_1)? DUPLICATE : REBUILD_PARITY));
484
485 unlock_driver(oldspl);
486
487 while (!pVDevice->u.array.rf_rebuilding)
488 {
425 if ( timeout >= hz*3)
426 break;
427 timeout ++;
428 }
429 }
430 break;
431 }
432 }

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

481
482 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pVDevice,
483 (UCHAR)((pVDevice->u.array.CriticalMembers || pVDevice->VDeviceType == VD_RAID_1)? DUPLICATE : REBUILD_PARITY));
484
485 unlock_driver(oldspl);
486
487 while (!pVDevice->u.array.rf_rebuilding)
488 {
489 tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
489 pause("pause", 1);
490 if ( timeout >= hz*20)
491 break;
492 timeout ++;
493 }
494 }
495
496 break;
497

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

506 return -1;
507
508 oldspl = lock_driver();
509 pVDevice->u.array.rf_abort_rebuild = 1;
510 unlock_driver(oldspl);
511
512 while (pVDevice->u.array.rf_abort_rebuild)
513 {
490 if ( timeout >= hz*20)
491 break;
492 timeout ++;
493 }
494 }
495
496 break;
497

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

506 return -1;
507
508 oldspl = lock_driver();
509 pVDevice->u.array.rf_abort_rebuild = 1;
510 unlock_driver(oldspl);
511
512 while (pVDevice->u.array.rf_abort_rebuild)
513 {
514 tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
514 pause("pause", 1);
515 if ( timeout >= hz*20)
516 break;
517 timeout ++;
518 }
519 }
520 break;
521
522 case AS_VERIFY_START:

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

530
531 oldspl = lock_driver();
532 pVDevice->u.array.RebuildSectors = 0;
533 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pVDevice, VERIFY);
534 unlock_driver(oldspl);
535
536 while (!pVDevice->u.array.rf_verifying)
537 {
515 if ( timeout >= hz*20)
516 break;
517 timeout ++;
518 }
519 }
520 break;
521
522 case AS_VERIFY_START:

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

530
531 oldspl = lock_driver();
532 pVDevice->u.array.RebuildSectors = 0;
533 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pVDevice, VERIFY);
534 unlock_driver(oldspl);
535
536 while (!pVDevice->u.array.rf_verifying)
537 {
538 tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
538 pause("pause", 1);
539 if ( timeout >= hz*20)
540 break;
541 timeout ++;
542 }
543 }
544 break;
545
546 case AS_VERIFY_ABORT:
547 {
548 if(pVDevice->u.array.rf_verifying != 1)
549 return -1;
550
551 oldspl = lock_driver();
552 pVDevice->u.array.rf_abort_rebuild = 1;
553 unlock_driver(oldspl);
554
555 while (pVDevice->u.array.rf_abort_rebuild)
556 {
539 if ( timeout >= hz*20)
540 break;
541 timeout ++;
542 }
543 }
544 break;
545
546 case AS_VERIFY_ABORT:
547 {
548 if(pVDevice->u.array.rf_verifying != 1)
549 return -1;
550
551 oldspl = lock_driver();
552 pVDevice->u.array.rf_abort_rebuild = 1;
553 unlock_driver(oldspl);
554
555 while (pVDevice->u.array.rf_abort_rebuild)
556 {
557 tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
557 pause("pause", 1);
558 if ( timeout >= hz*80)
559 break;
560 timeout ++;
561 }
562 }
563 break;
564
565 case AS_INITIALIZE_START:

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

570 return -1;
571
572 oldspl = lock_driver();
573 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pVDevice, VERIFY);
574 unlock_driver(oldspl);
575
576 while (!pVDevice->u.array.rf_initializing)
577 {
558 if ( timeout >= hz*80)
559 break;
560 timeout ++;
561 }
562 }
563 break;
564
565 case AS_INITIALIZE_START:

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

570 return -1;
571
572 oldspl = lock_driver();
573 hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pVDevice, VERIFY);
574 unlock_driver(oldspl);
575
576 while (!pVDevice->u.array.rf_initializing)
577 {
578 tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
578 pause("pause", 1);
579 if ( timeout >= hz*80)
580 break;
581 timeout ++;
582 }
583 }
584 break;
585
586 case AS_INITIALIZE_ABORT:
587 {
588 if(pVDevice->u.array.rf_initializing != 1)
589 return -1;
590
591 oldspl = lock_driver();
592 pVDevice->u.array.rf_abort_rebuild = 1;
593 unlock_driver(oldspl);
594
595 while (pVDevice->u.array.rf_abort_rebuild)
596 {
579 if ( timeout >= hz*80)
580 break;
581 timeout ++;
582 }
583 }
584 break;
585
586 case AS_INITIALIZE_ABORT:
587 {
588 if(pVDevice->u.array.rf_initializing != 1)
589 return -1;
590
591 oldspl = lock_driver();
592 pVDevice->u.array.rf_abort_rebuild = 1;
593 unlock_driver(oldspl);
594
595 while (pVDevice->u.array.rf_abort_rebuild)
596 {
597 tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
597 pause("pause", 1);
598 if ( timeout >= hz*80)
599 break;
600 timeout ++;
601 }
602 }
603 break;
604
605 default:

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

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
598 if ( timeout >= hz*80)
599 break;
600 timeout ++;
601 }
602 }
603 break;
604
605 default:

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

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);
952 pause("switch", 1);
953#endif
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}
953#endif
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}