Commit Graph

72 Commits

Author SHA1 Message Date
Hidetoshi Shimokawa
5b50d9ade7 MFp4:
* firewire
	- Remove pending list.
	- Ignore timeout for the FWXF_START state.
	- Define M_FWMEM for debugging.
	- Comment out DELAY() in fw_asybusy().
	- Improve debugging messages
* sbp
	- Freeze simq while bus reset.
2004-01-05 14:21:18 +00:00
Hidetoshi Shimokawa
39b2899f54 Improve debug message. 2003-11-12 04:06:21 +00:00
Hidetoshi Shimokawa
4a4bfb088e - Reserve a ocb for management ORB.
- Requeue XPT_SCSI_IO if ocb is short.
2003-11-12 03:45:10 +00:00
Hidetoshi Shimokawa
5414e3cfad Oops, fix typo in my name. 2003-11-12 03:29:57 +00:00
Hidetoshi Shimokawa
9b86b36df8 Reduce debug message. 2003-11-10 14:04:37 +00:00
Hidetoshi Shimokawa
4a431baa58 * Improve sbp device probe in boot process.
- Notify BUS RESET to CAM in sbp_attach().
	- Use last bus reset time to determine login delay.

Tested by: imura

* Add some sysctl MIB and tunables.
2003-11-10 03:51:23 +00:00
Hidetoshi Shimokawa
97b70925d0 Add a new sysctl MIB to control exclusive login. 2003-10-31 12:05:55 +00:00
Hidetoshi Shimokawa
5217c8c293 - Call sbp_reset_start() for mgm timeout.
- Change type of target->luns to allocate an array of LUNs dynamically.
	This allows targets to change their number of LUNs after each bus reset.
- Serialize ORB POINTER command for each LUN.
- Improve debug messages.
2003-10-18 04:59:47 +00:00
Hidetoshi Shimokawa
cb987496a3 - Implement sbp_poll() to enable kernel dump on SBP-2 device. 2003-10-06 05:40:47 +00:00
Hidetoshi Shimokawa
baaf74b248 - Fix timeout for unodered excution.
In unodered excution case, we cannot detect link-chain end only
	by prev == NULL if lastest ORB is executed earlyer than the former
	ORBs. Use ORB_LINK_DEAD flag for this case.

- Don't reset agent for management ORB.
- Improve debug messages.

Spotted by: sbp target mode
2003-10-06 03:44:37 +00:00
Hidetoshi Shimokawa
c4778b5d1c MFp4: Change struct fw_xfer to reduce memory copy in fwmem_*() functions.
And many changes.

* all
	- Major change of struct fw_xfer.
		o {send,recv}.buf is splitted into hdr and payload.
		o Remove unnecessary fields.
		o spd is moved under send and recv.
	- Remove unnecessary 'volatile' keyword.
	- Add definition of rtcode and extcode.

* firewire.c
	- Ignore FWDEVINVAL devices in fw_noderesolve_nodeid().
	- Check the existance of the bind before call STAILQ_REMOVE().
	- Fix bug in the fw_bindadd().
	- Change element of struct fw_bind for simplicity.
	- Check rtcode of response packet.
	- Reduce split transaction timeout to 200 msec.
		(100msec is the default value in the spec.)
	- Set watchdog timer cycle to 10 Hz.
	- Set xfer->tv just before calling fw_get_tlabel().

* fwohci.c
	- Simplifies fwohci_get_plen().

* sbp.c
	- Fix byte order of multibyte scsi_status informations.
	- Split sbp.c and sbp.h.
	- Unit number is not necessary for FIFO¤ address.
	- Reduce LOGIN_DELAY and SCAN_DELAY to 1 sec.
	- Add some constants defineded in SBP-2 spec.

* fwmem.c
	- Introduce fwmem_strategy() and reduce memory copy.
2003-10-02 04:06:56 +00:00
Hidetoshi Shimokawa
16acf1a3f1 Fix byte order of multi-byte scsi_status information. 2003-08-29 13:36:17 +00:00
Hidetoshi Shimokawa
7e711d0d8d Include order bit in sdev->type. 2003-08-21 08:40:31 +00:00
Hidetoshi Shimokawa
3722fcec4b - Disable faking T_DIRECT as T_RBC because we have PIM_NO_6_BYTE now. 2003-08-01 02:24:39 +00:00
Nate Lawson
1deac58179 Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to
receive 6 byte commands.  Add a check for this flag to da(4) and cd(4) so
that they honor it.  This is a quick workaround for many devices (especially
USB) that require da(4) quirks to operate.  The more complete approach is
to finish the new transport code which will be aware of the SCSI version a
transport implements.

