Commit Graph

1317 Commits

Author SHA1 Message Date
Ed Schouten
73dcd7db56 Import upstream changes to the system call definitions.
Support has been added for providing the scope of a futex operation,
whether the futex is local to the process or shared between processes.
2015-07-22 10:04:53 +00:00
Ed Schouten
6256e57ba9 Implement CloudABI memory management system calls.
Add support for the <sys/mman.h> functions by wrapping around our own
implementations. There are no kern_*() variants of these system calls,
but we also don't need them in this case. It is sufficient to just call
into the sys_*() functions.

Differential Revision:	https://reviews.freebsd.org/D3033
Reviewed by:		brooks
2015-07-17 09:00:38 +00:00
Ed Schouten
6e5fcd99df Add a sysentvec for CloudABI on x86-64.
Summary:
For CloudABI we need to put two things on the stack of new processes:
the argument data (a binary blob; not strings) and a startup data
structure. The startup data structure contains interesting things such
as a pointer to the ELF program header, the thread ID of the initial
thread, a stack smashing protection canary, and a pointer to the
argument data.

Fetching system call arguments and setting the return value is similar
to FreeBSD. The only differences are that system call 0 does not exist
and that we call into cloudabi_convert_errno() to convert the error
code. We also need this function in a couple of other places, so we'd
better reuse it here.

Reviewers: dchagin, kib

Reviewed By: kib

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D3098
2015-07-16 18:24:06 +00:00
Ed Schouten
6d338f9a81 Import the CloudABI datatypes and create a system call table.
CloudABI is a pure capability-based runtime environment for UNIX. It
works similar to Capsicum, except that processes already run in
capabilities mode on startup. All functionality that conflicts with this
model has been omitted, making it a compact binary interface that can be
supported by other operating systems without too much effort.

CloudABI is 'secure by default'; the idea is that it should be safe to
run arbitrary third-party binaries without requiring any explicit
hardware virtualization (Bhyve) or namespace virtualization (Jails). The
rights of an application are purely determined by the set of file
descriptors that you grant it on startup.

The datatypes and constants used by CloudABI's C library (cloudlibc) are
defined in separate files called syscalldefs_mi.h (pointer size
independent) and syscalldefs_md.h (pointer size dependent). We import
these files in sys/contrib/cloudabi and wrap around them in
cloudabi*_syscalldefs.h.

We then add stubs for all of the system calls in sys/compat/cloudabi or
sys/compat/cloudabi64, depending on whether the system call depends on
the pointer size. We only have nine system calls that depend on the
pointer size. If we ever want to support 32-bit binaries, we can simply
add sys/compat/cloudabi32 and implement these nine system calls again.

The next step is to send in code reviews for the individual system call
implementations, but also add a sysentvec, to allow CloudABI executabled
to be started through execve().

More information about CloudABI:
- GitHub: https://github.com/NuxiNL/cloudlibc
- Talk at BSDCan: https://www.youtube.com/watch?v=SVdF84x1EdA

Differential Revision:	https://reviews.freebsd.org/D2848
Reviewed by:	emaste, brooks
Obtained from:	https://github.com/NuxiNL/freebsd
2015-07-09 07:20:15 +00:00
Mariusz Zaborski
54f98da930 Move the nvlist source and private includes from sys/kern to seperate
directory sys/contrib/libnv.

The goal of this operation is to NOT install header files which shouldn't
be used outside the nvlist library.

Approved by:	pjd (mentor)
2015-07-04 16:33:37 +00:00
Adrian Chadd
3e307100f6 Quieten the scorpion SoC/WMAC reset path. Stuff the non-error stuff
under HALDEBUG().
2015-07-04 03:15:42 +00:00
Jung-uk Kim
5ef5072350 Merge ACPICA 20150619. 2015-06-18 23:14:45 +00:00
Jung-uk Kim
5836df80a2 MFV: r283965
- Update GUIDs for new NFIT tables.
- Fix ill-formed GUID strings for NFIT tables.
- Fix a possible fault when performing a UUID search.
2015-06-03 19:39:59 +00:00
Adrian Chadd
967e8d3778 Add support for the tuning cap for Hornet/AR9331 boards.
This dramatically improves RX sensitivity and behaviour on the
AR9331 hardware I have, including the Carambola 2.

Tested:

* AR9331, Carambola 2 board

Submitted by:	Zilvinas Valinskas <zilvinas.valinskas@gmail.com>
2015-05-23 08:02:54 +00:00
Jung-uk Kim
fd90e2ed54 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
2015-05-22 17:05:21 +00:00
Jung-uk Kim
a371a5fd85 Merge ACPICA 20150515. 2015-05-18 23:46:11 +00:00
Gleb Smirnoff
772e66a6fc Move ALTQ from contrib to net/altq. The ALTQ code is for many years
discontinued by its initial authors. In FreeBSD the code was already
slightly edited during the pf(4) SMP project. It is about to be edited
more in the projects/ifnet. Moving out of contrib also allows to remove
several hacks to the make glue.

