Commit Graph

100 Commits

Author SHA1 Message Date
Marius Strobl
0752b99d69 Allocate the DMA memory shared between the host and the controller as
coherent.

MFC after:	2 weeks
2011-03-11 22:19:49 +00:00
Rebecca Cran
8834bc521e Fix grammar. 2010-10-18 14:26:29 +00:00
Sean Bruno
01f312783e Remove redundant while () from loop.
Submitted by:	 Ganbold <ganbold@micom.mng.net>
Reviewed by:	 scottl
2009-02-13 17:44:07 +00:00
Sean Bruno
373d922731 Enhance debug messages and attempt to unify them into one format where possible.
Reviewed by:	scottl
2009-02-12 03:26:05 +00:00
Sean Bruno
3042cc43f0 Some updates and bug squashing in the firewire stack.
Move the interupt handler to a driver_intr_t type function as it was trying
to do way to much for a lightweight filter interrupt function.

Introduce much more locking around fc->mtx.  Tested this for lock reversals
and other such lockups.  Locking seems to be working better, but there
is much more to do with regard to locking.  The most significant lock is
in the BUS RESET handler.  It was possible, before this checkin, to set
a bus reset via "fwcontrol -r" and have the BUS RESET handler fire before
the code responsible for asserting BUS RESET was complete.  This locking
fixes that issue.

Move some of the memory allocations in the fc struct to the attach function
in firewire.c

Rework the businfo.generation indicator to be merely a on/off bit now.
It's purpose according to spec is to notify the bus that the config ROM
has changed.  That's it.

Catch and squash a possible panic in SBP where in the SBP_LOCK was held
during a possible error case.  The error handling code would definitely
panic as it would try to acquire the SBP_LOCK on entrance.

Catch and squash a camcontrol/device lockup when firewire drives go away.
When a firewire device was powered off or disconnected from the firewire
bus, a "camcontrol rescan all" would hang trying to poll removed devices
as they were not properly detached.  Don't do that.

Approved by:	scottl
MFC after:	2 weeks
2009-02-01 23:28:52 +00:00
Hidetoshi Shimokawa
d219022c4c - Fix panic on detach.
- Fix a comment.

MFC after: 2 weeks
2008-05-10 13:40:42 +00:00
Hidetoshi Shimokawa
5f3fa23423 - Disable interrupts on suspend to eliminate excessive
'device physically ejected?' message on resume.
- Fix memory leak on resume reported by kiyohara at netbsd.org.

MFC after: 2 weeks
2008-05-10 09:22:06 +00:00
Hidetoshi Shimokawa
c59557f5d4 Timestamp after sent. 2007-06-08 09:04:30 +00:00
Hidetoshi Shimokawa
7acf69638a Fix a race after a bus reset.
- We are in FWBUSINIT state just after SID interrupt.
- Do not pass normal xfers before bus probe is done.
2007-06-08 07:53:59 +00:00
Hidetoshi Shimokawa
ac2d2894b4 Add a tunable hw.firewire.phydma_enable.
This is enabled by default.  It should be disabled for
those who are uneasy with peeking/poking from FireWire.

Please note sbp(4) and dcons(4) over FireWire need
this feature.
2007-06-07 13:20:48 +00:00
Hidetoshi Shimokawa
9950b741e9 MFp4: MPSAFE firewire stack.
- lock its own locks and drop Giant.
- create its own taskqueue thread.
- split interrupt routine
- use interrupt filter as a fast interrupt.
- run watchdog timer in taskqueue so that it should be
   serialized with the bottom half.
- add extra sanity check for transaction labels.
   disable ad-hoc workaround for unknown tlabels.
- add sleep/wakeup synchronization primitives
- don't reset OHCI in fwohci_stop()
2007-06-06 14:31:36 +00:00
Hidetoshi Shimokawa
0cf4488ab4 MFp4: Improve asynchronous packet receive process.
- Wake up DMA engine after adding a new receive buffer.
- Skip buffers which have unknown state after error.
- More rigid error detection.

