Merge ^/head r304236 through r304536.

This commit is contained in:
Dimitry Andric 2016-08-20 18:52:03 +00:00
commit 65e1b13807
339 changed files with 161495 additions and 174463 deletions

View File

@ -38,6 +38,20 @@
# xargs -n1 | sort | uniq -d;
# done
# 20160819: Remove ie(4)
OLD_FILES+=usr/share/man/man4/i386/ie.4.gz
# 20160819: Remove spic(4)
OLD_FILES+=usr/share/man/man4/spic.4.gz
# 20160819: Remove wl(4) and wlconfig(8)
OLD_FILES+=usr/share/man/man4/i386/wl.4.gz
OLD_FILES+=usr/sbin/wlconfig
OLD_FILES+=usr/share/man/man8/i386/wlconfig.8.gz
# 20160819: Remove si(4) and sicontrol(8)
OLD_FILES+=usr/share/man/man4/si.4.gz
OLD_FILES+=usr/sbin/sicontrol
OLD_FILES+=usr/share/man/man8/sicontrol.8.gz
# 20160819: Remove scd(4)
OLD_FILES+=usr/share/man/man4/scd.4.gz
# 20160815: Remove mcd(4)
OLD_FILES+=usr/share/man/man4/mcd.4.gz
# 20160703: POSIXify locales with variants

View File

@ -31,6 +31,18 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20160818:
The UDP receive code has been updated to only treat incoming UDP
packets that were addressed to an L2 broadcast address as L3
broadcast packets. It is not expected that this will affect any
standards-conforming UDP application. The new behaviour can be
disabled by setting the sysctl net.inet.udp.require_l2_bcast to
0.
20160818:
Remove the openbsd_poll system call.
__FreeBSD_version has been bumped because of this.
20160622:
The libc stub for the pipe(2) system call has been replaced with
a wrapper that calls the pipe2(2) system call and the pipe(2)

View File

@ -93,6 +93,9 @@ static int g_flowindent;
static int g_intr;
static int g_impatient;
static int g_newline;
#ifdef __FreeBSD__
static int g_siginfo;
#endif
static int g_total;
static int g_cflags;
static int g_oflags;
@ -1260,6 +1263,16 @@ intr(int signo)
g_impatient = 1;
}
#ifdef __FreeBSD__
static void
siginfo(int signo __unused)
{
g_siginfo++;
g_newline = 1;
}
#endif
static void
installsighands(void)
{
@ -1275,12 +1288,16 @@ installsighands(void)
if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGTERM, &act, NULL);
#ifndef illumos
#ifdef __FreeBSD__
if (sigaction(SIGPIPE, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGPIPE, &act, NULL);
if (sigaction(SIGUSR1, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGUSR1, &act, NULL);
act.sa_handler = siginfo;
if (sigaction(SIGINFO, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGINFO, &act, NULL);
#endif
}
@ -1944,6 +1961,13 @@ main(int argc, char *argv[])
if (!g_intr && !done)
dtrace_sleep(g_dtp);
#ifdef __FreeBSD__
if (g_siginfo) {
(void)dtrace_aggregate_print(g_dtp, g_ofp, NULL);
g_siginfo = 0;
}
#endif
if (g_newline) {
/*
* Output a newline just to make the output look

View File

@ -1630,12 +1630,17 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
assert(cl_idx < nvl_len);
/*
* We don't want to unmount & remount the dataset when changing
* its canmount property to 'on' or 'noauto'. We only use
* the changelist logic to unmount when setting canmount=off.
* its canmount property. We only use the changelist logic to
* unmount when setting canmount=off for a mounted filesystem
* or when setting canmount=on for an unmounted filesystem.
* For all other changes to canmount property the filesystem
* remains the same.
*/
if (prop != ZFS_PROP_CANMOUNT ||
(fnvpair_value_uint64(elem) == ZFS_CANMOUNT_OFF &&
zfs_is_mounted(zhp, NULL))) {
zfs_is_mounted(zhp, NULL)) ||
(fnvpair_value_uint64(elem) == ZFS_CANMOUNT_ON &&
!zfs_is_mounted(zhp, NULL))) {
cls[cl_idx] = changelist_gather(zhp, prop, 0, 0);
if (cls[cl_idx] == NULL)
goto error;

View File

@ -1 +1 @@
v0.10
v0.11

View File

@ -142,7 +142,7 @@ main(int argc, char **argv)
logfail(EX_CANTCREAT, "cannot build mbox path for `%s/%s'", _PATH_MAILDIR, user);
}
f = open(fn, O_RDONLY|O_CREAT, 0600);
f = open(fn, O_RDONLY|O_CREAT|O_NOFOLLOW, 0600);
if (f < 0)
logfail(EX_NOINPUT, "cannt open mbox `%s'", fn);

View File

@ -321,7 +321,7 @@ deliver(struct qitem *it)
snprintf(errmsg, sizeof(errmsg), "unknown bounce reason");
retry:
syslog(LOG_INFO, "trying delivery");
syslog(LOG_INFO, "<%s> trying delivery", it->addr);
if (it->remote)
error = deliver_remote(it);
@ -331,7 +331,7 @@ deliver(struct qitem *it)
switch (error) {
case 0:
delqueue(it);
syslog(LOG_INFO, "delivery successful");
syslog(LOG_INFO, "<%s> delivery successful", it->addr);
exit(EX_OK);
case 1:

View File

@ -49,7 +49,7 @@
#define VERSION "DragonFly Mail Agent " DMA_VERSION
#define BUF_SIZE 2048
#define ERRMSG_SIZE 200
#define ERRMSG_SIZE 1024
#define USERNAME_SIZE 50
#define MIN_RETRY 300 /* 5 minutes */
#define MAX_RETRY (3*60*60) /* retry at least every 3 hours */

View File

@ -34,6 +34,7 @@
*/
#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>

View File

@ -196,7 +196,7 @@ deliver_local(struct qitem *it)
goto out;
}
error = snprintf(line, sizeof(line), "%sFrom %s\t%s", newline, sender, ctime(&now));
error = snprintf(line, sizeof(line), "%sFrom %s %s", newline, sender, ctime(&now));
if (error < 0 || (size_t)error >= sizeof(line)) {
syslog(LOG_NOTICE, "local delivery deferred: can not write header: %m");
goto out;

View File

@ -372,11 +372,13 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
host->host, host->addr, c, neterr); \
snprintf(errmsg, sizeof(errmsg), "%s [%s] did not like our %s:\n%s", \
host->host, host->addr, c, neterr); \
return (-1); \
error = -1; \
goto out; \
} else if (res != exp) { \
syslog(LOG_NOTICE, "remote delivery deferred: %s [%s] failed after %s: %s", \
host->host, host->addr, c, neterr); \
return (1); \
error = 1; \
goto out; \
}
/* Check first reply from remote host */
@ -426,7 +428,8 @@ deliver_to_host(struct qitem *it, struct mx_hostentry *host)
syslog(LOG_ERR, "remote delivery failed:"
" SMTP login failed: %m");
snprintf(errmsg, sizeof(errmsg), "SMTP login to %s failed", host->host);
return (-1);
error = -1;
goto out;
}
/* SMTP login is not available, so try without */
else if (error > 0) {

View File

@ -19,8 +19,8 @@ options {
# Setup some shorthand for regex that we use later in the file.
#XXX Yes, these are gross -- imp
set scsi-controller-regex
"(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|\
esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)\
"(aac|adv|adw|aha|ahb|ahc|ahd|aic|amr|bt|ciss|ct|dpt|\
esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm)\
[0-9]+";
set wifi-driver-regex
"(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rum|run|uath|\

View File

@ -1,3 +1,3 @@
/* $FreeBSD$ */
#define FREEBSD_CC_VERSION 1200000
#define FREEBSD_CC_VERSION 1200002

View File

@ -110,6 +110,9 @@ NOASM=
${LIBC_ARCH} == "mips"
.include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
.endif
.if ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "amd64"
.include "${LIBC_SRCTOP}/x86/sys/Makefile.inc"
.endif
.if ${MK_NIS} != "no"
CFLAGS+= -DYP
.include "${LIBC_SRCTOP}/yp/Makefile.inc"

View File

@ -15,7 +15,6 @@ MDASM= cerror.S \
NOASM= break.o \
exit.o \
getlogin.o \
openbsd_poll.o \
sbrk.o \
sstk.o \
vfork.o \

View File

@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <sys/vdso.h>
#include <machine/cpufunc.h>
#include <errno.h>
#include "libc_private.h"
static inline uint64_t
@ -55,14 +56,15 @@ cp15_cntpct_get(void)
}
#pragma weak __vdso_gettc
u_int
__vdso_gettc(const struct vdso_timehands *th)
int
__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
{
uint64_t val;
if (th->th_algo != VDSO_TH_ALGO_ARM_GENTIM)
return (ENOSYS);
__asm __volatile("isb" : : : "memory");
val = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get();
return (val);
*tc = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get();
return (0);
}
#pragma weak __vdso_gettimekeep

View File

@ -2,12 +2,12 @@
# $FreeBSD$
SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
amd64_set_gsbase.c __vdso_gettc.c
amd64_set_gsbase.c
MDASM= vfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
sbrk.S setlogin.S sigreturn.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
PSEUDO= _getlogin.o _exit.o

View File

@ -1,70 +0,0 @@
/*-
* Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/elf.h>
#include <sys/time.h>
#include <sys/vdso.h>
#include <machine/cpufunc.h>
#include "libc_private.h"
static u_int
__vdso_gettc_low(const struct vdso_timehands *th)
{
u_int rv;
__asm __volatile("lfence; rdtsc; shrd %%cl, %%edx, %0"
: "=a" (rv) : "c" (th->th_x86_shift) : "edx");
return (rv);
}
static u_int
__vdso_rdtsc32(void)
{
u_int rv;
__asm __volatile("lfence;rdtsc" : "=a" (rv) : : "edx");
return (rv);
}
#pragma weak __vdso_gettc
u_int
__vdso_gettc(const struct vdso_timehands *th)
{
return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) :
__vdso_rdtsc32());
}
#pragma weak __vdso_gettimekeep
int
__vdso_gettimekeep(struct vdso_timekeep **tk)
{
return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk)));
}

View File

@ -5,6 +5,6 @@ SRCS+= __vdso_gettc.c
MDASM= Ovfork.S brk.S cerror.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
PSEUDO= _exit.o _getlogin.o

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/vdso.h>
#include <machine/cpufunc.h>
#include <machine/acle-compat.h>
#include <errno.h>
#include "libc_private.h"
#if __ARM_ARCH >= 6
@ -58,11 +59,12 @@ cp15_cntpct_get(void)
#endif
#pragma weak __vdso_gettc
u_int
__vdso_gettc(const struct vdso_timehands *th)
int
__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
{
uint64_t val;
if (th->th_algo != VDSO_TH_ALGO_ARM_GENTIM)
return (ENOSYS);
#if __ARM_ARCH >= 6
/*
* Userspace gettimeofday() is only enabled on ARMv7 CPUs, but
@ -70,11 +72,12 @@ __vdso_gettc(const struct vdso_timehands *th)
* armv7-a directive does not work.
*/
__asm __volatile(".word\t0xf57ff06f" : : : "memory"); /* isb */
val = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get();
*tc = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get();
return (0);
#else
val = 0;
*tc = 0;
return (ENOSYS);
#endif
return (val);
}
#pragma weak __vdso_gettimekeep

View File

@ -34,18 +34,18 @@
.\"
.\" $FreeBSD$
.\"
.Dd March 3, 2008
.Dd August 17, 2016
.Dt SEM_TIMEDWAIT 3
.Os
.Sh NAME
.Nm sem_timedwait
.Nd "lock a semaphore"
.Sh LIBRARY
.Lb libpthread
.Lb libc
.Sh SYNOPSIS
.In semaphore.h
.Ft int
.Fn sem_timedwait "sem_t *sem" "const struct timespec *abs_timeout"
.Fn sem_timedwait "sem_t * restrict sem" "const struct timespec * restrict abs_timeout"
.Sh DESCRIPTION
The
.Fn sem_timedwait

View File

@ -5,14 +5,13 @@
SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c
.endif
SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \
__vdso_gettc.c
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c
MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S ptrace.S \
sbrk.S setlogin.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
PSEUDO= _getlogin.o _exit.o

View File

@ -6,6 +6,6 @@ MDASM= Ovfork.S brk.S cerror.S exect.S \
ptrace.S sbrk.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
NOASM= break.o exit.o getlogin.o sstk.o vfork.o yield.o
PSEUDO= _exit.o _getlogin.o

View File

@ -32,7 +32,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 26, 2006
.Dd August 18, 2016
.Dt INET_NET 3
.Os
.Sh NAME
@ -42,7 +42,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.In netinet/in.h
.In arpa/inet.h

View File

@ -3,6 +3,6 @@
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o
NOASM= break.o exit.o getlogin.o sstk.o yield.o
PSEUDO= _getlogin.o _exit.o

View File

@ -3,6 +3,6 @@
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o
NOASM= break.o exit.o getlogin.o sstk.o yield.o
PSEUDO= _getlogin.o _exit.o

View File

@ -13,7 +13,6 @@ MDASM= cerror.S \
NOASM= break.o \
exit.o \
getlogin.o \
openbsd_poll.o \
sbrk.o \
sstk.o \
vfork.o \

View File

@ -15,6 +15,6 @@ CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu
MDASM+= brk.S cerror.S exect.S ptrace.S sbrk.S setlogin.S sigaction1.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o yield.o
NOASM= break.o exit.o getlogin.o sstk.o yield.o
PSEUDO= _getlogin.o _exit.o

View File

