Commit Graph

150926 Commits

Author SHA1 Message Date
Garrett Wollman
bedffadccc In clnt_raw_create(), avoid minor race condition initializing the
file-scope variable clntraw_private.

Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:52:12 +00:00
Garrett Wollman
fcbfc882d6 In svc_raw_reply(), don't leave stat uninitialized if the MSG_ACCEPTED
&& SUCCESS case succeeds.  The stack garbage might be zero.

Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:49:41 +00:00
Garrett Wollman
0c0349bfa4 Eliminate more dead stores.
Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:45:45 +00:00
Garrett Wollman
750a395ba6 Make all three if conditions look similar by always initializing nsec
and moving the default initialization of prec into the else clause.
The clang static analyzer erroneously thought that nsec can be used
uninitialized here; it was not actually possible, but better to make
the code clearer.  (Clang can't know that sprintf() won't modify *pi
behind the scenes.)
2009-11-25 04:35:54 +00:00
Garrett Wollman
ab5b2fafec In __mbsconv(), if prec was zero, nconv could have been used
uninitialized.  Initialize it to a safe value so that there's no
chance of returning an error if stack garbage happens to be equal to
(size_t)-1 or (size_t)-2.

Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:27:55 +00:00
Garrett Wollman
e40c32385d Eliminate dead store.
Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:21:42 +00:00
Will Andrews
c3582a1967 Make ``ifconfig -l ether'' only list interfaces that speak Ethernet.
PR:		118987
Approved by:	ken (mentor)
2009-11-25 00:00:57 +00:00
Ivan Voras
cbc4ea28e2 Make ULE process usage (%CPU) accounting usable again by keeping track
of the last tick we incremented on.

Submitted by:	matthew.fleming/at/isilon.com, is/at/rambler-co.ru
Reviewed by:	jeff (who thinks there should be a better way in the future)
Approved by:	gnn (mentor)
MFC after:	3 weeks
2009-11-24 19:57:41 +00:00
Fabien Thomas
5eaf27d8ff - fix a LOR between process lock and pmc thread mutex
- fix a system deadlock on process exit when the sample buffer
is full (pmclog_loop blocked in fo_write) and pmcstat exit.

Reviewed by: jkoshy
MFC after: 3 weeks
2009-11-24 19:26:53 +00:00
John Baldwin
31e119ed7d Use a single private timer to drive the transmit watchdog rather than using
if_watchdog and if_timer from the first port.

Reviewed by:	gonzo
2009-11-24 18:34:47 +00:00
Pyun YongHyeon
fd4d32feb2 BGE_FLAG_40BIT_BUG should be set before creating DMA tags.
Pointy hat to:  yongari
2009-11-24 17:46:58 +00:00
John Baldwin
6d60ecdc6c - For 350 chips, don't set various INTR bits in TX control word; turning INTR
bits on seems to confuse hardware TX engine.
- For 350 chips, set TX desc's buffer physical address before turning on the
  TX desc valid bit.