MFC after:	1 day
2003-07-28 06:15:59 +00:00
Hidetoshi Shimokawa
9547314f7c Clean up include files. 2003-07-18 14:31:16 +00:00
Hidetoshi Shimokawa
4f93346871 Add compatibility for FreeBSD-4. 2003-07-04 14:04:41 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Hidetoshi Shimokawa
0d3432eca7 Revert previos change for prior release/branch. 2003-06-16 03:44:36 +00:00
Nate Lawson
2813692cc2 Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry.

* Due to a bug, aic(4) never used extended geometry.  Changes all drives
  >1G to now use extended translation.
* sbp(4) drives exactly 1 GB in size now no longer use extended geometry.
* umass(4) drives exactly 1 GB in size now no longer use extended geometry.

For all other controllers in this commit, this should be a no-op.

Looked over by:	scottl
2003-06-14 22:17:41 +00:00
Hidetoshi Shimokawa
de7f8045e0 Don't call sbp_do_attach() recursively after agent reset
while device probing.
2003-06-03 23:01:43 +00:00
Hidetoshi Shimokawa
96c7c6dd58 Make it compiled on 4-stable.
Approved by: re (scottl)
2003-05-12 00:42:28 +00:00
Hidetoshi Shimokawa
d7398f2363 Write to RESET_START register if TARGET_RESET ORB doesn't work for timeout. 2003-05-05 14:50:24 +00:00
Jake Burkholder
eadb8f358b Fix printf format errors. 2003-05-02 17:21:07 +00:00
Hidetoshi Shimokawa
e47276e59c Fix printf warning caused by recent CAM change. 2003-05-01 03:38:04 +00:00
Hidetoshi Shimokawa
98465499f8 Release devq before detach. 2003-04-30 10:32:32 +00:00
Hidetoshi Shimokawa
45800373db Add missing crom_next() in the previous revision. 2003-04-29 23:40:04 +00:00
Hidetoshi Shimokawa
fd59632766 Get correct firmware/model information for multiple unit directories. 2003-04-29 15:01:01 +00:00
Hidetoshi Shimokawa
5e286c3211 - Improve configuration ROM parser for multiple unit directory.
- Remove getcsrdata().
- Don't print device type, this can be obtained by fwcontrol.

Tested with: Maxtor 5000XT
Tested by: Daniel O'Connor <doconnor@gsoft.com.au>
2003-04-26 16:45:40 +00:00
Hidetoshi Shimokawa
a2da26fc1d Fix printf warnings for i386 with PAE.
Submitted by: harti
2003-04-24 15:27:06 +00:00
Hidetoshi Shimokawa
77ee030b5f MFp4(simokawa_firewire):
Many internal structure changes for the FireWire driver.

- Compute CRC in CROM parsing.
- Add support for configuration ROM build.
- Simplify dummy buffer handling.
- busdma conversion
- Use swi_taskqueue_giant for -current.  Mark the interrupt routine as MPSAFE.
- AR buffer handling.
	Don't reallocate AR buffer but just recycle it.
	Don't malloc and copy per packet in fwohci_arcv().
	Pass packet to fw_rcv() using iovec.
	Application must prepare receiving buffer in advance.
- Change fw_bind API so that application should pre-allocate xfer structure.
- Add fw_xfer_unload() for recycling struct fw_xfer.
- Add post_busreset hook
- Remove unused 'sub' and 'act_type' in struct fw_xfer.
- Remove npacket from struct fw_bulkxfer.
- Don't call back handlers in fwochi_arcv() if the packet has
	not drained in AT queue
- Make firewire works on big endian platform.
- Use native endian for packet header and remove unnecessary ntohX/htonX.
- Remove FWXFERQ_PACKET mode.  We don't use it anymore.
- Remove unnecessary restriction of FWSTMAXCHUNK.
- Don't set root node for phy config packet if the root node is
	not cycle master capable but set myself for root node.
	We should be the root node after next bus reset.

	Spotted by: Yoshihiro Tabira <tabira@scd.mei.co.jp>
- Improve self id handling

Tested on: i386, sparc64 and i386 with forced bounce buffer
2003-04-17 03:38:03 +00:00
Hidetoshi Shimokawa
050871cc4f Panic if bus_dmamap_load() doesn't respect maxsegsz. 2003-04-14 14:17:49 +00:00
Hidetoshi Shimokawa
d067ce208d Put back including sys/devicestat.h for 4-stable. 2003-03-12 10:36:53 +00:00
Poul-Henning Kamp
60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Hidetoshi Shimokawa
0fc9ced053 Fix printf warning on RELENG_4. 2003-03-04 06:47:17 +00:00
Hidetoshi Shimokawa
46ce9fefe5 Simplify ORB queue management.
Don't send doorbell and send ORB pointer only if it's necessary.
This reduces bus traffic and interrupts much.
2003-03-03 15:27:29 +00:00
Hidetoshi Shimokawa
37413f0a0f Don't reset agent before processing OCB has done. 2003-03-01 16:50:40 +00:00
Hidetoshi Shimokawa
455454994f MFp4(simokawa_sbp branch)
Improve SBP device probeing:
- Wait 2 sec before issuing LOGIN ORB expecting the reconnection
	hold timer expires.
