summaryrefslogtreecommitdiffstats
path: root/sys/dev/firewire/firewire.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r309093: firewire: initialize tag label to -1 in fw_xfer_alloc()avg2016-12-141-0/+1
|
* MFC r258779,r258780,r258787,r258822:eadler2014-02-041-1/+1
| | | | | | | | | | | | | Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this shifts into the sign bit. Instead use (1U << 31) which gets the expected result. Similar to the (1 << 31) case it is not defined to do (2 << 30). This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD.
* FireWire: Don't allow a tlabel to reference an xfer after free.will2013-04-081-3/+12
| | | | | | | | | | | | | | | sys/dev/firewire/firewire.c: - fw_xfer_unload(): Since we are about to free this xfer, call fw_tl_free() to remove the xfer from its tlabel's list, if it has a tlabel. - In every occasion when a xfer is removed from a tlabel's list, reset xfer->tl to -1 while holding fc->tlabel_lock, so that the xfer isn't mis-identified as belonging to a tlabel. This doesn't fix all the use-after-free problems for M_FWMEM, but is an incremental towards that goal. Reviewed by: kan, sbruno Sponsored by: Spectra Logic
* - There's no need to overwrite the default device method with the defaultmarius2011-11-221-5/+4
| | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
* bus_add_child: change type of order parameter to u_intavg2010-09-101-2/+2
| | | | | | | | | | 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
* Rename the host-related prison fields to be the same as the host.*jamie2009-06-131-1/+1
| | | | | | | parameters they represent, and the variables they replaced, instead of abbreviated versions of them. Approved by: bz (mentor)
* Place hostnames and similar information fully under the prison system.jamie2009-05-291-2/+4
| | | | | | | | | | | | | | | | | The system hostname is now stored in prison0, and the global variable "hostname" has been removed, as has the hostname_mtx mutex. Jails may have their own host information, or they may inherit it from the parent/system. The proper way to read the hostname is via getcredhostname(), which will copy either the hostname associated with the passed cred, or the system hostname if you pass NULL. The system hostname can still be accessed directly (and without locking) at prison0.pr_host, but that should be avoided where possible. The "similar information" referred to is domainname, hostid, and hostuuid, which have also become prison parameters and had their associated global variables removed. Approved by: bz (mentor)
* Minor updates as a precursor to fixing sbp_targsbruno2009-04-071-1/+5
| | | | | | | firewire.c -- expand a comment and repair a typo sbp.h -- define Logical Unit Reset so it can be used in sbp_targ Reviewed by: scottl@freebsd.org
* Reviewed by: scott (scottl@freebsd.org)sbruno2009-03-171-32/+52
| | | | | | | | | | | | Obtained from: Hideotshi Shimokawa This update is based on comments from Hidetoshi. Changeset 183550 removed the call to crom_load() in fw_busreset(). Restore that call such that the Configuration ROM is valid. Stash and update fwdev settings in fw_explore_node() so that negotiation works again.
* Introduce 1394a-2000 extended PHY Self ID packets.sbruno2009-02-171-6/+23
| | | | | | | | | | Deprecate unused phy_delay Self ID field as it was removed by 1394a-2000. Attempt to parse extended Self ID PHY packets if they are detected Reviewed by: scottl (mentor) MFC after: 2 weeks
* Simplify some debugging messages and try to consolodate some of the moresbruno2009-02-171-65/+109
| | | | | | | | | | | interesting conditional printf's into single device_printf's Change a couple of variable names so that I don't have to trace what they acutally do anymore. Enable the display of the Self ID PHY packet if firewire_debug > 0 Reviewed by: scottl(mentor) MFC after: 2 weeks
* Synopsis:sbruno2009-02-171-6/+55
| | | | | | | | | | | | | | | | | | | | | | | | | If speed of link between two devices is slower than the reported max speed of both endpoints, the current driver will fail and be unable to negotiate. Summary: Test negotiated speed by reading the CSRROM into a dummy variable. If that read fails, decrement our speed and retry. If all else fails, go to lowest speed possible(0). Report speed to the user. Add display of the Bus Info Block when debug.firewire_debug > 1 Support the Bus Info Block(1394a-2000) method of speed detection. I also should note that I am moving "hold_count" to 0 for future releases. This variable determines how many bus resets to "hold" a removed firewire device before deletion. I don't feel this is useful and will probably drop support for this sysctl in the future. Reviewed by: scottl(mentor) MFC after: 2 weeks
* Some updates and bug squashing in the firewire stack.sbruno2009-02-011-36/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Step 1.5 of importing the network stack virtualization infrastructurezec2008-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the vimage project, as per plan established at devsummit 08/08: http://wiki.freebsd.org/Image/Notes200808DevSummit Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator macros, and CURVNET_SET() context setting macros, all currently resolving to NOPs. Prepare for virtualization of selected SYSCTL objects by introducing a family of SYSCTL_V_*() macros, currently resolving to their global counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT(). Move selected #defines from sys/sys/vimage.h to newly introduced header files specific to virtualized subsystems (sys/net/vnet.h, sys/netinet/vinet.h etc.). All the changes are verified to have zero functional impact at this point in time by doing MD5 comparision between pre- and post-change object files(*). (*) netipsec/keysock.c did not validate depending on compile time options. Implemented by: julian, bz, brooks, zec Reviewed by: julian, bz, brooks, kris, rwatson, ... Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
* Commit step 1 of the vimage project, (network stack)bz2008-08-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
* - Fix panic on detach.simokawa2008-05-101-1/+4
| | | | | | - Fix a comment. MFC after: 2 weeks
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-10-201-2/+2
| | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls.
* Protect transaction labels by its own lock to reduce lock contention.simokawa2007-07-201-12/+16
| | | | Approved by: re (rwatson)
* Improve acquisition of transaction labels.simokawa2007-07-151-20/+16
| | | | | | | | - Keep last transaction label for each destination. - If the next label is not free, just give up. - This should reduce CPU load for TX on if_fwip under heavy load. Approved by: re (hrs)
* Fix a bug of retrieving configuration ROM.simokawa2007-07-081-2/+2
| | | | | | | | | | - Handle directories and leaves other than unit directories and text leaves correctly. - Now we can retrieve CROM of iSight correctly. Approved by: re (hrs) Tested by: flz MFC after: 3 days
* Timestamp after sent.simokawa2007-06-081-4/+3
|
* Fix a race after a bus reset.simokawa2007-06-081-11/+12
| | | | | - We are in FWBUSINIT state just after SID interrupt. - Do not pass normal xfers before bus probe is done.
* MFp4: MPSAFE firewire stack.simokawa2007-06-061-69/+214
| | | | | | | | | | | | | - 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()
* Make sure fwsid is not NULL.simokawa2007-05-211-1/+3
| | | | MFC after: 3 days
* MFp4: Simplify the bus probe routin using a kthread.simokawa2007-05-211-335/+236
| | | | MFC after: 1 week
* MFp4:simokawa2007-04-301-9/+11
| | | | | | | - Update state in fw_xferq_dorain() after removed from the send queue. - Remove unnecessary 'goto err;". MFC after: 1 week
* MFp4: Fix broken userland API for async packets.simokawa2007-04-301-54/+45
| | | | | | | | - Introduce fw_xferlist_add/remove(). - Introduce fw_read/write_async(). - Remove unused FWACT_CH. MFC after: 1 week
* MFp4: Fix typo in recv spd.simokawa2007-04-301-1/+1
| | | | MFC after: 1 week
* MFp4: remove unused fw_asybusy().simokawa2007-04-301-14/+0
| | | | MFC after: 1 week
* MFp4: Simplify tlabel handlingsimokawa2007-04-301-33/+27
| | | | | | | | - Remove struct tl_label and runtime malloc() for it. - Include tl_lable list in struct fw_xfer. - Don't free unallocated tlabel. MFC after: 1 week
* Initialize configuration ROM before a bus reset.simokawa2007-04-301-2/+3
| | | | MFC: after 3 days
* Free tlabel in fw_xfer_done().simokawa2007-03-301-2/+1
|
* - Don't call fw_busreset() in firewire_attach().simokawa2007-03-301-1/+0
| | | | | | | This should fix the problem that the first bus reset is sometimes ignored because of FWBUSRESET status. MFC after: 3 days
* Replace xfer->act.hand with xfer->hand.simokawa2007-03-161-16/+16
|
* Remove retry_count.simokawa2007-03-161-1/+0
|
* * Remove xfer->retry_req.simokawa2007-03-161-30/+2
| | | | | It is unnecessary because retry is done by OHCI. Further retry should be done by applications.
* Fix panic when we cannot find self-id of probing nodes.simokawa2005-11-251-1/+3
| | | | | | | | | This shouldn't happen as far as the self-id buffer is vaild but some people have this problem. PR: kern/83999 Submitted by: Markus Wild <fbsd-lists@dudes.ch> MFC after: 3 days
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* return after freeing data element, instead of falling through, and usingjmg2005-01-041-0/+1
| | | | | | the free'd element, and ultimate NULL deref of the failed allocation. MFC after: 1 week
* Avoid casts as lvalues.kan2004-07-281-1/+1
|
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPphk2004-07-151-0/+2
| | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything".
* If we run out of transmission labels, just re-queue the packet for laterdfr2004-06-141-3/+4
| | | | | instead of printing endless error messages on the console and discarding the packet.
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's todfr2004-05-221-36/+36
| | | | uint32_t where appropriate.
* Fix spelling.dfr2004-05-211-5/+5
|
* Don't use the node id as an index into the topology map. This breaksdfr2004-05-161-2/+21
| | | | | if a node on the bus has more than three ports (like my cheapo six port hub).
* MFp4: FireWiresimokawa2004-03-261-20/+45
| | | | | | | | | | | | | | | | | | | * 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.
* Check that xfer != NULL before dereferencing it, not after.cperciva2004-02-221-2/+2
| | | | | Reported by: "Ted Unangst" <tedu@coverity.com> Approved by: rwatson (mentor)
* Use device_identify and bus_add_child methods to add a firewiresimokawa2004-01-301-4/+13
| | | | | bus on fwohci. This should fix attach failure caused by a race between firewire and fwochi initialization for the kernel module.
* * firewiresimokawa2004-01-081-17/+26
| | | | | | | | | | 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.
OpenPOWER on IntegriCloud