mcd.c (15116) | mcd.c (15574) |
---|---|
1/* 2 * Copyright 1993 by Holger Veit (data part) 3 * Copyright 1993 by Brian Moore (audio part) 4 * Changes Copyright 1993 by Gary Clark II 5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia 6 * 7 * Rewrote probe routine to work on newer Mitsumi drives. 8 * Additional changes (C) 1994 by Jordan K. Hubbard --- 26 unchanged lines hidden (view full) --- 35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 * | 1/* 2 * Copyright 1993 by Holger Veit (data part) 3 * Copyright 1993 by Brian Moore (audio part) 4 * Changes Copyright 1993 by Gary Clark II 5 * Changes Copyright (C) 1994-1995 by Andrey A. Chernov, Moscow, Russia 6 * 7 * Rewrote probe routine to work on newer Mitsumi drives. 8 * Additional changes (C) 1994 by Jordan K. Hubbard --- 26 unchanged lines hidden (view full) --- 35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 36 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 37 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 38 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 * |
43 * $Id: mcd.c,v 1.75 1996/03/28 14:28:45 scrappy Exp $ | 43 * $Id: mcd.c,v 1.76 1996/04/07 17:32:14 bde Exp $ |
44 */ 45static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; 46 47#include "mcd.h" 48#if NMCD > 0 49#include <sys/types.h> 50#include <sys/param.h> 51#include <sys/systm.h> --- 9 unchanged lines hidden (view full) --- 61#include <sys/dkbad.h> 62#include <sys/disklabel.h> 63#include <sys/devconf.h> 64#include <sys/kernel.h> 65#ifdef DEVFS 66#include <sys/devfsext.h> 67#endif /*DEVFS*/ 68 | 44 */ 45static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; 46 47#include "mcd.h" 48#if NMCD > 0 49#include <sys/types.h> 50#include <sys/param.h> 51#include <sys/systm.h> --- 9 unchanged lines hidden (view full) --- 61#include <sys/dkbad.h> 62#include <sys/disklabel.h> 63#include <sys/devconf.h> 64#include <sys/kernel.h> 65#ifdef DEVFS 66#include <sys/devfsext.h> 67#endif /*DEVFS*/ 68 |
69#include <machine/spl.h> |
|
69#include <machine/clock.h> 70 71#include <i386/i386/cons.h> 72 73#include <i386/isa/isa.h> 74#include <i386/isa/isa_device.h> 75#include <i386/isa/mcdreg.h> 76 --- 75 unchanged lines hidden (view full) --- 152 int partflags[MAXPARTITIONS]; 153 int openflags; 154 struct mcd_volinfo volinfo; 155 struct mcd_qchninfo toc[MCD_MAXTOCS]; 156 short audio_status; 157 short curr_mode; 158 struct mcd_read2 lastpb; 159 short debug; | 70#include <machine/clock.h> 71 72#include <i386/i386/cons.h> 73 74#include <i386/isa/isa.h> 75#include <i386/isa/isa_device.h> 76#include <i386/isa/mcdreg.h> 77 --- 75 unchanged lines hidden (view full) --- 153 int partflags[MAXPARTITIONS]; 154 int openflags; 155 struct mcd_volinfo volinfo; 156 struct mcd_qchninfo toc[MCD_MAXTOCS]; 157 short audio_status; 158 short curr_mode; 159 struct mcd_read2 lastpb; 160 short debug; |
160 struct buf head; /* head of buf queue */ | 161 struct buf_queue_head head; /* head of buf queue */ |
161 struct mcd_mbx mbx; 162#ifdef DEVFS 163 void *ra_devfs_token; /* store the devfs handle here */ 164 void *rc_devfs_token; /* store the devfs handle here */ 165 void *a_devfs_token; /* store the devfs handle here */ 166 void *c_devfs_token; /* store the devfs handle here */ 167#endif 168} mcd_data[NMCD]; --- 253 unchanged lines hidden (view full) --- 422 423 return 0; 424} 425 426void 427mcdstrategy(struct buf *bp) 428{ 429 struct mcd_data *cd; | 162 struct mcd_mbx mbx; 163#ifdef DEVFS 164 void *ra_devfs_token; /* store the devfs handle here */ 165 void *rc_devfs_token; /* store the devfs handle here */ 166 void *a_devfs_token; /* store the devfs handle here */ 167 void *c_devfs_token; /* store the devfs handle here */ 168#endif 169} mcd_data[NMCD]; --- 253 unchanged lines hidden (view full) --- 423 424 return 0; 425} 426 427void 428mcdstrategy(struct buf *bp) 429{ 430 struct mcd_data *cd; |
430 struct buf *qp; | |
431 int s; 432 433 int unit = mcd_unit(bp->b_dev); 434 435 cd = mcd_data + unit; 436 437 /* test validity */ 438/*MCD_TRACE("strategy: buf=0x%lx, unit=%ld, block#=%ld bcount=%ld\n", --- 35 unchanged lines hidden (view full) --- 474 goto done; 475 } 476 } else { 477 bp->b_pblkno = bp->b_blkno; 478 bp->b_resid = 0; 479 } 480 481 /* queue it */ | 431 int s; 432 433 int unit = mcd_unit(bp->b_dev); 434 435 cd = mcd_data + unit; 436 437 /* test validity */ 438/*MCD_TRACE("strategy: buf=0x%lx, unit=%ld, block#=%ld bcount=%ld\n", --- 35 unchanged lines hidden (view full) --- 474 goto done; 475 } 476 } else { 477 bp->b_pblkno = bp->b_blkno; 478 bp->b_resid = 0; 479 } 480 481 /* queue it */ |
482 qp = &cd->head; | |
483 s = splbio(); | 482 s = splbio(); |
484 disksort(qp,bp); | 483 tqdisksort(&cd->head, bp); |
485 splx(s); 486 487 /* now check whether we can perform processing */ 488 mcd_start(unit); 489 return; 490 491bad: 492 bp->b_flags |= B_ERROR; 493done: 494 bp->b_resid = bp->b_bcount; 495 biodone(bp); 496 return; 497} 498 499static void mcd_start(int unit) 500{ 501 struct mcd_data *cd = mcd_data + unit; | 484 splx(s); 485 486 /* now check whether we can perform processing */ 487 mcd_start(unit); 488 return; 489 490bad: 491 bp->b_flags |= B_ERROR; 492done: 493 bp->b_resid = bp->b_bcount; 494 biodone(bp); 495 return; 496} 497 498static void mcd_start(int unit) 499{ 500 struct mcd_data *cd = mcd_data + unit; |
502 struct buf *bp, *qp = &cd->head; | |
503 struct partition *p; | 501 struct partition *p; |
502 struct buf *bp; |
|
504 register s = splbio(); 505 506 if (cd->flags & MCDMBXBSY) { 507 splx(s); 508 return; 509 } 510 | 503 register s = splbio(); 504 505 if (cd->flags & MCDMBXBSY) { 506 splx(s); 507 return; 508 } 509 |
511 if ((bp = qp->b_actf) != 0) { | 510 bp = TAILQ_FIRST(&cd->head); 511 if (bp != 0) { |
512 /* block found to process, dequeue */ 513 /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ | 512 /* block found to process, dequeue */ 513 /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ |
514 qp->b_actf = bp->b_actf; /* changed from: bp->av_forw <se> */ | 514 TAILQ_REMOVE(&cd->head, bp, b_act); |
515 splx(s); 516 } else { 517 /* nothing to do */ 518 splx(s); 519 return; 520 } 521 522 /* changed media? */ --- 1310 unchanged lines hidden --- | 515 splx(s); 516 } else { 517 /* nothing to do */ 518 splx(s); 519 return; 520 } 521 522 /* changed media? */ --- 1310 unchanged lines hidden --- |