Commit graph

120567 commits

Author SHA1 Message Date
Poul-Henning Kamp 75067f4f70 Add an extensible version of our *printf(3) implementation to libc
on probationary terms:  it may go away again if it transpires it is
a bad idea.

This extensible printf version will only be used if either
    environment variable USE_XPRINTF is defined
or
    one of the extension functions are called.
or
    the global variable __use_xprintf is set greater than zero.

In all other cases our traditional printf implementation will
be used.

The extensible version is slower than the default printf, mostly
because less opportunity for combining I/O operation exists when
faced with extensions.  The default printf on the other hand
is a bad case of spaghetti code.

The extension API has a GLIBC compatible part and a FreeBSD version
of same.  The FreeBSD version exists because the GLIBC version may
run afoul of our FILE * locking in multithreaded programs and it
even further eliminate the opportunities for combining I/O operations.

Include three demo extensions which can be enabled if desired: time
(%T), hexdump (%H) and strvis (%V).

%T can format time_t (%T), struct timeval (%lT) and struct timespec (%llT)
   in one of two human readable duration formats:
	"%.3llT" -> "20349.245"
	"%#.3llT" -> "5h39m9.245"

%H will hexdump a sequence of bytes and takes a pointer and a length
   argument.  The width specifies number of bytes per line.
	"%4H" -> "65 72 20 65"
	"%+4H" -> "0000 65 72 20 65"
	"%#4H" -> "65 72 20 65  |er e|"
	"%+#4H" -> "0000 65 72 20 65  |er e|"

%V will dump a string in strvis format.
	"%V" -> "Hello\tWor\377ld"	(C-style)
	"%0V" -> "Hello\011Wor\377ld"	(octal)
	"%+V" -> "Hello%09Wor%FFld"	(http-style)

Tests, comments, bugreports etc are most welcome.
2005-12-16 18:56:39 +00:00
Alan Cox da61b9a69e Use sf_buf_alloc() instead of vm_map_find() on exec_map to create the
ephemeral mappings that are used as the source for three copy
operations from kernel space to user space.  There are two reasons for
making this change: (1) Under heavy load exec_map can fill up causing
vm_map_find() to fail.  When it fails, the nascent process is aborted
(SIGABRT).  Whereas, this reimplementation using sf_buf_alloc()
sleeps.  (2) Although it is possible to sleep on vm_map_find()'s
failure until address space becomes available (see kmem_alloc_wait()),
using sf_buf_alloc() is faster.  Furthermore, the reimplementation
uses a CPU private mapping, avoiding a TLB shootdown on
multiprocessors.

Problem uncovered by: kris@
Reviewed by: tegge@
MFC after: 3 weeks
2005-12-16 18:34:14 +00:00
Xin LI 6ba9ec2d09 In pipe_write(): when uiomove() fails, do not spin on it forever.
Submitted by:	Kostik Belousov <kostikbel at gmail.com> on -current@
Message-ID:	<20051216151016.GE84442@deviant.zoral.local>
MFC After:	3 weeks
2005-12-16 18:32:39 +00:00
Bill Paul 923218fd4a MFC: sync with -current (interrupt handler API fixes, RT2500 deadlock
with wpa_supplicant)
2005-12-16 17:27:45 +00:00
Bill Paul a807264e92 In ndis_rxeof_eth(), avoid acquiring the NDIS miniport block spinlock for
serialized miniports when updating the packet list.

This fixes a deadlock that can occur with the Ralink RT2500 driver
when using wpa_supplicant.
2005-12-16 17:21:28 +00:00
Ruslan Ermilov 1a40739a00 Fix PCI ID of the AMD-8111 System Management controller so it matches
SMBus 1.0 and not SMBus 2.0.

AMD-8111 hub (datasheet is publically available) implements both SMBus
2.0 (a separate PCI device) and SMBus 1.0 (a subfunction of the System
Management Controller device with the base I/O address is accessible
through the CSR 0x58).  This driver only supports AMD-756 SMBus 1.0
compatible devices.

With the patched sysutils/xmbmon port (to also fix PCI ID and to enable
smb(4) support), I now get:

pciconf:
none0@pci0:7:2: class=0x0c0500 card=0x746a1022 chip=0x746a1022 rev=0x02 hdr=0x00
    vendor   = 'Advanced Micro Devices (AMD)'
    device   = 'AMD-8111 SMBus 2.0 Controller'
    class    = serial bus
    subclass = SMBus
amdpm0@pci0:7:3:        class=0x068000 card=0x746b1022 chip=0x746b1022 rev=0x05 hdr=0x00
    vendor   = 'Advanced Micro Devices (AMD)'
    device   = 'AMD-8111 ACPI System Management Controller'
    class    = bridge