MFC after: 1 week
2007-04-30 14:06:30 +00:00
Hidetoshi Shimokawa
6b3ecf71ea MFp4: Add a sysctl knob to disable cycle master mode and add some comments.
MFC after: 1 week
2007-04-30 12:38:50 +00:00
Hidetoshi Shimokawa
ad9cf50615 Initialize configuration ROM before a bus reset.
MFC: after 3 days
2007-04-30 10:50:53 +00:00
Hidetoshi Shimokawa
33662e369c Wait SCLK to be stable after LPS enabled.
This should fix NMI problem in fwphy_rddata().

PR: kern/94146 kern/100356
MFC: after 3 days
2007-03-19 03:35:45 +00:00
Hidetoshi Shimokawa
976c8eadc9 * Remove xfer->retry_req.
It is unnecessary because retry is done by OHCI.
   Further retry should be done by applications.
2007-03-16 05:11:42 +00:00
Hidetoshi Shimokawa
ac44778260 Less verbose debug messages. 2007-03-16 04:26:58 +00:00
Hidetoshi Shimokawa
d0581de84e Detect cycle lost. 2007-03-16 04:25:02 +00:00
John Baldwin
4d70511ac3 Use pause() rather than tsleep() on stack variables and function pointers. 2007-02-27 17:23:29 +00:00
Sam Leffler
b083b7c98d fix potential null ptr deref
Submitted by:	Coverity Prevent analysis tool
2005-03-29 01:44:59 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Hidetoshi Shimokawa
f9d9941f2d Don't output too many debug messages for bootverbose.
This driver seems to be fairly stable now.
2004-07-20 04:49:44 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Doug Rabson
c0e9efacfe Initialise OHCI_CROMHDR and OHCI_BUS_OPT in fwohci_ibr to make sure that
they have the right values at the first bus reset.
2004-05-23 14:22:11 +00:00
Doug Rabson
03161bbcf6 Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's to
uint32_t where appropriate.
2004-05-22 16:14:17 +00:00
Doug Rabson
95a2495411 Fix spelling. 2004-05-21 09:12:07 +00:00
Hidetoshi Shimokawa
10d3ed6459 MFp4: FireWire
* all
- s/__FUNCTION__/__func__/.
	Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>
- Compatibility for RELENG_4 and DragonFly.

* firewire
- Timestamp just before queuing.
- Retry bus probe if it fails.
- Use device_printf() for debug message.
- Invalidiate CROM while update.
- Don't process minimum/invalid CROM.

* sbp
- Add ORB_SHORTAGE flag.
- Add sbp.tags tunable.
- Revive doorbell support. It's not enabled by default.
2004-03-26 23:17:10 +00:00
Hidetoshi Shimokawa
b180671ce4 Use device_identify and bus_add_child methods to add a firewire
bus on fwohci. This should fix attach failure caused by a race
between firewire and fwochi initialization for the kernel module.
2004-01-30 14:28:11 +00:00
Hidetoshi Shimokawa
4c790222f6 Add missing free() in exception handlers.
Reported by:    Stanford Metacompilation research group
2004-01-22 14:41:17 +00:00
Hidetoshi Shimokawa
480878299e Sync type of linkspeed with firewire.c. 2004-01-11 15:40:42 +00:00
Hidetoshi Shimokawa
d09a5d6fce Remove __P(). 2004-01-06 14:30:47 +00:00
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
Peter Wemm
a89ec05e3e Catch a few places where NULL (pointer) was used where 0 (integer) was
expected.
2003-12-23 02:36:43 +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
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
1a75370022 Comment out verbose debug messages. 2003-08-22 07:30:41 +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
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
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
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
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
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
0bc666e09b - Enable support for building Configuration ROM.
- Improve probe message for S800 chips.
2003-06-15 04:09:26 +00:00
Hidetoshi Shimokawa
13bd86018b Set recv.len to zero if we get no response. 2003-04-29 15:02:34 +00:00