scsi_pt.c (112260) | scsi_pt.c (112946) |
---|---|
1/* 2 * Implementation of SCSI Processor Target Peripheral driver for CAM. 3 * 4 * Copyright (c) 1998 Justin T. Gibbs. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/* 2 * Implementation of SCSI Processor Target Peripheral driver for CAM. 3 * 4 * Copyright (c) 1998 Justin T. Gibbs. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/cam/scsi/scsi_pt.c 112260 2003-03-15 10:50:44Z phk $ | 28 * $FreeBSD: head/sys/cam/scsi/scsi_pt.c 112946 2003-04-01 15:06:26Z phk $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/queue.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/types.h> 36#include <sys/bio.h> --- 311 unchanged lines hidden (view full) --- 348 return(CAM_REQ_CMP); 349} 350 351static void 352ptoninvalidate(struct cam_periph *periph) 353{ 354 int s; 355 struct pt_softc *softc; | 29 */ 30 31#include <sys/param.h> 32#include <sys/queue.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/types.h> 36#include <sys/bio.h> --- 311 unchanged lines hidden (view full) --- 348 return(CAM_REQ_CMP); 349} 350 351static void 352ptoninvalidate(struct cam_periph *periph) 353{ 354 int s; 355 struct pt_softc *softc; |
356 struct bio *q_bp; | |
357 struct ccb_setasync csa; 358 359 softc = (struct pt_softc *)periph->softc; 360 361 /* 362 * De-register any async callbacks. 363 */ 364 xpt_setup_ccb(&csa.ccb_h, periph->path, --- 13 unchanged lines hidden (view full) --- 378 */ 379 s = splbio(); 380 381 /* 382 * Return all queued I/O with ENXIO. 383 * XXX Handle any transactions queued to the card 384 * with XPT_ABORT_CCB. 385 */ | 356 struct ccb_setasync csa; 357 358 softc = (struct pt_softc *)periph->softc; 359 360 /* 361 * De-register any async callbacks. 362 */ 363 xpt_setup_ccb(&csa.ccb_h, periph->path, --- 13 unchanged lines hidden (view full) --- 377 */ 378 s = splbio(); 379 380 /* 381 * Return all queued I/O with ENXIO. 382 * XXX Handle any transactions queued to the card 383 * with XPT_ABORT_CCB. 384 */ |
386 while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ 387 bioq_remove(&softc->bio_queue, q_bp); 388 q_bp->bio_resid = q_bp->bio_bcount; 389 biofinish(q_bp, NULL, ENXIO); 390 } | 385 bioq_flush(&softc->bio_queue, NULL, ENXIO); |
391 392 splx(s); 393 394 xpt_print_path(periph->path); 395 printf("lost device\n"); 396} 397 398static void --- 170 unchanged lines hidden (view full) --- 569 if (error == ERESTART) { 570 /* 571 * A retry was scheuled, so 572 * just return. 573 */ 574 return; 575 } 576 if (error != 0) { | 386 387 splx(s); 388 389 xpt_print_path(periph->path); 390 printf("lost device\n"); 391} 392 393static void --- 170 unchanged lines hidden (view full) --- 564 if (error == ERESTART) { 565 /* 566 * A retry was scheuled, so 567 * just return. 568 */ 569 return; 570 } 571 if (error != 0) { |
577 struct bio *q_bp; 578 | |
579 s = splbio(); 580 581 if (error == ENXIO) { 582 /* 583 * Catastrophic error. Mark our device 584 * as invalid. 585 */ 586 xpt_print_path(periph->path); 587 printf("Invalidating device\n"); 588 softc->flags |= PT_FLAG_DEVICE_INVALID; 589 } 590 591 /* 592 * return all queued I/O with EIO, so that 593 * the client can retry these I/Os in the 594 * proper order should it attempt to recover. 595 */ | 572 s = splbio(); 573 574 if (error == ENXIO) { 575 /* 576 * Catastrophic error. Mark our device 577 * as invalid. 578 */ 579 xpt_print_path(periph->path); 580 printf("Invalidating device\n"); 581 softc->flags |= PT_FLAG_DEVICE_INVALID; 582 } 583 584 /* 585 * return all queued I/O with EIO, so that 586 * the client can retry these I/Os in the 587 * proper order should it attempt to recover. 588 */ |
596 while ((q_bp = bioq_first(&softc->bio_queue)) 597 != NULL) { 598 bioq_remove(&softc->bio_queue, q_bp); 599 q_bp->bio_resid = q_bp->bio_bcount; 600 biofinish(q_bp, NULL, EIO); 601 } | 589 bioq_flush(&softc->bio_queue, NULL, EIO); |
602 splx(s); 603 bp->bio_error = error; 604 bp->bio_resid = bp->bio_bcount; 605 bp->bio_flags |= BIO_ERROR; 606 } else { 607 bp->bio_resid = csio->resid; 608 bp->bio_error = 0; 609 if (bp->bio_resid != 0) { --- 123 unchanged lines hidden --- | 590 splx(s); 591 bp->bio_error = error; 592 bp->bio_resid = bp->bio_bcount; 593 bp->bio_flags |= BIO_ERROR; 594 } else { 595 bp->bio_resid = csio->resid; 596 bp->bio_error = 0; 597 if (bp->bio_resid != 0) { --- 123 unchanged lines hidden --- |