summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
AgeCommit message (Collapse)Author
2007-06-23Implement disk sizes > 2^32-1. Code modelled on NetBSD.Kenneth R Westerback
Tested, tweaked and ok otto@
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-31Use 12 and 16 byte read/write commands as required by the size/lengthKenneth R Westerback
of the I/O being attempted. Throw in a comment typo fix to properly refer to sectors and not blocks. ok marco@
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-14For devices unwilling or unable to report geometry, change the 'fake'Kenneth R Westerback
geometry used to 255 heads and 63 sectors/track from 64 heads and 32 sectors. 255/63 makes the cylinders as large as PC/BIOS compatibility allows, increasing the size of devices that can be supported. ok pedro@ (long ago) marco@ millert@ weingart@
2007-04-13If a removable device refuses to process PREVENT_ALLOW to lock theKenneth R Westerback
media in while the device is open, allow the open anyway. Fixes some USB devices which do odd things when presented by PREVENT_ALLOW. Suggestion from mickey@. ok millert@ marco@
2007-04-11Use a separate function to remove the buffers in sddetach.Alexander Bluhm
No functional change. ok krw
2007-04-10Name and cast all struct sd_softc *sd the same way. No binary change.Alexander Bluhm
ok krw
2007-04-04sprinkle some ansification around.David Gwynne
no binary change, and ok krw@ marco@
2007-04-03implement the DK INFO ioctl so userland can query the disks product,David Gwynne
vendor, etc details.
2007-02-21Don't unconditionally spin up SDEV_UMASS devices. They almostKenneth R Westerback
certainly don't need it, or are capable of reporting themselves in need of a spin up. Feedback from various agreeing it is unlikely such devices exist. Fixes devices found by Markus Bergkvist and Johan M:son Lindman. ok dlg@
2007-02-12Don't need a 'return' just before exiting a function.Kenneth R Westerback
2007-02-03Make comment match code. ok pedroAlexander Bluhm
2006-12-21Fix some comment typos. 'immediatly' -> 'immediately', 'tranfer' ->Kenneth R Westerback
'transfer', 'tranfered' -> 'transferred'.
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-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-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-13Eliminate scsi_link field 'scsi_version' and just use the INQUIRY dataKenneth R Westerback
stored in scsi_link. That's where the value came from anyway. Move 'luns' field to where 'scsi_version' used to be to preserve alignment. ok dlg@
2006-07-11the scsi_link structure contained a copy of the inquiry flags and the wholeDavid Gwynne
inquiry. this removes the flags member and makes all its users refer to the whole inquiry now. ok miod@ krw@
2006-05-18Test the state of a disk *after* spinning it up and not before. ThisKenneth R Westerback
prevents the issuing of sizing inquiries to non-existant or non-responsive devices like empty slots on a USB card reader. Also try to avoid *extremely* unlikely loop of scsi_start() commands, by not using sd_interpret_sense() until after the disk is spinning. ok dlg@
2006-05-11Zap trailing whitespace.Kenneth R Westerback
2006-03-15Nuke dk_establish(), no longer used.Miod Vallat
2006-03-05Remove NetBSDism NRND. Pointed out by Mickey.Kenneth R Westerback
ok miod@ marco@
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.
2005-11-17Don't forget to device_unref() in sdclose() if sdlock() fails; ok krw@Miod Vallat
2005-11-17Use sectors as the size units for the RAW_PART (i.e. 'c') partition inKenneth R Westerback
spoofed sd disklabels. Sectors are the partition size units used and documented everywhere else in the tree. sd ensures a sector will always be a multiple of 512. Fixes disklabel(8) error messages and partition size display for sd devices that have no OpenBSD disklabel and a sectorsize > 512. Noted by Robert Szasz on his Sony Hi-MD device. ok pedro@ marco@
2005-11-13Allow removable disks to be spun up if they ask for initializationKenneth R Westerback
after being opened. Use SC_DEBUG() to suppress some verbiage during spin up. Return actual errors encountered during attempt to spin up, rather than always returning EIO. ok dlg@
2005-11-13Use scsi_delay() instead of delay() when waiting for scsi disk toKenneth R Westerback
become ready. Make verbiage SC_DEBUG(). ok dlg@
2005-11-07Death to superfluous verbiage. Suppress errors when getting the parametersKenneth R Westerback
for a raw partition like we suppress errors for the other operations on raw partitions. Replace 'could not get size' with more specific and informative SC_DEBUG() output. Silences a usb card reader that fgsch@ found. Now attach message is only 'sdX: drive offline'. Tested & ok fgsch@
2005-10-10Make some panic messages more useful.Kenneth R Westerback
2005-09-19Use variable to eliminate repeated calculation. More readable. NoKenneth R Westerback
functional change. ok dlg@
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-09-11Some UMASS devices blow up if MODE SENSE buffer length is 0 (aka 256).Kenneth R Westerback
Some blow up if buffer length is not 0. Just fake geometry for all UMASS devices since it's almost always fictitious anyway. One step on the road to eliminate geometry entirely. Fixes Ed Wandasiewicz's 2nd gen iPod mini and Sebastiaan Indesteege's UBest Technology device. ok marco@
2005-09-08free(NULL, ...) is not safe in the kernel. So check for NULL'nessKenneth R Westerback
before free()'ing buf in sd_get_parms(). Tweak code so there is only one free(buf, ...) to worry about. ok deraadt@.
2005-08-27Put in missing parenthesis and thus always passKenneth R Westerback
SCSI_IGNORE_ILLEGAL_REQUEST and SCSI_IGNORE_MEDIA_CHANGE flags to scsi_test_unit_ready() and scsi_start() during sdopen(). Re-enables use of devices that don't support START_STOP or TEST_UNIT_READY commands. Noted by and fix tested by Jason Crawford on VMWare disks. ok dlg@ henning@, supportive comments from miod@.
2005-08-24Test xs->bp before de-referencing it. Initialize it to NULL, not 0.Kenneth R Westerback
ok deraadt@
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-23Spin up sd units even if TEST_UNIT_READY says they're ready.Kenneth R Westerback
Use consistant scsi_autoconf and SCSI_SILENT flags in scsi_test_unit()/scsi_start() pairs. Fixes some hppa, vax, sparc systems that do not spin up disks automatically. Keeps USB card readers and such reasonably quiet. Noted by millert@ (hppa), henning@ (sparc) and hshoexer@ (vax). ok deraadt@