freebsd.git
10 years agoMerge byacc 20130925
bapt [Tue, 29 Oct 2013 08:21:22 +0000 (08:21 +0000)]
Merge byacc 20130925

2 changes:
- Increase default stack-size so that used to be our default stack-size prior byacc import
- fix two loop-limits found by clang 3.3

10 years agoImport byacc version 20130925
bapt [Tue, 29 Oct 2013 08:08:57 +0000 (08:08 +0000)]
Import byacc version 20130925

10 years agoRemove redundand declaration, fixing the build with gcc.
kib [Tue, 29 Oct 2013 07:25:54 +0000 (07:25 +0000)]
Remove redundand declaration, fixing the build with gcc.

Reported and tested by: Michael Butler <imb@protected-networks.net>
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

10 years agoFix regression introduced in r235816.
yongari [Tue, 29 Oct 2013 06:37:27 +0000 (06:37 +0000)]
Fix regression introduced in r235816.
r235816 triggered kernel panic or hang after warm boot.
Don't blindly restore BCE_EMAC_MODE media configuration in
bce_reset().  If driver is about to shutdown it will invoke
bce_reset() which in turn results in restoring BCE_EMAC_MODE
media configuration.  This operation seems to confuse controller
firmware.

Reported by: Paul Herman (herman <> cleverbridge dot com)
Tested by: sbruno, Paul Herman (herman <> cleverbridge dot com)

10 years agoAdd preliminary support for RTL8168EP.
yongari [Tue, 29 Oct 2013 05:37:05 +0000 (05:37 +0000)]
Add preliminary support for RTL8168EP.

Submitted by: Edward O'Callaghan (eocallaghan <> alterapraxis dot com)

10 years agoAdd preliminary support for RTL8168G, RTL8168GU and RTL8411B.
yongari [Tue, 29 Oct 2013 05:30:21 +0000 (05:30 +0000)]
Add preliminary support for RTL8168G, RTL8168GU and RTL8411B.
RTL8168GU has two variants(GMII and MII) but it uses the same chip
revision id.  Driver checks PCI device id of controller and
sets internal capability flag(i.e. jumbo frame and link speed down
in WOL).

H/W donated by: RealTek Semiconductor Corp.

10 years agoAdd support for new Gigabit PHY of RealTek.
yongari [Tue, 29 Oct 2013 05:14:38 +0000 (05:14 +0000)]
Add support for new Gigabit PHY of RealTek.
I don't have a copy of data sheet so I'm not sure exact PHY model
name. Vendor's web page indicates RTL8251 is latest PHY so I used
the name. This PHY is used with RTL8168G, RTL8168GU and RTL8411B.

10 years agobinutils/bfd: fix printf-like format strings for "bfd *" arguments
rea [Tue, 29 Oct 2013 04:25:49 +0000 (04:25 +0000)]
binutils/bfd: fix printf-like format strings for "bfd *" arguments

There is a special format argument '%B' that directly handles values
of type 'bfd *', they must be used instead of '%s'.  Manifestations
of this bug can be seen in ld(1) error messages, for example,
  http://lists.freebsd.org/pipermail/freebsd-current/2013-August/043580.html
  http://lists.freebsd.org/pipermail/freebsd-current/2013-October/045404.html

Approved by: dim
MFC after: 2 weeks

10 years agoFix the PLCP lookup code in iwn(4) to base the 11n decision on whether
adrian [Tue, 29 Oct 2013 04:03:00 +0000 (04:03 +0000)]
Fix the PLCP lookup code in iwn(4) to base the 11n decision on whether
the rate is 11n, rather than whether the channel is 11n.

This correctly allows the PLCP lookup code to return the legacy rates
even on an 11n channel.

PR: kern/183430

10 years agoFix an off-by-one error when checking whether a given address is within
markj [Tue, 29 Oct 2013 03:52:05 +0000 (03:52 +0000)]
Fix an off-by-one error when checking whether a given address is within
the extent of a symbol.

Submitted by: Prashanth Kumar <pra_udupi@yahoo.co.in>
Reviewed by: rpaulo
MFC after: 1 week

10 years agoDigi-CCWMX53: enable ffec and uart.
rpaulo [Tue, 29 Oct 2013 03:42:43 +0000 (03:42 +0000)]
Digi-CCWMX53: enable ffec and uart.

10 years agoRevert r257248 and fix the problem in a way that doesn't violate style(9).
markj [Tue, 29 Oct 2013 03:12:31 +0000 (03:12 +0000)]
Revert r257248 and fix the problem in a way that doesn't violate style(9).

Suggested by: jmg

10 years agoRemove unnecessary includes of <machine/pmap.h>
neel [Tue, 29 Oct 2013 02:25:18 +0000 (02:25 +0000)]
Remove unnecessary includes of <machine/pmap.h>

Requested by: alc@