@ -366,6 +366,7 @@ MLINKS+=ffclock.2 ffclock_getcounter.2 \
ffclock.2 ffclock_getestimate.2 \
ffclock.2 ffclock_setestimate.2
MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
MLINKS+=fsync.2 fdatasync.2
MLINKS+=getdirentries.2 getdents.2
MLINKS+=getfh.2 lgetfh.2
MLINKS+=getgid.2 getegid.2

View File

@ -34,9 +34,7 @@ FBSD_1.0 {
__setugid;
__syscall;
__sysctl;
_umtx_lock;
_umtx_op;
_umtx_unlock;
abort2;
accept;
access;
@ -459,12 +457,8 @@ FBSDprivate_1.0 {
__sys___syscall;
___sysctl;
__sys___sysctl;
__umtx_lock;
__sys__umtx_lock;
__umtx_op;
__sys__umtx_op;
__umtx_unlock;
__sys__umtx_unlock;
_abort2;
__sys_abort2;
_accept;

View File

@ -34,12 +34,16 @@ __FBSDID("$FreeBSD$");
#include <machine/atomic.h>
#include "libc_private.h"
static u_int
tc_delta(const struct vdso_timehands *th)
static int
tc_delta(const struct vdso_timehands *th, u_int *delta)
{
int error;
u_int tc;
return ((__vdso_gettc(th) - th->th_offset_count) &
th->th_counter_mask);
error = __vdso_gettc(th, &tc);
if (error == 0)
*delta = (tc - th->th_offset_count) & th->th_counter_mask;
return (error);
}
/*
@ -56,6 +60,8 @@ binuptime(struct bintime *bt, struct vdso_timekeep *tk, int abs)
{
struct vdso_timehands *th;
uint32_t curr, gen;
u_int delta;
int error;
do {
if (!tk->tk_enabled)
@ -63,11 +69,14 @@ binuptime(struct bintime *bt, struct vdso_timekeep *tk, int abs)
curr = atomic_load_acq_32(&tk->tk_current);
th = &tk->tk_th[curr];
if (th->th_algo != VDSO_TH_ALGO_1)
return (ENOSYS);
gen = atomic_load_acq_32(&th->th_gen);
*bt = th->th_offset;
bintime_addx(bt, th->th_scale * tc_delta(th));
error = tc_delta(th, &delta);
if (error == EAGAIN)
continue;
if (error != 0)
return (error);
bintime_addx(bt, th->th_scale * delta);
if (abs)
bintime_add(bt, &th->th_boottime);

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 21, 2016
.Dd August 19, 2016
.Dt AIO_FSYNC 2
.Os
.Sh NAME
@ -74,16 +74,14 @@ the call returns without having enqueued the request.
.Pp
The
.Fa iocb->aio_sigevent
structure can be used to request notification of the request's
structure can be used to request notification of the operation's
completion as described in
.Xr aio 4 .
.Sh RESTRICTIONS
The asynchronous I/O Control Block structure pointed to by
The Asynchronous I/O Control Block structure pointed to by
.Fa iocb
must remain valid until the
operation has completed.
For this reason, use of auto (stack) variables
for these objects is discouraged.
.Pp
The asynchronous I/O control buffer
.Fa iocb
@ -91,9 +89,8 @@ should be zeroed before the
.Fn aio_fsync
call to avoid passing bogus context information to the kernel.
.Pp
Modifications of the Asynchronous I/O Control Block structure or the
buffer contents after the request has been enqueued, but before the
request has completed, are not allowed.
Modification of the Asynchronous I/O Control Block structure is not allowed
while the request is queued.
.Sh RETURN VALUES
.Rv -std aio_fsync
.Sh ERRORS

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 21, 2016
.Dd August 19, 2016
.Dt AIO_MLOCK 2
.Os
.Sh NAME
@ -67,7 +67,7 @@ then the call returns without having enqueued the request.
.Pp
The
.Fa iocb->aio_sigevent
structure can be used to request notification of the request's
structure can be used to request notification of the operation's
completion as described in
.Xr aio 4 .
.Sh RESTRICTIONS
@ -77,8 +77,6 @@ and the buffer that the
.Fa iocb->aio_buf
member of that structure references must remain valid until the
operation has completed.
For this reason, use of auto (stack) variables
for these objects is discouraged.
.Pp
The asynchronous I/O control buffer
.Fa iocb
@ -87,8 +85,8 @@ should be zeroed before the
call to avoid passing bogus context information to the kernel.
.Pp
Modifications of the Asynchronous I/O Control Block structure or the
buffer contents after the request has been enqueued, but before the
request has completed, are not allowed.
memory mapping described by the virtual address range are not allowed
while the request is queued.
.Sh RETURN VALUES
.Rv -std aio_mlock
.Sh ERRORS

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 21, 2016
.Dd August 19, 2016
.Dt AIO_READ 2
.Os
.Sh NAME
@ -82,7 +82,7 @@ not be referenced after the request is enqueued.
.Pp
The
.Fa iocb->aio_sigevent
structure can be used to request notification of the request's
structure can be used to request notification of the operation's
completion as described in
.Xr aio 4 .
.Sh RESTRICTIONS
@ -92,8 +92,6 @@ and the buffer that the
.Fa iocb->aio_buf
member of that structure references must remain valid until the
operation has completed.
For this reason, use of auto (stack) variables
for these objects is discouraged.
.Pp
The asynchronous I/O control buffer
.Fa iocb
@ -102,8 +100,7 @@ should be zeroed before the
call to avoid passing bogus context information to the kernel.
.Pp
Modifications of the Asynchronous I/O Control Block structure or the
buffer contents after the request has been enqueued, but before the
request has completed, are not allowed.
buffer contents are not allowed while the request is queued.
.Pp
If the file offset in
.Fa iocb->aio_offset

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 21, 2016
.Dd August 19, 2016
.Dt AIO_WRITE 2
.Os
.Sh NAME
@ -88,7 +88,7 @@ be referenced after the request is enqueued.
.Pp
The
.Fa iocb->aio_sigevent
structure can be used to request notification of the request's
structure can be used to request notification of the operation's
completion as described in
.Xr aio 4 .
.Sh RESTRICTIONS
@ -98,8 +98,6 @@ and the buffer that the
.Fa iocb->aio_buf
member of that structure references must remain valid until the
operation has completed.
For this reason, use of auto (stack) variables
for these objects is discouraged.
.Pp
The asynchronous I/O control buffer
.Fa iocb
@ -108,8 +106,7 @@ should be zeroed before the
system call to avoid passing bogus context information to the kernel.
.Pp
Modifications of the Asynchronous I/O Control Block structure or the
buffer contents after the request has been enqueued, but before the
request has completed, are not allowed.
buffer contents are not allowed while the request is queued.
.Pp
If the file offset in
.Fa iocb->aio_offset

View File

@ -28,7 +28,7 @@
.\" @(#)bind.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd June 26, 2014
.Dd August 18, 2016
.Dt BIND 2
.Os
.Sh NAME
@ -37,7 +37,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.Ft int
.Fn bind "int s" "const struct sockaddr *addr" "socklen_t addrlen"

View File

@ -28,7 +28,7 @@
.\" @(#)connect.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd February 4, 2016
.Dd August 18, 2016
.Dt CONNECT 2
.Os
.Sh NAME
@ -37,7 +37,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.Ft int
.Fn connect "int s" "const struct sockaddr *name" "socklen_t namelen"

View File

@ -1,5 +1,11 @@
.\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved.
.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Parts of this documentation were written by
.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
.\" from the FreeBSD Foundation.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@ -28,40 +34,65 @@
.\" @(#)fsync.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd June 4, 1993
.Dd August 17, 2016
.Dt FSYNC 2
.Os
.Sh NAME
.Nm fsync
.Nm fdatasync, fsync
.Nd "synchronise changes to a file"
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In unistd.h
.Ft int
.Fn fdatasync "int fd"
.Ft int
.Fn fsync "int fd"
.Sh DESCRIPTION
The
.Fn fsync
system call
causes all modified data and attributes of
causes all modified data and attributes of the file referenced by
the file descriptor
.Fa fd
to be moved to a permanent storage device.
This normally results in all in-core modified copies
of buffers for the associated file to be written to a disk.
.Pp
The
.Fn fdatasync
system call causes all modified data of
.Fa fd
to be moved to a permanent storage device.
Unlike
.Fn fsync ,
the system call does not guarantee that file attributes or
metadata necessary to access the file are committed to the permanent storage.
.Pp
The
.Fn fsync
system call
should be used by programs that require a file to be
in a known state, for example, in building a simple transaction
facility.
If the file metadata has already been committed, using
.Fn fdatasync
can be more efficient than
.Fn fsync .
.Pp
Both
.Fn fdatasync
and
.Fn fsync
calls are cancellation points.
.Sh RETURN VALUES
.Rv -std fsync
.Sh ERRORS
The
.Fn fsync
fails if:
and
.Fn fdatasync
calls fail if:
.Bl -tag -width Er
.It Bq Er EBADF
The
@ -85,3 +116,15 @@ The
.Fn fsync
system call appeared in
.Bx 4.2 .
The
.Fn fdatasync
system call appeared in
.Fx 12.0
.Sh BUGS
The
.Fn fdatasync
system call currently does not guarantee that enqueued
.Xr aio 4
requests for the file referenced by
.Fa fd
are completed before the syscall returns.

View File

@ -28,7 +28,7 @@
.\" From: @(#)listen.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
.Dd July 15, 2014
.Dd August 18, 2016
.Dt LISTEN 2
.Os
.Sh NAME
@ -37,7 +37,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.Ft int
.Fn listen "int s" "int backlog"

View File

@ -28,7 +28,7 @@
.\" @(#)recv.2 8.3 (Berkeley) 2/21/94
.\" $FreeBSD$
.\"
.Dd January 29, 2016
.Dd August 18, 2016
.Dt RECV 2
.Os
.Sh NAME
@ -40,7 +40,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.Ft ssize_t
.Fn recv "int s" "void *buf" "size_t len" "int flags"

View File

@ -28,7 +28,7 @@
.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
.\" $FreeBSD$
.\"
.Dd January 29, 2016
.Dd August 18, 2016
.Dt SEND 2
.Os
.Sh NAME
@ -40,7 +40,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.Ft ssize_t
.Fn send "int s" "const void *msg" "size_t len" "int flags"

View File

@ -28,7 +28,7 @@
.\" From: @(#)socket.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd March 19, 2013
.Dd August 18, 2016
.Dt SOCKET 2
.Os
.Sh NAME
@ -37,7 +37,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/socket.h
.Ft int
.Fn socket "int domain" "int type" "int protocol"

View File

@ -32,11 +32,11 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#pragma weak __vdso_gettc
u_int
__vdso_gettc(const struct vdso_timehands *th)
int
__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
{
return (0);
return (ENOSYS);
}
#pragma weak __vdso_gettimekeep

View File

@ -0,0 +1,6 @@
# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/x86/sys
SRCS+= \
__vdso_gettc.c

View File

@ -1,5 +1,10 @@
/*-
* Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
* Copyright (c) 2016 The FreeBSD Foundation
* All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -26,19 +31,27 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/param.h>
#include "namespace.h"
#include <sys/elf.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/vdso.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "un-namespace.h"
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
#include <dev/acpica/acpi_hpet.h>
#include "libc_private.h"
static int lfence_works = -1;
static int
get_lfence_usage(void)
static void
lfence_mb(void)
{
#if defined(__i386__)
static int lfence_works = -1;
u_int cpuid_supported, p[4];
if (lfence_works == -1) {
@ -57,7 +70,7 @@ get_lfence_usage(void)
" jmp 2f\n"
"1: movl $0,%0\n"
"2:\n"
: "=r" (cpuid_supported) : : "eax", "ecx");
: "=r" (cpuid_supported) : : "eax", "ecx", "cc");
if (cpuid_supported) {
__asm __volatile(
" pushl %%ebx\n"
@ -70,16 +83,21 @@ get_lfence_usage(void)
} else
lfence_works = 0;
}
return (lfence_works);
if (lfence_works == 1)
lfence();
#elif defined(__amd64__)
lfence();
#else
#error "arch"
#endif
}
static u_int
__vdso_gettc_low(const struct vdso_timehands *th)
__vdso_gettc_rdtsc_low(const struct vdso_timehands *th)
{
u_int rv;
if (get_lfence_usage() == 1)
lfence();
lfence_mb();
__asm __volatile("rdtsc; shrd %%cl, %%edx, %0"
: "=a" (rv) : "c" (th->th_x86_shift) : "edx");
return (rv);
@ -88,21 +106,68 @@ __vdso_gettc_low(const struct vdso_timehands *th)
static u_int
__vdso_rdtsc32(void)
{
u_int rv;
if (get_lfence_usage() == 1)
lfence();
rv = rdtsc32();
return (rv);
lfence_mb();
return (rdtsc32());
}
static char *hpet_dev_map = NULL;
static uint32_t hpet_idx = 0xffffffff;
static void
__vdso_init_hpet(uint32_t u)
{
static const char devprefix[] = "/dev/hpet";
char devname[64], *c, *c1, t;
int fd;
c1 = c = stpcpy(devname, devprefix);
u = hpet_idx;
do {
*c++ = u % 10 + '0';
u /= 10;
} while (u != 0);
*c = '\0';
for (c--; c1 != c; c1++, c--) {
t = *c1;
*c1 = *c;
*c = t;
}
fd = _open(devname, O_RDONLY);
if (fd == -1) {
hpet_dev_map = MAP_FAILED;
return;
}
if (hpet_dev_map != NULL && hpet_dev_map != MAP_FAILED)
munmap(hpet_dev_map, PAGE_SIZE);
hpet_dev_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0);
_close(fd);
}
#pragma weak __vdso_gettc
u_int
__vdso_gettc(const struct vdso_timehands *th)
int
__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
{
uint32_t tmp;
return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) :
__vdso_rdtsc32());
switch (th->th_algo) {
case VDSO_TH_ALGO_X86_TSC:
*tc = th->th_x86_shift > 0 ? __vdso_gettc_rdtsc_low(th) :
__vdso_rdtsc32();
return (0);
case VDSO_TH_ALGO_X86_HPET:
tmp = th->th_x86_hpet_idx;
if (hpet_dev_map == NULL || tmp != hpet_idx) {
hpet_idx = tmp;
__vdso_init_hpet(hpet_idx);
}
if (hpet_dev_map == MAP_FAILED)
return (ENOSYS);
*tc = *(volatile uint32_t *)(hpet_dev_map + HPET_MAIN_COUNTER);
return (0);
default:
return (ENOSYS);
}
}
#pragma weak __vdso_gettimekeep

View File

@ -7,7 +7,7 @@ DMA_SOURCES= ${.CURDIR}/../../../contrib/dma
CFLAGS+= -I${DMA_SOURCES} \
-DHAVE_REALLOCF -DHAVE_STRLCPY -DHAVE_GETPROGNAME \
-DCONF_PATH='"/etc/dma"' \
-DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.10"' \
-DLIBEXEC_PATH='"/usr/libexec"' -DDMA_VERSION='"v0.11+"' \
-DDMA_ROOT_USER='"mailnull"' \
-DDMA_GROUP='"mail"'
BINGRP= mail

View File

@ -751,9 +751,6 @@
&hwlist.vpo;
<para>[&arch.i386;] The wds(4) driver supports the WD7000 SCSI
controller.</para>
<para>With all supported SCSI controllers, full support is
provided for SCSI-I, SCSI-II, and SCSI-III peripherals,
including hard disks, optical disks, tape drives (including
@ -774,24 +771,10 @@
SoundBlaster SCSI) (&man.cd.4;)</para>
</listitem>
<listitem>
<para>[&arch.i386;] Sony proprietary interface (all models)
(&man.scd.4;)</para>
</listitem>
<listitem>
<para>ATAPI IDE interface (&man.acd.4;)</para>
</listitem>
</itemizedlist>
<para>[&arch.i386;] The following device is unmaintained:</para>
<itemizedlist>
<listitem>
<para>Mitsumi proprietary CD-ROM interface (all models)
(&man.mcd.4;)</para>
</listitem>
</itemizedlist>
</sect2>
<sect2 xml:id="ethernet">
@ -1040,9 +1023,6 @@
Intersil PRISM-2.5, Intersil Prism-3, and Symbol Spectrum24
chipsets (&man.wi.4; driver)</para>
<para>[&arch.i386;] NCR / AT&amp;T / Lucent Technologies WaveLan
T1-speed ISA/radio LAN cards (&man.wl.4; driver)</para>
<para>[&arch.i386;, &arch.amd64;] Intel PRO/Wireless 3945ABG
MiniPCI network adapters (&man.wpi.4; driver)</para>
@ -1238,13 +1218,6 @@
&hwlist.rc;
<para>[&arch.i386;, &arch.amd64;] Specialix SI/XIO/SX multiport
serial cards, with both the older SIHOST2.x and the
<quote>enhanced</quote> (transputer based, aka JET) host cards
(ISA, EISA and PCI) are supported. Note that the newer SX+
PCI cards are not currently supported. (&man.si.4;
driver)</para>
<para>[&arch.pc98;] Internel serial interfaces (&man.sio.4;
driver)</para>

View File

@ -305,7 +305,7 @@ extern u_int real_dev_bsize; /* actual disk sector size, not overridden */
extern char nflag; /* assume a no response */
extern char yflag; /* assume a yes response */
extern int bkgrdflag; /* use a snapshot to run on an active system */
extern int bflag; /* location of alternate super block */
extern ufs2_daddr_t bflag; /* location of alternate super block */
extern int debug; /* output debugging info */
extern int Eflag; /* delete empty data blocks */
extern int Zflag; /* zero empty data blocks */

View File

@ -77,7 +77,7 @@ u_int real_dev_bsize; /* actual disk sector size, not overridden */
char nflag; /* assume a no response */
char yflag; /* assume a yes response */
int bkgrdflag; /* use a snapshot to run on an active system */
int bflag; /* location of alternate super block */
ufs2_daddr_t bflag; /* location of alternate super block */
int debug; /* output debugging info */
int Eflag; /* delete empty data blocks */
int Zflag; /* zero empty data blocks */

View File

@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fstab.h>
#include <grp.h>
#include <inttypes.h>
#include <mntopts.h>
#include <paths.h>
#include <stdint.h>
@ -68,7 +69,7 @@ __FBSDID("$FreeBSD$");
int restarts;
static void usage(void) __dead2;
static int argtoi(int flag, const char *req, const char *str, int base);
static intmax_t argtoimax(int flag, const char *req, const char *str, int base);
static int checkfilesys(char *filesys);
static int chkdoreload(struct statfs *mntp);
static struct statfs *getmntpt(const char *);
@ -88,8 +89,8 @@ main(int argc, char *argv[])
switch (ch) {
case 'b':
skipclean = 0;
bflag = argtoi('b', "number", optarg, 10);
printf("Alternate super block location: %d\n", bflag);
bflag = argtoimax('b', "number", optarg, 10);
printf("Alternate super block location: %jd\n", bflag);
break;
case 'B':
@ -98,7 +99,8 @@ main(int argc, char *argv[])
case 'c':
skipclean = 0;
cvtlevel = argtoi('c', "conversion level", optarg, 10);
cvtlevel = argtoimax('c', "conversion level", optarg,
10);
if (cvtlevel < 3)
errx(EEXIT, "cannot do level %d conversion",
cvtlevel);
@ -121,7 +123,7 @@ main(int argc, char *argv[])
break;
case 'm':
lfmode = argtoi('m', "mode", optarg, 8);
lfmode = argtoimax('m', "mode", optarg, 8);
if (lfmode &~ 07777)
errx(EEXIT, "bad mode to -m: %o", lfmode);
printf("** lost+found creation mode %o\n", lfmode);
@ -203,13 +205,13 @@ main(int argc, char *argv[])
exit(ret);
}
static int
argtoi(int flag, const char *req, const char *str, int base)
static intmax_t
argtoimax(int flag, const char *req, const char *str, int base)
{
char *cp;
int ret;
intmax_t ret;
ret = (int)strtol(str, &cp, base);
ret = strtoimax(str, &cp, base);
if (cp == str || *cp)
errx(EEXIT, "-%c flag requires a %s", flag, req);
return (ret);

View File

@ -196,7 +196,7 @@ setup(char *dev)
bflag = 0;
return(0);
}
pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag);
pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag);
bflag = 0;
}
if (skipclean && ckclean && sblock.fs_clean) {
@ -329,7 +329,7 @@ readsb(int listerr)
}
if (sblock.fs_magic != FS_UFS1_MAGIC &&
sblock.fs_magic != FS_UFS2_MAGIC) {
fprintf(stderr, "%d is not a file system superblock\n",
fprintf(stderr, "%jd is not a file system superblock\n",
bflag);
return (0);
}

View File

@ -22,9 +22,9 @@ MAN+= config.5 des_modes.7
# base sources
SRCS= cpt_err.c cryptlib.c cversion.c ex_data.c mem.c mem_dbg.c o_dir.c \
o_fips.c o_init.c o_str.c o_time.c uid.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= x86_64cpuid.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= x86cpuid.S
.else
SRCS+= mem_clr.c
@ -33,10 +33,10 @@ INCS+= crypto.h ebcdic.h opensslv.h ossl_typ.h symhacks.h ../e_os2.h
# aes
SRCS+= aes_cfb.c aes_ctr.c aes_ecb.c aes_ige.c aes_misc.c aes_ofb.c aes_wrap.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= aes-x86_64.S aesni-mb-x86_64.S aesni-sha1-x86_64.S \
aesni-sha256-x86_64.S aesni-x86_64.S bsaes-x86_64.S vpaes-x86_64.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= aes-586.S aesni-x86.S vpaes-x86.S
.else
SRCS+= aes_cbc.c aes_core.c
@ -60,7 +60,7 @@ INCS+= asn1.h asn1_mac.h asn1t.h
# bf
SRCS+= bf_cfb64.c bf_ecb.c bf_ofb64.c bf_skey.c
.if ${MACHINE_CPUARCH} == "i386"
.if defined(ASM_i386)
.if ${MACHINE_CPU:Mi686}
SRCS+= bf-686.S
.else
@ -82,10 +82,10 @@ SRCS+= bn_add.c bn_blind.c bn_const.c bn_ctx.c bn_depr.c bn_div.c bn_err.c \
bn_exp.c bn_exp2.c bn_gcd.c bn_gf2m.c bn_kron.c bn_lib.c bn_mod.c \
bn_mont.c bn_mpi.c bn_mul.c bn_nist.c bn_prime.c bn_print.c bn_rand.c \
bn_recp.c bn_shift.c bn_sqr.c bn_sqrt.c bn_word.c bn_x931p.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= rsaz-avx2.S rsaz-x86_64.S rsaz_exp.c x86_64-gcc.c x86_64-gf2m.S \
x86_64-mont.S x86_64-mont5.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= bn-586.S co-586.S x86-gf2m.S x86-mont.S
.else
SRCS+= bn_asm.c
@ -98,9 +98,9 @@ INCS+= buffer.h
# camellia
SRCS+= cmll_cfb.c cmll_ctr.c cmll_ecb.c cmll_ofb.c cmll_utl.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= cmll_misc.c cmll-x86_64.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= cmll-x86.S
.else
SRCS+= camellia.c cmll_cbc.c cmll_misc.c
@ -135,7 +135,7 @@ SRCS+= cbc_cksm.c cbc_enc.c cfb64ede.c cfb64enc.c cfb_enc.c des_old.c \
des_old2.c ecb3_enc.c ecb_enc.c ede_cbcm_enc.c enc_read.c enc_writ.c \
fcrypt.c ofb64ede.c ofb64enc.c ofb_enc.c pcbc_enc.c qud_cksm.c \
rand_key.c read2pwd.c rpc_enc.c set_key.c str2key.c xcbc_enc.c
.if ${MACHINE_CPUARCH} == "i386"
.if defined(ASM_i386)
SRCS+= crypt586.S des-586.S
.else
SRCS+= des_enc.c fcrypt_b.c
@ -161,7 +161,7 @@ SRCS+= ec2_mult.c ec2_oct.c ec2_smpl.c ec_ameth.c ec_asn1.c ec_check.c \
ec_curve.c ec_cvt.c ec_err.c ec_key.c ec_lib.c ec_mult.c ec_oct.c \
ec_pmeth.c ec_print.c eck_prn.c ecp_mont.c ecp_nist.c ecp_oct.c \
ecp_smpl.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= ecp_nistz256.c ecp_nistz256-x86_64.S
.endif
INCS+= ec.h
@ -218,9 +218,9 @@ INCS+= md4.h
# md5
SRCS+= md5_dgst.c md5_one.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= md5-x86_64.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= md5-586.S
.endif
INCS+= md5.h
@ -232,9 +232,9 @@ INCS+= mdc2.h
# modes
SRCS+= cbc128.c ccm128.c cfb128.c ctr128.c cts128.c gcm128.c ofb128.c \
wrap128.c xts128.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= aesni-gcm-x86_64.S ghash-x86_64.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= ghash-x86.S
.endif
INCS+= modes.h
@ -278,9 +278,9 @@ INCS+= rc2.h
# rc4
SRCS+= rc4_utl.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= rc4-md5-x86_64.S rc4-x86_64.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= rc4-586.S
.else
SRCS+= rc4_enc.c rc4_skey.c
@ -289,7 +289,7 @@ INCS+= rc4.h
# rc5
SRCS+= rc5_ecb.c rc5_skey.c rc5cfb64.c rc5ofb64.c
.if ${MACHINE_CPUARCH} == "i386"
.if defined(ASM_i386)
SRCS+= rc5-586.S
.else
SRCS+= rc5_enc.c
@ -298,7 +298,7 @@ INCS+= rc5.h
# ripemd
SRCS+= rmd_dgst.c rmd_one.c
.if ${MACHINE_CPUARCH} == "i386"
.if defined(ASM_i386)
SRCS+= rmd-586.S
.endif
INCS+= ripemd.h
@ -316,10 +316,10 @@ INCS+= seed.h
# sha
SRCS+= sha1_one.c sha1dgst.c sha256.c sha512.c sha_dgst.c sha_one.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= sha1-mb-x86_64.S sha1-x86_64.S sha256-mb-x86_64.S sha256-x86_64.S \
sha512-x86_64.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= sha1-586.S sha256-586.S sha512-586.S
.endif
INCS+= sha.h
@ -348,9 +348,9 @@ INCS+= ui.h ui_compat.h
# whrlpool
SRCS+= wp_dgst.c
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
SRCS+= wp-x86_64.S
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
SRCS+= wp-mmx.S wp_block.c
.else
SRCS+= wp_block.c
@ -389,13 +389,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/crypto/modes
ACFLAGS+= -Wa,--noexecstack
.endif
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
OPENSSLCONF_H= opensslconf-x86.h
.else
OPENSSLCONF_H= opensslconf-${MACHINE_CPUARCH}.h
.endif
CLEANFILES= buildinf.h opensslconf.h
CLEANFILES= buildinf.h opensslconf.h opensslconf.h.tmp
buildinf.h: Makefile
( echo "#ifndef MK1MF_BUILD"; \
@ -404,17 +398,21 @@ buildinf.h: Makefile
echo " #define PLATFORM \"platform: FreeBSD-${MACHINE_ARCH}\""; \
echo "#endif" ) > ${.TARGET}
opensslconf.h: ${OPENSSLCONF_H}
${CP} ${.ALLSRC} ${.TARGET}
opensslconf.h: opensslconf-${MACHINE_CPUARCH:C/^(amd64|i386)$/x86/}.h.in
.if defined(ASM_${MACHINE_CPUARCH})
sed 's/%%ASM%%//; /%%NO_ASM%%/d' ${.ALLSRC} > ${.TARGET}.tmp
.else
sed '/%%ASM%%/d; s/%%NO_ASM%%//' ${.ALLSRC} > ${.TARGET}.tmp
.endif
${CP} ${.TARGET}.tmp ${.TARGET}
.include <bsd.lib.mk>
.if ${MACHINE_CPUARCH} == "amd64"
_bn_asmpath= ${LCRYPTO_SRC}/crypto/bn/asm
.endif
.if exists(${.CURDIR}/${MACHINE_CPUARCH})
.if defined(ASM_${MACHINE_CPUARCH})
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}
.if defined(ASM_amd64)
.PATH: ${LCRYPTO_SRC}/crypto/bn/asm
.endif
.endif
.PATH: ${LCRYPTO_SRC}/crypto \
@ -423,7 +421,6 @@ _bn_asmpath= ${LCRYPTO_SRC}/crypto/bn/asm
${LCRYPTO_SRC}/crypto/bf \
${LCRYPTO_SRC}/crypto/bio \
${LCRYPTO_SRC}/crypto/bn \
${_bn_asmpath} \
${LCRYPTO_SRC}/crypto/buffer \
${LCRYPTO_SRC}/crypto/camellia \
${LCRYPTO_SRC}/crypto/cast \

