Deleted Added
full compact
mcd.c (139749) mcd.c (141031)
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

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

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 */
44
45#include <sys/cdefs.h>
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

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

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 */
44
45#include <sys/cdefs.h>
46__FBSDID("$FreeBSD: head/sys/dev/mcd/mcd.c 139749 2005-01-06 01:43:34Z imp $");
46__FBSDID("$FreeBSD: head/sys/dev/mcd/mcd.c 141031 2005-01-30 08:12:37Z sobomax $");
47static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
48
49#include <sys/param.h>
50#include <sys/systm.h>
51#include <sys/kernel.h>
52#include <sys/conf.h>
53#include <sys/fcntl.h>
54#include <sys/bio.h>

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

130static int mcd_volinfo(struct mcd_softc *);
131static int mcd_waitrdy(struct mcd_softc *,int dly);
132static timeout_t mcd_timeout;
133static void mcd_doread(struct mcd_softc *, int state, struct mcd_mbx *mbxin);
134static void mcd_soft_reset(struct mcd_softc *);
135static int mcd_hard_reset(struct mcd_softc *);
136static int mcd_setmode(struct mcd_softc *, int mode);
137static int mcd_getqchan(struct mcd_softc *, struct mcd_qchninfo *q);
47static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
48
49#include <sys/param.h>
50#include <sys/systm.h>
51#include <sys/kernel.h>
52#include <sys/conf.h>
53#include <sys/fcntl.h>
54#include <sys/bio.h>

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

130static int mcd_volinfo(struct mcd_softc *);
131static int mcd_waitrdy(struct mcd_softc *,int dly);
132static timeout_t mcd_timeout;
133static void mcd_doread(struct mcd_softc *, int state, struct mcd_mbx *mbxin);
134static void mcd_soft_reset(struct mcd_softc *);
135static int mcd_hard_reset(struct mcd_softc *);
136static int mcd_setmode(struct mcd_softc *, int mode);
137static int mcd_getqchan(struct mcd_softc *, struct mcd_qchninfo *q);
138static int mcd_subchan(struct mcd_softc *, struct ioc_read_subchannel *sc);
138static int mcd_subchan(struct mcd_softc *, struct ioc_read_subchannel *sc,
139 int nocopyout);
139static int mcd_toc_header(struct mcd_softc *, struct ioc_toc_header *th);
140static int mcd_read_toc(struct mcd_softc *);
141static int mcd_toc_entrys(struct mcd_softc *, struct ioc_read_toc_entry *te);
142#if 0
143static int mcd_toc_entry(struct mcd_softc *, struct ioc_read_toc_single_entry *te);
144#endif
145static int mcd_stop(struct mcd_softc *);
146static int mcd_eject(struct mcd_softc *);

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

435 return (0);
436
437 case CDIOCPLAYTRACKS:
438 return mcd_playtracks(sc, (struct ioc_play_track *) addr);
439 case CDIOCPLAYBLOCKS:
440 return mcd_playblocks(sc, (struct ioc_play_blocks *) addr);
441 case CDIOCPLAYMSF:
442 return mcd_playmsf(sc, (struct ioc_play_msf *) addr);
140static int mcd_toc_header(struct mcd_softc *, struct ioc_toc_header *th);
141static int mcd_read_toc(struct mcd_softc *);
142static int mcd_toc_entrys(struct mcd_softc *, struct ioc_read_toc_entry *te);
143#if 0
144static int mcd_toc_entry(struct mcd_softc *, struct ioc_read_toc_single_entry *te);
145#endif
146static int mcd_stop(struct mcd_softc *);
147static int mcd_eject(struct mcd_softc *);

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