Reviewed by:	net@
2015-04-16 20:22:40 +00:00
Xin LI
687a306f23 Sync with OpenBSD: Use volatile instead of __volatile__.
MFC after:	2 weeks
2015-04-13 20:23:46 +00:00
Jung-uk Kim
7cf3e94a41 Merge ACPICA 20150410. 2015-04-11 03:23:41 +00:00
Gleb Smirnoff
b7703ad432 In ipfilter(4) there is the ipftest(1) program, that compiles half of the
ipfilter code as userland application. To reduce kernel structure knowledge
include if_var.h only if a file is compiled with _KERNEL defined.
In !_KERNEL case, provide our own definition of struct ifnet, that will
satisfy ipftest(1). This was already done earlier to struct ifaddr in
r279029. Protect the definition with _NET_IF_VAR_H_, since kernel part
of ipfilter may include if_var.h and ip_compat.h.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-04-07 06:22:22 +00:00
Gleb Smirnoff
6d947416cc o Use new function ip_fillid() in all places throughout the kernel,
where we want to create a new IP datagram.
o Add support for RFC6864, which allows to set IP ID for atomic IP
  datagrams to any value, to improve performance. The behaviour is
  controlled by net.inet.ip.rfc6864 sysctl knob, which is enabled by
  default.
o In case if we generate IP ID, use counter(9) to improve performance.
o Gather all code related to IP ID into ip_id.c.

Differential Revision:		https://reviews.freebsd.org/D2177
Reviewed by:			adrian, cy, rpaulo
Tested by:			Emeric POUPON <emeric.poupon stormshield.eu>
Sponsored by:			Netflix
Sponsored by:			Nginx, Inc.
Relnotes:			yes
2015-04-01 22:26:39 +00:00
Adrian Chadd
d5c3e61afb Expose the ANI state / statistics using the public ANI function, rather than
the ar9300_* definitions.

.. which of course don't match, and athstats was reading garbage ANI
data.
2015-04-01 04:56:10 +00:00
Adrian Chadd
9778bf377b Add initial support for the HAL channel survey support to the AR9300 HAL.
This is used by the 'athsurvey' command to print out channel survey
statistics - % busy times transmit, receive and airtime.

It's as buggy and incomplete as the rest of the HAL survey support -
notably, tying into the ANI code to read channel stats and occasionally
getting garbage counters isn't very nice.  It also doesn't (yet!) get
channel survey information during a scan.  But it's good enough for
basic air-time debugging, which is why I'm committing it in this state.

Tested:

* AR9380, STA mode
2015-03-29 21:53:08 +00:00
Adrian Chadd
f5ab408ee9 Quieten some of the log spam from AR9300 sysctl tree walk and chip setup/reset
path.

* For now there's no exposed control over classic / LNA antenna diversity,
  so just stub them out.  Adding this will take quite a bit of time.

* Add a function to fetch the CTS timeout.

PR:		kern/198558
2015-03-21 23:12:46 +00:00
Andrew Turner
2fb34dae14 Use the dsb macro to use the correct instruction when building for ARMv7. 2015-03-19 11:34:51 +00:00
Jung-uk Kim
1c0e1b6da9 Merge ACPICA 20141107 and 20150204. 2015-02-18 20:33:00 +00:00
Hans Petter Selasky
b5c1e0cb8d Update the infiniband stack to Mellanox's OFED version 2.1.
Highlights:
 - Multiple verbs API updates
 - Support for RoCE, RDMA over ethernet

All hardware drivers depending on the common infiniband stack has been
updated aswell.

Discussed with:	np @
Sponsored by:	Mellanox Technologies
MFC after:	1 month
2015-02-17 08:40:27 +00:00
Adrian Chadd
b8871f0823 Add initial support to the AR9300 HAL to support FreeBSD's intmit API.
I don't like having it in this function; I may migrate it to ar9300_freebsd.c
at some point to keep the HAL code pollution down.

This allows ANI to be disabled via a sysctl.

Tested:

* AR9331, STA/TDMA modes
2015-02-15 21:15:09 +00:00
Adrian Chadd
caa918bd3b Add ath_hal_setbeacontimers() to the AR9300 HAL.
This is a custom FreeBSD HAL method that is used by the TDMA code
to program the beacon timers directly without any guesswork/assumptions
by the HAL.

This brings up basic TDMA master/slave support on the AR9380 HAL,
however there are other issues preventing it from being stable.
(I'm seeing beacon interval instability, which may be due to
busy 2GHz air, but also may be due to some HAL configuration
issues with regards to ANI, or hardware timer programming, etc.)