View File

@ -6,7 +6,7 @@
.include "Makefile.inc"
.if ${MACHINE_CPUARCH} == "amd64"
.if defined(ASM_amd64)
.PATH: ${LCRYPTO_SRC}/crypto \
${LCRYPTO_SRC}/crypto/aes/asm \
@ -78,7 +78,7 @@ ${s}.S: ${s}.s
cat ${s}.s ) > ${.TARGET}
.endfor
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
.PATH: ${LCRYPTO_SRC}/crypto \
${LCRYPTO_SRC}/crypto/aes/asm \

View File

@ -21,7 +21,17 @@ CFLAGS+=-DL_ENDIAN
CFLAGS+=-DB_ENDIAN
.endif
.if ${MACHINE_CPUARCH} == "amd64"
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
_ASM_AVX!= { \
echo vzeroall | \
${CC} -x assembler -o /dev/null -c - 2> /dev/null; \
} && echo yes || echo no
.if ${_ASM_AVX} == yes
ASM_${MACHINE_CPUARCH}=
.endif
.endif
.if defined(ASM_amd64)
CFLAGS+=-DOPENSSL_IA32_SSE2
CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM
CFLAGS+=-DECP_NISTZ256_ASM
@ -30,7 +40,7 @@ CFLAGS+=-DMD5_ASM
CFLAGS+=-DGHASH_ASM
CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
CFLAGS+=-DWHIRLPOOL_ASM
.elif ${MACHINE_CPUARCH} == "i386"
.elif defined(ASM_i386)
CFLAGS+=-DOPENSSL_IA32_SSE2
CFLAGS+=-DAES_ASM -DVPAES_ASM
CFLAGS+=-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m

