aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/firewire/fwohci.c
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Fix unused variable warning in fwohci.cDimitry Andric2022-07-211-2/+9
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/dev/firewire/fwohci.c:2762:23: error: variable 'pcnt' set but not used [-Werror,-Wunused-but-set-variable] int len, plen, hlen, pcnt, offset; ^ The 'pcnt' variable is eventually used only in an #if 0'd block, obviously meant for debugging. Ensure that 'pcnt' is only declared and used when COUNT_PACKETS is defined, so the debugging can be easily turned on later, if desired. MFC after: 3 days
* firewire: plug set-but-not-used varsMateusz Guzik2021-12-091-13/+31
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* fwohci: Cast bitfield to uint32_t before passing it to roundup2().John Baldwin2021-02-171-1/+1
| | | | | | | | | | The fallback for __align_up() used by roundup2() uses __typeof__() which doesn't work for bitfields. This fixes the build on GCC which uses the fallback. Reviewed by: arichardson, markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D28599
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* fwohci: report whether PhysicalUpperBound register is implementedAndriy Gapon2016-11-241-0/+10
| | | | | | | | | | | | | | | | | Please see section 5.15 of 1394 OHCI Specification. If the register is not implemented, then the physical response unit is limited to the first 4GB of the physical memory. In that case the non-cooperative debugging over firewire (using /dev/fwmem) can not be expected to work if a target has more RAM than that. The method is described in gdb.4 and the Developer's Handbook. It seems that most of the consumer hardware does not implement PhysicalUpperBound register. MFC after: 1 week Notes: svn path=/head/; revision=309092
* Remove NULL checks after M_WAITOK allocations from firewire.Edward Tomasz Napierala2016-05-101-4/+0
| | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=299351
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-5/+5
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* Fix remote DMA based firewire debugging when targetingWill Andrews2015-01-211-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | systems with more than 4GB of physical memory. To remotely debug the system 'stealthy' which has a kernel with this change installed and firewire properly configured: % fwcontrol -m stealthy (or stealthy's firewire EUI64) % kgdb kernel /dev/fwmem0.0 sys/dev/firewire/fwohci.c: Rather than hard code the upper limit for hw based automatic responses to remote DMA requests at 4GB, program the hardware using Maxmem, the page number one higher than the highest physical page detected in the system. While here, garbage collect more useless splfw() calls. Submitted by: gibbs MFC after: 1 week Sponsored by: Spectra Logic MFSpectraBSD: 1110994 on 2015/01/06 Notes: svn path=/head/; revision=277511
* Do not pass whole descriptor block size as align to fwdma_malloc_multisegAlexander Kabaev2014-09-271-1/+1
| | | | | | | | | | | | Do not pass wrong alignment value to fwdma_malloc_multiseg and ultimately to contigalloc. In addition to being wrong, this causes insta-panic in certain cases due to safety assertion - the alignment is required to be the power of two and the value we calculate here seldom is. MFC after: 1 month Notes: svn path=/head/; revision=272215
* Remove obsolete compatibility glue and improve firewire code readability.Alexander Kabaev2014-09-271-265/+257
| | | | | | | | | | | Commit my version of style(9) pass over the firewire code. Now that other people have started changing the code carrying this is as a local patch is not longer a viable option. MFC after: 1 month Notes: svn path=/head/; revision=272214
* Start the process of cleaning up FreeBSD's firewire driver.Will Andrews2014-09-181-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | sys/dev/firewire/firewire.c: sys/dev/firewire/firewire.h: sys/dev/firewire/firewirereg.h: sys/dev/firewire/fwcrom.c: sys/dev/firewire/fwdev.c: sys/dev/firewire/fwdma.c: sys/dev/firewire/fwmem.c: sys/dev/firewire/fwohci.c: sys/dev/firewire/fwohci_pci.c: sys/dev/firewire/fwohcivar.h: sys/dev/firewire/if_fwe.c: sys/dev/firewire/if_fwip.c: sys/dev/firewire/sbp.c: sys/dev/firewire/sbp_targ.c: Unifdef the code, removing support for DragonflyBSD and FreeBSD prior to version 5. Submitted by: gibbs MFC after: 1 month Sponsored by: Spectra Logic MFSpectraBSD: 1081188 on 2014/08/01 Notes: svn path=/head/; revision=271795
* Silence noisy firewire logging.Will Andrews2014-09-181-4/+0
| | | | | | | | | MFC after: 1 month Sponsored by: Spectra Logic MFSpectraBSD: 974594 on 2013/08/02 Notes: svn path=/head/; revision=271793
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-6/+5
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-5/+6
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thisEitan Adler2013-11-301-2/+2
| | | | | | | | | | | | | | | | shifts into the sign bit. Instead use (1U << 31) which gets the expected result. 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. Discussed with: -arch, rdivacky Reviewed by: cperciva Notes: svn path=/head/; revision=258780
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-1/+1
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* When we see an interrupt status of 0xffffffff, check to see if theWarner Losh2011-06-211-2/+3
| | | | | | | | | child is still present. If not, return 'handled' and don't print anything (this is expected behavior). We expect an interrupt on eject, power-down and/or shutdown. Notes: svn path=/head/; revision=223353
* Allocate the DMA memory shared between the host and the controller asMarius Strobl2011-03-111-2/+2
| | | | | | | | | coherent. MFC after: 2 weeks Notes: svn path=/head/; revision=219543
* Fix grammar.Rebecca Cran2010-10-181-2/+2
| | | | Notes: svn path=/head/; revision=214021
* Remove redundant while () from loop.Sean Bruno2009-02-131-1/+1
| | | | | | | | Submitted by: Ganbold <ganbold@micom.mng.net> Reviewed by: scottl Notes: svn path=/head/; revision=188584
* Enhance debug messages and attempt to unify them into one format where possible.Sean Bruno2009-02-121-10/+12
| | | | | | | Reviewed by: scottl Notes: svn path=/head/; revision=188509
* Some updates and bug squashing in the firewire stack.Sean Bruno2009-02-011-18/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=187993
* - Fix panic on detach.Hidetoshi Shimokawa2008-05-101-3/+0
| | | | | | | | | - Fix a comment. MFC after: 2 weeks Notes: svn path=/head/; revision=178915
* - Disable interrupts on suspend to eliminate excessiveHidetoshi Shimokawa2008-05-101-4/+9
| | | | | | | | | | 'device physically ejected?' message on resume. - Fix memory leak on resume reported by kiyohara at netbsd.org. MFC after: 2 weeks Notes: svn path=/head/; revision=178911
* Timestamp after sent.Hidetoshi Shimokawa2007-06-081-0/+1
| | | | Notes: svn path=/head/; revision=170427
* Fix a race after a bus reset.Hidetoshi Shimokawa2007-06-081-3/+4
| | | | | | | | - We are in FWBUSINIT state just after SID interrupt. - Do not pass normal xfers before bus probe is done. Notes: svn path=/head/; revision=170425
* Add a tunable hw.firewire.phydma_enable.Hidetoshi Shimokawa2007-06-071-6/+11
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=170400
* MFp4: MPSAFE firewire stack.Hidetoshi Shimokawa2007-06-061-243/+252
| | | | | | | | | | | | | | | | - 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() Notes: svn path=/head/; revision=170374
* MFp4: Improve asynchronous packet receive process.Hidetoshi Shimokawa2007-04-301-32/+68
| | | | | | | | | | | - 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 Notes: svn path=/head/; revision=169132
* MFp4: Add a sysctl knob to disable cycle master mode and add some comments.Hidetoshi Shimokawa2007-04-301-1/+9
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=169123
* Initialize configuration ROM before a bus reset.Hidetoshi Shimokawa2007-04-301-1/+1
| | | | | | | MFC: after 3 days Notes: svn path=/head/; revision=169117
* Wait SCLK to be stable after LPS enabled.Hidetoshi Shimokawa2007-03-191-0/+2
| | | | | | | | | | This should fix NMI problem in fwphy_rddata(). PR: kern/94146 kern/100356 MFC: after 3 days Notes: svn path=/head/; revision=167685
* * Remove xfer->retry_req.Hidetoshi Shimokawa2007-03-161-6/+2
| | | | | | | | It is unnecessary because retry is done by OHCI. Further retry should be done by applications. Notes: svn path=/head/; revision=167630
* Less verbose debug messages.Hidetoshi Shimokawa2007-03-161-3/+3
| | | | Notes: svn path=/head/; revision=167629
* Detect cycle lost.Hidetoshi Shimokawa2007-03-161-0/+18
| | | | Notes: svn path=/head/; revision=167628
* Use pause() rather than tsleep() on stack variables and function pointers.John Baldwin2007-02-271-4/+2
| | | | Notes: svn path=/head/; revision=167086
* fix potential null ptr derefSam Leffler2005-03-291-4/+4
| | | | | | | Submitted by: Coverity Prevent analysis tool Notes: svn path=/head/; revision=144263
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Don't output too many debug messages for bootverbose.Hidetoshi Shimokawa2004-07-201-11/+11
| | | | | | | This driver seems to be fairly stable now. Notes: svn path=/head/; revision=132432
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-1/+1
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Initialise OHCI_CROMHDR and OHCI_BUS_OPT in fwohci_ibr to make sure thatDoug Rabson2004-05-231-0/+7
| | | | | | | they have the right values at the first bus reset. Notes: svn path=/head/; revision=129611
* Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's toDoug Rabson2004-05-221-59/+59
| | | | | | | uint32_t where appropriate. Notes: svn path=/head/; revision=129585
* Fix spelling.Doug Rabson2004-05-211-7/+7
| | | | Notes: svn path=/head/; revision=129541
* MFp4: FireWireHidetoshi Shimokawa2004-03-261-13/+22
| | | | | | | | | | | | | | | | | | | | | | * 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. Notes: svn path=/head/; revision=127468
* Use device_identify and bus_add_child methods to add a firewireHidetoshi Shimokawa2004-01-301-1/+0
| | | | | | | | bus on fwohci. This should fix attach failure caused by a race between firewire and fwochi initialization for the kernel module. Notes: svn path=/head/; revision=125238
* Add missing free() in exception handlers.Hidetoshi Shimokawa2004-01-221-0/+1
| | | | | | | Reported by: Stanford Metacompilation research group Notes: svn path=/head/; revision=124836
* Sync type of linkspeed with firewire.c.Hidetoshi Shimokawa2004-01-111-1/+1
| | | | Notes: svn path=/head/; revision=124378