History log of /freebsd-9.3-release/sys/dev/firewire/fwohci_pci.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 254306 13-Aug-2013 scottl

Merge r254263:

Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
command register. The lazy BAR allocation code in FreeBSD sometimes
disables this bit when it detects a range conflict, and will re-enable
it on demand when a driver allocates the BAR. Thus, the bit is no longer
a reliable indication of capability, and should not be checked. This
results in the elimination of a lot of code from drivers, and also gives
the opportunity to simplify a lot of drivers to use a helper API to set
the busmaster enable bit.

This changes fixes some recent reports of disk controllers and their
associated drives/enclosures disappearing during boot.

Candidate for 9.2

Submitted by: jhb
Reviewed by: jfv, marius, adrian, achim


# 229093 31-Dec-2011 hselasky

MFC r226173, r227843, r227848 and r227908:
Use DEVMETHOD_END to mark end of device methods.
Remove superfluous device methods.
Add some missing __FBSBID() macros.


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 212413 10-Sep-2010 avg

bus_add_child: change type of order parameter to u_int

This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to: r212213
MFC after: 10 days


# 189575 09-Mar-2009 imp

remove now-redunant cardbus attachment.


# 187993 01-Feb-2009 sbruno

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


# 170374 06-Jun-2007 simokawa

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()


# 168099 30-Mar-2007 simokawa

Teardown interrupt only when sc->ih is not NULL.

MFC after: 3 days


# 167686 19-Mar-2007 simokawa

Poll only while interrupt is disabled.

MFC: 3 days after


# 167602 15-Mar-2007 simokawa

Don't mess with PCIM_CMD_SERRESPEN and PCIM_CMD_PERRESPEN.
This will fix 'NMI RAM parity error' while booting on some machines.

PR: kern/95077
MFC after: 3 days


# 166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


# 166165 21-Jan-2007 marius

Change the remainder of the drivers for DMA'ing devices enabled in the
sparc64 GENERIC and the sound device drivers known working on sparc64
to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid
of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4),
stge(4) and ti(4) these changes are runtime tested (unless I booted up
the wrong kernels again...).


# 159535 12-Jun-2006 imp

Better printf


# 148106 17-Jul-2005 imp

The Sony i.LINK CXD1947 device is a firewire bridge, but it doesn't
implement the OHCI programming interface. Thus it probes, but fails
to attach because of an invalid OHCI version. Rather than count on
the downstream tests properly failing, print a message that this
chipset isn't supported and fail the probe.


# 146439 20-May-2005 marius

Recognize the integrated (though not necessarily enabled) FireWire
controllers of Sun PCIO-2 chips which are used onboard in most of
the newer PCI-based sun4u machines (cosmetic change as they were also
already probed as generic FWOHCI without this). As with gem(4), hme(4)
and ohci(4) detect whether their intpin register is valid and correct
it if necessary, i.e. set the respective IVAR to the right value for
allocating the IRQ resource, as some of them come up having it set
to 0 (in fact in all machines I'm currently aware of the FireWire
part being enabled). This fixes attaching affected controllers.

Apporved by: simokawa
Tested by: Michiel Boland <michiel@boland.org>
MFC after: 1 month


# 143161 05-Mar-2005 imp

Use BUS_PROBE_DEFAULT for pci probe return value


# 139759 06-Jan-2005 simokawa

Clear PCIM_CMD_SERRESPEN and PCIM_CMD_PERRESPEN for broken hardware.
Some amd64 laptops fail to boot with these flags.

PR: kern/75482


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 133116 04-Aug-2004 simokawa

Fix and add deivce ID's.

Obtained from: DragonFly BSD


# 132432 20-Jul-2004 simokawa

Don't output too many debug messages for bootverbose.
This driver seems to be fairly stable now.


# 132283 17-Jul-2004 simokawa

Add some PCI IDs for OHCI chips.

Obtained from: DragonFly BSD


# 131398 01-Jul-2004 jhb

Trim a few things from the dmesg output and stick them under bootverbose to
cut down on the clutter including PCI interrupt routing, MTRR, pcibios,
etc.

Discussed with: USENIX Cabal