Tested:

* AR9331 (Carambola2), STA, AP, adhoc and TDMA master mode.
2015-02-15 19:56:31 +00:00
Adrian Chadd
3876533b14 Comment out a double declaration of this particular function name.
It trips up gcc builds.

Pointy-hat-from:	jenkins, kib
2015-02-14 17:44:24 +00:00
Adrian Chadd
cb2f5d5ddb Quieten a clang warning. 2015-02-14 17:43:54 +00:00
Adrian Chadd
06f874e1f9 Remove the reserved pin 11 from the HAL check.
The QCA9565 can have RFKILL on GPIO Pin 11, and thus we need to configure
it up correctly or the NIC may not function.

I'm not sure why the AR9382 can't use GPIO 8 / GPIO 11 ; it's likely
hooked up to some external LNA or filter.  The real solution is to
make it only block pin 8 / pin 11 for AR9382, but the AR9382 probes
like an AR9380.  Sigh.

Submitted by:	Anthony Jenkins <scoobi_doo@yahoo.com>
2015-02-14 16:23:04 +00:00
Adrian Chadd
899d1cacac Update the AR9300 HAL to the latest public available HAL from QCA.
I've been sitting on this for a year or so now; I've finally
tested it on enough devices to be reasonably sure it won't
cause too much drama.  But, if you see issues, please email me.

Tested (all STA mode):

PCIe:

* AR9380
* AR9390
* AR9580
* AR9462
* AR9485

SoC:

* QCA9550
* AR9331
* AR9342
2015-02-14 04:28:51 +00:00
Oleksandr Tymoshenko
e6c4672e82 Fix build without INVARIANTS/INVARIANT_SUPPORT:
- Replace "emulation" of return in lmutex_lock_interruptible macros by
    proper static/inline function.

Submitted by:	Guy Yur
2015-02-13 02:10:09 +00:00
Oleksandr Tymoshenko
b5d689899d - Perform bus_dmamap_sync on pagelist structure
- Wire pages of bulk transfer buffer when preparing pagelist
2015-02-12 04:31:17 +00:00
Kevin Lo
6fc44dab19 Add preliminary support for the Ralink RT5390 and RT5392 chipsets.
Committed over the D-Link DWA-525 rev A2 on amd64 with WPA.
2015-02-11 05:25:23 +00:00
Konstantin Belousov
4c918926cd Add x2APIC support. Enable it by default if CPU is capable. The
hw.x2apic_enable tunable allows disabling it from the loader prompt.

To closely repeat effects of the uncached memory ops when accessing
registers in the xAPIC mode, the x2APIC writes to MSRs are preceeded
by mfence, except for the EOI notifications.  This is probably too
strict, only ICR writes to send IPI require serialization to ensure
that other CPUs see the previous actions when IPI is delivered.  This
may be changed later.

In vmm justreturn IPI handler, call doreti_iret instead of doing iretd
inline, to handle corner conditions.

Note that the patch only switches LAPICs into x2APIC mode. It does not
enables FreeBSD to support > 255 CPUs, which requires parsing x2APIC
MADT entries and doing interrupts remapping, but is the required step
on the way.

Reviewed by:	neel
Tested by:	pho (real hardware), neel (on bhyve)
Discussed with:	jhb, grehan
Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
2015-02-09 21:00:56 +00:00
Oleksandr Tymoshenko
10e99e6057 Do not mark shared structures as __packed, it leads to race condition
If structure packed as __packed clang (and probably gcc) generates
code that loads word fields (e.g. tx_pos)  byte-by-byte and if it's
modified by VideoCore in the same time as ARM loads the value result
is going to be mixed combination of bytes from previous value and
new one.
2015-02-09 02:31:27 +00:00
Oleksandr Tymoshenko
e6bf0bdb36 Remove unused variables 2015-02-09 02:27:33 +00:00
Oleksandr Tymoshenko
4676e354fd Act as a bus in attach method: probe and attach devices 2015-02-08 01:12:23 +00:00
Dimitry Andric
772400696c Fix a number of -Wcast-qual warnings in ath's ar9300_attach.c, by making
the ia_array field of struct ar9300_ini_array const, and removing the
const-dropping casts.  No functional change.

Reviewed by:	adrian
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D1725
2015-02-07 12:20:33 +00:00
Oleksandr Tymoshenko
262f27b29e Import VCHI driver for Broadcom's VideoCore IV GPU
Differential Revision:	D1753
2015-02-05 19:54:03 +00:00
Hans Petter Selasky
d39d7c8636 Add missing linuxapi module dependencies and always use the FreeBSD
"MODULE_VERSION" macro definition. Remove the redefinition of the
"MODULE_VERSION" macro from the Linux kernel compatibility API.