10 years agoReturn NOKEY instead of 0 if there are no more key presses queued. This
nwhitehorn [Tue, 29 Oct 2013 00:53:17 +0000 (00:53 +0000)]
Return NOKEY instead of 0 if there are no more key presses queued. This
worked by accident if and only if akbd was part of a kbdmux (which it
always was in practice).

MFC after: 1 week

10 years agoAdd support for PCI-to-ISA LPC bridge emulation. If the LPC bus is attached
neel [Tue, 29 Oct 2013 00:18:11 +0000 (00:18 +0000)]
Add support for PCI-to-ISA LPC bridge emulation. If the LPC bus is attached
to a virtual machine then we implicitly create COM1 and COM2 ISA devices.

Prior to this change the only way of attaching a COM port to the virtual
machine was by presenting it as a PCI device that is mapped at the legacy
I/O address 0x3F8 or 0x2F8.

There were some issues with the original approach:
- It did not work at all with UEFI because UEFI will reprogram the PCI device
  BARs and remap the COM1/COM2 ports at non-legacy addresses.
- OpenBSD GENERIC kernel does not create a /dev/console because it expects
  the uart device at the legacy 0x3F8/0x2F8 address to be an ISA device.
- It was functional with a FreeBSD guest but caused the console to appear
  on /dev/ttyu2 which was not intuitive.

The uart emulation is now independent of the bus on which it resides. Thus it
is possible to have uart devices on the PCI bus in addition to the legacy
COM1/COM2 devices behind the LPC bus.

The command line option to attach ISA COM1/COM2 ports to a virtual machine is
"-s <bus>,lpc -l com1,stdio".

The command line option to create a PCI-attached uart device is:
"-s <bus>,uart[,stdio]"

The command line option to create PCI-attached COM1/COM2 device is:
"-S <bus>,uart[,stdio]". This style of creating COM ports is deprecated.

Discussed with: grehan
Reviewed by: grehan
Submitted by: Tycho Nightingale (tycho.nightingale@pluribusnetworks.com)

M    share/examples/bhyve/vmrun.sh
AM   usr.sbin/bhyve/legacy_irq.c
AM   usr.sbin/bhyve/legacy_irq.h
M    usr.sbin/bhyve/Makefile
AM   usr.sbin/bhyve/uart_emul.c
M    usr.sbin/bhyve/bhyverun.c
AM   usr.sbin/bhyve/uart_emul.h
M    usr.sbin/bhyve/pci_uart.c
M    usr.sbin/bhyve/pci_emul.c
M    usr.sbin/bhyve/inout.c
M    usr.sbin/bhyve/pci_emul.h
M    usr.sbin/bhyve/inout.h
AM   usr.sbin/bhyve/pci_lpc.c
AM   usr.sbin/bhyve/pci_lpc.h

10 years agoFix condition that determines PMAP_NEEDS_PTE_SYNC value for ARM
zbb [Mon, 28 Oct 2013 23:42:44 +0000 (23:42 +0000)]
Fix condition that determines PMAP_NEEDS_PTE_SYNC value for ARM

Use values of the correct defines to determine statement's result.
ARM_ARCH_ symbols are always defined, hence only values are relevant.

Reviewed by: cognet

10 years agoProvide necessary includes.
glebius [Mon, 28 Oct 2013 23:34:05 +0000 (23:34 +0000)]
Provide necessary includes.

10 years agoProvide necessary includes that before came via if.h.
glebius [Mon, 28 Oct 2013 23:17:41 +0000 (23:17 +0000)]
Provide necessary includes that before came via if.h.

10 years agoClean up a spurious "." in SEE ALSO.
brueffer [Mon, 28 Oct 2013 23:02:12 +0000 (23:02 +0000)]
Clean up a spurious "." in SEE ALSO.

MFC after: 3 days

10 years agoNew sentence -> new line and some mdoc cleanup.
brueffer [Mon, 28 Oct 2013 22:54:28 +0000 (22:54 +0000)]
New sentence -> new line and some mdoc cleanup.

MFC after: 3 days

10 years ago- Provide necessary includes, that before came via if.h pollution.
glebius [Mon, 28 Oct 2013 22:26:03 +0000 (22:26 +0000)]
- Provide necessary includes, that before came via if.h pollution.
- Remove unnecessary ones.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

10 years agoSwitch off explicit broadcasting of the TLB flush operations for PJ4B CPU
zbb [Mon, 28 Oct 2013 21:41:44 +0000 (21:41 +0000)]
Switch off explicit broadcasting of the TLB flush operations for PJ4B CPU

Since CPU_MV_PJ4B describes ARMv7 compliant CPU there is no need for
sending an IPI each time when TLB is flushed in any way.

Tested by: kevlo

10 years agoRemove not working and deprecated PJ4Bv6 support
zbb [Mon, 28 Oct 2013 21:39:54 +0000 (21:39 +0000)]
Remove not working and deprecated PJ4Bv6 support