Submitted by:	Jeremy O'Brien  obrien654j | gmail, sephe
Obtained from:	DragonFly BSD
2009-11-24 16:57:35 +00:00
John Baldwin
08f85872d3 Use bus_*() rather than bus_space_*(). 2009-11-24 16:54:54 +00:00
Alexander Motin
32e7052ed0 Use only lower byte of sectors_intr IDENTIFY word as sector count.
This fixes SET_MULTI error during boot on devices supporting less then
16 sectors per interrupt.
2009-11-24 14:06:15 +00:00
Christian Brueffer
eaea833385 Grammar and mdoc improvements.
MFC after:	3 days
2009-11-24 13:44:53 +00:00
Alexander Motin
c8039fc667 MFp4:
- Extend XPT-SIM transfer settings control API. Now it allows to report to
SATA SIM number of tags supported by each device, implement ATA mode and
SATA revision negotiation for both SATA and PATA SIMs.
- Make ahci(4) and siis(4) to use submitted maximum tag number, when
scheduling requests. It allows to support NCQ on devices with lower tags
count then controller supports.
- Make PMP driver to report attached devices connection speeds.
- Implement ATA mode negotiation between user settings, device and
controller capabilities.
2009-11-24 12:47:58 +00:00
Christian Brueffer
473fbad3c9 LSI MegaRAID 9260 works, sort the hardware list while here.
Submitted by:	Jason <jhelfman@e-e.com>
MFC after:	3 days
2009-11-24 08:14:22 +00:00
Kip Macy
2036720ba9 remove annoying printf that cripples kdb on PV guests 2009-11-24 07:18:38 +00:00
Kip Macy
be7747b449 fixup kernel core dumps on paravirtual guests 2009-11-24 07:17:51 +00:00
Marcel Moolenaar
9c6a6bc422 Improve upon revision 196196 by removing the newly added comment
in the wrong place and instead add a KASSERT in the right place.
2009-11-24 01:35:21 +00:00
Marcel Moolenaar
a78fb6f93d Don't make MJUMPAGESIZE equal to PAGE_SIZE unconditionally.
When PAGE_SIZE is 16K, MJUMPAGESIZE equals MJUM16BYTES and
causes build breakages.
For PAGE_SIZE < 2K, define MJUMPAGESIZE as MCLBYTES.
For PAGE_SIZE > 8K, define MJUMPAGESIZE as 8K.
Everywhere inbetween, define MJUMPAGESIZE as PAGE_SIZE.

Thus MCLBYTES <= MJUMPAGESIZE <= 8KB.
2009-11-23 23:23:05 +00:00
Jung-uk Kim
0cdc14c810 Make this test case little bit more interesting. 2009-11-23 22:28:15 +00:00
Jung-uk Kim
26b8a1c94f - Add more aggressive BPF JIT optimization. This is in more favor of i386
while the previous commit was more amd64-centric.
- Use calloc(3) instead of malloc(3)/memset(3) in user land[1].

Submitted by:	ed[1]
2009-11-23 22:23:19 +00:00
Marcel Moolenaar
65e962fb76 Revert previous commit. The problem was not related to overrunning
the kernel stack at all. The new USB stack simply caused a change
in timing that triggered a firmware bug more often. The addition
of PRINTF_BUFR_SIZE apparently triggered the same firmware bug
even more reliably.

But even with KSTACK_PAGES=5, one instance of the firmware bug
remained: booting with a CD inserted. This problem was run into
by accident after installing Debian and having to boot FreeBSD
to fixup the GPT partitioning (Thanks... not). After bumping
KSTACK_PAGES to 5, it was pretty unbelievable that the stack was
still being too small.

After updating the firmware we could boot with a CD inserted and
KSTACK_PAGES could be lowered back to 4 pages without problems.

Note: It is believed to be a timing related firmware bug, because
the machine check information showed access to the serial console
on one CPU and access to the EHCI HCD on the other CPU. Since
both are devices on the management unit and thus virtualized in
some way, any execution trace that does not include concurrent
access to the BMC from both CPUs is fine.

Note also that it's not understood exactly how increasing the
kernel stack avoided hitting the firmware bug. A change in page
faults does change timing, but it's not known if that's what's
happening here.

In any case: the problem is being monitored. Reverting back to
4 pages for the kernel stack is preferred, because it makes it
easier to switch to 16K pages (double the page size) without
wasting too much memory by not being able to half the number of
pages...
2009-11-23 21:09:23 +00:00
Andrew Thompson
bda9babe90 Actually disable interrupts in ehci_detach().
Reviewed by:	HPS
2009-11-23 18:12:09 +00:00
Alexander Motin
9ece9ab1eb Do not attach JMicrons with single PCI function. They are not working as
AHCI for some reason, even when declaring so. Let atajmicron configure
them for us and provide PATA support.
2009-11-23 18:07:28 +00:00
Rick Macklem
38e3ea69d4 Modify the experimental nfs server so that it falls back to
using VOP_LOOKUP() when VFS_VGET() returns EOPNOTSUPP in the
ReaddirPlus RPC. This patch is based upon one by pjd@ for the
regular nfs server which has not yet been committed. It is needed
when a ZFS volume is exported and ReaddirPlus (which almost
always happens for NFSv4) is performed by a client. The patch
also simplifies vnode lock handling somewhat.

