Commit Graph

373 Commits

Author SHA1 Message Date
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
Seigo Tanimura
512824f8f7 - 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
Hidetoshi Shimokawa
132e28bd75 Allow shared open of /dev/fwmem* for read-only. 2003-11-07 12:39:39 +00:00
Hidetoshi Shimokawa
3a927c871a Respect a return code of fwmem_open(). 2003-11-07 12:30:57 +00:00
Hidetoshi Shimokawa
30177c8168 Increase FWMAXQUEUE up to 128. 2003-11-07 09:01:41 +00:00
Hidetoshi Shimokawa
34ea46a73b Add compatibility for 4-stable.
Submitted by: imura
2003-11-07 08:59:35 +00:00
Hidetoshi Shimokawa
ed32ba839e Use if_printf() for FWEDEBUG. 2003-11-06 04:19:15 +00:00
Hidetoshi Shimokawa
5e7c89e488 - 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
Doug Rabson
0be389f3ca 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 Davis
9bf40ede4a 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
Hidetoshi Shimokawa
97b70925d0 Add a new sysctl MIB to control exclusive login. 2003-10-31 12:05:55 +00:00
Hidetoshi Shimokawa
ff04511e01 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
Hidetoshi Shimokawa
b2d0deb2ce Add a compatibility macro for FreeBSD-4. 2003-10-31 04:58:03 +00:00
Hidetoshi Shimokawa
65290832bd Fix fwmem_strategy() race in 4-stable. 2003-10-25 15:05:59 +00:00
Hidetoshi Shimokawa
a4468d6352 Move validity check of 'xfer->fc != NULL' to right place. 2003-10-25 15:04:49 +00:00
Hidetoshi Shimokawa
102ebc1f95 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
Hidetoshi Shimokawa
ad5c39fe2a 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
Hidetoshi Shimokawa
61ba65809d Reduce debug messages. 2003-10-23 01:55:03 +00:00
Hidetoshi Shimokawa
e9e688e243 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
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
bdc0dba68b - 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
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
c44a734c56 Remove wrong usage of BUF_REFCNT().
Spotted by: phk
2003-10-02 14:33:30 +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
c727011a76 Fix a bug in fwdev_clone().
Spotted by: grog
2003-10-01 06:04:30 +00:00
Hidetoshi Shimokawa
aed9eb791a Phy register map. 2003-09-25 09:27:05 +00:00
Hidetoshi Shimokawa
16acf1a3f1 Fix byte order of multi-byte scsi_status information. 2003-08-29 13:36:17 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Hidetoshi Shimokawa
2109dbc4e5 Make this compiled on RELENG_4. 2003-08-22 07:33:20 +00:00
Hidetoshi Shimokawa
1a75370022 Comment out verbose debug messages. 2003-08-22 07:30:41 +00:00
Warner Losh
4fbd232c86 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
Hidetoshi Shimokawa
7e711d0d8d Include order bit in sdev->type. 2003-08-21 08:40:31 +00:00
Hidetoshi Shimokawa
a1c9e73ab8 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
Hidetoshi Shimokawa
98b8dc587d Remove unused code. 2003-08-19 08:59:07 +00:00
Hidetoshi Shimokawa
29b187dc39 Drop too short packets. 2003-08-19 08:50:35 +00:00
Hidetoshi Shimokawa
f9c8c31d33 Allow to access phy registers via ioctl(). 2003-08-19 08:47:49 +00:00
Hidetoshi Shimokawa
f40a29157e Validate number of iso. DMA channels. 2003-08-12 13:01:27 +00:00
Hidetoshi Shimokawa
a160e00e41 Change device name notation.
- /dev/fw{,mem}X.Y represents the Y'th unit on the X'th bus.
- /dev/fw{,mem}X is an alias of fw{,mem}X.0 for compatibility.
- Clone devices.
2003-08-05 03:11:39 +00:00
Hidetoshi Shimokawa
183498934b - Don't mess with TX queue in fwohci_stop() if we failed to attach the device.
Tested by: wilko