Sheeva PJ4Bv6 - based chips were only prototypes for V7 class Armada
SoC family. Current in-tree support for PJ4Bv6 will not work and also
there should be no platforms in active use that would incorporate that
CPU revision.

10 years agoChange Armada XP kernel load address to the u-boot's end address
zbb [Mon, 28 Oct 2013 21:37:45 +0000 (21:37 +0000)]
Change Armada XP kernel load address to the u-boot's end address

Loading kernel to 0xf00000 has no practical reason.
Starting it from the u-boot's highest possible end address
(2MB counting from 0x0) makes more sense.

Tested by: kevlo

10 years agoFix-up DTB for Armada XP registers' base according to the actual settings
zbb [Mon, 28 Oct 2013 21:34:32 +0000 (21:34 +0000)]
Fix-up DTB for Armada XP registers' base according to the actual settings

Depending on u-boot's flavor some boards have their SoC registers
base address configured to 0xD0000000 and other to 0xF1000000.
U-boot is passing currently set value via CP15 register.
In order to create proper mapping for SoC registers and allow further
successful initialization it is necessary to replace fdt_immr_pa with
the real value and eventually fix-up device tree blob.

Tested by: kevlo

10 years agoRemove hard-coded mappings related to Armada XP support
zbb [Mon, 28 Oct 2013 21:31:12 +0000 (21:31 +0000)]
Remove hard-coded mappings related to Armada XP support

Armada XP initialization flow requires SoC registers to be
mapped very early in order to configure Snoop Filter for SMP.
Additional mapping in locore.S is redundant as proper mapping is
made in pmap_devmap_bootstrap() prior to calling cpu_setup() which
configures the Snoop Filter.
For secondaru CPUs it is better to pass VA of the SoC
registers defined in MV_BASE and PA consistent with the value
in the Device Tree.

Tested by: kevlo

10 years agoInclude XEN and HyperV into amd64 LINT.
glebius [Mon, 28 Oct 2013 21:11:28 +0000 (21:11 +0000)]
Include XEN and HyperV into amd64 LINT.

10 years agoRemove dead function show_device(). It isn't buildable if DEBUG is
glebius [Mon, 28 Oct 2013 21:09:59 +0000 (21:09 +0000)]
Remove dead function show_device(). It isn't buildable if DEBUG is
defined, due to unknown field "xn_ifno".  The field wasn't known
since beginning of history of this file.

10 years agoInclude if_var.h.
glebius [Mon, 28 Oct 2013 21:08:04 +0000 (21:08 +0000)]
Include if_var.h.

10 years agoFis the value of *optlen when calling getsockopt() for
tuexen [Mon, 28 Oct 2013 20:45:19 +0000 (20:45 +0000)]
Fis the value of *optlen when calling getsockopt() for
SCTP_REMOTE_UDP_ENCAPS_PORT.
This issue was reported by Andrew Galante.
MFC after: 3 days

10 years agoG/c unused mountrootfsname.
pluknet [Mon, 28 Oct 2013 20:38:17 +0000 (20:38 +0000)]
G/c unused mountrootfsname.
It was replaced with rootdevnames in r52778.

10 years agoFix compilation if SCTP_DONT_DO_PRIVADDR_SCOPE is defined.
tuexen [Mon, 28 Oct 2013 20:32:37 +0000 (20:32 +0000)]
Fix compilation if SCTP_DONT_DO_PRIVADDR_SCOPE is defined.
The issue was reported by Andrew Galante.

MFC after: 3 days

10 years agoStyle: s/SYS_EVENTHANDLER_H/_SYS_EVENTHANDLER_H_/g
glebius [Mon, 28 Oct 2013 20:32:05 +0000 (20:32 +0000)]
Style: s/SYS_EVENTHANDLER_H/_SYS_EVENTHANDLER_H_/g

Submitted by: bde

10 years agoInclude <sys/ktr.h>, since we need it if ATH_DEBUG is defined.
cognet [Mon, 28 Oct 2013 20:26:34 +0000 (20:26 +0000)]
Include <sys/ktr.h>, since we need it if ATH_DEBUG is defined.

10 years agoAdd a couple includes if net/if_var.h that were missed in r257176.
brooks [Mon, 28 Oct 2013 20:15:59 +0000 (20:15 +0000)]
Add a couple includes if net/if_var.h that were missed in r257176.

10 years agoEnable the --sysroot=/foo option in ld by always building with a sysroot
brooks [Mon, 28 Oct 2013 19:56:46 +0000 (19:56 +0000)]
Enable the --sysroot=/foo option in ld by always building with a sysroot
defined. When not building as a cross linker, the sysroot is set to "/".

Exp-run by: bdrewery (ports/183206)
MFC after: 3 days