MFC after:	2 weeks
2009-11-23 16:08:15 +00:00
Robert Noland
f06c961ee3 Create a seperate ZFS enabled loader.
This adds zfsloader which will be called by zfsboot/gptzfsboot code rather
than the tradional loader.  This eliminates the need to set the
LOADER_ZFS_SUPPORT variable in order to get a ZFS enabled loader.

Note however, that you must reinstall your bootcode (zfsboot/gptzfsboot)
in order for the boot process to use the new loader.

New installations will no longer be required to build a ZFS enabled
loader for a working ZFS boot system.  Installing zfsboot/gptzfsboot is
sufficient for acknowledging the use of CDDL code and therefore the ZFS
enabled loader.

Based on a previous patch from jhb@

Reviewed by:	jhb@
MFC after:	2 weeks
2009-11-23 16:00:16 +00:00
Alexander Motin
c01cccb81c Refer more recently added Marvell chips. 2009-11-23 09:02:08 +00:00
Andrew Thompson
3e65f9971a Make the mode setting transfer asynchronous.
Submitted by:	Rohit Grover
2009-11-22 21:53:09 +00:00
Pyun YongHyeon
30f57f615b Reduce status block size DMAed by controller. bge(4) uses single
Tx/Rx/Rx return ring such that large part of status block was not
used at all. All bge(4) controllers except BCM5700 AX/BX has a
feature to control the size of status block. So use minimum status
block size allowed in controller. This reduces number of DMAed
status block size to 32 bytes from 80 bytes.
2009-11-22 21:45:55 +00:00
Andrew Thompson
add5cc2fad Add missed register change in r199676.
Submitted by:	Hans Petter Selasky
2009-11-22 21:31:31 +00:00
Andrew Thompson
dc6942514b add support for MIDI devices without audio control stream.
Submitted by:	Hans Petter Selasky
2009-11-22 21:26:27 +00:00
Andrew Thompson
f1eac1007e Correct register access for USB device side operation on the musb controller.
Submitted by:	Hans Petter Selasky
2009-11-22 21:24:38 +00:00
Andrew Thompson
c13fd8d42b Provide tunables for some of the usb sysctls that affect boot behaviour.
Submitted by:	Andriy Gapon
2009-11-22 21:21:22 +00:00
Pyun YongHyeon
2e1d4df419 Add missing function prototype in r199671. 2009-11-22 21:20:26 +00:00
Andrew Thompson
78c94708fb Initialise variable before use.
Submitted by:	Hans Petter Selasky
2009-11-22 21:19:01 +00:00
Andrew Thompson
f12c6c2913 Improve High Speed slot allocation mechanism by moving the computation to the
endpoint rather than per xfer and provide functions around get/free of resources.

Submitted by:	Hans Petter Selasky
2009-11-22 21:16:43 +00:00
Pyun YongHyeon
ca3f1187f1 Implement TSO for BCM5755 or newer controllers. Some controllers
seem to require a special firmware to use TSO. But the firmware is
not available to FreeBSD and Linux claims that the TSO performed by
the firmware is slower than hardware based TSO. Moreover the
firmware based TSO has one known bug which can't handle TSO if
ethernet header + IP/TCP header is greater than 80 bytes. The
workaround for the TSO bug exist but it seems it's too expensive
than not using TSO at all. Some hardwares also have the TSO bug so
limit the TSO to the controllers that are not affected TSO issues
(e.g. 5755 or higher).
While I'm here set VLAN tag bit to all descriptors that belengs to
a frame instead of the first descriptor of a frame. The datasheet
is not clear how to handle VLAN tag bit but it worked either way in
my testing. This makes it simplify TSO configuration a little bit.

Big thanks to davidch@ who sent me detailed TSO information.
Without this I was not able to implement it.