MFC after:	1 month
Reported by:	np@
Sponsored by:	Mellanox Technologies
2015-01-19 21:53:00 +00:00
Adrian Chadd
6ae52b27b6 Oops - use the correct argument order for ar9300_set_beacon().
(It's only an issue in AP/adhoc modes. But, still. Grr.)
2015-01-18 17:43:00 +00:00
Adrian Chadd
f590185223 Correct the descriptor length for AR9462/AR9565 and set the final field
to zero - TX drops are otherwise reported.

Tested:

* AR9462 (WB222), STA mode

Obtained from:	Linux ath9k
2015-01-17 17:37:08 +00:00
Adrian Chadd
091855cd9e Skip the OFDM weak signal threshold detection programming for
AR9462/AR9565.

This and some upcoming changes to the HAL for these chips should
address some of the signal sensitivity reported by users.

Tested:

* AR9462 (WB222), STA mode

Obtained from:	Linux ath9k
2015-01-17 17:31:47 +00:00
Adrian Chadd
e5acc52d45 Override the bt enable/disable methods for AR9462 (jupiter) and
AR9565 (Aphrodite.)  These need to use the MCI routines, not
the legacy 2-wire / 3-wire bluetooth coexistence methods.

Tested:

* AR9462 (WB222); STA mode
2015-01-17 06:43:30 +00:00
Adrian Chadd
38878c6343 Tie in the MCI bluetooth coexistence functions into the HAL.
Tested:

* AR9462 (WB222)
2015-01-16 23:48:28 +00:00
Robert Watson
2a8c860fe3 In order to reduce use of M_EXT outside of the mbuf allocator and
socket-buffer implementations, introduce a return value for MCLGET()
(and m_cljget() that underlies it) to allow the caller to avoid testing
M_EXT itself.  Update all callers to use the return value.

With this change, very few network device drivers remain aware of
M_EXT; the primary exceptions lie in mbuf-chain pretty printers for
debugging, and in a few cases, custom mbuf and cluster allocation
implementations.

NB: This is a difficult-to-test change as it touches many drivers for
which I don't have physical devices.  Instead we've gone for intensive
review, but further post-commit review would definitely be appreciated
to spot errors where changes could not easily be made mechanically,
but were largely mechanical in nature.

Differential Revision:	https://reviews.freebsd.org/D1440
Reviewed by:	adrian, bz, gnn
Sponsored by:	EMC / Isilon Storage Division
2015-01-06 12:59:37 +00:00
Adrian Chadd
bc6ee3cc93 Glue to suck in the QCA9550 HAL support if AH_SUPPORT_QCA9550 is defined. 2015-01-06 07:52:19 +00:00
Marius Strobl
182600f180 Use the same 6000 series g2{a,b} firmware versions when embedding these
images into the kernel as currently included into iwn6000g2{a,b}fw.ko
and delete the old files, missed in r254199 and r259135 respectively.

MFC after:	3 days
2014-12-27 17:10:35 +00:00
Cy Schubert
006e24e909 Correctly define constants.
MFC after:	1 week
2014-11-28 04:07:06 +00:00
Kevin Lo
f386f04f11 Add missing headers needed by write(). 2014-11-25 02:58:38 +00:00
Craig Rodrigues
f687a7c2dd Set the current vnet inside the ioctl handler for ipfilter.
Without this fix, the vnet was NULL and would crash.
This fix is similar to what was done inside the ioctl handler for PF.

Tested by:
   (1) Boot a kernel with "options VIMAGE" enabled
   (2) Type:

   echo "map lo0 from 10.0.0.0/24 to ! 10.0.0.0/24 -> 127.0.0.1/32" > /etc/ipnat.rules ; service ipnat onerestart

PR: 176992
Differential Revision: https://reviews.freebsd.org/D1191
Reviewed by: cy
2014-11-20 08:11:54 +00:00
Dimitry Andric
cfd2f3f928 Fix the following -Werror warning from clang 3.5.0, while building
lib/libngatm:

sys/contrib/ngatm/netnatm/saal/saal_sscop.c:4030:32: error: 'break' is bound to current loop, GCC binds it to the enclosing loop [-Werror,-Wgcc-compat]
                } while(sn < sscop->vr_h && !QFIND(&sscop->rbuf, sn));
                                             ^
sys/contrib/ngatm/netnatm/saal/saal_sscop.c:173:4: note: expanded from macro 'QFIND'
                        break;                                          \
                        ^
1 error generated.

The idea is to remove any ambiguity by replacing the macro with an
equivalent static inline function.

Reviewed by:	emaste, rpaulo
See also:	http://reviews.llvm.org/D2518
Differential Revision: https://reviews.freebsd.org/D1188
2014-11-19 07:47:37 +00:00