10 years agoRemove redundand assignment to error variable and check for its value [1].
kib [Mon, 28 Oct 2013 19:30:09 +0000 (19:30 +0000)]
Remove redundand assignment to error variable and check for its value [1].
Do CTR logging in the case of error as well.

Noted by: rdivacky [1]
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

10 years agoFollow r257244; it's now necessary to include if_var.h.
ian [Mon, 28 Oct 2013 18:43:00 +0000 (18:43 +0000)]
Follow r257244; it's now necessary to include if_var.h.

10 years agoQueisce two category of clang warnings:
sbruno [Mon, 28 Oct 2013 18:24:31 +0000 (18:24 +0000)]
Queisce two category of clang warnings:

1.  missing explicit includes for string.h, stdio.h, etc
2.  missing explicit declaration for some common functions

I have been unable to contact the upstream maintainer for this patch,
http://www.inner.net/opie appears to be the source of truth but it
unreachable

10 years agoQuiesce warnings -Wdangling-else
sbruno [Mon, 28 Oct 2013 18:10:35 +0000 (18:10 +0000)]
Quiesce warnings -Wdangling-else

Thanks to jilles for some reviews and tips.

10 years agorepair build for dev/cs.
sbruno [Mon, 28 Oct 2013 16:27:01 +0000 (16:27 +0000)]
repair build for dev/cs.

Reported by: Outback Dingo <outbackdingo@gmail.com>

10 years agoRemove more remnants of ng_fec(4).
glebius [Mon, 28 Oct 2013 16:21:31 +0000 (16:21 +0000)]
Remove more remnants of ng_fec(4).

The ng_create_one() and ng_mkpeer() functions in network.subr are
now not used anywhere, but I left them, since they can be useful
in future in netgraph scripting.

Submitted by: pluknet

10 years agoRemove ng_fec.4
glebius [Mon, 28 Oct 2013 15:38:26 +0000 (15:38 +0000)]
Remove ng_fec.4

Submitted by: Dmitry Luhtionov <dmitryluhtionov gmail.com>

10 years agoSweep up a bit of arm-land fallout after r257244; include necessary
ian [Mon, 28 Oct 2013 15:20:17 +0000 (15:20 +0000)]
Sweep up a bit of arm-land fallout after r257244; include necessary
headers directly that are no longer available via accidental include.

10 years agoRemove ng_fec(4).
glebius [Mon, 28 Oct 2013 15:17:41 +0000 (15:17 +0000)]
Remove ng_fec(4).

10 years agoFix build. We need to include systm.h before if_var.h.
glebius [Mon, 28 Oct 2013 15:11:37 +0000 (15:11 +0000)]
Fix build. We need to include systm.h before if_var.h.

Pointy hat to: glebius

10 years agoRemove ng_fec(4).
glebius [Mon, 28 Oct 2013 14:52:08 +0000 (14:52 +0000)]
Remove ng_fec(4).

10 years agoRemove ng_fec(4).
glebius [Mon, 28 Oct 2013 14:47:33 +0000 (14:47 +0000)]
Remove ng_fec(4).

10 years agoImport the driver for VT-d DMAR hardware, as specified in the revision
kib [Mon, 28 Oct 2013 13:33:29 +0000 (13:33 +0000)]
Import the driver for VT-d DMAR hardware, as specified in the revision
1.3 of Intelб╝ Virtualization Technology for Directed I/O Architecture
Specification.  The Extended Context and PASIDs from the rev. 2.2 are
not supported, but I am not aware of any released hardware which
implements them.  Code does not use queued invalidation, see comments
for the reason, and does not provide interrupt remapping services.

Code implements the management of the guest address space per domain
and allows to establish and tear down arbitrary mappings, but not
partial unmapping.  The superpages are created as needed, but not
promoted.  Faults are recorded, fault records could be obtained
programmatically, and printed on the console.

Implement the busdma(9) using DMARs.  This busdma backend avoids
bouncing and provides security against misbehaving hardware and driver
bad programming, preventing leaks and corruption of the memory by wild
DMA accesses.

By default, the implementation is compiled into amd64 GENERIC kernel
but disabled; to enable, set hw.dmar.enable=1 loader tunable.  Code is
written to work on i386, but testing there was low priority, and
driver is not enabled in GENERIC.  Even with the DMAR turned on,
individual devices could be directed to use the bounce busdma with the
hw.busdma.pci<domain>:<bus>:<device>:<function>.bounce=1 tunable.  If
DMARs are capable of the pass-through translations, it is used,
otherwise, an identity-mapping page table is constructed.

The driver was tested on Xeon 5400/5500 chipset legacy machine,
Haswell desktop and E5 SandyBridge dual-socket boxes, with ahci(4),
ata(4), bce(4), ehci(4), mfi(4), uhci(4), xhci(4) devices.  It also
works with em(4) and igb(4), but there some fixes are needed for
drivers, which are not committed yet.  Intel GPUs do not work with
DMAR (yet).