Tested by:	current
2009-11-22 21:16:30 +00:00
Pyun YongHyeon
f681b29a6d Fix two long standing bugs on bge(4). Most pre BCM5755 controllers
have a DMA bug when buffer address crosses a multiple of the 4GB
boundary(e.g. 4GB, 8GB, 12GB etc). Limit DMA address to be within
4GB address for these controllers. The second DMA bug limits DMA
address to be within 40bit address space. This bug applies to
BCM5714 and BCM5715 and 5708(bce(4) controller). This is not
actually a MAC controller bug but an issue with the embedded PCIe
to PCI-X bridge in the device. So for BCM5714/BCM5715 controllers
also limit the DMA address to be within 40bit address space.
Special thanks to davidch@ who gave me detailed errata information.
I think this change will fix long standing bge(4) instability
issues on systems with more than 4GB memory.

Reviewed by:	davidch
2009-11-22 20:50:27 +00:00
Nathan Whitehorn
961e3d1410 Garbage collect some code that was never compiled in to handle Altivec
during traps. It predates actual Altivec support and was never used.
2009-11-22 20:45:15 +00:00
Pyun YongHyeon
dfe0df9a76 For MSI case, interrupt is not shared and we don't need to force
PCI flush to get correct status block update. Add an optimized
interrupt handler that is activated for MSI case. Actual interrupt
handling is done by taskqueue such that the handler does not
require driver lock for Rx path. The MSI capable bge(4) controllers
automatically disables further interrupt once it enters interrupt
state so we don't need PIO access to disable interrupt in interrupt
handler.
2009-11-22 20:31:40 +00:00
Pyun YongHyeon
b9c05fa593 Cache Rx producer/Tx consumer index as soon as we know status block
update and then clear status block. Previously it used to access
these index without synchronization which may cause problems when
bounce buffers are used. Also add missing bus_dmamap_sync(9) in
polling handler. Since we now update status block in driver, adjust
bus_dmamap_sync(9) for status block.
2009-11-22 20:02:13 +00:00
Pyun YongHyeon
167fdb62e3 Rearrange bge_start_locked to see we can send more frames by
checking IFF_DRV_RUNNING and IFF_DRV_OACTIVE flags. Also if we
have less than 16 free send BDs set IFF_DRV_OACTIVE and try it
later. Previously bge(4) used to reserve 16 free send BDs after
loading dma maps but hardware just need one reserved send BD. If
prouder index has the same value of consumer index it means the Tx
queue is empty.
While I'm here check IFQ_DRV_IS_EMPTY first to save one lock
operation.
2009-11-22 19:44:11 +00:00
Pyun YongHyeon
d77e9fa7be Controller does not write Rx descriptors, remove BUS_DMASYNC_PREREAD. 2009-11-22 19:17:32 +00:00
Pyun YongHyeon
0aaf10578c Use capability pointer to access PCIe registers rather than
directly access them at fixed address. While I'm here don't touch
other bits of PCIe device control register except max payload size.

Reviewed by:	marius
2009-11-22 19:11:34 +00:00
Pyun YongHyeon
d648358b0b Due to newly added PCIe capabilities fallback code for finding the
PCIe capability did not work right on recent controllers. Remove
FreeBSD 6.x support code.

Reviewed by:	marius
2009-11-22 18:47:56 +00:00
Pyun YongHyeon
1b90d0bd3e Fix typo introduced in r199011.
Pointed out by:	marius
2009-11-22 18:34:15 +00:00
Pyun YongHyeon
1715ec0d32 Remove extra white space. 2009-11-22 18:30:19 +00:00
Jilles Tjoelker
9922c6d2d5 Fix various things about SIGINT handling:
* exception handlers are now run with interrupts disabled, which avoids
  many race conditions
* fix some cases where SIGINT only aborts one command and continues the
  script, in particular if a SIGINT causes an EINTR error which trumped the
  interrupt.

Example:
  sh -c 'echo < /some/fifo; echo This should not be printed'
The fifo should not have writers. When pressing ctrl+c to abort the open,
the shell used to continue with the next command.

Example:
  sh -c '/bin/echo < /some/fifo; echo This should not be printed'
Similar. Note, however, that this particular case did not and does not work
in interactive mode with job control enabled.
2009-11-22 18:23:30 +00:00