Commit Graph

76194 Commits

Author SHA1 Message Date
Warner Losh
85e6efa229 Style(9) pass. 2010-01-04 20:34:15 +00:00
Luigi Rizzo
7173b6e554 Various cleanup done in ipfw3-head branch including:
- use a uniform mtag format for all packets that exit and re-enter
  the firewall in the middle of a rulechain. On reentry, all tags
  containing reinject info are renamed to MTAG_IPFW_RULE so the
  processing is simpler.

- make ipfw and dummynet use ip_len and ip_off in network format
  everywhere. Conversion is done only once instead of tracking
  the format in every place.

- use a macro FREE_PKT to dispose of mbufs. This eases portability.

On passing i also removed a few typos, staticise or localise variables,
remove useless declarations and other minor things.

Overall the code shrinks a bit and is hopefully more readable.

I have tested functionality for all but ng_ipfw and if_bridge/if_ethersubr.
For ng_ipfw i am actually waiting for feedback from glebius@ because
we might have some small changes to make.
For if_bridge and if_ethersubr feedback would be welcome
(there are still some redundant parts in these two modules that
I would like to remove, but first i need to check functionality).
2010-01-04 19:01:22 +00:00
Michael Tuexen
f5366806c6 Correct usage of parenthesis.
PR:	kern/142066
Approved by: rrs (mentor)
Obtained from: Henning Petersen, Bruce Cran.
MFC after: 2 weeks
2010-01-04 18:25:38 +00:00
Konstantin Belousov
181d0b5dab Bump __FreeBSD_version for scandir(3) and alphasort(3) prototype changes. 2010-01-04 15:41:16 +00:00
Edward Tomasz Napierala
922ec47140 Fix comments. 2010-01-04 12:39:42 +00:00
David Xu
79f8b61995 Add user-level semaphore synchronous type, this change allows multiple
processes to share semaphore by using shared memory area, in simplest case,
only one atomic operation is needed in userland, waiter flag is maintained by
kernel and userland only checks the flag, if the flag is set, user code enters
kernel and does a wakeup() call.
Move type definitions into file _umtx.h to minimize compiling time.
Also type names need to be prefixed with underline character, this would reduce
name conflict (still in progress).
2010-01-04 05:27:49 +00:00
Rui Paulo
16ffe04c2f Remove CNS11XXNAS.hints. 2010-01-04 03:40:46 +00:00
Rui Paulo
381a19cce0 Add support for Cavium Econa CNS11XX ARM boards. These boards were
previously know by StarSemi STR9104.

Tested by the submitter on an Emprex NSD-100 board.

Submitted by:	Yohanes Nugroho <yohanes at gmail.com>
Reviewed by:	freebsd-arm, stas
Obtained from:	//depot/projects/str91xx/...
2010-01-04 03:35:45 +00:00
Warner Losh
f29b8b7f41 cardbus -> CardBus 2010-01-03 23:31:58 +00:00
Warner Losh
f33a1c1621 cardbus -> CardBus 2010-01-03 23:29:49 +00:00
Warner Losh
afa45c0763 cardbus -> CardBus 2010-01-03 23:28:32 +00:00
Warner Losh
cba55405e1 CardBus instead of cardbus. 2010-01-03 23:26:29 +00:00
Warner Losh
a2d61e43c2 Fix CardBus spelling.
MFC after:	1 month
2010-01-03 23:15:14 +00:00
Pyun YongHyeon
4f4a16e152 Fix regression introduced in r198318. BCM5754/BCM5754M uses the
same ASIC ID of BCM5758 such that r198318 incorecctly enabled TSO
on BCM5754.BCM5754M controllers. BCM5754/BCM5754M needs a special
firmware to enable TSO and bge(4) does not support firmware based
TSO.

Reported by:	ed
Tested by:	ed
2010-01-03 21:49:24 +00:00
Brooks Davis
9efde58392 Add vlan(4) to all GENERIC kernels.
MFC after:	1 week
2010-01-03 20:40:54 +00:00
Rick Macklem
3968293472 The test for "same client" for the experimental nfs server over NFSv4
was broken w.r.t. byte range lock conflicts when it was the same client
and the request used the open_to_lock_owner4 case, since lckstp->ls_clp
was not set. This patch fixes it by using "clp" instead of "lckstp->ls_clp".

MFC after:	2 weeks
2010-01-03 20:08:10 +00:00
Rick Macklem
b04b4acda0 Fix three related problems in the experimental nfs client when
checking for conflicts w.r.t. byte range locks for NFSv4.
1 - Return 0 instead of EACCES when a conflict is found, for F_GETLK.
2 - Check for "same file" when checking for a conflict.
3 - Don't check for a conflict for the F_UNLCK case.
2010-01-03 18:27:10 +00:00
Edward Tomasz Napierala
3a597bfc7b Make mac_lomac(4) able to interpret NFSv4 access bits.
Reviewed by:	rwatson
2010-01-03 17:19:14 +00:00
Martin Blapp
593a1aea1a Fix card/device names, no functional change
The ADMtek AN985 is the cardbus variant of ADMtek AN983
The Netgear FA511 is just a relabled ADMtek AN985

PR:		kern/50574
MFC after:	1 month
2010-01-03 13:59:59 +00:00
Navdeep Parhar
567145993f Avoid NULL dereference in arpresolve. 2010-01-03 06:43:13 +00:00
Yoshihiro Takahashi
dd2bf8ea67 Re-enable more options and devices. Now kernel size problem is gone.
MFC after:	2 week
2010-01-03 04:38:38 +00:00
Marius Strobl
9a41d9ef93 Exclude options COMPAT_FREEBSD4 now that the MD freebsd4_sigreturn()
is gone since r201396 and which is also in line with the fact that
FreeBSD 4 didn't supported sparc64.
2010-01-03 02:58:43 +00:00
Matt Jacob
1943fd192a Make sure that the WWNN is also created for 2100..2300 cards.
MFC after:	1 day
2010-01-03 02:43:46 +00:00
Xin LI
1ee5de4482 Reduce diff against OpenSolaris - move Giant acquire/release to
zfs_znode.c.  As a side effect this also eliminates two potential
Giant leaks.

Approved by:	pjd
MFC after:	1 month
2010-01-02 23:38:03 +00:00
Martin Blapp
1457e0cdac Fix typo: s/partion/partition/
Submitted by:	Marc Balmer <marc@msys.ch>
MFC after:	3 days
2010-01-02 17:32:40 +00:00
Marius Strobl
be70411f82 - Demapping unused kernel TLB slots has proven to work reliably so move
the associated debugging under bootverbose.
- Remove freebsd4_sigreturn(); given that FreeBSD 4 didn't supported
  sparc64 this only ever served as a transition aid prior to FreeBSD
  5.0 and is unused by default since COMPAT_FREEBSD4 was removed from
  GENERIC in r143072 nearly 5 years ago.
2010-01-02 15:44:16 +00:00
Marius Strobl
c936816f6d - Preserve the PROM IOMMU in order to allow OFW drivers to continue to
work.
- Sanity check the parameters passed to the implementations of the
  pcib_{read,write}_config() methods. Using illegal values can cause
  no real harm but it doesn't hurt to avoid unnecessary data error
  traps requiring to flush and re-enable the level 1 caches.
2010-01-02 15:19:33 +00:00
Warner Losh
8ba6b16f90 Welcome to 2010. 2010-01-02 01:12:10 +00:00
Marcel Moolenaar
665bb830e2 Properly return the UUID represented by the alias.
PR:		142174
Submitted by:	Przemyslaw Laczynski <torindel@gmail.com>
Pointy hat to:	rpaulo
2010-01-02 01:02:59 +00:00
Marcel Moolenaar
f7afeafebb Change BUS_SPACE_MAXADDR from 2^32-1 to 2^64-1. 2^32-1 is representative
for its origin, more than for its accuracy.

MFC after:	1 week
2010-01-02 00:37:00 +00:00
Marius Strobl
209817b163 Fix botches in r201005:
- Actually use the newly introduced sc_res in the front-end.
- Remove a whitespace glitch in mk48txx_gettime().
2010-01-01 22:47:53 +00:00
David E. O'Brien
93d8be03d9 Quiet variable "shadows" warning:
sys/vmmeter.h: warning: shadowed declaration is here
  machine/cpufunc.h: In function 'insw':
  machine/cpufunc.h: warning: declaration of 'cnt' shadows a global declaration
  ..snip..
2010-01-01 20:55:11 +00:00
Brooks Davis
7eb5db5179 If a filter has already been added, actually return EEXIST when trying
at add it again.

MFC after:	1 week
2009-12-31 20:56:28 +00:00
John Baldwin
fb92ad4af5 Use stricter checking to match possible vlan clones by not allowing extra
garbage characters around or within the tag.

Reviewed by:	brooks
MFC after:	3 days
2009-12-31 20:44:38 +00:00
Brooks Davis
a6fffd6cb0 The devices that supported EVFILT_NETDEV kqueue filters were removed in
r195175.  Remove all definitions, documentation, and usage.

fifo_misc.c:
	Remove all kqueue tests as fifo_io.c performs all those that
	would have remained.

Reviewed by:	rwatson
MFC after:	3 weeks
X-MFC note:	don't change vlan_link_state() function signature
2009-12-31 20:29:58 +00:00
Konstantin Belousov
17c4c3563c Allow swap out of the kernel stack for the thread with priority greater
or equial then PSOCK, not less or equial. Higher priority has lesser
numerical value.

Existing test does not allow for swapout of the thread waiting for
advisory lock, for exiting child or sleeping for timeout. On the other
hand, high-priority waiters of VFS/VM events can be swapped out.

Tested by:	pho
Reviewed by:	jhb
MFC after:	1 week
2009-12-31 18:52:58 +00:00
Rick Macklem
5d60668c70 Fix the experimental NFS client so that it can create Unix
domain sockets on an NFSv4 mount point. It was generating
incorrect XDR in the request for this case.

Tested by:	infofarmer
MFC after:	2 weeks
2009-12-31 18:02:48 +00:00
Yoshihiro Takahashi
02694ba6bc Reimplement the boot2 for pc98 completely.
It's based on the newest i386's one and has the advantage of:

 - ELF binary support.
 - UFS2 filesystem support.
 - Many FreeBSD slices support on a disk.

Tested by:	SATOU Tomokazu ( tomo1770 _ maple _ ocn _ ne _ jp ),
		WATANABE Kazuhiro ( CQG00620 _ nifty _ ne _ jp ) and
		nyan

MFC after:	2 week

Happy New Year in Japan!!
2009-12-31 15:03:33 +00:00
Yoshihiro Takahashi
5c44b2a6b3 Don't use 15M-16M area on pc98. It's reserved for some devices.
MFC after:	2 week
2009-12-31 12:17:38 +00:00
Yoshihiro Takahashi
6925b4bda1 Add setting machine type support to the loader.
MFC after:	2 week
2009-12-31 12:05:48 +00:00
Matt Jacob
1d52a1ad42 Create a Node WWN from the *Port* WWN, not vice versa, for 2400s.
If the NAA is type 2, the Node WWN is the Port WWN with the 12 bits
of port (48..60) cleared. This iff a wwn fetched from NVRAM is zero.

MFC after:	1 week
2009-12-31 04:16:18 +00:00
Qing Li
9f1409057b Remove a deleted comment line that was brought back by
my previous commit.

MFC after:	5 days
2009-12-31 01:09:16 +00:00
Andrew Thompson
87b88f757d Add new device ID to uipaq driver
PR:		usb/141936
Submitted by:	HASHI Hiroaki
2009-12-31 00:55:50 +00:00
Ed Schouten
03bc68ca09 Disable K&R style function definitions for WARNS=6.
Unfortunately there are two slight problems with that:

- Yacc and lex might generate code that generates warnings because of
  this. Require yacc and lex to be rebuilt during bootstrap. I'm not
  incrementing __FreeBSD_version here, because I assume someone else
  will do this eventually.

- When running `make buildkernel', it uses share/mk from the source
  treeo to build aicasm. Because aicasm also depends on lex, this would
  break. Lower WARNS to 5 for now. We should just increment it to 6
  again somewhere in the very far future.
2009-12-31 00:07:26 +00:00
John Baldwin
6a41dc1043 Actually set RLE_ALLOCATED when allocating a reserved resource so that
resource_list_release() will later release the resource instead of failing.
2009-12-30 22:37:28 +00:00
John Baldwin
3a6b4b04ab Fix an error case I missed in the previous change so that the CIS resource
is fully cleaned up if we fail to find the CIS in the devices ROM.
2009-12-30 22:34:26 +00:00
Qing Li
ccbb9c359d Consolidate the route message generation code for when address
aliases were added or deleted. The announced route entry for
an address alias is no longer empty because this empty route
entry was causing some route daemon to fail and exit abnormally.

MFC after:	5 days
2009-12-30 22:13:01 +00:00
Qing Li
baf7c37373 Multiple IPv6 addresses of the same prefix can be installed on the
same interface. The first address will install the prefix route into
the kernel routing table and that prefix will be marked as on-link.
Without RADIX_MPATH enabled, the other address aliases of the same
prefix will update the prefix reference count but no other routes
will be installed. Consequently the prefixes associated with these
addresses would not be marked as on-link. As such, incoming packets
destined to these address aliases will fail the ND6 on-link check
on input. This patch fixes the above problem by searching the kernel
routing table and try to find an on-link prefix on the given interface.

MFC after:	5 days
2009-12-30 21:51:23 +00:00
Qing Li
c7ab66020f The proxy arp entries could not be added into the system over the
IFF_POINTOPOINT link types. The reason was due to the routing
entry returned from the kernel covering the remote end is of an
interface type that does not support ARP. This patch fixes this
problem by providing a hint to the kernel routing code, which
indicates the prefix route instead of the PPP host route should
be returned to the caller. Since a host route to the local end
point is also added into the routing table, and there could be
multiple such instantiations due to multiple PPP links can be
created with the same local end IP address, this patch also fixes
the loopback route installation failure problem observed prior to
this patch. The reference count of loopback route to local end would
be either incremented or decremented. The first instantiation would
create the entry and the last removal would delete the route entry.

MFC after:	5 days
2009-12-30 21:35:34 +00:00
John Baldwin
767dff0ac9 Delete the CIS resource after releasing it. This is needed when the CIS is
stored in a BAR since the CIS BAR is mapped before the PCI bus driver
enumerates all the BARs.  Without this change, the PCI bus driver would
attempt to initialize a BAR that was already allocated resulting in a panic.
2009-12-30 20:49:13 +00:00
John Baldwin
4e8790e943 Teach the PCI bus driver to handle PCIR_BIOS BARs properly and remove special
handling for the PCIR_BIOS decoding enable bit from the cardbus driver.
The PCIR_BIOS BAR does include type bits like other BARs.  Instead, it is
always a 32-bit non-prefetchable memory BAR where the low bit is used as a
flag to enable decoding.

Reviewed by:	imp
2009-12-30 20:47:14 +00:00
John Baldwin
f26d7f8e95 Use bus_*() rather than bus_space_*(). 2009-12-30 20:42:07 +00:00
John Baldwin
1280c1198d Remove no longer used pci_release_resource(). 2009-12-30 19:46:09 +00:00
John Baldwin
0eb9893a80 - Assert that a reserved resource returned via resource_list_alloc() is not
active.
- Fix bus_generic_rl_(alloc|release)_resource() to not attempt to fetch a
  resource list for grandchild devices, but just pass those requests up to
  the parent directly.  This worked by accident previously, but it is
  better to not let bus drivers try to operate on devices they do not
  manage.
2009-12-30 19:44:31 +00:00
John Baldwin
ef36004841 Use a constant instead of a magic number for the flag that enables decoding
of a device ROM.
2009-12-30 19:42:27 +00:00
Marcel Moolenaar
938026e334 Revamp bus_space access functions:
o   Optimize for memory mapped I/O by making all I/O port acceses function
    calls and marking the test for the IA64_BUS_SPACE_IO tag with
    __predict_false(). Implement the I/O port access functions in a new
    file, called bus_machdep.c.
o   Change the bus_space_handle_t for memory mapped I/O to the virtual
    address rather than the physical address. This eliminates the PA->VA
    translation for every I/O access. The handle for I/O port access is
    still the port number.
o   Move inb(), outb(), inw(), outw(), inl(), outl(), and their string
    variants from cpufunc.h and define them in bus.h. On ia64 these are
    not CPU functions at all. In bus.h they are merely aliases for the
    new I/O port access functions defined in bus_machdep.h.
o   Handle the ACPI resource bug in nexus_set_resource(). There we can
    do it once so that we don't have to worry about it whenever we need
    to write to an I/O port that is really a memory mapped address.

The upshot of this change is that the KBI is better defined and that I/O
port access always involves a function call, allowing us to change the
actual implementation without breaking the KBI. For memory mapped I/O the
virtual address is abstracted, so that we can change the VA->PA mapping
in the kernel without causing an KBI breakage. The exception at this time
is for bus_space_map() and bus_space_unmap().

MFC after:	1 week.
2009-12-30 18:15:25 +00:00
Alexander Motin
0d883b11e3 Call wakeup() only for the first request on the queue. 2009-12-30 17:23:27 +00:00
Ed Schouten
73c4bad04d Add missing `void' keywords. 2009-12-30 16:56:50 +00:00
Shteryana Shopova
7c90b0258f Make sure the multicast forwarding cache entry's stall queue is properly
initialized before trying to insert an entry into it.