Many thanks to John Baldwin, who explained me the newbus integration;
Peter Holm, who did all testing and helped me to discover and
understand several incredible bugs; and to Jim Harris for the access
to the EDS and BWG and for listening when I have to explain my
findings to somebody.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

10 years agong_fec(4) removed.
glebius [Mon, 28 Oct 2013 12:49:07 +0000 (12:49 +0000)]
ng_fec(4) removed.

10 years agoAxe ng_fec(4). It has never been a real netgraph(4) module, since
glebius [Mon, 28 Oct 2013 12:47:05 +0000 (12:47 +0000)]
Axe ng_fec(4). It has never been a real netgraph(4) module, since
it had no hooks. It has abused ifnet's if_afdata slot and actually
abused every subsystem it touched.

lagg(4) is a proper trunking solution at ifnet(9) layer.

ng_one2many(4) is a proper trunking solution in netgraph(4).

10 years agoFix the build with gcc.
markj [Mon, 28 Oct 2013 12:42:27 +0000 (12:42 +0000)]
Fix the build with gcc.

10 years ago- Fix VIMAGE build.
glebius [Mon, 28 Oct 2013 10:12:19 +0000 (10:12 +0000)]
- Fix VIMAGE build.
- Fix build with gcc.

10 years ago- Make the prophecy from 1997 happen and remove if_var.h inclusion
glebius [Mon, 28 Oct 2013 08:03:40 +0000 (08:03 +0000)]
- Make the prophecy from 1997 happen and remove if_var.h inclusion
  from if.h.
- Remove unnecessary includes and declarations from if.h
- Remove unnecessary includes and declarations from if_var.h [1]
- Mark some declarations that are about to be removed in near
  future with comments, explaning why this declaration is still
  necessary.
- Protect eventhandler declarations with #ifdef SYS_EVENTHANDLER_H.

Obtained from: bdeBSD [1]
Sponsored by: Netflix
Sponsored by: Nginx, Inc.

10 years agoInstead of putting ifnet declaration into eventhandler.h, move
glebius [Mon, 28 Oct 2013 07:45:03 +0000 (07:45 +0000)]
Instead of putting ifnet declaration into eventhandler.h, move
bpf(4) and vlan(4) related event declarations to bpf.h and
if_vlan_var.h. To avoid dependency on eventhandler.h, protect
these declarations with ifdef SYS_EVENTHANDLER_H.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

10 years agoInclude necessary headers that now are available due to pollution
glebius [Mon, 28 Oct 2013 07:29:16 +0000 (07:29 +0000)]
Include necessary headers that now are available due to pollution
via if_var.h.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

10 years agoRun mvs SATA driver on Armada XP instead of old mv_sata
zbb [Mon, 28 Oct 2013 07:18:24 +0000 (07:18 +0000)]
Run mvs SATA driver on Armada XP instead of old mv_sata

The mvs driver seems to be more functional than mv_sata and is not
causing random interrupt storms during boot.

10 years agoCorrect ld(1) manual page for --no-add-needed set as default after r253839
rea [Mon, 28 Oct 2013 05:55:47 +0000 (05:55 +0000)]
Correct ld(1) manual page for --no-add-needed set as default after r253839

Approved by: dim
MFC after: 2 weeks

10 years agoQuiesce warning -Wmissing-variable-declarations from buildworld, which is
sbruno [Mon, 28 Oct 2013 02:36:34 +0000 (02:36 +0000)]
Quiesce warning -Wmissing-variable-declarations from buildworld, which is
slightly unnerving.

In file included from ioctl.c:48:
/var/tmp/home/sbruno/bsd/head/tmp/usr/include/dev/lmc/if_lmc.h:939:13:
warning: no previous extern declaration for non-static variable 'ssi_cables'
[-Wmissing-variable-declarations]
const char *ssi_cables[] =

10 years agoRemove an incorrect debug printf.
markj [Mon, 28 Oct 2013 01:41:59 +0000 (01:41 +0000)]
Remove an incorrect debug printf.

10 years agoWith r247602, the "c" flag is no longer printed as a file descriptor flag.
markj [Mon, 28 Oct 2013 00:20:30 +0000 (00:20 +0000)]
With r247602, the "c" flag is no longer printed as a file descriptor flag.

Reviewed by: pjd
MFC after: 3 days

10 years agoUse the size of the MACHINE_ARCH string instead of sizeof(uint32_t). It can
cognet [Sun, 27 Oct 2013 23:48:59 +0000 (23:48 +0000)]
Use the size of the MACHINE_ARCH string instead of sizeof(uint32_t). It can
happen sizeof(MACHINE_ARCH) is more than 4 bytes, and bad things would
happen. This should make the ctors being called again on armeb.

