Sync with head

This commit is contained in:
Dag-Erling Smørgrav 2009-09-25 22:45:59 +00:00
commit 0fbc5fbedf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/quota64/; revision=197507
322 changed files with 4371 additions and 2203 deletions

View File

@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
machines to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
20090922:
802.11s D3.03 support was committed. This is incompatible with the
previous code, which was based on D3.0.
20090910:
ZFS snapshots are now mounted with MNT_IGNORE flag. Use -v option for
mount(8) and -a option for df(1) to see them.

View File

@ -375,6 +375,10 @@ introduces a comment if used at the beginning of a word.
The word starting with
.Ql #
and the rest of the line are ignored.
.Pp
.Tn ASCII
.Dv NUL
characters (character code 0) are not allowed in shell input.
.Ss Quoting
Quoting is used to remove the special meaning of certain characters
or words to the shell, such as operators, whitespace, keywords,

View File

@ -535,7 +535,7 @@ This property is not inherited.
.ad
.sp .6
.RS 4n
Controls the checksum used to verify data integrity. The default value is "on", which automatically selects an appropriate algorithm (currently, \fIfletcher2\fR, but this may change in future releases). The value "off" disables integrity
Controls the checksum used to verify data integrity. The default value is "on", which automatically selects an appropriate algorithm (currently, \fIfletcher4\fR, but this may change in future releases). The value "off" disables integrity
checking on user data. Disabling checksums is NOT a recommended practice.
.RE

View File

@ -23,6 +23,7 @@
rc_debug="NO" # Set to YES to enable debugging output from rc.d
rc_info="NO" # Enables display of informational messages at boot.
rc_startmsgs="NO" # Show "Starting foo:" messages at boot
rcshutdown_timeout="30" # Seconds to wait before terminating rc.shutdown
early_late_divider="FILESYSTEMS" # Script that separates early/late
# stages of the boot process. Make sure you know

View File

@ -708,7 +708,13 @@ run_rc_command()
# setup the full command to run
#
[ -z "${rc_quiet}" ] && echo "Starting ${name}."
_show_startmsgs=1
if [ -n "${rc_quiet}" ]; then
if ! checkyesno rc_startmsgs; then
unset _show_startmsgs
fi
fi
[ -n "$_show_startmsgs" ] && echo "Starting ${name}."
if [ -n "$_chroot" ]; then
_doit="\
${_nice:+nice -n $_nice }\

View File

@ -72,6 +72,8 @@
.ds doc-operating-system-FreeBSD-6.3 6.3
.ds doc-operating-system-FreeBSD-6.4 6.4
.ds doc-operating-system-FreeBSD-7.1 7.1
.ds doc-operating-system-FreeBSD-7.2 7.2
.ds doc-operating-system-FreeBSD-7.3 7.3
.ds doc-operating-system-FreeBSD-8.0 8.0
.ds doc-operating-system-FreeBSD-9.0 9.0
.

View File

@ -15,7 +15,7 @@ SRCS+= __getosreldate.c __xuname.c \
getbootfile.c getbsize.c \
getcap.c getcwd.c getdomainname.c getgrent.c getgrouplist.c \
gethostname.c getloadavg.c getlogin.c getmntinfo.c getnetgrent.c \
getosreldate.c getpagesize.c \
getosreldate.c getpagesize.c getpagesizes.c \
getpeereid.c getprogname.c getpwent.c getttyent.c \
getusershell.c getvfsbyname.c glob.c \
initgroups.c isatty.c isinf.c isnan.c jrand48.c lcong48.c \
@ -51,8 +51,8 @@ MAN+= alarm.3 arc4random.3 \
getbootfile.3 getbsize.3 getcap.3 getcontext.3 getcwd.3 \
getdiskbyname.3 getdomainname.3 getfsent.3 \
getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 \
getmntinfo.3 getnetgrent.3 getosreldate.3 \
getpagesize.3 getpass.3 getpeereid.3 getprogname.3 getpwent.3 \
getmntinfo.3 getnetgrent.3 getosreldate.3 getpagesize.3 \
getpagesizes.3 getpass.3 getpeereid.3 getprogname.3 getpwent.3 \
getttyent.3 getusershell.3 getvfsbyname.3 \
glob.3 initgroups.3 isgreater.3 ldexp.3 lockf.3 makecontext.3 \
modf.3 \

View File

