yongari [Tue, 3 Jan 2012 00:22:57 +0000 (00:22 +0000)]
MFC r226814-226815,226820-226821,226864,226866-226867:
r226814:
Rename definition of BGE_SOFTWARE_GENCOMM_* to more readable ones.
The origin of GENCOMM seems to come from Alteon Tigon Host/NIC
interface definition where it defines general communications region
which is active when firmware is loaded and running. This region
was used in communication between the host and processor internal
to the Tigon chip.
Broadcom data sheet also defines the region as 'Software Gencomm'
in NetXtreme memory map but lacks detailed description of its
interface so it was hard to know which ones are used for which
interface.
This change shall slightly enhance readability.
No functional changes.
r226815:
Define MAC address mail box and use it instead of using
hard-coded value.
r226820:
Offset 0x6810 is RX-RISC event register. Rename BGE_CPU_EVENT with
BGE_RX_CPU_EVENT for readability.
Additionally define BGE_TX_CPU_EVENT for TX-RSIC event register(BCM570[0-4] only).
r226821:
SRAM offset 0x0C04 is used by driver to inform the IPMI/ASF firmware
about the various driver events like load, unload, reset, suspend,
restart, and ioctl operations.
Define driver's event rather than using hard-coded values. We don't
still send suspend/resume event to firmware.
Previously bge(4) used BGE_SDI_STATUS to send events. Because driver
has to access firmware mail box to inform current state, using
BGE_SDI_STATUS register was wrong. The end result was the same as
BGE_SDI_STATUS is 0x0C04.
No functional changes.
r226864:
Rename BGE_FW_DRV_ALIVE/BGE_FW_PAUSE to BGE_FW_CMD_DRV_ALIVE/BGE_FW_CMD_PAUSE.
Also add more firmware commands(not used yet).
No functional changes.
r226866:
Rename hard-coded value 1 << 14 with BGE_RX_CPU_DRV_EVENT.
This bit(SW event 7 in publicly available data sheet) is used to
make RX CPU handle a firmware command and the bit is automatically
cleared after RX CPU completed the command.
Generally firmware command takes the following steps.
1. Write BGE_SRAM_FW_CMD_MB with a command.
2. Write BGE_SRAM_FW_CMD_LEN_MB with the length of the command in bytes.
3. Write BGE_SRAM_FW_CMD_DATA_MB with actual command data.
4. Generate BGE_RX_CPU_EVENT and let firmware handle the command.
5. Wait for the ACK of the firmware command.
No functional changes.
r226867:
Define BGE_FW_HB_TIMEOUT_SEC and remove one more magic value.
bge(4) sends BGE_FW_CMD_DRV_ALIVE command to firmware every 2
seconds. BGE_FW_CMD_DRV_ALIVE command requires 4 bytes data. This
data contains timeout value in seconds until the next
BGE_FW_CMD_DRV_ALIVE command.
Broadcom recommends driver set the value 3 times longer than the
interval that it sends BGE_FW_CMD_DRV_ALIVE. Currently bge(4) uses
3 seconds so probably we have to increase it in future and use
different ALIVE command(e.g. BGE_FW_CMD_DRV_ALIVE3).
r226770:
Fix long standing bge_sysctl_debug_info() issues.
o Protect bge(4) status block access and register dump with driver lock.
o Add missing bus_dmamap_sync() before dumping status block.
o Use minimum status block size, 32 bytes, for status block dump on most
controllers except BCM5700 AX/BX.
While I'm here, make the handler show 5717 Plus in hardware flags.
r226804:
Make CPMU handle GPHY power down control on controllers that have
CPMU capability.
r226805:
It is known that all Broadcom controllers have 4GB boundary DMA
bug. Apply workaround to all controllers.
r226806:
Broadcom says BCM5755 or higher and BCM5906 have short DMA bug.
Apply workaround to these controllers.
r226807:
BCM5719 cannot handle DMA requests for DMA segments that have
larger than 4KB in size. However the maximum DMA segment size
created in DMA tag is 4KB, so we wouldn't encounter the issue here.
Just record this issue such that let developers not to create a DMA
segment that is larger than 4KB for BCM5719. It's possible to split
a DMA segment into multiple smaller ones in run time but I believe
it's not worth to implement that.
gjb [Mon, 2 Jan 2012 23:43:16 +0000 (23:43 +0000)]
MFC r228356:
r228356:
- Update du(1):
- Sort arguments alphabetically where appropriate
- '-B blocksize' is not mutually exclusive of '-h|-k|-m'
- Mention '-t' in synopsis
- Other wording improvements
- Update usage() output to reflect the new synopsis
- Other miscellaneous improvements
yongari [Mon, 2 Jan 2012 23:35:18 +0000 (23:35 +0000)]
MFC r226701:
Add support for ALi/ULi, now NVIDIA, M5261/M5263 PCI FastEthernet
controller which is found on ULi M1563 South Bridge & M1689 Bridge.
These controllers look like a tulip clone.
M5263 controller does not support MII bitbang so use DC_ROM
register to access MII registers. Like other tulip variants, ULi
controller uses a setup frame to configure RX filter and uses new
setup frame format. It's not clear to me whether the controller
supports a hash based multicast filtering so this patch uses 14
perfect multicast filter to filter multicast frames. If number of
multicast addresses is greater than 14, controller is put into a
mode that receives all multicast frames.
Due to lack of access to M5261, this change was not tested with
M5261 but it probably works. Many thanks to Marco who provided
remote access to M5263.
Tested by: Marco Steinbach <coco <> executive-computing dot de>,
Martin MATO <martin.mato <> orange dot fr>
yongari [Mon, 2 Jan 2012 23:17:45 +0000 (23:17 +0000)]
MFC r226699:
When driver is run for the first time there would be no established
link such that calling dc_setcfg() right after media change would
be meaningless unless controller in question is not Davicom DM9102.
Ideally dc_setcfg() should be called when speed/duplex is resolved
otherwise it would reprogram controller with wrong speed/duplex
information. Because MII status change callback already calls
dc_setcfg() I think calling dc_setcfg() in dc_init_locked() is
wrong. For instance, it would take some time to establish a link
after mii_mediachg(), so blindly calling dc_setcfg() right after
mii_mediachg() will always yield wrong media configuration.
Extend dc_ifmedia_upd() to handle media change and still allow
21143 and Davidcom controllers program speed/duplex regardless of
current resolved speed/duplex of link. In theory 21143 may not need
to call dc_setcfg() right after media change, but leave it as it is
because there are too many variants to test that change. Probably
dc(4) shall need a PHY reset in dc_ifmedia_upd() but it's hard to
verify correctness of the change.
This change reliably makes ULi M5263 establish a link.
While I'm here correctly report media change result. Previously it
always reported a success.
mav [Mon, 2 Jan 2012 18:06:48 +0000 (18:06 +0000)]
MFC r227464, r227471
Major GEOM MULTIPATH class rewrite:
- Improved locking and destruction process to fix crashes.
- Improved "automatic" configuration method to make it consistent and safe
by reading metadata back from all specified paths after writing to one.
- Added provider size check to reduce chance of ordering conflict with
other GEOM classes.
- Added "manual" configuration method without using on-disk metadata.
- Added "add" and "remove" commands to allow manage paths manually.
- Failed paths are no longer dropped from geom, but only marked as FAIL
and excluded from I/O operations.
- Automatically restore failed paths when all others paths are marked
as failed, for example, because of device-caused (not transport) errors.
- Added "fail" and "restore" commands to manually control FAIL flag.
- geom is now destroyed on last path disconnection.
- Added optional Active/Active mode support. Unlike Active/Passive
mode, load evenly distributed between all working paths. If supported by
the device, it allows to significantly improve performance, utilizing
bandwidth of all paths. It is controlled by -A option during creation.
Disabled by default now.
- Improved `status` and `list` commands output.
mav [Mon, 2 Jan 2012 17:56:45 +0000 (17:56 +0000)]
MFC r226816:
Clarify disks/volumes above 2TiB support in geom_raid:
- add support for volumes above 2TiB with Promise metadata format;
- enforse and document other limitations:
- Intel and Promise metadata formats do not support disks above 2TiB;
- NVIDIA metadata format does not support volumes above 2TiB.
mav [Mon, 2 Jan 2012 17:36:14 +0000 (17:36 +0000)]
MFC r227637:
Introduce CAM_SIM_POLLED SIM flag, indicating that it works in polling mode.
It blocks CAM SWI usage on requests completion, unneeded because of polling
and denied during kernel dumping because of blocked scheduler.
Before r198899 there was periph flag CAM_PERIPH_POLLED, but that was wrong,
because there is whole SIM is polled or handled by SWI, not a single periph.
mav [Mon, 2 Jan 2012 17:27:07 +0000 (17:27 +0000)]
MFC r226680:
Some dmesg cosmetics:
- for the legacy PCI ATA channels move channel number out of the device
description, same as it is for ahci(4), siis(4) and mvs(4);
- add device description for the ISA ATA channels.
mav [Mon, 2 Jan 2012 17:19:58 +0000 (17:19 +0000)]
MFC r228200:
Add hw.ahci.force tunable to control whether AHCI drivers should attach
to known AHCI-capable chips (AMD/NVIDIA), configured for legacy emulation.
Enabled by default to get additional performance and functionality of AHCI
when it can't be enabled by BIOS. Can be disabled to honor BIOS settings if
needed for some reason.
mav [Mon, 2 Jan 2012 17:13:56 +0000 (17:13 +0000)]
MFC r227635:
Change the way how "not implemented" AHCI channels handled. Instead of
completely skipping them, create ahcich devices for them to allocate unit
numbers, but mark them as disabled to prevent driver probe and attach.
Last time some BIOSes tend to report unused channels as "not implemented".
This change makes ahcichX devices numbering consistent, independently of
connected disks. It makes per-channel driver hints usable and CAM devices
wiring possible on such systems.
rmacklem [Mon, 2 Jan 2012 16:54:21 +0000 (16:54 +0000)]
MFC: r227543
Modify the new NFS client so that nfs_fsync() only calls ncl_flush()
for regular files. Since other file types don't write into the
buffer cache, calling ncl_flush() is almost a no-op. However, it does
clear the NMODIFIED flag and this shouldn't be done by nfs_fsync() for
directories.
mdf [Mon, 2 Jan 2012 16:14:52 +0000 (16:14 +0000)]
MFC r228444:
- Define true and false in sys/types.h for _KERNEL consumers, and
typedef bool. Due to macro expansion it seemed better to use a
typedef for kernel consumers (specifically ofed won't compile
without more changes if a define is used).
- <stdbool.h> should also not re-define bool/true/false if they are
defined by <sys/types.h>. It would probably be a programming error
to define _KERNEL for user-space code, but downstream consumers
like Isilon have already been including <stdbool.h> in kernel
sources, and this protects that usage.
- sizeof(_Bool) is not necessarily the same as sizeof(int), so kernel
modules should be rebuilt with this change. Bump __FreeBSD_version.
No KBI change is expected based on review of the code.
dim [Mon, 2 Jan 2012 13:21:34 +0000 (13:21 +0000)]
MFC r228868:
When building the kernel for amd64 with clang, don't attempt to use the
-frename-registers option, as it is not supported. No change for builds
with gcc.
dim [Mon, 2 Jan 2012 13:20:01 +0000 (13:20 +0000)]
MFC r228861:
Set WERROR= for the nve(4) module. This driver gives several warnings
with clang, which will probably never be fixed, as it is unmaintained,
and superseded by nfe(4).
dim [Mon, 2 Jan 2012 13:17:31 +0000 (13:17 +0000)]
MFC r228822:
When building the kernel with clang, it produces several warnings which
might be useful in some cases, but which are not severe enough to error
out the whole kernel build. Display them anyway, so there is at least
some incentive to fix them eventually.
Start with -Wtautological-compare warnings. These usually occur when
people check if unsigned quantities are negative, or similar cases. To
clean these up would be painful, and might give problems if the base
type which is compared against changes to signed later on.
MFC r228841:
Amend r228822 by not directly adding to CWARNFLAGS, but to an optional
CWARNEXTRA variable, which gets included into the initial CWARNFLAGS
setting. This makes it easier to override CWARNFLAGS with completely
custom settings (including enabling any disabled warnings).
Reminded by: arundel
MFC r228860:
Make another clang warning, -Wempty-body, non-fatal during kernel
builds. All the instances of this warning in our tree are completely
harmless. (Most of the empty bodies look to be used simply as reminder
for the developer to add something later.)
While here, assign to CWARNEXTRA with ?=, so it can be overridden
easily, if needed.
MFC r228867:
Make another clang warning, -Wparentheses-equality, non-fatal during
kernel builds. All the instances of this warning in our tree are
completely harmless, and many people seem to like adding extra
parentheses to make precedence clearer.
dim [Mon, 2 Jan 2012 13:12:53 +0000 (13:12 +0000)]
MFC r228801:
Remove -mfancy-math from LIB32CPUFLAGS for amd64. It has been default
for our gcc since more than three years (see r181534, which is also in
stable/9 and stable/8). This flag used to be for the benefit of the old
in-kernel math emulator, which was removed more than eight years ago.
dim [Mon, 2 Jan 2012 13:01:57 +0000 (13:01 +0000)]
MFC r228783:
When building with clang, disable -Wshift-count-negative and
-Wshift-count-overflow for sys/dev/ath/ath_hal/ah_regdomain.c, as it
gets multiple instances of the following warnings:
Both warnings are false positives, caused by LLVM PR 10030. For global
initializations, clang fails to detect that the branch of the ternary
operator causing the warning is dead.
MFC r228793:
Amend r228783 by also disabling -Wshift-count-negative
-Wshift-count-overflow warnings for the ath module.
MFC r228818:
Disable various warnings for the ath module in a more fine-grained way:
only add the option for the specific .c files that need them, like via
sys/conf/files.
dim [Mon, 2 Jan 2012 12:53:11 +0000 (12:53 +0000)]
MFC r228781:
When building with clang, disable -Warray-bounds for sys/dev/asr/asr.c,
as it gets the following warning:
sys/dev/asr/asr.c:1836:29: warning: array index of '58' indexes past the end of an array (that contains 1 element) [-Warray-bounds]
while ((len > 0) && (sg < &((PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE)
^
sys/dev/asr/i2omsg.h:934:8: note: array 'Simple' declared here
I2O_SGE_SIMPLE_ELEMENT Simple[1];
^
This is a false positive, since I2O_SG_ELEMENT::Simple is not declared
as a C99 flexible array member, but in the old (but more portable) way.
At run-time, the proper number of array elements will hopefully have
been allocated.
MFC r228865:
Amend r228781 by also disabling -Warray-bounds warnings for the asr
module.
dim [Mon, 2 Jan 2012 12:50:19 +0000 (12:50 +0000)]
MFC r228779:
Start selectively disabling a few kernel build warnings for clang, since
there are some places in the kernel where fixing them is too disruptive,
or where there is a false positive.
In this case, disable -Wconstant-conversion for two aic7xxx-related
files, as they get the following warning on i386 (and possibly on other
32-bit arches):
sys/dev/aic7xxx/ahc_pci.c:112:10: warning: implicit conversion from 'long long' to 'bus_addr_t' (aka 'unsigned int') changes value from 549755813887 to 4294967295 [-Wconstant-conversion]
? 0x7FFFFFFFFFLL
~~^~~~~~~~~~~~~~
This is a false positive, since the code only passes the 0x7FFFFFFFFFLL
argument, if sizeof(bus_addr_t) is larger than 4 (e.g. on 64 bit arches,
or when PAE is enabled on i386). The code could be refactored to do
compile-time checks, but that is more disruptive.
MFC r228789:
Amend r228779 by also disabling -Wconstant-conversion warnings for the
aic7xxx module.
MFC r228805:
Disable -Wconstant-conversion warnings for the aic7xxx module in a more
fine-grained way: only add the option for the specific .c files that
need them, like via sys/conf/files.
rmacklem [Mon, 2 Jan 2012 04:25:25 +0000 (04:25 +0000)]
MFC: r227517
Move the setting of the default value for nm_wcommitsize to
before the nfs_decode_args() call in the new NFS client, so
that a specfied command line value won't be overwritten.
Also, modify the calculation for small values of desiredvnodes
to avoid an unusually large value or a divide by zero crash.
It seems that the default value for nm_wcommitsize is very
conservative and may need to change at some time.
kib [Mon, 2 Jan 2012 00:04:51 +0000 (00:04 +0000)]
MFC r228751:
Change the type of real_dev_bsize variable from long to u_int.
The DIOCGSECTORSIZE takes u_int * as an argument, using long *
causes failures on big-endian targets.
dim [Sun, 1 Jan 2012 23:53:16 +0000 (23:53 +0000)]
MFC r228722:
In usr.sbin/yp_mkdb/yp_mkdb.c, cast some printf field width parameters
to int, cast time_t to intmax_t, and use the corresponding printf length
modifier.
kib [Sun, 1 Jan 2012 23:51:18 +0000 (23:51 +0000)]
MFC r228306:
Most users of pipe(2) do not call fstat(2) on the returned pipe descriptors.
Optimize for the case, by lazily allocating the pipe inode number at the
fstat(2) time.
dim [Sun, 1 Jan 2012 23:49:11 +0000 (23:49 +0000)]
MFC r228714:
In usr.sbin/timed, fix several issues with printf formats:
- Cast time_t's to long, and print them with %ld.
- Print ptrdiff_t's with %td.
- Print ssize_t's and size_t's with %zd and %zu.
- Print int32_t's with %d.
Also, replace some int variables with the more appropriate size_t.
MFC r228719:
Some people pointed out long is 32-bit on some arches, while time_t is
64-bit, so better cast time_t to intmax_t, and use the appropriate
printf format strings.
MFC r228720:
Fix r228719; when you use intmax_t, you need stdint.h.
dim [Sun, 1 Jan 2012 23:45:21 +0000 (23:45 +0000)]
MFC r228713:
In contrib/tcpdump/print-icmp6.c, fix a problem where the comparison
against icmp6_hdr::icmp6_type is done incorrectly. (This fix has
already been applied upstream, but we do not have the latest version of
tcpdump.)
dim [Sun, 1 Jan 2012 23:39:56 +0000 (23:39 +0000)]
MFC r228678:
In usr.sbin/rpc.ypupdated/yp_dbupdate.c, use the appropriate printf
length modifier for time_t (after casting it to intmax_t).
MFC r228679:
In usr.sbin/rpc.ypupdated/yp_dbupdate.c, include stdint.h, so intmax_t
is known, otherwise it won't build.
Pointy hat to: dim
MFC r228680:
In usr.sbin/rpc.ypupdated/yp_dbupdate.c, since intmax_t is signed, just
like time_t, better use %jd instead of %ju. Strangely enough, neither
gcc, clang nor gcc 4.6 warn about this discrepancy...
kib [Sun, 1 Jan 2012 23:34:06 +0000 (23:34 +0000)]
MFC r227656:
Use the alternate form of the gcc extension that works even with
-ansi -pedantic without issuing a warning, and which is recommended
by gcc manual.
kib [Sun, 1 Jan 2012 23:12:43 +0000 (23:12 +0000)]
MFC r227696:
Do not use NULLVPTOLOWERVP() in the null_print(). If diagnostic is compiled
in, and show vnode is used from ddb on the faulty nullfs vnode, we get
panic instead of vnode dump.
dim [Sun, 1 Jan 2012 23:08:19 +0000 (23:08 +0000)]
MFC r228665:
Use NO_WCAST_ALIGN for usr.sbin/ndiscvt; because this is only built for
x86, any alignment warnings can be safely ignored. Define YY_NO_INPUT
in usr.sbin/ndiscvt/inf-token.l, so no unused lex functions are defined.
dougb [Sun, 1 Jan 2012 22:33:02 +0000 (22:33 +0000)]
MFC r228909:
1. Remove a bunch of duplicates. Usually this means removing them from
fortunes, but occasionally remove them from the other 2 files when
they are not offensive, or not murphy'ish enough.
Where the version in fortunes had better attribution and/or formatting,
copy it over.
2. Fix a few typos
3. Use the full name of François De La Rochefoucauld, fix one of his
quotes, and remove the duplicate of it.
MFC r228934:
Prefer ASCII apostrophes over Unicode ones like the rest of the file.
MFC r228938:
1. Correct capitalization of the nobility particle for
Francois de La Rochefoucauld introduced in r228909
2. Change c-cedilla introduced in the same commit to ASCII c since
non-UTF-8 terminals will choke on the non-ASCII text.
dim [Sun, 1 Jan 2012 21:43:14 +0000 (21:43 +0000)]
MFC r228657:
In usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h, use the correct
enumeration types for the mesh_peering and mesh_forwarding members of
struct wlan_iface, to fix enum conversion warnings.
dim [Sun, 1 Jan 2012 20:57:38 +0000 (20:57 +0000)]
MFC r228650:
In usr.bin/netstat/atalk.c, work around a clang false positive with
printf format warnings and conditional operators.
MFC r228668:
Revert r228650, and work around the clang false positive with printf
formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to
the Makefile instead.
dim [Sun, 1 Jan 2012 20:53:33 +0000 (20:53 +0000)]
MFC r228649:
Use NO_WCAST_ALIGN for usr.bin/ncplist, as there are many potential
alignment issues in it. (Though I doubt anyone still cares about
NetWare support...)
dim [Sun, 1 Jan 2012 19:19:48 +0000 (19:19 +0000)]
MFC r228712:
Use NO_WCAST_ALIGN for usr.bin/hastctl and usr.bin/hastd; the alignment
warnings in sbin/hastd/lzf.c are only emitted for i386 and amd64, and
there they can be safely ignored.
dim [Sun, 1 Jan 2012 19:15:52 +0000 (19:15 +0000)]
MFC r228636:
Correct a logic error in usr.bin/hexdump/conv.c, found by clang.
Whenever the conv_c() function encounters an incomplete multibyte char,
it peeks ahead. It also sets p to peekbuf, to indicate it is still
processing the incomplete character.
However, on the next retry, it compares buf against peekbuf, which
always returns false, since both buf and peekbuf are local char arrays,
whose addresses are never the same.
Fix this by comparing against p instead, which was the intention. Also
turn peekbuf into an array of u_char, to prevent conversion warnings.
dim [Sun, 1 Jan 2012 19:05:15 +0000 (19:05 +0000)]
MFC r228627:
In contrib/ee/ee.c, fix a few warnings about format strings not being
literals. Also, change the direction argument to move_rel() from char
to int; K&R function definions cause it to be promoted to an int anyway,
and this way we avoid clang warning about it.