summaryrefslogtreecommitdiff
path: root/sys/scsi/cd.c
AgeCommit message (Collapse)Author
2001-06-22KNFTheo de Raadt
2000-07-18Update cd_size to handle failure of READ_CD_CAPACITY by returningConstantine Sapuntzakis
some default values
2000-04-18cd detachConstantine Sapuntzakis
2000-04-18sd and scsibus detachConstantine Sapuntzakis
cdlock/cdunlock now through disk_lock/disk_unlock
2000-04-09Don't trust the TOC coming from the drive so much.Constantine Sapuntzakis
Be better about handling failures of SCSI CD READ TOC command.
1999-11-12Use cdio.h instead of dvdio.hAngelos D. Keromytis
1999-11-11SCSI commands do not send data in both directions in the data phase.Constantine Sapuntzakis
Fixes DMA bug Angelos was seeing with DVD stuff. Happy ripping!
1999-11-09Fix lengths of scsi cmdsAngelos D. Keromytis
1999-11-03bzero the right amount of memory; I think NetBSD has this problem too.Angelos D. Keromytis
1999-11-03Some DVD support, from NetBSD.Angelos D. Keromytis
1999-10-16another fix form csapuntzTheo de Raadt
1999-10-14read disklabels only from CDs that have a data track, spoofed labels fromTheo de Raadt
the audio CDs could do with a bit more work, but this makes audio cd playing not generate disklabel read-failure messages on first open; csapuntz
1999-09-25sorry, but the last two changes completely broke disklabel spoofing, which ↵Theo de Raadt
we need for the release
1999-09-21Bug in the disklabel calculations fixed. Offsets were calculated inConstantine Sapuntzakis
terms of 512-unit sectors, yet the disklabel said that the sector size was 2048. Enabled code that tries to read disklabel from first data track. I guess this will be useful for those combination music/BSD install cds.
1999-09-21For some reason unbeknownst to me, the old acd driver had a more advancedConstantine Sapuntzakis
disklabel logic than the cd driver. This patch integrates that logic into the SCSI cd driver. Bug fixed - we no longer try to read disklabels off of audio CDs. No more SCSI errors when you hit play the first time on an audio CD.
1999-08-24Added type field to scsi_addr to reflect bus/device type (ATAPI or SCSI).Constantine Sapuntzakis
Updated ioctls to match Minor patches in anticipation of wd->sd translation layer
1999-08-10support DIOCRLDINFOTheo de Raadt
1999-07-21swap16_multi by niklas@cvs.openbsd.orgConstantine Sapuntzakis
Fix cd.c so it compiles on big-endian platforms
1999-07-20Be more generous with timeout on cd_play_msfConstantine Sapuntzakis
1999-07-20Make acd redundant.Constantine Sapuntzakis
Mostly based on NetBSD-current
1999-04-01If READ_CD_CAPACITY fails, just use the 2048/400000 defaults since some CDR ↵Todd C. Miller
drives don't support READ_CD_CAPACITY on blank media ; downsj with modifications by me
1998-10-05make DIOCGPDINFO equivalent to DIOCGDINFO for cd'sTodd C. Miller
1998-10-04Add DIOCGPDINFO supportTodd C. Miller
1998-10-03Add a "spoofonly" argument to readdisklabel() which will be used toTodd C. Miller
implement an ioctl to get a spoofed label even for disks that have a label on them.
1998-07-13CDs can have up to 99 tracks, not 65 tracks. Use kernel heap instead of stackConstantine Sapuntzakis
for temporary storage of CD table of contents
1998-07-12fill in d_bbsize and d_sbsizeTheo de Raadt
1998-03-27Fix strncpy usage and call a cdrom a cdrom in the fake labelTodd C. Miller
1997-12-05argh. this darn little bugger made CDIOCREADSUBCHANNEL unuseable, thisNiels Provos
should also fix some cdio problems with SCSI cdroms.
1997-10-18avoid "no disklabel" error messagesTheo de Raadt
1997-10-15make it compileNiels Provos
1997-09-11cd_play/acd_play() were replaced a while backTheo de Raadt
1997-08-31* Make scsi_do_ioctl() sane again.Jason Downs
* Use scsi_do_ioctl() in cd.c and uk.c again.
1997-08-08Change the bounds_check_with_label API to also take a cpu_disklabelNiklas Hallqvist
reference for making transferral of meta-information possible from readdisklabel to bounds_check_with_label. The first (and maybe only) thing that will use this is the multi-disklabel-format code on the alpha where the labelsector is passed via cpu_disklabel so the label write-protection can work correctly no matter what label was found. Also use a new macro DKBAD to get at the dkbad field of the cpu_disklabel implementations that contain it. This too is for multi-disklabel architectures where the "bad" field can be inside a union. Use this macro as a means for a driver to check if an architecture supports dkbad constructs. Remove proto of bounds_check_with_label from all MD disklabel.h as it is in sys/disklabel.h. I have not been able to test the changes everywhere, if I break anything I apologize, and promise to fix it as soon as I become aware of it.
1997-04-14Merge in various pieces of current NetBSD scsi code, including but not limitedJason Downs
to: * New changer driver. * Better optical support. * Different `done' semantics. * New quirks for SCSI QIC tape driver, SCSI floppy drives. * Better support for SCSI-I devices. Everybody needs to test this.
1997-03-29Increase timeout by a factor of ten in cd_size().briggs
NetBSD PR#3409 from Koji Imada <koji@imada.math.human.nagoya-u.ac.jp>
1997-03-26deal with CD drives that indicate 2352 bytes per block...Theo de Raadt
1997-01-04readdisklabel() with correct dev_tTheo de Raadt
1996-12-24deal with the 2340 lie in the right place, i thinkTheo de Raadt
1996-12-11b_resid cleanups, pointed out by minoura@kw.netlaputa.or.jp in netbsd pr#3007Theo de Raadt
1996-12-05call readdisklabel() in the same fashion as sd.c doesTheo de Raadt
1996-10-31$OpenBSD RCSIDs + comment fix in sd.cNiklas Hallqvist
1996-10-05[a]cd_play -> [a]cd_play_big. Say hello to cdio(1).Jason Downs
1996-08-16only safe ioctlTheo de Raadt
1996-08-07disk_unbusy if op failed to enqueueTheo de Raadt
1996-06-10Several changes:Jason Downs
* Implemented NetBSD PR#2529, adding ZIP 100. * Added MTIOCTOP support to acd, cd, and sd. * Implemented eject on close for acd, cd, and sd. `mt -f /dev/rcd0d offline' now ejects a mounted {acd|cd|sd} when it is unmounted.
1996-06-01all ports have dk_establishTheo de Raadt
1996-05-16from NetBSD PR#812:Michael Shalayeff
allow CDDA disks to be read. not tested, anyone w/ SCSI CD is ought to. here is the test program (not tested too ;): #define CDDA #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/param.h> #include <sys/scsiio.h> #include <sys/cdio.h> #include <scsi/scsi_all.h> #include <scsi/scsi_cd.h> #include <scsi/scsi_disk.h> extern int errno; void usage() { fprintf(stderr, "usage: cdda -d device -b blkcnt -o offset >output\n"); exit(1); } char databuf[CD_DA_BLKSIZ]; main(int argc, char *argv[]) { int ch; int fd; off_t offset = 0; int cnt = 0; char *dev = 0; struct scsi_rw_big read_cmd; struct scsi_mode_sense sense_cmd; struct cd_mode_data bdesc; scsireq_t req; while ((ch = getopt(argc, argv, "d:b:o:")) != -1) { switch (ch) { case 'd': dev = optarg; break; case 'b': cnt = atoi(optarg); if (cnt <= 0) usage(); break; case 'o': offset = atoi(optarg); break; case '?': default: usage(); } } if (dev == NULL || cnt == 0) usage(); fd = open(dev, O_RDONLY); if (fd == -1) err(1,"can't open device %s", dev); #ifdef DEBUG ch = SC_DB_FLOW; ioctl(fd, SCIOCDEBUG, &ch); #endif ch = 1; if (ioctl(fd, CDIOCSETCDDA, &ch) == -1) warn("can't set CDDA mode"); read_cmd.opcode = READ_BIG; /* READ10 */ read_cmd.byte2 = 0; /* no relative */ read_cmd.reserved = 0; read_cmd.length2 = 0; read_cmd.length1 = 1; /* read one block at a time. hope it caches! */ read_cmd.control = 0; /* LBA mode, leave flag & link zero */ for (; cnt > 0; cnt--, offset++) { read_cmd.addr_3 = (offset >> 24) & 0xff; read_cmd.addr_2 = (offset >> 16) & 0xff; read_cmd.addr_1 = (offset >> 8) & 0xff; read_cmd.addr_0 = offset & 0xff; memset(&req, 0, sizeof(req)); req.flags = SCCMD_READ; /* timeout is in milliseconds--not that it's obvious from the include files! */ req.timeout = 10000; /* 10 sec */ bcopy(&read_cmd, req.cmd, sizeof(read_cmd)); req.cmdlen = sizeof(read_cmd); req.databuf = databuf; req.datalen = sizeof(databuf); req.senselen = sizeof(req.sense); /* XXX */ if (ioctl(fd, SCIOCCOMMAND, &req) == -1) { fprintf(stderr, "bad ioctl: %d\n", errno); ch = 0; ioctl(fd, CDIOCSETCDDA, &ch); #ifdef DEBUG ioctl(fd, SCIOCDEBUG, &ch); #endif exit(1); } if (req.retsts != 0 || req.error != 0) { ch = 0; ioctl(fd, CDIOCSETCDDA, &ch); #ifdef DEBUG ioctl(fd, SCIOCDEBUG, &ch); #endif errx(1,"return status %d, error %d\n", req.retsts, req.error); } if (req.datalen_used != sizeof(databuf)) { ch = 0; ioctl(fd, CDIOCSETCDDA, &ch); #ifdef DEBUG ioctl(fd, SCIOCDEBUG, &ch); #endif errx(1,"didn't get full buffer back (%x)", req.datalen_used); } write(1, databuf, sizeof(databuf)); } ch = 0; if (ioctl(fd, CDIOCSETCDDA, &ch) == -1) warn("can't reset CDDA mode"); #ifdef DEBUG ioctl(fd, SCIOCDEBUG, &ch); #endif close(fd); exit(0); }
1996-05-10SC_DEBUG cleanupTheo de Raadt
1996-05-02no sys/cpu.h, fix bugs in chTheo de Raadt
1996-04-21partial sync with netbsd 960418, more to comeTheo de Raadt