# 131255 28-Jun-2004 imp

Remove the setting of the pci config variables on power state changes.
The bus does this now.


# 129585 22-May-2004 dfr

Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's to
uint32_t where appropriate.


# 127468 26-Mar-2004 simokawa

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.


# 127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 125239 30-Jan-2004 simokawa

Add NEC uPD72873.

Submitted by: Christian Laursen <xi@borderworlds.dk>


# 125238 30-Jan-2004 simokawa

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.


# 124877 23-Jan-2004 simokawa

* fwohci_pci.c
Improve error message for attach failure.

* sbp_targ.c
- Add speed in struct sbp_targ_login.
- Remove unnecessary htonl().


# 124145 05-Jan-2004 simokawa

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.


# 123019 28-Nov-2003 imp

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@)


# 121939 03-Nov-2003 dfr

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


# 121506 25-Oct-2003 simokawa

Fix fwmem_strategy() race in 4-stable.


# 119290 22-Aug-2003 simokawa

Make this compiled on RELENG_4.


# 119277 22-Aug-2003 imp

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.


# 118416 04-Aug-2003 simokawa

- 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>


# 117732 18-Jul-2003 simokawa

Clean up include files.


# 117228 04-Jul-2003 simokawa

Add compatibility for FreeBSD-4.


# 117198 03-Jul-2003 imp

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.


# 117126 01-Jul-2003 scottl

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


# 117067 30-Jun-2003 simokawa

Include file clean up.


# 116978 28-Jun-2003 simokawa

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.


# 116897 26-Jun-2003 simokawa

- Use fwohci_poll() instead of fwohci_intr() to process the first bus reest.
- Wait 2 cycles before starting the process for fast machines.


# 115806 04-Jun-2003 simokawa

Add id for TI's 1394b link chip.


# 113957 24-Apr-2003 simokawa

Add some IEEE 1394 OHCI chips.

Partially submitted by: Tetsuya Ryuchi <ryuchi@ryuchi.org>
PR: misc/51336


# 113584 17-Apr-2003 simokawa

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


# 112522 24-Mar-2003 simokawa

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.


# 111076 18-Feb-2003 simokawa

Use pci_get_devid().


# 111075 18-Feb-2003 simokawa

Add 'uPD72871/2 IEEE1394 1-Chip OHCI Host Controller'.


# 110892 14-Feb-2003 simokawa

Protect calling fwohci_intr() with splfw() for 4-stable.


# 110875 14-Feb-2003 simokawa

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.


# 110195 01-Feb-2003 simokawa

Define new malloc type M_FW and use it.


# 110145 31-Jan-2003 simokawa

SBP related changes.
- Issue LOGOUT command on detach and shutdown.
- Rename some functions.


# 108705 05-Jan-2003 simokawa

Syntax fix in fwohci_pci_suspend().


# 108655 04-Jan-2003 simokawa

- 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.


# 108642 04-Jan-2003 simokawa

- 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.


# 108530 01-Jan-2003 simokawa

Experimental support for suspend/resume, not finished yet.


# 108527 01-Jan-2003 simokawa

- Retry phy access when the wait-loop count is exhausted.
- Free allocated memory when detaching.
- Detect contigmalloc failure.


# 108504 31-Dec-2002 simokawa

Fix and add several device IDs.


# 108281 26-Dec-2002 simokawa

Cosmetic change. s/Firewire/FireWire/.


# 107653 06-Dec-2002 simokawa

Reduce and improve debug messages.

Approved by: re


# 106809 12-Nov-2002 simokawa

Add a prototype for suspend/resume.


# 106485 06-Nov-2002 simokawa

- Let the PCI code try to route interrupt in -current
- Print warning in -stable.


# 105114 14-Oct-2002 jhb

This file doesn't need opt_bus.h.


# 103485 17-Sep-2002 ikob

Firewire device support for Apple eMac with PPC kernel.
Contributed by Peter Grehan <grehan@freebsd.org>


# 103285 13-Sep-2002 ikob

Initial import for IEEE1394 OHCI chipdet device driver and SBP-2 (Serial
Bus Protocol 2:SCSI over IEEE1394) support for CAM.