- Serialize management ORB and scanning LUN by CAM on each target.
	This should fix the problem for devices which have multiple LUNs.
	Test device is donated by: Jaye Mathisen <mrcpu@internetcds.com>
- Freeze SIM queue for 2 sec after BUS RESET.
- Retry with LOGIN rather than RECONNECT after LOGIN is not completed for
	BUS RESET.
- Use appropriate CAM status for BUS RESET and DEVICE RESET.
- Let CAM to scan targets after BUS REST.
- Implement CAM scan target function.
- Keep our own devq freeze count.
- Let CAM to know that SBP does tagged queuing.

These should be merged to RELENG_4 before 4.8-RELEASE.
2003-02-27 12:51:24 +00:00
Hidetoshi Shimokawa
41dc7a9831 Oops, forgot to put back debug level. 2003-02-21 02:27:13 +00:00
Hidetoshi Shimokawa
d17c7743c6 Don't scan lun by myself while boot process leave it CAM to scan the bus.
Some drives seem to be confused by simultaneous probes.

Tested by: marcel

As a side effect, logical units whose lun is greater than 0 might not be
probed correctly if the lun of 0 doesn't exist in the target because
CAM doesn't scan such luns.
I have a SCSI-FireWire bridge which maps SCSI-ID to LUN and it is an
example of such targets.
2003-02-21 02:09:04 +00:00
Hidetoshi Shimokawa
f918ec7bac * firewire.c
- Don't initiate bus reset even if probe failed for some nodes to prevent
	infinite bus reset loop.

Problem Reported by: Pierre Beyssac <pb@fasterix.frmug.org>

- Protect timeout routine with splfw() for 4-stable.

* sbp.c

- Make sure to release devq when start request.
2003-02-17 14:24:06 +00:00
Hidetoshi Shimokawa
f3d2847dd0 - Though I got a feedback from the originator of kern/48129 that the
previous revision fixed the panic, I found the problem exits in
another part of the function by investigating the crom dump sent by him.
The search was started in the middle of bus info block and the
routine misunderstood the EUI64 as a crom entry. This problem is fixed.

PR: kern/48129

Fix incorrect type mask included in a logical unit number and check
the validity of the lun.
2003-02-14 03:09:59 +00:00
Hidetoshi Shimokawa
627d85fbdd firewire/fwohci
- Drain fwohci TX queue first then drain xfer queue which has not started.
- Check validity of the received packet length.
- Don't allocate too large buffer for xfer receive buf.

sbp
- Fix panic for some CROM which doesn't have a text leaf.
	This could fix the PR kern/48129 but no feedback has been gotten from
	the originator yet.
- Put back some M_NOWAIT flags into malloc which could be called
	in interrupt context for 4-stable.
2003-02-13 13:35:57 +00:00
Hidetoshi Shimokawa
5a8d8970be Remove unnecessary check for OCB_ACT_CMD. 2003-02-09 07:40:27 +00:00
Hidetoshi Shimokawa
a487c0f261 - Improve recovery after timeout.
* reset agent first then reset target.
	* untimeout all ccbs.
- Try reconnect first if the device has been seen.
- Fix for ORB_FUN_ATA.
2003-02-04 17:08:45 +00:00
Hidetoshi Shimokawa
48249fe0c8 - Take malloc type as an argument in fw_xfer_alloc().
- Fix overwrite problem of freed buffers. It was rare but could happen
	when fwohci_arcv() is called before fwohci_txd() is called for
	the transcation.
- Drain AT queues and pend AR queues on SID receive rather than BUS reset to
	make sure DMA actually stops.
- Do agent reset in sbp_timeout().
2003-02-03 07:33:31 +00:00
Hidetoshi Shimokawa
5166f1df39 Define new malloc type M_FW and use it. 2003-02-01 15:04:33 +00:00
Hidetoshi Shimokawa
0981f5f00e - replace timeout with callout_*.
- replace TAILQ with STAILQ for device list.
- some clean up.
2003-02-01 14:42:49 +00:00
Hidetoshi Shimokawa
3c62126d84 Check status FIFO more closely to report error. 2003-02-01 12:06:57 +00:00
Hidetoshi Shimokawa
0db3d1635c Add basic support for device wiring down to specific (CAM)
target id. It still needs to be hard-coded now but will
be changed to be configured by tunables or device hints.
2003-02-01 08:55:33 +00:00