View File

@ -51,9 +51,9 @@ extern "C" {
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
#ifndef OPENSSL_NO_ASM
# define OPENSSL_NO_ASM
#endif
%%NO_ASM%%#ifndef OPENSSL_NO_ASM
%%NO_ASM%%# define OPENSSL_NO_ASM
%%NO_ASM%%#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@ -101,6 +101,8 @@ extern "C" {
# endif
#endif
%%ASM%%#define OPENSSL_CPUID_OBJ
%%ASM%%
/* crypto/opensslconf.h.in */
/* Generate 80386 code? */

View File

@ -51,9 +51,9 @@ extern "C" {
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
#ifndef OPENSSL_NO_ASM
# define OPENSSL_NO_ASM
#endif
%%NO_ASM%%#ifndef OPENSSL_NO_ASM
%%NO_ASM%%# define OPENSSL_NO_ASM
%%NO_ASM%%#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@ -101,6 +101,8 @@ extern "C" {
# endif
#endif
%%ASM%%#define OPENSSL_CPUID_OBJ
%%ASM%%
/* crypto/opensslconf.h.in */
/* Generate 80386 code? */

View File

@ -51,9 +51,9 @@ extern "C" {
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
#ifndef OPENSSL_NO_ASM
# define OPENSSL_NO_ASM
#endif
%%NO_ASM%%#ifndef OPENSSL_NO_ASM
%%NO_ASM%%# define OPENSSL_NO_ASM
%%NO_ASM%%#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif

View File

@ -51,9 +51,9 @@ extern "C" {
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
#ifndef OPENSSL_NO_ASM
# define OPENSSL_NO_ASM
#endif
%%NO_ASM%%#ifndef OPENSSL_NO_ASM
%%NO_ASM%%# define OPENSSL_NO_ASM
%%NO_ASM%%#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@ -101,6 +101,8 @@ extern "C" {
# endif
#endif
%%ASM%%#define OPENSSL_CPUID_OBJ
%%ASM%%
/* crypto/opensslconf.h.in */
/* Generate 80386 code? */

View File

@ -51,9 +51,9 @@ extern "C" {
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
#ifndef OPENSSL_NO_ASM
# define OPENSSL_NO_ASM
#endif
%%NO_ASM%%#ifndef OPENSSL_NO_ASM
%%NO_ASM%%# define OPENSSL_NO_ASM
%%NO_ASM%%#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif

View File

@ -51,9 +51,9 @@ extern "C" {
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
#ifndef OPENSSL_NO_ASM
# define OPENSSL_NO_ASM
#endif
%%NO_ASM%%#ifndef OPENSSL_NO_ASM
%%NO_ASM%%# define OPENSSL_NO_ASM
%%NO_ASM%%#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@ -101,6 +101,8 @@ extern "C" {
# endif
#endif
%%ASM%%#define OPENSSL_CPUID_OBJ
%%ASM%%
/* crypto/opensslconf.h.in */
/* Generate 80386 code? */

View File

@ -51,6 +51,9 @@ extern "C" {
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
%%NO_ASM%%#ifndef OPENSSL_NO_ASM
%%NO_ASM%%# define OPENSSL_NO_ASM
%%NO_ASM%%#endif
#ifndef OPENSSL_NO_STATIC_ENGINE
# define OPENSSL_NO_STATIC_ENGINE
#endif
@ -98,8 +101,8 @@ extern "C" {
# endif
#endif
#define OPENSSL_CPUID_OBJ
%%ASM%%#define OPENSSL_CPUID_OBJ
%%ASM%%
/* crypto/opensslconf.h.in */
/* Generate 80386 code? */

View File

@ -441,7 +441,6 @@ MAN= aac.4 \
sbp.4 \
sbp_targ.4 \
scc.4 \
scd.4 \
sched_4bsd.4 \
sched_ule.4 \
screen.4 \
@ -454,7 +453,6 @@ MAN= aac.4 \
sf.4 \
${_sfxge.4} \
sge.4 \
si.4 \
siba.4 \
siftr.4 \
siis.4 \
@ -498,7 +496,6 @@ MAN= aac.4 \
snd_via82c686.4 \
snd_vibes.4 \
snp.4 \
spic.4 \
${_spkr.4} \
splash.4 \
sppp.4 \

View File

@ -16,7 +16,6 @@ MAN= aic.4 \
fe.4 \
glxiic.4 \
glxsb.4 \
ie.4 \
longrun.4 \
mse.4 \
npx.4 \
@ -31,8 +30,7 @@ MAN= aic.4 \
streams.4 \
svr4.4 \
vpd.4 \
vx.4 \
wl.4
vx.4
MLINKS= CPU_ELAN.4 CPU_SOEKRIS.4
MLINKS+=pae.4 PAE.4

View File

@ -1,143 +0,0 @@
.\"
.\" Copyright (c) 1994, Wilko Bulte
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 16, 2005
.Dt IE 4 i386
.Os
.Sh NAME
.Nm ie
.Nd "Ethernet device driver"
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device ie"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
if_ie_load="YES"
.Ed
.Pp
In
.Pa /boot/device.hints :
.Cd hint.ie.0.at="isa"
.Cd hint.ie.0.port="0x300"
.Cd hint.ie.0.irq="5"
.Cd hint.ie.0.maddr="0xd0000"
.Sh HARDWARE
The
.Nm
driver provides supports the following 8 and 16bit ISA Ethernet cards
that are based on the Intel i82586 chip:
.Pp
.Bl -bullet -compact
.It
3COM 3C507
.It
AT&T EN100
.It
AT&T Starlan 10
.It
AT&T Starlan Fiber
.It
Intel EtherExpress 16
.It
RACAL Interlan NI5210
.El
.Sh DIAGNOSTICS
.Bl -diag
.It "ie%d: unknown board type code %d"
An i82586 chip was found, but the driver was unable to determine the actual
board type during the probe.
.It "ie%d: kernel configured maddr %x doesn't match board configured maddr %x"
The device probe detected a different maddr than the one specified in the
kernel configuration file.
.It "ie%d: can't find shared memory"
The device probe could not access the shared memory to determine its size.
.It "ie%d: kernel configured msize %d doesn't match board configured msize %d"
The device probe found a different size for the shared memory than the one
specified in the kernel configuration file.
.It "ie%d: kernel configured irq %d doesn't match board configured irq %d"
The device probe detected that the board is configured for a different
interrupt than the one specified in the kernel configuration file.
.It "ie%d: reset"
The Intel i82586 had to be reset by the driver.
.It "ie%d: transceiver problem"
The driver has detected a problem with the Ethernet transceiver.
This is
usually due to a loose or broken transceiver cable when using an external
transceiver.
When you experience this problem with an on-card transceiver
your card may be incorrectly jumpered for to use an external transceiver.
Worst case your on-board transceiver may be broken.
.It "ie%d: TDR detected an open %d clocks away"
The driver detected an open circuit in the Ethernet cable.
Check your
coax cable and terminator resistors.
.It "ie%d: TDR detected a short %d clocks away"
The driver detected a short circuit in the Ethernet cable.
Check your
coax cable and terminator resistors.
.It "ie%d: TDR returned unknown status %x"
The driver got an unknown status from the card during the Ethernet cable
test.
.It "ie%d: multicast address setup command failed"
The card could not be put into multicast mode.
.It "ie%d: configure command failed"
The card refused to respond correctly during configuration.
.It "ie%d: individual address setup command failed"
The programming of the Ethernet (MAC) address failed.
.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr netintro 4 ,
.Xr ng_ether 4 ,
.Xr ifconfig 8
.Sh AUTHORS
.An -nosplit
The
.Nm
device driver was written by
.An Garrett A. Wollman ,
based on code by
.An William F. Jolitz
and Lawrence Berkeley Laboratories.
.Tn 3C507
support was written by
.An Charles M. Hannum .
This manual page was written by
.An Wilko C. Bulte .
.Sh CAVEATS
The Racal Interlan NI5210 comes in variants with 8 and 16 kbytes of
shared memory.
It is strongly advisable to use the 16 kbyte variant.
You can upgrade your 8 kbyte card to 16 kbyte by adding an additional
RAM chip.

View File

@ -1,193 +0,0 @@
.\"
.\" Copyright (c) 1997, Jim Binkley
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Jim Binkley
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd September 29, 2006
.Dt WL 4 i386
.Os
.Sh NAME
.Nm wl
.Nd T1 speed ISA/radio lan card
.Sh SYNOPSIS
.Cd "device wl0 at isa? port 0x300 irq 5"
.Sh DESCRIPTION
The
.Nm
driver controls a radio lan card system made originally by
NCR, then ATT, now Lucent.
The system is spread-spectrum radio
at around 915 MHz (or 2.4 GHz).
With the supplied omni-directional antennae,
about 400 feet (indoors, more outdoors) can be covered in circumference.
This card can talk to the companion (wlp0) pccard.
Speeds vary
from 1 megabit to theoretically 2 megabits (roughly T1 in speed).
.Pp
The card has three fundamental hardware
units, a so-called PSA or programmable storage area, a radio modem,
and a Ethernet lan controller.
The latter component is the
ancient (and not very honorable) Intel 82586 Ethernet chip.
Fundamentally it appears to the operating system as an Ethernet system,
and speaks IEEE MAC addresses.
The radio modem simply translates
Ethernet packets to/from radio packets, that are either at 2.4 GHz
or 915 MHz depending on the radio modem.
It supports a collision
avoidance scheme.
The lan controller
supports promiscuous mode, broadcast, and multicasting
(although there is a glitch
in the latter).
"It thinks it is Ethernet".
.Pp
How it is used
depends on the kind of antennae deployed with it.
Point to point
applications are possible as are Ethernet-like lan use.
The vendor
ships an omni-directional antennae that works in the
vicinity of 400 feet (indoors).
Point to point antennae can be purchased that will go miles.
.Sh SETUP
The card can either be initialized with the vendor supplied DOS setup software.
Typically minimally an IRQ, port, and Network ID must be supplied.
Michael Smith's
.Xr wlconfig 8
utility can now be used to do this work from
the UNIX side.
The card is "not" plug and play.
The network id controls whether one set of cards can hear another.
If different, cards will read physical packets, but they will be discarded
by the radio modem.
.Sh CONTROL
In addition to the config utility, there are several sysctl
switches that can be used to modify runtime parameters.
The
.Xr sysctl 8
variables are as follows:
.Bl -diag
.It "machdep.wl_xmit_delay <useconds>"
This variable will cause the driver to insert a delay on transmit.
250 is the default.
The delay should probably be a bit longer
on faster cpus and less on slower cpus.
It exists because the 82586
was not designed to work with Pentium-speed cpu systems and if overdriven
will have copious xmit side errors.
.It machdep.wl_ignore_nwid <0 | 1>
This switch defaults to 0; i.e., the nwid is not ignored.
It can
be set to 1 to cause the nwid to not be used.
This may be useful
when the device is in promiscuous mode as one can watch for all
packets and ignore nwid differences.
.It machdep.wl_xmit_watch <milliseconds>
This switch is not currently useful.
.It machdep.wl_gather_snr <milliseconds>
This switch is not currently useful.
.Pp
There is also a signal strength cache in the driver.
It may be interrogated
with
.Xr wlconfig 8 .
Incoming packets
are checked for certain hardware radio-modem values including signal
strength, silence, and quality, which range fro 0..63, 0..63, and 0..15
respectively.
Thus one can read out signal strenth values to see
how close/far peer nodes are.
The signal strength cache is indexed by
sender MAC address.
There are two sysctls that change how it filters packets.
Both are on
by default.
.It machdep.wl_wlcache_mcastonly <0 | 1>
By default this switch is on.
It forces the cache to filter out
unicast packets.
Only broadcast or multicast packets are accepted.
.It machdep.wl_wlcache_iponly <0 | 1>
By default this switch is on.
It forces the driver to discard non-IP
packets and also stores the IP src address.
ARP packets are ignored,
as are any other network protocol barring IPv4 packets.
.El
.Sh SEE ALSO
.Xr sysctl 8 ,
.Xr wlconfig 8
.Pp
.Pa http://www.wavelan.com
.Sh HISTORY
The
.Nm
driver was written by
.An Anders Klemets
(thousands of years ago?) and
appears to be based on an even older Intel 82586 driver.
The 82586
controller was one of the first (if not the first?) integrated lan
controller on the block.
That does not mean it was the best either.
Anders ported and or created a driver for the ISA wavelan and PCCARD
wavelan system too (wlp).
.An Robert T. Morris, Jr.
ported the Mach drivers to BSDI.
.An Jim Binkley
ported them to
.Fx 2.1 .
.An Michael Smith
ported the
.Nm
driver only to 2.2.2.
Jim and Michael have been
maintaining them.
The current state of the driver is NOT ANYONE'S
FAULT.
Thanks to
.An Bernie Doehner
and
.An Robert Buaas
for contributions.
.Sh AUTHORS
Too numerous to mention.
See above.
.Sh CAVEATS
The 82586 has numerous defects.
It may experience transmit-side
errors when modern faster cpus send packets at it faster than it can handle.
The driver (and probably the chip) does not support an all multicast mode.
As a result, it can be used with applications like
.Xr mrouted 8 Pq Pa ports/net/mrouted ,
but it must go into promiscuous mode for that to work.
The driver
is slow to change modes from "normal" to promiscuous mode, presumably
due to delays in the configuration code.

View File

@ -32,7 +32,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 27, 2015
.Dd August 17, 2016
.Dt RIGHTS 4
.Os
.Sh NAME
@ -254,6 +254,7 @@ Permit
.It Dv CAP_FSYNC
Permit
.Xr aio_fsync 2 ,
.Xr fdatasync 2 ,
.Xr fsync 2
and
.Xr openat 2

View File

@ -1,74 +0,0 @@
.\"
.\" Copyright (c) 1995 Jordan K. Hubbard
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd March 17, 2008
.Dt SCD 4
.Os
.Sh NAME
.Nm scd
.Nd Sony CDU31/33 CD-ROM driver
.Sh SYNOPSIS
.Cd "device scd"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.scd.0.at="isa"
.Cd hint.scd.0.port="0x230"
.Sh DESCRIPTION
The
.Nm
driver provides a data interface to the Sony CDU31 and CDU33A CD-ROM
drives.
The drive must be hooked to a Sony proprietary interface
card or a compatible clone.
.Sh FILES
.Bl -tag -width /dev/[r]scd0a -compact
.It Pa /dev/[r]scd0a
accesses
.Bx
partition on the disc.
Normally, there is only
one file system on a CDROM disc.
.It Pa /dev/[r]scd0c
accesses the raw device.
.El
.Sh SEE ALSO
.Pa /sys/dev/scd/scd.c
.Sh HISTORY
The
.Nm
driver first appeared in
.Fx 2.0.5 .
.Sh AUTHORS
.An -nosplit
The driver was written by
.An Mikael Hybsch
with code contributed by
.An Holger Veit
and
.An Brian Moore .

View File

@ -1,181 +0,0 @@
.\" $FreeBSD$
.Dd September 16, 1995
.Dt SI 4
.Os
.Sh NAME
.Nm si
.Nd "driver for Specialix International SI/XIO or SX intelligent serial card"
.Sh SYNOPSIS
.Cd "device si"
.Pp
For ISA host cards put the following lines in
.Pa /boot/device.hints :
.Cd hint.si.0.at="isa"
.Cd hint.si.0.maddr="0xd0000"
.Cd hint.si.0.irq="12"
.Sh DESCRIPTION
The Specialix SI/XIO and SX hardware makes up an 8 to 32 port RS-232 serial
multiplexor.
.Pp
The system uses two components: a "Host adapter", which is plugged into
an ISA, EISA or PCI slot and provides intelligence and buffering/processing
capabilities, as well as an external bus in the form of a 37 pin cable.
.Pp
On this cable, "modules" are connected.
The "SI" module comes in a 4 and 8 port version.
The "XIO" and "SX" modules come only in
8 port versions.
.Pp
The host adapter polls and transfers data between the modules and the rest
of the machine.
The Host adapter provides a 256 byte transmit and 256 byte
receive FIFO for each of the 32 ports that it can maintain.
.Pp
The XIO modules can operate each of their 8 ports at 115,200 baud.
The SI version can run at 57,600 baud.
The SX modules can operate each of their
8 ports at up to 921,600 baud.
.Pp
SX modules are only supported when connected to an SX host card.
SI or
XIO modules are supported on any host card.
.Pp
The host adapter uses a shared memory block in the traditional ISA bus
"hole" between 0xA0000 and 0xEFFFF.
The adapter can be configured outside
range, but requires the memory range to be explicitly non-cached.
The driver does not yet support this mode of operation.
.Pp
SX ISA Host cards have an 8/16 bit mode switch or jumper on them.
This switch
or jumper MUST be set for 8 bit mode.
.Pp
The ISA adapters can use Irq's 11, 12 or 15 (and 9 and 10 in the case of
SX host cards).
.Pp
The si device driver may have some of its configuration settings changed
at run-time with the
.Xr sicontrol 8
utility.
.Pp
The si device driver also responds to the
.Xr comcontrol 8
utility for configuring drain-on-close timeouts.
.Pp
The driver also defines 3 sysctl variables that can be manipulated:
machdep.si_debug sets the debug level for the whole driver.
It depends
on the driver being compiled with SI_DEBUG.
machdep.si_pollrate
sets how often per second the driver polls for lost interrupts.
machdep.si_realpoll sets whether or not the card will treat the
poll intervals as if they were interrupts.
.Pp
An open on a /dev device node controlled by the si driver obeys the same
semantics as the
.Xr sio 4
driver.
It fully supports the usual semantics of the cua ports, and the
"initial termios" and "locked termios" settings.
In summary, an open on a
tty port will block until DCD is raised, unless O_NONBLOCK is specified.
CLOCAL is honored.
An open on a cua port will always succeed, but DCD
transitions will be honored after DCD rises for the first time.
.Pp
Up to four SI/XIO host cards may be controlled by the si driver.
Due to the lack of available interrupts, only 3 ISA SI/XIO host cards can be
used at once.
.Pp
The lowest 5 bits of the minor device number are used to select the port
number on the module cluster.
The next 2 bits select which of 4 host adapter
cards.
This allows a maximum of 128 ports on this driver.
.Pp
Bit 7 is used to differentiate a tty/dialin port (bit 7=0) and a
cua/callout port (bit 7=1).
.Pp
Bit 8 through 15 (on
.Fx )
are unavailable as they are a shadow of the
major device number.
.Pp
If bit 16 is a 1, the device node is referring to the "initial state" device.
This "initial state" is used to prime the
.Xr termios 4
settings of the device when it is initially opened.
If bit 17 is a 1, the device node is referring to the "locked state" device.
The "locked state" is used to prevent the
.Xr termios 4
settings from being changed.
.Pp
To manipulate the initial/locked settings, the
.Xr stty 1
command is useful.
When setting the "locked" variables, enabling the mode
on the lock device will lock the termios mode, while disabling the mode will
unlock it.
.Sh FILES
.Bl -tag -width /dev/si_control -compact
.It Pa /dev/si_control
global driver control file for
.Xr sicontrol 8
.It Pa /dev/ttyA*
terminal/dialin ports
.It Pa /dev/cuaA*
dialout ports
.It Pa /dev/ttyiA*
initial termios state devices
.It Pa /dev/ttylA*
locked termios state devices
.It Pa /dev/cuaiA*
initial termios state devices for dialout ports
.It Pa /dev/cualA*
locked termios state devices for dialout ports
.El
.Sh SEE ALSO
.Xr stty 1 ,
.Xr sio 4 ,
.Xr termios 4 ,
.Xr tty 4 ,
.Xr comcontrol 8 ,
.Xr sicontrol 8
.Sh HISTORY
This driver is loosely based on driver code originating at Specialix, which
was ported to run on BSDI by
.An Andy Rutter Aq Mt andy@specialix.co.uk .
The System V driver source is/was available by ftp from
.Sy ftp.specialix.co.uk .
.Pp
This driver is not supported by Specialix International.
.Sh AUTHORS
.An -nosplit
.An Peter Wemm Aq Mt peter@netplex.com.au
obtained the code from
.An Andy Rutter
and ported it to
.Fx
and threw the man page together.
.An Bruce Evans Aq Mt bde@zeta.org.au
provided a large amount of assistance during porting.
.An Nick Sayer Aq Mt nick@specialix.com
wrote the EISA, PCI and SX portions.
.Sh BUGS
The interrupt tuning rate is not believed to be optimal at this time for
maximum efficiency.
.Pp
Polled mode (a feature of standard Specialix drivers) is not implemented,
but it can be approximated by turning on machdep.si_realpoll.
The poll
frequency is set by machdep.si_pollrate (in units of 1/100th of a second).
.Pp
The driver does not yet support baud rates higher than 115,200 on SX
modules.
.Pp
Operation outside the traditional ISA "hole" is not yet supported, although it
should work if the test is removed from the probe routine.
.Pp
Multiple host cards are supported although combinations of hosts on
different bus types have not been tested - device numbering is known to
be a problem and may lead to unexpected results.

View File

@ -1,61 +0,0 @@
.\"
.\" Copyright (c) 2002 Will Andrews
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd May 20, 2002
.Dt SPIC 4
.Os
.Sh NAME
.Nm spic
.Nd Sony Programmable I/O Controller device driver
.Sh SYNOPSIS
.Cd "device spic"
.Sh DESCRIPTION
The
.Nm
driver allows using
.Xr moused 8
to drive the Sony Vaio Jogdial device found on several Sony Vaio models.
It works by mapping the forward, backwards, up, and down inputs to
.Dq l ,
.Dq r ,
.Dq u ,
and
.Dq d ,
respectively.
From that a program reading the Jogdial can decide what to do.
Some actions might include scrolling, mimicking mouse buttons, launching
applications, or other useful things.
.Sh SEE ALSO
.Xr moused 8
.Sh HISTORY
The
.Nm
device driver first appeared in
.Fx 4.6 .
.Sh AUTHORS
.An Nick Sayer Aq Mt nsayer@FreeBSD.org
.An Will Andrews Aq Mt will@FreeBSD.org

View File

@ -542,7 +542,6 @@ hint.pbio.0.port="0x360"
device smbios
device vpd
device asmc
device si
device tpm
device padlock_rng # VIA Padlock RNG
device rdrand_rng # Intel Bull Mountain RNG

View File

@ -0,0 +1,4 @@
# $FreeBSD$
arm/allwinner/a10/a10_intc.c standard
arm/allwinner/a10/a10_padconf.c standard

View File

@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/controller/ehci.h>
#include <dev/usb/controller/ehcireg.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
#include <dev/extres/clk/clk.h>
#include <dev/extres/hwreset/hwreset.h>
#include <dev/extres/phy/phy.h>

View File

@ -52,11 +52,13 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
#include <arm/allwinner/allwinner_pinctrl.h>
#include <dev/extres/clk/clk.h>
#include <dev/extres/hwreset/hwreset.h>
#include <dt-bindings/pinctrl/sun4i-a10.h>
#if defined(__aarch64__)
#include "opt_soc.h"
#endif
@ -210,14 +212,8 @@ a10_gpio_get_function(struct a10_gpio_softc *sc, uint32_t pin)
offset = ((pin & 0x07) << 2);
func = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, pin >> 3));
switch ((func >> offset) & 0x7) {
case A10_GPIO_INPUT:
return (GPIO_PIN_INPUT);
case A10_GPIO_OUTPUT:
return (GPIO_PIN_OUTPUT);
}
return (0);
return ((func >> offset) & 0x7);
}
static int
@ -257,14 +253,8 @@ a10_gpio_get_pud(struct a10_gpio_softc *sc, uint32_t pin)
offset = ((pin & 0x0f) << 1);
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pin >> 4));
switch ((val >> offset) & 0x3) {
case A10_GPIO_PULLDOWN:
return (GPIO_PIN_PULLDOWN);
case A10_GPIO_PULLUP:
return (GPIO_PIN_PULLUP);
}
return (0);
return ((val >> offset) & AW_GPIO_PUD_MASK);
}
static void
@ -285,6 +275,23 @@ a10_gpio_set_pud(struct a10_gpio_softc *sc, uint32_t pin, uint32_t state)
A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pin >> 4), val);
}
static uint32_t
a10_gpio_get_drv(struct a10_gpio_softc *sc, uint32_t pin)
{
uint32_t bank, offset, val;
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
bank = sc->padconf->pins[pin].port;
pin = sc->padconf->pins[pin].pin;
offset = ((pin & 0x0f) << 1);
val = A10_GPIO_READ(sc, A10_GPIO_GP_DRV(bank, pin >> 4));
return ((val >> offset) & AW_GPIO_DRV_MASK);
}
static void
a10_gpio_set_drv(struct a10_gpio_softc *sc, uint32_t pin, uint32_t drive)
{
@ -373,14 +380,39 @@ static int
a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
{
struct a10_gpio_softc *sc;
uint32_t func;
uint32_t pud;
sc = device_get_softc(dev);
if (pin >= sc->padconf->npins)
return (EINVAL);
A10_GPIO_LOCK(sc);
*flags = a10_gpio_get_function(sc, pin);
*flags |= a10_gpio_get_pud(sc, pin);
func = a10_gpio_get_function(sc, pin);
switch (func) {
case A10_GPIO_INPUT:
*flags = GPIO_PIN_INPUT;
break;
case A10_GPIO_OUTPUT:
*flags = GPIO_PIN_OUTPUT;
break;
default:
*flags = 0;
break;
}
pud = a10_gpio_get_pud(sc, pin);
switch (pud) {
case A10_GPIO_PULLDOWN:
*flags |= GPIO_PIN_PULLDOWN;
break;
case A10_GPIO_PULLUP:
*flags |= GPIO_PIN_PULLUP;
break;
default:
break;
}
A10_GPIO_UNLOCK(sc);
return (0);
@ -564,9 +596,15 @@ aw_fdt_configure_pins(device_t dev, phandle_t cfgxref)
}
A10_GPIO_LOCK(sc);
a10_gpio_set_function(sc, pin_num, pin_func);
a10_gpio_set_drv(sc, pin_num, pin_drive);
a10_gpio_set_pud(sc, pin_num, pin_pull);
if (a10_gpio_get_function(sc, pin_num) != pin_func)
a10_gpio_set_function(sc, pin_num, pin_func);
if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
a10_gpio_set_drv(sc, pin_num, pin_drive);
if (a10_gpio_get_pud(sc, pin_num) != pin_pull &&
(pin_pull == SUN4I_PINCTRL_PULL_UP ||
pin_pull == SUN4I_PINCTRL_PULL_DOWN))
a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}

