Commit Graph

378 Commits

Author SHA1 Message Date
Rebecca Cran
8834bc521e Fix grammar. 2010-10-18 14:26:29 +00:00
Andriy Gapon
3d844eddb7 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
2010-09-10 11:19:03 +00:00
Warner Losh
784ae79476 Cast a bus_size_t to a (size_t) to use %zd specifier. Not quite the
right thing to do, but it is in compat code I don't want to sort out
at the moment.
2010-03-29 17:24:23 +00:00
Martin Blapp
c2ede4b379 Remove extraneous semicolons, no functional changes.
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	1 week
2010-01-07 21:01:37 +00:00
Robert Noland
cfd7bacef2 Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.
This replaces d_mmap() with the d_mmap2() implementation and also
changes the type of offset to vm_ooffset_t.

Purge d_mmap2().

All driver modules will need to be rebuilt since D_VERSION is also
bumped.

Reviewed by:	jhb@
MFC after:	Not in this lifetime...
2009-12-29 21:51:28 +00:00
Poul-Henning Kamp
6778431478 Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
2009-09-08 13:19:05 +00:00
Poul-Henning Kamp
b34421bf9c Add necessary include. 2009-09-08 13:16:55 +00:00
Roman Divacky
03cd51df00 Fix what seems to be an obvious typo preventing the body of the
if statement to ever be executed.

Approved by:	ed (mentor)
2009-06-23 09:02:24 +00:00
Jamie Gritton
c1f192193d Rename the host-related prison fields to be the same as the host.*
parameters they represent, and the variables they replaced, instead of
abbreviated versions of them.

Approved by:	bz (mentor)
2009-06-13 15:39:12 +00:00
Attilio Rao
1abcdbd127 When user_frac in the polling subsystem is low it is going to busy the
CPU for too long period than necessary.  Additively, interfaces are kept
polled (in the tick) even if no more packets are available.
In order to avoid such situations a new generic mechanism can be
implemented in proactive way, keeping track of the time spent on any
packet and fragmenting the time for any tick, stopping the processing
as soon as possible.

In order to implement such mechanism, the polling handler needs to
change, returning the number of packets processed.
While the intended logic is not part of this patch, the polling KPI is
broken by this commit, adding an int return value and the new flag
IFCAP_POLLING_NOCOUNT (which will signal that the return value is
meaningless for the installed handler and checking should be skipped).

Bump __FreeBSD_version in order to signal such situation.

Reviewed by:	emaste
Sponsored by:	Sandvine Incorporated
2009-05-30 15:14:44 +00:00
Jamie Gritton
76ca6f88da Place hostnames and similar information fully under the prison system.
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)
2009-05-29 21:27:12 +00:00
Sean Bruno
4470fe9dbe Minor updates as a precursor to fixing sbp_targ
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
2009-04-07 02:33:46 +00:00
Sean Bruno
450fa4f83a Reviewed by: scott (scottl@freebsd.org)
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.
2009-03-17 13:07:11 +00:00
Warner Losh
155a83e87a remove now-redunant cardbus attachment. 2009-03-09 13:23:54 +00:00
Sean Bruno
f541131711 Enhance debugging mode by storing the string "BB:TT:LL" once and use
it instead of overloading sbp_show_sdev_info().

replace calls to printf with calls to device_printf and cleanup debug
messages

Remove a bit of dead, commented out code.

Reviewed by:	scottl(mentor)
MFC after:	2 weeks
2009-02-18 18:41:34 +00:00
Sean Bruno
a71c4d427d Introduce 1394a-2000 extended PHY Self ID packets.
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
2009-02-17 19:37:04 +00:00
Sean Bruno
41fd7057bb Simplify some debugging messages and try to consolodate some of the more
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
2009-02-17 17:46:43 +00:00
Sean Bruno
ebe234793b Synopsis:
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
2009-02-17 04:08:08 +00:00
Sean Bruno
f25a08888f Update the Self ID structure to conform to 1394a-2000.
Delete the unused defines.