dmesg:
amdpm0: <AMD 756/766/768/8111 Power Management Controller> port 0x10e0-0x10ff at device 7.3 on pci0
smbus0: <System Management Bus> on amdpm0

# mbmon -A -d
Summary of Detection:
 * SMB monitor(s)[ioctl:AMD8111]:
  ** Winbond Chip W83627HF/THF/THF-A found at slave address: 0x50.
  ** Analog Dev. Chip ADM1027 found at slave address: 0x5C.
 * ISA monitor(s):
  ** Winbond Chip W83627HF/THF/THF-A found.

I think the confusion comes from the fact that nobody really tried
SMBus with xmbmon :-), since sysutils/xmbmon port doesn't come with
SMBus support enabled, neither in FreeBSD 4, nor in later versions,
so mbmon(1) was just showing the values from the Winbond sensors
accessible through the ISA I/O method (mbmon -I), for me anyway.

On my test machine, the amdpm(4) didn't even attach due to I/O port
allocation failure (who knows what the hell it read from CSR 0x58
of the SMBus 2.0 device :-), which isn't in the CSR space).

I've also checked that lm_sensors.org uses correct PCI ID for SMBus
1.0 of AMD-8111:

i2c-amd756.c:   {PCI_VENDOR_ID_AMD, 0x746B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111 },

This driver is analogous to our amdpm.c which supports SMBus 1.0
AMD-756 and compatible devices, including SMBus 1.0 on AMD-8111.

i2c-amd8111.c:  { 0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },

This driver is analogous to nForce-2/3/4, i2c-nforce2.c, which
supports SMBus 2.0, and which our amdpm.c does NOT support
(SMBus 2.0 uses a different, ACPI-unified, API to talk to SMBus).
At least I know for sure it doesn't work with my nForce3.  :-)

(The xmbmon port will be fixed to correct the PCI ID too and to
enable the smb(4) support.)
2005-12-16 15:03:16 +00:00
Ed Maste bd2b686fe8 Add descriptions for sysctl -d.
Approved by:	glebius
Silence from:	rwatson (mentor)
2005-12-16 15:01:44 +00:00
David Xu 03f70aec67 Replace selwakeuppri with selwakeup, let scheduler figure out
appropriate thread priority.
2005-12-16 15:01:16 +00:00
Gleb Smirnoff 6e02dbdfa3 Cleanup __FreeBSD_version. 2005-12-16 13:10:32 +00:00
Ceri Davies ced42c6c54 Document the pfsync(4) specific maxupd parameter, with text mostly taken
from OpenBSD's manpage.

PR:		docs/89256
Submitted by:	Pim van Pelt <pim at ipng dot nl>
MFC after:	3 days
2005-12-16 11:38:18 +00:00
Pyun YongHyeon e3829d1f54 Add jumbo frame support for architectures with strict alignment.
Reviewed by:	glebius
2005-12-16 08:29:43 +00:00
Søren Schmidt 121b478372 Cleanup the strings for printing chipset names, saves quite some space.
Add a couble new nVidia chips now we are here.
2005-12-16 08:12:13 +00:00
Paul Saab 2514c5bfdd It seems ciss should ignore overrun and underrun on a SCSI INQUIRY
command.  This fixes some weird booting issues on newer versions
of the firmware on the MSA20.

Reported by:	Philippe Pegon <Philippe dot Pegon at crc dot u-strasbg dot fr>
2005-12-16 06:50:55 +00:00
Scott Long 7f512e8f29 Make this compile on 64bit systems. It likely isn't correct, but that can
be sorted out later.
2005-12-16 06:11:22 +00:00
Scott Long 98f9589da1 Fix compiling on platforms with 64bit time_t. 2005-12-16 06:02:44 +00:00
Scott Long 0717619c5c Don peril sensitive sunglasses and jack up the MAX_BPAGES limit to 8192
on amd64.  If you're going to stuff >4GB into your box, reserving 32MB for
bonce pages amounts to a rounding error in the overall scheme of things.
2005-12-16 05:57:18 +00:00
David Xu 3b52e4d1b7 With current pthread implementations, a mutex initialization will
allocate a memory block. sscanf calls __svfscanf which in turn calls
fread, fread triggers mutex initialization but the mutex is not
destroyed in sscanf, this leads to memory leak. To avoid the memory
leak and performance issue, we create a none MT-safe version of fread:
__fread, and instead let __svfscanf call __fread.

PR: threads/90392
Patch submitted by: dhartmei
MFC after: 7 days
2005-12-16 02:50:53 +00:00
John Baldwin 74a96f4337 Use uintmax_t and %j to print bus dma segment members rather than casting
to long long and using %ll.
2005-12-15 22:12:27 +00:00
John Baldwin 636a309adb Use %t (ptrdiff_t modifier) to print a couple of pointer differences rather
than casting them to int.
2005-12-15 21:57:32 +00:00
Joel Dahl 3004a7fb15 Make the SYNOPSIS section a bit more informative. 2005-12-15 21:02:16 +00:00
Joel Dahl aaf93d16ab Make the SYNOPSIS section a bit more informative. 2005-12-15 20:25:41 +00:00
Andrew Thompson 7536320f62 It is not safe to use m_copypacket() here as the returned mbuf is readonly,
change to m_dup and keep the alignment on the layer3 header.