@ -366,6 +366,10 @@ FBSD_1.1 {
tcsetsid;
};
FBSD_1.2 {
getpagesizes;
};
FBSDprivate_1.0 {
/* needed by thread libraries */
__thr_jtable;

View File

@ -0,0 +1,99 @@
.\" Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu>
.\" 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 September 21, 2009
.Dt GETPAGESIZES 3
.Os
.Sh NAME
.Nm getpagesizes
.Nd "get system page sizes"
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/mman.h
.Ft int
.Fn getpagesizes "size_t pagesize[]" "int nelem"
.Sh DESCRIPTION
The
.Fn getpagesizes
function retrieves page size information from the system.
When it is called with
.Fa pagesize
specified as
.Dv NULL
and
.Fa nelem
specified as 0, it returns the number of distinct page sizes that are
supported by the system.
Otherwise, it assigns up to
.Fa nelem
of the system-supported page sizes to consecutive elements of the
array referenced by
.Fa pagesize .
These page sizes are expressed in bytes.
In this case,
.Fn getpagesizes
returns the number of such page sizes that it assigned to the array.
.Sh RETURN VALUES
If successful, the
.Fn getpagesizes
function returns either the number of page sizes that are supported by
the system or the number of supported page sizes that it assigned to
the array referenced by
.Fa pagesize .
Otherwise, it returns the value\~\-1 and sets
.Va errno
to indicate the error.
.Sh ERRORS
The
.Fn getpagesizes
function will succeed unless:
.Bl -tag -width Er
.It Bq Er EINVAL
The
.Fa pagesize
argument is
.Dv NULL
and the
.Fa nelem
argument is non-zero.
.It Bq Er EINVAL
The
.Fa nelem
argument is less than zero.
.El
.Sh SEE ALSO
.Xr getpagesize 3
.Sh HISTORY
The
.Fn getpagesizes
function first appeared in Solaris 9.
This manual page was written in conjunction with a new but compatible
implementation that was first released in
.Fx 7.3 .
.Sh AUTHORS
This manual page was written by
.An Alan L. Cox Aq alc@cs.rice.edu .

View File

@ -0,0 +1,78 @@
/*-
* Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu>
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/sysctl.h>
#include <errno.h>
/*
* Retrieves page size information from the system. Specifically, returns the
* number of distinct page sizes that are supported by the system, if
* "pagesize" is NULL and "nelem" is 0. Otherwise, assigns up to "nelem" of
* the system-supported page sizes to consecutive elements of the array
* referenced by "pagesize", and returns the number of such page sizes that it
* assigned to the array. These page sizes are expressed in bytes.
*
* The implementation of this function does not directly or indirectly call
* malloc(3) or any other dynamic memory allocator that may itself call this
* function.
*/
int
getpagesizes(size_t pagesize[], int nelem)
{
static u_long ps[MAXPAGESIZES];
static int nops;
size_t size;
int i;
if (nelem < 0 || (nelem > 0 && pagesize == NULL)) {
errno = EINVAL;
return (-1);
}
/* Cache the result of the sysctl(2). */
if (nops == 0) {
size = sizeof(ps);
if (sysctlbyname("hw.pagesizes", ps, &size, NULL, 0) == -1)
return (-1);
/* Count the number of page sizes that are supported. */
nops = size / sizeof(ps[0]);
while (nops > 0 && ps[nops - 1] == 0)
nops--;
}
if (pagesize == NULL)
return (nops);
/* Return up to "nelem" page sizes from the cached result. */
if (nelem > nops)
nelem = nops;
for (i = 0; i < nelem; i++)
pagesize[i] = ps[i];
return (nelem);
}

View File

@ -67,8 +67,8 @@ if the
.Fa fib
argument is greater than the current system maximum.
.Sh SEE ALSO
.Xr setsockopt 2 ,
.Xr setfib 8
.Xr setfib 1 ,
.Xr setsockopt 2
.Sh STANDARDS
The
.Fn setfib

View File

@ -36,17 +36,22 @@ Sanitize_Bios_Geom(struct disk *disk)
if (disk->bios_cyl >= 65536)
sane = 0;
#ifdef PC98
if (disk->bios_hd >= 256)
sane = 0;
if (disk->bios_sect >= 256)
sane = 0;
#else
if (disk->bios_hd > 256)
sane = 0;
#ifdef PC98
if (disk->bios_sect >= 256)
#else
if (disk->bios_sect > 63)
#endif
sane = 0;
#endif
#if 0 /* Disable a check on a disk size. It's too strict. */
if (disk->bios_cyl * disk->bios_hd * disk->bios_sect !=
disk->chunks->size)
sane = 0;
#endif
if (sane)
return;

View File

@ -39,7 +39,7 @@
.Nm jailparam_set ,
.Nm jailparam_get ,
.Nm jailparam_export ,
.Nm jailparam_free ,
.Nm jailparam_free
.Nd create and manage system jails
.Sh LIBRARY
.Lb libjail
@ -89,14 +89,16 @@ knowing the parameter formats.
The
.Fn jail_getid
function returns the JID of the jail identified by
.Ar name ,
.Fa name ,
or \-1 if the jail does not exist.
.Pp
The
.Fn jail_getname
function returns the name of the jail identified by
.Ar jid ,
or NULL if the jail does not exist.
.Fa jid ,
or
.Dv NULL
if the jail does not exist.
.Pp
The
.Fn jail_setv
@ -116,7 +118,7 @@ returned parameters.
The
.Fn jailparam_all
function sets
.Ar jpp
.Fa jpp
to a list of all known jail parameters, and returns the number of
parameters.
The list should later be freed with
@ -127,14 +129,15 @@ and
The
.Fn jailparam_init
function clears a parameter record and copies the
.Ar name
to it. After use, it should be freed with
.Fa name
to it.
After use, it should be freed with
.Fn jailparam_free .
.Pp
The
.Fn jailparam_import
function adds a
.Ar value
.Fa value
to a parameter record, converting it from a string to its native form.
The
.Fn jailparam_import_raw
@ -151,7 +154,7 @@ and
.Pp
The
.Fn jailparam_get
function function passes a list of parameters to
function passes a list of parameters to
.Xr jail_get 2 .
The parameters are assumed to have been created with
.Fn jailparam_init
@ -163,7 +166,7 @@ with one parameter (the key) having been given a value with
The
.Fn jailparam_export
function returns the string equivalent of a parameter value.
The returned string should freed after use.
The returned string should be freed after use.
.Pp
The
.Fn jailparam_free
@ -171,6 +174,43 @@ function frees the stored names and values in a parameter list.
If the list itself came from
.Fn jailparam_all ,
it should be freed as well.
.Sh RETURN VALUES
The
.Fn jail_getid ,
.Fn jail_setv ,
.Fn jail_getv ,
.Fn jailparam_set
and
.Fn jailparam_get
functions return a JID on success, or \-1 on error.
.Pp
The
.Fn jail_getname
and
.Fn jailparam_export
functions return a dynamically allocated string on success, or
.Dv NULL
on error.
.Pp
The
.Fn jailparam_all
function returns the number of parameters on success, or \-1 on error.
.Pp
The
.Fn jailparam_init ,
.Fn jailparam_import
and
.Fn jailparam_import_raw
functions return 0 on success, or \-1 on error.
.Pp
Whenever an error is returned,
.Va errno
is set, and the global string
.Va jail_errmsg
contains a description of the error, possibly from
.Xr jail_set 2
or
.Xr jail_get 2 .
.Sh EXAMPLES
Set the hostname of jail
.Dq foo
@ -209,41 +249,6 @@ jailparam_get(params, 2, 0);
hostname = jailparam_export(&params[1]);
jailparam_free(params, 2);
.Ed
.Sh RETURN VALUES
The
.Fn jail_getid ,
.Fn jail_setv ,
.Fn jail_getv ,
.Fn jailparam_set
and
.Fn jailparam_get
functions return a JID on success, or \-1 on error.
.Pp
The
.Fn jail_getname
and
.Fn jailparam_export
functions return a dynamically allocated string on success, or NULL on error.
.Pp
The
.Fn jailparam_all
function returns the number of parameters on success, or \-1 on error.
.Pp
The
.Fn jailparam_init ,
.Fn jailparam_import
and
.Fn jailparam_import_raw
functions return 0 on success, or \-1 on error.
.Pp
Whenever an error is returned,
.Va errno
is set, and the global string
.Va jail_errmsg
contains a descrption of the error, possibly from
.Xr jail_set 2
or
.Xr jail_get 2 .
.Sh ERRORS
The
.Nm jail
@ -256,16 +261,17 @@ or
In addition, the following errors are possible:
.Bl -tag -width Er
.It Bq Er EINVAL
A prameter value cannot be convert from the passed string to its
A parameter value cannot be converted from the passed string to its
internal form.
.It Bq Er ENOENT
The named parameter does not exist.
.It Bq Er ENOENT
A parameter is of an unknown type.
.El
.Sh SEE ALSO
.Xr jail 2 ,
.Xr jail 8 ,
.Xr sysctl 3
.Xr sysctl 3 ,
.Xr jail 8
.Sh HISTORY
The
.Nm jail

View File

@ -131,9 +131,19 @@ _thread_cleanupspecific(void)
curthread->specific[key].data = NULL;
curthread->specific_data_count--;
}
else if (curthread->specific[key].data != NULL) {
/*
* This can happen if the key is deleted via
* pthread_key_delete without first setting the value
* to NULL in all threads. POSIX says that the
* destructor is not invoked in this case.
*/
curthread->specific[key].data = NULL;
curthread->specific_data_count--;
}
/*
* If there is a destructore, call it
* If there is a destructor, call it
* with the key table entry unlocked:
*/
if (destructor != NULL) {

View File

@ -171,8 +171,11 @@ _thr_rwlock_unlock(struct urwlock *rwlock)
for (;;) {
if (__predict_false(URWLOCK_READER_COUNT(state) == 0))
return (EPERM);
if (!((state & URWLOCK_WRITE_WAITERS) && URWLOCK_READER_COUNT(state) == 1)) {
if (atomic_cmpset_rel_32(&rwlock->rw_state, state, state-1))
if (!((state & (URWLOCK_WRITE_WAITERS |
URWLOCK_READ_WAITERS)) &&
URWLOCK_READER_COUNT(state) == 1)) {
if (atomic_cmpset_rel_32(&rwlock->rw_state,
state, state-1))
return (0);
state = rwlock->rw_state;
} else {

View File

@ -57,8 +57,8 @@ static void
cleanup(int sig)
{
(void) sig;
(void) rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL);
(void)sig;
(void)rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL);
exit(0);
}
@ -71,18 +71,17 @@ main(void)
socklen_t fromlen;
fromlen = sizeof(from);
if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) {
if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0)
from_inetd = 0;
}
if (!from_inetd) {
daemon(0, 0);
(void) rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL);
(void)rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL);
(void) signal(SIGINT, cleanup);
(void) signal(SIGTERM, cleanup);
(void) signal(SIGHUP, cleanup);
(void)signal(SIGINT, cleanup);
(void)signal(SIGTERM, cleanup);
(void)signal(SIGHUP, cleanup);
}
openlog("rpc.rquotad", LOG_CONS|LOG_PID, LOG_DAEMON);
@ -95,10 +94,11 @@ main(void)
exit(1);
}
ok = svc_reg(transp, RQUOTAPROG, RQUOTAVERS,
rquota_service, NULL);
} else
rquota_service, NULL);
} else {
ok = svc_create(rquota_service,
RQUOTAPROG, RQUOTAVERS, "udp");
RQUOTAPROG, RQUOTAVERS, "udp");
}
if (!ok) {
syslog(LOG_ERR,
"unable to register (RQUOTAPROG, RQUOTAVERS, %s)",
@ -143,7 +143,7 @@ sendquota(struct svc_req *request, SVCXPRT *transp)
struct dqblk dqblk;
struct timeval timev;
bzero((char *)&getq_args, sizeof(getq_args));
bzero(&getq_args, sizeof(getq_args));
if (!svc_getargs(transp, (xdrproc_t)xdr_getquota_args, &getq_args)) {
svcerr_decode(transp);
return;
@ -196,7 +196,7 @@ printerr_reply(SVCXPRT *transp) /* when a reply to a request failed */
caller = (struct sockaddr *)svc_getrpccaller(transp)->buf;
getnameinfo(caller, caller->sa_len, name, sizeof (name),
NULL, 0, NI_NUMERICHOST);
NULL, 0, NI_NUMERICHOST);
errno = save_errno;
if (errno == 0)
syslog(LOG_ERR, "couldn't send reply to %s", name);
@ -221,15 +221,13 @@ initfs(void)
if (!hasquota(fs, &qfpathname))
continue;
fs_current = (struct fs_stat *) malloc(sizeof(struct fs_stat));
fs_current = malloc(sizeof(struct fs_stat));
fs_current->fs_next = fs_next; /* next element */
fs_current->fs_file =
malloc(sizeof(char) * (strlen(fs->fs_file) + 1));
fs_current->fs_file = malloc(strlen(fs->fs_file) + 1);
strcpy(fs_current->fs_file, fs->fs_file);
fs_current->qfpathname =
malloc(sizeof(char) * (strlen(qfpathname) + 1));
fs_current->qfpathname = malloc(strlen(qfpathname) + 1);
strcpy(fs_current->qfpathname, qfpathname);
stat(fs_current->fs_file, &st);

View File

@ -242,6 +242,7 @@ MFSSIZE= 4096
MFSINODE= 8192
MFSLABEL= auto
MINIROOT=
SEPARATE_LIVEFS=
.elif ${TARGET_ARCH} == "ia64"
DISKLABEL= ""
MAKE_DVD=

View File

@ -502,6 +502,10 @@
<para>&sun.blade; 2000</para>
</listitem>
<listitem>
<para>&sun.blade; 2500</para>
</listitem>
<listitem>
<para>&sun.fire; 280R</para>
</listitem>
@ -511,7 +515,12 @@
</listitem>
<listitem>
<para>&sun.fire; V440 (except for the on-board NICs)</para>
<para>&sun.fire; V250</para>
</listitem>
<listitem>
<para>&sun.fire; V440 (support for the on-board NICs first
appeared in 8.0-RELEASE)</para>
</listitem>
<listitem>

View File

@ -1055,23 +1055,22 @@ atacapprint(struct ata_params *parm)
printf("\n");
printf("PIO supported PIO");
if (parm->atavalid & ATA_FLAG_64_70) {
if (parm->apiomodes & 0x02)
printf("4");
else if (parm->apiomodes & 0x01)
printf("3");
} else if (parm->mwdmamodes & 0x04)
switch (ata_max_pmode(parm)) {
case ATA_PIO4:
printf("4");
else if (parm->mwdmamodes & 0x02)
break;
case ATA_PIO3:
printf("3");
else if (parm->mwdmamodes & 0x01)
break;
case ATA_PIO2:
printf("2");
else if ((parm->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x200)
printf("2");
else if ((parm->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x100)
break;
case ATA_PIO1:
printf("1");
else
break;
default:
printf("0");
}
printf("\n");
printf("DMA%ssupported ",

View File

@ -869,7 +869,7 @@ The packet is tagged so as to use the FIB (routing table)
.Ar fibnum
in any subsequent forwarding decisions.
Initially this is limited to the values 0 through 15, see
.Xr setfib 8 .
.Xr setfib 1 .
Processing continues at the next rule.
.It Cm reass
Queue and reassemble ip fragments.

View File

@ -104,7 +104,7 @@ struct nfhret {
#define OF_NOINET6 8
int retrycnt = -1;
int opflags = 0;
int nfsproto = IPPROTO_UDP;
int nfsproto = IPPROTO_TCP;
int mnttcp_ok = 1;
int noconn = 0;
char *portspec = NULL; /* Server nfs port; NULL means look up via rpcbind. */

View File

@ -101,14 +101,16 @@ checks the core dump in various ways to make sure that it is complete.
If it passes these checks, it saves the core image in
.Ar directory Ns Pa /vmcore.#
and information about the core in
.Ar directory Ns Pa /info.#
.Ar directory Ns Pa /info.# .
For kernel textdumps generated with the
.Xr textdump 4
facility, output will be stored in the
.Xr tar 5
format and named
.Ar director Ns Pa /textdump.tar.#
The ``#'' is the number from the first line of the file
.Ar directory Ns Pa /textdump.tar.# .
The
.Dq #
is the number from the first line of the file
.Ar directory Ns Pa /bounds ,
and it is incremented and stored back into the file each time
.Nm

View File

@ -293,7 +293,7 @@ main(int argc, char *argv[])
if (targ_fd < 0)
errx(1, "Tried to open %d devices, none available", unit);
else
warnx("opened /dev/targ%d", unit);
warnx("opened %s", targname);
/* The first three are handled by kevent() later */
signal(SIGHUP, SIG_IGN);

View File

@ -2,7 +2,7 @@
.\" Written by Garrett Wollman
.\" This file is in the public domain.
.\"
.Dd July 9, 2009
.Dd September 22, 2009
.Dt PROCFS 5
.Os
.Sh NAME
@ -117,6 +117,12 @@ Not implemented.
.It Pa notepg
Used for sending signal to the process group.
Not implemented.
.It Pa osrel
Allows read and write of the kernel osrel value assigned to the process.
It affects the compatibility shims that are turned on and off
depending on the value.
Initial process value is read from the ABI note tag in the executed ELF image,
and is zero if the tag not supported by binary format or was not found.
.It Pa regs
Allows read and write access to the process' register set.
This file contains a binary data structure
@ -237,6 +243,8 @@ the complete virtual address space of the process
used for signaling the process
.It Pa /proc/curproc/notepg
used for signaling the process group
.It Pa /proc/curproc/osrel
the process osrel value
.It Pa /proc/curproc/regs
the process register set
.It Pa /proc/curproc/rlimit

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd September 2, 2009
.Dd September 17, 2009
.Dt RC.CONF 5
.Os
.Sh NAME
@ -95,6 +95,13 @@ disable informational messages from the rc scripts.
Informational messages are displayed when
a condition that is not serious enough to warrant a warning or
an error occurs.
.It Va rc_startmsgs
.Pq Vt bool
If set to
.Dq Li YES ,
show
.Dq Starting foo:
when faststart is used (e.g., at boot time).
.It Va early_late_divider
.Pq Vt str
The name of the script that should be used as the

View File

@ -253,6 +253,7 @@ MAN= accept_filter.9 \
usbdi.9 \
utopia.9 \
vaccess.9 \
vaccess_acl_nfs4.9 \
vaccess_acl_posix1e.9 \
vcount.9 \
vflush.9 \

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd June 1, 2009
.Dd September 18, 2009
.Os
.Dt VOP_ACCESS 9
.Sh NAME
@ -95,6 +95,7 @@ requested access.
.El
.Sh SEE ALSO
.Xr vaccess 9 ,
.Xr vaccess_acl_nfs4 9 ,
.Xr vaccess_acl_posix1e 9 ,
.Xr vnode 9
.Sh AUTHORS

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 23, 1999
.Dd September 18, 2009
.Os
.Dt ACL 9
.Sh NAME
@ -207,6 +207,7 @@ The following values are valid:
.El
.Sh SEE ALSO
.Xr acl 3 ,
.Xr vaccess_acl_nfs4 9 ,
.Xr vaccess_acl_posix1e 9 ,
.Xr VFS 9 ,
.Xr vnaccess 9 ,

View File

@ -37,7 +37,6 @@
.Nm KFAIL_POINT_GOTO ,
.Nm fail_point ,
.Nm DEBUG_FP
.
.Nd fail points
.Sh SYNOPSIS
.In sys/fail.h
@ -79,7 +78,7 @@ is derived from the
.Fn return
value set in the sysctl MIB.
See
.Sx SYSCTL SETTINGS
.Sx SYSCTL VARIABLES
below.
.Pp
The remaining
@ -100,7 +99,6 @@ is the equivalent of
.Sy KFAIL_POINT_CODE(...,
{ error_var = RETURN_VALUE; goto label;})
.El
.Pp
.Sh SYSCTL VARIABLES
The
.Fn KFAIL_POINT_*
@ -108,28 +106,28 @@ macros add sysctl MIBs where specified.
Many base kernel MIBs can be found in the
.Sy debug.fail_point
tree (referenced in code by
.Sy DEBUG_FP
).
.Sy DEBUG_FP ) .
.Pp
The sysctl variable may be set using the following grammar:
.Pp
.Bd -literal
<fail_point> ::
<term> ( "->" <term> )*
.Pp
<term> ::
( (<float> "%") | (<integer> "*" ) )*
<type>
[ "(" <integer> ")" ]
.Pp
<float> ::
<integer> [ "." <integer> ] |
"." <integer>
.Pp
<type> ::
"off" | "return" | "sleep" | "panic" | "break" | "print"
.Ed
.Pp
The <type>
argument specifies which action to take:
The <type> argument specifies which action to take:
.Bl -tag -width ".Dv return"
.It Sy off
Take no action (does not trigger fail point code)
@ -158,13 +156,13 @@ is evaluated before the count, i.e. "2%5*" means "2% of the time,
but only 5 times total".
.Pp
The operator -> can be used to express cascading terms.
If you specify <term1>-><term2>, it means that if <term1> doesn't
'execute', <term2> is evaluated.
If you specify <term1>-><term2>, it means that if <term1> does not
.Ql execute ,
<term2> is evaluated.
For the purpose of this operator, the return() and print() operators
are the only types that cascade.
A return() term only cascades if the code executes, and a print()
term only cascades when passed a non-zero argument.
.Pp
.Sh EXAMPLES
.Bl -tag
.It Sy sysctl debug.fail_point.foobar="2.1%return(5)"
@ -175,7 +173,7 @@ with RETURN_VALUE set to 5.
2/100ths of the time, execute
.Fa code
with RETURN_VALUE set to 5.
If that doesn't happen, 5% of the time execute
If that does not happen, 5% of the time execute
.Fa code
with RETURN_VALUE set to 22.
.It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)"
@ -186,9 +184,8 @@ Return 5 for 1 in 1000 executions, but only 5 times total.
.It Sy sysctl debug.fail_point.foobar="1%*sleep(50)"
1/100th of the time, sleep 50ms.
.El
.Pp
.Sh CAVEATS
It's easy to shoot yourself in the foot by setting fail points too
It is easy to shoot yourself in the foot by setting fail points too
aggressively or setting too many in combination.
For example, forcing
.Fn malloc
@ -201,7 +198,6 @@ Currently,
.Fn fail_point_eval
does not verify whether the context is appropriate for calling
.Fn msleep .
.Pp
.Sh AUTHORS
.An -nosplit
This manual page was written by

View File

@ -225,7 +225,7 @@ Allocate and initialize a
structure.
This method cannot sleep.
The default method allocates zero'd memory using
.Xr malloc 9.
.Xr malloc 9 .
Drivers should override this method to allocate extended storage
for their own needs.
Memory allocated by the driver must be tagged with
@ -301,7 +301,7 @@ This method is called immediately after each channel change
and must initiate the work to scan a channel and schedule a timer
to advance to the next channel in the scan list.
This callback is done in a sleepable context.
The default method handles active scan work (e.g. sending ProbRequest
The default method handles active scan work (e.g. sending ProbeRequest
frames), and schedules a call to
.Xr ieee80211_scan_next 9
according to the maximum dwell time for the channel.
@ -558,4 +558,4 @@ Device supports Reduced Inter Frame Spacing (RIFS).
.Xr ieee80211_send_action 9 ,
.Xr ieee80211_radiotap_attach 9 ,
.Xr ifnet 9 ,
.Xr malloc 9 .
.Xr malloc 9

View File

@ -191,4 +191,4 @@ Drivers that poll a device to retrieve statistics can use
(instead or in addition).
.Sh SEE ALSO
.Xr ieee80211 9 ,
.Xr ieee80211_output 9 ,
.Xr ieee80211_output 9

View File

@ -112,4 +112,4 @@ Staggering beacon frames is usually superior to bursting frames, up to
about eight vaps, at which point the overhead becomes significant and
the channel becomes noticeably busy anyway.
.Sh SEE ALSO
.Xr ieee80211 9 .
.Xr ieee80211 9

View File

@ -86,6 +86,6 @@ Note that software beacon miss handling is not limited to station mode;
it can be used in any operating mode where beacons from a peer station
are received.
.Sh SEE ALSO
.Xr ieee80211 9 ,
.Xr ieee80211_vap 9 ,
.Xr wpa_supplicant 8 ,
.Xr ieee80211 9 ,
.Xr ieee80211_vap 9

View File

@ -65,10 +65,10 @@
.\"
.Ft int
.Fo ieee80211_crypto_newkey
.Fa "struct ieee80211vap *
.Fa "int cipher
.Fa "int flags
.Fa "struct ieee80211_key *
.Fa "struct ieee80211vap *"
.Fa "int cipher"
.Fa "int flags"
.Fa "struct ieee80211_key *"
.Fc
.\"
.Ft int
@ -141,7 +141,7 @@ so it can reclaim resources.
.Pp
Crypto modules can notify the system of two events.
When a packet replay event is recognized
.Fn ieee80111_notify_replay_failure
.Fn ieee80211_notify_replay_failure
can be used to signal the event.
When a
.Dv TKIP
@ -256,4 +256,4 @@ when receive traffic is active.
.Xr ioctl 2 ,
.Xr wlan_ccmp 4 ,
.Xr wlan_tkip 4 ,
.Xr wlan_wep 4 .
.Xr wlan_wep 4

View File

@ -54,7 +54,7 @@ This is especially important because wireless applications are often
built for embedded environments where cross-machine or post-mortem
debugging facilities like
.Xr kgdb 1
infeasible.
are infeasible.
.Pp
The most commonly used command is
.Bd -literal -offset indent
@ -69,4 +69,4 @@ and
data structures in the system.
.Sh SEE ALSO
.Xr ddb 4 ,
.Xr ieee80211 9 .
.Xr ieee80211 9

View File

@ -113,4 +113,4 @@ Otherwise the values are made available to user applications
(with the rssi presented as a filtered average over the last ten values
and the noise floor the last reported value).
.Sh SEE ALSO
.Xr ieee80211 9 .
.Xr ieee80211 9

View File

@ -248,4 +248,4 @@ then a normal lookup is done without a table update.
.Sh SEE ALSO
.Xr ddb 9
.Xr ieee80211 9 ,
.Xr ieee80211_proto 9 ,
.Xr ieee80211_proto 9

View File

@ -47,9 +47,9 @@
.\"
.Ft void
.Fo ieee80211_process_callback
.Fa struct ieee80211_node *
.Fa struct mbuf *
.Fa int
.Fa "struct ieee80211_node *"
.Fa "struct mbuf *"
.Fa "int"
.Fc
.Sh DESCRIPTION
The
@ -101,7 +101,7 @@ Similarly,
.Nm net80211
handles activities such as background scanning and power save mode,
frames will not be sent to a driver unless it is operating on the
BSS channel will
BSS channel with
.Dq full power .
.Pp
All frames passed to a driver for transmit hold a reference to a

View File

@ -119,7 +119,7 @@ and
.Vt ic_bsschan
are guaranteed to be usable.
.It Dv IEEE80211_S_CSA
Channel Switch Annoucememnt (CSA) is pending.
Channel Switch Announcement (CSA) is pending.
This state is reached only from
.Dv IEEE80211_S_RUN
when either a CSA is received from an access point (in station mode)
@ -229,11 +229,11 @@ handled by
or, in the case of card eject or vap destroy,
work will be initiated outside the driver.
.Sh SEE ALSO
.Xr ioctl 2
.Xr ioctl 2 ,
.Xr wpa_supplicant 8 ,
.Xr ieee80211 9 ,
.Xr ifnet 9
.Xr ifnet 9 ,
.Xr taskqueue 9
.Xr wpa_supplicant 8
.Sh HISTORY
The state machine concept was part of the original
.Nm ieee80211

View File

@ -198,11 +198,11 @@ RF noise power at the antenna, in decibels difference from 1mW.
.\"power as unitless distance from maximum power set at factory calibration.
.\"0 indicates maximum transmit power.
.\"Monotonically nondecreasing with lower power levels.
\.".It Dv IEEE80211_RADIOTAP_DB_TX_ATTENUATION
\."This field contains a single unsigned 16-bit value, expressing transmit
\."power as decibel distance from maximum power set at factory calibration.
\."0 indicates maximum transmit power.
\."Monotonically nondecreasing with lower power levels.
.\".It Dv IEEE80211_RADIOTAP_DB_TX_ATTENUATION
.\"This field contains a single unsigned 16-bit value, expressing transmit
.\"power as decibel distance from maximum power set at factory calibration.
.\"0 indicates maximum transmit power.
.\"Monotonically nondecreasing with lower power levels.
.It Dv IEEE80211_RADIOTAP_DBM_TX_POWER
Transmit power expressed as decibels from a 1mW reference.
This field is a single signed 8-bit value.
@ -223,9 +223,9 @@ This field contains a single unsigned 8-bit value that indicates the
RF noise power at the antenna, in decibels difference from an
arbitrary, fixed reference.
.It Dv IEEE80211_RADIOTAP_XCHANNEL
This field containts four values: a 32-bit unsigned bitmap of
This field contains four values: a 32-bit unsigned bitmap of
flags that describe the channel attributes, a 16-bit unsigned
freqeuncy in MHz (typically the channel center), an 8-bit
frequency in MHz (typically the channel center), an 8-bit
unsigned IEEE channel number, and a signed 8-bit value that
holds the maximum regulatory transmit power cap in .5 dBm
(8 bytes total).
@ -237,10 +237,10 @@ This property supersedes
.Dv IEEE80211_RADIOTAP_CHANNEL
and is the only way to completely express all
channel attributes and the
mapping between channel freqeuncy and IEEE channel number.
mapping between channel frequency and IEEE channel number.
.El
.Sh EXAMPLES
Radiotap receive definitions for the Intersil Prims driver:
Radiotap receive definitions for the Intersil Prism driver:
.Bd -literal -offset indent
#define WI_RX_RADIOTAP_PRESENT \\
((1 << IEEE80211_RADIOTAP_TSFT) \\
@ -298,7 +298,6 @@ definitions first appeared in
.\"
.Sh AUTHORS
.An -nosplit
.Pp
The original version of this manual page was written by
.An Bruce M. Simpson Aq bms@FreeBSD.org
and

View File

@ -112,7 +112,7 @@ routine.
This should be done whenever the channel table contents are modified.
.Pp
The
.Fn ieee80211_alloc_countrie
.Fn ieee80211_alloc_countryie
function allocates an information element as specified by 802.11h.
Because this is expensive to generate it is cached in
.Vt ic_countryie
@ -140,4 +140,4 @@ The exact rules by which to operate are still being codified.
.Sh SEE ALSO
.Xr regdomain 5 ,
.Xr ifconfig 8 ,
.Xr ieee80211 9 .
.Xr ieee80211 9

View File

@ -347,4 +347,4 @@ request.
.Sh SEE ALSO
.Xr ioctl 2 ,
.Xr ieee80211 9 .
.Xr ieee80211_proto 9 .
.Xr ieee80211_proto 9

View File

@ -151,4 +151,4 @@ that beacon are stopped before stopping the hardware timers).
.Sh SEE ALSO
.Xr ieee80211 9 ,
.Xr ifnet 9 ,
.Xr malloc 9 .
.Xr malloc 9

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 22, 2001
.Dd September 18, 2009
.Os
.Dt VACCESS 9
.Sh NAME
@ -117,6 +117,7 @@ An attempt was made to perform an operation limited to processes with
appropriate privileges or to the owner of a file or other resource.
.El
.Sh SEE ALSO
.Xr vaccess_acl_nfs4 9 ,
.Xr vaccess_acl_posix1e 9 ,
.Xr vnode 9 ,
.Xr VOP_ACCESS 9

View File

@ -0,0 +1,129 @@
.\"-
.\" Copyright (c) 2001 Robert N. M. Watson
.\" 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 September 18, 2009
.Os
.Dt VACCESS_ACL_NFS4 9
.Sh NAME
.Nm vaccess_acl_nfs4
.Nd generate a NFSv4 ACL access control decision using vnode parameters
.Sh SYNOPSIS
.In sys/param.h
.In sys/vnode.h
.In sys/acl.h
.Ft int
.Fo vaccess_acl_nfs4
.Fa "enum vtype type"
.Fa "uid_t file_uid"
.Fa "gid_t file_gid"
.Fa "struct acl *acl"
.Fa "accmode_t accmode"
.Fa "struct ucred *cred"
.Fa "int *privused"
.Fc
.Sh DESCRIPTION
This call implements the logic for the
.Ux
discretionary file security model
with NFSv4 ACL extensions.
It accepts the vnodes type
.Fa type ,
owning UID
.Fa file_uid ,
owning GID
.Fa file_gid ,
access ACL for the file
.Fa acl ,
desired access mode
.Fa accmode ,
requesting credential
.Fa cred ,
and an optional call-by-reference
.Vt int
pointer returning whether or not
privilege was required for successful evaluation of the call; the
.Fa privused
pointer may be set to
.Dv NULL
by the caller in order not to be informed of
privilege information, or it may point to an integer that will be set to
1 if privilege is used, and 0 otherwise.
.Pp
This call is intended to support implementations of
.Xr VOP_ACCESS 9 ,
which will use their own access methods to retrieve the vnode properties,
and then invoke
.Fn vaccess_acl_nfs4
in order to perform the actual check.
Implementations of
.Xr VOP_ACCESS 9
may choose to implement additional security mechanisms whose results will
be composed with the return value.
.Pp
The algorithm used by
.Fn vaccess_acl_nfs4
is based on the NFSv4 ACL evaluation algorithm, as described in
NFSv4 Minor Version 1, draft-ietf-nfsv4-minorversion1-21.txt.
The algorithm selects a
.Em matching
entry from the access ACL, which may
then be composed with an available ACL mask entry, providing
.Ux
security compatibility.
.Pp
Once appropriate protections are selected for the current credential,
the requested access mode, in combination with the vnode type, will be
compared with the discretionary rights available for the credential.
If the rights granted by discretionary protections are insufficient,
then super-user privilege, if available for the credential, will also be
considered.
.Sh RETURN VALUES
.Fn vaccess_acl_nfs4
will return 0 on success, or a non-zero error value on failure.
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er EACCES
Permission denied.
An attempt was made to access a file in a way forbidden by its file access
permissions.
.It Bq Er EPERM
Operation not permitted.
An attempt was made to perform an operation limited to processes with
appropriate privileges or to the owner of a file or other resource.
.El
.Sh SEE ALSO
.Xr vaccess 9 ,
.Xr vnode 9 ,
.Xr VOP_ACCESS 9
.Sh AUTHORS
Current implementation of
.Fn vaccess_acl_nfs4
was written by
.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
.Sh BUGS
This manual page should include a full description of the NFSv4 ACL
evaluation algorithm, or cross reference another page that does.

View File

@ -229,6 +229,7 @@ FreeBSD 5.2 | | | |
| | | | | DragonFly 2.2.0
| FreeBSD 7.2 | NetBSD 5.0 OpenBSD 4.5 |
| | | | | |
| | | | | DragonFly 2.4.0
| V | | | |
| | | | |
FreeBSD 8 -current | NetBSD -current OpenBSD -current |
@ -502,6 +503,7 @@ DragonFly 2.2.0 2009-02-17 [DFB]
NetBSD 5.0 2009-04-29 [NBD]
OpenBSD 4.5 2009-05-01 [OBD]
FreeBSD 7.2 2009-05-04 [FBD]
DragonFly 2.4.0 2009-09-16 [DFB]
Bibliography
------------------------

View File

@ -42,7 +42,7 @@ BZ BLZ 084 Belize
BJ BEN 204 Benin
BM BMU 060 Bermuda
BT BTN 064 Bhutan
BO BOL 068 Bolivia
BO BOL 068 Bolivia, Plurinational State of
BA BIH 070 Bosnia and Herzegovina
BW BWA 072 Botswana
BV BVT 074 Bouvet Island
@ -253,7 +253,7 @@ UY URY 858 Uruguay
UZ UZB 860 Uzbekistan
VU VUT 548 Vanuatu
VA VAT 336 Holy See (Vatican City State)
VE VEN 862 Venezuela
VE VEN 862 Venezuela, Bolivarian Republic of
VN VNM 704 Viet Nam
VG VGB 092 Virgin Islands, British
VI VIR 850 Virgin Islands, U.S.
@ -518,3 +518,19 @@ ZW ZWE 716 Zimbabwe
#
# Newsletter VI-1 2007-09-21
# Added SAINT BARTHELEMY (BL) and SAINT MARTIN (MF).
#
# Newsletter VI-2 2008-04-25
# Name changes for Moldova, Montenegro and other minor corrections.
#
# Newsletter VI-3 2008-09-09
# Name change for Nepal and other minor corrections.
# Not relevant to this file.
#
# Newsletter VI-4 2009-01-07
# Name change for the Republic of Moldova and other minor corrections.
#
# Newsletter VI-5 2009-03-03
# Name change for Bolivarian Republic of Venezuela and other minor corrections.
#
# Newsletter VI-6 2009-05-08
# Name change for Plurinational State of Bolivia.

View File

@ -32,8 +32,12 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/actables.h>
#include <dev/acpica/acpivar.h>
@ -99,6 +103,246 @@ acpi_cpu_c1()
__asm __volatile("sti; hlt");
}
/*
* Support for mapping ACPI tables during early boot. Currently this
* uses the crashdump map to map each table. However, the crashdump
* map is created in pmap_bootstrap() right after the direct map, so
* we should be able to just use pmap_mapbios() here instead.
*
* This makes the following assumptions about how we use this KVA:
* pages 0 and 1 are used to map in the header of each table found via
* the RSDT or XSDT and pages 2 to n are used to map in the RSDT or
* XSDT. This has to use 2 pages for the table headers in case a
* header spans a page boundary.
*
* XXX: We don't ensure the table fits in the available address space
* in the crashdump map.
*/
/*
* Map some memory using the crashdump map. 'offset' is an offset in
* pages into the crashdump map to use for the start of the mapping.
*/
static void *
table_map(vm_paddr_t pa, int offset, vm_offset_t length)
{
vm_offset_t va, off;
void *data;
off = pa & PAGE_MASK;
length = roundup(length + off, PAGE_SIZE);
pa = pa & PG_FRAME;
va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
(offset * PAGE_SIZE);
data = (void *)(va + off);
length -= PAGE_SIZE;
while (length > 0) {
va += PAGE_SIZE;
pa += PAGE_SIZE;
length -= PAGE_SIZE;
pmap_kenter(va, pa);
invlpg(va);
}
return (data);
}
/* Unmap memory previously mapped with table_map(). */
static void
table_unmap(void *data, vm_offset_t length)
{
vm_offset_t va, off;
va = (vm_offset_t)data;
off = va & PAGE_MASK;
length = roundup(length + off, PAGE_SIZE);
va &= ~PAGE_MASK;
while (length > 0) {
pmap_kremove(va);
invlpg(va);
va += PAGE_SIZE;
length -= PAGE_SIZE;
}
}
/*
* Map a table at a given offset into the crashdump map. It first
* maps the header to determine the table length and then maps the
* entire table.
*/
static void *
map_table(vm_paddr_t pa, int offset, const char *sig)
{
ACPI_TABLE_HEADER *header;
vm_offset_t length;
void *table;
header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
table_unmap(header, sizeof(ACPI_TABLE_HEADER));
return (NULL);
}
length = header->Length;
table_unmap(header, sizeof(ACPI_TABLE_HEADER));
table = table_map(pa, offset, length);
if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
if (bootverbose)
printf("ACPI: Failed checksum for table %s\n", sig);
table_unmap(table, length);
return (NULL);
}
return (table);
}
/*
* See if a given ACPI table is the requested table. Returns the
* length of the able if it matches or zero on failure.
*/
static int
probe_table(vm_paddr_t address, const char *sig)
{
ACPI_TABLE_HEADER *table;
table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
if (table == NULL) {
if (bootverbose)
printf("ACPI: Failed to map table at 0x%jx\n",
(uintmax_t)address);
return (0);
}
if (bootverbose)
printf("Table '%.4s' at 0x%jx\n", table->Signature,
(uintmax_t)address);
if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) {
table_unmap(table, sizeof(ACPI_TABLE_HEADER));
return (0);
}
table_unmap(table, sizeof(ACPI_TABLE_HEADER));
return (1);
}
/*
* Try to map a table at a given physical address previously returned
* by acpi_find_table().
*/
void *
acpi_map_table(vm_paddr_t pa, const char *sig)
{
return (map_table(pa, 0, sig));
}
/* Unmap a table previously mapped via acpi_map_table(). */
void
acpi_unmap_table(void *table)
{
ACPI_TABLE_HEADER *header;
header = (ACPI_TABLE_HEADER *)table;
table_unmap(table, header->Length);
}
/*
* Return the physical address of the requested table or zero if one
* is not found.
*/
vm_paddr_t
acpi_find_table(const char *sig)
{
ACPI_PHYSICAL_ADDRESS rsdp_ptr;
ACPI_TABLE_RSDP *rsdp;
ACPI_TABLE_RSDT *rsdt;
ACPI_TABLE_XSDT *xsdt;
ACPI_TABLE_HEADER *table;
vm_paddr_t addr;
int i, count;
if (resource_disabled("acpi", 0))
return (0);
/*
* Map in the RSDP. Since ACPI uses AcpiOsMapMemory() which in turn
* calls pmap_mapbios() to find the RSDP, we assume that we can use
* pmap_mapbios() to map the RSDP.
*/
if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
return (0);
rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
if (rsdp == NULL) {
if (bootverbose)
printf("ACPI: Failed to map RSDP\n");
return (0);
}
/*
* For ACPI >= 2.0, use the XSDT if it is available.
* Otherwise, use the RSDT. We map the XSDT or RSDT at page 2
* in the crashdump area. Pages 0 and 1 are used to map in the
* headers of candidate ACPI tables.
*/
addr = 0;
if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
/*
* AcpiOsGetRootPointer only verifies the checksum for
* the version 1.0 portion of the RSDP. Version 2.0 has
* an additional checksum that we verify first.
*/
if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
if (bootverbose)
printf("ACPI: RSDP failed extended checksum\n");
return (0);
}
xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
if (xsdt == NULL) {
if (bootverbose)
printf("ACPI: Failed to map XSDT\n");
return (0);
}
count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
sizeof(UINT64);
for (i = 0; i < count; i++)
if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
addr = xsdt->TableOffsetEntry[i];
break;
}
acpi_unmap_table(xsdt);
} else {
rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT);
if (rsdt == NULL) {
if (bootverbose)
printf("ACPI: Failed to map RSDT\n");
return (0);
}
count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
sizeof(UINT32);
for (i = 0; i < count; i++)
if (probe_table(rsdt->TableOffsetEntry[i], sig)) {
addr = rsdt->TableOffsetEntry[i];
break;
}
acpi_unmap_table(rsdt);
}
pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
if (addr == 0) {
if (bootverbose)
printf("ACPI: No %s table found\n", sig);
return (0);
}
if (bootverbose)
printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
/*
* Verify that we can map the full table and that its checksum is
* correct, etc.
*/
table = map_table(addr, 0, sig);
if (table == NULL)
return (0);
acpi_unmap_table(table);
return (addr);
}
/*
* ACPI nexus(4) driver.
*/

