summaryrefslogtreecommitdiff
path: root/sys/scsi/cd.c
AgeCommit message (Collapse)Author
2006-03-15Nuke dk_establish(), no longer used.Miod Vallat
2006-03-04Typos grab bag of the month, eyeballed by jmc@Miod Vallat
2006-01-21Invoke disk_detach() and related cleanup work in detach(), rather thanMiod Vallat
zeroref() - just to be on the safe side, should we mess up our ref count.
2006-01-17Need to device_unreg() the implicit device_ref() done by cdlookup() inMiod Vallat
cdminphys().
2006-01-12Don't populate the fabricated disklabel's partition info from trackKenneth R Westerback
information in the TOC. The partition info is just overwritten or rendered incomplete by readdisklabel(). Just examine the TOC to determine if the cd is audio only, i.e. it has a valid TOC but no data tracks. In this case don't call readdisklabel(). Much simpler code. No functional change for single data track CD's like the install media. ok pedro@.
2005-12-25Cleanup/fix cdgetdisklabel() byKenneth R Westerback
1) Using cd_load_toc() instead of replicating code. 2) Using struct cd_toc and betoh32() like other parts of cd.c. 3) Restoring pre-Sept. 26 behaviour of trying to read usable disklabel info if there is no TOC. i.e. avoid readdisklabel() only when it is an audio-only CD. Stop abusing spoofonly. Tested by mjc@
2005-12-23Make cd_load_toc() take an address mode parameter, clean up a bit.Kenneth R Westerback
Add a check for ending_track < starting_track before calculating size of TOC to read. Tested by mjc@
2005-12-22Move a struct cd_toc (800 bytes) from the stack to malloc'ed memory.Kenneth R Westerback
bzero() all malloc'ed cd_toc structs because cd_read_toc() will only zero as much as it is trying to read. malloc M_TEMP memory instead of M_DEVBUF memory for the cd_toc structs. ok deraadt@
2005-12-22Initialize data_track before a 'goto done;' could lead to it beingKenneth R Westerback
used.
2005-10-15Eliminate unnecessary bzero() by only writing valid information.Kenneth R Westerback
Eliminate separate check/break from for() loop. No functional change. ok deraadt@
2005-10-14Eliminate uneeded variable 'i' and use under utilized 'data_track'Kenneth R Westerback
instead. ok deraadt@
2005-10-11use [bl]etohXX instead of ntoh[sl], makes the code more consistent andHans-Joerg Hoexer
better readable. actually no binary change. ok krw@
2005-10-11Change some byte shifting to _4btol() and swap32() calls.Kenneth R Westerback
ok hshoexer@
2005-10-10Some KNF. malloc/free instead of MALLOC/FREE since it's a variableKenneth R Westerback
sized allocation. Remove some dead code.
2005-09-29Clear SDEV_MEDIA_LOADED for cd media on the last close of a device, asKenneth R Westerback
sd does. Prevents spurious label information from being seen on devices that return NOT READY/UNABLE TO RECOVER TABLE-OF-CONTENTS error (or other sense errors) for blank media. Burning cd's still works. ok marco@ dlg@ fgsch@ deraadt@
2005-09-26Use SCSI_IGNORE_ILLEGAL_REQUEST when reading a cd's table of contents.Kenneth R Westerback
ILLEGAL REQUEST is correctly reported for blank media, as an informative FreeBSD comment pointed out. Ensure the returned table of contents is always initialized to zero. Call readdisklabel with spoofonly = 1 when no data tracks are found. Don't try to read the DOS label from the device if spoofonly is 1. Only done for amd64 here. More archs to follow. Eliminates scsi error messages when attempting to open a cd containing blank media, as pointed out by Michael Coulter. ok deraadt@
2005-09-21Improve readability by using a variable instead of repeatedKenneth R Westerback
calculations. Same as sd.c r1.94.
2005-09-21Missing parenthesis. Same problem was addressed in sd.c r1.90. CouldKenneth R Westerback
fix devices not supporting TEST UNIT READY.
2005-09-11Simplify code by changing struct scsi_mode_sense_buf{ union {}Kenneth R Westerback
headers; } to just union scsi_mode_sense_buf {}. No functional change. ok marco@
2005-08-23Move uses of struct scsi_mode_sense_buf (255 bytes each) from theKenneth R Westerback
stack into malloc'd memory. ok deraadt@
2005-08-03Move a couple of 2048+4 byte structures from the stack to the heap.Kenneth R Westerback
Create structures to eliminate 2048+4 magic number everywhere. Mostly adapted from NetBSD. tested by sturm@, beck@. ok beck@
2005-06-11Elminate a few unnecessary casts by using union field names, bit of KNF.Kenneth R Westerback
2005-06-05Fix scsi_mode_select() and scsi_mode_select_big() to send just theKenneth R Westerback
required number of bytes, rather than a full scsi_mode_sense_buf. Some devices (e.g. my HP SureStore DAT/24) decline to accept such oversized transfers. Instead, force callers to fill in the data_length field in the header and use that information to set the size of the transfer.
2005-06-03Move definitions of struct cd_softc{} and CDRETRIES from cdvar.h intoKenneth R Westerback
cd.h. Remove include of cdvar.h from cd.c. cdvar.h becomes expendable. No functional change.
2005-06-03Tweak scsi_do_mode_sense(). NetBSD was right and I was wrong. Sigh.Kenneth R Westerback
Add 'big' parameter to report which mode sense header type is being returned. Eliminate icky pointer arithmetic, since it won't work if only block descriptors are returned by the device. No functional change.
2005-05-27Don't bother issuing a MODE SELECT in cd_set_pa_immed() if we aren'tKenneth R Westerback
going to change anything. From NetBSD. Fixes playing music cd in ATAPI drive in USB enclosure pascoe@ is using. ok pascoe@.
2005-05-27Convert cd code to new mode sense framework. Merge cd_scsi andKenneth R Westerback
cd_atapi into cd since code is now almost identical, and only affects volume adjusting ioctl's. Minor side effect of allowing cd_load_unload() attempts to scsi cd's as NetBSD does.
2005-05-01Allow RAW_PART+S_IFCHR device opens to succeed even if media notKenneth R Westerback
present. A successful open is required for ioctl's to work. Mostly from NetBSD, partly correcting previous code cleanup error. From deraadt@, treat MTIOCTOP+MTRETEN as CDIOCCLOSE for cd devices (i.e. close the cd drawer). ok deraadt@.
2005-04-06De-register scsi.Kenneth R Westerback
2005-04-05Clean up some logic. Use better error handling for sd devices. BeKenneth R Westerback
quiet if raw partition access tried. Be more careful with SDEV_MEDIA_LOADED. Inspired by some NetBSD changes. ok marco@
2005-03-30Comment typo, minor knf. No code change.Kenneth R Westerback
2004-05-09Add missing <cr>'s to various SC_DEBUG() calls, along with a few otherKenneth R Westerback
SC_DEBUG() spacing tweaks. ok deraadt@
2004-02-15new arg to disk_unbusy, to record separate read/write statistics.Ted Unangst
looked at by various, testing henning@ mcbride@ dan weeks mostly from netbsd via Pedro Martelletto <pbastos@rdc.puc-rio.br>
2003-11-07adress -> address, and a few more; all from Jonathon Gray;Jason McIntyre
(mvme68k/mvme88k) vs.c and (vax) if_le.c ok miod@ isakmpd ones ok ho@
2003-07-30reverse booleans so it's clear what we're looking for. ok krw@Ted Unangst
2003-05-18constify the quirck tables and fix the scsi_inqmatch() proto accordingly; ↵Michael Shalayeff
krw@ ok
2003-05-17READ_CD_CAPCITY -> READ_CD_CAPACITY in comment.Kenneth R Westerback
2003-05-16Provide most if not all the support required for the usb changes NateKenneth R Westerback
is trying to bring in. 1) Change name of SDEV_NOCDB6 to SDEV_ONLYBIG to align it with the same quirk in NetBSD, and make it more clear what it is trying to do. i.e. force the use of READ_BIG/WRITE_BIG commands, not suppress all use of 6 byte CDB's. 2) Check SDEV_ONLYBIG in cd.c as well as sd.c. i.e. both places where a choice is made to use the 6 or 10 byte versions of READ/WRITE. 3) Actually make use of the ADEV_NOTUR (No TEST UNIT READY) quirk to suppress the emission of TEST UNIT READY commands. 4) Add some explanatory comments from NetBSD to scsiconf.h so that the use of the quirks is made clear. ok miod@ tdeval@ nate@
2003-04-06The disklabel fields d_packname and d_typename are not null terminated stringsKenneth R Westerback
and should not be created or used as such. This fixes some instances of both behaviours, and sets the stage for some strcpy -> strncpy fixup. ok tdeval@ millert@ deraadt@
2003-01-17The end of the track is one frame before the first frame of the next trackJason Wright
(and right before the leadout track in the case of the last track). Some CDROM's are evidentally picky about being asked to play the first frame of the leadout.
2003-01-05spellingTheo de Raadt
2002-12-30Add new parameter to scsi_test_unit_ready(): retries number.Alexander Yurchenko
Use increased retries number and don't ignore SCSI_IGNORE_NOT_READY when call scsi_test_unit_ready() for cd-rom, this makes system wait if drive is loading media. Tested by millert@ and fgsch@; some input and ok from krw@. Problem reported by The lord of the CD-writers Igor Grabin <violent@death.kiev.ua>.
2002-06-09splassert a splbio assumption.Artur Grabowski
2002-06-08KISS. the spl variable doesn't have to be called s, but it make the code ↵Artur Grabowski
less confusing.
2002-06-08splbio around biodoneArtur Grabowski
2002-05-23Signed/unsigned int bug caused lp->d_npartitions to be set to zero.Constantine Sapuntzakis
Should fix disklabel warnings on disks with no data track. The old code was unnecessary complex too.
2002-03-14Final __P removal plus some cosmetic fixupsTodd C. Miller
2002-03-14First round of __P removal in sysTodd C. Miller
2002-02-01cdstrategy(): check that media is loaded before doing anything with theHans Insulander
cd. ok art@
2001-10-25Allow an empty cd to be opened (raw device/whole disk) primarily toDale Rahn
allow empty CD caddies to be ejected. Original diff from Alexander Guy. "pretty much straight from NetBSD" Addition to allow eject (mt) to eject an empty tray. ok csapuntz@