Deleted Added
full compact
mcd.c (4398) mcd.c (4480)
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 by Andrew A. Chernov
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 by Andrew A. Chernov
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.29 1994/11/12 14:19:11 ache Exp $
43 * $Id: mcd.c,v 1.30 1994/11/12 18:18:20 ache 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>

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

97#define MCDSOPEN 0x00a0
98
99#define MCD_MD_UNKNOWN (-1)
100
101/* toc */
102#define MCD_MAXTOCS 104 /* from the Linux driver */
103#define MCD_LASTPLUS1 170 /* special toc entry */
104
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>

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

97#define MCDSOPEN 0x00a0
98
99#define MCD_MD_UNKNOWN (-1)
100
101/* toc */
102#define MCD_MAXTOCS 104 /* from the Linux driver */
103#define MCD_LASTPLUS1 170 /* special toc entry */
104
105#define MCD_TYPE_UNKNOWN 0
106#define MCD_TYPE_LU002S 1
107#define MCD_TYPE_LU005S 2
108#define MCD_TYPE_FX001 3
109#define MCD_TYPE_FX001D 4
110
105struct mcd_mbx {
106 short unit;
107 short port;
108 short retry;
109 short nblk;
110 int sz;
111 u_long skip;
112 struct buf *bp;
113 int p_offset;
114 short count;
115 short mode;
116};
117
118struct mcd_data {
111struct mcd_mbx {
112 short unit;
113 short port;
114 short retry;
115 short nblk;
116 int sz;
117 u_long skip;
118 struct buf *bp;
119 int p_offset;
120 short count;
121 short mode;
122};
123
124struct mcd_data {
125 short type;
126 char *name;
119 short config;
120 short flags;
121 short status;
122 int blksize;
123 u_long disksize;
124 int iobase;
125 struct disklabel dlabel;
126 int partflags[MAXPARTITIONS];

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

199
200static struct kern_devconf kdc_mcd[NMCD] = { {
201 0, 0, 0, /* filled in by dev_attach */
202 "mcd", 0, { MDDT_ISA, 0, "bio" },
203 isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
204 &kdc_isa0, /* parent */
205 0, /* parentdata */
206 DC_IDLE, /* status */
127 short config;
128 short flags;
129 short status;
130 int blksize;
131 u_long disksize;
132 int iobase;
133 struct disklabel dlabel;
134 int partflags[MAXPARTITIONS];

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

207
208static struct kern_devconf kdc_mcd[NMCD] = { {
209 0, 0, 0, /* filled in by dev_attach */
210 "mcd", 0, { MDDT_ISA, 0, "bio" },
211 isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
212 &kdc_isa0, /* parent */
213 0, /* parentdata */
214 DC_IDLE, /* status */
207 "Mitsumi CD-ROM controller"
215 "Mitsumi CD-ROM controller" /* properly filled later */
208} };
209
210static inline void
211mcd_registerdev(struct isa_device *id)
212{
213 if(id->id_unit)
214 kdc_mcd[id->id_unit] = kdc_mcd[0];
215 kdc_mcd[id->id_unit].kdc_unit = id->id_unit;

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

227 cd->flags |= MCDINIT;
228 mcd_soft_reset(dev->id_unit);
229
230#ifdef NOTYET
231 /* wire controller for interrupts and dma */
232 mcd_configure(cd);
233#endif
234 mcd_registerdev(dev);
216} };
217
218static inline void
219mcd_registerdev(struct isa_device *id)
220{
221 if(id->id_unit)
222 kdc_mcd[id->id_unit] = kdc_mcd[0];
223 kdc_mcd[id->id_unit].kdc_unit = id->id_unit;

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

235 cd->flags |= MCDINIT;
236 mcd_soft_reset(dev->id_unit);
237
238#ifdef NOTYET
239 /* wire controller for interrupts and dma */
240 mcd_configure(cd);
241#endif
242 mcd_registerdev(dev);
243 /* name filled in probe */
244 kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name;
235
236 return 1;
237}
238
239int mcdopen(dev_t dev)
240{
241 int unit,part,phys;
242 struct mcd_data *cd;

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

538static int mcd_getdisklabel(int unit)
539{
540 struct mcd_data *cd = mcd_data + unit;
541
542 if (cd->flags & MCDLABEL)
543 return -1;
544
545 bzero(&cd->dlabel,sizeof(struct disklabel));
245
246 return 1;
247}
248
249int mcdopen(dev_t dev)
250{
251 int unit,part,phys;
252 struct mcd_data *cd;

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

548static int mcd_getdisklabel(int unit)
549{
550 struct mcd_data *cd = mcd_data + unit;
551
552 if (cd->flags & MCDLABEL)
553 return -1;
554
555 bzero(&cd->dlabel,sizeof(struct disklabel));
546 strncpy(cd->dlabel.d_typename,"Mitsumi CD ROM ",16);
547 strncpy(cd->dlabel.d_packname,"unknown ",16);
556 /* filled with spaces first */
557 strncpy(cd->dlabel.d_typename," ",
558 sizeof(cd->dlabel.d_typename));
559 strncpy(cd->dlabel.d_typename, cd->name,
560 min(strlen(cd->name), sizeof(cd->dlabel.d_typename) - 1));
561 strncpy(cd->dlabel.d_packname,"unknown ",
562 sizeof(cd->dlabel.d_packname));
548 cd->dlabel.d_secsize = cd->blksize;
549 cd->dlabel.d_nsectors = 100;
550 cd->dlabel.d_ntracks = 1;
551 cd->dlabel.d_ncylinders = (cd->disksize/100)+1;
552 cd->dlabel.d_secpercyl = 100;
553 cd->dlabel.d_secperunit = cd->disksize;
554 cd->dlabel.d_rpm = 300;
555 cd->dlabel.d_interleave = 1;

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

624int
625mcd_probe(struct isa_device *dev)
626{
627 int port = dev->id_iobase;
628 int unit = dev->id_unit;
629 int i, j;
630 int status;
631 unsigned char stbytes[3];
563 cd->dlabel.d_secsize = cd->blksize;
564 cd->dlabel.d_nsectors = 100;
565 cd->dlabel.d_ntracks = 1;
566 cd->dlabel.d_ncylinders = (cd->disksize/100)+1;
567 cd->dlabel.d_secpercyl = 100;
568 cd->dlabel.d_secperunit = cd->disksize;
569 cd->dlabel.d_rpm = 300;
570 cd->dlabel.d_interleave = 1;

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

639int
640mcd_probe(struct isa_device *dev)
641{
642 int port = dev->id_iobase;
643 int unit = dev->id_unit;
644 int i, j;
645 int status;
646 unsigned char stbytes[3];
647 char *s;
632
633 mcd_data[unit].flags = MCDPROBING;
634
635#ifdef NOTDEF
636 /* get irq/drq configuration word */
637 mcd_data[unit].config = irqs[dev->id_irq]; /* | drqs[dev->id_drq];*/
638#else
639 mcd_data[unit].config = 0;

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

666 }
667 printf("mcd%d: version information is %x %c %x\n", unit,
668 stbytes[0], stbytes[1], stbytes[2]);
669 if (stbytes[1] >= 4) {
670 outb(port+MCD_CTRL, M_PICKLE);
671 mcd_data[unit].flags |= MCDNEWMODEL;
672 printf("mcd%d: Adjusted for newer drive model\n", unit);
673 }
648
649 mcd_data[unit].flags = MCDPROBING;
650
651#ifdef NOTDEF
652 /* get irq/drq configuration word */
653 mcd_data[unit].config = irqs[dev->id_irq]; /* | drqs[dev->id_drq];*/
654#else
655 mcd_data[unit].config = 0;

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

682 }
683 printf("mcd%d: version information is %x %c %x\n", unit,
684 stbytes[0], stbytes[1], stbytes[2]);
685 if (stbytes[1] >= 4) {
686 outb(port+MCD_CTRL, M_PICKLE);
687 mcd_data[unit].flags |= MCDNEWMODEL;
688 printf("mcd%d: Adjusted for newer drive model\n", unit);
689 }
690 switch (stbytes[1]) {
691 case 'M':
692 if (mcd_data[unit].flags & MCDNEWMODEL) {
693 mcd_data[unit].type = MCD_TYPE_LU005S;
694 mcd_data[unit].name = "Mitsumi LU005S";
695 } else {
696 mcd_data[unit].type = MCD_TYPE_LU002S;
697 mcd_data[unit].name = "Mitsumi LU002S";
698 }
699 break;
700 case 'F':
701 mcd_data[unit].type = MCD_TYPE_FX001;
702 mcd_data[unit].name = "Mitsumi FX001";
703 break;
704 case 'D':
705 mcd_data[unit].type = MCD_TYPE_FX001D;
706 mcd_data[unit].name = "Mitsumi FX001D";
707 break;
708 default:
709 mcd_data[unit].type = MCD_TYPE_UNKNOWN;
710 mcd_data[unit].name = "Mitsumi ???";
711 break;
712 }
713 printf("mcd%d: type %s\n", unit, mcd_data[unit].name);
674 return 4;
675}
676
677
678static int
679mcd_waitrdy(int port,int dly)
680{
681 int i;

--- 805 unchanged lines hidden ---
714 return 4;
715}
716
717
718static int
719mcd_waitrdy(int port,int dly)
720{
721 int i;

--- 805 unchanged lines hidden ---