summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
AgeCommit message (Collapse)Author
2010-09-24init err to 0 in sd_get_parms to avoid confusion when checking rigidDavid Gwynne
geometry. it doesnt matter waht the value there is cos rigid will be NULL, but this is clearer.
2010-09-22All users of physio(9) now pass NULL as the buf pointer argument, soMatthew Dempsky
no point in keeping it around. "i like this" thib@ (a while back); ok krw@ and oga@; reminder to update the man page and tweaks jmc@
2010-09-21Add a real DIOCGPDINFO, allowing access to the physical informationKenneth R Westerback
about the device rather than the contents of whichever disklabel was read. Tweak whitespace in sd.c to make the code appearance consistant.
2010-09-20bufq_drain() does not need to be done in deactivate; we only needTheo de Raadt
to deactivate transactions we are currently doing. ok dlg
2010-09-12Garbage collect rot_rate from disk_parms. No longer in disk label so noKenneth R Westerback
need to calculate and save. Not used anywhere in tree.
2010-09-11Be more ruthlessly consistent in variable names for blk/block ==Kenneth R Westerback
512 == DEV_BSIZE units and variable-sized physical device 'sectors'. I hope this reduces confusion a bit more. No change to .o files. ok for intent miod@, with tweak.
2010-09-10scsi_xsh_del the io handler in deactivate to prevent it from being run onDavid Gwynne
a device thats now gone, or from being on the list of pending io when the device is actually detached. found and fix tested by jakemsr@ "go for it" jakemsr@
2010-09-08Introduce a disk_lookup() function which calls device_lookup(), beforeJoel Sing
verifying that the resulting device is present on the disklist. This avoids a race whereby the disk driver can be accessed as soon as the softc has been allocated, but before the disk has completed initialisation and has called disk_attach() (up until this point dk_label is still a null pointer). Cut cd(4), sd(4) and wd(4) across to disk_lookup(). All callers of disk_attach() need to be tested and cut over in due course. ok deraadt@ krw@
2010-09-08Store a struct device pointer within struct disk and populate this whenJoel Sing
disk_attach() is called by the device driver. We will be building on this shortly. ok deraadt@ krw@
2010-09-01Restore compilability after bufq changesMiod Vallat
2010-09-01make struct bufq a member of the softc for devices that use it,David Gwynne
rather than it being a pointer to something that needs to be allocated at attach. since all these devices need a bufq to operate, it makes sense to have it allocated as part of the softc and get bufq_init to just initialise all its fields. it also gets rid of the possibility that you wont be able to allocate the bufq struct during attach, which is something you dont want to happen. secondly, it consistently implements a split between wrapper functions and the per discipline implementation of the bufq handlers. it consistently does the locking in the wrappers rather than doing half in the wrappers and the other half in the implementations. it also consistently handles the outstanding bufq bq pointer in the wrappers. this hides most of the implementation inside kern_bufq.c. the only stuff left in buf.h is for the bits each implementation needs to put inside struct buf. tested by thib@ krw@ and me ok thib@ matthew@ no objection from krw@
2010-08-31in the activate function, order the DVACT_ functions in the order theyTheo de Raadt
can expect to be used
2010-08-28Garbage collect struct dkdriver.Matthew Dempsky
ok miod@; "please go ahead" jsing@
2010-08-03Don't attempt to set the read or write caches on usb disks. ItKenneth R Westerback
breaks at least one previously working device, as discovered by naddy@. dlg@ confirmed other kernels also avoid attempting this operation on usb disks. ok dlg@ deraadt@
2010-07-07Pull out disk sort. I committed the wrong version of the diff and itMarco Peereboom
wasn't ok deraadt & dlg.
2010-07-06Enable FIFO IO for sd devices. This time committed against the actual tree.Marco Peereboom
Tested by lots of people during c2k10 ok phessler krw thib
2010-07-03Stop disk on suspend and start it again upon resume. Gets rid of the loudMark Kettenis
click upon suspend that my laptop with ahci(4) has. ok dlg@, ok marco@ on an earlier iteration of this diff
2010-07-01Die struct scsi_device! Die! Instead, save a pointer to the routineKenneth R Westerback
to interpret sense errors. This is initialized to the basic interpretation routine, and specific scsi drivers (sd/st/cd) can replace this with their own. While here kill EJUSTRETURN dance and make more specialized interpretation routines directly call the basic routine if desired. Fixes by matthew@ to my first diff. Most original work by dlg@. ok matthew@ marco@ dlg@
2010-07-01Restore setting xs->bp; fixes ncr(4) on VAX.Matthew Dempsky
ok miod@, krw@
2010-06-30Flush cache before suspend.Mark Kettenis
ok krw@, marco@
2010-06-28Move disk_attach() to the end of the attach functions, at which point theJoel Sing
disk is now ready to handle I/O. ok krw@ dlg@
2010-06-24we cant rely on being able to sleep when dumping, so dont lose theDavid Gwynne
SCSI_NOSLEEP flag on the xs when setting extra flags by oring them in rather than assigning them. from matthew dempsky
2010-06-16Always check both the return value of scsi_do_mode_sense() and theKenneth R Westerback
NULL'ness of the pointer to the actual page data. Fixes a NULL deref when trying to set caching on my ASUS eeePC 1000HE's SD slot. ok dlg@
2010-06-15enable the write cache on disks during attach.David Gwynne
requested by deraadt@ ok krw@ marco@
2010-06-15dont pass the dev_t from the scsi device drivers into the midlayer forDavid Gwynne
ioctl requests, and dont pass the proc pointers around for any ioctl requests in scsi land at all. neither were used, so trim the fat. ok krw@ marco@
2010-06-11Restore an unusual XS_SENSE semantic that inadvertantly got lostKenneth R Westerback
in the great re-write. If the scsi device *_interpret_sense() function returns 0 that means there was no error. Fixes restore(8) problems seen on certain tape drives. Found and fix tested by Percey Piper. Suggestions from Matthew Dempsky. Thanks! ok dlg@
2010-06-02bring back the SDF_WAITING waiting flag while adapters still implementDavid Gwynne
NO_CCB. if sd_buf_done is told that the adapter has no more ccbs via NO_CCB, this sets a flag so sdstart doesnt try and queue more io straight away. this fixes the lockups on ciss that halex and okan were experiencing after the iopools code went in. it will fix any other hba that returns NO_CCB too. tested by me@, okan@, and halex@ ok krw@ okan@ halex@
2010-05-26Trying this again. Mixing anoncvs with cvs is _not_ a good idea.Thordur I. Bjornsson
Reintroduce bufqs. A few changes since it was backed out after some good comments from dlg@. No need for a separate bufq.h, keep all of in buf.h; As requested by kittens and deraadt. Only sd(4) and wd(4) for now. The rest of the drivers will be converted soon, also other goodies like heuristics for sd(4) for selecting the bufq type and the death of disksort() are forthcoming. Tested on: i386, amd64, sparc64, macppc, loongson and alpha by myself and phessler. OK art@, beck@, kettenis@, oga@
2010-05-20Simplify new disk cache code so simpler people can understand it.Kenneth R Westerback
No functional change. ok dlg@
2010-05-19remove unused flag.David Gwynne
2010-05-19add an ioctl that allows userland to get or set a disks read and writeDavid Gwynne
caches, and implement handling of these ioctls on vanilla scsi disks. discussed with krw@, marco@, miod@, kettenis@. krw@ has a diff to make the sd.c code prettier coming shortly.
2010-05-18dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisDavid Gwynne
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include <sys/dkio.h> to the places that actually want and use the disk ioctls. this became an issue when krw@'s X build failed when he was testing a change to dkio.h. tested by krw@ help from and ok miod@
2010-04-30unbreak dumps on scsi disks.David Gwynne
discovered by oga@
2010-04-23Recycle unused disklabel fields in order to create a disklabel uniqueJoel Sing
identifier, allowing the disk to be identified without relying on the device name. ok deraadt@ krw@ beck@ marco@ todd@
2010-04-12i snuck fine grained locking into the midlayer as part of all theDavid Gwynne
other stuff ive been doing in here. everything that needs protection inside the midlayer and the scsi device drivers (sd, cd, etc) uses mutexes now. this pushes splbio out of the midlayer. splbio is only taken before biodone is called now. ok beck@ marco@ krw@ deraadt@. theyre all terrified, but they all say if we're going to do then now is the right stage of the dev cycle.
2010-04-06cut sd over to using the new shiny scsi_xsh api. instead of pushing io ontoDavid Gwynne
the disk as soon as it gets any from the block layer, this now registers a callback for when a resource becomes available on the bus. ok krw@ beck@ marco@ tested by many including krw@ beck@ mk@ okan@ todd@
2010-01-15Abstract and merge the manual buf queue manipulating functions intoKenneth R Westerback
one place for easier debugging and maintenance. No intended functional changes. ok dlg@
2010-01-15Restore XS_BUSY delay behaviour for buf i/o. Same as for sync path.Kenneth R Westerback
ok dlg@
2010-01-12dont let the antisemaphore clear the WAITING flag so NO_CCB doesnt causeDavid Gwynne
us to loop forever. follow sdstart through to to an adapters scsi_cmd handler and assume that handler returns NO_CCB to enjoy the bug in full. ok kettenis@ krw@ beck@
2010-01-11dlg@ lost the SCSI_IGNORE_ILLEGAL_REQUEST flag on all SYNCHRONIZE_CACHEKenneth R Westerback
commands. Noticed & fix tested by halex@. ok dlg@
2010-01-11Be as careful with sd/cd buf queue manipulations as was found necessary forKenneth R Westerback
st's queue manipulations. i.e. ensure b_actb is correctly updated as the queue becomes empty or has an i/o requeued on it. Tested on claudio@'s backup crashing box. ok dlg@ beck@
2010-01-11Add mutex around work consuming loop in sdstart - this ensures that onlyBob Beck
one thread will be grabbing xs's at a time and dequeuing work, but avoids a race between notification there is work to do and exiting the loop releasing the xs's. Fixes problem noticed by claudio where usb disks would hang with the new minty dlg midlayer. ok krw@, dlg@, tested by claudio@
2010-01-09dont try to prevent multiple concurrent runs of a devices start routineDavid Gwynne
by setting flags around the loop. there is a race which can prevent necessary work being completed by any of the currently running instances of xxstart. the caveat with the removal of this code is because multiple xxstarts can be running at the same time they can cause io reordering, but that is less of a problem than no io. found by and fix tested by claudio@ debugged with krw@ claudio@ beck@ deraadt@
2010-01-05only call disk_unbusy when we're finished with the io (or we're requeuingDavid Gwynne
it when we hit NO_CCB). retried io would call unbusy twice before this change. noticed by deraadt@
2010-01-04introduce scsi_xs_sync. this will synchronously execute a scsi_xferDavid Gwynne
and do the appropriate sleeps, retries, error processing, and finally returns an errno style value to the caller. this cuts scsi_scsi_cmd, the ioctl code, sd_flush, and scsi_inquiry over to scsi_xs_sync. ok krw@
2009-12-07Re-enable SCSIDEBUG display of commands and data. Original diffKenneth R Westerback
from dlg@, tweaking by me to make it compile. ok dlg@
2009-12-06Nuke SCSI_URGENT after removing its only use, in ncr53c9x.c. That useKenneth R Westerback
was to try to play dangerous games with tagged queuing. ok marco@
2009-12-06consistently refer to the softc pointer as sc, not sd.David Gwynne
2009-12-06biodone must be called at splbio.David Gwynne
2009-12-03prevent a completion interrupt pulling io of the buf queue and shoving itDavid Gwynne
down to the disk while a process is doing the same thing. this will avoid some relatively minor io reordering from occurring. discovered by krw@ during his long dark trek through the code. requested by marco@