View File

@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <dev/mmc/mmcreg.h>
#include <dev/mmc/mmcbrvar.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
#include <arm/allwinner/a10_mmc.h>
#include <dev/extres/clk/clk.h>
#include <dev/extres/hwreset/hwreset.h>

View File

@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
#include <dev/extres/clk/clk.h>
#include <dev/extres/regulator/regulator.h>

View File

@ -1,6 +1,6 @@
/*-
* Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@freebsd.org>
* Copyright (c) 2015-2016 Emmanuel Vadot <manu@bidouilliste.com>
* Copyright (c) 2015-2016 Emmanuel Vadot <manu@freebsd.org>
* All rights reserved.
*
* This code is derived from software written for Brini by Mark Brinicombe
@ -26,6 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c
*/
@ -52,7 +53,7 @@ __FBSDID("$FreeBSD$");
#include <arm/allwinner/aw_mp.h>
#include <arm/allwinner/aw_wdog.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
#include "platform_if.h"

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2015 Emmanuel Vadot <manu@bidouilliste.com>
* Copyright (c) 2015 Emmanuel Vadot <manu@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
#include <machine/platformvar.h>
#include <arm/allwinner/aw_mp.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
/* Register for all dual-core SoC */
#define A20_CPUCFG_BASE 0x01c25c00