436 return (0);
437
438 case CDIOCPLAYTRACKS:
439 return mcd_playtracks(sc, (struct ioc_play_track *) addr);
440 case CDIOCPLAYBLOCKS:
441 return mcd_playblocks(sc, (struct ioc_play_blocks *) addr);
442 case CDIOCPLAYMSF:
443 return mcd_playmsf(sc, (struct ioc_play_msf *) addr);
444 case CDIOCREADSUBCHANNEL_SYSSPACE:
445 return mcd_subchan(sc, (struct ioc_read_subchannel *) addr, 1);
443 case CDIOCREADSUBCHANNEL:
446 case CDIOCREADSUBCHANNEL:
444 return mcd_subchan(sc, (struct ioc_read_subchannel *) addr);
447 return mcd_subchan(sc, (struct ioc_read_subchannel *) addr, 0);
445 case CDIOREADTOCHEADER:
446 return mcd_toc_header(sc, (struct ioc_toc_header *) addr);
447 case CDIOREADTOCENTRYS:
448 return mcd_toc_entrys(sc, (struct ioc_read_toc_entry *) addr);
449 case CDIOCRESUME:
450 return mcd_resume(sc);
451 case CDIOCPAUSE:
452 return mcd_pause(sc);

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

1352 bcd2bin(q->hd_pos_msf[0]),
1353 bcd2bin(q->hd_pos_msf[1]),
1354 bcd2bin(q->hd_pos_msf[2]));
1355 }
1356 return (0);
1357}
1358
1359static int
448 case CDIOREADTOCHEADER:
449 return mcd_toc_header(sc, (struct ioc_toc_header *) addr);
450 case CDIOREADTOCENTRYS:
451 return mcd_toc_entrys(sc, (struct ioc_read_toc_entry *) addr);
452 case CDIOCRESUME:
453 return mcd_resume(sc);
454 case CDIOCPAUSE:
455 return mcd_pause(sc);

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

1355 bcd2bin(q->hd_pos_msf[0]),
1356 bcd2bin(q->hd_pos_msf[1]),
1357 bcd2bin(q->hd_pos_msf[2]));
1358 }
1359 return (0);
1360}
1361
1362static int
1360mcd_subchan(struct mcd_softc *sc, struct ioc_read_subchannel *sch)
1363mcd_subchan(struct mcd_softc *sc, struct ioc_read_subchannel *sch, int nocopyout)
1361{
1362 struct mcd_qchninfo q;
1363 struct cd_sub_channel_info data;
1364 int lba;
1365
1366 if (sc->data.debug)
1367 device_printf(sc->dev, "subchan af=%d, df=%d\n",
1368 sch->address_format,

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

1418 lba = -lba;
1419 data.what.position.reladdr.lba = htonl(lba);
1420 data.what.position.absaddr.lba = htonl(msf2hsg(q.hd_pos_msf, 0));
1421 break;
1422 }
1423 break;
1424 }
1425
1364{
1365 struct mcd_qchninfo q;
1366 struct cd_sub_channel_info data;
1367 int lba;
1368
1369 if (sc->data.debug)
1370 device_printf(sc->dev, "subchan af=%d, df=%d\n",
1371 sch->address_format,

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

1421 lba = -lba;
1422 data.what.position.reladdr.lba = htonl(lba);
1423 data.what.position.absaddr.lba = htonl(msf2hsg(q.hd_pos_msf, 0));
1424 break;
1425 }
1426 break;
1427 }
1428
1426 return copyout(&data, sch->data, min(sizeof(struct cd_sub_channel_info), sch->data_len));
1429 if (nocopyout == 0)
1430 return copyout(&data, sch->data, min(sizeof(struct cd_sub_channel_info), sch->data_len));
1431 bcopy(&data, sch->data, min(sizeof(struct cd_sub_channel_info), sch->data_len));
1432 return (0)
1427}
1428
1429static int
1430mcd_playmsf(struct mcd_softc *sc, struct ioc_play_msf *p)
1431{
1432 struct mcd_read2 pb;
1433
1434 if (sc->data.debug)

--- 162 unchanged lines hidden ---
1433}
1434
1435static int
1436mcd_playmsf(struct mcd_softc *sc, struct ioc_play_msf *p)
1437{
1438 struct mcd_read2 pb;
1439
1440 if (sc->data.debug)

--- 162 unchanged lines hidden ---