Commit Graph

239 Commits

Author SHA1 Message Date
simokawa
97a674e005 * fwohci_pci.c
Improve error message for attach failure.

* sbp_targ.c
	- Add speed in struct sbp_targ_login.
	- Remove unnecessary htonl().
2004-01-23 17:37:09 +00:00
simokawa
9c3cf58a7c Add missing free() in exception handlers.
Reported by:    Stanford Metacompilation research group
2004-01-22 14:41:17 +00:00
simokawa
9d375cd3f6 Sync type of linkspeed with firewire.c. 2004-01-11 15:40:42 +00:00
simokawa
24c56fbd9f * firewire
Add tcode_str[] and improve debug message.
* sbp
	If max_speed is negative, use the maximum speed which the
	ohci chip supports.  The default max_speed is -1.
* if_fwe
	If tx_speed is negative, use the maximum speed which the
	ohci chip supports.  The default tx_speed is 2.
2004-01-08 14:58:09 +00:00
simokawa
51884c3a8f Remove __P(). 2004-01-06 14:30:47 +00:00
simokawa
c560e3e9a3 Fix register mis-alignment introduced in rev1.12. 2004-01-06 14:24:01 +00:00
simokawa
1c0b417dbd 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
peter
6ef2d701eb Catch a few places where NULL (pointer) was used where 0 (integer) was
expected.
2003-12-23 02:36:43 +00:00
simokawa
b50ca15232 Fix panic.
- Don't call sbp_targ_status_FIFO() twice for LOGIN error.
- Don't access login if it's NULL.
2003-12-13 15:33:45 +00:00
simokawa
a25a871c3c MFp4:
- Introduce sbp_targ_login instead of sbp_targ_istate.
- Implement reconnection and logout.
- Freeze simq while bus reset.
2003-12-11 03:42:40 +00:00
imp
681047fce1 Sometimes cardbus attachments don't attach, so while we track down
this problem put these lines back in.  While they should be
unnecessary, they appear to be sometimes necessary.

Reviewed in concept: dfr
Approved by: re (scottl@)
2003-11-28 05:28:29 +00:00
simokawa
9ca7055108 Add tunables. 2003-11-13 06:29:40 +00:00
simokawa
0210fa91be Improve debug message. 2003-11-12 04:06:21 +00:00
simokawa
ebce6ea33e - Reserve a ocb for management ORB.
- Requeue XPT_SCSI_IO if ocb is short.
2003-11-12 03:45:10 +00:00
simokawa
f2f211e88d Oops, fix typo in my name. 2003-11-12 03:29:57 +00:00
simokawa
a1e03fed76 Reduce debug message. 2003-11-10 14:04:37 +00:00
simokawa
c34786a050 * 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
tanimura
6906857f32 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +00:00
simokawa
0e272354da Allow shared open of /dev/fwmem* for read-only. 2003-11-07 12:39:39 +00:00
simokawa
69bbca8dc8 Respect a return code of fwmem_open(). 2003-11-07 12:30:57 +00:00
simokawa
e1600e87de Increase FWMAXQUEUE up to 128. 2003-11-07 09:01:41 +00:00
simokawa
0b9b2ff851 Add compatibility for 4-stable.
Submitted by: imura
2003-11-07 08:59:35 +00:00
simokawa
c0541f794a Use if_printf() for FWEDEBUG. 2003-11-06 04:19:15 +00:00
simokawa
27cdf48bcb - Change driver name to fix if_xname breakage in the previous revision.
- Don't call device_get_unit() twice.

Tested by: nork
2003-11-03 13:01:23 +00:00
dfr
ae13306183 Remove explicit cardbus attachments from drivers where this is identical
to the pci attachment. Cardbus is a derived class of pci so all pci
drivers are automatically available for matching against cardbus devices.