View File

@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
#include "clock_if.h"

View File

@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
#include <dt-bindings/clock/sun4i-a10-pll2.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
#include "clkdev_if.h"

View File

@ -1,5 +0,0 @@
# $FreeBSD$
arm/allwinner/a10/a10_intc.c standard
arm/allwinner/a10_padconf.c standard
arm/allwinner/timer.c standard

View File

@ -16,7 +16,7 @@ arm/allwinner/aw_rsb.c optional rsb
arm/allwinner/aw_rtc.c standard
arm/allwinner/aw_wdog.c standard
arm/allwinner/a20/a20_cpu_cfg.c standard
arm/allwinner/allwinner_machdep.c standard
arm/allwinner/aw_machdep.c standard
arm/allwinner/aw_mp.c optional smp
arm/allwinner/axp209.c optional axp209
arm/allwinner/axp81x.c optional axp81x

View File

@ -0,0 +1,3 @@
# $FreeBSD$
arm/allwinner/timer.c standard

View File

@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
#include <dev/mii/miivar.h>
#include <arm/allwinner/if_emacreg.h>
#include <arm/allwinner/aw_sid.h>
#include <dev/extres/clk/clk.h>
@ -167,12 +168,17 @@ static void
emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr)
{
uint32_t val0, val1, rnd;
u_char rootkey[16];
/*
* Try to get MAC address from running hardware.
* If there is something non-zero there just use it.
*
* Otherwise set the address to a convenient locally assigned address,
* using the SID rootkey.
* This is was uboot does so we end up with the same mac as if uboot
* did set it.
* If we can't get the root key, generate a random one,
* 'bsd' + random 24 low-order bits. 'b' is 0x62, which has the locally
* assigned bit set, and the broadcast/multicast bit clear.
*/
@ -186,13 +192,23 @@ emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr)
hwaddr[4] = (val0 >> 8) & 0xff;
hwaddr[5] = (val0 >> 0) & 0xff;
} else {
rnd = arc4random() & 0x00ffffff;
hwaddr[0] = 'b';
hwaddr[1] = 's';
hwaddr[2] = 'd';
hwaddr[3] = (rnd >> 16) & 0xff;
hwaddr[4] = (rnd >> 8) & 0xff;
hwaddr[5] = (rnd >> 0) & 0xff;
if (aw_sid_get_rootkey(rootkey) == 0) {
hwaddr[0] = 0x2;
hwaddr[1] = rootkey[3];
hwaddr[2] = rootkey[12];
hwaddr[3] = rootkey[13];
hwaddr[4] = rootkey[14];
hwaddr[5] = rootkey[15];
}
else {
rnd = arc4random() & 0x00ffffff;
hwaddr[0] = 'b';
hwaddr[1] = 's';
hwaddr[2] = 'd';
hwaddr[3] = (rnd >> 16) & 0xff;
hwaddr[4] = (rnd >> 8) & 0xff;
hwaddr[5] = (rnd >> 0) & 0xff;
}
}
if (bootverbose)
printf("MAC address: %s\n", ether_sprintf(hwaddr));

View File

@ -1,4 +1,4 @@
# Allwinner A10 common options
# Allwinner Uniprocessor common options
#$FreeBSD$
cpu CPU_CORTEXA
@ -8,6 +8,7 @@ makeoptions CONF_CFLAGS="-march=armv7a"
makeoptions KERNVIRTADDR=0xc0200000
options KERNVIRTADDR=0xc0200000
files "../allwinner/files.allwinner_up"
files "../allwinner/files.allwinner"
files "../allwinner/files.a10"
files "../allwinner/a10/files.a10"
files "../allwinner/a13/files.a13"

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kdb.h>
#include <arm/allwinner/allwinner_machdep.h>
#include <arm/allwinner/aw_machdep.h>
/**
* Timer registers addr

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <machine/pte-v4.h>
#include <machine/cpufunc.h>
#include <machine/armreg.h>
#include <machine/cpu.h>
extern char kernel_start[];
extern char kernel_end[];
@ -47,7 +48,7 @@ extern void *_end;
void _start(void);
void __start(void);
void __startC(void);
void __startC(unsigned r0, unsigned r1, unsigned r2, unsigned r3);
extern unsigned int cpu_ident(void);
extern void armv6_idcache_wbinv_all(void);
@ -124,6 +125,10 @@ static int arm_dcache_l2_nsets;
static int arm_dcache_l2_assoc;
static int arm_dcache_l2_linesize;
/*
* Boot parameters
*/
static struct arm_boot_params s_boot_params;
extern int arm9_dcache_sets_inc;
extern int arm9_dcache_sets_max;
@ -172,12 +177,17 @@ bzero(void *addr, int count)
static void arm9_setup(void);
void
_startC(void)
_startC(unsigned r0, unsigned r1, unsigned r2, unsigned r3)
{
int tmp1;
unsigned int sp = ((unsigned int)&_end & ~3) + 4;
unsigned int pc, kernphysaddr;
s_boot_params.abp_r0 = r0;
s_boot_params.abp_r1 = r1;
s_boot_params.abp_r2 = r2;
s_boot_params.abp_r3 = r3;
/*
* Figure out the physical address the kernel was loaded at. This
* assumes the entry point (this code right here) is in the first page,
@ -211,8 +221,15 @@ _startC(void)
/* Temporary set the sp and jump to the new location. */
__asm __volatile(
"mov sp, %1\n"
"mov r0, %2\n"
"mov r1, %3\n"
"mov r2, %4\n"
"mov r3, %5\n"
"mov pc, %0\n"
: : "r" (target_addr), "r" (tmp_sp));
: : "r" (target_addr), "r" (tmp_sp),
"r" (s_boot_params.abp_r0), "r" (s_boot_params.abp_r1),
"r" (s_boot_params.abp_r2), "r" (s_boot_params.abp_r3),
: "r0", "r1", "r2", "r3");
}
#endif
@ -487,6 +504,7 @@ load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end,
vm_offset_t lastaddr = 0;
Elf_Addr ssym = 0;
Elf_Dyn *dp;
struct arm_boot_params local_boot_params;
eh = (Elf32_Ehdr *)kstart;
ssym = 0;
@ -555,6 +573,12 @@ load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end,
if (!d)
return ((void *)lastaddr);
/*
* Now the stack is fixed, copy boot params
* before it's overrided
*/
memcpy(&local_boot_params, &s_boot_params, sizeof(local_boot_params));
j = eh->e_phnum;
for (i = 0; i < j; i++) {
volatile char c;
@ -604,7 +628,10 @@ load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end,
"mcr p15, 0, %0, c1, c0, 0\n" /* CP15_SCTLR(%0)*/
: "=r" (ssym));
/* Jump to the entry point. */
((void(*)(void))(entry_point - KERNVIRTADDR + curaddr))();
((void(*)(unsigned, unsigned, unsigned, unsigned))
(entry_point - KERNVIRTADDR + curaddr))
(local_boot_params.abp_r0, local_boot_params.abp_r1,
local_boot_params.abp_r2, local_boot_params.abp_r3);
__asm __volatile(".globl func_end\n"
"func_end:");

View File

@ -105,6 +105,10 @@ static struct resource_spec timer_spec[] = {
{ -1, 0 }
};
static uint32_t arm_tmr_fill_vdso_timehands(struct vdso_timehands *vdso_th,
struct timecounter *tc);
static void arm_tmr_do_delay(int usec, void *);
static timecounter_get_t arm_tmr_get_timecount;
static struct timecounter arm_tmr_timecount = {
@ -114,6 +118,7 @@ static struct timecounter arm_tmr_timecount = {
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_quality = 1000,
.tc_fill_vdso_timehands = arm_tmr_fill_vdso_timehands,
};
#ifdef __arm__
@ -128,10 +133,6 @@ static struct timecounter arm_tmr_timecount = {
#define set_el1(x, val) WRITE_SPECIALREG(x ##_el1, val)
#endif
static uint32_t arm_tmr_fill_vdso_timehands(struct vdso_timehands *vdso_th,
struct timecounter *tc);
static void arm_tmr_do_delay(int usec, void *);
static int
get_freq(void)
{
@ -412,8 +413,6 @@ arm_tmr_attach(device_t dev)
}
}
arm_cpu_fill_vdso_timehands = arm_tmr_fill_vdso_timehands;
arm_tmr_timecount.tc_frequency = sc->clkfreq;
tc_init(&arm_tmr_timecount);
@ -535,7 +534,8 @@ arm_tmr_fill_vdso_timehands(struct vdso_timehands *vdso_th,
struct timecounter *tc)
{
vdso_th->th_algo = VDSO_TH_ALGO_ARM_GENTIM;
vdso_th->th_physical = arm_tmr_sc->physical;
bzero(vdso_th->th_res, sizeof(vdso_th->th_res));
return (tc == &arm_tmr_timecount);
return (1);
}

View File

@ -2003,14 +2003,3 @@ initarm(struct arm_boot_params *abp)
#endif /* __ARM_ARCH < 6 */
#endif /* FDT */
uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *,
struct timecounter *);
uint32_t
cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc)
{
return (arm_cpu_fill_vdso_timehands != NULL ?
arm_cpu_fill_vdso_timehands(vdso_th, tc) : 0);
}

View File

@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#ifdef FDT
#include <machine/fdt.h>
#include <dev/ofw/ofw_bus_subr.h>
#include "ofw_bus_if.h"
#endif
@ -379,6 +380,11 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid,
#endif
rman_set_virtual(r, (void *)vaddr);
rman_set_bushandle(r, vaddr);
return (0);
} else if (type == SYS_RES_IRQ) {
#ifdef INTRNG
intr_activate_irq(child, r);
#endif
}
return (0);
}
@ -390,17 +396,23 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
bus_size_t psize;
bus_space_handle_t vaddr;
psize = (bus_size_t)rman_get_size(r);
vaddr = rman_get_bushandle(r);
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
psize = (bus_size_t)rman_get_size(r);
vaddr = rman_get_bushandle(r);
if (vaddr != 0) {
if (vaddr != 0) {
#ifdef FDT
bus_space_unmap(fdtbus_bs_tag, vaddr, psize);
bus_space_unmap(fdtbus_bs_tag, vaddr, psize);
#else
pmap_unmapdev((vm_offset_t)vaddr, (vm_size_t)psize);
pmap_unmapdev((vm_offset_t)vaddr, (vm_size_t)psize);
#endif
rman_set_virtual(r, NULL);
rman_set_bushandle(r, 0);
}
} else if (type == SYS_RES_IRQ) {
#ifdef INTRNG
intr_deactivate_irq(child, r);
#endif
rman_set_virtual(r, NULL);
rman_set_bushandle(r, 0);
}
return (rman_deactivate_resource(r));
@ -411,11 +423,22 @@ static int
nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells,
pcell_t *intr)
{
#ifdef INTRNG
return (INTR_IRQ_INVALID);
#else
#ifndef INTRNG
return (intr_fdt_map_irq(iparent, intr, icells));
#endif
#else
u_int irq;
struct intr_map_data_fdt *fdt_data;
size_t len;
len = sizeof(*fdt_data) + icells * sizeof(pcell_t);
fdt_data = (struct intr_map_data_fdt *)intr_alloc_map_data(
INTR_MAP_DATA_FDT, len, M_WAITOK | M_ZERO);
fdt_data->iparent = iparent;
fdt_data->ncells = icells;
memcpy(fdt_data->cells, intr, icells * sizeof(pcell_t));
irq = intr_map_irq(NULL, iparent, (struct intr_map_data *)fdt_data);
return (irq);
#endif /* INTRNG */
}
#endif
#endif /* FDT */