MFC after:	1 week
2005-12-15 19:34:39 +00:00
John Baldwin 04ddb211d5 Install nextboot in /rescue as /rescue/nextboot rather than
/rescue/nextboot.sh to match the name in /sbin (/sbin/nextboot).

Reviewed by:	gtetlow
MFC after:	1 week
2005-12-15 18:29:01 +00:00
Christian Brueffer 64026ffebb VIA Tech V-RAID write support added. 2005-12-15 17:02:11 +00:00
John Baldwin 410d857972 Remove linux_mib_destroy() (which I actually added in between 5.0 and 5.1)
which existed to cleanup the linux_osname mutex.  Now that MTX_SYSINIT()
has grown a SYSUNINIT to destroy mutexes on unload, the extra destroy here
was redundant and resulted in panics in debug kernels.

MFC after:	1 week
Reported by:	Goran Gajic ggajic at afrodita dot rcub dot bg dot ac dot yu
2005-12-15 16:30:41 +00:00
Bruce Evans 7aac169e18 Added comments about the apparently-magic rational function used in
the second step of approximating cbrt(x).  It turns out to be neither
very magic not nor very good.  It is just the (2,2) Pade approximation
to 1/cbrt(r) at r = 1, arranged in a strange way to use fewer operations
at a cost of replacing 4 multiplications by 1 division, which is an
especially bad tradeoff on machines where some of the multiplications
can be done in parallel.  A Remez rational approximation would give
at least 2 more bits of accuracy, but the (2,2) Pade approximation
already gives 6 more bits than needed.  (Changed the comment which
essentially says that it gives 3 more bits.)

Lower order Pade approximations are not quite accurate enough for
double precision but are plenty for float precision.  A lower order
Remez rational approximation might be enough for double precision too.
However, rational approximations inherently require an extra division,
and polynomial approximations work well for 1/cbrt(r) at r = 1, so I
plan to switch to using the latter.  There are some technical
complications that tend to cost a division in another way.
2005-12-15 16:23:22 +00:00
Søren Schmidt 5608e472c1 Add support for writing VIA metadata.
Null out the metadata on disks when array is deleted.
2005-12-15 13:30:23 +00:00
Gleb Smirnoff 7e27542a4a o Rewrite bge_encap() to use bus_dmamap_load_mbuf_sg(9), inlining the
callback function bge_dma_map_tx_desc() into the bge_encap() itself.
o If busdma returns EFBIG, try to m_defrag() the packet.

Reviewed by:	yongari
2005-12-15 09:45:53 +00:00
Pyun YongHyeon e907febf6a Add bge(4) support for big-endian architectures(part 1/2).
- Give up endianess support and switch to native-endian format for
   accessing hardware structures. In fact embedded processor for
   BCM57xx is big-endian architure(MIPS) and it requires native-endian
   format for NIC structures.The NIC performs necessary byte/word
   swapping depending on programmed endian type.
 - With above changes all htole16/htole32 calls were gone.
 - Remove bge_vhandle member in softc and changed to use explicit
   register access. This may add additional performance penalty
   that than that of previous memory access. But most of the access
   is performed on initialization phase(e.g. RCB setup), it would be
   negligible.

Due to incorrect use of bus_dma(9) in bge(4) it still panics sparc64
system in device detach path. The issue would be fixed in next patch.

Reviewed by:	jkim (initial version)
Silence from:	ps
Tested by:	glebius
Obtained from:	NetBSD via OpenBSD
2005-12-15 05:48:49 +00:00
Ian Dowse 25298bc2b6 Remove one more reference to usbd.conf. 2005-12-15 01:14:35 +00:00
Ian Dowse 2e46a159cc Remove usbd(8) and all references to it. It is no longer necessary
since devd(8) now provides the same functionality.

Submitted by:	Anish Mistry
2005-12-15 01:04:51 +00:00
Ed Maste 63e6f39011 When using m_dup(9) to copy more than MHLEN bytes of data, don't create an
mbuf chain that starts with a cluster containing just MHLEN bytes.  This
happened because m_dup called m_get or m_getcl depending on the amount of
data to copy, but then always set the size available in the first mbuf to
MHLEN.

Submitted by:	Matt Koivisto <mkoivisto at sandvine dot com>
Approved by:	jmg
Silence from:	rwatson (mentor)
2005-12-14 23:34:26 +00:00
Maxime Henrion e59898ff36 Fix a bunch of SYSCTL_INT() that should have been SYSCTL_ULONG() to
match the type of the variable they are exporting.