View File

@ -36,27 +36,19 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/smp.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <machine/apicreg.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
#include <machine/apicvar.h>
#include <machine/md_var.h>
#include <machine/specialreg.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/actables.h>
#include <dev/acpica/acpivar.h>
#include <dev/pci/pcivar.h>
typedef void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg);
/* These two arrays are indexed by APIC IDs. */
struct ioapic_info {
void *io_apic;
@ -79,8 +71,6 @@ static enum intr_polarity interrupt_polarity(UINT16 IntiFlags, UINT8 Source);
static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source);
static int madt_find_cpu(u_int acpi_id, u_int *apic_id);
static int madt_find_interrupt(int intr, void **apic, u_int *pin);
static void *madt_map(vm_paddr_t pa, int offset, vm_offset_t length);
static void *madt_map_table(vm_paddr_t pa, int offset, const char *sig);
static void madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg);
static void madt_parse_interrupt_override(
ACPI_MADT_INTERRUPT_OVERRIDE *intr);
@ -92,13 +82,10 @@ static int madt_probe(void);
static int madt_probe_cpus(void);
static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
void *arg __unused);
static int madt_probe_table(vm_paddr_t address);
static void madt_register(void *dummy);
static int madt_setup_local(void);
static int madt_setup_io(void);
static void madt_unmap(void *data, vm_offset_t length);
static void madt_unmap_table(void *table);
static void madt_walk_table(madt_entry_handler *handler, void *arg);
static void madt_walk_table(acpi_subtable_handler *handler, void *arg);
static struct apic_enumerator madt_enumerator = {
"MADT",
@ -108,214 +95,19 @@ static struct apic_enumerator madt_enumerator = {
madt_setup_io
};
/*
* Code to abuse the crashdump map to map in the tables for the early
* probe. We cheat and make the following assumptions about how we
* use this KVA: pages 0 and 1 are used to map in the header of each
* table found via the RSDT or XSDT and pages 2 to n are used to map
* in the RSDT or XSDT. We have to use 2 pages for the table headers
* in case a header spans a page boundary. The offset is in pages;
* the length is in bytes.
*/
static void *
madt_map(vm_paddr_t pa, int offset, vm_offset_t length)
{
vm_offset_t va, off;
void *data;
off = pa & PAGE_MASK;
length = roundup(length + off, PAGE_SIZE);
pa = pa & PG_FRAME;
va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
(offset * PAGE_SIZE);
data = (void *)(va + off);
length -= PAGE_SIZE;
while (length > 0) {
va += PAGE_SIZE;
pa += PAGE_SIZE;
length -= PAGE_SIZE;
pmap_kenter(va, pa);
invlpg(va);
}
return (data);
}
static void
madt_unmap(void *data, vm_offset_t length)
{
vm_offset_t va, off;
va = (vm_offset_t)data;
off = va & PAGE_MASK;
length = roundup(length + off, PAGE_SIZE);
va &= ~PAGE_MASK;
while (length > 0) {
pmap_kremove(va);
invlpg(va);
va += PAGE_SIZE;
length -= PAGE_SIZE;
}
}
static void *
madt_map_table(vm_paddr_t pa, int offset, const char *sig)
{
ACPI_TABLE_HEADER *header;
vm_offset_t length;
void *table;
header = madt_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
return (NULL);
}
length = header->Length;
madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
table = madt_map(pa, offset, length);
if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
if (bootverbose)
printf("MADT: Failed checksum for table %s\n", sig);
madt_unmap(table, length);
return (NULL);
}
return (table);
}
static void
madt_unmap_table(void *table)
{
ACPI_TABLE_HEADER *header;
header = (ACPI_TABLE_HEADER *)table;
madt_unmap(table, header->Length);
}
/*
* Look for an ACPI Multiple APIC Description Table ("APIC")
*/
static int
madt_probe(void)
{
ACPI_PHYSICAL_ADDRESS rsdp_ptr;
ACPI_TABLE_RSDP *rsdp;
ACPI_TABLE_RSDT *rsdt;
ACPI_TABLE_XSDT *xsdt;
int i, count;
if (resource_disabled("acpi", 0))
madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
if (madt_physaddr == 0)
return (ENXIO);
/*
* Map in the RSDP. Since ACPI uses AcpiOsMapMemory() which in turn
* calls pmap_mapbios() to find the RSDP, we assume that we can use
* pmap_mapbios() to map the RSDP.
*/
if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
return (ENXIO);
rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
if (rsdp == NULL) {
if (bootverbose)
printf("MADT: Failed to map RSDP\n");
return (ENXIO);
}
/*
* For ACPI >= 2.0, use the XSDT if it is available.
* Otherwise, use the RSDT. We map the XSDT or RSDT at page 1
* in the crashdump area. Page 0 is used to map in the
* headers of candidate ACPI tables.
*/
if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
/*
* AcpiOsGetRootPointer only verifies the checksum for
* the version 1.0 portion of the RSDP. Version 2.0 has
* an additional checksum that we verify first.
*/
if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
if (bootverbose)
printf("MADT: RSDP failed extended checksum\n");
return (ENXIO);
}
xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 2,
ACPI_SIG_XSDT);
if (xsdt == NULL) {
if (bootverbose)
printf("MADT: Failed to map XSDT\n");
return (ENXIO);
}
count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
sizeof(UINT64);
for (i = 0; i < count; i++)
if (madt_probe_table(xsdt->TableOffsetEntry[i]))
break;
madt_unmap_table(xsdt);
} else {
rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 2,
ACPI_SIG_RSDT);
if (rsdt == NULL) {
if (bootverbose)
printf("MADT: Failed to map RSDT\n");
return (ENXIO);
}
count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
sizeof(UINT32);
for (i = 0; i < count; i++)
if (madt_probe_table(rsdt->TableOffsetEntry[i]))
break;
madt_unmap_table(rsdt);
}
pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
if (madt_physaddr == 0) {
if (bootverbose)
printf("MADT: No MADT table found\n");
return (ENXIO);
}
if (bootverbose)
printf("MADT: Found table at 0x%jx\n",
(uintmax_t)madt_physaddr);
/*
* Verify that we can map the full table and that its checksum is
* correct, etc.
*/
madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
if (madt == NULL)
return (ENXIO);
madt_unmap_table(madt);
madt = NULL;
return (0);
}
/*
* See if a given ACPI table is the MADT.
*/
static int
madt_probe_table(vm_paddr_t address)
{
ACPI_TABLE_HEADER *table;
table = madt_map(address, 0, sizeof(ACPI_TABLE_HEADER));
if (table == NULL) {
if (bootverbose)
printf("MADT: Failed to map table at 0x%jx\n",
(uintmax_t)address);
return (0);
}
if (bootverbose)
printf("Table '%.4s' at 0x%jx\n", table->Signature,
(uintmax_t)address);
if (strncmp(table->Signature, ACPI_SIG_MADT, ACPI_NAME_SIZE) != 0) {
madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
return (0);
}
madt_physaddr = address;
madt_length = table->Length;
madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
return (1);
}
/*
* Run through the MP table enumerating CPUs.
*/
@ -323,10 +115,11 @@ static int
madt_probe_cpus(void)
{
madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
madt_length = madt->Header.Length;
KASSERT(madt != NULL, ("Unable to re-map MADT"));
madt_walk_table(madt_probe_cpus_handler, NULL);
madt_unmap_table(madt);
acpi_unmap_table(madt);
madt = NULL;
return (0);
}
@ -417,17 +210,11 @@ SYSINIT(madt_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST,
* Call the handler routine for each entry in the MADT table.
*/
static void
madt_walk_table(madt_entry_handler *handler, void *arg)
madt_walk_table(acpi_subtable_handler *handler, void *arg)
{
ACPI_SUBTABLE_HEADER *entry;
u_char *p, *end;
end = (u_char *)(madt) + madt->Header.Length;
for (p = (u_char *)(madt + 1); p < end; ) {
entry = (ACPI_SUBTABLE_HEADER *)p;
handler(entry, arg);
p += entry->Length;
}
acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
handler, arg);
}
static void

View File

@ -1192,6 +1192,77 @@ isa_irq_pending(void)
u_int basemem;
static int
add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp)
{
int i, insert_idx, physmap_idx;
physmap_idx = *physmap_idxp;
if (boothowto & RB_VERBOSE)
printf("SMAP type=%02x base=%016lx len=%016lx\n",
smap->type, smap->base, smap->length);
if (smap->type != SMAP_TYPE_MEMORY)
return (1);
if (smap->length == 0)
return (0);
/*
* Find insertion point while checking for overlap. Start off by
* assuming the new entry will be added to the end.
*/
insert_idx = physmap_idx + 2;
for (i = 0; i <= physmap_idx; i += 2) {
if (smap->base < physmap[i + 1]) {
if (smap->base + smap->length <= physmap[i]) {
insert_idx = i;
break;
}
if (boothowto & RB_VERBOSE)
printf(
"Overlapping memory regions, ignoring second region\n");
return (1);
}
}
/* See if we can prepend to the next entry. */
if (insert_idx <= physmap_idx &&
smap->base + smap->length == physmap[insert_idx]) {
physmap[insert_idx] = smap->base;
return (1);
}
/* See if we can append to the previous entry. */
if (insert_idx > 0 && smap->base == physmap[insert_idx - 1]) {
physmap[insert_idx - 1] += smap->length;
return (1);
}
physmap_idx += 2;
*physmap_idxp = physmap_idx;
if (physmap_idx == PHYSMAP_SIZE) {
printf(
"Too many segments in the physical address map, giving up\n");
return (0);
}
/*
* Move the last 'N' entries down to make room for the new
* entry if needed.
*/
for (i = physmap_idx; i > insert_idx; i -= 2) {
physmap[i] = physmap[i - 2];
physmap[i + 1] = physmap[i - 1];
}
/* Insert the new entry. */
physmap[insert_idx] = smap->base;
physmap[insert_idx + 1] = smap->base + smap->length;
return (1);
}
/*
* Populate the (physmap) array with base/bound pairs describing the
* available physical memory in the system, then test this memory and
@ -1235,40 +1306,9 @@ getmemsize(caddr_t kmdp, u_int64_t first)
smapsize = *((u_int32_t *)smapbase - 1);
smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize);
for (smap = smapbase; smap < smapend; smap++) {
if (boothowto & RB_VERBOSE)
printf("SMAP type=%02x base=%016lx len=%016lx\n",
smap->type, smap->base, smap->length);
if (smap->type != SMAP_TYPE_MEMORY)
continue;
if (smap->length == 0)
continue;
for (i = 0; i <= physmap_idx; i += 2) {
if (smap->base < physmap[i + 1]) {
if (boothowto & RB_VERBOSE)
printf(
"Overlapping or non-monotonic memory region, ignoring second region\n");
continue;
}
}
if (smap->base == physmap[physmap_idx + 1]) {
physmap[physmap_idx + 1] += smap->length;
continue;
}
physmap_idx += 2;
if (physmap_idx == PHYSMAP_SIZE) {
printf(
"Too many segments in the physical address map, giving up\n");
for (smap = smapbase; smap < smapend; smap++)
if (!add_smap_entry(smap, physmap, &physmap_idx))
break;
}
physmap[physmap_idx] = smap->base;
physmap[physmap_idx + 1] = smap->base + smap->length;
}
/*
* Find the 'base memory' segment for SMP

View File

@ -701,6 +701,11 @@ pmap_init(void)
* Are large page mappings enabled?
*/
TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
if (pg_ps_enabled) {
KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0,
("pmap_init: can't assign to pagesizes[1]"));
pagesizes[1] = NBPDR;
}
/*
* Calculate the size of the pv head table for superpages.

View File

@ -253,6 +253,11 @@ trap(struct trapframe *frame)
}
#endif
if (type == T_RESERVED) {
trap_fatal(frame, 0);
goto out;
}
#ifdef HWPMC_HOOKS
/*
* CPU PMCs interrupt using an NMI. If the PMC module is
@ -500,8 +505,11 @@ trap(struct trapframe *frame)
* XXX this should be fatal unless the kernel has
* registered such use.
*/
fpudna();
printf("fpudna in kernel mode!\n");
#ifdef KDB
kdb_backtrace();
#endif
fpudna();
goto out;
case T_STKFLT: /* stack fault */

View File

@ -154,12 +154,17 @@ options AGP_DEBUG
#####################################################################
# HARDWARE DEVICE CONFIGURATION
# To include support for VGA VESA video modes (depends on X86EMU)
# To include support for VGA VESA video modes
options VESA
# Turn on extra debugging checks and output for VESA support.
options VESA_DEBUG
device dpms # DPMS suspend & resume via VESA BIOS
# x86 real mode BIOS emulator, required by atkbdc/dpms/vesa
options X86BIOS
#
# Optional devices:
#
@ -219,6 +224,9 @@ options VGA_WIDTH90 # support 90 column modes
# Debugging.
options VGA_DEBUG
# Linear framebuffer driver for S3 VESA 1.2 cards. Works on top of VESA.
device s3pci
# 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create
# the /dev/3dfx0 device to work with glide implementations. This should get
# linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as

View File

@ -77,5 +77,8 @@ extern int acpi_release_global_lock(uint32_t *lock);
void acpi_SetDefaultIntrModel(int model);
void acpi_cpu_c1(void);
void *acpi_map_table(vm_paddr_t pa, const char *sig);
void acpi_unmap_table(void *table);
vm_paddr_t acpi_find_table(const char *sig);
#endif /* __ACPICA_MACHDEP_H__ */

View File

@ -108,6 +108,8 @@
#define NBPML4 (1ul<<PML4SHIFT)/* bytes/page map lev4 table */
#define PML4MASK (NBPML4-1)
#define MAXPAGESIZES 3 /* maximum number of supported page sizes */
#define IOPAGES 2 /* pages of i/o permission bitmap */
#ifndef KSTACK_PAGES

View File

@ -181,9 +181,9 @@ pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes)
{
int dataport = 0;
if (bus <= PCI_BUSMAX && slot < 32 && func <= PCI_FUNCMAX &&
reg <= PCI_REGMAX && bytes != 3 && (unsigned) bytes <= 4 &&
(reg & (bytes - 1)) == 0) {
if (bus <= PCI_BUSMAX && slot <= PCI_SLOTMAX && func <= PCI_FUNCMAX &&
(unsigned)reg <= PCI_REGMAX && bytes != 3 &&
(unsigned)bytes <= 4 && (reg & (bytes - 1)) == 0) {
outl(CONF1_ADDR_PORT, (1 << 31) | (bus << 16) | (slot << 11)
| (func << 8) | (reg & ~0x03));
dataport = CONF1_DATA_PORT + (reg & 0x03);
@ -281,7 +281,7 @@ pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
* fall back to using type 1 config access instead.
*/
if (pci_cfgregopen() != 0) {
for (slot = 0; slot < 32; slot++) {
for (slot = 0; slot <= PCI_SLOTMAX; slot++) {
val1 = pcireg_cfgread(0, slot, 0, 0, 4);
if (val1 == 0xffffffff)
continue;
@ -309,8 +309,8 @@ pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
volatile vm_offset_t va;
int data = -1;
if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
func > PCI_FUNCMAX || reg >= 0x1000)
if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
func > PCI_FUNCMAX || reg > PCIE_REGMAX)
return (-1);
va = PCIE_VADDR(pcie_base, reg, bus, slot, func);
@ -336,8 +336,8 @@ pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
{
volatile vm_offset_t va;
if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
func > PCI_FUNCMAX || reg >= 0x1000)
if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
func > PCI_FUNCMAX || reg > PCIE_REGMAX)
return;
va = PCIE_VADDR(pcie_base, reg, bus, slot, func);

View File

@ -92,6 +92,8 @@
#define NBPDR (1 << PDR_SHIFT)
#define NPDEPG (1 << (32 - PDR_SHIFT))
#define MAXPAGESIZES 1 /* maximum number of supported page sizes */
#ifndef KSTACK_PAGES
#define KSTACK_PAGES 2
#endif /* !KSTACK_PAGES */

View File

@ -1034,8 +1034,13 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb)
cam_error_print(saved_ccb, CAM_ESF_ALL,
CAM_EPF_ALL);
#endif
xpt_done_ccb = TRUE;
} else {
saved_ccb->ccb_h.status &=
~CAM_STATUS_MASK;
saved_ccb->ccb_h.status |=
CAM_AUTOSENSE_FAIL;
}
xpt_done_ccb = TRUE;
}
}
bcopy(done_ccb->ccb_h.saved_ccb_ptr, done_ccb,

View File

@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/devicestat.h>
#include <sys/proc.h>
/* Includes to support callout */
#include <sys/types.h>
#include <sys/systm.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
@ -50,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <cam/cam_sim.h>
#include <cam/scsi/scsi_targetio.h>
/* Transaction information attached to each CCB sent by the user */
struct targ_cmd_descr {
struct cam_periph_map_info mapinfo;
@ -92,6 +96,8 @@ struct targ_softc {
targ_state state;
struct selinfo read_select;
struct devstat device_stats;
struct callout destroy_dev_callout;
struct mtx destroy_mtx;
};
static d_open_t targopen;
@ -154,6 +160,7 @@ static void abort_all_pending(struct targ_softc *softc);
static void notify_user(struct targ_softc *softc);
static int targcamstatus(cam_status status);
static size_t targccblen(xpt_opcode func_code);
static void targdestroy(void *);
static struct periph_driver targdriver =
{
@ -211,10 +218,18 @@ targclose(struct cdev *dev, int flag, int fmt, struct thread *td)
int error;
softc = (struct targ_softc *)dev->si_drv1;
if ((softc->periph == NULL) ||
(softc->state & TARG_STATE_LUN_ENABLED) == 0) {
mtx_init(&softc->destroy_mtx, "targ_destroy", "SCSI Target dev destroy", MTX_DEF);
callout_init_mtx(&softc->destroy_dev_callout, &softc->destroy_mtx, CALLOUT_RETURNUNLOCKED);
if (softc->periph == NULL) {
#if 0
destroy_dev(dev);
free(softc, M_TARG);
#endif
printf("%s: destroying non-enabled target\n", __func__);
mtx_lock(&softc->destroy_mtx);
callout_reset(&softc->destroy_dev_callout, hz / 2,
(void *)targdestroy, (void *)dev);
mtx_unlock(&softc->destroy_mtx);
return (0);
}
@ -226,18 +241,23 @@ targclose(struct cdev *dev, int flag, int fmt, struct thread *td)
cam_periph_acquire(periph);
cam_periph_lock(periph);
error = targdisable(softc);
if (error == CAM_REQ_CMP) {
dev->si_drv1 = 0;
if (softc->periph != NULL) {
cam_periph_invalidate(softc->periph);
softc->periph = NULL;
}
destroy_dev(dev);
free(softc, M_TARG);
if (softc->periph != NULL) {
cam_periph_invalidate(softc->periph);
softc->periph = NULL;
}
cam_periph_unlock(periph);
cam_periph_release(periph);
#if 0
destroy_dev(dev);
free(softc, M_TARG);
#endif
printf("%s: close finished error(%d)\n", __func__, error);
mtx_lock(&softc->destroy_mtx);
callout_reset(&softc->destroy_dev_callout, hz / 2,
(void *)targdestroy, (void *)dev);
mtx_unlock(&softc->destroy_mtx);
return (error);
}
@ -821,7 +841,9 @@ targdone(struct cam_periph *periph, union ccb *done_ccb)
case XPT_CONT_TARGET_IO:
TAILQ_INSERT_TAIL(&softc->user_ccb_queue, &done_ccb->ccb_h,
periph_links.tqe);
cam_periph_unlock(softc->periph);
notify_user(softc);
cam_periph_lock(softc->periph);
break;
default:
panic("targdone: impossible xpt opcode %#x",
@ -969,13 +991,19 @@ targgetccb(struct targ_softc *softc, xpt_opcode type, int priority)
int ccb_len;
ccb_len = targccblen(type);
ccb = malloc(ccb_len, M_TARG, M_WAITOK);
ccb = malloc(ccb_len, M_TARG, M_NOWAIT);
CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb));
if (ccb == NULL) {
return (ccb);
}
xpt_setup_ccb(&ccb->ccb_h, softc->path, priority);
ccb->ccb_h.func_code = type;
ccb->ccb_h.cbfcnp = targdone;
ccb->ccb_h.targ_descr = targgetdescr(softc);
if (ccb->ccb_h.targ_descr == NULL) {
free (ccb, M_TARG);
ccb = NULL;
}
return (ccb);
}
@ -1013,8 +1041,10 @@ targgetdescr(struct targ_softc *softc)
struct targ_cmd_descr *descr;
descr = malloc(sizeof(*descr), M_TARG,
M_WAITOK);
descr->mapinfo.num_bufs_used = 0;
M_NOWAIT);
if (descr) {
descr->mapinfo.num_bufs_used = 0;
}
return (descr);
}
@ -1094,8 +1124,11 @@ abort_all_pending(struct targ_softc *softc)
/* If we aborted anything from the work queue, wakeup user. */
if (!TAILQ_EMPTY(&softc->user_ccb_queue)
|| !TAILQ_EMPTY(&softc->abort_queue))
|| !TAILQ_EMPTY(&softc->abort_queue)) {
cam_periph_unlock(softc->periph);
notify_user(softc);
cam_periph_lock(softc->periph);
}
}
/* Notify the user that data is ready */
@ -1188,3 +1221,25 @@ targccblen(xpt_opcode func_code)
return (len);
}
/*
* work around to destroy targ device
* outside of targclose
*/
static void
targdestroy(void *dev)
{
struct cdev *device = (struct cdev *)dev;
struct targ_softc *softc = (struct targ_softc *)device->si_drv1;
#if 0
callout_stop(&softc->destroy_dev_callout);
#endif
mtx_unlock(&softc->destroy_mtx);
mtx_destroy(&softc->destroy_mtx);
free(softc, M_TARG);
device->si_drv1 = 0;
destroy_dev(device);
printf("%s: destroyed dev\n", __func__);
}

View File