Reviewed by: imp
2003-11-03 09:22:18 +00:00
brooks
4290fbacd1 Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
simokawa
a8bc5fa79e Add a new sysctl MIB to control exclusive login. 2003-10-31 12:05:55 +00:00
simokawa
5ce8d909a0 Reject too large OHCI version number.
Invalid OHCI version indicates OHCI registers are not mapped
correctly in PCI or CardBus layer.
2003-10-31 05:05:12 +00:00
simokawa
d059115021 Add a compatibility macro for FreeBSD-4. 2003-10-31 04:58:03 +00:00
simokawa
f930fc1d8f Fix fwmem_strategy() race in 4-stable. 2003-10-25 15:05:59 +00:00
simokawa
64f71bd2a3 Move validity check of 'xfer->fc != NULL' to right place. 2003-10-25 15:04:49 +00:00
simokawa
054da3bf6c Fix for FW_ASYREQ.
- set send.pay_len correctly.
- copy response only if needed.
- remove unnecessary 'err = 0'.
2003-10-24 13:55:51 +00:00
simokawa
2c1b1a2988 Don't check timeout just after booted.
Some transactions could be considered wrongly to be timeout
bacause interrupts are disabled during boot process.
2003-10-24 07:42:21 +00:00
simokawa
01a6d5b552 Reduce debug messages. 2003-10-23 01:55:03 +00:00
simokawa
e3381170cf Add SBP-II target mode driver.
Though this is still incomplete and has some missing features such as
exclusive login and event notification, it may be enough for someone
who wants to play with it.

This driver is supposed to work with firewire(4), targ(4) of CAM(4)
and scsi_target(8) which can be found in /usr/share/example/scsi_target.
This driver doesn't require sbp(4) which implements initiator mode.

Sample configuration:

Kernel: (you can use modules as well)
device	firewire
device	scbus
device	targ
device	sbp_targ

After reboot:
# mdconfig -a -t malloc -s 10m
md0
# scsi_target 0:0:0 /dev/md0
(Assuming sbp_targ0 on scbus0)

You should find the 10MB HDD on FreeBSD/MacOS X/WinXP or whatever connected
to the target using FireWire.

Manpage is not finished yet.
2003-10-18 05:41:31 +00:00
simokawa
752f7e6b76 - 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
simokawa
601ff74c0a - Introduce hw.firewire.hold_count sysctl MIB by popular demand.
This MIB specifies how many bus resets should be observed before the
lost device entry is removed. The default value is 3.
You can set this value to 0 if you want a SBP device to be detached from CAM
layer as soon as the device is physically detached like USB.
2003-10-06 07:17:43 +00:00
simokawa
b349bb039b - Implement sbp_poll() to enable kernel dump on SBP-2 device. 2003-10-06 05:40:47 +00:00
simokawa
c3a2a5ac08 - 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
simokawa
198b7fae41 Remove wrong usage of BUF_REFCNT().
Spotted by: phk
2003-10-02 14:33:30 +00:00
simokawa
0c1b10fee8 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
simokawa
107695b878 Fix a bug in fwdev_clone().
Spotted by: grog
2003-10-01 06:04:30 +00:00
simokawa
189261ea09 Phy register map. 2003-09-25 09:27:05 +00:00
simokawa
2439227004 Fix byte order of multi-byte scsi_status information. 2003-08-29 13:36:17 +00:00
obrien
c8e9653b1c Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
simokawa
ad0e2ca28e Make this compiled on RELENG_4. 2003-08-22 07:33:20 +00:00
simokawa
7a493e8316 Comment out verbose debug messages. 2003-08-22 07:30:41 +00:00
imp
0886a6ee43 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 05:54:52 +00:00
simokawa
a837c0437f Include order bit in sdev->type. 2003-08-21 08:40:31 +00:00
simokawa
9ff6f74ef6 Fill reserved fields of transmitting packets header with zero.
This fixes the if_fwe problem with 1394b chip.

PR and Tested by: nork
2003-08-20 03:11:37 +00:00