Spotted by:	Thomas Hurst <tom@hur.st>
MFC after:	3 days
2005-12-14 22:27:48 +00:00
John Baldwin 05ee80c796 Fix stale comment. 2005-12-14 21:47:02 +00:00
John Baldwin 3ca629a373 Whitespace. 2005-12-14 21:42:12 +00:00
Christian Brueffer b77c8db1f4 Add Via VT8251 support. 2005-12-14 21:10:59 +00:00
Wilko Bulte d000225ad0 Spelling fixes and minor nit.
PR: doc/9035
Submitted by: Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
2005-12-14 19:50:55 +00:00
Sam Leffler 29d58c7173 add control for packet bursting 2005-12-14 19:44:39 +00:00
Sam Leffler c27e4e31fe make packet bursting configurable (default to on if device is capable) 2005-12-14 19:32:53 +00:00
John Baldwin 23de16f9a7 Add support for the nForce2/3/4 SMBus controllers which all contain two
SMBus busses.  Because of limitations in smbus_if.m, the second smbus is
attached to an amdpm1 device that is a child of amdpm0.

Submitted by:	Artemiev Igor ai (at) bmc dot brk dot ru
2005-12-14 17:49:45 +00:00
Maxim Konovalov e20daf376d Fix the name of the country I was born. 2005-12-14 17:33:12 +00:00
Maxim Konovalov 19d099fc86 o Now when SIG_IGN signal action for SIGCHLD reap zombies
automatically it is possible wait4(2) returns -1 and sets
errno = ECHILD if there were forked children.  A user can
set such signal handler e.g. via ``trap "" 20'', see a PR
for the test case.  Deal with this case and mark a job as
JOBDONE.

PR:		bin/90334
Submitted by:	bde
MFC after:	4 weeks
2005-12-14 17:26:29 +00:00
Søren Schmidt 59a269294f Add RAID0+1 and RAID5 support to VIA RAID code.
Fix support for multiple arrays.
2005-12-14 13:07:49 +00:00
Søren Schmidt a569390328 Add support for VIA VT8251 southbridge.
SATA support for now in compat mode, but all 4 channels usable.
2005-12-14 12:13:00 +00:00
Søren Schmidt c6c6c58a89 Correct calculation of RAID0 sizes on VIA RAID arrays. 2005-12-14 12:11:51 +00:00
Maxim Konovalov 54ccb3ac94 o Correct usage(): delete command takes as argument array not channel.
PR:		bin/90353
Submitted by:	Gavin Atkinson
MFC after:	1 week
2005-12-14 06:33:18 +00:00
Scott Long 5351742ea2 Mega update to the LSI MegaRAID driver:
1.  Implement a large set of ioctl shims so that the Linux management apps
from LSI will work.  This includes infrastructure to support adding, deleting
and rescanning arrays at runtime.  This is based on work from Doug Ambrosko,
heavily augmented by LSI and Yahoo.

2.  Implement full 64-bit DMA support.  Systems with more than 4GB of RAM
can now operate without the cost of bounce buffers.  Cards that cannot do
64-bit DMA will automatically revert to using bounce buffers.  This option
can be forced off by setting the 'hw.amr.force_sg32" tunable in the loader.
It should only be turned off for debugging purposes.  This work was sponsored
by Yahoo.

3.  Streamline the command delivery and interrupt handler paths after
much discussion with Dell and LSI.  The logic now closely matches the
intended design, making it both more robust and much faster.  Certain
i/o failures under heavy load should be fixed with this.

4.  Optimize the locking.  In the interrupt handler, the card can be checked
for completed commands without any locks held, due to the handler being
implicitely serialized and there being no need to look at any shared data.
Only grab the lock to return the command structure to the free pool.  A
small optimization can still be made to collect all of the completions
together and then free them together under a single lock.

Items 3 and 4 significantly increase the performance of the driver.  On an
LSI 320-2X card, transactions per second went from 13,000 to 31,000 in my
testing with these changes.  However, these changes are still fairly
experimental and shouldn't be merged to 6.x until there is more testing.

Thanks to Doug Ambrosko, LSI, Dell, and Yahoo for contributing towards
this.
2005-12-14 03:26:49 +00:00
Andrew Thompson 91f6764e93 Add support for creating span ports so that one can snoop bridged traffic
from another interface/machine/network.

Obtained from:	OpenBSD
MFC after:	2 weeks
2005-12-14 02:52:13 +00:00
David Xu dbcf945af6 Style fixs, add missing word 'signal'.
Reviewed by: deischen
2005-12-14 01:59:11 +00:00
Sam Leffler aa5eb8878e display a bssid that's zero with the -v option 2005-12-14 01:22:26 +00:00