View File

@ -1,5 +1,5 @@
#
# A10 -- Custom configuration for the AllWinner A10 SoC
# ALLWINNER_UP -- Custom configuration for the AllWinner Uniprocessor SoC
#
# For more information on this file, please read the config(5) manual page,
# and/or the handbook section on Kernel Configuration Files:
@ -18,10 +18,10 @@
#
# $FreeBSD$
ident A10
ident ALLWINNER_UP
include "std.armv6"
include "../allwinner/std.a10"
include "../allwinner/std.allwinner_up"
options INTRNG

View File

@ -45,11 +45,6 @@ extern int (*_arm_bzero)(void *, int, int);
extern int _min_memcpy_size;
extern int _min_bzero_size;
struct vdso_timehands;
struct timecounter;
extern uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *,
struct timecounter *);
#define DST_IS_USER 0x1
#define SRC_IS_USER 0x2
#define IS_PHYSICAL 0x4

View File

@ -32,4 +32,6 @@
uint32_t th_physical; \
uint32_t th_res[7];
#define VDSO_TH_ALGO_ARM_GENTIM VDSO_TH_ALGO_1
#endif

View File

@ -88,12 +88,12 @@ struct tegra_lic_sc {
};
static int
tegra_lic_alloc_intr(device_t dev, struct intr_irqsrc *isrc,
tegra_lic_activate_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
struct tegra_lic_sc *sc = device_get_softc(dev);
return (PIC_ALLOC_INTR(sc->parent, isrc, res, data));
return (PIC_ACTIVATE_INTR(sc->parent, isrc, res, data));
}
static void
@ -122,12 +122,12 @@ tegra_lic_map_intr(device_t dev, struct intr_map_data *data,
}
static int
tegra_lic_release_intr(device_t dev, struct intr_irqsrc *isrc,
tegra_lic_deactivate_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
struct tegra_lic_sc *sc = device_get_softc(dev);
return (PIC_RELEASE_INTR(sc->parent, isrc, res, data));
return (PIC_DEACTIVATE_INTR(sc->parent, isrc, res, data));
}
static int
@ -266,11 +266,11 @@ static device_method_t tegra_lic_methods[] = {
DEVMETHOD(device_detach, tegra_lic_detach),
/* Interrupt controller interface */
DEVMETHOD(pic_alloc_intr, tegra_lic_alloc_intr),
DEVMETHOD(pic_activate_intr, tegra_lic_activate_intr),
DEVMETHOD(pic_disable_intr, tegra_lic_disable_intr),
DEVMETHOD(pic_enable_intr, tegra_lic_enable_intr),
DEVMETHOD(pic_map_intr, tegra_lic_map_intr),
DEVMETHOD(pic_release_intr, tegra_lic_release_intr),
DEVMETHOD(pic_deactivate_intr, tegra_lic_deactivate_intr),
DEVMETHOD(pic_setup_intr, tegra_lic_setup_intr),
DEVMETHOD(pic_teardown_intr, tegra_lic_teardown_intr),
DEVMETHOD(pic_pre_ithread, tegra_lic_pre_ithread),

View File

@ -33,20 +33,20 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/devmap.h>
#include <sys/proc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/bus.h>
#include <sys/rman.h>
#include <sys/endian.h>
#include <sys/devmap.h>
#include <machine/intr.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
#include <vm/pmap.h>
#include <dev/extres/clk/clk.h>
@ -68,8 +68,9 @@ __FBSDID("$FreeBSD$");
#include <arm/nvidia/tegra_pmc.h>
#include "ofw_bus_if.h"
#include "msi_if.h"
#include "pcib_if.h"
#include "pic_if.h"
#define AFI_AXI_BAR0_SZ 0x000
@ -93,17 +94,10 @@ __FBSDID("$FreeBSD$");
#define AFI_MSI_BAR_SZ 0x060
#define AFI_MSI_FPCI_BAR_ST 0x064
#define AFI_MSI_AXI_BAR_ST 0x068
#define AFI_AXI_BAR6_SZ 0x134
#define AFI_AXI_BAR7_SZ 0x138
#define AFI_AXI_BAR8_SZ 0x13c
#define AFI_AXI_BAR6_START 0x140
#define AFI_AXI_BAR7_START 0x144
#define AFI_AXI_BAR8_START 0x148
#define AFI_FPCI_BAR6 0x14c
#define AFI_FPCI_BAR7 0x150
#define AFI_FPCI_BAR8 0x154
#define AFI_MSI_VEC(x) (0x06c + 4 * (x))
#define AFI_MSI_EN_VEC(x) (0x08c + 4 * (x))
#define AFI_MSI_INTR_IN_REG 32
#define AFI_MSI_REGS 8
#define AFI_CONFIGURATION 0x0ac
#define AFI_CONFIGURATION_EN_FPCI (1 << 0)
@ -209,6 +203,8 @@ __FBSDID("$FreeBSD$");
#define TEGRA_PCIE_LINKUP_TIMEOUT 200
#define TEGRA_PCIB_MSI_ENABLE
#define DEBUG
#ifdef DEBUG
#define debugf(fmt, args...) do { printf(fmt,##args); } while (0)
@ -258,6 +254,13 @@ static struct ofw_compat_data compat_data[] = {
{NULL, 0},
};
#define TEGRA_FLAG_MSI_USED 0x0001
struct tegra_pcib_irqsrc {
struct intr_irqsrc isrc;
u_int irq;
u_int flags;
};
struct tegra_pcib_port {
int enabled;
int port_idx; /* chip port index */
@ -271,6 +274,7 @@ struct tegra_pcib_port {
};
#define TEGRA_PCIB_MAX_PORTS 3
#define TEGRA_PCIB_MAX_MSI AFI_MSI_INTR_IN_REG * AFI_MSI_REGS
struct tegra_pcib_softc {
struct ofw_pci_softc ofw_pci;
device_t dev;
@ -303,7 +307,7 @@ struct tegra_pcib_softc {
regulator_t supply_vddio_pex_ctl;
regulator_t supply_avdd_pll_erefe;
uint32_t msi_bitmap;
vm_offset_t msi_page; /* VA of MSI page */
bus_addr_t cfg_base_addr; /* base address of config */
bus_size_t cfg_cur_offs; /* currently mapped window */
bus_space_handle_t cfg_handle; /* handle of config window */
@ -311,9 +315,9 @@ struct tegra_pcib_softc {
int lanes_cfg;
int num_ports;
struct tegra_pcib_port *ports[TEGRA_PCIB_MAX_PORTS];
struct tegra_pcib_irqsrc *isrcs;
};
static int
tegra_pcib_maxslots(device_t dev)
{
@ -324,13 +328,15 @@ static int
tegra_pcib_route_interrupt(device_t bus, device_t dev, int pin)
{
struct tegra_pcib_softc *sc;
u_int irq;
sc = device_get_softc(bus);
device_printf(bus, "route pin %d for device %d.%d to %ju\n",
irq = intr_map_clone_irq(rman_get_start(sc->irq_res));
device_printf(bus, "route pin %d for device %d.%d to %u\n",
pin, pci_get_slot(dev), pci_get_function(dev),
rman_get_start(sc->irq_res));
irq);
return (rman_get_start(sc->irq_res));
return (irq);
}
static int
@ -471,84 +477,319 @@ static int tegra_pci_intr(void *arg)
return (FILTER_HANDLED);
}
#if defined(TEGRA_PCI_MSI)
/* -----------------------------------------------------------------------
*
* PCI MSI interface
*/
static int
tegra_pcib_map_msi(device_t dev, device_t child, int irq, uint64_t *addr,
tegra_pcib_alloc_msi(device_t pci, device_t child, int count, int maxcount,
int *irqs)
{
phandle_t msi_parent;
/* XXXX ofw_bus_msimap() don't works for Tegra DT.
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
NULL);
*/
msi_parent = OF_xref_from_node(ofw_bus_get_node(pci));
return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
irqs));
}
static int
tegra_pcib_release_msi(device_t pci, device_t child, int count, int *irqs)
{
phandle_t msi_parent;
/* XXXX ofw_bus_msimap() don't works for Tegra DT.
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
NULL);
*/
msi_parent = OF_xref_from_node(ofw_bus_get_node(pci));
return (intr_release_msi(pci, child, msi_parent, count, irqs));
}
static int
tegra_pcib_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
uint32_t *data)
{
phandle_t msi_parent;
/* XXXX ofw_bus_msimap() don't works for Tegra DT.
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
NULL);
*/
msi_parent = OF_xref_from_node(ofw_bus_get_node(pci));
return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
}
#ifdef TEGRA_PCIB_MSI_ENABLE
/* --------------------------------------------------------------------------
*
* Interrupts
*
*/
static inline void
tegra_pcib_isrc_mask(struct tegra_pcib_softc *sc,
struct tegra_pcib_irqsrc *tgi, uint32_t val)
{
uint32_t reg;
int offs, bit;
offs = tgi->irq / AFI_MSI_INTR_IN_REG;
bit = 1 << (tgi->irq % AFI_MSI_INTR_IN_REG);
if (val != 0)
AFI_WR4(sc, AFI_MSI_VEC(offs), bit);
reg = AFI_RD4(sc, AFI_MSI_EN_VEC(offs));
if (val != 0)
reg |= bit;
else
reg &= ~bit;
AFI_WR4(sc, AFI_MSI_EN_VEC(offs), reg);
}
static int
tegra_pcib_msi_intr(void *arg)
{
u_int irq, i, bit, reg;
struct tegra_pcib_softc *sc;
struct trapframe *tf;
struct tegra_pcib_irqsrc *tgi;
sc = device_get_softc(dev);
irq = irq - MSI_IRQ;
sc = (struct tegra_pcib_softc *)arg;
tf = curthread->td_intr_frame;
/* validate parameters */
if (isclr(&sc->msi_bitmap, irq)) {
device_printf(dev, "invalid MSI 0x%x\n", irq);
return (EINVAL);
for (i = 0; i < AFI_MSI_REGS; i++) {
reg = AFI_RD4(sc, AFI_MSI_VEC(i));
/* Handle one vector. */
while (reg != 0) {
bit = ffs(reg) - 1;
/* Send EOI */
AFI_WR4(sc, AFI_MSI_VEC(i), 1 << bit);
irq = i * AFI_MSI_INTR_IN_REG + bit;
tgi = &sc->isrcs[irq];
if (intr_isrc_dispatch(&tgi->isrc, tf) != 0) {
/* Disable stray. */
tegra_pcib_isrc_mask(sc, tgi, 0);
device_printf(sc->dev,
"Stray irq %u disabled\n", irq);
}
reg = AFI_RD4(sc, AFI_MSI_VEC(i));
}
}
return (FILTER_HANDLED);
}
tegra_msi_data(irq, addr, data);
static int
tegra_pcib_msi_attach(struct tegra_pcib_softc *sc)
{
int error;
uint32_t irq;
const char *name;
debugf("%s: irq: %d addr: %jx data: %x\n",
__func__, irq, *addr, *data);
sc->isrcs = malloc(sizeof(*sc->isrcs) * TEGRA_PCIB_MAX_MSI, M_DEVBUF,
M_WAITOK | M_ZERO);
name = device_get_nameunit(sc->dev);
for (irq = 0; irq < TEGRA_PCIB_MAX_MSI; irq++) {
sc->isrcs[irq].irq = irq;
error = intr_isrc_register(&sc->isrcs[irq].isrc,
sc->dev, 0, "%s,%u", name, irq);
if (error != 0)
return (error); /* XXX deregister ISRCs */
}
if (intr_msi_register(sc->dev,
OF_xref_from_node(ofw_bus_get_node(sc->dev))) != 0)
return (ENXIO);
return (0);
}
static int
tegra_pcib_alloc_msi(device_t dev, device_t child, int count,
int maxcount __unused, int *irqs)
tegra_pcib_msi_detach(struct tegra_pcib_softc *sc)
{
/*
* There has not been established any procedure yet
* how to detach PIC from living system correctly.
*/
device_printf(sc->dev, "%s: not implemented yet\n", __func__);
return (EBUSY);
}
static void
tegra_pcib_msi_disable_intr(device_t dev, struct intr_irqsrc *isrc)
{
struct tegra_pcib_softc *sc;
u_int start = 0, i;
struct tegra_pcib_irqsrc *tgi;
if (powerof2(count) == 0 || count > MSI_IRQ_NUM)
return (EINVAL);
sc = device_get_softc(dev);
tgi = (struct tegra_pcib_irqsrc *)isrc;
tegra_pcib_isrc_mask(sc, tgi, 0);
}
static void
tegra_pcib_msi_enable_intr(device_t dev, struct intr_irqsrc *isrc)
{
struct tegra_pcib_softc *sc;
struct tegra_pcib_irqsrc *tgi;
sc = device_get_softc(dev);
tgi = (struct tegra_pcib_irqsrc *)isrc;
tegra_pcib_isrc_mask(sc, tgi, 1);
}
/* MSI interrupts are edge trigered -> do nothing */
static void
tegra_pcib_msi_post_filter(device_t dev, struct intr_irqsrc *isrc)
{
}
static void
tegra_pcib_msi_post_ithread(device_t dev, struct intr_irqsrc *isrc)
{
}
static void
tegra_pcib_msi_pre_ithread(device_t dev, struct intr_irqsrc *isrc)
{
}
static int
tegra_pcib_msi_setup_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
struct tegra_pcib_softc *sc;
struct tegra_pcib_irqsrc *tgi;
sc = device_get_softc(dev);
tgi = (struct tegra_pcib_irqsrc *)isrc;
if (data == NULL || data->type != INTR_MAP_DATA_MSI)
return (ENOTSUP);
if (isrc->isrc_handlers == 0)
tegra_pcib_msi_enable_intr(dev, isrc);
return (0);
}
static int
tegra_pcib_msi_teardown_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
struct tegra_pcib_softc *sc;
struct tegra_pcib_irqsrc *tgi;
sc = device_get_softc(dev);
tgi = (struct tegra_pcib_irqsrc *)isrc;
if (isrc->isrc_handlers == 0)
tegra_pcib_isrc_mask(sc, tgi, 0);
return (0);
}
static int
tegra_pcib_msi_alloc_msi(device_t dev, device_t child, int count, int maxcount,
device_t *pic, struct intr_irqsrc **srcs)
{
struct tegra_pcib_softc *sc;
int i, irq, end_irq;
bool found;
KASSERT(powerof2(count), ("%s: bad count", __func__));
KASSERT(powerof2(maxcount), ("%s: bad maxcount", __func__));
sc = device_get_softc(dev);
mtx_lock(&sc->mtx);
for (start = 0; (start + count) < MSI_IRQ_NUM; start++) {
for (i = start; i < start + count; i++) {
if (isset(&sc->msi_bitmap, i))
found = false;
for (irq = 0; irq < TEGRA_PCIB_MAX_MSI && !found; irq++) {
/* Start on an aligned interrupt */
if ((irq & (maxcount - 1)) != 0)
continue;
/* Assume we found a valid range until shown otherwise */
found = true;
/* Check this range is valid */
for (end_irq = irq; end_irq != irq + count - 1; end_irq++) {
/* No free interrupts */
if (end_irq == (TEGRA_PCIB_MAX_MSI - 1)) {
found = false;
break;
}
/* This is already used */
if ((sc->isrcs[irq].flags & TEGRA_FLAG_MSI_USED) ==
TEGRA_FLAG_MSI_USED) {
found = false;
break;
}
}
if (i == start + count)
break;
}
if ((start + count) == MSI_IRQ_NUM) {
/* Not enough interrupts were found */
if (!found || irq == (TEGRA_PCIB_MAX_MSI - 1)) {
mtx_unlock(&sc->mtx);
return (ENXIO);
}
for (i = start; i < start + count; i++) {
setbit(&sc->msi_bitmap, i);
irqs[i] = MSI_IRQ + i;
}
debugf("%s: start: %x count: %x\n", __func__, start, count);
for (i = 0; i < count; i++) {
/* Mark the interrupt as used */
sc->isrcs[irq + i].flags |= TEGRA_FLAG_MSI_USED;
}
mtx_unlock(&sc->mtx);
for (i = 0; i < count; i++)
srcs[i] = (struct intr_irqsrc *)&sc->isrcs[irq + i];
*pic = device_get_parent(dev);
return (0);
}
static int
tegra_pcib_release_msi(device_t dev, device_t child, int count, int *irqs)
tegra_pcib_msi_release_msi(device_t dev, device_t child, int count,
struct intr_irqsrc **isrc)
{
struct tegra_pcib_softc *sc;
u_int i;
struct tegra_pcib_irqsrc *ti;
int i;
sc = device_get_softc(dev);
mtx_lock(&sc->mtx);
for (i = 0; i < count; i++) {
ti = (struct tegra_pcib_irqsrc *)isrc;
for (i = 0; i < count; i++)
clrbit(&sc->msi_bitmap, irqs[i] - MSI_IRQ);
KASSERT((ti->flags & TEGRA_FLAG_MSI_USED) == TEGRA_FLAG_MSI_USED,
("%s: Trying to release an unused MSI-X interrupt",
__func__));
mtx_unlock(&sc->mtx);
ti->flags &= ~TEGRA_FLAG_MSI_USED;
mtx_unlock(&sc->mtx);
}
return (0);
}
static int
tegra_pcib_msi_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc,
uint64_t *addr, uint32_t *data)
{
struct tegra_pcib_softc *sc = device_get_softc(dev);
struct tegra_pcib_irqsrc *ti = (struct tegra_pcib_irqsrc *)isrc;
*addr = vtophys(sc->msi_page);
*data = ti->irq;
return (0);
}
#endif
/* ------------------------------------------------------------------- */
static bus_size_t
tegra_pcib_pex_ctrl(struct tegra_pcib_softc *sc, int port)
{
@ -1137,6 +1378,52 @@ tegra_pcib_enable(struct tegra_pcib_softc *sc)
return(0);
}
#ifdef TEGRA_PCIB_MSI_ENABLE
static int
tegra_pcib_attach_msi(device_t dev)
{
struct tegra_pcib_softc *sc;
uint32_t reg;
int i, rv;
sc = device_get_softc(dev);
sc->msi_page = kmem_alloc_contig(kernel_arena, PAGE_SIZE, M_WAITOK,
0, BUS_SPACE_MAXADDR, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
/* MSI BAR */
tegra_pcib_set_bar(sc, 9, vtophys(sc->msi_page), vtophys(sc->msi_page),
PAGE_SIZE, 0);
/* Disble and clear all interrupts. */
for (i = 0; i < AFI_MSI_REGS; i++) {
AFI_WR4(sc, AFI_MSI_EN_VEC(i), 0);
AFI_WR4(sc, AFI_MSI_VEC(i), 0xFFFFFFFF);
}
rv = bus_setup_intr(dev, sc->msi_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
tegra_pcib_msi_intr, NULL, sc, &sc->msi_intr_cookie);
if (rv != 0) {
device_printf(dev, "cannot setup MSI interrupt handler\n");
rv = ENXIO;
goto out;
}
if (tegra_pcib_msi_attach(sc) != 0) {
device_printf(dev, "WARNING: unable to attach PIC\n");
tegra_pcib_msi_detach(sc);
goto out;
}
/* Unmask MSI interrupt. */
reg = AFI_RD4(sc, AFI_INTR_MASK);
reg |= AFI_INTR_MASK_MSI_MASK;
AFI_WR4(sc, AFI_INTR_MASK, reg);
out:
return (rv);
}
#endif
static int
tegra_pcib_probe(device_t dev)
{
@ -1254,7 +1541,7 @@ tegra_pcib_attach(device_t dev)
goto out;
if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
tegra_pci_intr, NULL, sc, &sc->intr_cookie)) {
tegra_pci_intr, NULL, sc, &sc->intr_cookie)) {
device_printf(dev, "cannot setup interrupt handler\n");
rv = ENXIO;
goto out;
@ -1275,6 +1562,11 @@ tegra_pcib_attach(device_t dev)
tegra_pcib_port_disable(sc, i);
}
#ifdef TEGRA_PCIB_MSI_ENABLE
rv = tegra_pcib_attach_msi(dev);
if (rv != 0)
goto out;
#endif
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
@ -1299,11 +1591,24 @@ static device_method_t tegra_pcib_methods[] = {
DEVMETHOD(pcib_read_config, tegra_pcib_read_config),
DEVMETHOD(pcib_write_config, tegra_pcib_write_config),
DEVMETHOD(pcib_route_interrupt, tegra_pcib_route_interrupt),
#if defined(TEGRA_PCI_MSI)
DEVMETHOD(pcib_alloc_msi, tegra_pcib_alloc_msi),
DEVMETHOD(pcib_release_msi, tegra_pcib_release_msi),
DEVMETHOD(pcib_map_msi, tegra_pcib_map_msi),
#ifdef TEGRA_PCIB_MSI_ENABLE
/* MSI/MSI-X */
DEVMETHOD(msi_alloc_msi, tegra_pcib_msi_alloc_msi),
DEVMETHOD(msi_release_msi, tegra_pcib_msi_release_msi),
DEVMETHOD(msi_map_msi, tegra_pcib_msi_map_msi),
/* Interrupt controller interface */
DEVMETHOD(pic_disable_intr, tegra_pcib_msi_disable_intr),
DEVMETHOD(pic_enable_intr, tegra_pcib_msi_enable_intr),
DEVMETHOD(pic_setup_intr, tegra_pcib_msi_setup_intr),
DEVMETHOD(pic_teardown_intr, tegra_pcib_msi_teardown_intr),
DEVMETHOD(pic_post_filter, tegra_pcib_msi_post_filter),
DEVMETHOD(pic_post_ithread, tegra_pcib_msi_post_ithread),
DEVMETHOD(pic_pre_ithread, tegra_pcib_msi_pre_ithread),
#endif
/* OFW bus interface */

View File

@ -57,12 +57,12 @@ struct omap4_wugen_sc {
};
static int
omap4_wugen_alloc_intr(device_t dev, struct intr_irqsrc *isrc,
omap4_wugen_activate_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
struct omap4_wugen_sc *sc = device_get_softc(dev);
return (PIC_ALLOC_INTR(sc->sc_parent, isrc, res, data));
return (PIC_ACTIVATE_INTR(sc->sc_parent, isrc, res, data));
}
static void
@ -91,12 +91,12 @@ omap4_wugen_map_intr(device_t dev, struct intr_map_data *data,
}
static int
omap4_wugen_release_intr(device_t dev, struct intr_irqsrc *isrc,
omap4_wugen_deactivate_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
struct omap4_wugen_sc *sc = device_get_softc(dev);
return (PIC_RELEASE_INTR(sc->sc_parent, isrc, res, data));
return (PIC_DEACTIVATE_INTR(sc->sc_parent, isrc, res, data));
}
static int
@ -227,11 +227,11 @@ static device_method_t omap4_wugen_methods[] = {
DEVMETHOD(device_detach, omap4_wugen_detach),
/* Interrupt controller interface */
DEVMETHOD(pic_alloc_intr, omap4_wugen_alloc_intr),
DEVMETHOD(pic_activate_intr, omap4_wugen_activate_intr),
DEVMETHOD(pic_disable_intr, omap4_wugen_disable_intr),
DEVMETHOD(pic_enable_intr, omap4_wugen_enable_intr),
DEVMETHOD(pic_map_intr, omap4_wugen_map_intr),
DEVMETHOD(pic_release_intr, omap4_wugen_release_intr),
DEVMETHOD(pic_deactivate_intr, omap4_wugen_deactivate_intr),
DEVMETHOD(pic_setup_intr, omap4_wugen_setup_intr),
DEVMETHOD(pic_teardown_intr, omap4_wugen_teardown_intr),
DEVMETHOD(pic_pre_ithread, omap4_wugen_pre_ithread),

View File

@ -1005,17 +1005,6 @@ initarm(struct arm64_bootparams *abp)
early_boot = 0;
}
uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *,
struct timecounter *);
uint32_t
cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc)
{
return (arm_cpu_fill_vdso_timehands != NULL ?
arm_cpu_fill_vdso_timehands(vdso_th, tc) : 0);
}
#ifdef DDB
#include <ddb/ddb.h>

View File

@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
#include <machine/intr.h>
#ifdef FDT
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/ofw/openfirm.h>
#include "ofw_bus_if.h"
#endif
@ -345,6 +346,8 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid,
rman_set_bustag(r, &memmap_bus);
rman_set_virtual(r, (void *)vaddr);
rman_set_bushandle(r, vaddr);
} else if (type == SYS_RES_IRQ) {
intr_activate_irq(child, r);
}
return (0);
}
@ -378,13 +381,17 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
bus_size_t psize;
bus_space_handle_t vaddr;
psize = (bus_size_t)rman_get_size(r);
vaddr = rman_get_bushandle(r);
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
psize = (bus_size_t)rman_get_size(r);
vaddr = rman_get_bushandle(r);
if (vaddr != 0) {
bus_space_unmap(&memmap_bus, vaddr, psize);
rman_set_virtual(r, NULL);
rman_set_bushandle(r, 0);
if (vaddr != 0) {
bus_space_unmap(&memmap_bus, vaddr, psize);
rman_set_virtual(r, NULL);
rman_set_bushandle(r, 0);
}
} else if (type == SYS_RES_IRQ) {
intr_deactivate_irq(child, r);
}
return (rman_deactivate_resource(r));
@ -431,8 +438,18 @@ static int
nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells,
pcell_t *intr)
{
u_int irq;
struct intr_map_data_fdt *fdt_data;
size_t len;
return (INTR_IRQ_INVALID);
len = sizeof(*fdt_data) + icells * sizeof(pcell_t);
fdt_data = (struct intr_map_data_fdt *)intr_alloc_map_data(
INTR_MAP_DATA_FDT, len, M_WAITOK | M_ZERO);
fdt_data->iparent = iparent;
fdt_data->ncells = icells;
memcpy(fdt_data->cells, intr, icells * sizeof(pcell_t));
irq = intr_map_irq(NULL, iparent, (struct intr_map_data *)fdt_data);
return (irq);
}
#endif

View File

@ -47,9 +47,4 @@ void dump_add_page(vm_paddr_t);
void dump_drop_page(vm_paddr_t);
int minidumpsys(struct dumperinfo *);
struct vdso_timehands;
struct timecounter;
extern uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *,
struct timecounter *);
#endif /* !_MACHINE_MD_VAR_H_ */

Some files were not shown because too many files have changed in this diff Show More