summaryrefslogtreecommitdiff
path: root/sys/scsi
AgeCommit message (Collapse)Author
2008-07-08this makes the code in sdattach less dense by collapsing the flags we passDavid Gwynne
to all the scsi midlayer code into a local variable. ok krw@ marco@
2008-07-05When SCSIDEBUG'ing, print data about to be written (for commandsKenneth R Westerback
flagged SCSI_DATA_OUT) and data that has been returned (for commands flagged SCSI_DATA_IN). This is better than just printing the data buffer before the command is issued since that does not include any data that has been read. e.g. INQUIRY data, as thib@ and I discovered. ok marco@
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
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-06-21Oops. Forgot to actually change the retries in scsi_size() to SCSI_RETRIES.Kenneth R Westerback
2008-06-21fgsch@ points out my last commit changed the retry limit for CD capacityKenneth R Westerback
commands. Bump limit back to the standard 4, and at the same time eliminate SDRETRIES and CDRETRIES (both defined to 4) in favour of a new define, SCSI_RETRIES, also defined to 4.
2008-06-21Eliminate cd_size() and use scsi_size() + tweaked cd_get_params()Kenneth R Westerback
instead. We do not make use of the PMI and RELADDR bits in the READ CAPACITY command, and thus there is no difference between cd and sd capacity handling. Brings cd and sd more into line, shrinks code and makes things easier to understand. Make types for blocksize and disksize consistant and MI. Make cdopen() as silent as sdopen(). ok marco@
2008-06-17Nuke unnecessary re-definition of READ_CAPACITY, scsi_read_capacity, andKenneth R Westerback
scsi_read_cap_data as READ_CD_CAPACITY, scsi_read_cd_capacity and scsi_read_cd_cap_data respectively. No functional change as all were identical to their counterparts.
2008-06-15Treat SENSE_NOT_READY_INIT_REQUIRED sense errors the same asKenneth R Westerback
SENSE_NOT_READY_BECOMING_READY sense errors. Some devices such as USB Zip250 drives return the former when they mean the latter. Give the first TEST UNIT READY command three times the usual retries so more devices have time to get ready. This allows more removable devices to detect media details and avoid issuing 'drive offline' messages. ok marco@
2008-06-15Don't bypass partition bounds check for RAW_PART. We now guarantee thatKenneth R Westerback
RAW_PART will always be 0 -> disksize, so the bounds check will always pass for i/o's to valid addresses. Now the i/o will be properly truncated if it goes past the end of the device. This prevents various adverse impacts of issuing i/o's for data past the end of the device. Repeatedly requested by todd@. ok weingart@ deraadt@
2008-06-14Nuke ADEV_NOTUR, always issue TEST UNIT READY to clear out power-upKenneth R Westerback
errors before issuing INQUIRY. Fixes Sony YE-Data floppy drive and probably other devices at the cost of possibly breaking some 10 year old CD-ROM drives. Un-special cases mvme68k which was forcing these initial TURs. Now wait for the inevitable weird USB device that breaks to surface. ok marco@ deraadt@
2008-06-13Merge show_scsi_xs() and show_scsi_cmd() and move invocation so theKenneth R Westerback
debug output shows the xs/command before it's issued rather than displaying it on command completion. Some commands don't come back and it would be nice to see their details. While here nuke invocations of scsi_show* in umass. If you want SCSI debug output use SCSI debug options. Only affects SCSI debug output. ok marco@
2008-06-10Accidental commit. Clean up.Artur Grabowski
2008-06-10Buffer cache revampBob Beck
1) remove multiple size queues, introduced as a stopgap. 2) decouple pages containing data from their mappings 3) only keep buffers mapped when they actually have to be mapped (right now, this is when buffers are B_BUSY) 4) New functions to make a buffer busy, and release the busy flag (buf_acquire and buf_release) 5) Move high/low water marks and statistics counters into a structure 6) Add a sysctl to retrieve buffer cache statistics Tested in several variants and beat upon by bob and art for a year. run accidentally on henning's nfs server for a few months... ok deraadt@, krw@, art@ - who promises to be around to deal with any fallout
2008-06-10When copying stuff from code that runs with interrupts enabled to codeKenneth R Westerback
that may run without interrupts, don't forget to add scsi_autoconf to the flags and POLL for the result rather than wait for an interrupt that will never come. Fixes Dale's Iomega Jazz drive on the ahc here, and no doubt many other device combinations.
2008-06-02Don't spew sense errors (e.g. 'media not present') when probing aKenneth R Westerback
device. Fallout from doing better PREVENT ALLOW dance. Prodded by marco@ as a result of a report from Andreas Kahari on tech@.
2008-06-02Shrink scsi_mode_sense_buf to 254 bytes so ahci doesn't get upset atKenneth R Westerback
trying to dma-map odd length data areas. No other alignment should be required according to miod@. Makes my new SATA tape drive work. ok deraadt@
2008-05-27nuke unused lba2msf and msf2lba functions. krw@ ok.Federico G. Schwindt
2008-05-26Print SCSI initiator ID such that it is easier to spot configurationMark Kettenis
problems. ok krw@, marco@, deraadt@
2008-05-24SDEV_UMASS devices skip the mode page dance to set blksize. So initializeKenneth R Westerback
blksize to 0 to avoid confusing garbage values with useful info. Noticed by jolan@.
2008-05-22zap useless comment block with no content.Jasper Lievisse Adriaanse
ok krw@
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-09Lock in removable media while trying to determine the disk parameters. ThisKenneth R Westerback
should fix a number of 'drive offline' situations where the device claims it has no media loaded until the lock in occurs. Like a Blackberry Pearl Todd Fries found and probably other USB devices. Move the lock in during device open to before the test unit ready to eliminate similar spurious rejections of the device. Feedback from marco@, tests by todd@ and miod@. ok deraadt@ beck@ dlg@ miod@
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@
2008-04-24Say 'ATAPI' rather than 'SCSIn' for ATAPI devices found on (pseudo)Kenneth R Westerback
SCSI buses like atapiscsi. This more accurately describes the commands that will be used on the device. ok dlg@
2008-04-10fix the macros that are used to read the devid vpd page.David Gwynne
2008-03-21USB Floppies are umass devices so we always use the default 63/255Kenneth R Westerback
geometry. But 63 * 255 > 2880 and the cylinder count becomes 0. So if we end up with a valid disksize but 0 cylinders, set heads = cylinders = 1 and sectors-per-track = disksize.
2007-12-29the scsi layer always had function pointers for asking the hba about aDavid Gwynne
device before issuing scsi commands to it, but it was never implemented, never used, and no hba actually filled them in. i came along and added another two function pointers for the same thing. this cleans up the extra pointers. ok krw@ marco@ miod@ deraadt@
2007-12-28massage the way vpds are defined. rename the page used for the devicesDavid Gwynne
serial number and split the vpd header out for use in other places. while here define the device identification page bits too. ok krw@ marco@
2007-11-27typos; ok jmc@Martynas Venckus
sys/dev/pci/pciide.c from naddy@
2007-11-26let scsibus ask the adapter about a device before probing it. also allowDavid Gwynne
the adapter to be notified when a device goes away so it can free any state it maintains about that device. ok deraadt@ marco@
2007-11-25dont use the adapter_softc member of scsi_link as a softc anymore. theDavid Gwynne
"adapter_softc" is simply a way for the adapter to determine what scsibus it is now dealing with, not a pointer back to the adapters device struct. ok deraadt@ marco@
2007-11-23if we cant fetch the serial then fill it with "(unknown)".David Gwynne
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-11-11Revert useless textual optimization that resulted in 16 bytes beingKenneth R Westerback
sent to the adapter instead of the 10 bytes the scsi_sychronize_cache command actually occupies. This freaked out the ahc on jsing@'s SGI and probably others. Found, isolated, fix tested, and ok jsing@
2007-11-06Fix SDF_DIRTY handling, eliminate useless SDF_FLUSHING. The sd_flush()Kenneth R Westerback
called from the last sdclose() on a device will now reset SDF_DIRTY after submitting the SYNCHRONIZE CACHE command. sddone() need not worry about SDF_DIRTY since it was never called for the SYNCHRONIZE CACHE command anyway. This eliminates a spurious SYNCHRONIZE CACHE command being issued for every sd device from sd_shutdown(). ok dlg@
2007-09-16A couple of obvious bzero() -> M_ZERO changes I missed.Kenneth R Westerback
2007-09-16MALLOC/FREE -> malloc/free, M_ZERO, extraneous casts,Kenneth R Westerback
extraneous #include <malloc.h>
2007-09-15Allow to pull out an usb stick with ffs filesystem while mountedAlexander Bluhm
and a file is written onto the stick. Without these fixes the machine panics or hangs. The usb fix calls the callback when the stick is pulled out to free the associated buffers. Otherwise we have busy buffers for ever and the automatic unmount will panic. The change in the scsi layer prevents passing down further dirty buffers to usb after the stick has been deactivated. In vfs the automatic unmount has moved from the function vgonel() to vop_generic_revoke(). Both are called when the sd device's vnode is removed. In vgonel() the VXLOCK is already held which can cause a deadlock. So call dounmount() earlier. ok krw@, I like this marco@, tested by ian@
2007-09-07The obvious bzero/memset -> M_ZERO changes.Kenneth R Westerback
2007-06-24rework sensor tasks to use the kernels generic workq rather than a specialDavid Gwynne
kernel thread of its own. the api has changed (which will be fixed in the manpage shortly) so all the users of sensor tasks that i can find have been fixed too. noone tested, so its going in to force people to run with it. "put it in" deraadt@
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