@ -19,11 +19,111 @@
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Fletcher Checksums
* ------------------
*
* ZFS's 2nd and 4th order Fletcher checksums are defined by the following
* recurrence relations:
*
* a = a + f
* i i-1 i-1
*
* b = b + a
* i i-1 i
*
* c = c + b (fletcher-4 only)
* i i-1 i
*
* d = d + c (fletcher-4 only)
* i i-1 i
*
* Where
* a_0 = b_0 = c_0 = d_0 = 0
* and
* f_0 .. f_(n-1) are the input data.
*
* Using standard techniques, these translate into the following series:
*
* __n_ __n_
* \ | \ |
* a = > f b = > i * f
* n /___| n - i n /___| n - i
* i = 1 i = 1
*
*
* __n_ __n_
* \ | i*(i+1) \ | i*(i+1)*(i+2)
* c = > ------- f d = > ------------- f
* n /___| 2 n - i n /___| 6 n - i
* i = 1 i = 1
*
* For fletcher-2, the f_is are 64-bit, and [ab]_i are 64-bit accumulators.
* Since the additions are done mod (2^64), errors in the high bits may not
* be noticed. For this reason, fletcher-2 is deprecated.
*
* For fletcher-4, the f_is are 32-bit, and [abcd]_i are 64-bit accumulators.
* A conservative estimate of how big the buffer can get before we overflow
* can be estimated using f_i = 0xffffffff for all i:
*
* % bc
* f=2^32-1;d=0; for (i = 1; d<2^64; i++) { d += f*i*(i+1)*(i+2)/6 }; (i-1)*4
* 2264
* quit
* %
*
* So blocks of up to 2k will not overflow. Our largest block size is
* 128k, which has 32k 4-byte words, so we can compute the largest possible
* accumulators, then divide by 2^64 to figure the max amount of overflow:
*
* % bc
* a=b=c=d=0; f=2^32-1; for (i=1; i<=32*1024; i++) { a+=f; b+=a; c+=b; d+=c }
* a/2^64;b/2^64;c/2^64;d/2^64
* 0
* 0
* 1365
* 11186858
* quit
* %
*
* So a and b cannot overflow. To make sure each bit of input has some
* effect on the contents of c and d, we can look at what the factors of
* the coefficients in the equations for c_n and d_n are. The number of 2s
* in the factors determines the lowest set bit in the multiplier. Running
* through the cases for n*(n+1)/2 reveals that the highest power of 2 is
* 2^14, and for n*(n+1)*(n+2)/6 it is 2^15. So while some data may overflow
* the 64-bit accumulators, every bit of every f_i effects every accumulator,
* even for 128k blocks.
*
* If we wanted to make a stronger version of fletcher4 (fletcher4c?),
* we could do our calculations mod (2^32 - 1) by adding in the carries
* periodically, and store the number of carries in the top 32-bits.
*
* --------------------
* Checksum Performance
* --------------------
*
* There are two interesting components to checksum performance: cached and
* uncached performance. With cached data, fletcher-2 is about four times
* faster than fletcher-4. With uncached data, the performance difference is
* negligible, since the cost of a cache fill dominates the processing time.
* Even though fletcher-4 is slower than fletcher-2, it is still a pretty
* efficient pass over the data.
*
* In normal operation, the data which is being checksummed is in a buffer
* which has been filled either by:
*
* 1. a compression step, which will be mostly cached, or
* 2. a bcopy() or copyin(), which will be uncached (because the
* copy is cache-bypassing).
*
* For both cached and uncached data, both fletcher checksums are much faster
* than sha-256, and slower than 'off', which doesn't touch the data at all.
*/
#include <sys/types.h>
#include <sys/sysmacros.h>

View File

@ -255,6 +255,7 @@ VTOZ(vnode_t *vp)
/*
* ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation.
* ZFS_ENTER_NOERROR() is called when we can't return EIO.
* ZFS_EXIT() must be called before exitting the vop.
* ZFS_VERIFY_ZP() verifies the znode is valid.
*/
@ -267,6 +268,9 @@ VTOZ(vnode_t *vp)
} \
}
#define ZFS_ENTER_NOERROR(zfsvfs) \
rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG)
#define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG)
#define ZFS_VERIFY_ZP(zp) \

View File

@ -76,7 +76,7 @@ enum zio_checksum {
ZIO_CHECKSUM_FUNCTIONS
};
#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2
#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_4
#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON
enum zio_compress {

View File

@ -1841,7 +1841,7 @@ zfs_perm_init(znode_t *zp, znode_t *parent, int flag,
fgid = zfs_fuid_create_cred(zfsvfs,
ZFS_GROUP, tx, cr, fuidp);
#ifdef __FreeBSD__
gid = parent->z_phys->zp_gid;
gid = fgid = parent->z_phys->zp_gid;
#else
gid = crgetgid(cr);
#endif

View File

@ -864,7 +864,7 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp)
znode_t *rootzp;
int error;
ZFS_ENTER(zfsvfs);
ZFS_ENTER_NOERROR(zfsvfs);
error = zfs_zget(zfsvfs, zfsvfs->z_root, &rootzp);
if (error == 0) {
@ -898,6 +898,9 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
* 'z_parent' is self referential for non-snapshots.
*/
(void) dnlc_purge_vfsp(zfsvfs->z_parent->z_vfs, 0);
#ifdef FREEBSD_NAMECACHE
cache_purgevfs(zfsvfs->z_parent->z_vfs);
#endif
}
/*
@ -1027,6 +1030,17 @@ zfs_umount(vfs_t *vfsp, int fflag)
ASSERT(zfsvfs->z_ctldir == NULL);
}
if (fflag & MS_FORCE) {
/*
* Mark file system as unmounted before calling
* vflush(FORCECLOSE). This way we ensure no future vnops
* will be called and risk operating on DOOMED vnodes.
*/
rrw_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG);
zfsvfs->z_unmounted = B_TRUE;
rrw_exit(&zfsvfs->z_teardown_lock, FTAG);
}
/*
* Flush all the files.
*/

View File

@ -4860,7 +4860,7 @@ zfs_freebsd_getacl(ap)
vsecattr_t vsecattr;
if (ap->a_type != ACL_TYPE_NFS4)
return (EOPNOTSUPP);
return (EINVAL);
vsecattr.vsa_mask = VSA_ACE | VSA_ACECNT;
if (error = zfs_getsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL))
@ -4889,7 +4889,7 @@ zfs_freebsd_setacl(ap)
aclent_t *aaclp;
if (ap->a_type != ACL_TYPE_NFS4)
return (EOPNOTSUPP);
return (EINVAL);
if (ap->a_aclp->acl_cnt < 1 || ap->a_aclp->acl_cnt > MAX_ACL_ENTRIES)
return (EINVAL);

View File

@ -890,17 +890,25 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp)
if (zp->z_unlinked) {
err = ENOENT;
} else {
if ((vp = ZTOV(zp)) != NULL) {
VI_LOCK(vp);
if ((vp->v_iflag & VI_DOOMED) != 0) {
VI_UNLOCK(vp);
vp = NULL;
} else
VI_UNLOCK(vp);
}
if (vp != NULL)
VN_HOLD(vp);
int dying = 0;
vp = ZTOV(zp);
if (vp == NULL)
dying = 1;
else {
VN_HOLD(vp);
if ((vp->v_iflag & VI_DOOMED) != 0) {
dying = 1;
/*
* Don't VN_RELE() vnode here, because
* it can call vn_lock() which creates
* LOR between vnode lock and znode
* lock. We will VN_RELE() the vnode
* after droping znode lock.
*/
}
}
if (dying) {
if (first) {
ZFS_LOG(1, "dying znode detected (zp=%p)", zp);
first = 0;
@ -912,6 +920,8 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp)
dmu_buf_rele(db, NULL);
mutex_exit(&zp->z_lock);
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
if (vp != NULL)
VN_RELE(vp);
tsleep(zp, 0, "zcollide", 1);
goto again;
}

View File

@ -0,0 +1,196 @@
/*-
* Written by paradox <ddkprog@yahoo.com>
* Public domain.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "opt_x86bios.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/cpufunc.h>
#include <contrib/x86emu/x86emu.h>
#include <contrib/x86emu/x86emu_regs.h>
#include <compat/x86bios/x86bios.h>
u_char *pbiosMem = NULL;
static u_char *pbiosStack = NULL;
int busySegMap[5];
static struct x86emu x86bios_emu;
static struct mtx x86bios_lock;
static uint8_t
x86bios_emu_inb(struct x86emu *emu, uint16_t port)
{
if (port == 0xb2) /* APM scratch register */
return (0);
if (port >= 0x80 && port < 0x88) /* POST status register */
return (0);
return (inb(port));
}
static uint16_t
x86bios_emu_inw(struct x86emu *emu, uint16_t port)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return (0);
return (inw(port));
}
static uint32_t
x86bios_emu_inl(struct x86emu *emu, uint16_t port)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return (0);
return (inl(port));
}
static void
x86bios_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val)
{
if (port == 0xb2) /* APM scratch register */
return;
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outb(port, val);
}
static void
x86bios_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outw(port, val);
}
static void
x86bios_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outl(port, val);
}
void
x86bios_intr(struct x86regs *regs, int intno)
{
if (intno < 0 || intno > 255)
return;
if (bootverbose)
printf("Calling int 0x%x (ax=0x%04x bx=0x%04x "
"cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
intno, regs->R_AX, regs->R_BX, regs->R_CX,
regs->R_DX, regs->R_ES, regs->R_DI);
mtx_lock_spin(&x86bios_lock);
memcpy(&x86bios_emu.x86, regs, sizeof(*regs));
x86emu_exec_intr(&x86bios_emu, intno);
memcpy(regs, &x86bios_emu.x86, sizeof(*regs));
mtx_unlock_spin(&x86bios_lock);
if (bootverbose)
printf("Exiting int 0x%x (ax=0x%04x bx=0x%04x "
"cx=0x%04x dx=0x%04x es=0x%04x di=0x%04x)\n",
intno, regs->R_AX, regs->R_BX, regs->R_CX,
regs->R_DX, regs->R_ES, regs->R_DI);
}
void *
x86bios_offset(uint32_t offs)
{
return (pbiosMem + offs);
}
static void
x86bios_init(void *arg __unused)
{
int offs;
mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN);
/* Can pbiosMem be NULL here? */
pbiosMem = pmap_mapbios(0x0, MAPPED_MEMORY_SIZE);
memset(&x86bios_emu, 0, sizeof(x86bios_emu));
x86emu_init_default(&x86bios_emu);
x86bios_emu.emu_inb = x86bios_emu_inb;
x86bios_emu.emu_inw = x86bios_emu_inw;
x86bios_emu.emu_inl = x86bios_emu_inl;
x86bios_emu.emu_outb = x86bios_emu_outb;
x86bios_emu.emu_outw = x86bios_emu_outw;
x86bios_emu.emu_outl = x86bios_emu_outl;
x86bios_emu.mem_base = (char *)pbiosMem;
x86bios_emu.mem_size = MAPPED_MEMORY_SIZE;
memset(busySegMap, 0, sizeof(busySegMap));
pbiosStack = x86bios_alloc(1, &offs);
}
static void
x86bios_uninit(void *arg __unused)
{
x86bios_free(pbiosStack, 1);
if (pbiosMem)
pmap_unmapdev((vm_offset_t)pbiosMem,
MAPPED_MEMORY_SIZE);
mtx_destroy(&x86bios_lock);
}
static int
x86bios_modevent(module_t mod __unused, int type, void *data __unused)
{
int err = 0;
switch (type) {
case MOD_LOAD:
x86bios_init(NULL);
break;
case MOD_UNLOAD:
x86bios_uninit(NULL);
break;
default:
err = ENOTSUP;
break;
}
return (err);
}
static moduledata_t x86bios_mod = {
"x86bios",
x86bios_modevent,
NULL,
};
DECLARE_MODULE(x86bios, x86bios_mod, SI_SUB_CPU, SI_ORDER_ANY);
MODULE_VERSION(x86bios, 1);

View File

@ -0,0 +1,134 @@
/*-
* Written by paradox <ddkprog@yahoo.com>
* Public domain.
*
* x86 registers were borrowed from x86emu.h x86emu_regs.h
* for compatability.
*
* $FreeBSD$
*/
#ifndef _X86BIOS_H_
#define _X86BIOS_H_
#include <sys/types.h>
#include <sys/endian.h>
#include <sys/systm.h>
#ifdef __BIG_ENDIAN__
struct x86_register32 {
uint32_t e_reg;
};
struct x86_register16 {
uint16_t filler0;
uint16_t x_reg;
};
struct x86_register8 {
uint8_t filler0, filler1;
uint8_t h_reg, l_reg;
};
#else /* !__BIG_ENDIAN__ */
struct x86_register32 {
uint32_t e_reg;
};
struct x86_register16 {
uint16_t x_reg;
};
struct x86_register8 {
uint8_t l_reg, h_reg;
};
#endif /* __BIG_ENDIAN__ */
union x86_register {
struct x86_register32 I32_reg;
struct x86_register16 I16_reg;
struct x86_register8 I8_reg;
};
struct x86regs {
uint16_t padding; /* CS is unused. */
uint16_t register_ds;
uint16_t register_es;
uint16_t register_fs;
uint16_t register_gs;
uint16_t register_ss;
uint32_t register_flags;
union x86_register register_a;
union x86_register register_b;
union x86_register register_c;
union x86_register register_d;
union x86_register register_sp;
union x86_register register_bp;
union x86_register register_si;
union x86_register register_di;
};
typedef struct x86regs x86regs_t;
/* 8 bit registers */
#define R_AH register_a.I8_reg.h_reg
#define R_AL register_a.I8_reg.l_reg
#define R_BH register_b.I8_reg.h_reg
#define R_BL register_b.I8_reg.l_reg
#define R_CH register_c.I8_reg.h_reg
#define R_CL register_c.I8_reg.l_reg
#define R_DH register_d.I8_reg.h_reg
#define R_DL register_d.I8_reg.l_reg
/* 16 bit registers */
#define R_AX register_a.I16_reg.x_reg
#define R_BX register_b.I16_reg.x_reg
#define R_CX register_c.I16_reg.x_reg
#define R_DX register_d.I16_reg.x_reg
/* 32 bit extended registers */
#define R_EAX register_a.I32_reg.e_reg
#define R_EBX register_b.I32_reg.e_reg
#define R_ECX register_c.I32_reg.e_reg
#define R_EDX register_d.I32_reg.e_reg
/* special registers */
#define R_SP register_sp.I16_reg.x_reg
#define R_BP register_bp.I16_reg.x_reg
#define R_SI register_si.I16_reg.x_reg
#define R_DI register_di.I16_reg.x_reg
#define R_FLG register_flags
/* special registers */
#define R_ESP register_sp.I32_reg.e_reg
#define R_EBP register_bp.I32_reg.e_reg
#define R_ESI register_si.I32_reg.e_reg
#define R_EDI register_di.I32_reg.e_reg
#define R_EFLG register_flags
/* segment registers */
#define R_DS register_ds
#define R_SS register_ss
#define R_ES register_es
#define R_FS register_fs
#define R_GS register_gs
#define SEG_ADDR(x) (((x) >> 4) & 0x00F000)
#define SEG_OFF(x) ((x) & 0x0FFFF)
#define FARP(x) ((le32toh(x) & 0xffff) + ((le32toh(x) >> 12) & 0xffff00))
#define MAPPED_MEMORY_SIZE (1024 * 1024)
#define PAGE_RESERV (4096 * 5)
__BEGIN_DECLS
void *x86bios_alloc(int count, int *segs);
void x86bios_free(void *pbuf, int count);
void x86bios_intr(struct x86regs *regs, int intno);
void *x86bios_offset(uint32_t offs);
__END_DECLS
#endif /* !_X86BIOS_H_ */

View File

@ -0,0 +1,81 @@
/*-
* Copyright (C) 1999 Egbert Eich
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of the authors not be used
* in advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. The authors makes no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* xserver/hw/xfree86/int10/generic.c
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <compat/x86bios/x86bios.h>
extern u_char *pbiosMem;
extern int busySegMap[5];
void *
x86bios_alloc(int count, int *segs)
{
int i;
int j;
/* find the free segblock of page */
for (i = 0; i < (PAGE_RESERV - count); i++)
{
if (busySegMap[i] == 0)
{
/* find the capacity of segblock */
for (j = i; j < (i + count); j++)
{
if (busySegMap[j] == 1)
break;
}
if (j == (i + count))
break;
i += count;
}
}
if (i == (PAGE_RESERV - count))
return NULL;
/* make the segblock is used */
for (j = i; j < (i + count); j++)
busySegMap[i] = 1;
*segs = i * 4096;
return (pbiosMem + *segs);
}
void
x86bios_free(void *pbuf, int count)
{
int i;
int busySeg;
busySeg = ((u_char *)pbuf - pbiosMem) / 4096;
for (i = busySeg; i < (busySeg + count); i++)
busySegMap[i] = 0;
}

View File

@ -2757,5 +2757,3 @@ options AAC_DEBUG # Debugging levels:
options BROOKTREE_ALLOC_PAGES=(217*4+1)
options MAXFILES=999
# x86 real mode emulator
options X86EMU

View File

@ -1792,6 +1792,7 @@ fs/procfs/procfs_ioctl.c optional procfs
fs/procfs/procfs_map.c optional procfs
fs/procfs/procfs_mem.c optional procfs
fs/procfs/procfs_note.c optional procfs
fs/procfs/procfs_osrel.c optional procfs
fs/procfs/procfs_regs.c optional procfs
fs/procfs/procfs_rlimit.c optional procfs
fs/procfs/procfs_status.c optional procfs
@ -2009,6 +2010,7 @@ kern/sched_ule.c optional sched_ule
kern/serdev_if.m standard
kern/stack_protector.c standard \
compile-with "${NORMAL_C:N-fstack-protector*}"
kern/subr_acl_nfs4.c standard
kern/subr_acl_posix1e.c standard
kern/subr_autoconf.c standard
kern/subr_blist.c standard
@ -2633,7 +2635,7 @@ ufs/ufs/ufs_acl.c optional ffs
ufs/ufs/ufs_bmap.c optional ffs
ufs/ufs/ufs_dirhash.c optional ffs
ufs/ufs/ufs_extattr.c optional ffs
ufs/ufs/ufs_gjournal.c optional ffs
ufs/ufs/ufs_gjournal.c optional ffs UFS_GJOURNAL
ufs/ufs/ufs_inode.c optional ffs
ufs/ufs/ufs_lookup.c optional ffs
ufs/ufs/ufs_quota.c optional ffs
@ -2828,6 +2830,3 @@ dev/xen/netfront/netfront.c optional xen | xenhvm
dev/xen/xenpci/xenpci.c optional xenpci
dev/xen/xenpci/evtchn.c optional xenpci
dev/xen/xenpci/machine_reboot.c optional xenpci
contrib/x86emu/x86emu.c optional x86emu
contrib/x86emu/x86emu_util.c optional x86emu

View File

@ -162,7 +162,7 @@ dev/atkbdc/atkbdc_subr.c optional atkbdc
dev/atkbdc/psm.c optional psm atkbdc
dev/coretemp/coretemp.c optional coretemp
dev/cpuctl/cpuctl.c optional cpuctl
dev/dpms/dpms.c optional dpms x86emu
dev/dpms/dpms.c optional dpms
# There are no systems with isa slots, so all ed isa entries should go..
dev/ed/if_ed_3c503.c optional ed isa ed_3c503
dev/ed/if_ed_isa.c optional ed isa
@ -170,7 +170,8 @@ dev/ed/if_ed_wd80x3.c optional ed isa
dev/ed/if_ed_hpp.c optional ed isa ed_hpp
dev/ed/if_ed_sic.c optional ed isa ed_sic
dev/fb/fb.c optional fb | vga
dev/fb/vesa.c optional vga vesa x86emu
dev/fb/s3_pci.c optional s3pci
dev/fb/vesa.c optional vga vesa
dev/fb/vga.c optional vga
dev/ichwd/ichwd.c optional ichwd
dev/if_ndis/if_ndis.c optional ndis
@ -219,7 +220,7 @@ dev/sio/sio_puc.c optional sio puc
dev/speaker/spkr.c optional speaker
dev/syscons/apm/apm_saver.c optional apm_saver apm
dev/syscons/scterm-teken.c optional sc
dev/syscons/scvesactl.c optional sc vga vesa x86emu
dev/syscons/scvesactl.c optional sc vga vesa
dev/syscons/scvgarndr.c optional sc vga
dev/syscons/scvtb.c optional sc
dev/uart/uart_cpu_amd64.c optional uart
@ -293,3 +294,10 @@ i386/cpufreq/p4tcc.c optional cpufreq
#
libkern/memmove.c standard
libkern/memset.c standard
#
# x86 real mode BIOS emulator, required by atkbdc/dpms/vesa
#
compat/x86bios/x86bios.c optional x86bios | atkbd | dpms | vesa
compat/x86bios/x86bios_alloc.c optional x86bios | atkbd | dpms | vesa
contrib/x86emu/x86emu.c optional x86bios | atkbd | dpms | vesa
contrib/x86emu/x86emu_util.c optional x86bios | atkbd | dpms | vesa

View File

@ -150,14 +150,15 @@ dev/ctau/if_ct.c optional ctau
dev/cx/csigma.c optional cx
dev/cx/cxddk.c optional cx
dev/cx/if_cx.c optional cx
dev/dpms/dpms.c optional dpms x86emu
dev/dpms/dpms.c optional dpms
dev/ed/if_ed_3c503.c optional ed isa ed_3c503
dev/ed/if_ed_isa.c optional ed isa
dev/ed/if_ed_wd80x3.c optional ed isa
dev/ed/if_ed_hpp.c optional ed isa ed_hpp
dev/ed/if_ed_sic.c optional ed isa ed_sic
dev/fb/fb.c optional fb | vga
dev/fb/vesa.c optional vga vesa x86emu
dev/fb/s3_pci.c optional s3pci
dev/fb/vesa.c optional vga vesa
dev/fb/vga.c optional vga
dev/fdc/fdc.c optional fdc
dev/fdc/fdc_acpi.c optional fdc
@ -219,7 +220,7 @@ dev/sio/sio_puc.c optional sio puc
dev/speaker/spkr.c optional speaker
dev/syscons/apm/apm_saver.c optional apm_saver apm
dev/syscons/scterm-teken.c optional sc
dev/syscons/scvesactl.c optional sc vga vesa x86emu
dev/syscons/scvesactl.c optional sc vga vesa
dev/syscons/scvgarndr.c optional sc vga
dev/syscons/scvtb.c optional sc
dev/uart/uart_cpu_i386.c optional uart
@ -377,3 +378,10 @@ i386/xbox/xbox.c optional xbox
i386/xbox/xboxfb.c optional xboxfb
dev/fb/boot_font.c optional xboxfb
i386/xbox/pic16l.s optional xbox
#
# x86 real mode BIOS emulator, required by atkbdc/dpms/vesa
#
compat/x86bios/x86bios.c optional x86bios | atkbd | dpms | vesa
compat/x86bios/x86bios_alloc.c optional x86bios | atkbd | dpms | vesa
contrib/x86emu/x86emu.c optional x86bios | atkbd | dpms | vesa
contrib/x86emu/x86emu_util.c optional x86bios | atkbd | dpms | vesa

View File