PR:		kern/142052
Reviewed by:	bms
MFC after:	now
2009-12-30 08:52:13 +00:00
Justin T. Gibbs
491e647805 In blkif_queue_cb(), test the return value from gnttab_claim_grant_reference()
for >= 0 instead of != ENOSPC.
2009-12-29 23:31:21 +00:00
Justin T. Gibbs
88dd7ba72b Correct bug introduced while purging the -ERRNO Linuxism from the
grant table API.  Valid grant refs are in the range of positive 32bit
integers.  ENOSPACE, being 29, is also a positive integer.  Return
GNTTAB_LIST_END (-1) instead when gnttab_claim_grant_reference() fails.
2009-12-29 23:28:13 +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
Alexander Motin
723bd8c6b5 Usually these controllers are able to automatically decode command code to
get required command protocol. But they have no idea about new commands,
such as DATA SET MANAGEMENT (TRIM). As soon as this info any way provided
by CAM, give controller specific instructions.
2009-12-29 21:49:11 +00:00
Rui Paulo
dc1c6863fa Delete old firmware. 2009-12-29 20:15:52 +00:00
Rui Paulo
0f454b93f8 iwn(4) update. Notable changes:
* new firmware
* untested support for 1000 and 6000 series
* bgscan support
* remove unnecessary RXON changes
* allow setting of country/regdomain by enforcing channel flags read
  from the EEPROM
* suspend/resume fixes
* RF kill switch fixes
* LED adjustments
* several bus_dma*() related fixes
* addressed some LORs
* many other bug fixes

Submitted by:	Bernhard Schmidt <bschmidt at techwires.net>
Obtained from:	Brandon Gooch <jamesbrandongooch at gmail dot com> (LED
		related changes), Benjamin Kaduk <kaduk at mit dot edu>
		(LOR fixes), OpenBSD
2009-12-29 19:47:34 +00:00
Marius Strobl
c64b2eba8a - Remove a redundant variable and an unnecessary cast.
- Fix whitespace.
2009-12-29 14:06:36 +00:00
Marius Strobl
7d027c4ff2 - Prefer i and j over i and n for temporary integer variables.
- Wrap/shorten too long lines.
- Remove a redundant variable and an unnecessary cast in schizo(4).
2009-12-29 14:03:38 +00:00
Philip Paeps
a6eb469d8e Fix autonegotiation: tell the MAC where to find the PHY.
Fix crashes in the detach path.

Submitted by:	Kristof Provost <kristof@sigsegv.be>
MFC after:	1 month
2009-12-29 14:00:17 +00:00
John Baldwin
5428776e2c Change vlan interfaces to cope more usefully with the parent interface being
renamed.  Previously the vlan interfaces would lose their configuration as if
the parent interface had been physically removed.  Now vlan interfaces ignore
rename events.
- Add a new ifnet flag (IFF_RENAMING) that is set while an ifnet is being
  renamed.  This flag can be checked in ifnet departure/arrival event
  handlers to treat rename events differently.
- Change the ifnet departure event handler in the if_vlan(4) driver to
  ignore departure events due to a trunk interface being renamed.

