summaryrefslogtreecommitdiff
path: root/sys/scsi/cd.c
AgeCommit message (Collapse)Author
2008-05-27nuke unused lba2msf and msf2lba functions. krw@ ok.Federico G. Schwindt
2007-09-16MALLOC/FREE -> malloc/free, M_ZERO, extraneous casts,Kenneth R Westerback
extraneous #include <malloc.h>
2007-09-07The obvious bzero/memset -> M_ZERO changes.Kenneth R Westerback
2007-06-20b_cylinder does not need to be set on the callpath down into drivers.Theo de Raadt
cpu_disklabel can go away, since nothing anymore needs to use it; ok miod
2007-06-18avoid modification race in DIOCRLDINFO; ok krw miodTheo de Raadt
2007-06-08all drivers should spoof version 1 labelsTheo de Raadt
2007-06-07in OpenBSD as all old BSD unix, RAW_PART always starts at 0, so noTheo de Raadt
need for special case code; ok krw
2007-06-06now that all partition size/offsets are potentially 64-bit, change theTheo de Raadt
type of all variables to daddr64_t. this includes the APIs for XXsize() and XXdump(), all range checks inside bio drivers, internal variables for disklabel handling, and even uvm's swap offsets. re-read numerous times by otto, miod, krw, thib to look for errors
2007-06-05use six new macros to access & store the 48-bit disklabel fields relatedTheo de Raadt
to size. tested on almost all machines, double checked by miod and krw next comes the type handling surrounding these values
2007-06-01Don't initialize d_partitions[RAW_DISK] just before callingKenneth R Westerback
readdisklabel(), since all readdisklabel()'s do that already. ok deraadt@
2007-05-25ANSI-fication, minor KNF. No code change. My plane had power outletsKenneth R Westerback
this time!
2007-04-28Fix comments above DISKMINOR uses. DISKMINOR provides minor not majorKenneth R Westerback
number (wd.c), and the uses are to find the minimum minor to be detached.
2007-04-26Use the standard DISKPART/DISKUNIT/etc. defines rather than identicalKenneth R Westerback
but differently named SD/CD ones. No change to .o files. ok deraadt@ dlg@
2007-04-12Add cd_kill_buffers() as a separate function, like sd_kill_buffers()Kenneth R Westerback
and for the same reason of preparing for safer handling of users yanking usb devices out. No functional change. Copied from bluhm@'s change to sd.c.
2007-04-10``it's'' -> ``its'' when the grammar gods require this change.Miod Vallat
2007-04-10Always use idiom 'struct cd_softc *cd = (struct cd_softc *)self'. SpottedKenneth R Westerback
by bluhm@ for sd. No change to cd.o.
2007-02-03Make comment match code. ok pedroAlexander Bluhm
2006-12-23Add the ability to issue GPCMD_REPORT_KEY and GPCMD_SEND_KEY scsiKenneth R Westerback
commands via the DVD_LU_SEND_RPC_STATE and DVD_HOST_SEND_RPC_STATE ioctls respectively. Thus allowing any region protected DVDs mistakenly delivered by Santa to the wrong region to be viewed on recalcitrant DVD drives (with the aid of an appropriate utility like regionset). No change to any current functions. Found in my hackers@ folder from August. From netbsd -> Kurt Miller -> jmc@.
2006-12-12Give the SCSI layer the ability to requeue i/o's rejected by a driverKenneth R Westerback
using the new NO_CCB result. Currently a no-op since no driver produces that result. ok dlg@ marco@ deraadt@
2006-11-28rename scsibus_attach_args to scsi_attach_args. this can help avoidDavid Gwynne
confusing when trying to attach scsibus to a hba, since it is really meant for attaching scsi devices to scsibus. ok deraadt@ marco@
2006-11-27more magic removalBob Beck
ok miod@, deraadt@
2006-11-27get rid of the rest of the asc/ascq magic codes in scsiBob Beck
ok marco@, deraadt@
2006-10-08Something more closely resembling english in this comment.Bob Beck
2006-10-07make cd-roms retry forever while the device indicates that it isBob Beck
"becoming ready" - this is done in the exact same way that it was done for tape in st.c. This commit adds a cd specific interpret_sense routine to cd.c that will catch the becoming ready case and handle it. This also removes the need to use crazy timeouts to catch this case. ok krw@
2006-09-26Zap D_REMOVABLE flag from disklabel. If you didn't already know thatKenneth R Westerback
floppies and cd's were removable, displaying that fact in disklabel output was unlikely to help. And the display in disklabel was the only use of D_REMOVABLE in the tree. ok marco@
2006-07-29The version field of scsi_inquiry_data is not a simple numeric valueKenneth R Westerback
that specifies the version of SCSI being supported. Even the ANSI part that we use is complex. 4 means 2, 5 means 3 and 6 means 4. Translate and use the value correctly. Fixes SCSI5 and SCSI6 in dmesg. And properly protects SCSI2 devices from getting SCSI3 commands. "seems like an elegant solution to me" millert@ ok dlg@ marco@
2006-07-23remove some scsi ioctls, most importantly the ones that can reprobe theDavid Gwynne
bus. supporting these complicates the midlayer unnecessarily. ok krw@
2006-07-19Add cd_powerhook(). Use it to lock CD drives having open partitionsKenneth R Westerback
when PWR_RESUME occurs. The drives may have forgotten they were locked. Noted and original diff by Alexey Vatchenko. "I agree with the intent." miod@ "Looks acceptable." deraadt@
2006-05-11Zap trailing whitespace.Kenneth R Westerback
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@