@ -89,28 +89,54 @@ i=`${MAKE:-make} -V KERN_IDENT`
case "$d" in
*/sys/*)
SRCDIR=${d##*obj}
if [ -n "$MACHINE" ]; then
SRCDIR=${SRCDIR##/$MACHINE}
fi
SRCDIR=${SRCDIR%%/sys/*}
for dir in /bin /usr/bin /usr/local/bin; do
if [ -x "${dir}/svnversion" ]; then
if [ -d "${SRCDIR}/sys/.svn" -a -x "${dir}/svnversion" ] ; then
svnversion=${dir}/svnversion
SRCDIR=${d##*obj}
if [ -n "$MACHINE" ]; then
SRCDIR=${SRCDIR##/$MACHINE}
fi
SRCDIR=${SRCDIR%%/sys/*}
break
fi
if [ -d "${SRCDIR}/.git" -a -x "${dir}/git" ] ; then
git_cmd="${dir}/git --git-dir=${SRCDIR}/.git"
break
fi
done
if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then
if [ -n "$svnversion" ] ; then
svn=" r`cd ${SRCDIR}/sys && $svnversion`"
fi
if [ -n "$git_cmd" ] ; then
git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null`
svn=`$git_cmd svn find-rev $git 2>/dev/null`
if [ -n "$svn" ] ; then
svn=" r${svn}"
git="=${git}"
else
svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \
sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'`
if [ -n $svn ] ; then
svn=" r${svn}"
git="+${git}"
else
git=" ${git}"
fi
fi
if $git_cmd --work-tree=${SRCDIR} diff-index \
--name-only HEAD | read dummy; then
git="${git}-dirty"
fi
fi
;;
esac
cat << EOF > vers.c
$COPYRIGHT
#define SCCSSTR "@(#)${VERSION} #${v}${svn}: ${t}"
#define VERSTR "${VERSION} #${v}${svn}: ${t}\\n ${u}@${h}:${d}\\n"
#define SCCSSTR "@(#)${VERSION} #${v}${svn}${git}: ${t}"
#define VERSTR "${VERSION} #${v}${svn}${git}: ${t}\\n ${u}@${h}:${d}\\n"
#define RELSTR "${RELEASE}"
char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;

View File

@ -838,4 +838,4 @@ SND_FEEDER_RATE_HP opt_snd.h
SND_PCM_64 opt_snd.h
SND_OLDSTEREO opt_snd.h
X86EMU
X86BIOS

View File

@ -1,6 +1,5 @@
/* $OpenBSD: x86emu.c,v 1.4 2009/06/18 14:19:21 pirofti Exp $ */
/* $NetBSD: x86emu.c,v 1.7 2009/02/03 19:26:29 joerg Exp $ */
/* $FreeBSD$ */
/*
*
@ -33,9 +32,8 @@
*
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <contrib/x86emu/x86emu.h>
#include <contrib/x86emu/x86emu_regs.h>
@ -8335,32 +8333,3 @@ pop_long(struct x86emu *emu)
emu->x86.R_SP += 4;
return res;
}
static int
x86emu_modevent(module_t mod __unused, int type, void *data __unused)
{
int err = 0;
switch (type) {
case MOD_LOAD:
break;
case MOD_UNLOAD:
break;
default:
err = ENOTSUP;
break;
}
return (err);
}
static moduledata_t x86emu_mod = {
"x86emu",
x86emu_modevent,
NULL,
};
DECLARE_MODULE(x86emu, x86emu_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(x86emu, 1);

View File

@ -1,6 +1,5 @@
/* $OpenBSD: x86emu_util.c,v 1.5 2009/06/18 14:19:21 pirofti Exp $ */
/* $NetBSD: x86emu_util.c,v 1.2 2007/12/04 17:32:22 joerg Exp $ */
/* $FreeBSD$ */
/*
*
@ -33,6 +32,9 @@
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/endian.h>

View File

@ -46,7 +46,6 @@ ACPI_MODULE_NAME("AIBOOST")
#define DESCSTRLEN 32
struct acpi_aiboost_element{
ACPI_HANDLE h;
uint32_t id;
char desc[DESCSTRLEN];
};
@ -127,22 +126,23 @@ static ACPI_STATUS acpi_aiboost_getcomponent(device_t dev, char *name, struct a
for(i = 1 ; i < o->Package.Count; i++){
elem = &o->Package.Elements[i];
if(elem->Type != ACPI_TYPE_ANY){
printf("NOREF\n");
goto error;
}
c->elem[ i - 1].h = elem->Reference.Handle;
if (elem->Type == ACPI_TYPE_ANY) {
buf2.Pointer = NULL;
buf2.Length = ACPI_ALLOCATE_BUFFER;
buf2.Pointer = NULL;
buf2.Length = ACPI_ALLOCATE_BUFFER;
status = AcpiEvaluateObject(c->elem[i - 1].h, NULL, NULL,
&buf2);
if(ACPI_FAILURE(status)){
printf("FETCH OBJECT\n");
status = AcpiEvaluateObject(elem->Reference.Handle,
NULL, NULL, &buf2);
if (ACPI_FAILURE(status)){
printf("FETCH OBJECT\n");
goto error;
}
subobj = buf2.Pointer;
} else if (elem->Type == ACPI_TYPE_PACKAGE)
subobj = elem;
else {
printf("NO PACKAGE\n");
goto error;
}
subobj = buf2.Pointer;
if(ACPI_FAILURE(acpi_PkgInt32(subobj,0, &c->elem[i -1].id))){
printf("ID FAILED\n");
goto error;
@ -151,15 +151,17 @@ static ACPI_STATUS acpi_aiboost_getcomponent(device_t dev, char *name, struct a
sizeof(c->elem[i - 1].desc));
if(ACPI_FAILURE(status)){
if(status == E2BIG){
c->elem[i-1].desc[DESCSTRLEN-1] = 0;
c->elem[i - 1].desc[DESCSTRLEN-1] = 0;
}else{
printf("DESC FAILED %d\n", i-1);
goto error;
}
}
if(buf2.Pointer)
AcpiOsFree(buf2.Pointer);
if (buf2.Pointer) {
AcpiOsFree(buf2.Pointer);
buf2.Pointer = NULL;
}
}
if(buf.Pointer)

View File

@ -288,7 +288,7 @@ static devclass_t acpi_ibm_devclass;
DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass,
0, 0);
MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1);
static char *ibm_ids[] = {"IBM0057", "IBM0068", NULL};
static char *ibm_ids[] = {"IBM0068", NULL};
static void
ibm_led(void *softc, int onoff)
@ -356,8 +356,6 @@ acpi_ibm_attach(device_t dev)
}
sc->ec_handle = acpi_get_handle(sc->ec_dev);
ACPI_SERIAL_BEGIN(ibm);
/* Get the sysctl tree */
sc->sysctl_ctx = device_get_sysctl_ctx(dev);
sc->sysctl_tree = device_get_sysctl_tree(dev);
@ -404,8 +402,6 @@ acpi_ibm_attach(device_t dev)
"Thermal zones");
}
ACPI_SERIAL_END(ibm);
/* Handle notifies */
AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY,
acpi_ibm_notify, dev);

View File

