summaryrefslogtreecommitdiff
path: root/sys/scsi/st.c
AgeCommit message (Collapse)Author
2013-10-03Print daddr_t variables with %lld, u_int64_t variables with %llu.Kenneth R Westerback
2013-07-05Tweak calculations of resid to avoid unsigned vs signed comparison andKenneth R Westerback
make code clearer. Pointed out by brad@ and his friend llvm.
2013-06-11final removal of daddr64_t. daddr_t has been 64 bit for a long enoughTheo de Raadt
test period; i think 3 years ago the last bugs fell out. ok otto beck others
2013-06-06Fix EOM handling. Makes Bacula much happier by allowing the use ofKenneth R Westerback
both 'Fast Forward Space File = yes' and 'Hardware End of Medium = yes'. Mostly taken from FreeBSD. Constant prodding by robert@, testing actual backup and restore by ajacoutot@.
2011-07-03Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingMatthew Dempsky
that's ever used it, and it's long since been changed to use DVACT_{QUIESCE,SUSPEND,RESUME} instead. ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it up a few weeks ago
2011-06-07Fix a device reference leak in st{read,write}() by making them workMatthew Dempsky
like {cd,sd}{read,write}(). ok krw@, dlg@
2011-03-31- use nitems(); no binary change.Jasper Lievisse Adriaanse
ok krw@
2011-03-18Fix stdetach() to call vdevgone() with the right device minor numbers.Matthew Dempsky
Some stylistic tweaks after discussions with krw@ and deraadt@. ok krw@; "Lovely" deraadt@
2011-03-17use dma_alloc/dma_free instead of malloc to allocate buffers which needTheo de Raadt
to be in the right address space. help from matthew and krw
2010-12-24Have sd(4) devices check for and respect read-only information theKenneth R Westerback
way st(4) does. Have both decline to open read-only devices for anything but read-only access. Suggestion to fail opens rather than individual i/o's from deraadt@. Problem USB device found and donated by chefren, who also tested diffs. Thanks! ok dlg@ marco@
2010-10-13No need to check ST_DYING flag twice in succession.Kenneth R Westerback
Noticed by Damien McGuckin. Thanks!
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-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-14dont leak an xs in ststart if its called while the device is dying.David Gwynne
pointed out by matthew@
2010-09-14scsi_xsh_del the xs handler on DEACTIVATE.David Gwynne
same change as sd.c r1.212. matthew@ pointed out that cd(4) and st(4) would need the same change.
2010-09-14Clean up sense mode handling to make residual value handling clearerKenneth R Westerback
and more plausibly correct. Tested by jsing@ and myself.
2010-09-01Don't give xs->resid an invalid value (xs->datalen * st->blksize)Kenneth R Westerback
inside st_interpret_sense() and then exit without making sure it's set back to <= xs->datalen. Fixes 'done < 0; strategy broken' panics when un-tar'ing /cvs from my ahci DAT tape drive. ok dlg@ more-or-less-ok matthew@
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-30Avoid possible aliasing-related compiler issues by always writing toMatthew Dempsky
cmd->opcode through the type casted command pointer rather than through xs->cmd->opcode. Requested by deraadt@; ok krw@.
2010-07-22In st_space() and st_write_filemarks(), if scsi_xs_get() returns NULL,Matthew Dempsky
set st->media_fileno and st->media_blkno before returning. Not sure if this is needed or even really correct, but it's an unintentional behavior change due to removing scsi_scsi_cmd(). ok dlg@
2010-07-22Eliminate scsi_scsi_cmd() now that ss(4) is gone and with it theKenneth R Westerback
last bastardized sync and buf call through scsi_scsi_cmd(). Flatten code to call scsi_xs_sync() directly for all commands. Airplane typos shaken out by various. ok dlg@ matthew@ deraadt@
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-30Prune some dead assignments in st_interpret_sense(); st(4) alreadyMatthew Dempsky
always explicitly sets bp->b_resid before calling biodone(), so these are unneeded. ok krw@
2010-06-29Change st(4) to use the FIFO buf sorting discipline rather than theMatthew Dempsky
default disk-sorting one. ok krw@
2010-06-26Don't #include <sys/user.h> into files that don't need the stuffPhilip Guenthe
it defines. In some cases, this means pulling in uvm.h or pcb.h instead, but most of the inclusions were just noise. Tested on alpha, amd64, armish, hppa, i386, macpcc, sgi, sparc64, and vax, mostly by krw and naddy. ok krw@
2010-06-25move st over to using xshandlers for scheduling io. based on theDavid Gwynne
same changes in cd and sd. tested by and ok krw@
2010-06-16Bring ststrategy() into line with sdstrategy() and cdstrategy(), makingKenneth R Westerback
sure buf's are correctly completed. Feedback from Matthew Dempsky. ok dlg@
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-01move cd, st & ss over to bufq's again.Thordur I. Bjornsson
Tested by myself and krw. ok krw@
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-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-12bring sd.c r1.180 over to the other drivers now using the antisemaphore,David Gwynne
ie, dont clear the WAITING flag when restarting the xxstart loops.
2010-01-11Bring mutex protections to ststart, cdstart and ssstart, as alreadyKenneth R Westerback
done in sd. Make names consistant across all three. ok dlg@ tested (cd) & ok beck@
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@
2009-12-26move st over to the new midlayer.David Gwynne
much testing and debugging from krw@ his diff was a nice christmas present
2009-10-13Get rid of devact enum, substitute it with an int and coresponding defines.Paul Irofti
This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
2009-02-16Extend the scsi_adapter minphys() callback to take a struct scsi_link *Miod Vallat
as additional argument. This will allow intermediate layers between scsi devices such as sd and scsi host adapters to take appropriate action if necessary.
2008-09-22Do not return an uninitialized value on success in stclose().Miod Vallat
ok krw@
2008-09-06Return EIO when the residual is > xs->datalen, even if SCSI_SILENT isKenneth R Westerback
set. SCSI_SILENT mediates printing error messages only.
2008-06-22Replace MUSTEK_RETRIES, SCANJET_RETRIES and ST_RETRIES with SCSI_RETRIES,Kenneth R Westerback
all defined to 4. Replace some magic number 4's with SCSI_RETRIES. Fix a few lines that were now too long.
2008-05-12Fix device reference counting. Now that we try to support detachableKenneth R Westerback
tape drives it is nice not to crash if one is detached. Basically use a consistant mechanism modelled on sd to lookup devices and do the device reference increments and decrements. Problem reported (PR#5811) and fix tested by Jozef Hatala. Still some corner cases Jozef is looking for but we'll fix those as discovered.
2008-05-09Oops. When detaching tape drives look for devices using 'stopen' notKenneth R Westerback
devices using 'sdopen'. PR#5810 from Jozef Hatala. ok beck@
2007-11-27typos; ok jmc@Martynas Venckus
sys/dev/pci/pciide.c from naddy@
2007-11-22Ansi-fy.Kenneth R Westerback
2007-11-22Ooops. Don't de-reference st until after it has been pointed at theKenneth R Westerback
correct st_softc. Fixes 'mt rewoffl' panics, as reported on misc@ by Jeff Ross and reproduced on my tape machine.
2007-11-16convert code over from sd.c, to let tapes discollect. Lucas StefanuttiTheo de Raadt
of pr 5635 confirms this works for him. similar diff authored by krw who was unaware i wrote this and mailed it to Lucas...
2007-09-16A couple of obvious bzero() -> M_ZERO changes I missed.Kenneth R Westerback