summaryrefslogtreecommitdiff
path: root/sys/dev/ic/siop.c
AgeCommit message (Collapse)Author
2003-10-21typos from Tom Cosgrove;Jason McIntyre
Tom: I did not commit a couple of your changes. i did not include some punctuation fixes (full stops, etc.) mnemorable -> mnemonic: i decided memorable was probably better instrunctions -> instruction: i kept the plural
2003-10-09go back to non-raw busdma load as some archs still do not have load_rawMichael Shalayeff
2003-09-29e own SIOP_DEBUG define instea of the system-wide one;Michael Shalayeff
bzero() the sgl before fillig it up; avoid reading registers extra times where we have a copy in the vars; on scsi_cmd timeout call siop_handle_reset() directly instead of relying on the RST interrupt which does not happen always it semms; use bus_dmamap_load_raw(). krw@ ok
2003-07-01Don't dma map the xs->cmd. Copy it to a safe buffer that is alreadyKenneth R Westerback
mapped and sync'ed appropriately, and is guaranteed to be in one memory page. Eliminate now unused dmamap_cmd and rs_cmd fields. Fix another error message (adding active command to reset list) so that it includes the adapter name. Add missing letoh32() calls to debug code. The evils of directly mapping *xs->cmd were pointed out by Mickey during osiop development. In particular, *xs->cmd may start on one memory page and run into the next. Since the dma logic in most cards/drivers (including siop) only allocates one address/size pair to map *xs->cmd, parts of a command could be lost or corrupted. The large number of 6 byte dma mappings noted long ago by someone (Henric?). This change reduces the dma mapping activity per i/o by 1/3 to 1/2 and may give a performance boost of some kind. Successfully tested on i386, sparc64 (ultra30 - thanks Jolan, blade100), macppc and alpha. Unfortunately these changes don't fix the Blade1000 siop problems. **NOTE** If scsi_generic is ever upped to 16 bytes the offsets in siop.ss must be updated!
2003-06-28Fix a bug which would promote a target from TARST_PROBING toKenneth R Westerback
TARST_ASYNC if a bus reset occurred while in TARST_PROBING. Improve DMA IRQ error message to always display the adapter name. Correct an indent botch. All of which doesn't help the Blade1000 boot, though it is now both less noisy and more informative.
2003-06-09Fix erroneous handling of i/o's during a reset.Kenneth R Westerback
a) Set xs->status rather than cmd_tables->status because there will be no interrupt processing to move it from cmd_tables->status to xs->status. b) Set cmd_c.status to correct value (CMDST_SENSE_DONE) when an active sense command is reset. c) Don't put a reset command from the ready queue into the free_list twice, once in siop_scsicmd_end() and once manually. Condition a) meant that the scsi layer was seeing successfully completed i/o's (xs->error == XS_NOERROR) when they were in fact reset and should have had xs->error == XS_TIMEOUT or xs->error == XS_RESET. This meant lost data on output, and random or zero'ed data on input. Condition b) meant that the wrong bus_dmamap_sync() was called, though the actual action was apparently identical. Condition c) meant that the free_list could become corrupt. The problem was discovered by pb@ on a heavily loaded server that experienced timeouts. This fix was tested by pb@ and henric@ to prove it did not affect normal processing. If nothing else it will provide better error messages if the problem is ever encountered again. Probably a good candidate for -stable if pb@ can successfully reproduce his timeout problems and not have his server crash.
2003-01-21bzero() siop_target structure after malloc().Kenneth R Westerback
In combination with previous openings fix makes Niklas happy. Probably fixes some negotiation bugs too. Another good candidate for -stable.
2002-12-23Fix complete botch in handling of 'openings'.Kenneth R Westerback
Assign a fixed value (SIOP_NTAGS) to the openings field in the adapter's template sc_link, rather than incrementing the value as cbd's are allocated. The template value is the one copied into each device's sc_link structure as it is created. Incrementing the value meant that each new device got a larger value for openings. The total number of openings claimed by devices on a bus soon exceeded the number of cbd's available. e.g. after 5 devices there would be 132 allocated cbd's, but the total number of openings claimed by devices would be 300. A heavy i/o load on an adapter with multiple devices could have caused the upper scsi layer to try to queue more i/o's than the driver had cbd's to store them in. Such i/o's would fail with EIO if they were started with SCSI_NOSLEEP (e.g. sdstart()) or were not queued within the specified retry limit. I/o's for devices 'later' on the bus would be more likely to trigger this behaviour, due to their inflated openings values. This is good candidate for -stable.
2002-11-16From NetBSD (bouyer@):Kenneth R Westerback
In siop_reset(), reset sc_ntargets to 0. The number of targets will be computed again in siop_add_reselsw(). In siop_reset(), reset the tag reseloff to 0, in addition to the lun reseloff. If siop_add_dev() fails this time we would use the old reseloff, clobbering memory now used for something else.
2002-09-16Resync siop with NetBSD. Make strong effort to minimizeKenneth R Westerback
differences, undoing whitespace, spelling, etc. changes and adopting the NetBSD code instead of equivalent home grown code for PPR negotiation, etc. siop.c 1.21 -> 1.64 siop_common.c 1.12 -> 1.30 siopreg.h 1.7 -> 1.13 siopvar.h 1.13 -> 1.18 siopvar_common.h 1.10 -> 1.21 ncr53cxxx.c 1.5 -> 1.10 siop.ss 1.12 -> 1.17 siop_pci.c 1.8 -> 1.11 siop_pci_common.c 1.6 -> 1.17 siop_pci_common.h 1.2 -> 1.4 Many fixes, add 1010-66 support, restructure things to prepare for addition of esiop, osiop and oosiop drivers. tested on various archs by art@, millert@, wilfried@, jason@, Dan Weeks. ok deraadt@.
2002-07-20If we call siop_intr manually, make sure it's protected by splbio.Artur Grabowski
My filesystem has been chopped to pieces.
2002-06-09fix the use of "cuz" in the tree; these are all in commentsJason Peel
noticed by aaron@, recommended by deraadt@
2002-03-14First round of __P removal in sysTodd C. Miller
2002-01-23Use the size of the cmd dmamap when syncing the scsi command, not data size.Per Fogelstrom
OK krw@
2001-11-05Switch everything to the new bus_dmamap_sync API.Artur Grabowski
Most work by Wilbern Cobb <vedge@csoft.org> with some fixes from me, mickey@ and drahn@.
2001-10-30From NetBSD: add __packed__ attribute to hardware structure thatKenneth R Westerback
lacked it (scr_table). Also remove scr_table_t typedef and just use 'struct scr_table' to be consistant with all other structures.
2001-10-26Allocate an appropriate number of cbd's for each discovered LUNKenneth R Westerback
at probe time, rather than allocating them dynamically as SCSI commands are started. This should eliminate one possible way of calling bus_dmamem_map() while in interrupt context. Potential problem spotted by Art@. Inspired by changes to achieve same effect in NetBSD by bouyer@.
2001-10-08Complete (I hope) the changes to siop that make it pay attentionKenneth R Westerback
to the quirks table. These latest changes, triggered by problems Dan Weeks was having and developed with a lot of testing by Dan, should ensure that siop is a) using the quirks of the correct LUN during wide/sync negotiations and b) calling siop_add_dev() for all LUN's which return valid information from an INQUIRY command.
2001-08-26Prepare for transition to 5-parameter bus_dmamap_sync() by creating andKenneth R Westerback
using *_bus_dmamap_sync() defines that are defined appropriately depending on __HAS_NEW_BUS_DMAMAP_SYNC. Most of the code changes are simple reversions to the original NetBSD code. Slip in a siop_script_sync() instead of a manually done code section.
2001-08-18Make siop pay attention to quirks table. This not only eliminates theKenneth R Westerback
ugly INQUIRY snooping but avoids adding even uglier #ifdef's to turn off stuff, e.g. tagged queuing. Add two disk drives now known to lie about supporting tagged queuing to quirks table. One from millert@ (<MICROP, 4421-07 0329SJ, 0329>) and one from Hakan Olsson (<SEAGATE, ST150176LW, 0002>). Add field 'inquiry_flags2' to struct scsi_link to hold flags2 field from struct scsi_inquiry_data. These flags relate to SCSI-3 specific features. Clean up some logic, eliminating need for TARF_PPR flag.
2001-07-04Embedding newlines in strings is a bad idea, and prints out badly.Marc Espie
Okay millert@, like previous commit.
2001-06-25Revert change to using sc_link in calls to siop_print_info().Kenneth R Westerback
sc_link->device_softc not necessarily available for devices like cd's that don't issue SCSI commands after INQUIRY during probe, leaving negotiation triggering to next LUN. Spotted by Nikolay Sturm. Fixing this is not worth the effort and added complexity for a cosmetic improvement. Keep code cleanups done at the same time, and add a typo fix (destiation -> destination).
2001-06-24Remove an over-optimization from the polling loop of siop_scsicmd(),Kenneth R Westerback
i.e. calling siop_print_info() immediately for async devices. With the change to use xs->sc_link as parameter to siop_print_info() this immediate call wouldn't work as the sc_link is not initialized until AFTER the return from processing the INQUIRY command. So, just use the default negotiation logic which is triggered by the next command to be handled.
2001-06-24Pass the device's scsi_link to siop_print_info(), instead of theKenneth R Westerback
adapter's siop_softc. This allows easy access to the dv_xname of the device whose negotiation results are being reported. This makes boot probe and subsequent log messages clearer. e.g. message will now read sd0: negotiated tagged 16 bit 20 MHz 16 REQ/ACK offset xfers instead of siop0: target 0 now using tagged 16 bit 20 MHz 16 REQ/ACK offset xfers Clean up siop_print_info() a bit as long as we are there.
2001-04-23Clean up supposedly 'impossible' case in siop_intr() soKenneth R Westerback
a) meaningful but not voluminous debug info is printed and clearly associated with the offending siop bus. b) instead of panic'ing, reset the scsi bus and return. This problem was only seen under heavy load on powerpc. Plus fix one typo (exeption -> exception). ok deraadt@
2001-04-15Support U160 on 53c1010 chips.Kenneth R Westerback
Add support for PPR negotiations and DT transfers, and the preservation and restoration of the SCNTL4 register which controls Ultra3 transfers. Redo sync lookup, since the same period factor can mean two things depending on whether you are using DT or ST. Keep a minimum allowed ST period factor, and a minimum allowd DT period factor for each adapter. Currently NO support for QAS or IUS or AIP.
2001-03-061) Enable tag queuing.Kenneth R Westerback
2) Negotiate and report wide/sync only after INQUIRY results known. 3) Clean up wide/sync negotiation code a bit, ensuring that an agressive target does not prematurely force negotiation before the INQUIRY is done. Seen by millert@. 4) Ensure that a wide negotiation always resets the sync settings to async. 5) Some error message improvements from thorpej@NetBSD. 6) Some KNF. 7) Print wide/sync negotiation results after each completed negotiation. 8) Print some relevant information just before a panic that should never happen. But does on PowerPC.
2001-03-01Typo police: various misspelling, capitalizations, etc.Kenneth R Westerback
2001-02-20If you can't do wide xfers, don't tempt the targets by offeringKenneth R Westerback
it. They might not turn you down. Spotted by drahn@.
2001-02-20Tone down the verbosity level on the siop driver, print negotiationKenneth R Westerback
results on one line, during boot polling only. Force wide/sync negotiations for all targets during boot. Delete extraneous name field and associated strings that duplicate info provided in INQUIRY data. Actually timeout during polling rather than wait forever for ITSDONE. Remove unneeded check for SCSI_POLL before calling scsi_done(). Makes logic conform to other drivers.
2001-02-15Import siop, a replacement for the ncr SCSI driver, from NetBSD.Kenneth R Westerback
Written for NetBSD by Manuel Bouyer. Tested with various cards on i386 and alpha. Outstanding issue: doesn't work with PowerPC yet.