Reviewed by:	scottl
2009-02-13 17:45:09 +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
d717909f5a Update comments around various structs.
Add speeds S800, S1600 and S3200
2009-02-12 03:05:42 +00:00
Max Khon
0a5eaa9d0e Do not self-initialize a variable.
Found with:	Coverity Prevent(tm)
CID:		3864, 3865
2009-02-09 16:58:18 +00:00
Max Khon
166366b5cd Remove unused variable.
Found with:	Coverity Prevent(tm)
CID:		3693
2009-02-09 16:57:07 +00:00
Sean Bruno
23ee18767e Delete fwohci_filt() as it is now unused
Obtained from:	Marius Strobl <marius@alchemy.franken.de>
MFC after:	2 weeks
2009-02-03 17:13:37 +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
Marko Zec
8b615593fc Step 1.5 of importing the network stack virtualization infrastructure
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
2008-10-02 15:37:58 +00:00
Ed Schouten
6bfa9a2d66 Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel
yesterday, I realised calling minor() everywhere is quite confusing.
Character devices now only have the ability to store a unit number, not
a minor number. Remove the confusion by using dev2unit() everywhere.

This commit could also be considered as a bug fix. A lot of drivers call
minor(), while they should actually be calling dev2unit(). In -CURRENT
this isn't a problem, but it turns out we never had any problem reports
related to that issue in the past. I suspect not many people connect
more than 256 pieces of the same hardware.

Reviewed by:	kib
2008-09-27 08:51:18 +00:00
Bjoern A. Zeeb
603724d3ab Commit step 1 of the vimage project, (network stack)
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
2008-08-17 23:27:27 +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
Ruslan Ermilov
ea26d58729 Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.
Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true
since the advent of MBUMA.

Reviewed by:	arch

There are ongoing disputes as to whether we want to switch to directly using
UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
2008-03-25 09:39:02 +00:00
Julian Elischer
3745c395ec Rename the kthread_xxx (e.g. kthread_create()) calls
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.
2007-10-20 23:23:23 +00:00
Hidetoshi Shimokawa
b0f99fbdbc Protect transaction labels by its own lock to reduce lock contention.
Approved by: re (rwatson)
2007-07-20 03:42:57 +00:00
Hidetoshi Shimokawa
f0441453c1 Improve acquisition of transaction labels.
- 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)
2007-07-15 13:00:29 +00:00
Hidetoshi Shimokawa
ead41a8810 Fix a bug of retrieving configuration ROM.
- 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
2007-07-08 11:47:52 +00:00
Scott Long
b50569b71d Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now.  This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.
2007-06-17 05:55:54 +00:00
Hidetoshi Shimokawa
99b242f354 - Lock sbp_write_cmd() and ORB_POINTER_ACTIVE flag.
- Remove unnecessary timestamps.
- Return CAM_RESRC_UNAVAIL for ORB shortage.
- Fix a lock problem when doorbell is used.
- Fix a potential bug for unordered execution.
2007-06-16 00:59:41 +00:00
Hidetoshi Shimokawa
9b33b1ab38 - Suppress compiler optimization so that orb[1] must be written first.
We may need an explicit memory barrier for other architectures other than i386/amd64.

MFC after: 3 days
2007-06-14 12:52:13 +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
Matt Jacob
ea47b6c8d2 Include now unused var within #if 0 where it come back if the other
#if 0 code comes back- quiets gcc 4.2
2007-06-08 01:34:04 +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
Andrew Gallatin
4930d13c50 Fix a typo to make this file compile 2007-06-06 18:33:38 +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
bebdf94c45 Make sure fwsid is not NULL.
MFC after: 3 days
2007-05-21 12:17:54 +00:00
Hidetoshi Shimokawa
9404513cfa MFp4: Simplify the bus probe routin using a kthread.
MFC after: 1 week
2007-05-21 02:18:50 +00:00
Hidetoshi Shimokawa
c6cf3e202a - Initialize login->id and fix problem for non-zero login id.
- Increase maxopenings for multiple lun/initiators.

MFC after: 3 days
2007-05-11 14:51:13 +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
2c70b09005 MFp4:
- Update state in fw_xferq_dorain() after removed from the send queue.
- Remove unnecessary 'goto err;".

MFC after: 1 week
2007-04-30 13:51:13 +00:00