10 years agoMake sure the PCB is aligned on 8 bytes, we may use ldrd/strd to access it,
cognet [Sun, 27 Oct 2013 22:15:50 +0000 (22:15 +0000)]
Make sure the PCB is aligned on 8 bytes, we may use ldrd/strd to access it,
which may have strong alignment requirements.

10 years agoAdd a virtual table for the busdma methods on x86, to allow different
kib [Sun, 27 Oct 2013 22:05:10 +0000 (22:05 +0000)]
Add a virtual table for the busdma methods on x86, to allow different
busdma implementations to coexist.  Copy busdma_machdep.c to
busdma_bounce.c, which is still a single implementation of the busdma
interface on x86 for now.  The busdma_machdep.c only contains common
and dispatch code.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

10 years agoAdd bus_dmamap_load_ma() function to load map with the array of
kib [Sun, 27 Oct 2013 21:39:16 +0000 (21:39 +0000)]
Add bus_dmamap_load_ma() function to load map with the array of
vm_pages.  Provide trivial implementation which forwards the load to
_bus_dmamap_load_phys() page by page.  Right now all architectures use
bus_dmamap_load_ma_triv().

Tested by: pho (as part of the functional patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

10 years agoImport pf_print_state.c 1.54 from OpenBSD
bapt [Sun, 27 Oct 2013 21:07:37 +0000 (21:07 +0000)]
Import pf_print_state.c 1.54 from OpenBSD

Original log:
pfctl -ss printed state levels for ICMPv6. Disable this the same
way it has already been done for ICMPv4.

Difference with OpenBSD:
- WITHOUT_INET6 safe

Obtained from: OpenBSD

10 years agoedquota: Don't pass fd for temporary file to editor.
jilles [Sun, 27 Oct 2013 21:06:17 +0000 (21:06 +0000)]
edquota: Don't pass fd for temporary file to editor.

The editor opens the temporary file by name.

10 years agoImport pf.c 1.638 from OpenBSD
bapt [Sun, 27 Oct 2013 20:56:23 +0000 (20:56 +0000)]
Import pf.c 1.638 from OpenBSD

Original log:
Some ICMP types that also have icmp_id, pointed out by markus@

Obtained from: OpenBSD

10 years agoImprot pf.c 1.636 from OpenBSD
bapt [Sun, 27 Oct 2013 20:52:09 +0000 (20:52 +0000)]
Improt pf.c 1.636 from OpenBSD

Original log:
Make sure pd2 has a pointer to the icmp header in the payload; fixes
panic seen with some some icmp types in icmp error message payloads.

Obtained from: OpenBSD

10 years agoImport pf.c 1.635 and pf_lb.c 1.4 from OpenBSD
bapt [Sun, 27 Oct 2013 20:44:42 +0000 (20:44 +0000)]
Import pf.c 1.635 and pf_lb.c 1.4 from OpenBSD

Stricter state checking for ICMP and ICMPv6 packets: include the ICMP type

in one port of the state key, using the type to determine which
side should be the id, and which should be the type. Also:
- Handle ICMP6 messages which are typically sent to multicast
  addresses but recieve unicast replies, by doing fallthrough lookups
  against the correct multicast address.  - Clear up some mistaken
  assumptions in the PF code:
- Not all ICMP packets have an icmp_id, so simulate
  one based on other data if we can, otherwise set it to 0.
  - Don't modify the icmp id field in NAT unless it's echo
  - Use the full range of possible id's when NATing icmp6 echoy

Difference with OpenBSD version:
- C99ify the new code
- WITHOUT_INET6 safe

Reviewed by: glebius
Obtained from: OpenBSD

10 years agoClean up the debug printing in libproc a bit. In particular:
markj [Sun, 27 Oct 2013 20:39:10 +0000 (20:39 +0000)]
Clean up the debug printing in libproc a bit. In particular:

* Don't print any error messages to stderr unless DEBUG is defined.
* Add a DPRINTFX macro for use when errno isn't set.
* Print the error string from libelf when appropriate.

10 years agoFix typo.
kib [Sun, 27 Oct 2013 18:52:09 +0000 (18:52 +0000)]
Fix typo.

MFC after: 3 days

10 years agoProvide forward declaration for struct ifnet. Consumers
glebius [Sun, 27 Oct 2013 17:27:06 +0000 (17:27 +0000)]
Provide forward declaration for struct ifnet. Consumers
of this header don't need contents of struct.

10 years agoAlmost all if_clone consumers do not care about if_clone_event.
glebius [Sun, 27 Oct 2013 17:14:33 +0000 (17:14 +0000)]
Almost all if_clone consumers do not care about if_clone_event.
Do not force them to include sys/eventhandler.h. Those who
utilize EVENTHANDLER(9), will see the declaration.

10 years agoInclude lock.h before mutex.h.
glebius [Sun, 27 Oct 2013 17:12:31 +0000 (17:12 +0000)]
Include lock.h before mutex.h.

10 years agoRemove the last dregs of trapframe_t. It turns out only arm was using
ian [Sun, 27 Oct 2013 17:09:23 +0000 (17:09 +0000)]
Remove the last dregs of trapframe_t.  It turns out only arm was using
this type, so remove it to make arm code more consistant with other
platforms.  Thanks to bde@ for pointing out only arm used trapframe_t.

10 years agoSeveral small fixes for the amd64 minidump code.
kib [Sun, 27 Oct 2013 16:31:12 +0000 (16:31 +0000)]
Several small fixes for the amd64 minidump code.

In report_progress(), use nitems(progress_track) instead of manually
hard-coding array size.  Wrap long line.

In blk_write(), code verifies that ptr and pa cannot be non-zero
simultaneously.  The later check for the page-alignment of the ptr
argument never triggers due to pa != 0 always implying ptr == NULL.  I
believe that the intent was to ensure that physicall address passed is
page-aligned, since the address is (temporary) mapped for the duration
of the page write.

Clear the progress_track.visited fields when starting minidump.  If
minidump is restarted or taken second time during the system lifetime,
progress is not printed otherwise, making operator suspectible to the
dump status.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

10 years agoMove new pf includes to the pf directory. The pfvar.h remain
glebius [Sun, 27 Oct 2013 16:25:57 +0000 (16:25 +0000)]
Move new pf includes to the pf directory. The pfvar.h remain
in net, to avoid compatibility breakage for no sake.

The future plan is to split most of non-kernel parts of
pfvar.h into pf.h, and then make pfvar.h a kernel only
include breaking compatibility.

Discussed with: bz

10 years agoWhen reentering kdb, typically due to a bug causing trap or assert in
kib [Sun, 27 Oct 2013 16:20:52 +0000 (16:20 +0000)]
When reentering kdb, typically due to a bug causing trap or assert in
the code executed in the context of debugger, do not be ashamed to
inform loudly about the re-entry.  Also, print the backtrace before
obliterating current stack with longjmp, allowing the operator to see
a place which caused the bug.

The change should make it less mysterious debugging the ddb itself.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

10 years agoIf the initial attempt to open /dev/ksyms fails, kldload the ksyms module
markj [Sun, 27 Oct 2013 16:18:48 +0000 (16:18 +0000)]
If the initial attempt to open /dev/ksyms fails, kldload the ksyms module
and retry.

10 years agoConvert the lockstat(1) man page to mdoc and make sure that it gets
markj [Sun, 27 Oct 2013 16:01:11 +0000 (16:01 +0000)]
Convert the lockstat(1) man page to mdoc and make sure that it gets
installed. Additionally, remove Solaris-specific sections and references,
and replace example outputs with output from lockstat on FreeBSD, since
lockstat's output contains stack traces.

This change also removes some examples that don't seem to work properly on
FreeBSD. The examples should be re-added when lockstat is fixed.

Reported by: avg
MFC after: 1 week

10 years agoAlways build ubldr as a soft-float binary as there is no support for VFP
andrew [Sun, 27 Oct 2013 14:27:11 +0000 (14:27 +0000)]
Always build ubldr as a soft-float binary as there is no support for VFP
this early on in the boot process.

10 years agoTurn on VM_KMEM_SIZE_SCALE on 32-bit as well as 64-bit PowerPC.
nwhitehorn [Sun, 27 Oct 2013 14:03:51 +0000 (14:03 +0000)]
Turn on VM_KMEM_SIZE_SCALE on 32-bit as well as 64-bit PowerPC.

Requested by: alc
MFC after: 1 month

10 years agoUpdate the hard-float version of the fenv functions to use the VFP unit.
andrew [Sun, 27 Oct 2013 10:44:22 +0000 (10:44 +0000)]
Update the hard-float version of the fenv functions to use the VFP unit.
Any other floating-point unit is unsupported on ARM.

10 years agoFix a deadlock when trying to power off a USB device. The deadlock
hselasky [Sun, 27 Oct 2013 10:09:53 +0000 (10:09 +0000)]
Fix a deadlock when trying to power off a USB device. The deadlock
happens because the code in question is trying to modify the parent
USB port registers outside the USB explore thread.

MFC after: 3 days

10 years agoMention in login.conf.5 which fields may be infinite and how to specifify infinity.
eadler [Sun, 27 Oct 2013 04:59:18 +0000 (04:59 +0000)]
Mention in login.conf.5 which fields may be infinite and how to specifify infinity.
The number of ways to indicate this confuses people.

PR: docs/100196
Reported by: "Dr. Markus Waldeck" <waldeck@gmx.de>
Reported by: Jamie Landeg Jones <jamie.landeg.jones@gmail.com>

10 years agoAll man pages refer to FreeBSD so there is no need to mention "In .Fx"
eadler [Sun, 27 Oct 2013 04:49:40 +0000 (04:49 +0000)]
All man pages refer to FreeBSD so there is no need to mention "In .Fx"

10 years agoEliminate a compiler warning about extraneous parens.
ian [Sun, 27 Oct 2013 03:29:38 +0000 (03:29 +0000)]
Eliminate a compiler warning about extraneous parens.

10 years agoOops, one more instance of ARM_NOCACHE_KVA_SIZE was hiding under the couch.
ian [Sun, 27 Oct 2013 03:24:46 +0000 (03:24 +0000)]
Oops, one more instance of ARM_NOCACHE_KVA_SIZE was hiding under the couch.
This should have been cleaned up along with r257201.

10 years agoRetire arm_remap_nocache() and the data and constants associated with it.
ian [Sun, 27 Oct 2013 03:13:26 +0000 (03:13 +0000)]
Retire arm_remap_nocache() and the data and constants associated with it.

The only remaining user was the code that allocates bounce pages for armv4
busdma.  It's not clear why bounce pages would need uncached memory, but
if that ever changes, kmem_alloc_attr() would be the way to get it.

10 years agoRemove #include <machine/frame.h> from all the arm code that doesn't
ian [Sun, 27 Oct 2013 01:34:10 +0000 (01:34 +0000)]
Remove #include <machine/frame.h> from all the arm code that doesn't
really need it.  That would be almost everywhere it was included.  Add
it in a couple files that really do need it and were previously getting
it by accident via another header.

10 years agoRemove all #include <machine/pmap.h> from arm code. It's already
ian [Sun, 27 Oct 2013 00:51:46 +0000 (00:51 +0000)]
Remove all #include <machine/pmap.h> from arm code.  It's already
included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h
so there's no reason to ever include it directly.

Thanks to alc@ for pointing this out.

10 years agoFix build after r257162.
nwhitehorn [Sat, 26 Oct 2013 23:41:11 +0000 (23:41 +0000)]
Fix build after r257162.

10 years agoMaximize available kva space by doing static device mapping from the top
ian [Sat, 26 Oct 2013 23:13:20 +0000 (23:13 +0000)]
Maximize available kva space by doing static device mapping from the top
of the address space downwards, and then returning the lowest mapped
device address from initarm_lastaddr().  This adds over 500MB of kva
space compared to the old way of hardcoding the end address as 0xE0000000.

Also, pre-map most of the SoC's common memory-mapped devices using 1MB
section mappings so that all device access uses just a few TLB entries.
Graphics devices aren't mapped this way yet, but probably should be.

To provide this new functionality without pasting identical code into
multiple imxNN_machdep.c files, rework the imx machdep code so that
things common to the whole family of SoCs are in a new imx_machdep.c file.
The rewritten imxNN_machdep.c files contain just things specific to an
individual SoC.

10 years agoMake devices with registers into the KVA region work reliably. Without this,
nwhitehorn [Sat, 26 Oct 2013 20:57:26 +0000 (20:57 +0000)]
Make devices with registers into the KVA region work reliably. Without this,
previous KVA allocations (which the PMAP lazily invalidates) in TLB0 could
shadow device maps in TLB1. Add a big block comment about some of the
caveats with this approach.

10 years agoTry even harder to find a console before giving up.
nwhitehorn [Sat, 26 Oct 2013 20:06:50 +0000 (20:06 +0000)]
Try even harder to find a console before giving up.

10 years agoFix build with GCC.
bdrewery [Sat, 26 Oct 2013 19:59:42 +0000 (19:59 +0000)]
Fix build with GCC.

BIO_new_mem_buf takes a void* buf, but internally it never modifies the
buf. It assigns the buffer to another pointer and then marks it as
read-only. So deconsting it should be safe here.

Also fix warning about 'buf' possibly being unused in parse_cert()

Approved by: bapt
MFC after: 2 days
X-MFC-With: r257147

10 years agoHandle (in a slightly ugly way) ePAPR-type loaders that just place a
nwhitehorn [Sat, 26 Oct 2013 19:50:40 +0000 (19:50 +0000)]
Handle (in a slightly ugly way) ePAPR-type loaders that just place a
device tree into r3. Rather than worrying about mapping that tree, reserving
its space in the global physical memory space, etc., just copy it to some
memory after the kernel.

10 years agoBump initial TLB size. The kernel is not necessarily less than 16 MB any
nwhitehorn [Sat, 26 Oct 2013 19:49:09 +0000 (19:49 +0000)]
Bump initial TLB size. The kernel is not necessarily less than 16 MB any
more.

10 years agoFix an itt instruction. We need to execute both the mov and b instructions
andrew [Sat, 26 Oct 2013 19:09:56 +0000 (19:09 +0000)]
Fix an itt instruction. We need to execute both the mov and b instructions
when building for Thumb.