Reviewed by:	brooks, rwatson
MFC after:	1 week
2009-12-29 13:35:18 +00:00
Edward Tomasz Napierala
6cb02977e2 SLIP is gone; remove its mutex from witness. 2009-12-29 08:45:27 +00:00
Joseph Koshy
e9b5dc16ef Use VFS_{LOCK,UNLOCK}_GIANT() around the call to vrele().
Reviewed by:	 kib
2009-12-29 02:35:50 +00:00
Luigi Rizzo
bcd3b68dd2 we really need htonl() here, see the comment a few lines above in the code. 2009-12-29 00:02:57 +00:00
Ed Schouten
01d716fc66 Use ANSI declarations instead of K&R. 2009-12-28 23:12:55 +00:00
Ed Schouten
62375ca8c1 Don't forget to use `void' for sched_balance(). It has no arguments. 2009-12-28 23:12:12 +00:00
Antoine Brodin
13e403fdea (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR:		137213
Submitted by:	Eygene Ryabinkin (initial version)
MFC after:	1 month
2009-12-28 22:56:30 +00:00
Xin LI
9189129097 Apply OpenSolaris revision 8012 which brings our zpool to version 14,
making it possible for zpools created on OpenSolaris 2009.06 be used
on FreeBSD.

PR:		kern/141800
Submitted by:	mm
Reviewed by:	pjd, trasz
Obtained from:	OpenSolaris
MFC after:	2 weeks
2009-12-28 22:15:11 +00:00
Bjoern A. Zeeb
fc74d005d9 Make the compiler happy after r201125:
- + remove two unnecessary initializations in ip_output;
+ + remove one unnecessary initializations in ip_output;
2009-12-28 21:14:18 +00:00
Alexander Motin
1c80ec0a6b Add BIO_DELETE support to ada(4):
- For SSDs use TRIM feature of DATA SET MANAGEMENT command, as defined by
ACS-2 specification working draft.
- For CompactFlash use CFA ERASE command, same as ad(4) does.

With this patch, `newfs -E /dev/ada1` was able to restore write speed of
my heavily weared OCZ Vertex SSD (firmware 1.4) up to the initial level
for the most part of it's capacity. Previous 1.3 firmware, even reportiong
TRIM capabilty bit set, was not working, reporting ABORT error for every
DSM command.

I have no idea whether it is normal, but for some reason it takes 200ms
to handle any TRIM command on this drive, that was making delete extremely
slow. But TRIM command is able to accept long list of LBAs and the length of
that list seems doesn't affect it's execution time. Implemented request
clusting algorithm allowed me to rise delete rate up to reasonable numbers,
when many parallel DELETE requests running.
2009-12-28 20:08:01 +00:00
Justin T. Gibbs
a4660d594f Correct alignment and boundary constraints in blkfront's bus dma tag. The
blkif interface in Xen requires all I/O to be 512 byte aligned with each
segment bounded by a 4k page.

Note: This submission only documents the proper contraints for blkif I/O.
      The alignment code in busdma does not yet handle alignment constraints
      correctly in all cases.
2009-12-28 18:59:13 +00:00
Konstantin Belousov
a411786576 Add a knob to allow reclaim of the directory vnodes that are source of
the namecache records. The reclamation is not enabled by default because
for typical workload it would make namecache unusable, but large nested
directory tree easily puts any process that accesses filesystem into 1
second wait for vlru.

Reported by:	yar (long time ago)
MFC after:	3 days
2009-12-28 15:35:39 +00:00
Luigi Rizzo
ec396e61ed introduce a local variable rte acting as a cache of ro->ro_rt
within ip_output, achieving (in random order of importance):
- a reduction of the number of 'r's in the source code;
- improved legibility;
- a reduction of 64 bytes in the .text
2009-12-28 14:48:32 +00:00
Marius Strobl
4c6587a6cf Account for firmware versions which include the CDMA interrupts in
the OFW device tree.

MFC after:	3 days
2009-12-28 14:16:40 +00:00
Luigi Rizzo
ca8b83b0fa + remove an unused #define print_ip;
+ remove two unnecessary initializations in ip_output;
+ localize 'len';
+ introduce a temporary variable n to count the number of fragments,
  the compiler seems unable to identify a common subexpression
  (written 3 times, used twice);
+ document some assumptions on ip_len and ip_hl
2009-12-28 14:09:46 +00:00
Luigi Rizzo
e59084e086 bring the NGM_IPFW_COOKIE back into ng_ipfw.h, libnetgraph expects
to find it there. Unfortunately this reintroduces the dependency
on ip_fw_pfil.c
2009-12-28 12:29:13 +00:00
Luigi Rizzo
830c6e2b97 bring in several cleanups tested in ipfw3-head branch, namely:
r201011
- move most of ng_ipfw.h into ip_fw_private.h, as this code is
  ipfw-specific. This removes a dependency on ng_ipfw.h from some files.

- move many equivalent definitions of direction (IN, OUT) for
  reinjected packets into ip_fw_private.h

- document the structure of the packet tags used for dummynet
  and netgraph;

r201049
- merge some common code to attach/detach hooks into
  a single function.

r201055
- remove some duplicated code in ip_fw_pfil. The input
  and output processing uses almost exactly the same code so
  there is no need to use two separate hooks.
  ip_fw_pfil.o goes from 2096 to 1382 bytes of .text

r201057 (see the svn log for full details)
- macros to make the conversion of ip_len and ip_off
  between host and network format more explicit

r201113 (the remaining parts)
- readability fixes -- put braces around some large for() blocks,
  localize variables so the compiler does not think they are uninitialized,
  do not insist on precise allocation size if we have more than we need.

r201119
- when doing a lookup, keys must be in big endian format because
  this is what the radix code expects (this fixes a bug in the
  recently-introduced 'lookup' option)

No ABI changes in this commit.

MFC after:	1 week
2009-12-28 10:47:04 +00:00
Luigi Rizzo
6cc7b9f5d9 readability fixes -- add braces on large blocks, remove unnecessary
initializations
2009-12-28 10:19:53 +00:00
Luigi Rizzo
6730dcaec7 explain details of operation of table lookups, and improve portability 2009-12-28 10:12:35 +00:00
Andrew Thompson
b55b073f14 Compact USB_VENDOR_X and USB_PRODUCT_Y in the quirk tables. 2009-12-28 00:42:42 +00:00
Marius Strobl
5cb5104246 Add a driver for the `Fire' JBus to PCIe bridges found in at least
the Sun Fire V215/V245 and Sun Ultra 25/45 machines. This driver also
already includes all the code to support the `Oberon' Uranus to PCIe
bridges found in the Fujitsu-Siemens based Mx000 machines but due to
lack of access to such a system for testing, probing of these bridges
is currently disabled.
Unfortunately, the event queue mechanism of these bridges for MSIs/
MSI-Xs matches our current MD and MI interrupt frameworks like square
pegs fit into round holes so for now we are generous and use one event
queue per MSI, which limits us to 35 MSIs/MSI-Xs per Host-PCIe-bridge
(we use one event queue for the PCIe error messages). This seems
tolerable as long as most devices just use one MSI/MSI-X anyway.
Adding knowledge about MSIs/MSI-Xs to the MD interrupt code should
allow us to decouple the 1:1 mapping at the cost of no longer being
able to bind MSIs/MSI-Xs to specific CPUs as we currently have no
reliable way to quiesce a device during the transition of its MSIs/
MSI-Xs to another event queue. This would still require the problem
of interrupt storms generated by devices which have no one-shot
behavior or can't/don't mask interrupts while the filter/handler is
executed (like the older PCIe NICs supported by bge(4)) to be solved
though.

Committed from:	26C3
2009-12-27 16:55:44 +00:00
Luigi Rizzo
2082ecd966 diverted packet must re-enter _after_ the matching rule,
or we create loops.
The divert cookie (that can be set from userland too)
contains the matching rule nr, so we must start from nr+1.

Reported by: Joe Marcus Clarke
2009-12-27 10:19:10 +00:00
Bjoern A. Zeeb
2254f022a0 Add missing include to make LINT-VIMAGE build as well.
Found by:	test building an MFC candidate
X-MFC with:	r200471
2009-12-27 10:10:38 +00:00
Marcel Moolenaar
76e42b3a0c Use unordered memory loads and stores for the in* and out*
family of functions.
2009-12-26 22:22:09 +00:00
Marcel Moolenaar
d85de18e39 SYnc with amd64:
De-support adv_isa.c and aic_isa.c
2009-12-26 22:06:55 +00:00
Rick Macklem
4a8e21764d When porting the experimental nfs subsystem to the FreeBSD8 krpc,
I added 3 functions that were already in the experimental client
under different names. This patch deletes the functions in the
experimental client and renames the calls to use the other set.
(This is just removal of duplicated code and does not fix any bug.)

MFC after:	2 weeks
2009-12-26 19:15:15 +00:00
Andrew Thompson
9e6b53136e Use macros to strip off USB_VENDOR_ and USB_PRODUCT_ from some id tables to make
them more compact and readable.
2009-12-26 19:03:28 +00:00
Joseph Koshy
8ca7958478 * Support the L1D_CACHE_LD event on Core2 processors.
* Correct a group of typos: for Core2 programmable events, check
  user supplied umask values against the correct event descriptor
  field.

Submitted by:	Ryan Stone <rysto32 at gmail dot com>
2009-12-26 14:39:23 +00:00
Joseph Koshy
bf792d68c7 Log process mappings for existing processes at PMC start time.
Submitted by:	Marc Unangst <mju at panasas dot com> [original patch]
Tested by:	fabient
2009-12-26 13:58:52 +00:00
Edward Tomasz Napierala
558e9b5c95 Now that all the callers seem to be fixed, add KASSERTs to make sure VAPPEND
is not being used improperly.
2009-12-26 11:36:10 +00:00
Marius Strobl
0c516eae87 Remove clause 3 from Izumi Tsutsui's licenses.
Obtained from:	NetBSD
2009-12-25 22:58:43 +00:00
Marius Strobl
de6a190429 Style changes
Obtained from:	NetBSD (mc146818reg.h)
2009-12-25 22:53:46 +00:00
Marius Strobl
033a5c8ce1 - Take advantage of bus_{read,write}_*(9).
- Set dow = -1 in mk48txx_gettime() because some drivers (for example
  the NetBSD and OpenBSD mk48txx(4)) don't set it correctly.
2009-12-25 21:53:20 +00:00
Marius Strobl
1b02305785 Remove clause 3 and 4 from TNF licenses.
Obtained from:	NetBSD
2009-12-25 21:41:05 +00:00
Marius Strobl
a64ac9c1e3 Style changes 2009-12-25 21:32:26 +00:00
Bjoern A. Zeeb
e4ff598ec6 Remove extra spaces (no functional change).
MFC after:	3 days
2009-12-25 21:14:05 +00:00
Rick Macklem
8da45f2c6e Modify the experimental server so that it uses VOP_ACCESSX().
This is necessary in order to enable NFSv4 ACL support. The
argument to nfsvno_accchk() was changed to an accmode_t and
the function nfsrv_aclaccess() was no longer needed and,
therefore, deleted.

Reviewed by:	trasz
MFC after:	2 weeks
2009-12-25 20:44:19 +00:00
Bjoern A. Zeeb
095809b084 Remove an unused global.
MFC after:	3 days
2009-12-25 20:03:03 +00:00
Gavin Atkinson
cd3135e9ec Set the locally-assigned bit in the randomly generated Ethernet address
if we end up having to generate one.

PR:		kern/133239
Discussed with:	yongari
Approved by:	ed (mentor)
MFC after:	2 weeks
2009-12-25 19:57:28 +00:00
Gavin Atkinson
f0b108cf03 Small spelling fix, "Ethetnet" -> "Ethernet"
Approved by:	ed (mentor)
MFC after:	1 week
2009-12-25 19:38:12 +00:00
Alexander Motin
c078c19633 Teach twe driver to report array stripe size to GEOM. 2009-12-25 17:34:43 +00:00
Marius Strobl
10a290af39 - Hook up the default implementations of the MSI/MSI-X pcib_if methods
so requests may bubble up to a host-PCI bridge driver.
- Distinguish between PCI and PCIe bridges in the device description
  so it's a bit easier to follow what hangs off of what in the dmesg.
  Unfortunately we can't also tell PCI and PCI-X apart based on the
  information provided in the OFW device tree.
- Add quirk handling for the ALi M5249 found in Fire-based machines
  which are used as a PCIe-PCIe bridge there. These are obviously
  subtractive decoding as as they have a PCI-ISA bridge on their
  secondary side (and likewise don't include the ISA I/O range in
  their bridge decode) but don't indicate this via the class code.
  Given that this quirk isn't likely to apply to all ALi M5249 and
  I have no datasheet for these chips so I could implement a check
  using the chip specific bits enabling subtractive decoding this
  quirk handling is added to the MD code rather than the MI one.
2009-12-25 15:03:05 +00:00
Alexander Motin
f45946a8f7 Avoid false positive probe on ICH6 chipsets. 2009-12-25 07:59:31 +00:00
Robert Watson
c7ca33d138 Minor comment tweaks in rmlocks.
MFC after:	3 days
2009-12-25 01:16:24 +00:00
Pyun YongHyeon
55219c9044 Remove wrong assertion. 2009-12-25 00:23:47 +00:00
Alexander Motin
ce8332d468 Report stripe size only if physical sector size is not equal to logical. 2009-12-24 21:54:44 +00:00
Pyun YongHyeon
cb05ec6606 ether_ifattach sets if_mtu, remove unnecessary code. 2009-12-24 20:45:33 +00:00
Pyun YongHyeon
da57a8c835 Update if_iqdrops in case of RX buffer allocation failure. 2009-12-24 20:43:31 +00:00
Pyun YongHyeon
b4c170e1f5 Add suspend/resume support as well as basic WOL.
While I'm here simplify SIOCSIFCAP handler.
2009-12-24 18:17:53 +00:00
Luigi Rizzo
4a3c1bd27f fix poor indentation resulting from a merge 2009-12-24 17:35:28 +00:00
Pyun YongHyeon
fabbaac560 Implement RX interrupt moderation using one-shot timer interrupt.
Unlike TX interrupt, ST201 does not provide any mechanism to
suppress RX interrupts. ste(4) can generate more than 70k RX
interrupts under heavy RX traffics such that these excessive
interrupts make system useless to process other useful things.
Maybe this was the major reason why polling support code was
introduced to ste(4).
The STE_COUNTDOWN register provides a programmable counter that
will generate an interrupt upon its expiration. We program
STE_DMACTL register to use 3.2us clock rate to drive the counter
register. Whenever ste(4) serves RX interrupt, the driver rearm
the timer to expire after STE_IM_RX_TIMER_DEFAULT time and disables
further generation of RX interrupts. This trick seems to work well
and ste(4) generates less than 8k RX interrupts even under 64 bytes
UDP torture test. Combined with TX interrupts, the total number of
interrupts are less than 10k which looks reasonable on heavily
loaded controller.

The default RX interrupt moderation time is 150us. Users can change
the value at any time with dev.ste.%d.int_rx_mod sysctl node.
Setting it 0 effectively disables the RX interrupt moderation
feature. Now we have both TX/RX interrupt moderation code so remove
loop of interrupt handler which resulted in sub-optimal performance
as well as more register accesses.
2009-12-24 17:22:15 +00:00
Marius Strobl
3438bdc53e Merge from amd64/i386:
Implement support for interrupt descriptions.
2009-12-24 15:43:37 +00:00
Marius Strobl
b1c13fc739 Add missing locking in intr_bind(). 2009-12-24 15:40:08 +00:00
Marius Strobl
005ad6daf8 Execute the cleanup handlers before jumping to the kernel just
like the other architectures do.
2009-12-24 15:23:51 +00:00
Marius Strobl
5e01e025a2 - Consistently wrap debugging in NETIF_DEBUG. This basically merges
NetBSD rev 1.19.
- Make the functions match their prototypes regarding static.
2009-12-24 15:16:16 +00:00
Marius Strobl
4794ebf3b9 Revert r183628 as with the current ata(4) ATAPI DMA with AcerLabs
M5229 appears to be once again fixed. If this happens to return
we probably should disable ATAPI DMA in ataacerlabs(4) instead
just like the Linux libATA does.
2009-12-24 15:14:35 +00:00
Alexander Motin
5f9b1143ac Make geom_concat to passthrough stripe parameters of the first component,
hoping that rest will fit.
2009-12-24 14:32:21 +00:00
Alexander Motin
113d8e5046 As soon as geom_raid3 reports it's own stripe as sector size, report largest
underlying provider's stripe, multiplied by number of data disks in array,
due to transformation done, as array stripe.
2009-12-24 13:38:02 +00:00
Marius Strobl
d92734d25a - Don't check for a valid interrupt controller on every interrupt
in intr_execute_handlers(). If we managed to get here without an
  associated interrupt controller we have way bigger problems.
  While at it predict stray vector interrupts as false as they are
  rather unlikely.
- Don't blindly call the clear function of an interrupt controller
  when adding a handler in inthand_add() as interrupt controllers
  like the one driven by upa(4) are auto-clearing and thus provide
  NULL instead.
2009-12-24 12:27:22 +00:00
Alexander Motin
92f60381d9 As soon as mirror has no own stripes, report largest stripe of unrerlying
components, hoping others fit, if they are not equal.
2009-12-24 12:17:22 +00:00
Alexander Motin
8b30323843 Add two disk ioctls, giving user-level tools information about disk/array
stripe (optimal access block) size and offset.
2009-12-24 11:05:23 +00:00
Alexander Motin
f00919d2fc Make geom_stripe report it's stripe size to upper layers. 2009-12-24 10:43:44 +00:00
Xin LI
dcc2b1ff46 Adapt OpenBSD pf's "sloopy" TCP state machine which is useful for Direct
Server Return mode, where not all packets would be visible to the load
balancer or gateway.

This commit should be reverted when we merge future pf versions.  The
benefit it would provide is that this version does not break any existing
public interface and thus won't be a problem if we want to MFC it to
earlier FreeBSD releases.

Discussed with:	mlaier
Obtained from:	OpenBSD
Sponsored by:	iXsystems, Inc.
MFC after:	1 month
2009-12-24 00:43:44 +00:00
Rui Paulo
bbb8e19daf Add hwpmc_arm.c 2009-12-23 23:53:30 +00:00
Rui Paulo
0ce207d2af Intel XScale hwpmc(4) support.
This brings hwpmc(4) support for 2nd and 3rd generation XScale cores.
Right now it's enabled by default to make sure we test this a bit.
When the time comes it can be disabled by default.
Tested on Gateworks boards.

A man page is coming.

Obtained from:	//depot/user/rpaulo/xscalepmc/...
2009-12-23 23:16:54 +00:00
Marius Strobl
48533564ca Recognize the NS16552 found in PCIe-based sun4u machines. 2009-12-23 22:31:43 +00:00
Marius Strobl
c39f5f5af4 - By re-arranging the code in OF_decode_addr() somewhat and accepting
a bit of a detour we can just iterate through the banks array instead
  of having to calculate every offset. This change is inspired by the
  powerpc version of this function.
- Add support for the JBus to EBus bridges which hang off of nexus(4).
2009-12-23 22:25:23 +00:00
Marius Strobl
ee57d839bb Style changes. 2009-12-23 22:11:33 +00:00
Marius Strobl
6ed76228c1 - Add support for the IOMMUs of Fire JBus to PCIe and Oberon Uranus
to PCIe bridges.
- Add support for talking the PROM mappings over to the kernel IOTSB
  just like we do with the kernel TSB in order to allow OFW drivers
  to continue to work.
- Change some members, parameters and variables to unsigned where
  more appropriate.
2009-12-23 22:02:34 +00:00
Marius Strobl
46c9b5d9bd Fix whitespace according to style(9). 2009-12-23 21:51:41 +00:00
Marius Strobl
926f4e43c6 - Add quirk handling for ALi M5229, mainly setting the magic "force
enable IDE I/O" bit which prevents data access traps with revision
  0xc8 in Fire-based machines when pci(4) enables PCIM_CMD_PORTEN.
- Like for sun4v also don't add the PCI side of host-PCIe bridges to
  the bus on sun4u as they don't have configuration space implement
  there either.
2009-12-23 21:38:59 +00:00
Marius Strobl
9cc21da577 - Sort the prototypes.
- Add macros to ease the access of device configuration space in
  ofw_pcibus_setup_device().
2009-12-23 21:25:16 +00:00
Marius Strobl
36fd650f09 Add structures for OFW MSI/MSI-X support. These are identical for
both sun4u and sun4v.
2009-12-23 21:07:49 +00:00
Marius Strobl
ec1ac5ad07 Hook ebus(4) and isa(4) up to the sun4v LINT build in order to
ensure that their compilation doesn't break as they are expected
to work as-is now (but aren't actually run-time tested).
2009-12-23 21:04:31 +00:00
Marius Strobl
d15bfa6899 - Remove devices which are/were only relevant for sun4u. 2009-12-23 20:52:45 +00:00
Marius Strobl
7bb518f115 Don't probe the bq4802 variant found in Ultra 25 and 45 for now as
this chip isn't MC146818 compatible and requires different handlers
(but which I can't test due to lack of such hardware).
2009-12-23 20:42:14 +00:00
Marius Strobl
4d116858df Don't use an out register to hold the vector number across the call
of the interrupt handler in intr_fast() as the handler might clobber
it (no in-tree handler currently does but an upcoming one will).
While at it, tidy the register usage in the interrupt counting code.
2009-12-23 20:23:04 +00:00
Pyun YongHyeon
ae49e7a695 We don't need to generate DMA complete interrupt for every
transmitted frames. So request interrupt for every 16th frames. Due
to the limitation of hardware we can't suppress the interrupt as
driver should have to check TX status register. The TX status
register can store up to 31 TX status so driver can't send more
than 31 frames without reading TX status register.
With this change controller would not generate TX completion
interrupt for every frame, so reclaim transmitted frames in
ste_tick().
2009-12-23 19:38:22 +00:00
Pyun YongHyeon
95a3c23b51 Correct STE_COUNTDOWN register offset. The datasheet was wrong. 2009-12-23 19:26:38 +00:00
Pyun YongHyeon
13e052e416 Remove unused duplicated register definition. It seems the
definition was made to access STE_ASICCTL register as 16bits but
ste(4) always access the register as 32bits so it was never used
before.
2009-12-23 19:21:37 +00:00
Pyun YongHyeon
8657caa66b Implement hardware MAC statistics counter support. The counters
could be accessed with dev.ste.0.stats sysctl node.
2009-12-23 19:18:07 +00:00
Luigi Rizzo
84918f5bc8 mostly style changes, such as removal of trailing whitespace,
reformatting to avoid unnecessary line breaks, small block
restructuring to avoid unnecessary nesting, replace macros
with function calls, etc.

As a side effect of code restructuring, this commit fixes one bug:
previously, if a realloc() failed, memory was leaked. Now, the
realloc is not there anymore, as we first count how much memory
we need and then do a single malloc.
2009-12-23 18:53:11 +00:00
Pyun YongHyeon
bfe051bd2e Report the correct result of mii_mediachg(). Previously it always
used to return success without respect to the result.
While I'm here use mii_mediachg() in ste_init_locked which allows
driver to use currently configured media. ste_ifmedia_upd() is
supposed to be called whenever user changes current media settings.
2009-12-23 18:42:25 +00:00
Pyun YongHyeon
5b7e31187e Don't report link status if driver is not running. 2009-12-23 18:28:47 +00:00
Pyun YongHyeon
931ec15a83 Overhaul RX filter programming.
o Let RX filter handler program promiscuous/multicast filter as
   well as broadcasting.
 o Remove unnecessary register access.
 o Simplify ioctl handler and have set_rxfilter to handle
   IFF_PROMISC and IFF_ALLMULTI change instead of directly
   programming the controller.
 o Removed unnecessary error variable reinitialization in ioctl
   handler.
 o Add IFF_DRV_RUNNING check before programming multicast filter.
 o Configure maximum allowed frame length before enabling MAC.
   Datasheet didn't say the exact ordering of programming sequence
   but it looks more natural to set maximum allowed frame length
   first prior to enabling controller.
2009-12-23 18:24:22 +00:00
Pyun YongHyeon
38c52cfdc1 Reimplement controller reset. Datasheet says full reset takes about
1ms. Since we switched to memory register mapping make sure to
flush PCI posted write by reading the register again.
While I'm here add additional delays in loop while driver waits the
completion of the reset.
2009-12-23 17:54:24 +00:00
Pyun YongHyeon
55d7003e48 Don't reinitialize controller if driver is already running. This
reduces number of link state UP/DOWN changes.
2009-12-23 17:46:11 +00:00
Randall Stewart
0e39bbc4dd Add missing function that doesintr naming and
init.
2009-12-23 14:55:33 +00:00
Randall Stewart
d0a679ea35 This is a list of the files for RMI's md_root
file system to get to multi-user. There are
still some rough edges, rge has an issue. And
someone held a spin lock to long.. But its
coming along :-)
2009-12-23 14:48:26 +00:00
Robert Watson
912f6323cd When warning about possible netisr configuration problems during boot,
report using "netisr_init" rather than "netisr2", which was the development
name for the project.

MFC after:	3 days
2009-12-23 12:33:59 +00:00
Robert Watson
0a32e29f59 Refine netisr.c comments a bit. 2009-12-23 12:31:27 +00:00
Luigi Rizzo
3ae19c3ba3 fix build with the new fast lookup structure.
Also remove some unnecessary headers
2009-12-23 12:15:21 +00:00
Luigi Rizzo
6aab896346 fix build on 64-bit architectures.
Also fix the indentation on a few lines.
2009-12-23 12:00:50 +00:00
Marcel Moolenaar
d9c849eceb Calculate the average CPU clock frequency and export that through
the hw.freq.cpu sysctl variable. This can be used by ports that
need to know "the" CPU frequency.
2009-12-23 06:52:12 +00:00
Marcel Moolenaar
2191712fd1 Export the bus, cpu and itc frequencies under the hw.freq sysctl node.
The frequencies are in MHz (i.e. a value of 1000 represents 1GHz). The
frequencies are rounded to the nearest whole MHz.

While here, rename and re-type bus_frequency, processor_frequency and
itc_frequency to bus_freq, cpu_freq and itc_freq and make them static.
As unsigned integers, the hw.freq.cpu sysctl can more easily be made
generic (across all architectures) making porting easier.

MFC after:	3 days
2009-12-23 04:48:42 +00:00
Marcel Moolenaar
30fd085c78 Add a bit definition for invalid timestamp in the record header. 2009-12-23 04:39:05 +00:00
Andrew Thompson
47d54fbb13 Shorten the USB_QUIRK_ENTRY macro and undef it at the end, its only internal. 2009-12-23 01:41:52 +00:00
Andrew Thompson
eb58441685 Move all Mass Storage Quirks over to the USB quirk module.
Submitted by:	Hans Petter Selasky
2009-12-23 01:16:24 +00:00
Andrew Thompson
7b360bcc6c Sync usb vendor/product defines to p4
Submitted by:	HPS
2009-12-23 01:12:54 +00:00
Pyun YongHyeon
81598b3e5e Reimplement Tx status error handler as recommended by datasheet.
If ste(4) encounter TX underrun or excessive collisions the TX MAC
of controller is stalled so driver should wake it up again. TX
underrun requires increasing TX threshold value to minimize
further TX underruns. Previously ste(4) used to reset controller
to recover from TX underrun, excessive collision and reclaiming
error. However datasheet says only TX underrun requires resetting
entire controller. So implement ste_restart_tx() that restarts TX
MAC and do not perform full reset except TX underrun case.
Now ste(4) uses CSR_READ_2 instead of CSR_READ_1 to read
STE_TX_STATUS register. This way ste(4) will also read frame id
value and we can write the same value back to STE_TX_FRAMEID
register instead of overwriting it to 0. The datasheet was wrong
in write back of STE_TX_STATUS so add some comments why we do so.
Also always invoke ste_txeoc() after ste_txeof() in ste_poll as
without reading TX status register can stall TX MAC.
2009-12-22 23:57:10 +00:00
Marius Strobl
b748710c34 - Correct an off-by-one error when calculating the end of a child
range.
- Spell the PCI TLA in uppercase.
2009-12-22 21:53:19 +00:00
Marius Strobl
63cd5b6d38 - Add support for the JBus to EBus bridges which hang off of nexus(4)
and are found in sun4u and sun4v machines based on the Fire ASIC.
- Initialize the configuration space of the PCI to EBus variant the
  same way as OpenSolaris does.
2009-12-22 21:49:53 +00:00
Marius Strobl
8bf72e61a7 - Add macros for the states of the interrupt clear registers.
- Change INTMAP_VEC() to take an INO as its second argument rather
  than an INR. The former is what I actually intended with this
  macro and how it's currently used.
2009-12-22 21:48:18 +00:00
Pyun YongHyeon
ec89b8a856 Prefer bus_write_{1,2,4}/bus_read_{1,2,4} to
bus_space_write_{1,2,4}/bus_space_read_{1,2,4}.
Remove unused ste_bhandle and ste_btag in softc.
2009-12-22 21:44:25 +00:00
Marius Strobl
ea77e7bb3f Make these constants unsigned which is more appropriate. 2009-12-22 21:42:54 +00:00
Pyun YongHyeon
c0270e602a Prefer memory space register mapping over io space. If memory space
mapping fails fall back to old io space mapping.
While I'm here use PCIR_BAR macro.
2009-12-22 21:39:34 +00:00
Marius Strobl
1bba41a506 Enroll these drivers in multipass probing. The motivation behind this
is that the JBus to EBus bridges share the interrupt controller of a
sibling JBus to PCIe bridge (at least as far as the OFW device tree
is concerned, in reality they are part of the same chip) so we have to
probe and attach the latter first. That happens to be also the case
due to the fact that the JBus to PCIe bridges appear first in the OFW
device tree but it doesn't hurt to ensure the right order.
2009-12-22 21:02:46 +00:00
Pyun YongHyeon
8d9f6dd948 Instead of relying on hard resetting of controller to stop
receiving incoming traffics, try harder to gracefully stop active
DMA cycles and then stop MACs. This is the way what datasheet
recommends and seems to work reliably. Resetting controller while
active DMAs are in progress is bad thing as we can't predict how
DMAs touche allocated TX/RX buffers. This change ensures controller
stop state before attempting to release allocated TX/RX buffers.
Also update MAC statistics which could have been updated during the
wait time of MAC stop.

While I'm here remove unnecessary controller resets in various
location. ste(4) no longer relies on hard controller reset to stop
controller and resetting controller also clears all configured
settings which makes it hard to implement WOL in near future.
Now resetting a controller is performed in ste_init_locked().
2009-12-22 20:57:30 +00:00
John Baldwin
b677f368bb Don't build zfsboot, gptzfsboot, and zfsloader if WITHOUT_ZFS is enabled.
MFC after:	1 week
2009-12-22 20:56:33 +00:00
Bruce M Simpson
aa16623133 Use ALLOW_NEW_SOURCES and BLOCK_OLD_SOURCES to signal a join or leave
with SSM MLDv2 by default.
This is current practice and complies with RFC 4604, as well as being
required by production IPv6 networks in Japan.
The behaviour may be disabled by setting the net.inet6.mld.use_allow
sysctl/tunable to 0.

Requested by:	Hideki Yamamoto
MFC after:	1 week
2009-12-22 20:40:22 +00:00
Pyun YongHyeon
10f695ee22 Reimplement miibus_statchg method. Don't rely on link state change
interrupt. If we want to use link state change interrupt ste(4)
should also implement auto-negotiation complete handler as well as
various PHY access handling. Now link state change is handled by
mii(4) polling so it will automatically update link state UP/DOWN
events which in turn make ste(4) usable with lagg(4).

r199559 added a private timer to drive watchdog and the timer also
used to drive MAC statistics update. Because the MAC statistics
update is called whenever statistics counter reaches near-full, it
drove watchdog timer too fast such that it caused false watchdog
timeouts under heavy TX traffic conditions.
Fix the regression by separating ste_stats_update() from driving
watchdog timer and introduce a new function ste_tick() that handles
periodic job such as driving watchdog, MAC statistics update and
link state check etc.
While I'm here clear armed watchdog timer in ste_stop().
2009-12-22 20:11:56 +00:00
Alexander Motin
7aab51b33e Add support for Intel SCH PATA controller.
PR:		kern/140251
2009-12-22 19:48:06 +00:00
Pyun YongHyeon
4465097b57 Introduce sc_flags member variable and use it to keep track of
link state and PHY related information.
Remove ste_link and ste_one_phy variable of softc as it's not used
anymore.
While I'm here add IFF_DRV_RUNNING check in ste_start_locked().
2009-12-22 19:32:16 +00:00
Luigi Rizzo
de240d1013 merge code from ipfw3-head to reduce contention on the ipfw lock
and remove all O(N) sequences from kernel critical sections in ipfw.

In detail:

 1. introduce a IPFW_UH_LOCK to arbitrate requests from
     the upper half of the kernel. Some things, such as 'ipfw show',
     can be done holding this lock in read mode, whereas insert and
     delete require IPFW_UH_WLOCK.

  2. introduce a mapping structure to keep rules together. This replaces
     the 'next' chain currently used in ipfw rules. At the moment
     the map is a simple array (sorted by rule number and then rule_id),
     so we can find a rule quickly instead of having to scan the list.
     This reduces many expensive lookups from O(N) to O(log N).

  3. when an expensive operation (such as insert or delete) is done
     by userland, we grab IPFW_UH_WLOCK, create a new copy of the map
     without blocking the bottom half of the kernel, then acquire
     IPFW_WLOCK and quickly update pointers to the map and related info.
     After dropping IPFW_LOCK we can then continue the cleanup protected
     by IPFW_UH_LOCK. So userland still costs O(N) but the kernel side
     is only blocked for O(1).

  4. do not pass pointers to rules through dummynet, netgraph, divert etc,
     but rather pass a <slot, chain_id, rulenum, rule_id> tuple.
     We validate the slot index (in the array of #2) with chain_id,
     and if successful do a O(1) dereference; otherwise, we can find
     the rule in O(log N) through <rulenum, rule_id>

All the above does not change the userland/kernel ABI, though there
are some disgusting casts between pointers and uint32_t

Operation costs now are as follows:

  Function				Old	Now	  Planned
-------------------------------------------------------------------
  + skipto X, non cached		O(N)	O(log N)
  + skipto X, cached			O(1)	O(1)
XXX dynamic rule lookup			O(1)	O(log N)  O(1)
  + skipto tablearg			O(N)	O(1)
  + reinject, non cached		O(N)	O(log N)
  + reinject, cached			O(1)	O(1)
  + kernel blocked during setsockopt()	O(N)	O(1)
-------------------------------------------------------------------

The only (very small) regression is on dynamic rule lookup and this will
be fixed in a day or two, without changing the userland/kernel ABI

Supported by: Valeria Paoli
MFC after:	1 month
2009-12-22 19:01:47 +00:00
Pyun YongHyeon
1bf71544de Add minimal dealy while ste(4) is waiting for the end of active DMA
cycle.
2009-12-22 19:00:18 +00:00
Pyun YongHyeon
a1b2c20925 Add bus_dma(9) and endianness support to ste(4).
o Sorted includes and added missing header files.
 o Added basic endianness support. In theory ste(4) should work on
   any architectures.
 o Remove the use of contigmalloc(9), contigfree(9) and vtophys(9).
 o Added 8 byte alignment limitation of TX/RX descriptor.
 o Added 1 byte alignment requirement for TX/RX buffers.
 o ste(4) controllers does not support DAC. Limit DMA address space
   to be within 32bit address.
 o Added spare DMA map to gracefully recover from DMA map failure.
 o Removed dead code for checking STE_RXSTAT_DMADONE bit. The bit
   was already checked in each iteration of loop so it can't be true.
 o Added second argument count to ste_rxeof(). It is used to limit
   number of iterations done in RX handler. ATM polling is the only
   consumer.
 o Removed ste_rxeoc() which was added to address RX stuck issue
   (cvs rev 1.66). Unlike TX descriptors, ST201 supports chaining
   descriptors to form a ring for RX descriptors. If RX descriptor
   chaining is not supported it's possible for controller to stop
   receiving incoming frames once controller pass the end of RX
   descriptor which in turn requires driver post new RX
   descriptors to receive more frames. For TX descriptors which
   does not support chaning, we exactly do manual chaining in
   driver by concatenating new descriptors to the end of previous
   TX chain.
   Maybe the workaround was borrowed from other drivers that does
   not support RX descriptor chaining, which is not valid for ST201
   controllers. I still have no idea how this address RX stuck
   issue and I can't reproduce the RX stuck issue on DFE-550TX
   controller.
 o Removed hw.ste_rxsyncs sysctl as the workaround was removed.
 o TX/RX side bus_dmamap_load_mbuf_sg(9) support.
 o Reimplemented optimized ste_encap().
 o Simplified TX logic of ste_start_locked().
 o Added comments for TFD/RFD requirements.
 o Increased number of RX descriptors to 128 from 64. 128 gave much
   better performance than 64 under high network loads.
2009-12-22 18:57:07 +00:00
John Baldwin
43d9473499 - Rename the __tcpi_(snd|rcv)_mss fields of the tcp_info structure to remove
the leading underscores since they are now implemented.
- Implement the tcpi_rto and tcpi_last_data_recv fields in the tcp_info
  structure.

Reviewed by:	rwatson
MFC after:	2 weeks
2009-12-22 15:47:40 +00:00
Andrew Gallatin
57e42c95a4 Don't take the driver mutex in mxge_tick(), as it
is run with the mutex held.

Submitted by: rwatson
MFC after:	3 days
2009-12-22 15:41:58 +00:00
Luigi Rizzo
46fdc2bf60 some mostly cosmetic changes in preparation for upcoming work:
+ in many places, replace &V_layer3_chain with a local
  variable chain;
+ bring the counter of rules and static_len within ip_fw_chain
  replacing static variables;
+ remove some spurious comments and extern declaration;
+ document which lock protects certain data structures
2009-12-22 13:53:34 +00:00
Edward Tomasz Napierala
5a8eb3a9d1 Cosmetic fixes. 2009-12-22 09:03:59 +00:00
Andrew Thompson
46e977391b Add missed usb product define in r200826. 2009-12-22 02:15:36 +00:00
Andrew Thompson
cc92254a07 add new ID to UFTDI driver.
Submitted by:	YAMAMOTO, Shigeru
2009-12-22 02:13:23 +00:00
Andrew Thompson
afbfddd901 - add support for more than 2 audio channels. [1]
- add support for more sample rates

Submitted by:	[1] ariff (earlier version), Hans Petter Selasky
2009-12-22 02:11:37 +00:00
Andrew Thompson
f1ea98c024 Set correct USB device description
Submitted by:	Paul B Mahol
2009-12-22 02:04:16 +00:00
Andrew Thompson
725f67ad7b Add more OHCI pci ids.
Submitted by:	Hans Petter Selasky
2009-12-22 01:59:17 +00:00
Andrew Thompson
bae15f4ab1 Add more EHCI pci ids.
Submitted by:	Hans Petter Selasky
2009-12-22 01:57:34 +00:00
Alexander Motin
d4060fa67d Make graid3 fallback to malloc() when component request size is bigger
then maximal prepared UMA zone size. This fixes crash with MAXPHYS > 128K.
2009-12-21 23:31:03 +00:00
Gavin Atkinson
eb8e36c9f6 Support the tablet in (at least) the Toshiba Portege M200 Tablet PC.
This device only appears on the ACPI bus, so isn't caught by the current
entry for it in the uart(4) ISA attachment.

PR:		kern/140172
Reviewed by:	jhb, marcel
Approved by:	ed (mentor)
MFC after:	2 weeks
2009-12-21 22:57:40 +00:00
Alexander Motin
922706175e Spell AMD properly. 2009-12-21 21:47:33 +00:00
Marius Strobl
6a963456fd Add missing module dependency information. 2009-12-21 21:41:33 +00:00
Marius Strobl
75b02cac5a Provide and consume missing module dependency information. 2009-12-21 21:29:16 +00:00
Alexander Motin
45e1aff18a Clear all ports interrupt status bits in single write. Clearing one by one
causes additional MSIs messages sent if several ports asked for attention
same time. Time window before clearing is not important, as these interrupts
are level triggered by interrupt source.
2009-12-21 21:27:56 +00:00
Pyun YongHyeon
084dc54bb3 Sort function prototyes. 2009-12-21 20:42:23 +00:00
Pyun YongHyeon
f2632c3b48 style(9) 2009-12-21 20:18:01 +00:00
John Baldwin
8e9683767c Remove commented out prototype for ifinit(). This prototype has been
commented out since 1.1 and has not been present in <sys/systm.h> since at
least 1.1 of that file.  It is also not needed in FreeBSD due to SYSINIT().
2009-12-21 20:09:19 +00:00
Pyun YongHyeon
9c7dcf0e47 Remove trailing white spaces. 2009-12-21 20:02:12 +00:00
Pyun YongHyeon
56af54f28f s/u_intXX_t/uintXX_t/g 2009-12-21 20:00:27 +00:00
Pyun YongHyeon
42306cb0b3 o Remove unnecessary return statement.
o Remove register keyword.
2009-12-21 19:56:11 +00:00
Pyun YongHyeon
60270842b7 Use ANSI function definations. 2009-12-21 19:50:29 +00:00
Edward Tomasz Napierala
9340fc72e6 Implement NFSv4 ACL support for UFS.
Reviewed by:	rwatson
2009-12-21 19:39:10 +00:00
Yoshihiro Takahashi
db5dd5cff8 Move cursor position after putting a character.
MFC after:	1 week
2009-12-21 14:59:23 +00:00
Konstantin Belousov
49e3050e6c VI_OBJDIRTY vnode flag mirrors the state of OBJ_MIGHTBEDIRTY vm object
flag. Besides providing the redundand information, need to update both
vnode and object flags causes more acquisition of vnode interlock.
OBJ_MIGHTBEDIRTY is only checked for vnode-backed vm objects.

Remove VI_OBJDIRTY and make sure that OBJ_MIGHTBEDIRTY is set only for
vnode-backed vm objects.

Suggested and reviewed by:	alc
Tested by:	pho
MFC after:	3 weeks
2009-12-21 12:29:38 +00:00
Randall Stewart
c33e262ffe Fixes so kdb works. 2009-12-21 11:29:30 +00:00
Robert Noland
66ab1230f1 Fix a handful of issues with via agp support.
* Read the pci capability register to identify AGP 3 support
  * Add missing smaller aperture sizes for AGP3 chips.
  * Fix the aperture size calculation on AGP2 chips.
    All sizes between 32M and 256M reported as 256M.
  * Add \n to error string.

This all seems to get the CLE266 EPIA-M board agp working properly, now
back to work on drm.

MFC after:	2 weeks
2009-12-21 03:28:05 +00:00
Ed Schouten
907b48bc05 Fix indentation. 2009-12-20 22:55:27 +00:00
Pyun YongHyeon
33a0d70b86 Disable jumbo frame support for PCIe VT6130/VT6132 controllers.
Quite contrary to VT6130 datasheet which says it supports up to 8K
jumbo frame, VT6130 does not seem to send jumbo frame that is
larger than 4K in length. Trying to send a frame that is larger
than 4K cause TX MAC hang.
Even though it's possible to allow 4K jumbo frame for VT6130, I
think it's meaningless to allow 4K jumbo frame. I'm not sure VT6132
also has the same limitation but I guess it uses the same MAC of
VT6130.
2009-12-20 19:45:46 +00:00
Pyun YongHyeon
564340e7cf VT6130 datasheet was wrong. If VT6130 receive a jumbo frame the
controller will split the jumbo frame into multiple RX buffers.
However it seems the hardware always dma the frame to 8 bytes
boundary for the split frames. Only the first part of the fragment
can have 4 byte alignment and subsequent buffers should be 8 bytes
aligned. Change RX buffer the alignment requirement to 8 bytes from
4 bytes.
2009-12-20 19:11:32 +00:00
Pyun YongHyeon
c743849615 Correct fragment bit definition in comments. 2009-12-20 18:53:34 +00:00
Randall Stewart
2be832193d Adds JC's fix to get rid of stray intr's.
Obtained from:	JC - jayachandraanc@netlogicmicro.com
2009-12-20 17:53:35 +00:00
Alexander Motin
c357f2c827 Add VIA CX700/VX800 chipsets SATA/PATA support.
PR:		kern/121521
Tested by:	Alex Deiter
2009-12-20 16:23:11 +00:00
Alexander Motin
1905fcfe0a Fairly set master/slave shared PIO/WDMA timings on ITE 821x controllers.
Previous implementation could only limit mode, but not rise it back.
2009-12-20 15:03:57 +00:00
Pyun YongHyeon
12ea9beca9 Swap VGE_TXQTIMER and VGE_RXQTIMER register definition. Pending
timer for Tx queue is at 0x3E.
2009-12-19 20:45:23 +00:00
Marcel Moolenaar
1c56376494 Remove a warning in DELAY about large delays. In kern_shutdown.c
we use excessive delays quite habitually.
2009-12-19 20:42:56 +00:00
Ed Schouten
8dc9b4cf04 Let access overriding to TTYs depend on the cdev_priv, not the vnode.
Basically this commit changes two things, which improves access to TTYs
in exceptional conditions. Basically the problem was that when you ran
jexec(8) to attach to a jail, you couldn't use /dev/tty (well, also the
node of the actual TTY, e.g. /dev/pts/X). This is very inconvenient if
you want to attach to screens quickly, use ssh(1), etc.

The fixes:

- Cache the cdev_priv of the controlling TTY in struct session. Change
  devfs_access() to compare against the cdev_priv instead of the vnode.
  This allows you to bypass UNIX permissions, even across different
  mounts of devfs.

- Extend devfs_prison_check() to unconditionally expose the device node
  of the controlling TTY, even if normal prison nesting rules normally
  don't allow this. This actually allows you to interact with this
  device node.

To be honest, I'm not really happy with this solution. We now have to
store three pointers to a controlling TTY (s_ttyp, s_ttyvp, s_ttydp).
In an ideal world, we should just get rid of the latter two and only use
s_ttyp, but this makes certian pieces of code very impractical (e.g.
devfs, kern_exit.c).

Reported by:	Many people
2009-12-19 18:42:12 +00:00
Xin LI
dd0c145752 Apply fix for Solaris bug 6462803: zfs snapshot -r failed because
filesystem was busy
(onnv revision 8989)

Submitted by:	mm
Approved by:	pjd
Obtained from:	OpenSolaris
MFC after:	2 weeks
2009-12-19 11:49:20 +00:00
Xin LI
24a41d7ec6 Apply fix for Solaris bug 6801979: zfs recv can fail with E2BIG
(onnv revision 8986)

Requested by:	mm
Submitted by:	pjd
Obtained from:	OpenSolaris
MFC after:	2 weeks
2009-12-19 11:47:22 +00:00
Xin LI
775f802393 Apply fix Solaris bug 6462803 zfs snapshot -r failed because
filesystem was busy.

Submitted by:	mm
Approved by:	pjd
MFC after:	2 weeks
2009-12-19 11:43:39 +00:00
Edward Tomasz Napierala
28d3fd007e Interpret VAPPEND correctly in vaccess_acl_nfs4(9). 2009-12-19 11:41:52 +00:00
Pyun YongHyeon
7fc94bc4e0 Add rudimentary WOL support. While I'm here remove enabling
busmastering/memory address in resume path. Bus driver will handle
that.
2009-12-18 22:14:28 +00:00
Pyun YongHyeon
45e564a90b Make sure to enable Next Page bit for IP1001. Otherwise the PHY
fails to re-establishe 1000baseT link after downgrading to
10/100Mbps link.
2009-12-18 21:57:51 +00:00
Marcel Moolenaar
e7f42eade6 Fix ub_env_enum(): syscall() returns 0 when properly invoked. 2009-12-18 21:12:37 +00:00
Ed Schouten
e6d84d057a Make the wchan names of pts(4) fit in top(1).
Just like a similar change we made to the TTY code about half a year
ago, make these strings look similar.

Suggested by:	Jille Timmermans <jille@quis.cx>
2009-12-18 20:11:29 +00:00
Jean-Sébastien Pédron
b469a43897 Add new "hw.psm.tap_enabled" tunable and sysctl.
This tunable allows one to enable (1) or disable (0) gestures like tap
and tap-hold on Synaptics TouchPad when the Extended mode isn't enabled
(ie. "hw.psm.synaptics_support" not set).

By default, the value is -1 in order to keep the current behaviour of
not enabling/disabling gestures explicitly.

PR:		kern/139272
Submitted by:	David Horn <dhorn2000 AT gmail DOT com>
Reviewed by:	David Horn <dhorn2000 AT gmail DOT com>
2009-12-18 17:46:57 +00:00
Ruslan Ermilov
bec5f27f73 Added proper attribution.
Requested by:	luigi
2009-12-18 17:22:21 +00:00
John Baldwin
becf6b3db8 - Add missing newlines to some error messages.
- Add interrupt descriptions when using mulitple MSI-X interrupts.

Reviewed by:	jfv
2009-12-18 16:14:31 +00:00
John Baldwin
390cee8729 - Create a separate section in in the MI NOTES file for PCI wireless NIC
drivers and move bwi(4) there from the PCI Ethernet NIC section.
- Move ath(4) and ral(4) to the MI NOTES file.

Reviewed by:	rpaulo
2009-12-18 16:13:21 +00:00
Joseph Koshy
68c3e04122 Recognize Intel CPUs with Family 0x6, Models 0x1E and 0x1F.
Submitted by:	Marc Unangst <mju at panasas dot com>
2009-12-18 15:01:46 +00:00
Alexander Motin
7485a8eb62 Remove duplicate devstat_start_transaction_bio() call. It is already called
from geom_disk. Dulicate call causes wrong queue depth and busy accounting.
2009-12-18 14:41:30 +00:00
Konstantin Belousov
9ae781dfcf Signal 0 is used to check the permission for current process to signal
target one. Since r184058, linux_do_tkill() calls tdsignal() instead of
kill(), without checking for validity of supplied signal number. Prevent
panic when supplied signal is 0 by finishing work after checks.

Found and tested by:	scf
MFC after:	3 days
2009-12-18 14:27:18 +00:00
Ruslan Ermilov
a46a1e767d - Fixed incorrect watchdog timeout setting: MSB of a 2-byte
value is obtained by dividing it by 256, not by 2550; also,
  one second is 10^9 nanoseconds, not 1800000000 nanoseconds.

- Due to rounding error, setting watchdog to a really small
  timeout (<1 sec) was turning the watchdog off.  It should
  set the watchdog to a small timeout instead.

- Implemented error checking in ipmi_wd_event(), as required
  by watchdog(9).

PR:		kern/130512
Submitted by:	Dmitrij Tejblum

- Additionally, check that the timeout value is within the
  supported range, and if it's too large, act as required by
  watchdog(9).

MFC after:	3 days
2009-12-18 12:10:42 +00:00
Andrew Thompson
b340b7be10 Keep list sorted. 2009-12-18 00:36:30 +00:00
Andrew Thompson
c0e2c17865 Add a bunch of new 3G ids obtained from from various operating systems and
Internet sources.

Obtained from:	Linux, NetBSD, OpenBSD, etc
2009-12-18 00:34:58 +00:00
Warner Losh
488141d9e8 Place holder ptrace mips module. Not entirely sure what's required
here yet, so I've not connected it to the build.  I think that we'll
need to move something into the processor specific part of the mips
port by requiring mips_cpu_ptrace or platform_cpu_ptrace be provided
by the ports to get/set processor specific registers, ala SSE
registers on x86.
2009-12-17 23:55:49 +00:00
Alexander Motin
6988053e0e Serverworks OSB4 has no 0x4a (piomode) register, do not touch it.
Also OSB4 has some problems with UDMA transfers, limit it to WDMA2.
2009-12-17 23:42:09 +00:00
Luigi Rizzo
1328a38b96 Add some experimental code to log traffic with tcpdump,
similar to pflog(4).
To use the feature, just put the 'log' options on rules
you are interested in, e.g.

	ipfw add 5000 count log ....

and run
	tcpdump -ni ipfw0 ...

net.inet.ip.fw.verbose=0 enables logging to ipfw0,
net.inet.ip.fw.verbose=1 sends logging to syslog as before.

More features can be added, similar to pflog(), to store in
the MAC header metadata such as rule numbers and actions.
Manpage to come once features are settled.
2009-12-17 23:11:16 +00:00
Andrew Thompson
2a4c6157ca Use the EVENTHANDLER system to hook into the usb device configuration and
perform a function such as ejecting a 3G autoinstaller disk. The eventhandler
system properly tracks threads and is safe to unload, remove the
setting/clearing of a function pointer in the kernel by u3g(4) which included a
tsleep for safety.
2009-12-17 21:42:10 +00:00
Andrew Thompson
2b54315009 If the runcount is non-zero in eventhandler_deregister() then one or more
threads are executing the eventhandler, sleep in this case to make it safe for
module unload. If the runcount was up then an entry would have been marked
EHE_DEAD_PRIORITY so use this as a trigger to do the wakeup in
eventhandler_prune_list().

Reviewed by:	jhb
2009-12-17 21:17:13 +00:00
Pyun YongHyeon
dd77a0532b Remove unused member variable of softc. 2009-12-17 19:48:54 +00:00
Pyun YongHyeon
610dfa9399 Actually clear interrupts. Writing 0 has no effect. 2009-12-17 18:03:05 +00:00
Pyun YongHyeon
3b2b8afb3c Implement interrupt moderation scheme supported by VT61xx
controllers. TX/RX interrupt mitigation is controlled by
VGE_TXSUPPTHR and VGE_RXSUPPTHR register. These registers suppress
generation of interrupts until the programmed frames counter equals
to the registers. VT61xx also supports interrupt hold off timer
register. If this interrupt hold off timer is active all interrupts
would be disabled until the timer reaches to 0. The timer value is
reloaded whenever VGE_ISR register written. The timer resolution is
about 20us.

Previously vge(4) used single shot timer to reduce Tx completion
interrupts. This required VGE_CRS1 register access in Tx
start/completion handler to rearm new timeout value and it did not
show satisfactory result(more than 50k interrupts under load). Rx
interrupts was not moderated at all such that vge(4) used to
generate too many interrupts which in turn made polling(4) better
approach under high network load.

This change activates all interrupt moderation mechanism and
initial values were tuned to generate interrupt less than 8k per
second. That number of interrupts wouldn't add additional packet
latencies compared to polling(4). These interrupt parameters could
be changed with sysctl.
dev.vge.%d.int_holdoff
dev.vge.%d.rx_coal_pkt
dev.vge.%d.tx_coal_pkt
Interface has be brought down and up again before change take
effect.

With interrupt moderation there is no more need to loop in
interrupt handler. This loop always added one more register access.
While I'm here remove dead code which tried to implement subset of
interrupt moderation.
2009-12-17 18:00:25 +00:00
Gavin Atkinson
64a026bdcc Don't panic due to unlocking an unowned mutex if we fail during attach.
PR:		kern/139053
Reviewed by:	scottl
Approved by:	ed (mentor)
MFC after:	2 weeks
2009-12-17 17:46:08 +00:00
Luigi Rizzo
8c5d93d4d4 Now that ipfw is split into multiple files, we need
to list them all in the Makefile for the module,
otherwise it won't load due to missing symbols.

The problem only affected head with ipfw built as a module.

Reported by David Horn
2009-12-17 17:44:34 +00:00
Pyun YongHyeon
ed03d795ff Remove unused VGE_ETHER_ALIGN definition. 2009-12-17 17:38:06 +00:00
Luigi Rizzo
60ab046a41 simplify and document lookup_next_rule() 2009-12-17 17:27:12 +00:00
Yoshihiro Takahashi
ef7b7ac106 Fix debug messages of bd_io().
MFC after:	1 week
2009-12-17 13:14:11 +00:00
Luigi Rizzo
59cd9f65f9 simplify the code that finds the next rule after reinjections
MFC after:	1 week
2009-12-17 12:27:54 +00:00
Matt Jacob
e7d829a46c Fix argument order in a call to mtx_init.
MFC after:	1 week
2009-12-17 00:22:56 +00:00
Matt Jacob
ab429a9218 Fix argument order in a call to mtx_init.
MFC after:	1 week
2009-12-17 00:21:12 +00:00
Warner Losh
8ffab8645b Revert 200606. 2009-12-16 21:53:56 +00:00
Pyun YongHyeon
83accfdbd5 Add "Velocity" to probe message which will make it clearer which
ethernet controller was recognized. VIA consistently calls
"Velocity" family for gigabit ethernet controllers. For fast
ethernet controllers they uses "Rhine" family(vr(4) controllers))
and vr(4) already shows "Rhine" in probe message.
2009-12-16 20:03:43 +00:00
Pyun YongHyeon
a931e5497b Add new flag VGE_FLAG_SUSPENDED to mark suspended state and
remove suspended member in softc.
2009-12-16 19:49:23 +00:00
Pyun YongHyeon
7129fb20d6 Add hardware MAC statistics support. This statistics could be
extracted from dev.vge.%d.stats sysctl node.
2009-12-16 19:41:40 +00:00
Pyun YongHyeon
5f07fd19e2 Rewrite RX filter setup and simplify code.
Now promiscuous mode and multicast handling is performed in single
function, vge_rxfilter().
2009-12-16 19:32:44 +00:00
Luigi Rizzo
53638988bc remove a duplicate sysctl entry 2009-12-16 18:03:35 +00:00
Pyun YongHyeon
38aa43c511 All vge(4) controllers support RX/TX checksum offloading for VLAN
tagged frames so add checksum offloading capabilities. Also add
missing VLAN hardware tagging control in ioctl handler and let
upper stack know current VLAN capabilities.
2009-12-16 18:03:25 +00:00
Alexander Motin
8bff82df5a Large I/Os on Promise controllers reported to cause UDMA ICRC errors and
subsequent timeouts. Restore previous limit for now, at least until
I will have hardware to experiment.

PR:             kern/141438
2009-12-16 17:42:02 +00:00
Warner Losh
42b3331b8a Fix compiling FREEBSD_COMPAT[4,5,6] without FREEBSD_COMPAT7.
Note: Not sure this is the right way to do compat, but it makes the
headers consistent with the implementations.
2009-12-16 17:17:40 +00:00
John Baldwin
dfd775727f Add entries to NOTES for the modular phy support so that these options are
documented.

PR:		docs/141358
Submitted by:	Bruce Cran
2009-12-16 16:24:32 +00:00
Luigi Rizzo
1b5691c61e bring back a couple of #include that are supplied by nesting,
and explain why they are used.
2009-12-16 13:00:37 +00:00
Andriy Gapon
ac2703ea39 ichsmb: add another pci id
This is SMBus controller found in Intel Platform Controller Hub (PCH),
which is a general name that refers to Intel 5 Series chipsets and
3400 Series chipsets.

Submitted by:	Dmitry S. Luhtionov <mitya@cabletv.dp.ua>
MFC after:	3 days
2009-12-16 12:25:27 +00:00
Luigi Rizzo
97219abf05 Various cosmetic cleanup of the files:
- move global variables around to reduce the scope and make them
  static if possible;
- add an ipfw_ prefix to all public functions to prevent conflicts
  (the same should be done for variables);
- try to pack variable declaration in an uniform way across files;
- clarify some comments;
- remove some misspelling of names (#define V_foo VNET(bar)) that
  slipped in due to cut&paste
- remove duplicate static variables in different files;

MFC after:	1 month
2009-12-16 10:48:40 +00:00
Warner Losh
26bbc1fc5a Quick fix to make this compile:
Remove redundant extern declearations.
If the maintainer has a better fix, then feel free to back this out.
2009-12-16 03:26:37 +00:00
Doug Barton
f1bdf073c1 Add INCLUDE_CONFIG_FILE, and a note in comments about how to also
include the comments with CONFIGARGS
2009-12-16 02:17:43 +00:00
Warner Losh
c643f1e35d Remove the now-obsolete comments about compile-with. There are no
compile-with lines in this file at all.  So we don't need two warnings
about them.
2009-12-15 23:22:19 +00:00
Jung-uk Kim
3afa8e569e Add two new debugging tunables for x86bios instead of abusing bootverbose,
i.e., debug.x86bios.call and debug.x86bios.int.
2009-12-15 22:44:28 +00:00
Luigi Rizzo
22f123afad more splitting of ip_fw2.c, now extract the 'table' routines
and the sockopt routines (the upper half of the kernel).

Whoever is the author of the 'table' code (Ruslan/glebius/oleg ?)
please change the attribution in ip_fw_table.c. I have copied
the copyright line from ip_fw2.c but it carries my name and I have
neither written nor designed the feature so I don't deserve
the credit.

MFC after:	1 month
2009-12-15 21:24:12 +00:00
Jung-uk Kim
1ce5efd4b6 Attach dpms(4) to vgapm and make sure to restore DPMS state after
VGA is resumed properly.

Reviewed by:	jhb
2009-12-15 19:58:23 +00:00
Luigi Rizzo
5f2e16424c add ip_fw_private.h to ng_ipfw.c, forgotten in previous commit;
comment out remove ip_fw.h from ng_bridge.c, as it seems unused.

MFC after:	1 month
2009-12-15 18:33:12 +00:00
Luigi Rizzo
70228fb346 Start splitting ip_fw2.c and ip_fw.h into smaller components.
At this time we pull out from ip_fw2.c the logging functions, and
support for dynamic rules, and move kernel-only stuff into
netinet/ipfw/ip_fw_private.h

No ABI change involved in this commit, unless I made some mistake.
ip_fw.h has changed, though not in the userland-visible part.

Files touched by this commit:

conf/files
	now references the two new source files

netinet/ip_fw.h
	remove kernel-only definitions gone into netinet/ipfw/ip_fw_private.h.

netinet/ipfw/ip_fw_private.h
	new file with kernel-specific ipfw definitions

netinet/ipfw/ip_fw_log.c
	ipfw_log and related functions

netinet/ipfw/ip_fw_dynamic.c
	code related to dynamic rules

netinet/ipfw/ip_fw2.c
	removed the pieces that goes in the new files

netinet/ipfw/ip_fw_nat.c
	minor rearrangement to remove LOOKUP_NAT from the
	main headers. This require a new function pointer.

A bunch of other kernel files that included netinet/ip_fw.h now
require netinet/ipfw/ip_fw_private.h as well.
Not 100% sure i caught all of them.

MFC after:	1 month
2009-12-15 16:15:14 +00:00
Bruce M Simpson
977ff62485 Add missing #include <sys/ktr.h>.
Submitted by:	Hideki Yamamoto
MFC after:	1 week
2009-12-15 10:40:40 +00:00
Luigi Rizzo
472099c4b0 implement a new match option,
lookup {dst-ip|src-ip|dst-port|src-port|uid|jail} N

which searches the specified field in table N and sets tablearg
accordingly.
With dst-ip or src-ip the option replicates two existing options.
When used with other arguments, the option can be useful to
quickly dispatch traffic based on other fields.

Work supported by the Onelab project.

MFC after:	1 week
2009-12-15 09:46:27 +00:00
Warner Losh
eb1b8eeafe Should have been copied frmo OCTEON.hints, but I botched that, so
we're stuck with this.  Given that this branch will soon be merged and
retired, I don't think it matters much.
2009-12-15 00:44:33 +00:00
Pyun YongHyeon
0c003e99df Tell upper layer vge(4) supports long frames. This should be done
after ether_ifattach(), as ether_ifattach() initializes it with
ETHER_HDR_LEN.
While I'm here remove setting if_mtu, it's already handled in
ether_ifattach().
2009-12-14 22:55:20 +00:00
Rui Paulo
37c90cfec7 Add apple-boot and apple-ufs.
Submitted by:	nwhitehorn
2009-12-14 22:47:09 +00:00
Pyun YongHyeon
5f26dcd859 Don't report current link status if interface is not UP.
If interface is not UP, the current link status wouldn't
reflect the negotiated status.
2009-12-14 22:30:07 +00:00
Jung-uk Kim
871d21ce2d Remove _FDE quirk handling as these quirks are automatically repaired
by ACPICA layer since ACPICA 20091214.
2009-12-14 22:28:32 +00:00
Jung-uk Kim
572c8255e6 Merge ACPICA 20091214. 2009-12-14 22:24:04 +00:00
Pyun YongHyeon
6f53098372 Report media change result to caller instead of returning success
without regard to the result.
2009-12-14 22:23:06 +00:00
Pyun YongHyeon
e7b2d9b80f Whenever link state change interrupt is raised, vge_tick() is
called and vge(4) used to drive auto-negotiation timer(mii_tick) in
vge_tick(). Therefore the mii_tick was not called for every hz such
that auto-negotiation complete was never handled in vge(4).
Use mii_pollstat to extract current negotiated speed/duplex instead
of mii_tick. The latter is valid only for auto-negotiation case.
While I'm here change the confusing function name vge_tick() to
vge_link_statchg().
2009-12-14 22:20:05 +00:00
Pyun YongHyeon
e4027c4968 Sort function prototyes. 2009-12-14 22:00:11 +00:00
Pyun YongHyeon
20c3cb15df We don't have to reload EEPROM in vge_reset(). Because vge_reset()
is called in vge_init_lock(), vge(4) always used to reload EEPROM.
Also add more comment why vge(4) clears VGE_CHIPCFG0_PACPI bit.
While I'm here add missing new line in vge_reset().
2009-12-14 21:16:02 +00:00
Marius Strobl
e29c870781 Set ATA_CHECKS_CABLE when appropriate.
Reviewed by:	mav
MFC after:	1 week
2009-12-14 21:11:50 +00:00
Pyun YongHyeon
623fa7184b Increase output queue size from 64 to 255. 2009-12-14 20:59:18 +00:00
Pyun YongHyeon
5957cc2a24 Add MSI support for VT613x controllers. 2009-12-14 20:49:50 +00:00
Pyun YongHyeon
643e9ee9fb Save PHY address by reading VGE_MIICFG register. For PCIe
controllers(VT613x), we assume the PHY address is 1.
Use the saved PHY address in MII register access routines and
remove accessing VGE_MIICFG register.
While I'm here save PCI express capability register which will be
used in near future.
2009-12-14 20:39:42 +00:00
Rui Paulo
33f7a4124d Add Microsoft and NetBSD partition types handling. 2009-12-14 20:26:27 +00:00
Pyun YongHyeon
4d7235dd49 Introduce vge_flags member in softc. The vge_flags member will
record device specific bits. Remove vge_link and use vge_flags.
While here, move clearing link state before mii_mediachg() as
mii_mediachg() may affect link state.
2009-12-14 20:17:53 +00:00
Luigi Rizzo
614cb83990 Move the scan for max_keylen into route.c::route_init(),
and make max_keylen an argument for rn_init().
This removes an unnecessary dependency on domain.h from radix.c

MFC after:	7 days
2009-12-14 20:12:51 +00:00
Pyun YongHyeon
77ec83ced8 style(9). 2009-12-14 20:07:25 +00:00
Rui Paulo
ee085c333e Add more Apple partition types. 2009-12-14 20:04:28 +00:00
Rui Paulo
f13174303d Simplify partition type parsing by using a data-oriented model.
While there add more Apple and Linux partition types.
2009-12-14 20:04:06 +00:00
Pyun YongHyeon
c3c74c6107 s/u_intXX_t/uintXX_t/g 2009-12-14 19:53:57 +00:00
Pyun YongHyeon
e44b7069a9 Remove unnecessary return statement. 2009-12-14 19:49:20 +00:00
Pyun YongHyeon
6afe22a8e6 Use ANSI function definations. 2009-12-14 19:44:54 +00:00
Gavin Atkinson
4e7ebd34ef Don't panic on failure to attach if we fail before or during the
if_alloc() of ifp.  This fixes the panic reported in the PR, but
not the attach failure.

PR:		kern/139079
Tested by:      Steven Noonan <steven uplinklabs.net>
Reviewed by:	thompsa
Approved by:	ed (mentor)
MFC after:	2 weeks`
2009-12-14 19:18:02 +00:00
Pyun YongHyeon
420d0abff8 Clear VGE_TXDESC_Q bit for transmitted frames. The VGE_TXDESC_Q bit
seems to work like a tag that indicates 'not list end' of queued
frames. Without having a VGE_TXDESC_Q bit indicates 'list end'. So
the last frame of multiple queued frames has no VGE_TXDESC_Q bit.
The hardware has peculiar behavior for VGE_TXDESC_Q bit handling.
If the VGE_TXDESC_Q bit of descriptor was set the controller would
fetch next descriptor. However if next descriptor's OWN bit was
cleared but VGE_TXDESC_Q was set, it could confuse controller.
Clearing VGE_TXDESC_Q bit for transmitted frames ensure correct
behavior.
2009-12-14 19:08:11 +00:00
Jack F Vogel
74dbc418c7 Add old read_mac_addr routine to this module since
a customer report of an Invalid MAC Address has occurred.
2009-12-14 19:05:16 +00:00
Pyun YongHyeon
bf93bee5c5 Fix typo in register definition. 2009-12-14 18:50:26 +00:00
Pyun YongHyeon
4baee89724 Use PCIR_BAR instead of hard-coded value. 2009-12-14 18:49:16 +00:00
Pyun YongHyeon
410f4c60ad Overhaul bus_dma(9) usage and fix various things.
o Separate TX/RX buffer DMA tag from TX/RX descriptor ring DMA tag.
 o Separate RX buffer DMA tag from common buffer DMA tag. RX DMA
   tag has different restriction compared to TX DMA tag.
 o Add 40bit DMA address support.
 o Adjust TX/RX descriptor ring alignment to 64 bytes from 256
   bytes as documented in datasheet.
 o Added check to ensure TX/RX ring reside within a 4GB boundary.
   Since TX/RX ring shares the same high address register they
   should have the same high address.
 o TX/RX side bus_dmamap_load_mbuf_sg(9) support.
 o Add lock assertion to vge_setmulti().
 o Add RX spare DMA map to recover from DMA map load failure.
 o Add optimized RX buffer handler, vge_discard_rxbuf which is
   activated when vge(4) sees bad frames.
 o Don't blindly update VGE_RXDESC_RESIDUECNT register. Datasheet
   says the register should be updated only when number of
   available RX descriptors are multiple of 4.
 o Use __NO_STRICT_ALIGNMENT instead of defining VGE_FIXUP_RX which
   is only set for i386 architecture. Previously vge(4) also
   performed expensive copy operation to align IP header on amd64.
   This change should give RX performance boost on amd64
   architecture.
 o Don't reinitialize controller if driver is already running. This
   should reduce number of link state flipping.
 o Since vge(4) drops a driver lock before passing received frame
   to upper layer, make sure vge(4) is still running after
   re-acquiring driver lock.
 o Add second argument count to vge_rxeof(). The argument will
   limit number of packets could be processed in RX handler.
 o Rearrange vge_rxeof() not to allocate RX buffer if received
   frame was bad packet.
 o Removed if_printf that prints DMA map failure. This type of
   message shouldn't be used in fast path of driver.
 o Reduce number of allowed TX buffer fragments to 6 from 7. A TX
   descriptor allows 7 fragments of a frame. However the CMZ field
   of descriptor has just 3bits and the controller wants to see
   fragment + 1 in the field. So if we have 7 fragments the field
   value would be 0 which seems to cause unexpected results under
   certain conditions. This change should fix occasional TX hang
   observed on vge(4).
 o Simplify vge_stat_locked() and add number of available TX
   descriptor check.
 o vge(4) controllers lack padding short frames. Make sure to fill
   zero for the padded bytes. This closes unintended information
   disclosure.
 o Don't set VGE_TDCTL_JUMBO flag. Datasheet is not clear whether
   this bit should be set by driver or write-back status bit after
   transmission. At least vendor's driver does not set this bit so
   remove it. Without this bit vge(4) still can send jumbo frames.
 o Don't start driver when vge(4) know there are not enough RX
   buffers.
 o Remove volatile keyword in RX descriptor structure. This should
   be handled by bus_dma(9).
 o Collapse two 16bits member of TX/RX descriptor into single 32bits
   member.
 o Reduce number of RX descriptors to 252 from 256. The
   VGE_RXDESCNUM is 16bits register but only lower 8bits are valid.
   So the maximum number of RX descriptors would be 255. However
   the number of should be multiple of 4 as controller wants to
   update 4 RX descriptors at a time. This limits the maximum
   number of RX descriptor to be 252.

Tested by:	Dewayne Geraghty (dewayne.geraghty <> heuristicsystems dot com dot au)
		Carey Jones (m.carey.jones <> gmail dot com)
		Yoshiaki Kasahara (kasahara <> nc dor kyushu-u dot ac dotjp)
2009-12-14 18:44:23 +00:00
Rui Paulo
2d7340428b Pass all IEs to net80211.
PR:		141376
Submitted by:	Paul <onemda at gmail.com>
MFC after:	1 week
2009-12-14 18:43:27 +00:00
Jack F Vogel
92cc9dde8b Remove the MTX_SPIN flag to the shared code MUTEX
as it was causing a panic, also took the opportunity
to rename the lock for clarity.
2009-12-14 18:43:18 +00:00
Pyun YongHyeon
8b3433dc98 Prefer bus_alloc_resource_any(9) to bus_alloc_resource(9). 2009-12-14 18:27:34 +00:00
Pyun YongHyeon
8170b2431e Fix spelling in comment. 2009-12-14 18:19:56 +00:00
Pyun YongHyeon
481402e197 Prefer device_printf(9) to printf(9). 2009-12-14 18:00:08 +00:00
Pyun YongHyeon
b534dcd5c0 Remove register keyword. 2009-12-14 17:53:10 +00:00
John Baldwin
36f1a2c073 Remove comment claiming that building acpi into the kernel is deprecated.
PR:		docs/141353
Submitted by:	Bruce Cran
MFC after:	1 week
2009-12-14 15:32:32 +00:00
Luigi Rizzo
20c510f826 Properly fix callout handling by putting all the per-cpu info in
struct callout_cpu. From the comment in the file:

+ * There is one struct callout_cpu per cpu, holding all relevant
+ * state for the callout processing thread on the individual CPU.
+ * In particular:
+ *     cc_ticks is incremented once per tick in callout_cpu().
+ *     It tracks the global 'ticks' but in a way that the individual
+ *     threads should not worry about races in the order in which
+ *     hardclock() and hardclock_cpu() run on the various CPUs.
+ *     cc_softclock is advanced in callout_cpu() to point to the
+ *     first entry in cc_callwheel that may need handling. In turn,
+ *     a softclock() is scheduled so it can serve the various entries i
+ *     such that cc_softclock <= i <= cc_ticks .

Together with a smaller patch committed in september, this fixes a
bug that affects 8.0 with apps that rely on callouts to fire exactly
in the number of ticks specified (qemu among them).
Right now, callouts in 8.0 fire one tick late.

This was discussed in september with JeffR and jhb

MFC after:	3 days
2009-12-14 12:23:46 +00:00
Marius Strobl
74f5b28a4d Only set ATA_CHECKS_CABLE for chip versions that actually support
cable detection, i.e. neither for ALI_OLD nor for ALI_NEW revisions
>= 0xc7.

MFC after:	1 week
2009-12-13 20:36:42 +00:00
Bjoern A. Zeeb
07f5a2c997 Make admsw(4) compile again fixing typos and adding the missing variable
after r199762.
2009-12-13 20:27:59 +00:00
Marius Strobl
affcd29e6a Properly support M5229 revision 0xc7 and 0xc8:
- These revisions no longer have cable detection capability.
- The UDMA support bit of register 0x4b has been dropped without an
  replacement.
- According to Linux it's crucial for working ATAPI DMA support to
  also set the reserved bit 1 of regsiter 0x53 with these revisions.

MFC after:	1 week
2009-12-13 18:42:06 +00:00
Marius Strobl
4640fdb5b6 Specify the capability and media bits of the capabilities page in
native, i.e. big-endian, format and convert as appropriate like we
also do with the multibyte fields of the other pages. This fixes
the output of acd_describe() to match reality on big-endian machines
without breaking it on little-endian ones. While at it, also convert
the remaining multibyte fields of the pages read although they are
currently unused for consistency and in order to prevent possible
similar bugs in the future.

MFC after:	1 week
2009-12-13 18:26:19 +00:00
Bjoern A. Zeeb
de0bd6f76b Throughout the network stack we have a few places of
if (jailed(cred))
left.  If you are running with a vnet (virtual network stack) those will
return true and defer you to classic IP-jails handling and thus things
will be "denied" or returned with an error.

Work around this problem by introducing another "jailed()" function,
jailed_without_vnet(), that also takes vnets into account, and permits
the calls, should the jail from the given cred have its own virtual
network stack.

We cannot change the classic jailed() call to do that,  as it is used
outside the network stack as well.

Discussed with:	julian, zec, jamie, rwatson (back in Sept)
MFC after:	5 days
2009-12-13 13:57:32 +00:00
Bjoern A. Zeeb
e65a4ba18b Add a few more V_hacks to nfsclient to allow machines with a VIMAGE
kernel to boot from NFS. [1]

Note: this is not a full virtualization of nfsclient. It is only does
what advertised above and nothing more.

Requested by:	public demand [1]
Tested by:	kris, ..
MFC after:	5 days
2009-12-13 11:06:39 +00:00
Marcel Moolenaar
066b1a5c7b Add support for memory disk (md). The size of the memory disk
is determined by MD_IMAGE_SIZE. A file system can be embedded
into the loader with /sys/tools/embed_mfs.sh.
Note that md.c is not included when MD_IMAGE_SIZE is not set.
2009-12-13 01:20:32 +00:00
Marius Strobl
0966baf709 Unbreak the ata_atapi() usage. Since r200171 the mode setting functions
get a ata_device type device passed instead of a ata_channel one, thus
ata_atapi() has to be adjusted accordingly.

Reviewed by:	mav
MFC after:	3 days
2009-12-13 00:13:21 +00:00
Attilio Rao
2028867def In current code, threads performing an interruptible sleep (on both
sxlock, via the sx_{s, x}lock_sig() interface, or plain lockmgr), will
leave the waiters flag on forcing the owner to do a wakeup even when if
the waiter queue is empty.
That operation may lead to a deadlock in the case of doing a fake wakeup
on the "preferred" (based on the wakeup algorithm) queue while the other
queue has real waiters on it, because nobody is going to wakeup the 2nd
queue waiters and they will sleep indefinitively.

A similar bug, is present, for lockmgr in the case the waiters are
sleeping with LK_SLEEPFAIL on.  In this case, even if the waiters queue
is not empty, the waiters won't progress after being awake but they will
just fail, still not taking care of the 2nd queue waiters (as instead the
lock owned doing the wakeup would expect).

In order to fix this bug in a cheap way (without adding too much locking
and complicating too much the semantic) add a sleepqueue interface which
does report the actual number of waiters on a specified queue of a
waitchannel (sleepq_sleepcnt()) and use it in order to determine if the
exclusive waiters (or shared waiters) are actually present on the lockmgr
(or sx) before to give them precedence in the wakeup algorithm.
This fix alone, however doesn't solve the LK_SLEEPFAIL bug. In order to
cope with it, add the tracking of how many exclusive LK_SLEEPFAIL waiters
a lockmgr has and if all the waiters on the exclusive waiters queue are
LK_SLEEPFAIL just wake both queues.

The sleepq_sleepcnt() introduction and ABI breakage require
__FreeBSD_version bumping.

Reported by:	avg, kib, pho
Reviewed by:	kib
Tested by:	pho
2009-12-12 21:31:07 +00:00
Konstantin Belousov
1173b9a2d0 For ia32 syscall(), call cpu_set_syscall_retval(). Update comment inside
cpu_set_syscall_retval() accordingly.

MFC after:	1 week
2009-12-12 20:11:31 +00:00
Luigi Rizzo
a50f6188de Make the code buildable in userland so it is easier to test it:
this requires a small reordering of headers and a few #defines to
map functions not available in userland.

Remove a useless #ifndef block at the beginning of the file.

Introduce (temporarily) rn_init2(), see the comment in the code
for the proper long term change.

No ABI or functional change.

MFC after:	7 days
2009-12-12 15:49:28 +00:00
Pyun YongHyeon
f52384d1cf Remove driver lock assertion in MII register access. This change
was made in r199543 to remove MTX_RECURSE. These routines can be
called in device attach phase(e.g. mii_phy_probe()) so checking
assertion here is not right as caller does not hold a driver lock.
2009-12-12 00:06:43 +00:00
Alexander Motin
c2023eeaad CFA support doesn't exclude FLUSH support.
Submitted by:	Grzegorz Bernacki
2009-12-11 16:32:59 +00:00
Yoshihiro Takahashi
36ff75683a Cleanups the boot2 for pc98. There is no functional change.
- Make setting machine type and getting geom conditional for future.
  - Remove unused RAWBOOT and CDBOOT supports.
  - Remove unneeded include.
  - Fix warnings.

MFC after:	1 week
2009-12-11 12:36:59 +00:00
Luigi Rizzo
37e20d0a37 only export bio_cmd and flags to userland (bio_cmd are
used by ggatectl, flags are potentially useful).
Other parts are internal kernel data structures and should
not be visible to userland.

No API change involved.

MFC after:	3 days
2009-12-11 10:35:58 +00:00
Marcel Moolenaar
57467e5933 Fix interrupt handling. It started off broken and grew worse over time.
The rewrite of the interrupt handler includes:
o   loop until all pending interrupts are handled. This closes a
    race condition.
o   count the number of interrupt sources we handled so that we can
    properly return FILTER_HANDLED or FILTER_STRAY when we break out
    of the loop.
o   When matching the interrupt source to the devices that have that
    source pending, check only from the set of devices we found to
    have a pending interrupt.

PR:		kern/140947
MFC after:	3 days
2009-12-11 03:08:07 +00:00
Andrew Thompson
ae6de8d67a Wrap long lines. 2009-12-11 02:52:14 +00:00
Andrew Thompson
4b5437a114 Add a quirk for the Curitel UM175 where setting multiplexing for call
management over the data endpoint causes communication to die.

Take this one step further and model it on the existing NetBSD quirk and import
other device IDs from them.

Obtained from:	NetBSD
2009-12-11 02:44:15 +00:00
Andrew Thompson
84d250f195 Revert r199331, the UM175 is in fact a cdc-acm device handled by umodem(4). 2009-12-11 00:57:30 +00:00
Alexander Motin
1969c3f4ea Add one more set of codec IDs. 2009-12-11 00:38:13 +00:00
Luigi Rizzo
b2089673e5 use div64 when converting back the burst value for userland 2009-12-10 18:37:14 +00:00
Luigi Rizzo
89717f91ef when draining a flowset free the entire chain, not just one packet. 2009-12-10 18:34:07 +00:00
Takanori Watanabe
28336d6080 Add module dependency for cam if configured as ATA_CAM. 2009-12-10 16:55:16 +00:00
Luigi Rizzo
478cae8a97 centralize the code to free a packet (or a chain) while in dummynet.
Remove an old macro and its stale comment.
2009-12-10 15:17:34 +00:00
John Baldwin
e85b664cd2 Don't warn about an RSDP with a corrupt checksum. The kernel does a better
job about warning about these things later and this message can be
confusing.

Submitted by:	infofarmer
MFC after:	1 week
2009-12-10 14:54:29 +00:00
Luigi Rizzo
22efc80fd8 No functional changes (who dares to touch this code!) but:
- cast the result of LEN() to int as this is the main usage.
- use LEN() in one place where it was forgotten.
- Document the use of a static variable in rw mode.

More small changes to follow.

MFC after:	7 days
2009-12-10 10:34:30 +00:00
Alexander Motin
7f719ba784 Limit maximum I/O size, depending on command set supported by device.
It is required to suppot non-LBA48 devices with MAXPHYS above 128K.
Same is done in ada(4).
2009-12-10 09:26:56 +00:00
Kip Macy
126e2c082b for PV XEN translate page table entries from machine (real) to physical (logical) addresses so that kgdb can
translate them to the correct coredump offsets
2009-12-10 07:48:47 +00:00
Kip Macy
72bc4ff74d - revert pmap_kenter_temporary to taking a physical address
- make minidump work
2009-12-10 03:09:35 +00:00
Warner Losh
912012d34a Hook up parsing of the boot records. 2009-12-10 01:45:06 +00:00
Warner Losh
41d3506b15 Get the sense of this right. We use uintpr_t for bus_addr_t when
we're building everything except octeon && 32-bit.  As note before, we
need a clearner way, but at least now the hack is right.
2009-12-10 01:44:11 +00:00
Warner Losh
e6e7f898dd app_descriptor_addr is unused (I know it is referened still). And
unnecessary since we pass in a3 unmodified to platform_start.
Eliminate it from here and kill one more TARGET_OCTEON in the process.
2009-12-10 01:42:44 +00:00
Jung-uk Kim
e36af2929a Implement a rudimentary suspend/resume methods for PCI P2P bridge.
Reviewed by:	jhb, imp
2009-12-10 01:01:53 +00:00
John Baldwin
42a346fa63 For some buses, devices may have active resources assigned even though they
are not allocated by the device driver.  These resources should still appear
allocated from the system's perspective so that their assigned ranges are
not reused by other resource requests.  The PCI bus driver has used a hack
to effect this for a while now where it uses rman_set_device() to assign
devices to the PCI bus when they are first encountered and later assigns
them to the actual device when a driver allocates a BAR.  A few downsides of
this approach is that it results in somewhat confusing devinfo -r output as
well as not being very easily portable to other bus drivers.

This commit adds generic support for "reserved" resources to the resource
list API used by many bus drivers to manage the resources of child devices.
A resource may be reserved via resource_list_reserve().  This will allocate
the resource from the bus' parent without activating it.
resource_list_alloc() recognizes an attempt to allocate a reserved resource.
When this happens it activates the resource (if requested) and then returns
the reserved resource.  Similarly, when a reserved resource is released via
resource_list_release(), it is deactivated (if it is active) and the
resource is then marked reserved again, but is left allocated from the
bus' parent.  To completely remove a reserved resource, a bus driver may
use resource_list_unreserve().  A bus driver may use resource_list_busy()
to determine if a reserved resource is allocated by a child device or if
it can be unreserved.

The PCI bus driver has been changed to use this framework instead of
abusing rman_set_device() to keep track of reserved vs allocated resources.

Submitted by:	imp (an older version many moons ago)
MFC after:	1 month
2009-12-09 21:52:53 +00:00
John Baldwin
23e00c4d81 Fix a confusing typo in the EDD packet structure used in gptboot and
gptzfsboot.  I got the segment and offset fields reversed in the structure,
but I also succeeded in crossing the assignments so the actual EDD packet
ended up correct.

MFC after:	1 week
2009-12-09 21:09:32 +00:00
John Baldwin
4497287f20 - Port bios_getmem() from libi386 to {gpt,}zfsboot() and use it to
safely allocate a heap region above 1MB.  This enables {gpt,}zfsboot()
  to allocate much larger buffers than before.
- Use a larger buffer (1MB instead of 128K) for temporary ZFS buffers.  This
  allows more reliable reading of compressed files in a raidz/raidz2 pool.

Submitted by:	Matt Reimer  mattjreimer of gmail
MFC after:	1 week
2009-12-09 20:36:56 +00:00
Andrew Thompson
4a0bce1923 Fix hardware issue with FTDI chips: avoid sending a zero length packet due to
hardware sending garbage on ZLPs.

Reported by:	Corey Smith
Submitted by:	HPS
2009-12-09 20:28:33 +00:00
Andrew Thompson
85e3d588a5 Fix dwSignature for NCM mode and add extra debug output.
Submitted by:	HPS
2009-12-09 20:27:06 +00:00
Andrew Thompson
27148a6c72 Add new device ids.
PR:		usb/140951, usb/140923
Submitted by:	Romain Tartiere, Brett Glass
2009-12-09 20:24:49 +00:00
Andrew Thompson
741194f111 Correct name, 82801IJ -> 82801JI
Submitted by:	mitya_cabletv.dp.ua
2009-12-09 20:17:22 +00:00
Andrew Thompson
0ca80d71d0 If the ID byte is non zero then we allow descriptors having multiple sizes.
Submitted by:	HPS
Reported by:	daichi
2009-12-09 20:15:05 +00:00
Alexander Motin
2ec0f2e186 Clear result before requesting XPT_PATH_INQ.
Many SIMs doesn't fill maxio field yet.
2009-12-09 14:21:21 +00:00
Alexander Motin
1535d59d7c Increase Max Read Request Size for PCIe chips from 512 to 1024 bytes.
It gives those beasts additional 10% of write bandwidth.
2009-12-09 13:10:10 +00:00
Kip Macy
367bfeea1c make PV core dump actually dump memory - still need to fix program header initialization 2009-12-09 08:09:25 +00:00
Xin LI
d9cf8753e3 Allow using IPv6 in nfsrvd_sentcache() callback.
PR:		kern/141289
Submitted by:	Petr Lampa <lampa fit vutbr cz>
Approved by:	rmacklem
MFC after:	1 week
2009-12-08 23:43:50 +00:00
Jung-uk Kim
93eba8807c Simplify a macro not to generate unncessary symbols. 2009-12-08 22:38:42 +00:00
Alexander Motin
402ea18cbd Fix the build. 2009-12-08 21:42:04 +00:00
Edward Tomasz Napierala
9d7031a6d6 Don't add VAPPEND if the file is not being opened for writing. Note that this
only affects cases where open(2) is being used improperly - i.e. when the user
specifies O_APPEND without O_WRONLY or O_RDWR.

Reviewed by:	rwatson
2009-12-08 20:47:10 +00:00
Marius Strobl
259100de20 Add additional checks of the kernel stack addresses in order to
ensure we don't overrun the end of the call chain.

MFC after:	1 week
2009-12-08 20:18:54 +00:00
Jack F Vogel
2b8dbb8253 Remove phantom line of code that somehow slipped
into the checkin.
2009-12-08 18:54:37 +00:00
Pyun YongHyeon
beaa2ae169 Create sysctl node(dev.bge.%d.focred_collapse) instead of
hw.bge.forced_collapse. hw.bge.forced_collapse affects all bge(4)
controllers on system which may not desirable behavior of the
sysctl node. Also allow the sysctl node could be modified at any
time.

Reviewed by:	bde (initial version)
2009-12-08 17:54:23 +00:00
Alexander Motin
7b4386c655 Add ID for NetMos NM9820 Serial Port chip, found on CardBus serial adapter. 2009-12-08 14:55:07 +00:00
Yoshihiro Takahashi
1a800d321e MFi386: revision 200219
Improve the algorithm the loader uses to choose a memory range for its
  heap when using a range above 1MB.

MFC after:	1 week
2009-12-08 13:06:35 +00:00
Yoshihiro Takahashi
ff85a22cfd MFi386: Use real mode instead of v86 mode.
MFC after:	1 week
2009-12-08 13:04:26 +00:00
Yoshihiro Takahashi
e61de1d24c MFi386: revision 200216
Various small whitespace and style fixes.
2009-12-08 12:10:06 +00:00
Jung-uk Kim
23e876b121 - Try pre-allocating all FIBs upfront. Previously we tried pre-allocating
128 FIBs first and allocated more later if necessary.  Remove now unused
definitions from the header file[1].
- Force sequential bus scanning.  It seems parallel scanning is in fact
slower and causes more harm than good[1].  Adjust a comment to reflect that.

PR:		kern/141269
Submitted by:	Alexander Sack (asack at niksun dot com)[1]
Reviewed by:	scottl
2009-12-08 05:35:51 +00:00
Pyun YongHyeon
9766cbd144 Partially revert r200228. For mini RCB case, bge(4) still have to
disable mini ring withtout regard to mini ring support.

Reported by:	marcel
Tested by:	marcel
2009-12-08 03:24:29 +00:00
Jack F Vogel
4edd8523d4 Resync with Intel versions of both the em and igb
drivers. These add new hardware support, most importantly
the pch (i5 chipset) in the em driver. Also, both drivers
now have the simplified (and I hope improved) watchdog
code. The igb driver uses the new RX cleanup that I
first implemented in ixgbe.

em  - version 6.9.24
igb - version 1.8.4
2009-12-08 01:07:44 +00:00
Rui Paulo
f59310a164 Fix typo in comment
Submitted by:	Paul B Mahol <onemda at gmail.com>
2009-12-08 00:54:08 +00:00
Rui Paulo
64e5a27754 Improve response to multi-touch taps.
Submitted by:	Rohit Grover <rgrover1 at gmail.com>
2009-12-08 00:52:59 +00:00
Marcel Moolenaar
c4dbd41f5d In exception_save, write-back ar.rnat after switching the backing-
store. Writing to ar.bspstore is defined to leave ar.rnat undefined.

PR:		ia64/120315
MFC after:	3 days
2009-12-08 00:44:23 +00:00
Jack F Vogel
2969bf0e46 Update driver to Intel version 2.0.7:
This adds new feature support for the 82599, a hardware
assist to LRO, doing this required a large revamp to the
RX cleanup code because the descriptor ring may not be
processed out of order, this necessitated the elimination
of global pointers.

Additionally, the RX routine now does not refresh mbufs
on every descriptor, rather it will do a range, and then
update the hardware pointer at that time. These are
performance oriented changes.

The TX side now has a cleaner simpler watchdog algorithm
as well, in TX cleanup a read of ticks is stored, that
can then be compared in local_timer to determine if
there is a hang.

Various other cleanups along the way, thanks to all who
have provided input and testing.
2009-12-07 21:30:54 +00:00
Jung-uk Kim
406930fba4 Revert r200231. It was already taken cared by jhb long ago.
Pointed out by:	jhb
Pointy hat:	jkim
2009-12-07 21:24:07 +00:00
Jung-uk Kim
0cca89cc53 Make mfi(4) little bit less chatty. 2009-12-07 20:17:33 +00:00
Marcel Moolenaar
1d864e0d2d Add support for the NetMos NM9865 family of Serial/Parallel ports.
Obtained from:	NetMos MCS9865 v1.0.0.1 driver
MFC after:	3 days
2009-12-07 20:05:02 +00:00
Pyun YongHyeon
2a141b9412 Don't access jumbo frame related registers if controller lacks the
feature. These registers are reserved on controllers that have no
support for jumbo frame.
Only BCM5700 has mini ring so do not poke mini ring related
registers if controller is not BCM5700.

Reviewed by:	marius
2009-12-07 19:26:54 +00:00
Pyun YongHyeon
6fe124d275 Remove PHY isolate/power down code in bge_stop(). The isolation
handler in brgphy(4) does not exist and brgphy(4) just resets the
PHY and returns EINVAL as it has no isolation handler. I also agree
on Marius's opinion that stop handler of every NIC driver seems to
be the wrong place for implementing PHY isolate/power down.
If we need PHY isolate/power down it should be implemented in
brgphy(4) and users should administratively down the PHY.

Reviewed by:	marius
2009-12-07 19:18:23 +00:00
Alexander Motin
3005368137 Explicitly acknowledge MSI completion, as required by SiI3124 datasheet.
It makes MSI working there. Later (and cheaper) PCIe chips (3132/3531)
still randomly crashing system in few seconds of high MSI rates, generating
something inaporopriate, like NMI or "Fatal trap 30".
2009-12-07 18:37:50 +00:00
John Baldwin
f1a6fd5d07 Improve the algorithm the loader uses to choose a memory range for its
heap when using a range above 1MB.

Previously the loader would always use the last 3MB in the first memory
range above 1MB for the heap.  However, this memory range is also where the
kernel and any modules are loaded.  If this memory range is "small", then
using the high 3MB for the heap may not leave enough room for the kernel
and modules.

Now the loader will use any range below 4GB for the heap, and the logic to
choose the "high" heap region has moved into biosmem.c.  It sets two
variables that the loader can use for a high heap if it desires.  When a
high heap is enabled (BZIP2, FireWire, GPT, or ZFS), then the following
memory ranges are preferred for the heap in order from best to worst:
- The largest memory region in the SMAP with a start address greater than
  1MB.  The memory region must be at least 3MB in length.  This leaves the
  region starting at 1MB purely for use by the kernel and modules.
- The last 3MB of the memory region starting at 1MB if it is at least 3MB
  in size.  This matches the current behavior except that the current loader
  would break horribly if the first region was not at least 3MB in size.
- The memory range from the end of the loader up to the 640k window.  This
  is the range the loader uses when none of the high-heap-requesting options
  are enabled.

Tested by:	hrs
MFC after:	1 week
2009-12-07 16:29:43 +00:00
Alexander Motin
7bdb664e50 MFp4;
- Cleanup kernel messages, mostly PMP.
- Took references on devices, while PMP reinitializes them, to not let them
go and distort freeze reference counting.
2009-12-07 16:23:25 +00:00
Alexander Motin
d095fa045c SiI3124 has no SNotification register. Handle Asynchronous Notifications
there without it as good as possible.
2009-12-07 16:10:48 +00:00
John Baldwin
eddb3f5b88 Various small whitespace and style fixes. 2009-12-07 16:00:59 +00:00
Marius Strobl
22bf171313 Add <machine/pcb.h> missed in r199135. 2009-12-07 15:29:07 +00:00
Guido van Rooij
c53a28102a Fix ntfs such that it understand media with a non-512-bytes sector size:
1. Fixups are always done on 512 byte chunks (in stead of sectors). This
is kind of stupid.
2. Conevrt between NTFS blocknumbers (the blocksize equals the media
sector size) and the bread() and getblk() blocknr (which are 512-byte
sized)

NB: this change should not affect ntfs for 512-byte sector sizes.
2009-12-07 15:15:08 +00:00
Marcel Moolenaar
58a0206d63 Define struct pcpu_md as the only MD field of struct pcpu (pc_acpi_id
excluded, as it's used by MI code) and mode the sysctl variables from
pcpu_stats to pcpu_md.
Adjust all references accordingly.

While nearby, change the PCPU sysctl tree so that they match the CPU
device sysctl tree -- they are now children of a static node called
"machdep.cpu" and are named only with their cpu ID.
2009-12-07 06:41:27 +00:00
Marcel Moolenaar
4dbb79b42d Allocate the VHPT for each CPU in cpu_mp_start(), rather than
allocating MAXCPU VHPTs up-front. This allows us to max-out MAXCPU
without memory waste -- MAXCPU is now 32 for SMP kernels.

This change also eliminates the VHPT scaling based in the total
memory in the system. It's the workload that determines the best size
of the VHPT. The workload can be affected by the amount of memory,
but not necessarily. For example, there's no performance difference
between VHPT sizes of 256KB, 512KB and 1MB when building the LINT
kernel. This was observed with a system that has 8GB of memory.
By default the kernel will allocate a 1MB VHPT. The user can tune the
system with the "machdep.vhpt.log2size" tunable.
2009-12-07 00:54:02 +00:00
Alexander Motin
a48eed8352 Add Asynchronous Notification support for controllers without SNTF
capability by snooping SDB FIS receive area. It should be even faster
then regular way, but less reliable.
2009-12-06 23:56:54 +00:00
Ed Schouten
04b0c5bbfa Add a libutempter compatibility interface to libulog.
The ulog_login_pseudo(3) and ulog_logout_pseudo(3) interfaces provide a
functionality identical to what libutempter has to offer. Just transform
libutempter's calls into the before mentioned functions.

libutempter doesn't work with utmpx, so instead of fixing I thought the
easiest way would be to integrate this functionality. libutempter is
used by applications like xterm and the KDE libraries, so if I ever
change the underlying file format, these applications will keep working
automatically.

Also increase __FreeBSD_version to indicate the addition (as well as the
import of libulog).
2009-12-06 20:30:21 +00:00
Nathan Whitehorn
edbb090444 Unbreak build.
Pointy hat to: me
2009-12-06 17:26:43 +00:00
Alexander Motin
21cc85878c MFp4:
If we panicked with SIM lock held, do not try to flush caches.
Extra lock recursing will not make debugging easier.
2009-12-06 11:48:53 +00:00
Alexander Motin
066f913a94 MFp4:
Introduce ATA_CAM kernel option, turning ata(4) controller drivers into
cam(4) interface modules. When enabled, this options deprecates all ata(4)
peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers
(ada, cd, ...) and interfaces to be natively used instead.

As side effect of this, ata(4) mode setting code was completely rewritten
to make controller API more strict and permit above change. While doing
this, SATA revision was separated from PATA mode. It allows DMA-incapable
SATA devices to operate and makes hw.ata.atapi_dma tunable work again.

Also allow ata(4) controller drivers (except some specific or broken ones)
to handle larger data transfers. Previous constraint of 64K was artificial
and is not really required by PCI ATA BM specification or hardware.

Submitted by:	nwitehorn (powerpc part)
2009-12-06 00:10:13 +00:00
Oleg Bulyzhin
22746035ec Fix burst processing for WF2Q pipes - do not increase available burst size
unless pipe is idle. This should fix follwing issues:
- 'dummynet: OUCH! pipe should have been idle!' log messages.
- exceeding configured pipe bandwidth.

MFC after:	1 week
2009-12-05 23:27:21 +00:00
Konstantin Belousov
88f2d72947 Change VOP_FSYNC for zfs vnode from VOP_PANIC to zfs_freebsd_fsync(),
both to not panic when fsync(2) is called for fifo on zfs
filedescriptor, and to actually fsync fifo inode to permanent storage.

PR:	kern/141177
Reviewed by:	pjd
MFC after:	1 week
2009-12-05 20:36:42 +00:00
Pawel Jakub Dawidek
dfb903e852 We have to eventually look for provider without checking guid as this is need
for attaching when there is no metadata yet.

Before r200125 the order of looking for providers was wrong. It was:
1. Find provider by name.
2. Find provider by guid.
3. Find provider by name and guid.

Where it should have been:
1. Find provider by name and guid.
2. Find provider by guid.
3. Find provider by name.

MFC after:	1 week
2009-12-05 20:16:28 +00:00