- Detect memory mapping failure of registers by checking OHCI version.

Tested by: KONDOU, Kazuhiro <kazuhiro@alib.jp>
2003-08-04 05:43:02 +00:00
Hidetoshi Shimokawa
9925de2808 Workaround for gcc on alpha/ia64.
(warning: `xferq' might be used uninitialized in this function)
2003-08-01 17:19:12 +00:00
Hidetoshi Shimokawa
6cada79a78 Clean up fwdev.
Allocate iso DMA channel dynamically.  This allows us to have more
/dev/fw* than number of DMA channels for asyn. transactions and etc.
2003-08-01 04:51:21 +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
Hidetoshi Shimokawa
6a3f229e17 - Detect full of DMA channel correctly. 2003-08-01 02:13:25 +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
Peter Wemm
abe9725e8c Fix some recently introduced warnings. 'Declaration does not declare
anything' etc.
2003-07-26 03:47:56 +00:00
Hidetoshi Shimokawa
9547314f7c Clean up include files. 2003-07-18 14:31:16 +00:00
Hidetoshi Shimokawa
086a638ef6 Add some debug messages. 2003-07-18 05:28:30 +00:00
Hidetoshi Shimokawa
d7e486b41d Allow retrieval of local Configuration ROM. 2003-07-12 09:34:44 +00:00
Hidetoshi Shimokawa
4d4e204a98 Configuraiton ROM fix:
- Don't bump the generation if ROM has not changed and keep it
	between 0x2 and 0xf.
- Refetch the ROM if CRC of the businfo block has changed.
2003-07-09 13:07:35 +00:00
Hidetoshi Shimokawa
4f93346871 Add compatibility for FreeBSD-4. 2003-07-04 14:04:41 +00:00
Warner Losh
fa4b32fa80 All current uses of pci_set_powerstate are bogus, at least in theory.
However, they are presently necessary due to bigger bogusness in the
pci bus layer not doing the right thing on suspend/resume or on
initial device probe.  This is exactly the sort of thing that the
BURN_BRIDGES option was invented for.  Mark all of them as
BURN_BRIDGES.  As soon as I have the powerstate stuff properly
integrated into the pci bus code, I intend to remove all these
workarounds.
2003-07-03 14:00:57 +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
2c56e6e419 Fix tsleep/wakup race on FreeBSD-4. 2003-07-01 12:03:54 +00:00
Hidetoshi Shimokawa
170e7a20d0 Include file clean up. 2003-06-30 06:33:18 +00:00
Hidetoshi Shimokawa
630529ad1e Fix several problems related to resume:
- Initialize fc->status to process bus reset correctly after resume.
- Initialize AT ring buffer pointer.
- Requeue stdma to stfree for active IR buffer.
- Stop DMA before suspend for safe.
- Set powerstate after resume.
2003-06-28 11:11:36 +00:00
Hidetoshi Shimokawa
740b10aaa9 - Use fwohci_poll() instead of fwohci_intr() to process the first bus reest.
- Wait 2 cycles before starting the process for fast machines.
2003-06-27 00:27:33 +00:00
Hidetoshi Shimokawa
88e7cb59f4 Bound check for broken Configuration ROM. 2003-06-16 08:43:22 +00:00
Hidetoshi Shimokawa
e47e35e61b Fix for big endian. 2003-06-16 08:29:24 +00:00
Hidetoshi Shimokawa
0d3432eca7 Revert previos change for prior release/branch. 2003-06-16 03:44:36 +00:00
Hidetoshi Shimokawa
0bc666e09b - Enable support for building Configuration ROM.
- Improve probe message for S800 chips.
2003-06-15 04:09:26 +00:00
Hidetoshi Shimokawa
b83977f0a4 Fix crom_add_simple_text().
Bytewap Configuration ROM image.
2003-06-15 03:22:30 +00:00
Hidetoshi Shimokawa
19fc8e7c05 Add CSRVAL_VENDOR_PRIVATE. 2003-06-15 03:19:55 +00:00
Hidetoshi Shimokawa
ec3fab0e0c White space fix. 2003-06-15 00:17:38 +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
0b1739465d Fix typo in the previous revision. 2003-06-10 12:08:58 +00:00
Hidetoshi Shimokawa
97aad8deb4 Fix struct bus_info on big-endian machines. 2003-06-10 02:29:10 +00:00
Hidetoshi Shimokawa
efd4a0c1ec Add tx_speed sysctl variable. 2003-06-10 02:27:39 +00:00
Hidetoshi Shimokawa
3be95df6a0 Add id for TI's 1394b link chip. 2003-06-04 04:26:14 +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
df7898b895 Allocate zeroed space for fwdev. 2003-06-03 22:58:22 +00:00
Hidetoshi Shimokawa
1bba1572a0 Open fwmem device exclusively. 2003-06-03 22:52:55 +00:00
Scott Long
bf423d4637 Remove the redundant declaration of bus_dmasync_op_t. 2003-05-27 16:34:52 +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
6902ee83c7 - Use moderate gap counts listed in IEEE1394a.
- Simplify and correct the bus manager election process.
- Check link_active when choosing cycle master.
- Fix location of the cmr bit.

Approved by: re (scottl)
2003-05-11 10:32:20 +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
Hidetoshi Shimokawa
2b68d77fdd Don't panic for FWXF_START state in fw_xfer_unload(). 2003-05-05 10:14:52 +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
16dbbeec74 Set status to FWDEVINVAL if probe failed. 2003-04-30 10:20:24 +00:00
Hidetoshi Shimokawa
45800373db Add missing crom_next() in the previous revision. 2003-04-29 23:40:04 +00:00
Hidetoshi Shimokawa
13bd86018b Set recv.len to zero if we get no response. 2003-04-29 15:02:34 +00:00
Hidetoshi Shimokawa
fd59632766 Get correct firmware/model information for multiple unit directories. 2003-04-29 15:01:01 +00:00
Hidetoshi Shimokawa
748ef1915a Fix indentation. 2003-04-29 14:05:17 +00:00
Hidetoshi Shimokawa
5364715a0e Move CSR definitions to iec*.h from firewirereg.h. 2003-04-29 13:27:13 +00:00
Hidetoshi Shimokawa
70b400a813 Make compiled on RELEGN_4 2003-04-28 03:12:16 +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
6c1acd010e Fix printf warning for RELENG_4. 2003-04-24 09:27:17 +00:00
Hidetoshi Shimokawa
8fd36d4aa6 Add some IEEE 1394 OHCI chips.
Partially submitted by: Tetsuya Ryuchi <ryuchi@ryuchi.org>
PR: misc/51336
2003-04-24 07:29:52 +00:00
Hidetoshi Shimokawa
85b2d114c0 Set the local bus address in xfer->dst.
Submitted by: Buzz Slye <buzz@gaia.arc.nasa.gov>
2003-04-22 02:31:31 +00:00
Hidetoshi Shimokawa
e863fbcdb0 Remove unused code. 2003-04-21 16:41:20 +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
Matthew N. Dodd
f246e4a17f - Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
  such abuse isn't really needed.  (And if we do need type information
  associated with a module then we should make it explicit and not
  use hacks.)
2003-04-15 06:37:30 +00:00
Hidetoshi Shimokawa
050871cc4f Panic if bus_dmamap_load() doesn't respect maxsegsz. 2003-04-14 14:17:49 +00:00
Hidetoshi Shimokawa
f34e847dce - The payload of Write Request Quad must be network byte order. 2003-03-24 04:11:21 +00:00
Hidetoshi Shimokawa
73aa55ba0a - The payload of Write Request Quad and Read Response Quad must be
network byte order.
- Set ATRetries register after each bus reset because the value is 'undef'
	in OHCI spec.
2003-03-24 04:06:21 +00:00
Hidetoshi Shimokawa
a84fda13bb Safe PCI configuration.
- Clear PCIM_CMD_MWRICEN:
	some chips seem to have problem with write invalidate.
	clearing this bit fixes SBP timeout problem.

Tested by: Michael Reifenberger <Michael.Reifenberger@Plaut.de>

- Set PCIM_CMD_SERRESPEN and PCIM_CMD_PERRESPEN
- Moderate value for latency timer.
2003-03-24 03:47:36 +00:00
Hidetoshi Shimokawa
58089a20d1 Clear channel and tag bits before set them.
This should fix the problem that if_fwe doesn't work after DV receiving.
2003-03-19 07:04:11 +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
3b79dd164b - improve timeout handling in fwmem.c
- stop processing of TX db if we reaches the end of active db.
2003-03-07 02:51:59 +00:00
Hidetoshi Shimokawa
2b4601d10b MFp4(simokawa_sbp)
Improve if_fwe performance.
- Simplify mbuf handling by using bulkxfer.
	Now, it uses mbuf clusters for RX buffer as usual ethernet drivers.
- Recycle struct xfer buffer and don't call malloc at runtime.
- Count input and output errors.
- Handle a mbuf chain longer than 6 correctly.
- Increase queue length.
2003-03-06 05:06:44 +00:00
Hidetoshi Shimokawa
9ca8add364 Set ldesc after dbch->ndesc has initialized. 2003-03-05 01:50:57 +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
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Hidetoshi Shimokawa
dcae7539cb Defer allowing async. requests after self ID's have received.
This should fix some problem of SBP2 device probing.

Prior to rev 1.41, we keep writing the register while bus reset phase.
But in rev 1.41, we ignore successive bus reset events and some chips seem to
clear the register after we write to it.

Tested by: Michael Reifenberger <root@nihil.reifenberger.com>
2003-03-03 04:10:56 +00:00
Poul-Henning Kamp
95e4359c8e Use canonical format for cdevsw initialization. 2003-03-02 18:51:46 +00:00
Dag-Erling Smørgrav
521f364b80 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +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
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Hidetoshi Shimokawa
41dc7a9831 Oops, forgot to put back debug level. 2003-02-21 02:27:13 +00:00
Hidetoshi Shimokawa
559dfd9b55 remove unused code. 2003-02-21 02:14:00 +00:00
Hidetoshi Shimokawa
cd1f52fe80 Fix typo
Submitted by: Masahiro Ito <m_itoh@mub.biglobe.ne.jp>
2003-02-21 02:09:39 +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
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Hidetoshi Shimokawa
d5e6895166 Fix fwdev memory leak on detaching. 2003-02-18 10:56:00 +00:00
Hidetoshi Shimokawa
69f034dae4 Use pci_get_devid(). 2003-02-18 10:01:44 +00:00
Hidetoshi Shimokawa
12f2a2958b Add 'uPD72871/2 IEEE1394 1-Chip OHCI Host Controller'. 2003-02-18 09:46:52 +00:00
Hidetoshi Shimokawa
1adf684228 * firewire.c
- Fix memory leak in detaching.
- Initialize fc->status to other than FWBUSREST.

* fwohci.c
- Ignore BUS reset events while BUS reset phase. We can't clear that flag
	during bus reset phase.
2003-02-18 09:39:48 +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
6611732341 Protect calling fwohci_intr() with splfw() for 4-stable. 2003-02-15 01:25:39 +00:00
Hidetoshi Shimokawa
3173a15429 - Increase split transaction timeout from 2 sec to 6 sec.
Problem reported by: Michael Reifenberger <root@nihil.reifenberger.com>

- Improve debug message.
2003-02-15 00:54:10 +00:00
Hidetoshi Shimokawa
c26f4c7168 Clear the bus reset event flag as soon as possible after
the initialization has completed to start transactions even when
interrupt is disabled during the boot process.
2003-02-14 15:52:32 +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
645394e60b Increase atrq.ndesc for if_fwe. 2003-02-09 17:11:55 +00:00
Hidetoshi Shimokawa
233b1b978b Add new ioctl to specify target EUI64 for fwmem. 2003-02-09 10:14:22 +00:00
Hidetoshi Shimokawa
5a8d8970be Remove unnecessary check for OCB_ACT_CMD. 2003-02-09 07:40:27 +00:00
Hidetoshi Shimokawa
864d7e72b8 - Detect split transcation timeout.
* implement watchdog timer.
	* check all standing transactions in firewire_xfer_timeout().
- Add firewire_xferq_drain() for fw_busreset().
- Add/improve some debug messages.
- Call fw_xfer_done() if retry handler is NULL.
2003-02-09 07:16:01 +00:00
Hidetoshi Shimokawa
6f99c2ff52 Remove debug message. 2003-02-07 09:46:30 +00:00
Hidetoshi Shimokawa
d3539e9792 Fix memory leak. 2003-02-06 17:23:01 +00:00
Hidetoshi Shimokawa
5db3899d2e Fix for fwmem write part.
- fix typo
- don't need to check receive buffer.
- don't forget to free xfer on errer.
2003-02-05 17:19:34 +00:00
Hidetoshi Shimokawa
8a45d99b2a - Implement write part.
- Use quad access for aligned 4 byte access.
2003-02-04 17:09:59 +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
beb19fc5dd Remove unnecessary M_NOWAIT. 2003-02-03 09:41:42 +00:00
Hidetoshi Shimokawa
62dae95462 Add missing 'static'. 2003-02-03 08:10:50 +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
Hidetoshi Shimokawa
4230e8de2f Sort device list by eui64 in acendent order correctly. 2003-02-01 06:34:36 +00:00
Hidetoshi Shimokawa
ba3129cb87 function name change. 2003-01-31 14:14:45 +00:00
Hidetoshi Shimokawa
64cf5240a9 SBP related changes.
- Issue LOGOUT command on detach and shutdown.
- Rename some functions.
2003-01-31 14:11:22 +00:00
Hidetoshi Shimokawa
9bb3ca0305 SBP related changes.
- Set dual phase retry BUSY_TIMEOUT.
- Let users to know serial bus error.
2003-01-31 03:09:13 +00:00
Hidetoshi Shimokawa
958c774916 Restart cycle master after bus manager election.
This should fix the IR(and maybe IT) problem when
the host becames the bus manager.
- rename fw_noderesolve() to fw_noderesolve_eui64() and add
	fw_noderesolve_nodeid().
2003-01-30 05:18:35 +00:00
Hidetoshi Shimokawa
449e559cdb - Handle SCSI_STATUS_BUSY case. 2003-01-30 05:12:56 +00:00
Hidetoshi Shimokawa
7054e8482e - Probe number of IT/IR DMA contexts as specified in OHCI spec. 2003-01-29 15:32:35 +00:00
Hidetoshi Shimokawa
878db8920f - Fix build on alpha.
- Add a missing newline in printf.
2003-01-29 02:13:31 +00:00
Hidetoshi Shimokawa
c3e9e25542 - Allow multiple packets read/write for IR/IT to reduce system call.
- Remove unused variables.
2003-01-28 15:09:07 +00:00
Hidetoshi Shimokawa
53f1eb8620 - Split db.desc.cmd into desc.control and desc.reqcount.
- remove unncessary descriptor updates.
2003-01-26 18:38:06 +00:00
Hidetoshi Shimokawa
5a7ba74dc4 - Improve IT/IR DMA queue management.
- Improve debug message for mbuf handling.
- Wait 1 sec for DMA stop in fwohci_i{t,r}x_disable() before freeing buffers.
2003-01-26 15:39:04 +00:00
Hidetoshi Shimokawa
c547b896f5 Change API of FW_GDEVLST ioctl.
- include information about itself.
- define struct fw_devinfo and use it in struct fw_devlstreq.
- unify EUI64 representation using struct fw_eui64.
2003-01-25 14:47:33 +00:00
Hidetoshi Shimokawa
9190691bd0 Remove FW_SSTDV ioctl. It is not used anymore. 2003-01-24 13:03:19 +00:00
Hidetoshi Shimokawa
e715bfae6c Merge little and big endian case. 2003-01-24 12:45:19 +00:00
Hidetoshi Shimokawa
16e0f48443 - Add sysctl knob for bus manager. (hw.firewire.try_bmr)
- Check invalid SID length.
- Add some debug messages.
2003-01-23 13:34:40 +00:00
Hidetoshi Shimokawa
93001c7214 Define misc structs outside of struct firewire_comm. 2003-01-21 16:37:01 +00:00
Hidetoshi Shimokawa
b9b35d1965 Ignore events of unused IR DMA. 2003-01-21 16:24:35 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Hidetoshi Shimokawa
ae8c82bbe9 Replace M_DONTWAIT with M_NOWAIT for malloc().
Pointed out by: nate@root.org
2003-01-17 15:15:21 +00:00
Hidetoshi Shimokawa
0ef6095d41 Improve some debug massages. 2003-01-17 15:03:57 +00:00
Hidetoshi Shimokawa
6340b71e5f Fix bus manager election process.
- Lock response 0x3f means that the host becomes the bus manager.
- Add missing htonl().
2003-01-17 15:03:25 +00:00
Hidetoshi Shimokawa
7643dc189d Detect underrun of IT queue for debugging.
Add some comments.
2003-01-17 03:52:48 +00:00
Hidetoshi Shimokawa
e2ad5d6e8c Improve memory allocation.
- Don't use contigmalloc() and allocate page by page to avoid
	allocation failure.
- allocate buffer by PAGE_SIZE.
2003-01-16 13:09:33 +00:00
Hidetoshi Shimokawa
97ae6c1f15 Use cycleMatch for precise IT DMA start timing. 2003-01-16 07:01:54 +00:00
Hidetoshi Shimokawa
744bdf5752 DV_PAL shouldn't be here. 2003-01-15 05:28:50 +00:00
Hidetoshi Shimokawa
6d6f7f2891 Add DV_PAL for PAL users. 2003-01-15 05:26:23 +00:00
Hidetoshi Shimokawa
4ed65ce9e1 Fix IT DMA underun while bus reset.
- Reduce number of DELAY's
2003-01-15 04:21:16 +00:00
Hidetoshi Shimokawa
5dda08514e Fix for FreeBSD-4.
- Protect whole fw_tbuf_update() with splfw().
2003-01-14 08:35:45 +00:00
Hidetoshi Shimokawa
0aaa9a23cd Minimal fix for DV part.
- Don't panic on contigmalloc failure.
- Calculate timestamp by feedforward rather than feedback which depends on
	unreliable interrupt timing.
- Overwrite timestamp in CIP header correctly.
- Add debug code for timestamp synchronization.
- Add comments.
2003-01-13 16:08:09 +00:00
Hidetoshi Shimokawa
d0035474c3 Merge big endian and little endian case.
Fill fdf bit fields and others.
2003-01-13 15:08:48 +00:00
Hidetoshi Shimokawa
435dd29b27 - Add error messages for bulkxfer.
- Reduce register access.
2003-01-09 10:25:07 +00:00
Hidetoshi Shimokawa
9a7d0adfaa - Fix print format for FreeBSD-4
- Reduce debug message.
2003-01-07 12:58:08 +00:00
Hidetoshi Shimokawa
64666ed6e7 Don't call fw_bus_probe() twice when successive self-id packets received.
This change should stabilize SBP-II device probing.
2003-01-07 04:26:45 +00:00
Hidetoshi Shimokawa
17faeefca6 Use device_printf() and s/fc->dev/fc->bdev/. 2003-01-06 08:07:20 +00:00
Hidetoshi Shimokawa
9bfd777adb Fix fc->dev to fc->bdev. 2003-01-06 05:57:48 +00:00
Hidetoshi Shimokawa
a423957600 Reduce diff to RELENG_4. 2003-01-05 14:58:45 +00:00
Hidetoshi Shimokawa
bda19384a1 Syntax fix in fwohci_pci_suspend(). 2003-01-05 09:12:47 +00:00
Hidetoshi Shimokawa
94b6f028fd - Change definition of fc->maxrec same as fwdev->maxrec.
- 'spec' and 'ver' are attributes of a unit rather than a node.
- Report Phy and Link info separatelly.
- Reorder intialization step in fwohci_reset().
2003-01-05 06:21:30 +00:00
Hidetoshi Shimokawa
bce5729a9d - Remove speed_map API because speed_map is obsoleted by 1394a.
- Add definition of OHCI_HCC_BIBIV in fwohcireg.h.
2003-01-04 16:03:50 +00:00
Hidetoshi Shimokawa
7ddbf617b1 - Handle zero sized directory right way.
- Staticize.
2003-01-04 10:32:31 +00:00
Hidetoshi Shimokawa
d6105b602c - Replace printf() with device_printf().
- Separate fc->dev (i.e. fwohci0) and fc->bdev (i.e. firewire0).
- Remove unused firewirebusreg.h.
- Reduce size of descriptor block for asynchronous transmit and
	check the number of descriptor when copying from mbuf.
- Skip mbuf whose length is zero. NFS seems passing such mbuf and
	some chips generates unrecoverable error.
2003-01-04 10:21:11 +00:00
Hidetoshi Shimokawa
9339321d89 - Propagate suspend/resume to child devices.
- Restore pci config registers after resume.
- Reinitialize and start rx buffers after resume.
- Don't reallocate memory in fwohci_db_init() if the dbch is
	already initialized.
- Fix typo.
- Some clean up.
2003-01-04 06:40:57 +00:00
Hidetoshi Shimokawa
d0fd7bc6b5 Experimental support for suspend/resume, not finished yet. 2003-01-01 08:25:32 +00:00
Hidetoshi Shimokawa
6faac3ac96 Reduce debug message. 2003-01-01 08:22:29 +00:00
Hidetoshi Shimokawa
1f2361f8f8 - Retry phy access when the wait-loop count is exhausted.
- Free allocated memory when detaching.
- Detect contigmalloc failure.
2003-01-01 04:23:54 +00:00
Hidetoshi Shimokawa
7895313547 Fix and add several device IDs. 2002-12-31 13:43:44 +00:00
Hidetoshi Shimokawa
b018dcd1b8 - Implement primal Configuration ROM parser.
- Support multiple LUNs for SBP-II.
2002-12-31 10:28:49 +00:00
Hidetoshi Shimokawa
e4b13179f6 Improve error checking of phy access and retry when error occurs. 2002-12-31 10:00:36 +00:00
Hidetoshi Shimokawa
e238f68de5 - Add more CSR related definitions (IEEE-1212).
- Fix struct csrtext's spec fields.
- Add prototypes of upcoming configuration ROM related functions.
2002-12-30 09:41:32 +00:00
Hidetoshi Shimokawa
ee126d67f7 Cosmetic change. s/Firewire/FireWire/. 2002-12-26 06:50:09 +00:00
Hidetoshi Shimokawa
f3abec2274 Replace ntohl() with ntohs() because orb_hi is u_int16_t. 2002-12-26 06:41:37 +00:00
Hidetoshi Shimokawa
ac9f66922b firewire.c
- Fix permission of device node.

fwochi.c, fwohcireg.h
- Detect phy access failure correct way.
- Set root hold-off bit before initiating bus reset.
	This should fix the problem with VIA6306.

fwohcivar.h
- Fix over-allocation of array. (fwohcivar.h)

sbp.c
- Return CAM_DEV_NOT_THERE rather than CAM_TID_INVALID to prevent retry.
2002-12-26 03:17:59 +00:00
Hidetoshi Shimokawa
17c3d42c9e Reduce and improve debug messages.
Approved by: re
2002-12-06 02:17:30 +00:00
Sam Leffler
673d91916d network interface driver changes:
o don't strip the Ethernet header from inbound packets; pass packets
  up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by:	many
Approved by:	re
2002-11-14 23:54:55 +00:00
Hidetoshi Shimokawa
d6ec58858c - Add fwmem_xfer_req() and use this in other functions. 2002-11-12 17:19:21 +00:00