@ -2243,6 +2243,28 @@ acpi_SetIntrModel(int model)
return (acpi_SetInteger(ACPI_ROOT_OBJECT, "_PIC", model));
}
/*
* Walk subtables of a table and call a callback routine for each
* subtable. The caller should provide the first subtable and a
* pointer to the end of the table. This can be used to walk tables
* such as MADT and SRAT that use subtable entries.
*/
void
acpi_walk_subtables(void *first, void *end, acpi_subtable_handler *handler,
void *arg)
{
ACPI_SUBTABLE_HEADER *entry;
for (entry = first; (void *)entry < end; ) {
/* Avoid an infinite loop if we hit a bogus entry. */
if (entry->Length < sizeof(ACPI_SUBTABLE_HEADER))
return;
handler(entry, arg);
entry = ACPI_ADD_PTR(ACPI_SUBTABLE_HEADER, entry, entry->Length);
}
}
/*
* DEPRECATED. This interface has serious deficiencies and will be
* removed.

View File

@ -282,8 +282,7 @@ acpi_video_detach(device_t dev)
acpi_video_notify_handler);
ACPI_SERIAL_BEGIN(video);
for (vo = STAILQ_FIRST(&sc->vid_outputs); vo != NULL; vo = vn) {
vn = STAILQ_NEXT(vo, vo_next);
STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) {
acpi_video_vo_destroy(vo);
}
ACPI_SERIAL_END(video);

View File

@ -307,6 +307,9 @@ void acpi_EnterDebugger(void);
ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL | \
ACPI_STA_BATT_PRESENT)
/* Callback function type for walking subtables within a table. */
typedef void acpi_subtable_handler(ACPI_SUBTABLE_HEADER *, void *);
BOOLEAN acpi_DeviceIsPresent(device_t dev);
BOOLEAN acpi_BatteryIsPresent(device_t dev);
ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, char *path,
@ -340,6 +343,8 @@ void acpi_UserNotify(const char *subsystem, ACPI_HANDLE h,
int acpi_bus_alloc_gas(device_t dev, int *type, int *rid,
ACPI_GENERIC_ADDRESS *gas, struct resource **res,
u_int flags);
void acpi_walk_subtables(void *first, void *end,
acpi_subtable_handler *handler, void *arg);
struct acpi_parse_resource_set {
void (*set_init)(device_t dev, void *arg, void **context);

View File

@ -227,6 +227,8 @@ ata_marvell_edma_ch_attach(device_t dev)
work = ch->dma.work_bus;
/* clear work area */
bzero(ch->dma.work, 1024+256);
bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
/* set legacy ATA resources */
for (i = ATA_DATA; i <= ATA_COMMAND; i++) {
@ -310,7 +312,11 @@ ata_marvell_edma_ch_attach(device_t dev)
static int
ata_marvell_edma_ch_detach(device_t dev)
{
struct ata_channel *ch = device_get_softc(dev);
if (ch->dma.work_tag && ch->dma.work_map)
bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
ata_dmafini(dev);
return (0);
}
@ -344,8 +350,6 @@ ata_marvell_edma_begin_transaction(struct ata_request *request)
struct ata_channel *ch = device_get_softc(request->parent);
u_int32_t req_in;
u_int8_t *bytep;
u_int16_t *wordp;
u_int32_t *quadp;
int i;
int error, slot;
@ -374,13 +378,14 @@ ata_marvell_edma_begin_transaction(struct ata_request *request)
slot = (((req_in & ~0xfffffc00) >> 5) + 0) & 0x1f;
bytep = (u_int8_t *)(ch->dma.work);
bytep += (slot << 5);
wordp = (u_int16_t *)bytep;
quadp = (u_int32_t *)bytep;
/* fill in this request */
quadp[0] = (long)request->dma->sg_bus & 0xffffffff;
quadp[1] = (u_int64_t)request->dma->sg_bus >> 32;
wordp[4] = (request->flags & ATA_R_READ ? 0x01 : 0x00) | (request->tag<<1);
le32enc(bytep + 0 * sizeof(u_int32_t),
request->dma->sg_bus & 0xffffffff);
le32enc(bytep + 1 * sizeof(u_int32_t),
(u_int64_t)request->dma->sg_bus >> 32);
le16enc(bytep + 4 * sizeof(u_int16_t),
(request->flags & ATA_R_READ ? 0x01 : 0x00) | (request->tag << 1));
i = 10;
bytep[i++] = (request->u.ata.count >> 8) & 0xff;
@ -409,6 +414,9 @@ ata_marvell_edma_begin_transaction(struct ata_request *request)
bytep[i++] = request->u.ata.command;
bytep[i++] = 0x90 | ATA_COMMAND;
bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
/* enable EDMA machinery if needed */
if (!(ATA_INL(ctlr->r_res1, 0x02028 + ATA_MV_EDMA_BASE(ch)) & 0x00000001)) {
ATA_OUTL(ctlr->r_res1, 0x02028 + ATA_MV_EDMA_BASE(ch), 0x00000001);
@ -451,6 +459,8 @@ ata_marvell_edma_end_transaction(struct ata_request *request)
slot = (((rsp_in & ~0xffffff00) >> 3)) & 0x1f;
rsp_out &= 0xffffff00;
rsp_out += (slot << 3);
bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
response = (struct ata_marvell_response *)
(ch->dma.work + 1024 + (slot << 3));
@ -525,6 +535,7 @@ ata_marvell_edma_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs,
prd[i].addrlo = htole32(segs[i].ds_addr);
prd[i].count = htole32(segs[i].ds_len);
prd[i].addrhi = htole32((u_int64_t)segs[i].ds_addr >> 32);
prd[i].reserved = 0;
}
prd[i - 1].count |= htole32(ATA_DMA_EOT);
KASSERT(nsegs <= ATA_DMA_ENTRIES, ("too many DMA segment entries\n"));

View File

@ -44,10 +44,10 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/resource.h>
#ifdef __i386__
#if defined(__i386__) || defined(__amd64__)
#include <machine/md_var.h>
#include <machine/psl.h>
#include <machine/vm86.h>
#include <compat/x86bios/x86bios.h>
#include <machine/pc/bios.h>
#include <vm/vm.h>
@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_param.h>
#include <isa/isareg.h>
#endif /* __i386__ */
#endif /* __i386__ || __amd64__ */
#include <sys/kbio.h>
#include <dev/kbd/kbdreg.h>
@ -1089,34 +1089,42 @@ atkbd_shutdown_final(void *v)
static int
get_typematic(keyboard_t *kbd)
{
#ifdef __i386__
#if defined(__i386__) || defined(__amd64__)
/*
* Only some systems allow us to retrieve the keyboard repeat
* rate previously set via the BIOS...
*/
struct vm86frame vmf;
u_int32_t p;
x86regs_t regs;
uint8_t *p;
bzero(&vmf, sizeof(vmf));
vmf.vmf_ax = 0xc000;
vm86_intcall(0x15, &vmf);
if ((vmf.vmf_eflags & PSL_C) || vmf.vmf_ah)
return ENODEV;
p = BIOS_PADDRTOVADDR(((u_int32_t)vmf.vmf_es << 4) + vmf.vmf_bx);
if ((readb(p + 6) & 0x40) == 0) /* int 16, function 0x09 supported? */
return ENODEV;
vmf.vmf_ax = 0x0900;
vm86_intcall(0x16, &vmf);
if ((vmf.vmf_al & 0x08) == 0) /* int 16, function 0x0306 supported? */
return ENODEV;
vmf.vmf_ax = 0x0306;
vm86_intcall(0x16, &vmf);
kbd->kb_delay1 = typematic_delay(vmf.vmf_bh << 5);
kbd->kb_delay2 = typematic_rate(vmf.vmf_bl);
return 0;
/* Is BIOS system configuration table supported? */
bzero(&regs, sizeof(regs));
regs.R_AH = 0xc0;
x86bios_intr(&regs, 0x15);
if ((regs.R_FLG & PSL_C) != 0 || regs.R_AH != 0)
return (ENODEV);
/* Is int 16, function 0x09 supported? */
p = x86bios_offset((regs.R_ES << 4) + regs.R_BX);
if (readw(p) < 5 || (readb(p + 6) & 0x40) == 0)
return (ENODEV);
/* Is int 16, function 0x0306 supported? */
bzero(&regs, sizeof(regs));
regs.R_AH = 0x09;
x86bios_intr(&regs, 0x16);
if ((regs.R_AL & 0x08) == 0)
return (ENODEV);
bzero(&regs, sizeof(regs));
regs.R_AX = 0x0306;
x86bios_intr(&regs, 0x16);
kbd->kb_delay1 = typematic_delay(regs.R_BH << 5);
kbd->kb_delay2 = typematic_rate(regs.R_BL);
return (0);
#else
return ENODEV;
#endif /* __i386__ */
return (ENODEV);
#endif /* __i386__ || __amd64__ */
}
static int

View File

@ -160,7 +160,7 @@ static void tulip_dma_map_rxbuf(void *, bus_dma_segment_t *, int,
static void
tulip_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
{
u_int32_t *paddr;
bus_addr_t *paddr;
if (error)
return;
@ -182,7 +182,7 @@ tulip_dma_map_rxbuf(void *arg, bus_dma_segment_t *segs, int nseg,
KASSERT(nseg == 1, ("too many DMA segments"));
KASSERT(segs[0].ds_len >= TULIP_RX_BUFLEN, ("receive buffer too small"));
desc->d_addr1 = segs[0].ds_addr;
desc->d_addr1 = segs[0].ds_addr & 0xffffffff;
desc->d_length1 = TULIP_RX_BUFLEN;
#ifdef not_needed
/* These should already always be zero. */
@ -3171,8 +3171,8 @@ tulip_reset(tulip_softc_t * const sc)
sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
}
TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr);
TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr);
TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr & 0xffffffff);
TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr & 0xffffffff);
TULIP_CSR_WRITE(sc, csr_busmode,
(1 << (3 /*pci_max_burst_len*/ + 8))
|TULIP_BUSMODE_CACHE_ALIGN8
@ -3488,7 +3488,7 @@ tulip_rx_intr(tulip_softc_t * const sc)
struct mbuf *m0;
KASSERT(ms != NULL, ("no packet to accept"));
#if defined(TULIP_COPY_RXDATA)
#ifndef __NO_STRICT_ALIGNMENT
/*
* Copy the data into a new mbuf that is properly aligned. If
* we fail to allocate a new mbuf, then drop the packet. We will
@ -3527,7 +3527,7 @@ tulip_rx_intr(tulip_softc_t * const sc)
*/
ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
#if defined(TULIP_COPY_RXDATA)
#ifndef __NO_STRICT_ALIGNMENT
skip_input:
#endif
if (ms == NULL) {
@ -4016,9 +4016,9 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m)
eop = nextout;
eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
eop->di_desc->d_status = d_status;
eop->di_desc->d_addr1 = segs[segcnt].ds_addr;
eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff;
eop->di_desc->d_length1 = segs[segcnt].ds_len;
eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr;
eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr & 0xffffffff;
eop->di_desc->d_length2 = segs[segcnt+1].ds_len;
d_status = TULIP_DSTS_OWNER;
if (++nextout == ri->ri_last)
@ -4028,7 +4028,7 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m)
eop = nextout;
eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
eop->di_desc->d_status = d_status;
eop->di_desc->d_addr1 = segs[segcnt].ds_addr;
eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff;
eop->di_desc->d_length1 = segs[segcnt].ds_len;
eop->di_desc->d_addr2 = 0;
eop->di_desc->d_length2 = 0;
@ -4194,7 +4194,7 @@ tulip_txput_setup(tulip_softc_t * const sc)
nextout->d_length2 = 0;
nextout->d_addr2 = 0;
nextout->d_length1 = sizeof(sc->tulip_setupdata);
nextout->d_addr1 = sc->tulip_setup_dma_addr;
nextout->d_addr1 = sc->tulip_setup_dma_addr & 0xffffffff;
bus_dmamap_sync(sc->tulip_setup_tag, sc->tulip_setup_map,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
TULIP_TXDESC_PRESYNC(ri);
@ -4491,7 +4491,7 @@ tulip_busdma_freering(tulip_ringinfo_t *ri)
/* Allocate memory for a single descriptor ring. */
static int
tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
bus_size_t maxsize, int nsegs, tulip_ringinfo_t *ri, const char *name)
bus_size_t align, int nsegs, tulip_ringinfo_t *ri, const char *name)
{
size_t size;
int error, i;
@ -4499,7 +4499,7 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
/* First, setup a tag. */
ri->ri_max = count;
size = count * sizeof(tulip_desc_t);
error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL,
&ri->ri_ring_tag);
if (error) {
@ -4527,9 +4527,9 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
}
/* Allocate a tag for the data buffers. */
error = bus_dma_tag_create(NULL, 4, 0,
error = bus_dma_tag_create(NULL, align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
maxsize, nsegs, TULIP_DATA_PER_DESC, 0, NULL, NULL, &ri->ri_data_tag);
MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag);
if (error) {
device_printf(dev, "failed to allocate %s buffer dma tag\n", name);
return (error);
@ -4563,6 +4563,7 @@ tulip_busdma_cleanup(tulip_softc_t * const sc)
if (sc->tulip_setupbuf != NULL) {
bus_dmamem_free(sc->tulip_setup_tag, sc->tulip_setupbuf,
sc->tulip_setup_map);
bus_dmamap_destroy(sc->tulip_setup_tag, sc->tulip_setup_map);
sc->tulip_setup_map = NULL;
sc->tulip_setupbuf = NULL;
}
@ -4586,8 +4587,8 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc)
/*
* Allocate space and dmamap for transmit ring.
*/
error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, TULIP_DATA_PER_DESC,
TULIP_MAX_TXSEG, &sc->tulip_txinfo, "transmit");
error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, 1, TULIP_MAX_TXSEG,
&sc->tulip_txinfo, "transmit");
if (error)
return (error);
@ -4598,7 +4599,7 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc)
* a waste in practice though as an ethernet frame can easily fit
* in TULIP_RX_BUFLEN bytes.
*/
error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, MCLBYTES, 1,
error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, 4, 1,
&sc->tulip_rxinfo, "receive");
if (error)
return (error);
@ -4606,7 +4607,7 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc)
/*
* Allocate a DMA tag, memory, and map for setup descriptor
*/
error = bus_dma_tag_create(NULL, 4, 0,
error = bus_dma_tag_create(NULL, 32, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0,
NULL, NULL, &sc->tulip_setup_tag);

View File

@ -104,7 +104,7 @@ typedef struct {
tulip_descinfo_t *ri_descinfo;
bus_dma_tag_t ri_ring_tag;
bus_dmamap_t ri_ring_map;
uint32_t ri_dma_addr;
bus_addr_t ri_dma_addr;
bus_dma_tag_t ri_data_tag;
bus_dmamap_t *ri_data_maps;
} tulip_ringinfo_t;
@ -134,11 +134,7 @@ typedef struct {
* architecture which can't handle unaligned accesses) because with
* 100Mb/s cards the copying is just too much of a hit.
*/
#if !defined(__i386__)
#define TULIP_COPY_RXDATA 1
#endif
#define TULIP_DATA_PER_DESC 2032
#define TULIP_TXTIMER 4
#define TULIP_RXDESCS 48
#define TULIP_TXDESCS 128
@ -560,7 +556,7 @@ struct tulip_softc {
*/
bus_dma_tag_t tulip_setup_tag;
bus_dmamap_t tulip_setup_map;
uint32_t tulip_setup_dma_addr;
bus_addr_t tulip_setup_dma_addr;
u_int32_t *tulip_setupbuf;
u_int32_t tulip_setupdata[192 / sizeof(u_int32_t)];
char tulip_boardid[24];

View File

@ -67,11 +67,7 @@ __FBSDID("$FreeBSD$");
#include <sys/libkern.h>
#include <sys/module.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <contrib/x86emu/x86emu.h>
#include <contrib/x86emu/x86emu_regs.h>
#include <compat/x86bios/x86bios.h>
/*
* VESA DPMS States
@ -94,9 +90,6 @@ struct dpms_softc {
int dpms_initial_state;
};
static struct x86emu vesa_emu;
static unsigned char *emumem = NULL;
static int dpms_attach(device_t);
static int dpms_detach(device_t);
static int dpms_get_supported_states(int *);
@ -126,59 +119,7 @@ static driver_t dpms_driver = {
static devclass_t dpms_devclass;
DRIVER_MODULE(dpms, vgapci, dpms_driver, dpms_devclass, NULL, NULL);
MODULE_DEPEND(dpms, x86emu, 1, 1, 1);
static uint8_t
vm86_emu_inb(struct x86emu *emu, uint16_t port)
{
if (port == 0xb2) /* APM scratch register */
return 0;
if (port >= 0x80 && port < 0x88) /* POST status register */
return 0;
return inb(port);
}
static uint16_t
vm86_emu_inw(struct x86emu *emu, uint16_t port)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return 0;
return inw(port);
}
static uint32_t
vm86_emu_inl(struct x86emu *emu, uint16_t port)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return 0;
return inl(port);
}
static void
vm86_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val)
{
if (port == 0xb2) /* APM scratch register */
return;
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outb(port, val);
}
static void
vm86_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outw(port, val);
}
static void
vm86_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outl(port, val);
}
MODULE_DEPEND(dpms, x86bios, 1, 1, 1);
static void
dpms_identify(driver_t *driver, device_t parent)
@ -192,7 +133,6 @@ dpms_identify(driver_t *driver, device_t parent)
*/
if (devclass_get_device(dpms_devclass, 0) == NULL)
device_add_child(parent, "dpms", 0);
}
static int
@ -200,21 +140,6 @@ dpms_probe(device_t dev)
{
int error, states;
emumem = pmap_mapbios(0x0, 0xc00000);
memset(&vesa_emu, 0, sizeof(vesa_emu));
x86emu_init_default(&vesa_emu);
vesa_emu.emu_inb = vm86_emu_inb;
vesa_emu.emu_inw = vm86_emu_inw;
vesa_emu.emu_inl = vm86_emu_inl;
vesa_emu.emu_outb = vm86_emu_outb;
vesa_emu.emu_outw = vm86_emu_outw;
vesa_emu.emu_outl = vm86_emu_outl;
vesa_emu.mem_base = (char *)emumem;
vesa_emu.mem_size = 1024 * 1024;
error = dpms_get_supported_states(&states);
if (error)
return (error);
@ -240,8 +165,6 @@ dpms_attach(device_t dev)
static int
dpms_detach(device_t dev)
{
if (emumem)
pmap_unmapdev((vm_offset_t)emumem, 0xc00000);
return (0);
}
@ -267,17 +190,20 @@ dpms_resume(device_t dev)
static int
dpms_call_bios(int subfunction, int *bh)
{
vesa_emu.x86.R_AX = VBE_DPMS_FUNCTION;
vesa_emu.x86.R_BL = subfunction;
vesa_emu.x86.R_BH = *bh;
vesa_emu.x86.R_ES = 0;
vesa_emu.x86.R_DI = 0;
x86emu_exec_intr(&vesa_emu, 0x10);
x86regs_t regs;
if ((vesa_emu.x86.R_EAX & 0xffff) != 0x004f)
bzero(&regs, sizeof(regs));
regs.R_AX = VBE_DPMS_FUNCTION;
regs.R_BL = subfunction;
regs.R_BH = *bh;
regs.R_ES = 0;
regs.R_DI = 0;
x86bios_intr(&regs, 0x10);
if ((regs.R_EAX & 0xffff) != 0x004f)
return (ENXIO);
*bh = vesa_emu.x86.R_BH;
*bh = regs.R_BH;
return (0);
}

View File

@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
#include <machine/md_var.h>
#include <machine/vm86.h>
#include <machine/pc/bios.h>
#include <dev/fb/vesa.h>

View File

@ -45,16 +45,15 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <machine/pc/bios.h>
#include <dev/fb/vesa.h>
#include <dev/fb/fbreg.h>
#include <dev/fb/vgareg.h>
#include <isa/isareg.h>
#include <machine/cpufunc.h>
#include <contrib/x86emu/x86emu.h>
#include <contrib/x86emu/x86emu_regs.h>
#include <compat/x86bios/x86bios.h>
#define VESA_VIA_CLE266 "VIA CLE266\r\n"
@ -73,7 +72,7 @@ typedef struct adp_state adp_state_t;
/* VESA video adapter */
static video_adapter_t *vesa_adp = NULL;
static int vesa_state_buf_size = 0;
#define VESA_X86EMU_BUFSIZE (3 * PAGE_SIZE)
#define VESA_BIOS_BUFSIZE (3 * PAGE_SIZE)
/* VESA functions */
#if 0
@ -106,8 +105,6 @@ static vi_bitblt_t vesa_bitblt;
static vi_diag_t vesa_diag;
static int vesa_bios_info(int level);
static struct x86emu vesa_emu;
static video_switch_t vesavidsw = {
vesa_probe,
vesa_init,
@ -197,6 +194,7 @@ static int vesa_bios_set_start(int x, int y);
static int vesa_map_gen_mode_num(int type, int color, int mode);
static int vesa_translate_flags(u_int16_t vflags);
static int vesa_translate_mmodel(u_int8_t vmodel);
static int vesa_get_line_width(video_info_t *info);
static int vesa_bios_init(void);
static void vesa_clear_modes(video_info_t *info, int color);
static vm_offset_t vesa_map_buffer(u_int paddr, size_t size);
@ -206,77 +204,6 @@ static void vesa_unmap_buffer(vm_offset_t vaddr, size_t size);
static int vesa_get_origin(video_adapter_t *adp, off_t *offset);
#endif
#define SEG_ADDR(x) (((x) >> 4) & 0x00F000)
#define SEG_OFF(x) ((x) & 0x0FFFF)
#if _BYTE_ORDER == _LITTLE_ENDIAN
#define B_O16(x) (x)
#define B_O32(x) (x)
#else
#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8))
#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \
| (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
#endif
#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00)
#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff))
#define REALOFF(x) (x*4096)
static unsigned char *emumem = NULL;
static uint8_t
vm86_emu_inb(struct x86emu *emu, uint16_t port)
{
if (port == 0xb2) /* APM scratch register */
return 0;
if (port >= 0x80 && port < 0x88) /* POST status register */
return 0;
return inb(port);
}
static uint16_t
vm86_emu_inw(struct x86emu *emu, uint16_t port)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return 0;
return inw(port);
}
static uint32_t
vm86_emu_inl(struct x86emu *emu, uint16_t port)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return 0;
return inl(port);
}
static void
vm86_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val)
{
if (port == 0xb2) /* APM scratch register */
return;
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outb(port, val);
}
static void
vm86_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outw(port, val);
}
static void
vm86_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val)
{
if (port >= 0x80 && port < 0x88) /* POST status register */
return;
outl(port, val);
}
static void
dump_buffer(u_char *buf, size_t len)
{
@ -293,8 +220,12 @@ dump_buffer(u_char *buf, size_t len)
static int
int10_set_mode(int mode)
{
vesa_emu.x86.R_EAX = 0x0000 | mode;
x86emu_exec_intr(&vesa_emu, 0x10);
x86regs_t regs;
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x0000 | mode;
x86bios_intr(&regs, 0x10);
return 0;
}
@ -303,21 +234,29 @@ int10_set_mode(int mode)
static int
vesa_bios_get_mode(int mode, struct vesa_mode *vmode)
{
x86regs_t regs;
int offs;
u_char *buf;
vesa_emu.x86.R_EAX = 0x4f01;
vesa_emu.x86.R_ECX = mode;
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f01;
regs.R_ECX = mode;
buf = (emumem + REALOFF(3));
vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(3));
vesa_emu.x86.R_DI = SEG_OFF(REALOFF(3));
buf = (u_char *)x86bios_alloc(1, &offs);
x86emu_exec_intr(&vesa_emu, 0x10);
regs.R_ES = SEG_ADDR(offs);
regs.R_DI = SEG_OFF(offs);
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_intr(&regs, 0x10);
if ((regs.R_AX & 0xff) != 0x4f)
{
x86bios_free(buf, 1);
return 1;
}
bcopy(buf, vmode, sizeof(*vmode));
x86bios_free(buf, 1);
return 0;
}
@ -325,62 +264,77 @@ vesa_bios_get_mode(int mode, struct vesa_mode *vmode)
static int
vesa_bios_set_mode(int mode)
{
vesa_emu.x86.R_EAX = 0x4f02;
vesa_emu.x86.R_EBX = mode;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f02;
regs.R_EBX = mode;
return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
x86bios_intr(&regs, 0x10);
return ((regs.R_AX & 0xff) != 0x4f);
}
static int
vesa_bios_get_dac(void)
{
vesa_emu.x86.R_EAX = 0x4f08;
vesa_emu.x86.R_EBX = 1;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f08;
regs.R_EBX = 1;
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_intr(&regs, 0x10);
if ((regs.R_AX & 0xff) != 0x4f)
return 6;
return ((vesa_emu.x86.R_EBX >> 8) & 0x00ff);
return ((regs.R_EBX >> 8) & 0x00ff);
}
static int
vesa_bios_set_dac(int bits)
{
vesa_emu.x86.R_EAX = 0x4f08;
vesa_emu.x86.R_EBX = (bits << 8);
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f08;
regs.R_EBX = (bits << 8);
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_intr(&regs, 0x10);
if ((regs.R_AX & 0xff) != 0x4f)
return 6;
return ((vesa_emu.x86.R_EBX >> 8) & 0x00ff);
return ((regs.R_EBX >> 8) & 0x00ff);
}
static int
vesa_bios_save_palette(int start, int colors, u_char *palette, int bits)
{
x86regs_t regs;
int offs;
u_char *p;
int i;
vesa_emu.x86.R_EAX = 0x4f09;
vesa_emu.x86.R_EBX = 1;
vesa_emu.x86.R_ECX = colors;
vesa_emu.x86.R_EDX = start;
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f09;
regs.R_EBX = 1;
regs.R_ECX = colors;
regs.R_EDX = start;
vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
p = (u_char *)x86bios_alloc(1, &offs);
p = emumem + REALOFF(2);
regs.R_ES = SEG_ADDR(offs);
regs.R_DI = SEG_OFF(offs);
x86emu_exec_intr(&vesa_emu, 0x10);
x86bios_intr(&regs, 0x10);
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
if ((regs.R_AX & 0xff) != 0x4f)
{
x86bios_free(p, 1);
return 1;
}
bits = 8 - bits;
for (i = 0; i < colors; ++i) {
@ -388,6 +342,8 @@ vesa_bios_save_palette(int start, int colors, u_char *palette, int bits)
palette[i*3 + 1] = p[i*4 + 1] << bits;
palette[i*3 + 2] = p[i*4] << bits;
}
x86bios_free(p, 1);
return 0;
}
@ -395,23 +351,29 @@ static int
vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
int bits)
{
x86regs_t regs;
int offs;
u_char *p;
int i;
vesa_emu.x86.R_EAX = 0x4f09;
vesa_emu.x86.R_EBX = 1;
vesa_emu.x86.R_ECX = colors;
vesa_emu.x86.R_EDX = start;
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f09;
regs.R_EBX = 1;
regs.R_ECX = colors;
regs.R_EDX = start;
vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
p = (u_char *)x86bios_alloc(1, &offs);
p = emumem + REALOFF(2);
regs.R_ES = SEG_ADDR(offs);
regs.R_DI = SEG_OFF(offs);
x86emu_exec_intr(&vesa_emu, 0x10);
x86bios_intr(&regs, 0x10);
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
if ((regs.R_AX & 0xff) != 0x4f)
{
x86bios_free(p, 1);
return 1;
}
bits = 8 - bits;
for (i = 0; i < colors; ++i) {
@ -419,16 +381,20 @@ vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
g[i] = p[i*4 + 1] << bits;
b[i] = p[i*4] << bits;
}
x86bios_free(p, 1);
return 0;
}
static int
vesa_bios_load_palette(int start, int colors, u_char *palette, int bits)
{
x86regs_t regs;
int offs;
u_char *p;
int i;
p = (emumem + REALOFF(2));
p = (u_char *)x86bios_alloc(1, &offs);
bits = 8 - bits;
for (i = 0; i < colors; ++i) {
@ -438,17 +404,20 @@ vesa_bios_load_palette(int start, int colors, u_char *palette, int bits)
p[i*4 + 3] = 0;
}
vesa_emu.x86.R_EAX = 0x4f09;
vesa_emu.x86.R_EBX = 0;
vesa_emu.x86.R_ECX = colors;
vesa_emu.x86.R_EDX = start;
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f09;
regs.R_EBX = 0;
regs.R_ECX = colors;
regs.R_EDX = start;
vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
regs.R_ES = SEG_ADDR(offs);
regs.R_DI = SEG_OFF(offs);
x86emu_exec_intr(&vesa_emu, 0x10);
x86bios_intr(&regs, 0x10);
return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
x86bios_free(p, 1);
return ((regs.R_AX & 0xff) != 0x4f);
}
#ifdef notyet
@ -456,10 +425,12 @@ static int
vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
int bits)
{
x86regs_t regs;
int offs;
u_char *p;
int i;
p = (emumem + REALOFF(2));
p = (u_char *)x86bios_alloc(1, &offs);
bits = 8 - bits;
for (i = 0; i < colors; ++i) {
@ -469,93 +440,111 @@ vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
p[i*4 + 3] = 0;
}
vesa_emu.x86.R_EAX = 0x4f09;
vesa_emu.x86.R_EBX = 0;
vesa_emu.x86.R_ECX = colors;
vesa_emu.x86.R_EDX = start;
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f09;
regs.R_EBX = 0;
regs.R_ECX = colors;
regs.R_EDX = start;
vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
regs.R_ES = SEG_ADDR(offs);
regs.R_DI = SEG_OFF(offs);
x86emu_exec_intr(&vesa_emu, 0x10);
x86bios_intr(&regs, 0x10);
return ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_free(p, 1);
return ((regs.R_AX & 0xff) != 0x4f);
}
#endif
static int
vesa_bios_state_buf_size(void)
{
vesa_emu.x86.R_EAX = 0x4f04;
vesa_emu.x86.R_ECX = STATE_ALL;
vesa_emu.x86.R_EDX = STATE_SIZE;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f04;
regs.R_ECX = STATE_ALL;
regs.R_EDX = STATE_SIZE;
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_intr(&regs, 0x10);
if ((regs.R_AX & 0xff) != 0x4f)
return 0;
return vesa_emu.x86.R_BX*64;
return regs.R_BX * 64;
}
static int
vesa_bios_save_restore(int code, void *p, size_t size)
{
x86regs_t regs;
int offs;
u_char *buf;
if (size > VESA_X86EMU_BUFSIZE)
if (size > VESA_BIOS_BUFSIZE)
return (1);
vesa_emu.x86.R_EAX = 0x4f04;
vesa_emu.x86.R_ECX = STATE_ALL;
vesa_emu.x86.R_EDX = code;
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f04;
regs.R_ECX = STATE_ALL;
regs.R_EDX = code;
buf = emumem + REALOFF(2);
buf = (u_char *)x86bios_alloc(1, &offs);
vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
regs.R_ES = SEG_ADDR(offs);
regs.R_DI = SEG_OFF(offs);
bcopy(p, buf, size);
x86emu_exec_intr(&vesa_emu, 0x10);
x86bios_intr(&regs, 0x10);
bcopy(buf, p, size);
return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
x86bios_free(p, 1);
return ((regs.R_AX & 0xff) != 0x4f);
}
static int
vesa_bios_get_line_length(void)
{
vesa_emu.x86.R_EAX = 0x4f06;
vesa_emu.x86.R_EBX = 1;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f06;
regs.R_EBX = 1;
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_intr(&regs, 0x10);
if ((regs.R_AX & 0xff) != 0x4f)
return -1;
return vesa_emu.x86.R_BX;
return regs.R_BX;
}
static int
vesa_bios_set_line_length(int pixel, int *bytes, int *lines)
{
vesa_emu.x86.R_EAX = 0x4f06;
vesa_emu.x86.R_EBX = 0;
vesa_emu.x86.R_ECX = pixel;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f06;
regs.R_EBX = 0;
regs.R_ECX = pixel;
x86bios_intr(&regs, 0x10);
#if VESA_DEBUG > 1
printf("bx:%d, cx:%d, dx:%d\n", vesa_emu.x86.R_BX, vesa_emu.x86.R_CX, vesa_emu.x86.R_DX);
printf("bx:%d, cx:%d, dx:%d\n", regs.R_BX, regs.R_CX, regs.R_DX);
#endif
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
if ((regs.R_AX & 0xff) != 0x4f)
return -1;
if (bytes)
*bytes = vesa_emu.x86.R_BX;
*bytes = regs.R_BX;
if (lines)
*lines = vesa_emu.x86.R_DX;
*lines = regs.R_DX;
return 0;
}
@ -564,16 +553,19 @@ vesa_bios_set_line_length(int pixel, int *bytes, int *lines)
static int
vesa_bios_get_start(int *x, int *y)
{
vesa_emu.x86.R_EAX = 0x4f07;
vesa_emu.x86.R_EBX = 1;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f07;
regs.R_EBX = 1;
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_intr(&regs, 0x10);
if ((regs.R_AX & 0xff) != 0x4f)
return -1;
*x = vesa_emu.x86.R_CX;
*y = vesa_emu.x86.R_DX;
*x = regs.R_CX;
*y = regs.R_DX;
return 0;
}
@ -582,14 +574,17 @@ vesa_bios_get_start(int *x, int *y)
static int
vesa_bios_set_start(int x, int y)
{
vesa_emu.x86.R_EAX = 0x4f07;
vesa_emu.x86.R_EBX = 0x80;
vesa_emu.x86.R_EDX = y;
vesa_emu.x86.R_ECX = x;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f07;
regs.R_EBX = 0x80;
regs.R_EDX = y;
regs.R_ECX = x;
return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
x86bios_intr(&regs, 0x10);
return ((regs.R_AX & 0xff) != 0x4f);
}
/* map a generic video mode to a known mode */
@ -659,12 +654,46 @@ vesa_translate_mmodel(u_int8_t vmodel)
return V_INFO_MM_OTHER;
}
static int
vesa_get_line_width(video_info_t *info)
{
int len;
int width;
width = info->vi_width;
if (info->vi_flags & V_INFO_GRAPHICS)
switch (info->vi_depth / info->vi_planes) {
case 1:
return (width / 8);
case 2:
return (width / 4);
case 4:
return (width / 2);
case 8:
return (width);
case 15:
case 16:
return (width * 2);
case 24:
case 32:
return (width * 4);
}
len = vesa_bios_get_line_length();
return (len > 0 ? len : width);
}
static int
vesa_bios_init(void)
{
static struct vesa_info buf;
struct vesa_mode vmode;
video_info_t *p;
x86regs_t regs;
size_t bsize;
int offs;
u_char *vmbuf;
int is_via_cle266;
int modes;
@ -678,16 +707,17 @@ vesa_bios_init(void)
vesa_vmode_max = 0;
vesa_vmode[0].vi_mode = EOT;
vmbuf = (emumem + REALOFF(2));
vmbuf = (u_char *)x86bios_alloc(1, &offs);
bcopy("VBE2", vmbuf, 4); /* try for VBE2 data */
vesa_emu.x86.R_EAX = 0x4f00;
vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f00;
regs.R_ES = SEG_ADDR(offs);
regs.R_DI = SEG_OFF(offs);
x86emu_exec_intr(&vesa_emu, 0x10);
x86bios_intr(&regs, 0x10);
if (((vesa_emu.x86.R_AX & 0xff) != 0x4f) || bcmp("VESA", vmbuf, 4))
if (((regs.R_AX & 0xff) != 0x4f) || bcmp("VESA", vmbuf, 4))
return 1;
bcopy(vmbuf, &buf, sizeof(buf));
@ -707,17 +737,17 @@ vesa_bios_init(void)
return 1;
}
vesa_oemstr = (char *)(emumem + L_ADD(vesa_adp_info->v_oemstr));
vesa_oemstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_oemstr));
is_via_cle266 = strcmp(vesa_oemstr, VESA_VIA_CLE266) == 0;
if (vesa_adp_info->v_version >= 0x0200) {
vesa_venderstr = (char *)(emumem+L_ADD(vesa_adp_info->v_venderstr));
vesa_prodstr = (char *)(emumem+L_ADD(vesa_adp_info->v_prodstr));
vesa_revstr = (char *)(emumem+L_ADD(vesa_adp_info->v_revstr));
vesa_venderstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_venderstr));
vesa_prodstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_prodstr));
vesa_revstr = (char *)x86bios_offset(FARP(vesa_adp_info->v_revstr));
}
vesa_vmodetab = (u_int16_t *)(emumem+L_ADD(vesa_adp_info->v_modetable));
vesa_vmodetab = (uint16_t *)x86bios_offset(FARP(vesa_adp_info->v_modetable));
if (vesa_vmodetab == NULL)
return 1;
@ -802,7 +832,7 @@ vesa_bios_init(void)
- vmode.v_lfb;
else
vesa_vmode[modes].vi_buffer_size
= vmode.v_offscreen + vmode.v_offscreensize*1024
= vmode.v_offscreen + vmode.v_offscreensize * 1024;
#endif
vesa_vmode[modes].vi_mem_model
= vesa_translate_mmodel(vmode.v_memmodel);
@ -840,9 +870,26 @@ vesa_bios_init(void)
vesa_vmode[modes].vi_flags
= vesa_translate_flags(vmode.v_modeattr) | V_INFO_VESA;
/* Does it have enough memory to support this mode? */
bsize = vesa_get_line_width(&vesa_vmode[modes]);
bsize *= vesa_vmode[modes].vi_height;
if (bsize > vesa_vmode[modes].vi_buffer_size) {
#if VESA_DEBUG > 1
printf(
"Rejecting VESA %s mode: %d x %d x %d bpp attr = %x, not enough memory\n",
(vmode.v_modeattr & V_MODEGRAPHICS) != 0 ? "graphics" : "text",
vmode.v_width, vmode.v_height, vmode.v_bpp, vmode.v_modeattr);
#endif
continue;
}
++modes;
}
vesa_vmode[modes].vi_mode = EOT;
x86bios_free(vmbuf, 1);
if (bootverbose)
printf("VESA: %d mode(s) found\n", modes);
@ -870,7 +917,8 @@ vesa_map_buffer(u_int paddr, size_t size)
u_int off;
off = paddr - trunc_page(paddr);
vaddr = (vm_offset_t)pmap_mapdev(paddr - off, size + off);
vaddr = (vm_offset_t)pmap_mapdev_attr(paddr - off, size + off,
PAT_WRITE_COMBINING);
#if VESA_DEBUG > 1
printf("vesa_map_buffer: paddr:%x vaddr:%tx size:%zx off:%x\n",
paddr, vaddr, size, off);
@ -1048,7 +1096,6 @@ static int
vesa_set_mode(video_adapter_t *adp, int mode)
{
video_info_t info;
int len;
if (adp != vesa_adp)
return (*prevvidsw->set_mode)(adp, mode);
@ -1126,46 +1173,17 @@ vesa_set_mode(video_adapter_t *adp, int mode)
} else {
vesa_adp->va_buffer = 0;
vesa_adp->va_buffer_size = info.vi_buffer_size;
vesa_adp->va_window = (vm_offset_t)(emumem+L_ADD(info.vi_window));
vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window);
vesa_adp->va_window_size = info.vi_window_size;
vesa_adp->va_window_gran = info.vi_window_gran;
}
vesa_adp->va_window_orig = 0;
len = vesa_bios_get_line_length();
if (len > 0) {
vesa_adp->va_line_width = len;
} else if (info.vi_flags & V_INFO_GRAPHICS) {
switch (info.vi_depth/info.vi_planes) {
case 1:
vesa_adp->va_line_width = info.vi_width/8;
break;
case 2:
vesa_adp->va_line_width = info.vi_width/4;
break;
case 4:
vesa_adp->va_line_width = info.vi_width/2;
break;
case 8:
default: /* shouldn't happen */
vesa_adp->va_line_width = info.vi_width;
break;
case 15:
case 16:
vesa_adp->va_line_width = info.vi_width*2;
break;
case 24:
case 32:
vesa_adp->va_line_width = info.vi_width*4;
break;
}
} else {
vesa_adp->va_line_width = info.vi_width;
}
vesa_adp->va_line_width = vesa_get_line_width(&info);
vesa_adp->va_disp_start.x = 0;
vesa_adp->va_disp_start.y = 0;
#if VESA_DEBUG > 0
printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d\n",
info.vi_width, len, vesa_adp->va_line_width);
printf("vesa_set_mode(): vi_width:%d, line_width:%d\n",
info.vi_width, vesa_adp->va_line_width);
#endif
bcopy(&info, &vesa_adp->va_info, sizeof(vesa_adp->va_info));
@ -1275,14 +1293,17 @@ vesa_load_state(video_adapter_t *adp, void *p)
static int
vesa_get_origin(video_adapter_t *adp, off_t *offset)
{
vesa_emu.x86.R_EAX = 0x4f05;
vesa_emu.x86.R_EBX = 0x10;
x86regs_t regs;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f05;
regs.R_EBX = 0x10;
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
x86bios_intr(&regs, 0x10);
if ((regs.R_AX & 0xff) != 0x4f)
return 1;
*offset = vesa_emu.x86.DX*adp->va_window_gran;
*offset = regs.DX * adp->va_window_gran;
return 0;
}
@ -1291,6 +1312,8 @@ vesa_get_origin(video_adapter_t *adp, off_t *offset)
static int
vesa_set_origin(video_adapter_t *adp, off_t offset)
{
x86regs_t regs;
/*
* This function should return as quickly as possible to
* maintain good performance of the system. For this reason,
@ -1307,18 +1330,20 @@ vesa_set_origin(video_adapter_t *adp, off_t offset)
if (adp->va_window_gran == 0)
return 1;
vesa_emu.x86.R_EAX = 0x4f05;
vesa_emu.x86.R_EBX = 0;
vesa_emu.x86.R_EDX = offset/adp->va_window_gran;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f05;
regs.R_EBX = 0;
regs.R_EDX = offset / adp->va_window_gran;
x86bios_intr(&regs, 0x10);
if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
if ((regs.R_AX & 0xff) != 0x4f)
return 1;
vesa_emu.x86.R_EAX = 0x4f05;
vesa_emu.x86.R_EBX = 1;
vesa_emu.x86.R_EDX = offset/adp->va_window_gran;
x86emu_exec_intr(&vesa_emu, 0x10);
bzero(&regs, sizeof(regs));
regs.R_EAX = 0x4f05;
regs.R_EBX = 1;
regs.R_EDX = offset / adp->va_window_gran;
x86bios_intr(&regs, 0x10);
adp->va_window_orig = (offset/adp->va_window_gran)*adp->va_window_gran;
return 0; /* XXX */
@ -1653,22 +1678,6 @@ vesa_load(void)
if (vesa_init_done)
return 0;
/* Can `emumem' be NULL here? */
emumem = pmap_mapbios(0x0, 0xc00000);
memset(&vesa_emu, 0, sizeof(vesa_emu));
x86emu_init_default(&vesa_emu);
vesa_emu.emu_inb = vm86_emu_inb;
vesa_emu.emu_inw = vm86_emu_inw;
vesa_emu.emu_inl = vm86_emu_inl;
vesa_emu.emu_outb = vm86_emu_outb;
vesa_emu.emu_outw = vm86_emu_outw;
vesa_emu.emu_outl = vm86_emu_outl;
vesa_emu.mem_base = (char *)emumem;
vesa_emu.mem_size = 1024 * 1024;
/* locate a VGA adapter */
s = spltty();
vesa_adp = NULL;
@ -1716,9 +1725,6 @@ vesa_unload(void)
}
splx(s);
if (emumem)
pmap_unmapdev((vm_offset_t)emumem, 0xc00000);
return error;
}
@ -1743,6 +1749,6 @@ static moduledata_t vesa_mod = {
};
DECLARE_MODULE(vesa, vesa_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
MODULE_DEPEND(vesa, x86emu, 1, 1, 1);
MODULE_DEPEND(vesa, x86bios, 1, 1, 1);
#endif /* VGA_NO_MODE_CHANGE */

View File

@ -1979,6 +1979,30 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE", IAP_EVENT_FDH_40H)
#define PMC_EV_TSC_FIRST PMC_EV_TSC_TSC
#define PMC_EV_TSC_LAST PMC_EV_TSC_TSC
/*
* Intel XScale events from "Intel XScale Core Developer's Manual",
* January 2004, #27347302
*/
#define __PMC_EV_XSCALE() \
__PMC_EV(XSCALE, IC_FETCH) \
__PMC_EV(XSCALE, IC_MISS) \
__PMC_EV(XSCALE, DATA_DEPENDENCY_STALL) \
__PMC_EV(XSCALE, ITLB_MISS) \
__PMC_EV(XSCALE, DTLB_MISS) \
__PMC_EV(XSCALE, BRANCH_EXECUTED) \
__PMC_EV(XSCALE, BRANCH_MISPRED) \
__PMC_EV(XSCALE, INSTR_EXECUTED) \
__PMC_EV(XSCALE, DC_FULL_CYCLE) \
__PMC_EV(XSCALE, DC_FULL_CONTIG) \
__PMC_EV(XSCALE, DC_ACCESS) \
__PMC_EV(XSCALE, DC_MISS) \
__PMC_EV(XSCALE, DC_WRITEBACK) \
__PMC_EV(XSCALE, PC_CHANGE)
#define PMC_EV_XSCALE_FIRST PMC_EV_XSCALE_IC_FETCH
#define PMC_EV_XSCALE_LAST PMC_EV_XSCALE_PC_CHANGE
/*
* All known PMC events.
*
@ -1996,6 +2020,7 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE", IAP_EVENT_FDH_40H)
* 0x11000 0x0080 INTEL Pentium 4 events
* 0x11080 0x0080 INTEL Pentium MMX events
* 0x11100 0x0100 INTEL Pentium Pro/P-II/P-III/Pentium-M events
* 0x11200 0x00FF INTEL XScale events
*/
#define __PMC_EVENTS() \
__PMC_EV_BLOCK(TSC, 0x01000) \
@ -2013,9 +2038,11 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE", IAP_EVENT_FDH_40H)
__PMC_EV_BLOCK(P5, 0x11080) \
__PMC_EV_P5() \
__PMC_EV_BLOCK(P6, 0x11100) \
__PMC_EV_P6()
__PMC_EV_P6() \
__PMC_EV_BLOCK(XSCALE, 0x11200) \
__PMC_EV_XSCALE()
#define PMC_EVENT_FIRST PMC_EV_TSC_TSC
#define PMC_EVENT_LAST PMC_EV_P6_LAST
#define PMC_EVENT_LAST PMC_EV_XSCALE_LAST
#endif /* _DEV_HWPMC_PMC_EVENTS_H_ */

View File

@ -1012,7 +1012,12 @@ static void
ndis_vap_delete(struct ieee80211vap *vap)
{
struct ndis_vap *nvp = NDIS_VAP(vap);
struct ieee80211com *ic = vap->iv_ic;
struct ifnet *ifp = ic->ic_ifp;
struct ndis_softc *sc = ifp->if_softc;
ndis_stop(sc);
callout_drain(&sc->ndis_scan_callout);
ieee80211_vap_detach(vap);
free(nvp, M_80211_VAP);
}

View File

@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$");
/*
* General defines
*/
#define MBOX_DELAY_COUNT 1000000 / 100
#define ISP_MARK_PORTDB(a, b, c) \
isp_prt(isp, ISP_LOGSANCFG, \
@ -1547,24 +1546,18 @@ isp_fibre_init(ispsoftc_t *isp)
}
icbp->icb_maxfrmlen = DEFAULT_FRAMESIZE(isp);
if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN ||
icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) {
isp_prt(isp, ISP_LOGERR,
"bad frame length (%d) from NVRAM- using %d",
DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN);
if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) {
isp_prt(isp, ISP_LOGERR, "bad frame length (%d) from NVRAM- using %d", DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN);
icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN;
}
icbp->icb_maxalloc = fcp->isp_maxalloc;
if (icbp->icb_maxalloc < 1) {
isp_prt(isp, ISP_LOGERR,
"bad maximum allocation (%d)- using 16", fcp->isp_maxalloc);
isp_prt(isp, ISP_LOGERR, "bad maximum allocation (%d)- using 16", fcp->isp_maxalloc);
icbp->icb_maxalloc = 16;
}
icbp->icb_execthrottle = DEFAULT_EXEC_THROTTLE(isp);
if (icbp->icb_execthrottle < 1) {
isp_prt(isp, ISP_LOGERR,
"bad execution throttle of %d- using %d",
DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE);
isp_prt(isp, ISP_LOGERR, "bad execution throttle of %d- using %d", DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE);
icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
}
icbp->icb_retry_delay = fcp->isp_retry_delay;
@ -1658,18 +1651,18 @@ isp_fibre_init(ispsoftc_t *isp)
/*
* For 22XX > 2.1.26 && 23XX, set some options.
* XXX: Probably okay for newer 2100 f/w too.
*/
if (ISP_FW_NEWER_THAN(isp, 2, 26, 0)) {
/*
* Turn on LIP F8 async event (1)
* Turn on generate AE 8013 on all LIP Resets (2)
* Disable LIP F7 switching (8)
*/
MBSINIT(&mbs, MBOX_SET_FIRMWARE_OPTIONS, MBLOGALL, 0);
mbs.param[1] = 0xb;
mbs.param[1] = IFCOPT1_DISF7SWTCH|IFCOPT1_LIPASYNC|IFCOPT1_LIPF8;
mbs.param[2] = 0;
mbs.param[3] = 0;
if (ISP_FW_NEWER_THAN(isp, 3, 16, 0)) {
mbs.param[1] |= IFCOPT1_EQFQASYNC|IFCOPT1_CTIO_RETRY;
if (fcp->role & ISP_ROLE_TARGET) {
mbs.param[3] = IFCOPT3_NOPRLI;
}
}
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
@ -2093,8 +2086,7 @@ isp_mark_portdb(ispsoftc_t *isp, int chan, int disposition)
* or via FABRIC LOGIN/FABRIC LOGOUT for other cards.
*/
static int
isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid,
int flags, int gs)
isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags, int gs)
{
mbreg_t mbs;
uint8_t q[QENTRY_LEN];
@ -2771,15 +2763,21 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
/*
* Make sure we're okay for doing this right now.
*/
if (fcp->isp_loopstate != LOOP_PDB_RCVD && fcp->isp_loopstate != LOOP_FSCAN_DONE && fcp->isp_loopstate != LOOP_LSCAN_DONE) {
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d", fcp->isp_loopstate);
if (fcp->isp_loopstate != LOOP_PDB_RCVD &&
fcp->isp_loopstate != LOOP_FSCAN_DONE &&
fcp->isp_loopstate != LOOP_LSCAN_DONE) {
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d",
fcp->isp_loopstate);
return (-1);
}
if (fcp->isp_topo == TOPO_FL_PORT || fcp->isp_topo == TOPO_NL_PORT || fcp->isp_topo == TOPO_N_PORT) {
if (fcp->isp_topo == TOPO_FL_PORT ||
fcp->isp_topo == TOPO_NL_PORT ||
fcp->isp_topo == TOPO_N_PORT) {
if (fcp->isp_loopstate < LOOP_LSCAN_DONE) {
if (isp_scan_loop(isp, chan) != 0) {
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: isp_scan_loop failed");
isp_prt(isp, ISP_LOGWARN,
"isp_pdb_sync: isp_scan_loop failed");
return (-1);
}
}
@ -2788,13 +2786,15 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) {
if (fcp->isp_loopstate < LOOP_FSCAN_DONE) {
if (isp_scan_fabric(isp, chan) != 0) {
isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: isp_scan_fabric failed");
isp_prt(isp, ISP_LOGWARN,
"isp_pdb_sync: isp_scan_fabric failed");
return (-1);
}
}
}
isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d Synchronizing PDBs", chan);
isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0,
"Chan %d Synchronizing PDBs", chan);
fcp->isp_loopstate = LOOP_SYNCING_PDB;
@ -2823,7 +2823,11 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
lp->state = FC_PORTDB_STATE_NIL;
isp_async(isp, ISPASYNC_DEV_GONE, chan, lp);
if (lp->autologin == 0) {
(void) isp_plogx(isp, chan, lp->handle, lp->portid, PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT | PLOGX_FLG_FREE_NPHDL, 0);
(void) isp_plogx(isp, chan, lp->handle,
lp->portid,
PLOGX_FLG_CMD_LOGO |
PLOGX_FLG_IMPLICIT |
PLOGX_FLG_FREE_NPHDL, 0);
} else {
lp->autologin = 0;
}
@ -3069,7 +3073,8 @@ isp_scan_loop(ispsoftc_t *isp, int chan)
for (i = 0; i < MAX_FC_TARG; i++) {
lp = &fcp->portdb[i];
if (lp->state == FC_PORTDB_STATE_NIL || lp->target_mode) {
if (lp->state == FC_PORTDB_STATE_NIL ||
lp->target_mode) {
continue;
}
if (lp->node_wwn != tmp.node_wwn) {
@ -3587,7 +3592,8 @@ isp_scan_fabric(ispsoftc_t *isp, int chan)
for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) {
lp = &fcp->portdb[dbidx];
if (lp->state != FC_PORTDB_STATE_PROBATIONAL || lp->target_mode) {
if (lp->state != FC_PORTDB_STATE_PROBATIONAL ||
lp->target_mode) {
continue;
}
if (lp->portid == portid) {
@ -3824,7 +3830,8 @@ isp_scan_fabric(ispsoftc_t *isp, int chan)
if (fcp->portdb[dbidx].target_mode) {
continue;
}
if (fcp->portdb[dbidx].node_wwn == wwnn && fcp->portdb[dbidx].port_wwn == wwpn) {
if (fcp->portdb[dbidx].node_wwn == wwnn &&
fcp->portdb[dbidx].port_wwn == wwpn) {
break;
}
}

View File

@ -31,7 +31,6 @@
*/
#ifndef _ISP_STDS_H
#define _ISP_STDS_H
/*
* FC Frame Header
*
@ -147,6 +146,7 @@ typedef struct {
#define FCP_SNSLEN_VALID 0x02
#define FCP_RSPLEN_VALID 0x01
#define FCP_MAX_RSPLEN 0x08
/*
* FCP Response Code Definitions
* Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08)
@ -159,6 +159,8 @@ typedef struct {
#define FCP_RSPNS_EROFS 3
#define FCP_RSPNS_TMF_REJECT 4
#define FCP_RSPNS_TMF_FAILED 5
#define FCP_RSPNS_TMF_SUCCEEDED 8
#define FCP_RSPNS_TMF_INCORRECT_LUN 9
/* unconverted miscellany */

View File

@ -1,428 +0,0 @@
/* $FreeBSD$ */
/*-
* Copyright (c) 1997-2007 by Matthew Jacob
* 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 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 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.
*/
/*
* Host Adapter Public Target Interface Structures && Routines
*/
#ifndef _ISP_TPUBLIC_H
#define _ISP_TPUBLIC_H 1
/*
* Action codes set by the MD target driver for
* the external layer to figure out what to do with.
*/
typedef enum {
QOUT_HBA_REG=0, /* the argument is a pointer to a hba_register_t */
QOUT_ENABLE, /* the argument is a pointer to a enadis_t */
QOUT_DISABLE, /* the argument is a pointer to a enadis_t */
QOUT_TMD_START, /* the argument is a pointer to a tmd_cmd_t */
QOUT_TMD_DONE, /* the argument is a pointer to a tmd_cmd_t */
QOUT_NOTIFY, /* the argument is a pointer to a tmd_notify_t */
QOUT_HBA_UNREG /* the argument is a pointer to a hba_register_t */
} tact_e;
/*
* Action codes set by the external layer for the
* MD driver to figure out what to do with.
*/
typedef enum {
QIN_HBA_REG=99, /* the argument is a pointer to a hba_register_t */
QIN_GETINFO, /* the argument is a pointer to a info_t */
QIN_SETINFO, /* the argument is a pointer to a info_t */
QIN_GETDLIST, /* the argument is a pointer to a fc_dlist_t */
QIN_ENABLE, /* the argument is a pointer to a enadis_t */
QIN_DISABLE, /* the argument is a pointer to a enadis_t */
QIN_TMD_CONT, /* the argument is a pointer to a tmd_cmd_t */
QIN_TMD_FIN, /* the argument is a pointer to a tmd_cmd_t */
QIN_NOTIFY_ACK, /* the argument is a pointer to a tmd_notify_t */
QIN_HBA_UNREG, /* the argument is a pointer to a hba_register_t */
} qact_e;
/*
* This structure is used to register to other software modules the
* binding of an HBA identifier, driver name and instance and the
* lun width capapbilities of this target driver. It's up to each
* platform to figure out how it wants to do this, but a typical
* sequence would be for the MD layer to find some external module's
* entry point and start by sending a QOUT_HBA_REG with info filled
* in, and the external module to call back with a QIN_HBA_REG that
* passes back the corresponding information.
*/
#define QR_VERSION 16
typedef struct {
/* NB: tags from here to r_version must never change */
void * r_identity;
void (*r_action)(qact_e, void *);
char r_name[8];
int r_inst;
int r_version;
uint32_t r_locator;
uint32_t r_nchannels;
enum { R_FC, R_SPI } r_type;
void * r_private;
} hba_register_t;
/*
* An information structure that is used to get or set per-channel transport layer parameters.
*/
typedef struct {
void * i_identity;
enum { I_FC, I_SPI } i_type;
int i_channel;
int i_error;
union {
struct {
uint64_t wwnn_nvram;
uint64_t wwpn_nvram;
uint64_t wwnn;
uint64_t wwpn;
} fc;
struct {
int iid;
} spi;
} i_id;
} info_t;
/*
* An information structure to return a list of logged in WWPNs. FC specific.
*/
typedef struct {
void * d_identity;
int d_channel;
int d_error;
int d_count;
uint64_t * d_wwpns;
} fc_dlist_t;
/*
* Notify structure
*/
typedef enum {
NT_ABORT_TASK=0x1000,
NT_ABORT_TASK_SET,
NT_CLEAR_ACA,
NT_CLEAR_TASK_SET,
NT_LUN_RESET,
NT_TARGET_RESET,
NT_BUS_RESET,
NT_LIP_RESET,
NT_LINK_UP,
NT_LINK_DOWN,
NT_LOGOUT,
NT_HBA_RESET
} tmd_ncode_t;
typedef struct tmd_notify {
void * nt_hba; /* HBA tag */
uint64_t nt_iid; /* inititator id */
uint64_t nt_tgt; /* target id */
uint16_t nt_lun; /* logical unit */
uint16_t : 15,
nt_need_ack : 1; /* this notify needs an ACK */
uint64_t nt_tagval; /* tag value */
uint32_t nt_channel; /* channel id */
tmd_ncode_t nt_ncode; /* action */
void * nt_lreserved;
void * nt_hreserved;
} tmd_notify_t;
#define LUN_ANY 0xffff
#define TGT_ANY ((uint64_t) -1)
#define INI_ANY ((uint64_t) -1)
#define TAG_ANY ((uint64_t) 0)
#define MATCH_TMD(tmd, iid, lun, tag) \
( \
(tmd) && \
(iid == INI_ANY || iid == tmd->cd_iid) && \
(lun == LUN_ANY || lun == tmd->cd_lun) && \
(tag == TAG_ANY || tag == tmd->cd_tagval) \
)
/*
* A word about ENABLE/DISABLE: the argument is a pointer to a enadis_t
* with en_hba, en_iid, en_chan, en_tgt and en_lun filled out.
*
* If an error occurs in either enabling or disabling the described lun
* cd_error is set with an appropriate non-zero value.
*/
typedef struct {
void * en_private; /* for outer layer usage */
void * en_hba; /* HBA tag */
uint64_t en_iid; /* initiator ID */
uint64_t en_tgt; /* target id */
uint16_t en_lun; /* logical unit */
uint16_t en_chan; /* channel on card */
int en_error;
} enadis_t;
/*
* Suggested Software Target Mode Command Handling structure.
*
* A note about terminology:
*
* MD stands for "Machine Dependent".
*
* This driver is structured in three layers: Outer MD, core, and inner MD.
* The latter also is bus dependent (i.e., is cognizant of PCI bus issues
* as well as platform issues).
*
*
* "Outer Layer" means "Other Module"
*
* Some additional module that actually implements SCSI target command
* policy is the recipient of incoming commands and the source of the
* disposition for them.
*
* The command structure below is one suggested possible MD command structure,
* but since the handling of thbis is entirely in the MD layer, there is
* no explicit or implicit requirement that it be used.
*
* The cd_private tag should be used by the MD layer to keep a free list
* of these structures. Code outside of this driver can then use this
* to identify it's own unit structures. That is, when not on the MD
* layer's freelist, the MD layer should shove into it the identifier
* that the outer layer has for it- passed in on an initial QIN_HBA_REG
* call (see below).
*
* The cd_hba tag is a tag that uniquely identifies the HBA this target
* mode command is coming from. The outer layer has to pass this back
* unchanged to avoid chaos.
*
* The cd_iid, cd_tgt, cd_lun and cd_port tags are used to identify the
* id of the initiator who sent us a command, the target claim to be, the
* lun on the target we claim to be, and the port instance (for multiple
* port host adapters) that this applies to (consider it an extra port
* parameter). The iid, tgt and lun values are deliberately chosen to be
* fat so that, for example, World Wide Names can be used instead of
* the units that the firmware uses (in the case where the MD
* layer maintains a port database, for example).
*
* The cd_tagtype field specifies what kind of command tag type, if
* any, has been sent with the command. Note that the Outer Layer
* still needs to pass the tag handle through unchanged even
* if the tag type is CD_UNTAGGED.
*
* The cd_cdb contains storage for the passed in command descriptor block.
* There is no need to define length as the callee should be able to
* figure this out.
*
* The tag cd_lflags are the flags set by the MD driver when it gets
* command incoming or when it needs to inform any outside entities
* that the last requested action failed.
*
* The tag cd_hflags should be set by any outside software to indicate
* the validity of sense and status fields (defined below) and to indicate
* the direction data is expected to move. It is an error to have both
* CDFH_DATA_IN and CDFH_DATA_OUT set.
*
* If the CDFH_STSVALID flag is set, the command should be completed (after
* sending any data and/or status). If CDFH_SNSVALID is set and the MD layer
* can also handle sending the associated sense data (either back with an
* FCP RESPONSE IU for Fibre Channel or otherwise automatically handling a
* REQUEST SENSE from the initator for this target/lun), the MD layer will
* set the CDFL_SENTSENSE flag on successful transmission of the sense data.
* It is an error for the CDFH_SNSVALID bit to be set and CDFH_STSVALID not
* to be set. It is an error for the CDFH_SNSVALID be set and the associated
* SCSI status (cd_scsi_status) not be set to CHECK CONDITON.
*
* The tag cd_data points to a data segment to either be filled or
* read from depending on the direction of data movement. The tag
* is undefined if no data direction is set. The MD layer and outer
* layers must agree on the meaning of cd_data and it is specifically
* not defined here.
*
* The tag cd_totlen is the total data amount expected to be moved
* over the life of the command. It may be set by the MD layer, possibly
* from the datalen field of an FCP CMND IU unit. If it shows up in the outer
* layers set to zero and the CDB indicates data should be moved, the outer
* layer should set it to the amount expected to be moved.
*
* The tag cd_resid should be the total residual of data not transferred.
* The outer layers need to set this at the begining of command processing
* to equal cd_totlen. As data is successfully moved, this value is decreased.
* At the end of a command, any nonzero residual indicates the number of bytes
* requested by the command but not moved.
*
* The tag cd_xfrlen is the length of the currently active data transfer.
* This allows several interations between any outside software and the
* MD layer to move data.
*
* The reason that total length and total residual have to be tracked
* is to keep track of relative offset.
*
* The tags cd_sense and cd_scsi_status are pretty obvious.
*
* The tag cd_error is to communicate between the MD layer and outer software
* the current error conditions.
*
* The tag cd_lreserved, cd_hreserved are scratch areas for use for the MD
* and outer layers respectively.
*
*/
#ifndef TMD_CDBLEN
#define TMD_CDBLEN 16
#endif
#ifndef TMD_SENSELEN
#define TMD_SENSELEN 18
#endif
#ifndef QCDS
#define QCDS (sizeof (void *))
#endif
typedef struct tmd_cmd {
void * cd_private; /* private data pointer */
void * cd_hba; /* HBA tag */
void * cd_data; /* 'pointer' to data */
uint64_t cd_iid; /* initiator ID */
uint64_t cd_tgt; /* target id */
uint8_t cd_lun[8]; /* logical unit */
uint64_t cd_tagval; /* tag value */
uint32_t cd_channel; /* channel index */
uint32_t cd_lflags; /* flags lower level sets */
uint32_t cd_hflags; /* flags higher level sets */
uint32_t cd_totlen; /* total data load */
uint32_t cd_resid; /* total data residual */
uint32_t cd_xfrlen; /* current data load */
int32_t cd_error; /* current error */
uint8_t cd_tagtype; /* tag type */
uint8_t cd_scsi_status;
uint8_t cd_sense[TMD_SENSELEN];
uint8_t cd_cdb[TMD_CDBLEN];
union {
void * ptrs[QCDS / sizeof (void *)];
uint64_t llongs[QCDS / sizeof (uint64_t)];
uint32_t longs[QCDS / sizeof (uint32_t)];
uint16_t shorts[QCDS / sizeof (uint16_t)];
uint8_t bytes[QCDS];
} cd_lreserved[4], cd_hreserved[4];
} tmd_cmd_t;
/* defined tags */
#define CD_UNTAGGED 0
#define CD_SIMPLE_TAG 1
#define CD_ORDERED_TAG 2
#define CD_HEAD_TAG 3
#define CD_ACA_TAG 4
#ifndef TMD_SIZE
#define TMD_SIZE (sizeof (tmd_cmd_t))
#endif
#define L0LUN_TO_FLATLUN(lptr) ((((lptr)[0] & 0x3f) << 8) | ((lptr)[1]))
#define FLATLUN_TO_L0LUN(lptr, lun) \
(lptr)[1] = lun & 0xff; \
if (sizeof (lun) == 1) { \
(lptr)[0] = 0; \
} else { \
uint16_t nl = lun; \
if (nl == LUN_ANY) { \
(lptr)[0] = (nl >> 8) & 0xff; \
} else if (nl < 256) { \
(lptr)[0] = 0; \
} else { \
(lptr)[0] = 0x40 | ((nl >> 8) & 0x3f); \
} \
} \
memset(&(lptr)[2], 0, 6)
/*
* Note that NODISC (obviously) doesn't apply to non-SPI transport.
*
* Note that knowing the data direction and lengh at the time of receipt of
* a command from the initiator is a feature only of Fibre Channel.
*
* The CDFL_BIDIR is in anticipation of the adoption of some newer
* features required by OSD.
*
* The principle selector for MD layer to know whether data is to
* be transferred in any QOUT_TMD_CONT call is cd_xfrlen- the
* flags CDFH_DATA_IN and CDFH_DATA_OUT define which direction.
*/
#define CDFL_SNSVALID 0x01 /* sense data (from f/w) good */
#define CDFL_SENTSTATUS 0x02 /* last action sent status */
#define CDFL_DATA_IN 0x04 /* target (us) -> initiator (them) */
#define CDFL_DATA_OUT 0x08 /* initiator (them) -> target (us) */
#define CDFL_BIDIR 0x0C /* bidirectional data */
#define CDFL_ERROR 0x10 /* last action ended in error */
#define CDFL_NODISC 0x20 /* disconnects disabled */
#define CDFL_SENTSENSE 0x40 /* last action sent sense data */
#define CDFL_BUSY 0x80 /* this command is not on a free list */
#define CDFL_PRIVATE 0xFF000000 /* private layer flags */
#define CDFH_SNSVALID 0x01 /* sense data (from outer layer) good */
#define CDFH_STSVALID 0x02 /* status valid */
#define CDFH_DATA_IN 0x04 /* target (us) -> initiator (them) */
#define CDFH_DATA_OUT 0x08 /* initiator (them) -> target (us) */
#define CDFH_DATA_MASK 0x0C /* mask to cover data direction */
#define CDFH_PRIVATE 0xFF000000 /* private layer flags */
/*
* A word about the START/CONT/DONE/FIN dance:
*
* When the HBA is enabled for receiving commands, one may show up
* without notice. When that happens, the MD target mode driver
* gets a tmd_cmd_t, fills it with the info that just arrived, and
* calls the outer layer with a QOUT_TMD_START code and pointer to
* the tmd_cmd_t.
*
* The outer layer decodes the command, fetches data, prepares stuff,
* whatever, and starts by passing back the pointer with a QIN_TMD_CONT
* code which causes the MD target mode driver to generate CTIOs to
* satisfy whatever action needs to be taken. When those CTIOs complete,
* the MD target driver sends the pointer to the cmd_tmd_t back with
* a QOUT_TMD_DONE code. This repeats for as long as necessary. These
* may not be done in parallel- they are sequential operations.
*
* The outer layer signals it wants to end the command by settings within
* the tmd_cmd_t itself. When the final QIN_TMD_CONT is reported completed,
* the outer layer frees the tmd_cmd_t by sending the pointer to it
* back with a QIN_TMD_FIN code.
*
* The graph looks like:
*
* QOUT_TMD_START -> [ QIN_TMD_CONT -> QOUT_TMD_DONE ] * -> QIN_TMD_FIN.
*
*/
/*
* Target handler functions.
*
* The MD target handler function (the outer layer calls this)
* should be be prototyped like:
*
* void target_action(qact_e, void *arg)
*
* The outer layer target handler function (the MD layer calls this)
* should be be prototyped like:
*
* void scsi_target_handler(tact_e, void *arg)
*/
#endif /* _ISP_TPUBLIC_H */
/*
* vim:ts=4:sw=4:expandtab
*/

View File

@ -26,6 +26,7 @@
* SUCH DAMAGE.
*
*/
/*
* Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
*/
@ -244,12 +245,38 @@
#define ASYNC_RIO_COMP 0x8042
#define ASYNC_RCV_ERR 0x8048
/*
* Firmware Options. There are a lot of them.
*
* IFCOPTN - ISP Fibre Channel Option Word N
*/
#define IFCOPT1_EQFQASYNC (1 << 13) /* enable QFULL notification */
#define IFCOPT1_EAABSRCVD (1 << 12)
#define IFCOPT1_RJTASYNC (1 << 11) /* enable 8018 notification */
#define IFCOPT1_ENAPURE (1 << 10)
#define IFCOPT1_ENA8017 (1 << 7)
#define IFCOPT1_DISGPIO67 (1 << 6)
#define IFCOPT1_LIPLOSSIMM (1 << 5)
#define IFCOPT1_DISF7SWTCH (1 << 4)
#define IFCOPT1_CTIO_RETRY (1 << 3)
#define IFCOPT1_LIPASYNC (1 << 1)
#define IFCOPT1_LIPF8 (1 << 0)
#define IFCOPT2_LOOPBACK (1 << 1)
#define IFCOPT2_ATIO3_ONLY (1 << 0)
#define IFCOPT3_NOPRLI (1 << 4) /* disable automatic sending of PRLI on local loops */
#define IFCOPT3_RNDASYNC (1 << 1)
/*
* 2.01.31 2200 Only. Need Bit 13 in Mailbox 1 for Set Firmware Options
* mailbox command to enable this.
*/
#define ASYNC_QFULL_SENT 0x8049
/*
* Needs to be enabled
*/
#define ASYNC_AUTO_PLOGI_RJT 0x8018
/*
* 24XX only
*/

View File

@ -728,7 +728,7 @@ genkbd_event(keyboard_t *kbd, int event, void *arg)
size_t len;
u_char *cp;
int mode;
int c;
u_int c;
/* assert(KBD_IS_VALID(kbd)) */
sc = (genkbd_softc_t *)arg;
@ -837,13 +837,14 @@ static int fkey_change_ok(fkeytab_t *, fkeyarg_t *, struct thread *);
int
genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
{
#ifndef KBD_DISABLE_KEYMAP_LOAD
keymap_t *mapp;
#endif
keyarg_t *keyp;
fkeyarg_t *fkeyp;
int s;
int i;
#ifndef KBD_DISABLE_KEYMAP_LOAD
int error;
#endif
s = spltty();
switch (cmd) {
@ -869,18 +870,29 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
break;
case GIO_KEYMAP: /* get keyboard translation table */
bcopy(kbd->kb_keymap, arg, sizeof(*kbd->kb_keymap));
break;
error = copyout(kbd->kb_keymap, *(void **)arg,
sizeof(keymap_t));
splx(s);
return (error);
case PIO_KEYMAP: /* set keyboard translation table */
#ifndef KBD_DISABLE_KEYMAP_LOAD
error = keymap_change_ok(kbd->kb_keymap, (keymap_t *)arg,
curthread);
mapp = malloc(sizeof *mapp, M_TEMP, M_NOWAIT);
error = copyin(*(void **)arg, mapp, sizeof *mapp);
if (error != 0) {
splx(s);
free(mapp, M_TEMP);
return (error);
}
error = keymap_change_ok(kbd->kb_keymap, mapp, curthread);
if (error != 0) {
splx(s);
free(mapp, M_TEMP);
return (error);
}
bzero(kbd->kb_accentmap, sizeof(*kbd->kb_accentmap));
bcopy(arg, kbd->kb_keymap, sizeof(*kbd->kb_keymap));
bcopy(mapp, kbd->kb_keymap, sizeof(*kbd->kb_keymap));
free(mapp, M_TEMP);
break;
#else
splx(s);

View File

@ -304,7 +304,7 @@ mwl_attach(uint16_t devid, struct mwl_softc *sc)
ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
if (ifp == NULL) {
device_printf(sc->sc_dev, "can not if_alloc()\n");
device_printf(sc->sc_dev, "cannot if_alloc()\n");
return ENOSPC;
}
ic = ifp->if_l2com;
@ -2303,8 +2303,10 @@ mwl_dma_setup(struct mwl_softc *sc)
int error, i;
error = mwl_rxdma_setup(sc);
if (error != 0)
if (error != 0) {
mwl_rxdma_cleanup(sc);
return error;
}
for (i = 0; i < MWL_NUM_TX_QUEUES; i++) {
error = mwl_txdma_setup(sc, &sc->sc_txq[i]);

View File

@ -106,6 +106,7 @@ static int mxge_max_slices = 1;
static int mxge_rss_hash_type = MXGEFW_RSS_HASH_TYPE_SRC_PORT;
static int mxge_always_promisc = 0;
static int mxge_initial_mtu = ETHERMTU_JUMBO;
static int mxge_throttle = 0;
static char *mxge_fw_unaligned = "mxge_ethp_z8e";
static char *mxge_fw_aligned = "mxge_eth_z8e";
static char *mxge_fw_rss_aligned = "mxge_rss_eth_z8e";
@ -143,7 +144,7 @@ MODULE_DEPEND(mxge, zlib, 1, 1, 1);
static int mxge_load_firmware(mxge_softc_t *sc, int adopt);
static int mxge_send_cmd(mxge_softc_t *sc, uint32_t cmd, mxge_cmd_t *data);
static int mxge_close(mxge_softc_t *sc);
static int mxge_close(mxge_softc_t *sc, int down);
static int mxge_open(mxge_softc_t *sc);
static void mxge_tick(void *arg);
@ -596,10 +597,13 @@ static int
mxge_select_firmware(mxge_softc_t *sc)
{
int aligned = 0;
int force_firmware = mxge_force_firmware;
if (sc->throttle)
force_firmware = sc->throttle;
if (mxge_force_firmware != 0) {
if (mxge_force_firmware == 1)
if (force_firmware != 0) {
if (force_firmware == 1)
aligned = 1;
else
aligned = 0;
@ -1305,8 +1309,7 @@ mxge_reset(mxge_softc_t *sc, int interrupts_setup)
ss->lro_queued = 0;
ss->lro_flushed = 0;
if (ss->fw_stats != NULL) {
ss->fw_stats->valid = 0;
ss->fw_stats->send_done_count = 0;
bzero(ss->fw_stats, sizeof *ss->fw_stats);
}
}
sc->rdma_tags_available = 15;
@ -1314,9 +1317,47 @@ mxge_reset(mxge_softc_t *sc, int interrupts_setup)
mxge_change_promisc(sc, sc->ifp->if_flags & IFF_PROMISC);
mxge_change_pause(sc, sc->pause);
mxge_set_multicast_list(sc);
if (sc->throttle) {
cmd.data0 = sc->throttle;
if (mxge_send_cmd(sc, MXGEFW_CMD_SET_THROTTLE_FACTOR,
&cmd)) {
device_printf(sc->dev,
"can't enable throttle\n");
}
}
return status;
}
static int
mxge_change_throttle(SYSCTL_HANDLER_ARGS)
{
mxge_cmd_t cmd;
mxge_softc_t *sc;
int err;
unsigned int throttle;
sc = arg1;
throttle = sc->throttle;
err = sysctl_handle_int(oidp, &throttle, arg2, req);
if (err != 0) {
return err;
}
if (throttle == sc->throttle)
return 0;
if (throttle < MXGE_MIN_THROTTLE || throttle > MXGE_MAX_THROTTLE)
return EINVAL;
mtx_lock(&sc->driver_mtx);
cmd.data0 = throttle;
err = mxge_send_cmd(sc, MXGEFW_CMD_SET_THROTTLE_FACTOR, &cmd);
if (err == 0)
sc->throttle = throttle;
mtx_unlock(&sc->driver_mtx);
return err;
}
static int
mxge_change_intr_coal(SYSCTL_HANDLER_ARGS)
{
@ -1379,7 +1420,7 @@ mxge_change_lro_locked(mxge_softc_t *sc, int lro_cnt)
ifp->if_capenable |= IFCAP_LRO;
sc->lro_cnt = lro_cnt;
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
mxge_close(sc);
mxge_close(sc, 0);
err = mxge_open(sc);
}
return err;
@ -1495,6 +1536,10 @@ mxge_add_sysctls(mxge_softc_t *sc)
"read_write_dma_MBs",
CTLFLAG_RD, &sc->read_write_dma,
0, "DMA concurrent Read/Write speed in MB/s");
SYSCTL_ADD_INT(ctx, children, OID_AUTO,
"watchdog_resets",
CTLFLAG_RD, &sc->watchdog_resets,
0, "Number of times NIC was reset");
/* performance related tunables */
@ -1504,6 +1549,12 @@ mxge_add_sysctls(mxge_softc_t *sc)
0, mxge_change_intr_coal,
"I", "interrupt coalescing delay in usecs");
SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
"throttle",
CTLTYPE_INT|CTLFLAG_RW, sc,
0, mxge_change_throttle,
"I", "transmit throttling");
SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
"flow_control_enabled",
CTLTYPE_INT|CTLFLAG_RW, sc,
@ -3600,7 +3651,7 @@ mxge_open(mxge_softc_t *sc)
}
static int
mxge_close(mxge_softc_t *sc)
mxge_close(mxge_softc_t *sc, int down)
{
mxge_cmd_t cmd;
int err, old_down_cnt;
@ -3617,21 +3668,23 @@ mxge_close(mxge_softc_t *sc)
}
#endif
sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
old_down_cnt = sc->down_cnt;
wmb();
err = mxge_send_cmd(sc, MXGEFW_CMD_ETHERNET_DOWN, &cmd);
if (err) {
device_printf(sc->dev, "Couldn't bring down link\n");
if (!down) {
old_down_cnt = sc->down_cnt;
wmb();
err = mxge_send_cmd(sc, MXGEFW_CMD_ETHERNET_DOWN, &cmd);
if (err) {
device_printf(sc->dev,
"Couldn't bring down link\n");
}
if (old_down_cnt == sc->down_cnt) {
/* wait for down irq */
DELAY(10 * sc->intr_coal_delay);
}
wmb();
if (old_down_cnt == sc->down_cnt) {
device_printf(sc->dev, "never got down irq\n");
}
}
if (old_down_cnt == sc->down_cnt) {
/* wait for down irq */
DELAY(10 * sc->intr_coal_delay);
}
wmb();
if (old_down_cnt == sc->down_cnt) {
device_printf(sc->dev, "never got down irq\n");
}
mxge_free_mbufs(sc);
return 0;
@ -3684,8 +3737,9 @@ static int
mxge_watchdog_reset(mxge_softc_t *sc, int slice)
{
struct pci_devinfo *dinfo;
struct mxge_slice_state *ss;
mxge_tx_ring_t *tx;
int err;
int err, running, s, num_tx_slices = 1;
uint32_t reboot;
uint16_t cmd;
@ -3719,6 +3773,30 @@ mxge_watchdog_reset(mxge_softc_t *sc, int slice)
reboot = mxge_read_reboot(sc);
device_printf(sc->dev, "NIC rebooted, status = 0x%x\n",
reboot);
running = sc->ifp->if_drv_flags & IFF_DRV_RUNNING;
if (running) {
/*
* quiesce NIC so that TX routines will not try to
* xmit after restoration of BAR
*/
/* Mark the link as down */
if (sc->link_state) {
sc->link_state = 0;
if_link_state_change(sc->ifp,
LINK_STATE_DOWN);
}
#ifdef IFNET_BUF_RING
num_tx_slices = sc->num_slices;
#endif
/* grab all TX locks to ensure no tx */
for (s = 0; s < num_tx_slices; s++) {
ss = &sc->ss[s];
mtx_lock(&ss->tx.mtx);
}
mxge_close(sc, 1);
}
/* restore PCI configuration space */
dinfo = device_get_ivars(sc->dev);
pci_cfg_restore(sc->dev, dinfo);
@ -3726,10 +3804,22 @@ mxge_watchdog_reset(mxge_softc_t *sc, int slice)
/* and redo any changes we made to our config space */
mxge_setup_cfg_space(sc);
if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) {
mxge_close(sc);
err = mxge_open(sc);
/* reload f/w */
err = mxge_load_firmware(sc, 0);
if (err) {
device_printf(sc->dev,
"Unable to re-load f/w\n");
}
if (running) {
if (!err)
err = mxge_open(sc);
/* release all TX locks */
for (s = 0; s < num_tx_slices; s++) {
ss = &sc->ss[s];
mtx_unlock(&ss->tx.mtx);
}
}
sc->watchdog_resets++;
} else {
tx = &sc->ss[slice].tx;
device_printf(sc->dev,
@ -3745,6 +3835,9 @@ mxge_watchdog_reset(mxge_softc_t *sc, int slice)
be32toh(sc->ss->fw_stats->send_done_count));
device_printf(sc->dev, "not resetting\n");
}
if (err)
device_printf(sc->dev, "watchdog reset failed\n");
return (err);
}
@ -3860,11 +3953,11 @@ mxge_change_mtu(mxge_softc_t *sc, int mtu)
old_mtu = ifp->if_mtu;
ifp->if_mtu = mtu;
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
mxge_close(sc);
mxge_close(sc, 0);
err = mxge_open(sc);
if (err != 0) {
ifp->if_mtu = old_mtu;
mxge_close(sc);
mxge_close(sc, 0);
(void) mxge_open(sc);
}
}
@ -3922,7 +4015,7 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
} else {
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
mxge_close(sc);
mxge_close(sc, 0);
}
}
mtx_unlock(&sc->driver_mtx);
@ -4016,6 +4109,7 @@ mxge_fetch_tunables(mxge_softc_t *sc)
TUNABLE_INT_FETCH("hw.mxge.rss_hash_type", &mxge_rss_hash_type);
TUNABLE_INT_FETCH("hw.mxge.rss_hashtype", &mxge_rss_hash_type);
TUNABLE_INT_FETCH("hw.mxge.initial_mtu", &mxge_initial_mtu);
TUNABLE_INT_FETCH("hw.mxge.throttle", &mxge_throttle);
if (sc->lro_cnt != 0)
mxge_lro_cnt = sc->lro_cnt;
@ -4033,6 +4127,12 @@ mxge_fetch_tunables(mxge_softc_t *sc)
if (mxge_initial_mtu > ETHERMTU_JUMBO ||
mxge_initial_mtu < ETHER_MIN_LEN)
mxge_initial_mtu = ETHERMTU_JUMBO;
if (mxge_throttle && mxge_throttle > MXGE_MAX_THROTTLE)
mxge_throttle = MXGE_MAX_THROTTLE;
if (mxge_throttle && mxge_throttle < MXGE_MIN_THROTTLE)
mxge_throttle = MXGE_MIN_THROTTLE;
sc->throttle = mxge_throttle;
}
@ -4645,7 +4745,7 @@ mxge_detach(device_t dev)
mtx_lock(&sc->driver_mtx);
sc->dying = 1;
if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING)
mxge_close(sc);
mxge_close(sc, 0);
mtx_unlock(&sc->driver_mtx);
ether_ifdetach(sc->ifp);
callout_drain(&sc->co_hdl);

View File

@ -261,6 +261,7 @@ struct mxge_softc {
int fw_multicast_support;
int link_width;
int max_mtu;
int throttle;
int tx_defrag;
int media_flags;
int need_media_probe;
@ -286,6 +287,8 @@ struct mxge_softc {
#define MXGE_PCI_REV_Z8ES 1
#define MXGE_XFP_COMPLIANCE_BYTE 131
#define MXGE_SFP_COMPLIANCE_BYTE 3
#define MXGE_MIN_THROTTLE 416
#define MXGE_MAX_THROTTLE 4096
#define MXGE_HIGHPART_TO_U32(X) \
(sizeof (X) == 8) ? ((uint32_t)((uint64_t)(X) >> 32)) : (0)

View File

@ -2149,62 +2149,38 @@ pci_disable_busmaster_method(device_t dev, device_t child)
int
pci_enable_io_method(device_t dev, device_t child, int space)
{
uint16_t command;
uint16_t bit;
char *error;
bit = 0;
error = NULL;
switch(space) {
case SYS_RES_IOPORT:
bit = PCIM_CMD_PORTEN;
error = "port";
break;
case SYS_RES_MEMORY:
bit = PCIM_CMD_MEMEN;
error = "memory";
break;
default:
return (EINVAL);
}
pci_set_command_bit(dev, child, bit);
/* Some devices seem to need a brief stall here, what do to? */
command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2);
if (command & bit)
return (0);
device_printf(child, "failed to enable %s mapping!\n", error);
return (ENXIO);
return (0);
}
int
pci_disable_io_method(device_t dev, device_t child, int space)
{
uint16_t command;
uint16_t bit;
char *error;
bit = 0;
error = NULL;
switch(space) {
case SYS_RES_IOPORT:
bit = PCIM_CMD_PORTEN;
error = "port";
break;
case SYS_RES_MEMORY:
bit = PCIM_CMD_MEMEN;
error = "memory";
break;
default:
return (EINVAL);
}
pci_clear_command_bit(dev, child, bit);
command = PCI_READ_CONFIG(dev, child, PCIR_COMMAND, 2);
if (command & bit) {
device_printf(child, "failed to disable %s mapping!\n", error);
return (ENXIO);
}
return (0);
}

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