mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 03:45:02 +01:00
Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8127c559e6 | ||
|
|
9d13ea80f2 | ||
|
|
a2cf25cf34 | ||
|
|
ddae6d9c68 | ||
|
|
326e9c2d28 | ||
|
|
3d1163642e | ||
|
|
dc7b372759 | ||
|
|
bd0ff46f65 | ||
|
|
4c9a76b0e8 | ||
|
|
4865310155 | ||
|
|
8a6b6a9b23 | ||
|
|
69fa854580 | ||
|
|
49700cc896 | ||
|
|
2bebbc513d | ||
|
|
1b8a115dcd | ||
|
|
ee553c69b6 | ||
|
|
34ae96a42c | ||
|
|
f50623b064 | ||
|
|
d8abef3b68 | ||
|
|
a3feb3e8f5 | ||
|
|
1e31f52b04 | ||
|
|
84b62d8b0b | ||
|
|
c5f3dba8c1 | ||
|
|
48cbd78c0b | ||
|
|
2663e1856b | ||
|
|
5474495c2c | ||
|
|
0f2dc80030 | ||
|
|
e0791d30a6 | ||
|
|
774b865493 | ||
|
|
153b9cb02b | ||
|
|
79e48d0205 |
No files matched your search
+1
-1
@@ -531,7 +531,7 @@ update:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}; cvs -q update -rRELENG_4 -P -d
|
||||
cd ${.CURDIR}; cvs -q update -rRELENG_4_8 -P -d
|
||||
.endif
|
||||
|
||||
#
|
||||
|
||||
@@ -8,6 +8,10 @@ A reverse chronology since 4.0 was released is included, followed by
|
||||
the common items quick how-tos, followed by entries for versions of
|
||||
-current prior to 4.0 Release.
|
||||
|
||||
|
||||
20030331:
|
||||
FreeBSD 4.8-RELEASE.
|
||||
|
||||
20030214:
|
||||
OpenSSL 0.97 has been imported, and the libcrypto/libssl
|
||||
library versions have been bumped.
|
||||
|
||||
@@ -94,7 +94,7 @@ int main (argc, argv, envp)
|
||||
int argc;
|
||||
char **argv, **envp;
|
||||
{
|
||||
int i;
|
||||
int i, e;
|
||||
struct servent *ent;
|
||||
struct interface_info *ip;
|
||||
struct client_state *client;
|
||||
@@ -111,8 +111,11 @@ int main (argc, argv, envp)
|
||||
int no_dhclient_db = 0;
|
||||
int no_dhclient_pid = 0;
|
||||
int no_dhclient_script = 0;
|
||||
FILE *pidfd;
|
||||
pid_t oldpid;
|
||||
char *s;
|
||||
|
||||
oldpid = 0;
|
||||
/* Make sure we have stdin, stdout and stderr. */
|
||||
i = open ("/dev/null", O_RDWR);
|
||||
if (i == 0)
|
||||
@@ -253,15 +256,18 @@ int main (argc, argv, envp)
|
||||
|
||||
/* first kill of any currently running client */
|
||||
if (release_mode) {
|
||||
/* XXX inelegant hack to prove concept */
|
||||
char command[1024];
|
||||
|
||||
#if !defined (NO_SNPRINTF)
|
||||
snprintf (command, 1024, "kill `cat %s`", path_dhclient_pid);
|
||||
#else
|
||||
sprintf (command, "kill `cat %s`", path_dhclient_pid);
|
||||
#endif
|
||||
system (command);
|
||||
if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) {
|
||||
e = fscanf(pidfd, "%d", &oldpid);
|
||||
|
||||
if (e != 0 && e != EOF) {
|
||||
if (oldpid) {
|
||||
if (kill(oldpid, SIGKILL) == 0)
|
||||
unlink(path_dhclient_pid);
|
||||
}
|
||||
}
|
||||
fclose(pidfd);
|
||||
}
|
||||
}
|
||||
|
||||
if (!quiet) {
|
||||
|
||||
@@ -1,254 +0,0 @@
|
||||
/* $NetBSD: strsuftoll.c,v 1.1 2002/11/29 12:58:17 lukem Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Luke Mewburn.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Keith Muller of the University of California, San Diego and Lance
|
||||
* Visser of Convex Computer Corporation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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>
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: strsuftoll.c,v 1.1 2002/11/29 12:58:17 lukem Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifdef _LIBC
|
||||
#include "namespace.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if !HAVE_STRSUFTOLL
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
# define _STRSUFTOLL _strsuftoll
|
||||
# define _STRSUFTOLLX _strsuftollx
|
||||
# ifdef __weak_alias
|
||||
__weak_alias(strsuftoll, _strsuftoll)
|
||||
__weak_alias(strsuftollx, _strsuftollx)
|
||||
# endif
|
||||
#else /* !LIBC */
|
||||
# define _STRSUFTOLL strsuftoll
|
||||
# define _STRSUFTOLLX strsuftollx
|
||||
#endif /* !LIBC */
|
||||
|
||||
/*
|
||||
* Convert an expression of the following forms to a (u)int64_t.
|
||||
* 1) A positive decimal number.
|
||||
* 2) A positive decimal number followed by a b (mult by 512).
|
||||
* 3) A positive decimal number followed by a k (mult by 1024).
|
||||
* 4) A positive decimal number followed by a m (mult by 1048576).
|
||||
* 5) A positive decimal number followed by a w (mult by sizeof int)
|
||||
* 6) Two or more positive decimal numbers (with/without k,b or w).
|
||||
* separated by x (also * for backwards compatibility), specifying
|
||||
* the product of the indicated values.
|
||||
* Returns the result upon successful conversion, or exits with an
|
||||
* appropriate error.
|
||||
*
|
||||
*/
|
||||
/* LONGLONG */
|
||||
long long
|
||||
_STRSUFTOLL(const char *desc, const char *val,
|
||||
long long min, long long max)
|
||||
{
|
||||
long long result;
|
||||
char errbuf[100];
|
||||
|
||||
result = strsuftollx(desc, val, min, max, errbuf, sizeof(errbuf));
|
||||
if (*errbuf != '\0')
|
||||
errx(1, "%s", errbuf);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* As strsuftoll(), but returns the error message into the provided buffer
|
||||
* rather than exiting with it.
|
||||
*/
|
||||
/* LONGLONG */
|
||||
long long
|
||||
_STRSUFTOLLX(const char *desc, const char *val,
|
||||
long long min, long long max, char *ebuf, size_t ebuflen)
|
||||
{
|
||||
long long num, t;
|
||||
char *expr;
|
||||
|
||||
_DIAGASSERT(desc != NULL);
|
||||
_DIAGASSERT(val != NULL);
|
||||
_DIAGASSERT(ebuf != NULL);
|
||||
|
||||
errno = 0;
|
||||
ebuf[0] = '\0';
|
||||
|
||||
while (isspace((unsigned char)*val)) /* Skip leading space */
|
||||
val++;
|
||||
|
||||
num = strtoll(val, &expr, 0);
|
||||
if (errno == ERANGE)
|
||||
goto erange; /* Overflow */
|
||||
|
||||
if (expr == val) /* No digits */
|
||||
goto badnum;
|
||||
|
||||
switch (*expr) {
|
||||
case 'b':
|
||||
t = num;
|
||||
num *= 512; /* 1 block */
|
||||
if (t > num)
|
||||
goto erange;
|
||||
++expr;
|
||||
break;
|
||||
case 'k':
|
||||
t = num;
|
||||
num *= 1024; /* 1 kilobyte */
|
||||
if (t > num)
|
||||
goto erange;
|
||||
++expr;
|
||||
break;
|
||||
case 'm':
|
||||
t = num;
|
||||
num *= 1048576; /* 1 megabyte */
|
||||
if (t > num)
|
||||
goto erange;
|
||||
++expr;
|
||||
break;
|
||||
case 'g':
|
||||
t = num;
|
||||
num *= 1073741824; /* 1 gigabyte */
|
||||
if (t > num)
|
||||
goto erange;
|
||||
++expr;
|
||||
break;
|
||||
case 't':
|
||||
t = num;
|
||||
num *= 1099511627776LL; /* 1 terabyte */
|
||||
if (t > num)
|
||||
goto erange;
|
||||
++expr;
|
||||
break;
|
||||
case 'w':
|
||||
t = num;
|
||||
num *= sizeof(int); /* 1 word */
|
||||
if (t > num)
|
||||
goto erange;
|
||||
++expr;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (*expr) {
|
||||
case '\0':
|
||||
break;
|
||||
case '*': /* Backward compatible */
|
||||
case 'x':
|
||||
t = num;
|
||||
num *= strsuftollx(desc, expr + 1, min, max, ebuf, ebuflen);
|
||||
if (*ebuf != '\0')
|
||||
return (0);
|
||||
if (t > num) {
|
||||
erange:
|
||||
snprintf(ebuf, ebuflen,
|
||||
"%s: %s", desc, strerror(ERANGE));
|
||||
return (0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
badnum: snprintf(ebuf, ebuflen,
|
||||
"%s `%s': illegal number", desc, val);
|
||||
return (0);
|
||||
}
|
||||
if (num < min) {
|
||||
/* LONGLONG */
|
||||
snprintf(ebuf, ebuflen, "%s %lld is less than %lld.",
|
||||
desc, (long long)num, (long long)min);
|
||||
return (0);
|
||||
}
|
||||
if (num > max) {
|
||||
/* LONGLONG */
|
||||
snprintf(ebuf, ebuflen,
|
||||
"%s %lld is greater than %lld.",
|
||||
desc, (long long)num, (long long)min);
|
||||
return (0);
|
||||
}
|
||||
*ebuf = '\0';
|
||||
return (num);
|
||||
}
|
||||
|
||||
#endif /* !HAVE_STRSUFTOLL */
|
||||
@@ -1,46 +0,0 @@
|
||||
# $NetBSD: Makefile,v 1.49 2002/08/22 00:09:38 christos Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 4/4/94
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PROG= ftpd
|
||||
SRCS= cmds.c conf.c ftpd.c ftpcmd.y logutmp.c logwtmp.c popen.c
|
||||
CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX
|
||||
DPADD+= ${LIBCRYPT} ${LIBUTIL}
|
||||
LDADD+= -lcrypt -lutil
|
||||
MAN= ftpd.conf.5 ftpusers.5 ftpd.8
|
||||
MLINKS= ftpusers.5 ftpchroot.5
|
||||
|
||||
# for `internal' ls
|
||||
SRCS+= ls.c cmp.c print.c stat_flags.c util.c
|
||||
.PATH: ${NETBSDSRCDIR}/bin/ls
|
||||
|
||||
CPPFLAGS+=-DINET6
|
||||
.include <bsd.own.mk>
|
||||
|
||||
WARNS=2
|
||||
|
||||
.if (${USE_SKEY} != "no")
|
||||
CPPFLAGS+=-DSKEY
|
||||
DPADD+= ${LIBSKEY}
|
||||
LDADD+= -lskey
|
||||
.endif
|
||||
|
||||
ftpd.o ftpcmd.o: version.h
|
||||
|
||||
# XXX Kerberos support is broken right now.
|
||||
#.PATH: ${NETBSDSRCDIR}/usr.bin/login
|
||||
|
||||
#.ifdef KERBEROS5
|
||||
#SRCS+= k5login.c
|
||||
#CPPFLAGS+=-DKERBEROS5
|
||||
#DPADD+= ${LIBKRB5} ${LIBK5CRYPTO} ${LIBCOM_ERR}
|
||||
#LDADD+= -lkrb5 -lk5crypto -lcom_err
|
||||
#.else
|
||||
#SRCS+= klogin.c
|
||||
#CPPFLAGS+=-DKERBEROS
|
||||
#DPADD+= ${LIBKRB} ${LIBDES} ${LIBCOM_ERR}
|
||||
#LDADD+= -lkrb -kdes -lcom_err
|
||||
#.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -329,6 +329,8 @@ setdefaults(e)
|
||||
DontProbeInterfaces = DPI_PROBEALL;
|
||||
DoubleBounceAddr = "postmaster";
|
||||
MaxHeadersLength = MAXHDRSLEN;
|
||||
MaxMimeHeaderLength = MAXLINE;
|
||||
MaxMimeFieldLength = MaxMimeHeaderLength / 2;
|
||||
MaxForwardEntries = 0;
|
||||
FastSplit = 1;
|
||||
#if SASL
|
||||
|
||||
@@ -608,7 +608,7 @@ unsigned char TokTypeNoC[256] =
|
||||
};
|
||||
|
||||
|
||||
#define NOCHAR -1 /* signal nothing in lookahead token */
|
||||
#define NOCHAR (-1) /* signal nothing in lookahead token */
|
||||
|
||||
char **
|
||||
prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
@@ -694,6 +694,7 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
/* see if there is room */
|
||||
if (q >= &pvpbuf[pvpbsize - 5])
|
||||
{
|
||||
addrtoolong:
|
||||
usrerr("553 5.1.1 Address too long");
|
||||
if (strlen(addr) > MAXNAME)
|
||||
addr[MAXNAME] = '\0';
|
||||
@@ -705,11 +706,15 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
}
|
||||
|
||||
/* squirrel it away */
|
||||
#if !ALLOW_255
|
||||
if ((char) c == (char) -1 && !tTd(82, 101))
|
||||
c &= 0x7f;
|
||||
#endif /* !ALLOW_255 */
|
||||
*q++ = c;
|
||||
}
|
||||
|
||||
/* read a new input character */
|
||||
c = *p++;
|
||||
c = (*p++) & 0x00ff;
|
||||
if (c == '\0')
|
||||
{
|
||||
/* diagnose and patch up bad syntax */
|
||||
@@ -764,6 +769,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
}
|
||||
else if (c != '!' || state == QST)
|
||||
{
|
||||
/* see if there is room */
|
||||
if (q >= &pvpbuf[pvpbsize - 5])
|
||||
goto addrtoolong;
|
||||
*q++ = '\\';
|
||||
continue;
|
||||
}
|
||||
@@ -849,6 +857,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
|
||||
/* new token */
|
||||
if (tok != q)
|
||||
{
|
||||
/* see if there is room */
|
||||
if (q >= &pvpbuf[pvpbsize - 5])
|
||||
goto addrtoolong;
|
||||
*q++ = '\0';
|
||||
if (tTd(22, 36))
|
||||
{
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
|
||||
SM_RCSID("@(#)$Id: version.c,v 8.104.2.14 2003/01/15 17:55:43 ca Exp $")
|
||||
|
||||
char Version[] = "8.12.8";
|
||||
char Version[] = "8.12.8p1";
|
||||
@@ -1,823 +0,0 @@
|
||||
%% $FreeBSD$
|
||||
%% From The War Against The Chtorr,
|
||||
%% Copyright David Gerrold, 1984-2000, all rights reserved,
|
||||
%% used with permission of the author.
|
||||
%%
|
||||
%%© This is the copyright line.
|
||||
%%Eighty-nine is the year we assign.
|
||||
%% These verses are caroled
|
||||
%% by one David Gerrold.
|
||||
%%All rights are reserved. This is mine. *
|
||||
%%
|
||||
A limerick of classic proportion
|
||||
should have meter and rhyme and a portion
|
||||
of humor quite lewd,
|
||||
and a frightfully crude,
|
||||
impossible sexual contortion.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A limerick is best when it's lewd,
|
||||
gross, titillating and crude --
|
||||
but this one is clean,
|
||||
unless you are seen
|
||||
reading it aloud in the nude.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
I wanted to print here a medley
|
||||
of limericks so gross they were deadly,
|
||||
but when the typesetter tried
|
||||
to set them, he died;
|
||||
(not to mention my editor, Smedly.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
I have written some limericks quite fateful,
|
||||
malicious and vicious and hateful;
|
||||
but I've torn up the jokes
|
||||
that will sicken most folks,
|
||||
and humanity ought to be grateful.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young lady named Susie,
|
||||
Who everyone thought was a floozy.
|
||||
She liked boy scout troops
|
||||
and Shriners, in groups;
|
||||
"What the hell?" She replied. "I'm not choosy."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A fellow who lived in West Perkin
|
||||
was always a-jerkin' his gherkin.
|
||||
Said he, "It's not fickle
|
||||
to play with my pickle.
|
||||
At least my gherkin's a workin'."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A proctologist name of McGee
|
||||
once bent over double to see
|
||||
an eyeball of glass
|
||||
he had shoved up his ass,
|
||||
"-- so I can see one that looks back at me."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Bart has a singular penis
|
||||
for his wife who is built like a Venus.
|
||||
He awoke with a fright
|
||||
last Saturday night:
|
||||
"Hey! Something is coming between us!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady who lives in New Delhi
|
||||
has habits disgusting and smelhi.
|
||||
She likes to eat feces
|
||||
of various species.
|
||||
(The recipe is tattooed or her belhi.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A daisy chain isn't a riddle.
|
||||
just some folks who are happy to fiddle,
|
||||
by twos and by threes,
|
||||
on their backs or their knees,
|
||||
and it's fun getting caught in the middle!
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lad with a marvelous bend
|
||||
has no need of a lover or friend.
|
||||
What he does to himself
|
||||
would fill up a shelf,
|
||||
but alas, he has come to his end.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was an old witch, name of Jessie
|
||||
whose crotch was all smelly and messie.
|
||||
She enjoyed a good squirm
|
||||
with an alien worm
|
||||
-- and got stains all over her dressie!
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady who favors coition,
|
||||
has invented the spaceship position.
|
||||
She lies down with ease
|
||||
and pulls up her knees,
|
||||
and hollers, "Lift off!" and "Ignitions!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Isaac the famous seducer,
|
||||
will meet a young lass and conducer
|
||||
to let him get fresh
|
||||
with her quivering flesh,
|
||||
but if there isn't the time, he'll just gucer.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
And old man of Texas named Tanners
|
||||
was notorious for his bad manners.
|
||||
When he noticed the start
|
||||
of an imminent fart,
|
||||
he'd announce it with bullhorns and banners.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A woman who wanted to see,
|
||||
if she stood up, how far she could pee,
|
||||
had pardon to beg,
|
||||
when it ran down her leg,
|
||||
and formed icicles off her left knee.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A promiscuous sort was dear Laurie
|
||||
(Yes, this is that kind of story.)
|
||||
She did it with Joe
|
||||
and Larry and Moe
|
||||
and Curly and Howard and Morrie.
|
||||
|
||||
And Johnny and Richard and Pritchard and Kerry
|
||||
And Lonnie and Horace and Boris and Barry
|
||||
and Donald and Harold
|
||||
and Ronald and Gerald
|
||||
and Tommy and Dicky and Harry.
|
||||
|
||||
And . . . Peter and Paul and Teddy and Todd
|
||||
and Matthew and Mark and Simon and Rod
|
||||
and Brucie and Mark
|
||||
and Bobby and Clarck
|
||||
and she still isn't finished! My God!
|
||||
|
||||
And David and Dennis and Huey and Ken
|
||||
and Dewey and Louie, then David again,
|
||||
and Willy and Ben
|
||||
and David again
|
||||
and again and again and again.
|
||||
|
||||
And Danny and Manny and Gary and Fred
|
||||
and Mackie and Jackie and Dougie and Ned
|
||||
and Harvey and Len
|
||||
(then David again)
|
||||
and -- hold on just a second, she's dead!
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young man from St. Loo,
|
||||
who gave his dear sister a screw.
|
||||
Said he, with aplomb,
|
||||
"You're better than Mom."
|
||||
Said she, "That's what Dad told me too!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady who didn't like flies
|
||||
managed to hide her surprise,
|
||||
when she opened up one
|
||||
and found it was fun.
|
||||
Now she willingly widens her thighs.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young lady named Nancy,
|
||||
who liked having sex, plain of fancy.
|
||||
With lightning and thunder,
|
||||
and a profound sense of wonder,
|
||||
But not with a partner -- much too chancy.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young lady quite tearful.
|
||||
Of sucking a cock, she was fearful.
|
||||
In a moment of dreard,
|
||||
she just turned her head.
|
||||
And, boy! Did she get an earful!
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A mathematician named Boris
|
||||
had a wife with a wondrous clitoris.
|
||||
He charged a small fee
|
||||
for his colleagues to see
|
||||
that it was made in the shape of a torus.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
The ladies all had to agree
|
||||
that Mort's penis was too small to see.
|
||||
A whore named Louise
|
||||
sniffed, "Who will _that_ please?"
|
||||
Mort proudly submitted, "Just me!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young fellow named Fisk
|
||||
whose comings and goings were brisk,
|
||||
He hid things that were stolen
|
||||
inside his colon,
|
||||
and said, "Hey! It's my own *."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A stunning young lady named Joan
|
||||
thought a penis was made with a bone.
|
||||
She just didn't know
|
||||
'twas her sexual glow
|
||||
that turned parts of men into stone.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A midwife named Flo from Arabia
|
||||
often enjoys giving baby a
|
||||
forty-volt shock
|
||||
to the base of the cock.
|
||||
(On a girl, she goes for the labia.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
I know of a lass who's for sale.
|
||||
She's really a nice piece of tail.
|
||||
From June to September,
|
||||
she'll devour your member,
|
||||
but the rest of the year, she's in jail.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Miss Wilkerson thought it her duty
|
||||
to maintain her conjugal beauty.
|
||||
She mixed up a paste
|
||||
of industrial waste,
|
||||
and applied it to her sweet patootie.*
|
||||
|
||||
* The facts about beauty are known,
|
||||
and well-learned by those who are grown:
|
||||
beauty is thin,
|
||||
it lies on the skin;
|
||||
but ugly goes down to the bone.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
The punctual Cynthia Rolen
|
||||
missed a period, (or it was stolen)
|
||||
She looked up her ass
|
||||
with a tube made of glass,
|
||||
but found only her own semi-colon;
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A short-organ fellow named Kevin
|
||||
used a vacuum to stretch it to seven,
|
||||
then to eight and to nine,
|
||||
and though ten was divine,
|
||||
there will be film at eleven.*
|
||||
|
||||
* If you think that our boy's now a stud,
|
||||
you've been fooled by the size of his pud.
|
||||
Although twelve inches soft,
|
||||
when it rises aloft,
|
||||
he just faints from the sheer lack of blood.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There once was a lady named Lizard,
|
||||
who got lost in a pink candy blizzard,
|
||||
with a fellow named Jim
|
||||
who wanted to swim
|
||||
up her legs to visit her gizzard.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young fellow named Ted,
|
||||
who had a radio put in his head.
|
||||
Long wave or short
|
||||
he did it for sport
|
||||
-- and to improve his reception in bed.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young lady from Venus,
|
||||
whose body was shaped like a penis.
|
||||
A fellow named Hunt
|
||||
was shaped like a cunt,
|
||||
so it all worked out fine, just between us.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was an old bastard named Gene,
|
||||
impotent, selfish, and mean.
|
||||
His dick was so shamed
|
||||
by what the man claimed,
|
||||
it pretended that is was a spleen.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There once was a fellow named Jason,
|
||||
whose horrible death I would hasten.
|
||||
I'd feed him to worms,
|
||||
just to see how he squirms
|
||||
-- but they'd vomit his crap in a basin.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
With a French lass, it's unwise to trifle.
|
||||
They have urges they simply can't stifle.
|
||||
A woman of France
|
||||
will pull down her pants
|
||||
at the sight of a towering eye-full.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
"My God!" screamed devout Mrs. Pike,
|
||||
as she fondled her stableman's spike.
|
||||
"This is quite out of place,
|
||||
and a great loss of face
|
||||
-- but I think I have fallen in like!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A well-endower fellow from Ortening
|
||||
prepared for an evening of sportening,
|
||||
with a boy from a disco,
|
||||
till he lubed up his Crisco,
|
||||
and discovered, alas, it was _shortening_!
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady who read Sigmund Freud,
|
||||
thought her genitals underemployed;
|
||||
so she put in a stand
|
||||
for a seven-piece band,
|
||||
and held dances that we all enjoyed.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady named Shirley was mellow
|
||||
and she said to her eager young fellow,
|
||||
"I prefer bagels and lox
|
||||
to sucking off cocks,
|
||||
Or even a nice dish of Jell-O!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young man from St. Helens
|
||||
afflicted with shrinkin's and swellin's.
|
||||
His dick was so small
|
||||
it was not there at all,
|
||||
but his balls looked like honeydew melons.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A woman who once faked a lettera
|
||||
reference by which she could gettera
|
||||
job much improved,
|
||||
regretted her move
|
||||
when they asked her to show her et cetera.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady of South Madagascar
|
||||
wears a bag on her head; it's to mask her.
|
||||
A bottle of scotch
|
||||
might loosen her crotch.
|
||||
Wait here, I'll go and I'll ask her.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Chuck is weird, let the whole world know it.
|
||||
He brought in his bucket to show it.
|
||||
We all had a fit
|
||||
when we saw it was shit.
|
||||
We didn't know he was planning to throw it.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
"Which partners are best? Sixty-niners.
|
||||
And better than that? Try the Shriners."
|
||||
These are the results
|
||||
of consenting adults,
|
||||
(and occasional like-minded minors.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady's iambic pentameter
|
||||
is thirty-two inches diameter.
|
||||
The breadth of her scansion
|
||||
is due to expansion
|
||||
in the pants of a critical amateur.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young fellow from Norwich
|
||||
Who liked having sex with his porridge.
|
||||
With sugar and cream
|
||||
and a buttery scream --
|
||||
(The leftovers went into storage.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young fellow named Jim
|
||||
who liked to get naked and swim
|
||||
with plastic sex toys
|
||||
shaped like pubescent boys,
|
||||
'cause he'd rather be gay than be grim.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady who jogged in the breeze
|
||||
had bosoms that flapped to her knees.
|
||||
Said she, "They're quite warm,
|
||||
they keep me dry in a storm,
|
||||
and when it snows, I use them for skis."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was an old voyeur named Zeke,
|
||||
who liked to hide in the closet and peek,
|
||||
then jump out with loud cries
|
||||
of "Aha!" and "Surprise!"
|
||||
and point out your flaws in technique.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Rick promised to gently deflower
|
||||
a maiden who lived on South Gower,
|
||||
(The truth is, he spread
|
||||
her legs wide on the bed,
|
||||
and finsihed her off in an hour.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
These poems have come out of my forehead.
|
||||
The subject are all fairly torrid
|
||||
-- except for the few
|
||||
that will make you say, "Pugh!"
|
||||
And those are the ones that are horrid.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Juanita, the subject of scandals,
|
||||
used to use unscented candles,
|
||||
but now thinks it nice
|
||||
to use a device
|
||||
with batteries, buzzers, and handles.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was an old prune name of Ginty
|
||||
who only ate muffins and thin tea.
|
||||
Thinking of sex
|
||||
gave her the blecchs,
|
||||
and left her all dried up and squinty.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
I have written some limericks quite fateful,
|
||||
malicious and vicious and hateful;
|
||||
but I've torn up the jokes
|
||||
that would sicken most folks,
|
||||
and humanity ought ot be grateful;
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Here's the tale of Benjamin Sneed:
|
||||
Where others were two'd he was three'd
|
||||
and when they unmasked it,
|
||||
(three balls in his basket),
|
||||
he was voted "Most Likely to Breed."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A maiden who had a third breast
|
||||
always kept her hand close to her chest,
|
||||
and I promised her well
|
||||
that I never woudl tell.
|
||||
(Write me privately. Name on request.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Skydiver Daniel McDopp
|
||||
used to masturbate right from the top.
|
||||
Whenever he fell,
|
||||
he jerked off like hell.
|
||||
He was good to the very last drop.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A necrophile name of Ned Schultz,
|
||||
often brags of his deed and exults,
|
||||
"Tis legal, it's said,
|
||||
to make love to the dead,
|
||||
if performed by consenting adults."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Have you ever met Jamie McBeezis?
|
||||
He does any damn thing that he pleases.
|
||||
Says Jamie, undaunted,
|
||||
"If you've got it,then flaunt it!"
|
||||
But he's referring to social diseases.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There once was a nearsighted gynie
|
||||
whose glasses were sparkly and shiny;
|
||||
but they stayed in the drawer
|
||||
while he worked on a whore
|
||||
and tied up the tubes of her hiney.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A shepherd named Jimmie Fitzhugh,
|
||||
said to his sweetheart, "It's true.
|
||||
Nothing is moister
|
||||
than a fresh oister,
|
||||
unless, of course, it is ewe."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There's a reason why Barton is queer.
|
||||
When you meet him, the reason is clear.
|
||||
A goddess named Venus
|
||||
gave him a penis,
|
||||
but Mother Nature filled up his brassiere.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Then there was Benjamin Bright,
|
||||
a contestant on "What's My Delight?"
|
||||
They guesses at his habits
|
||||
with little white rabbits,
|
||||
but were stumped by his mouse and his kite.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young man from St. Lutz,
|
||||
who had a remarkable putz.
|
||||
It would sniff, it would hunt,
|
||||
for it only liked cunt.
|
||||
Absolutely no lips, hands, or butts.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Sally's sex life was carefully planned.
|
||||
Said she, "I prefer to be manned.
|
||||
Things that are anal,
|
||||
are always so banal,
|
||||
but things that expand are just grand."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Sally-Jo was exceedingly vexed,
|
||||
when they said she was quite oversexed.
|
||||
She said, "That's not true,
|
||||
I just like to screw,
|
||||
Now, please take a number. Who's next?"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Sally sued for support; she was claimin'
|
||||
Phil had fathered her baby (named Damon).
|
||||
She said, "I ought to know."
|
||||
as she pointed below.
|
||||
"'Cause this is the box that he came in."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
We will need a computer to tally
|
||||
all the cowboys who scouted our Sally.
|
||||
There were some on her mountains
|
||||
and some on her fountains,
|
||||
and quite a few down in the valley.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady who overly lusted
|
||||
was frequently opened and thrusted.
|
||||
When the baby came due
|
||||
it was female too,
|
||||
and its hymen was already busted.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
When writing these verses of mine,
|
||||
I start with a clever last line,
|
||||
then work backward from there,
|
||||
toward the opening pair,
|
||||
with the hope it'll all work out fine.*
|
||||
|
||||
*only sometimes it doesn't.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There once was a whore from St. Paul,
|
||||
who took anyone, wide, short, or tall.
|
||||
She said to her clients,
|
||||
"It's not really science --
|
||||
it's just that one size will fit all!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young fellow named Forrest
|
||||
whose cornhole was one of the sorest.
|
||||
Said he, "I don't mind
|
||||
a regular grind
|
||||
-- but I do wish my ass were clitorised."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
When Shakespeare awakes with a scream
|
||||
and his member a-drippin' with cream,
|
||||
'tis just the commission
|
||||
of nocturnal emission,
|
||||
which he dubs, "A Mid-Slumber Night-Stream."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
Sally-Jo taught erotic correction.
|
||||
She told her student to get an erection.
|
||||
"Put your dick in my mouth.
|
||||
Move it north, move it south --
|
||||
Now, you're getting a sense of direction!"
|
||||
|
||||
Her instructions were very explicit,
|
||||
and more than a little illicit:
|
||||
"Please fill up my cunny
|
||||
with fresh clover honey,
|
||||
and butter my buns like a biscuit."
|
||||
|
||||
"Then wrap me up nice in a blanket,
|
||||
and I'll sit on your staff while you crank it.
|
||||
I'll put on some feathers,
|
||||
and laces and leathers,
|
||||
and wiggle my ass while you spank it."
|
||||
|
||||
"Now that your fingers are stinky,
|
||||
tie me up in some chains that are clinky.
|
||||
Bring in goats and a sheik,
|
||||
give my titties a tweak
|
||||
--and _now_, we can start getting kinky!"
|
||||
|
||||
"Forget what the chain and the whip meant.
|
||||
Just get the straps and the slings and a shipment
|
||||
of high-grade Vaseline,
|
||||
and a strong trampoline,
|
||||
and allof the other equipment!"
|
||||
|
||||
"Now, when we get all the bedsprings a-drummin',
|
||||
that's when I'll start in a-hummin',
|
||||
then quickly, my dear,
|
||||
put it into my ear,
|
||||
so I'll hear the sound of it comin'!"
|
||||
|
||||
"I don't know how much this is costing,"
|
||||
said her student, still covered with frosting.
|
||||
"But I can say with affinity
|
||||
that I've lost my virginity.
|
||||
Quite frankly, my dear, you're _exhausting_!"
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a mad pilot named Lizzy,
|
||||
whose manners were said to be skizzy.
|
||||
She could loop, she could twirl,
|
||||
she could make your head whirl.
|
||||
She left all her men fucking dizzy.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
The speed of Ed's seed is unclocked
|
||||
whenever a lady's unfrocked.
|
||||
Tho' his spirit is willin,
|
||||
when a pussy needs fillin',
|
||||
he's a man who goes off half-cocked.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A lady whose name is Tirelli
|
||||
has tits made of dynamite jelli.
|
||||
If you take on this dare,
|
||||
you must fondle with care.
|
||||
(The detonator's south of her belli.)
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
The fame of our Mame was her tushy,
|
||||
and the front of her cunt. (It was bushy.)
|
||||
But I heard that her Mike
|
||||
preferred for his spike
|
||||
the place in her face that was skwooshy.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A whore with a face like a hound
|
||||
complained that her sales were down,
|
||||
till a lover named Michael
|
||||
bought her a cycle,
|
||||
and she peddled it all over town.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
There was a young man named Levine
|
||||
who said to his lady, inclined,
|
||||
"Thanks for the spasm,
|
||||
it felt like orgasm;
|
||||
as a matter of fact, 'twas divine."
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
A king who was mad at the time,
|
||||
decreed limerick writing a crime.
|
||||
but late in the night
|
||||
all the poets woudl write
|
||||
verses without any rhyme or meter.
|
||||
|
||||
From The War Against The Chtorr, (c) David Gerrold, 1984-2000, all
|
||||
rights reserved, used with permission of the author.
|
||||
%
|
||||
@@ -52,7 +52,7 @@
|
||||
.ds doc-str-Lb-libvgl Video Graphics Library (libvgl, \-lvgl)
|
||||
.
|
||||
.\" Default .Os value
|
||||
.ds doc-operating-system FreeBSD\~4.7
|
||||
.ds doc-operating-system FreeBSD\~4.8
|
||||
.
|
||||
.ec
|
||||
.
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/* XXX: Depend on our system headers protecting against multiple includes. */
|
||||
#include <paths.h>
|
||||
#undef _PATH_FTPUSERS
|
||||
|
||||
#include <pwd.h>
|
||||
|
||||
#define _DIAGASSERT(x)
|
||||
|
||||
#include <sys/_types.h>
|
||||
#ifndef _SIZE_T_DECLARED
|
||||
typedef __size_t size_t;
|
||||
#define _SIZE_T_DECLARED
|
||||
#endif
|
||||
long long strsuftollx(const char *, const char *,
|
||||
long long, long long, char *, size_t);
|
||||
@@ -1,153 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
|
||||
#ifdef USE_PAM
|
||||
/*
|
||||
* the following code is stolen from imap-uw PAM authentication module and
|
||||
* login.c
|
||||
*/
|
||||
#define COPY_STRING(s) (s ? strdup(s) : NULL)
|
||||
|
||||
struct cred_t {
|
||||
const char *uname; /* user name */
|
||||
const char *pass; /* password */
|
||||
};
|
||||
typedef struct cred_t cred_t;
|
||||
|
||||
static int
|
||||
auth_conv(int num_msg, const struct pam_message **msg,
|
||||
struct pam_response **resp, void *appdata)
|
||||
{
|
||||
int i;
|
||||
cred_t *cred = (cred_t *) appdata;
|
||||
struct pam_response *reply;
|
||||
|
||||
reply = calloc(num_msg, sizeof *reply);
|
||||
if (reply == NULL)
|
||||
return PAM_BUF_ERR;
|
||||
|
||||
for (i = 0; i < num_msg; i++) {
|
||||
switch (msg[i]->msg_style) {
|
||||
case PAM_PROMPT_ECHO_ON: /* assume want user name */
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
reply[i].resp = COPY_STRING(cred->uname);
|
||||
/* PAM frees resp. */
|
||||
break;
|
||||
case PAM_PROMPT_ECHO_OFF: /* assume want password */
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
reply[i].resp = COPY_STRING(cred->pass);
|
||||
/* PAM frees resp. */
|
||||
break;
|
||||
case PAM_TEXT_INFO:
|
||||
case PAM_ERROR_MSG:
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
reply[i].resp = NULL;
|
||||
break;
|
||||
default: /* unknown message style */
|
||||
free(reply);
|
||||
return PAM_CONV_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
*resp = reply;
|
||||
return PAM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt to authenticate the user using PAM. Returns 0 if the user is
|
||||
* authenticated, or 1 if not authenticated. If some sort of PAM system
|
||||
* error occurs (e.g., the "/etc/pam.conf" file is missing) then this
|
||||
* function returns -1. This can be used as an indication that we should
|
||||
* fall back to a different authentication mechanism.
|
||||
*/
|
||||
static int
|
||||
auth_pam(struct passwd **ppw, const char *pass)
|
||||
{
|
||||
pam_handle_t *pamh = NULL;
|
||||
const char *tmpl_user;
|
||||
const void *item;
|
||||
int rval;
|
||||
int e;
|
||||
cred_t auth_cred = { (*ppw)->pw_name, pass };
|
||||
struct pam_conv conv = { &auth_conv, &auth_cred };
|
||||
|
||||
e = pam_start("ftpd", (*ppw)->pw_name, &conv, &pamh);
|
||||
if (e != PAM_SUCCESS) {
|
||||
syslog(LOG_ERR, "pam_start: %s", pam_strerror(pamh, e));
|
||||
return -1;
|
||||
}
|
||||
|
||||
e = pam_set_item(pamh, PAM_RHOST, remotehost);
|
||||
if (e != PAM_SUCCESS) {
|
||||
syslog(LOG_ERR, "pam_set_item(PAM_RHOST): %s",
|
||||
pam_strerror(pamh, e));
|
||||
return -1;
|
||||
}
|
||||
|
||||
e = pam_authenticate(pamh, 0);
|
||||
switch (e) {
|
||||
case PAM_SUCCESS:
|
||||
/*
|
||||
* With PAM we support the concept of a "template"
|
||||
* user. The user enters a login name which is
|
||||
* authenticated by PAM, usually via a remote service
|
||||
* such as RADIUS or TACACS+. If authentication
|
||||
* succeeds, a different but related "template" name
|
||||
* is used for setting the credentials, shell, and
|
||||
* home directory. The name the user enters need only
|
||||
* exist on the remote authentication server, but the
|
||||
* template name must be present in the local password
|
||||
* database.
|
||||
*
|
||||
* This is supported by two various mechanisms in the
|
||||
* individual modules. However, from the application's
|
||||
* point of view, the template user is always passed
|
||||
* back as a changed value of the PAM_USER item.
|
||||
*/
|
||||
if ((e = pam_get_item(pamh, PAM_USER, &item)) ==
|
||||
PAM_SUCCESS) {
|
||||
tmpl_user = (const char *) item;
|
||||
if (strcmp((*ppw)->pw_name, tmpl_user) != 0)
|
||||
*ppw = getpwnam(tmpl_user);
|
||||
} else
|
||||
syslog(LOG_ERR, "Couldn't get PAM_USER: %s",
|
||||
pam_strerror(pamh, e));
|
||||
rval = 0;
|
||||
break;
|
||||
|
||||
case PAM_AUTH_ERR:
|
||||
case PAM_USER_UNKNOWN:
|
||||
case PAM_MAXTRIES:
|
||||
rval = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
syslog(LOG_ERR, "pam_authenticate: %s", pam_strerror(pamh, e));
|
||||
rval = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rval == 0) {
|
||||
e = pam_acct_mgmt(pamh, 0);
|
||||
if (e == PAM_NEW_AUTHTOK_REQD) {
|
||||
e = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
|
||||
if (e != PAM_SUCCESS) {
|
||||
syslog(LOG_ERR, "pam_chauthtok: %s",
|
||||
pam_strerror(pamh, e));
|
||||
rval = 1;
|
||||
}
|
||||
} else if (e != PAM_SUCCESS) {
|
||||
rval = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (rval != 0) {
|
||||
if ((e = pam_end(pamh, e)) != PAM_SUCCESS) {
|
||||
syslog(LOG_ERR, "pam_end: %s", pam_strerror(pamh, e));
|
||||
}
|
||||
pamh = NULL;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
#endif /* USE_PAM */
|
||||
@@ -1,3 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#include <libutil.h>
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
#
|
||||
# Automatic SNAP versioning:
|
||||
DATE != date +%Y%m%d
|
||||
BASE = 4.7
|
||||
BASE = 4.8
|
||||
BUILDNAME?=${BASE}-${DATE}-STABLE
|
||||
#
|
||||
#CHROOTDIR=/junk/release
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
sed \
|
||||
-e '/DEC_3000_300/d' \
|
||||
-e '/DEC_3000_500/d' \
|
||||
-e '/DEC_KN8AE/d' \
|
||||
-e '/SOFTUPDATES/d' \
|
||||
-e '/UFS_DIRHASH/d' \
|
||||
-e '/MFS/d' \
|
||||
@@ -19,6 +20,7 @@ sed \
|
||||
-e '/ICMP_BANDLIM/d' \
|
||||
-e '/AHC_REG_PRETTY_PRINT/d' \
|
||||
-e '/AHD_REG_PRETTY_PRINT/d' \
|
||||
-e '/atapifd/d' \
|
||||
-e '/atapist/d' \
|
||||
-e '/ ncr/d' \
|
||||
-e '/ sa/d' \
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
(If we didn't do this, then the file with the datestamp might
|
||||
not be the one that received the last change in the document.)
|
||||
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/errata/article.sgml,v 1.4.2.37 2003/02/06 22:11:34 ue Exp $
|
||||
basiert auf: 1.1.2.93
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/errata/article.sgml,v 1.4.2.42 2003/03/28 13:29:03 ue Exp $
|
||||
basiert auf: 1.1.2.98
|
||||
-->
|
||||
|
||||
<!DOCTYPE ARTICLE PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
|
||||
@@ -171,6 +171,57 @@
|
||||
Privilegien erhalten konnte. Weitere Informationen finden Sie
|
||||
in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:44.filedesc.asc">FreeBSD-SA-02:44</ulink>.</para>
|
||||
|
||||
<para>Ein über das Netzwerk ausnutzbarer Fehler in
|
||||
<application>CVS</application> könnte dazu führen,
|
||||
daß ein Angreifer beliebige Programme auf dem CVS Server
|
||||
ausführen kann. Weitere Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:01.cvs.asc">FreeBSD-SA-03:01</ulink>.</para>
|
||||
|
||||
<para>Durch Auswertung der Antwortzeiten von
|
||||
<application>OpenSSL</application> wäre es einem Angreifer
|
||||
mit sehr viel Rechenleistung möglich gewesen, unter
|
||||
bestimmten Umständen den Klartext der übermittelten
|
||||
Daten zu erhalten. Dieser Fehler wurde in &os;
|
||||
&release.current; durch die neue
|
||||
<application>OpenSSL</application> Version 0.9.7 behoben. Auf
|
||||
den für Sicherheitsprobleme unterstützten
|
||||
Entwicklungszweigen wurde der Fehler durch die neue
|
||||
<application>OpenSSL</application> Version 0.9.6i behoben.
|
||||
Weitere Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:02.openssl.asc">FreeBSD-SA-03:02</ulink>.</para>
|
||||
|
||||
<para>Es ist theoretisch möglich, daß ein Angreifer
|
||||
den geheimen Schlüssel ermittelt, der von der Erweiterung
|
||||
<quote>syncookies</quote> genutzt wird. Dadurch sinkt deren
|
||||
Effektivität beim Schutz vor TCP SYN Flood
|
||||
Denial-of-Service Angriffen. Hinweise, wie sie das Problem
|
||||
umgehen können und weitere Informationen finden Sie in
|
||||
<ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:03.syncookies.asc">FreeBSD-SA-03:03</ulink>.</para>
|
||||
|
||||
<para>Durch einen Buffer-Überlaufen in den von
|
||||
<application>sendmail</application> genutzten Routinen zum
|
||||
Parsen des Headers war es einen Angreifer möglich, eine
|
||||
speziell konstruierte Nachricht an &man.sendmail.8; zu senden
|
||||
und so beliebige Programme ausführen zu lassen. Diese
|
||||
Programme verfügten über die Rechte des Benutzer,
|
||||
unter dessen Kennung &man.sendmail.8; lief, also typischerweise
|
||||
<username>root</username>. Weitere Informationen und Verweise
|
||||
auf Patches finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:04.sendmail.asc">FreeBSD-SA-03:04</ulink>.</para>
|
||||
|
||||
<para>Durch einen Puffer-Überlauf im XDR Kodierer/Dekodierer
|
||||
war es einem Angreifer mölich, den Service zum Absturz zu
|
||||
bringen. Informationen, wie Sie den Fehler beheben, finden Sie
|
||||
in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:05.xdr.asc">FreeBSD-SA-03:05</ulink>.</para>
|
||||
|
||||
<para><application>OpenSSL</application> enthält zwei
|
||||
Schwachstellen, die erst vor kurzer Zeit bekanntgemacht wurden.
|
||||
Informationen, wie Sie die Probleme umgehen können und
|
||||
weitere Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:06.openssl.asc">FreeBSD-SA-03:06</ulink>.</para>
|
||||
]]>
|
||||
</sect1>
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -28,8 +28,8 @@
|
||||
this file to fix "missed" conversions are likely to break the
|
||||
build.
|
||||
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/hardware/common/dev.sgml,v 1.3.2.26 2003/01/18 19:29:31 ue Exp $
|
||||
basiert auf: 1.13.2.75
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/hardware/common/dev.sgml,v 1.3.2.30 2003/03/19 10:40:36 ue Exp $
|
||||
basiert auf: 1.13.2.79
|
||||
-->
|
||||
|
||||
<sect1>
|
||||
@@ -870,8 +870,8 @@
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para arch="i386">Promise SuperTrak ATA RAID Controller (pst
|
||||
Treiber)
|
||||
<para arch="i386">Promise SuperTrak ATA RAID Controller
|
||||
(&man.pst.4; Treiber)
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Promise SuperTrak SX6000 ATA RAID Controller</para>
|
||||
@@ -893,7 +893,7 @@
|
||||
</para>
|
||||
|
||||
<para arch="i386">PCI SCSI Hostadapter auf Basis des Tekram
|
||||
TRM-S1040 SCSI Chipsatzes (trm Treiber)
|
||||
TRM-S1040 SCSI Chipsatzes (&man.trm.4; Treiber)
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>Tekram DC395U/UW/F</para>
|
||||
@@ -1451,7 +1451,8 @@
|
||||
</para>
|
||||
|
||||
<para arch="i386,alpha">VIA Technologies VT3043 <quote>Rhine
|
||||
I</quote> und VT86C100A <quote>Rhine II</quote> Fast Ethernet
|
||||
I</quote>, VT86C100A <quote>Rhine II</quote> und
|
||||
VT86C105/VT86C105M <quote>Rhine III</quote> Fast Ethernet
|
||||
Karten (&man.vr.4; Treiber)
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
@@ -1828,7 +1829,7 @@
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para arch="i386,alpha">Davicom DM9100 und DM9102 PCI Fast
|
||||
<para arch="i386,alpha">Davicom DM9009, DM9100 und DM9102 PCI Fast
|
||||
Ethernet Karten (&man.dc.4; Treiber)
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
@@ -2965,6 +2966,9 @@
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para arch="i386">Creative Technologies Sound Blaster Live!
|
||||
Familie (emu10k1 Treiber)</para>
|
||||
|
||||
<para arch="i386">Trident 4DWave DX/NX (&man.pcm.4;
|
||||
Treiber)</para>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<!--
|
||||
|
||||
$FreeBSD$
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/installation/common/install.sgml,v 1.2.2.10 2002/12/07 20:28:56 ue Exp $
|
||||
basiert auf: 1.1.2.12
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/installation/common/install.sgml,v 1.2.2.11 2003/02/17 06:59:02 ue Exp $
|
||||
basiert auf: 1.1.2.13
|
||||
|
||||
install.sgml
|
||||
|
||||
@@ -884,18 +884,15 @@ pqb0.0.1.4.0 PQB0 PCI EIDE</screen>
|
||||
löschen, indem Sie auf die Größe der
|
||||
Partition achten).</para>
|
||||
|
||||
<para><application>FIPS</application> kann die FAT32 und
|
||||
VFAT Partitionen, die von neueren Version von Windows 95
|
||||
benutzt werden, nicht bearbeiten. Für diese
|
||||
Partitionen brauchen Sie ein kommerzielles Programm wie
|
||||
<application>Partition Magic</application>.</para>
|
||||
<!--
|
||||
Was soll mir denn das sagen???? ue
|
||||
Sorry, but this is just the breaks if you've got a Windows partition
|
||||
hogging your whole disk and you don't want to reinstall from
|
||||
scratch.</para>
|
||||
-->
|
||||
</answer>
|
||||
<para><application>FIPS</application> kann nicht für
|
||||
NTFS Partitionen benutzt werden. Für diese
|
||||
Partitionen brauchen Sie ein kommerzielles Programm wie
|
||||
<application>Partition Magic</application>. Es mag zwar
|
||||
hart klingen, aber das ist halt der Preis, den Sie zahlen
|
||||
nüssen, wenn eine Windows Partition Ihre gesamte
|
||||
Festplatte belegt und Sie nicht alles neu installieren
|
||||
wollen.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!--
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/relnotes/common/new.sgml,v 1.3.2.118 2003/01/18 19:39:48 ue Exp $
|
||||
basiert auf: 1.22.2.321
|
||||
$FreeBSDde: de-docproj/relnotes/de_DE.ISO8859-1/relnotes/common/new.sgml,v 1.3.2.139 2003/03/28 13:37:04 ue Exp $
|
||||
basiert auf: 1.22.2.346
|
||||
-->
|
||||
|
||||
<articleinfo>
|
||||
@@ -130,6 +130,9 @@
|
||||
Unterstützung für Geräte mit
|
||||
FireWire-Schnittstellen (siehe &man.firewire.4;).</para>
|
||||
|
||||
<para arch="pc98">Der Power Management Controller CanBe wird jetzt
|
||||
unterstützt.</para>
|
||||
|
||||
<para arch="i386,pc98">Der neue Treiber ubsa unterstützt den
|
||||
Belkin F5U103 USB-nach-seriell Konverter und kompatible
|
||||
Geräte.</para>
|
||||
@@ -143,7 +146,21 @@
|
||||
<title>Unterstützung für Prozessoren und
|
||||
Mainboards</title>
|
||||
|
||||
<para></para>
|
||||
<para>&os; hat jetzt minimale Unterstützung für
|
||||
HyperThreading (HTT). SMP Kernel, die mit der Option
|
||||
<literal>HTT</literal> erzeugt wurden, erkennen und aktivieren
|
||||
die logischen Prozessoren auf HTT-Systemen. Die logischen
|
||||
Prozessoren werden vom Scheduler wie zusätzliche
|
||||
physikalische Prozessoren behandelt.</para>
|
||||
|
||||
<para arch="alpha">Wenn Sie &os; auf einer AlphaServer 8200 oder
|
||||
8400 <quote>TurboLaser</quote> benutzen, müssen Sie nach
|
||||
der Installation den getty für die serielle Konsole
|
||||
manuell aktiviert. Wenn Sie das nicht tun, sieht es so aus,
|
||||
als hätte sich Ihre Maschine aufgehängt, weil Sie
|
||||
keine Login-Aufforderung erhalten. Den notwendigen Eintrag
|
||||
finden Sie in <filename>/etc/ttys</filename> bei
|
||||
<literal>zs0</literal>.</para>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
@@ -159,6 +176,8 @@
|
||||
<sect3>
|
||||
<title>Netzwerke und Netzwerkkarten</title>
|
||||
|
||||
<para>Der Treiber cm unterstützt jetzt IPX.</para>
|
||||
|
||||
<para>Der Treiber &man.nge.4; unterstützt jetzt auch
|
||||
&man.polling.4;.</para>
|
||||
|
||||
@@ -169,10 +188,39 @@
|
||||
<sect3>
|
||||
<title>Netzwerk-Protokolle</title>
|
||||
|
||||
<para>Wird in der Konfigurationsdatei für den
|
||||
angepaßten die Option <literal>FAST_IPSEC</literal>
|
||||
verwendet, nutzt IPsec die &man.crypto.4;-Infrastruktur des
|
||||
Kernels, inklusive der Unterstützung für
|
||||
Hardware-Verschlüsselung. Weitere Informationen finden
|
||||
Sie in der Onlinehilfe zu &man.fast.ipsec.4;.
|
||||
<note>
|
||||
<para>Die gleichzeitige Verwendung von
|
||||
<literal>FAST_IPSEC</literal> und <literal>IPSEC</literal>
|
||||
ist nicht möglich.</para>
|
||||
</note>
|
||||
|
||||
<note>
|
||||
<para>Zur Zeit kann <literal>FAST_IPSEC</literal> nicht
|
||||
zusammen mit IPv6 oder der Option <literal>INET6</literal>
|
||||
verwendet werden.</para>
|
||||
</note>
|
||||
</para>
|
||||
|
||||
<para>Der neue Treiber &man.gre.4; unterstützt die
|
||||
Encapsulation von IP Paketen mt GRE (RFC 1701) und die
|
||||
minimale IP Encapsulation für Mobile IP (RFC
|
||||
2004).</para>
|
||||
|
||||
<para>In TCP NewReno wurde ein Fehler behoben, durch den der
|
||||
<quote>Fast Recovery</quote> Modus zu früh beendet wurde,
|
||||
falls NewReno aktiviert war.</para>
|
||||
|
||||
<para>Die Routinen zum Zusammensetzen von fragmentierten
|
||||
IP-Paketen arbeiten jetzt besser, wenn eine große Anzahl
|
||||
Fragmente empfangen wird. Ziel der Änderung war, eine
|
||||
bessere Resistenz gegen Denial-of-Service Angriffe mit
|
||||
Paket-Fragmenten zu erreichen.</para>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
@@ -182,15 +230,23 @@
|
||||
CAM-Schicht und -Treiber (&man.cd.4;, &man.da.4;, &man.st.4;
|
||||
und &man.pass.4;) auf ATA Geräte zuzugreifen, und
|
||||
emuliert so SCSI-Geräte. Um diese Möglichkeit
|
||||
nutzen zu können, muß in der Konfigurationsdatei
|
||||
nutzen zu können, muß in der Konfigurationsdatei
|
||||
für den Kernel die Anweisung <literal>device
|
||||
atapicam</literal> stehen. Weitergehende Informationen finden
|
||||
Sie in &man.atapicam.4;.</para>
|
||||
|
||||
<para>Der Treiber &man.matcd.4; mußte aus
|
||||
lizenzrechtlichen Gründen entfernt werden. Dies geschah
|
||||
schon in &release.prev;, wurde aber versehentlich nicht in den
|
||||
Release Notes erwähnt.</para>
|
||||
<para>Der Treiber &man.matcd.4; wurde entfernt, weil es
|
||||
rechtliche Bedenken wegen der Lizenzbestimmungen gab. Dieses
|
||||
Problem wird zur Zeit diskutiert und es ist denkbar, daß
|
||||
der Treiber in einer später erscheinenden &os;-Version
|
||||
wieder vefügbar sein wird. Der Treiber wurde schon in
|
||||
&release.prev; entfernt, diese Information wurde aber
|
||||
versehentlich nicht in den Release Notes erwähnt.</para>
|
||||
|
||||
<para>Der Treiber &man.targ.4; wurde komplett neu geschrieben.
|
||||
In <filename>/usr/share/examples/scsi_target</filename> steht
|
||||
jetzt ein neuer Benutzer-Modus zur Verfügung, der ein
|
||||
Gerät mit direkten Zugriff emuliert.</para>
|
||||
|
||||
<para>Der neue Treiber trm unterstützt SCSI-Controller auf
|
||||
Basis des Tekram TRM-S1040 SCSI Chipsatzes.</para>
|
||||
@@ -220,8 +276,8 @@
|
||||
<sect3>
|
||||
<title>Zusätzliche Software</title>
|
||||
|
||||
<para></para>
|
||||
|
||||
<para><application>IPFilter</application> steht jetzt in der
|
||||
Version 3.4.31 zur Verfügung.</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
@@ -242,6 +298,44 @@
|
||||
Privilegien erhalten konnte. Weitere Informationen finden Sie
|
||||
in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:44.filedesc.asc">FreeBSD-SA-02:44</ulink>.</para>
|
||||
|
||||
<para>Ein über das Netzwerk ausnutzbarer Fehler in
|
||||
<application>CVS</application> könnte dazu führen,
|
||||
daß ein Angreifer beliebige Programme auf dem CVS Server
|
||||
ausführen kann. Weitere Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:01.cvs.asc">FreeBSD-SA-03:01</ulink>.</para>
|
||||
|
||||
<para>Durch Auswertung der Antwortzeiten von
|
||||
<application>OpenSSL</application> wäre es einem Angreifer
|
||||
mit sehr viel Rechenleistung möglich gewesen, unter
|
||||
bestimmten Umständen den Klartext der übermittelten
|
||||
Daten zu erhalten. Dieser Fehler durch die neue
|
||||
<application>OpenSSL</application> Version 0.9.7 behoben.
|
||||
Weitere Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:02.openssl.asc">FreeBSD-SA-03:02</ulink>.</para>
|
||||
|
||||
<para>Die Sicherheit und Leistung der Erweiterung
|
||||
<quote>syncookies</quote> wurde verbessert, damit Angreifer es
|
||||
schwerer haben, eine Verbindung zu fälschen. Weitere
|
||||
Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:03.syncookies.asc">FreeBSD-SA-03:03</ulink>.</para>
|
||||
|
||||
<para>Ein über das Netzwerk ausnutzbaren Puffer-Überlauf
|
||||
in <application>sendmail</application> wurde durch die
|
||||
Aktualisierung von <application>sendmail</application> auf
|
||||
Version 8.12.8 behoben. Weitere Information finden Sie in
|
||||
<ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:04.sendmail.asc">FreeBSD-SA-03:04</ulink>.</para>
|
||||
|
||||
<para>In der XDR-Implementation wurde ein Fehler behoben, der es
|
||||
einem Angreifer möglich machte, den Dienst abstürzen
|
||||
zu lassen. Weitere Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:05.xdr.asc">FreeBSD-SA-03:05</ulink>.</para>
|
||||
|
||||
<para>In <application>OpenSSL</application> wurden zwei vor kurzem
|
||||
veröffentlichte Schwachstellen repariert. Weitere
|
||||
Informationen finden Sie in <ulink
|
||||
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-03:06.openssl.asc">FreeBSD-SA-03:06</ulink>.</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="userland">
|
||||
@@ -257,6 +351,40 @@
|
||||
angegeben, wird die höchste mögliche Geschwindigkeit
|
||||
verwendet.</para>
|
||||
|
||||
<para arch="alpha,i386">Die Distribution
|
||||
<filename>compat4x</filename> enthält jetzt die in &os;
|
||||
4.7-RELEASE enthaltenen Versionen der Bibliotheken
|
||||
<filename>libcrypto.so.2</filename>,
|
||||
<filename>libgmp.so.3</filename> und
|
||||
<filename>libssl.so.2</filename>.</para>
|
||||
|
||||
<para>Wird &man.ftpd.8; mit der neuen Option <option>-h</option>
|
||||
aufgerufen, werden in den Server-Meldungen keine Informationen
|
||||
über das System (wie die &man.ftpd.8; Versionsnummer oder
|
||||
der Systemname) angegeben.</para>
|
||||
|
||||
<para>Bei &man.ftpd.8; kann jetzt mit der neuen Option
|
||||
<option>-P</option> angegeben werden, auf welchem Port
|
||||
eingehende Verbindungen erwartet werden sollen. Die Portnummer
|
||||
für den Daten-Port ist nicht mehr hart verdraht, sondern
|
||||
immer eins kleiner als die des Ports für die
|
||||
Kommandos.</para>
|
||||
|
||||
<para>&man.ftpd.8; unterstützt jetzt eine erweiterte Version
|
||||
der Datei <filename>/etc/ftpchroot</filename>. Weitere
|
||||
Informationen finden Sie in der ebenfalls neuen Online-Hilfe zu
|
||||
&man.ftpchroot.5;.</para>
|
||||
|
||||
<para>&man.ftpd.8; unterstützt jetzt ein erweitertes Format
|
||||
für die Namen der Home-Verzeichnis, das gleichzeitig ein
|
||||
Startverzeichnis für &man.chroot.2; definiert; dieses
|
||||
Verzeichnis wird dann als Startpunkt für eine
|
||||
&man.chroot.2;-Umgebung genutzt. Zu diesem Zweck wird die
|
||||
Sequenz <literal>/./</literal> genutzt, die auch von anderen
|
||||
FTP-Servern für diesen Zweck genutzt wird. Diese Sequenz
|
||||
kann sowohl in &man.ftpchroot.5; als auch in &man.passwd.5;
|
||||
genutzt werden.</para>
|
||||
|
||||
<para>Das neue Programm &man.fwcontrol.8; ist ein Hilfsmittel zum
|
||||
Zugriff auf und die Kontrolle des FireWire-Subsystems.</para>
|
||||
|
||||
@@ -264,10 +392,29 @@
|
||||
Werte der in POSIX und X/Open angegebenen Variablen für die
|
||||
Pfad- und Systemkonfiguration ausgegeben werden.</para>
|
||||
|
||||
<para>Die neuen &man.ipfw.8;-Befehle <literal>enable</literal> und
|
||||
<literal>disable</literal> können zur Kontrolle
|
||||
verschiedener Aspekte der &man.ipfw.4;-Funktionalität
|
||||
genutzt werden, bis hin zur Aktivierung und Deaktivierung der
|
||||
gesamten Firewall. Im Vergleich mit den bereits existierenden
|
||||
sysctl-Variablen ist dieses Interface einfacher zu bedienen und
|
||||
besser zugänglich.</para>
|
||||
|
||||
<para>Wird &man.make.1; mit der neuen Option <option>-C</option>
|
||||
aufgerufen, wechselt es in das angegebene Verzeichnis, bevor es
|
||||
mit der Arbeit beginnt.</para>
|
||||
|
||||
<para>Wird &man.mount.nfs.8; mit der neuen Option
|
||||
<option>-c</option> aufgerufen, ruft es für UDP Mount
|
||||
Points nicht mehr &man.connect.2; auf. Diese Option muß
|
||||
gesetzt sein, wenn ein Server die Antworten nicht vom
|
||||
Standardport 2049 verschickt oder die Antworten von einer
|
||||
anderen IP-Adresse verschickt (dies kann bei Systemen mit
|
||||
mehreren Netzwerkkarten auftreten). Wird die Sysctl-Variable
|
||||
<varname>vfs.nfs.nfs_ip_paranoia</varname> auf
|
||||
<literal>0</literal> gesetzt, ist diese Option
|
||||
standardmäßig aktiv.</para>
|
||||
|
||||
<para>Wird bei &man.newsyslog.8; bei einem Eintrag (bzw. einer
|
||||
Gruppe von Einträgen, bei denen die Option
|
||||
<literal>G</literal> gesetzt ist) die neue Option
|
||||
@@ -281,6 +428,11 @@
|
||||
Pfadangaben auf ihre Gültigkeit und Portabilität
|
||||
zwischen POSIX-Systemen geprüft werden.</para>
|
||||
|
||||
<para>&man.pw.8; kann jetzt auch User anlegen, deren Namen mit dem
|
||||
Zeichen <literal>$</literal> endet, diese Änderung dient
|
||||
zur Vereinfachung der Administration von
|
||||
<application>Samba</application> Servern.</para>
|
||||
|
||||
<para>Bei &man.rarpd.8; kann jetzt mit <option>-t</option> ein
|
||||
Verzeichnis angegeben werden, das statt
|
||||
<filename>/tftpboot</filename> genutzt wird.</para>
|
||||
@@ -304,35 +456,73 @@
|
||||
<sect3>
|
||||
<title>Zusätzliche Software</title>
|
||||
|
||||
<para><application>BIND</application> steht jetzt in der Version
|
||||
8.3.4 zur Verfügung.</para>
|
||||
|
||||
<para>Alle Anwendungen aus dem <application>bzip2</application>
|
||||
Paket sind jetzt im Basissystem verfügbar (dies betrifft
|
||||
speziell <command>bzip2recover</command>, das jetzt erzeugt
|
||||
und installiert wird).</para>
|
||||
|
||||
<para><application>cvs</application> ist jetzt in der
|
||||
Zwischenversion 1.11.2.1 mit Stand 1. Dezember 2002
|
||||
<para><application>CVS</application> ist jetzt in der Version
|
||||
1.11.5 verfügbar.</para>
|
||||
|
||||
<para><application>FILE</application> steht jetzt in der Version
|
||||
3.41 zur Verfügung.</para>
|
||||
|
||||
<para><application>groff</application> und die dazu
|
||||
gehörenden Programme sind jetzt in der FSF Version 1.18.1
|
||||
verfügbar.</para>
|
||||
|
||||
<para><application>Heimdahl Kerberos</application> ist jetzt in
|
||||
der Version 0.5.1 verfügbar.</para>
|
||||
|
||||
<para>Der <application>ISC DHCP</application> Client steht jetzt
|
||||
in der Version 3.0.1RC11 zur Verfügung.</para>
|
||||
|
||||
<para><application>libz</application> steht jetzt in der Version
|
||||
1.1.4 zur Verfügung.</para>
|
||||
|
||||
<para><application>OpenSSH</application> steht jetzt in der
|
||||
Version 3.5p1 zur Verfügung.</para>
|
||||
|
||||
<para><application>OpenSSL</application> steht jetzt in der
|
||||
Version 0.9.7a zur Verfügung. Die wichtigsten Neuerungen
|
||||
sind die Unterstützung für AES und &man.crypto.4;
|
||||
Geräte.</para>
|
||||
|
||||
<para><application>sendmail</application> steht jetzt in der
|
||||
Version 8.12.8 zur Verfügung.</para>
|
||||
|
||||
<para><application>tcpdump</application> steht jetzt in der
|
||||
Version 3.7.2 zur Verfügung.</para>
|
||||
|
||||
<para>Die Datenbank mit den Zeitzonen steht jetzt in der Version
|
||||
<filename>tzdata2002d</filename> zur Verfügung.</para>
|
||||
</sect3>
|
||||
|
||||
<sect3>
|
||||
<title>Ports/Packages Collection</title>
|
||||
|
||||
<para></para>
|
||||
<title>Infrastruktur für Ports und Packages</title>
|
||||
|
||||
<para>Die nur eine Zeile langen <filename>pkg-comment</filename>
|
||||
Dateien wurden aus allen Ports entfernt und in das
|
||||
<filename>Makefile</filename> des jeweiligen Ports integriert.
|
||||
Dadurch sinken die Plattenbelegung und der Inode-Verbrauch der
|
||||
Ports-Sammlung erheblich.</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>Erzeugung von Releases und Integration</title>
|
||||
|
||||
<para></para>
|
||||
<para><application>GNOME</application> steht jetzt in der Version
|
||||
2.2 zur Verfügung.</para>
|
||||
|
||||
<para><application>KDE</application> steht jetzt in der Version
|
||||
3.1 zur Verfügung.</para>
|
||||
|
||||
<para><application>XFree86</application> steht jetzt in der
|
||||
Version 4.3.0 zur Verfügung.</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
@@ -370,7 +560,7 @@
|
||||
<command>make world</command></quote></ulink> des <ulink
|
||||
url="http://www.FreeBSD.org/doc/de_DE.ISO8859-1/books/handbook/">FreeBSD
|
||||
Handbuchs</ulink>. Eine Aktualisierung einer sehr alten
|
||||
Version von &os; kann mit Problemen verbunden sein; in diesen
|
||||
Version von &os; kann mit Problemen verbunden sein; in diesen
|
||||
Fällen ist es effektiver, eine binäre Aktualisierung
|
||||
oder eine komplette Neuinstallation
|
||||
durchzuführen.</para>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
(("xfree86") (string-append u "&" "manpath=XFree86+4.2.0"))
|
||||
(("netbsd") (string-append u "&" "manpath=NetBSD+1.5"))
|
||||
(("ports") (string-append u "&" "manpath=FreeBSD+Ports"))
|
||||
(else (string-append u "&" "manpath=FreeBSD+4.7-stable")))))
|
||||
(else (string-append u "&" "manpath=FreeBSD+4.8-RELEASE")))))
|
||||
]]>
|
||||
|
||||
(define (toc-depth nd)
|
||||
|
||||
@@ -12,7 +12,7 @@ UNITEXTS= readme errata
|
||||
|
||||
IMAGEDIR= .imagedir
|
||||
RHOST= freefall.freebsd.org
|
||||
RDIR= public_html/relnotes/4-STABLE
|
||||
RDIR= public_html/relnotes/4.8-RELEASE
|
||||
DOCDIR= ./release/doc
|
||||
LANG= en_US.ISO8859-1
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<!-- Version of the OS we're describing. This needs to be updated
|
||||
with each new release. -->
|
||||
<!ENTITY release.current "4.8-RC">
|
||||
<!ENTITY release.current "4.8-RELEASE">
|
||||
|
||||
<!-- The previous version used for comparison in the "What's New"
|
||||
section. For -CURRENT, we might point back to the last
|
||||
@@ -14,19 +14,19 @@
|
||||
<!ENTITY release.prev "4.7-RELEASE">
|
||||
|
||||
<!-- The next version to be released, usually used for snapshots. -->
|
||||
<!ENTITY release.next "4.8-RELEASE">
|
||||
<!ENTITY release.next "4.9-RELEASE">
|
||||
|
||||
<!-- The name of this branch. -->
|
||||
<!ENTITY release.branch "4-STABLE">
|
||||
|
||||
<!-- The URL for obtaining this version of FreeBSD. -->
|
||||
<!ENTITY release.url "http://snapshots.jp.FreeBSD.org/">
|
||||
<!ENTITY release.url "ftp://ftp.FreeBSD.org/">
|
||||
|
||||
<!-- The type of release (usually this will be either "snapshot"
|
||||
or "release" -->
|
||||
<!ENTITY release.type "snapshot">
|
||||
<!ENTITY % release.type.snapshot "INCLUDE">
|
||||
<!ENTITY % release.type.release "IGNORE">
|
||||
<!ENTITY release.type "release">
|
||||
<!ENTITY % release.type.snapshot "IGNORE">
|
||||
<!ENTITY % release.type.release "INCLUDE">
|
||||
|
||||
<!-- Text constants which probably don't need to be changed.-->
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ sed -e '/pty/d' \
|
||||
-e '/AHD_REG_PRETTY_PRINT/d' \
|
||||
-e '/ ncr/d' \
|
||||
-e '/ txp/d' \
|
||||
-e '/ awi$/d' \
|
||||
-e '/ an$/d' \
|
||||
-e '/ wi$/d' \
|
||||
-e '/atapist/d' \
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
#
|
||||
|
||||
#drv filename floppy type description
|
||||
amr amr 2 disk "AMI MegaRAID"
|
||||
aac aac 2 disk "Adaptec AAC RAID"
|
||||
an if_an 2 network "Aironet 4500/4800 802.11 PCMCIA/ISA/PCI card"
|
||||
em if_em 2 network "Intel(R) PRO/1000 Gigabit Ethernet"
|
||||
mlx mlx 2 disk "Mylex DAC960 family RAID"
|
||||
mly mly 2 disk "Mylex AcceleRAID/eXtremeRAID"
|
||||
wi if_wi 2 network "Lucent WaveLAN/IEEE 802.11 PCMCIA card"
|
||||
txp if_txp 2 network "3Com 3cR990 (``Typhoon'') PCI Ethernet"
|
||||
twe twe 2 disk "3ware Escalade RAID"
|
||||
|
||||
@@ -596,20 +596,10 @@ configXDesktop(dialogMenuItem *self)
|
||||
if (DITEM_STATUS(ret) != DITEM_FAILURE && gotit("startkde"))
|
||||
write_root_xprofile("exec startkde\n");
|
||||
}
|
||||
else if (!strcmp(desk, "gnome")) {
|
||||
ret = package_add("gnome");
|
||||
else if (!strcmp(desk, "gnome2")) {
|
||||
ret = package_add("gnome2");
|
||||
if (DITEM_STATUS(ret) != DITEM_FAILURE && gotit("gnome-session")) {
|
||||
ret = package_add("sawfish-gnome");
|
||||
if (DITEM_STATUS(ret) != DITEM_FAILURE && gotit("sawfish"))
|
||||
write_root_xprofile("exec gnome-session\n");
|
||||
}
|
||||
}
|
||||
else if (!strcmp(desk, "enlightenment")) {
|
||||
ret = package_add("gnomecore");
|
||||
if (DITEM_STATUS(ret) != DITEM_FAILURE && gotit("gnome-session")) {
|
||||
ret = package_add("enlightenment");
|
||||
if (DITEM_STATUS(ret) != DITEM_FAILURE && gotit("enlightenment"))
|
||||
write_root_xprofile("exec gnome-session\n");
|
||||
write_root_xprofile("exec gnome-session\n");
|
||||
}
|
||||
}
|
||||
else if (!strcmp(desk, "afterstep")) {
|
||||
|
||||
@@ -953,15 +953,13 @@ DMenu MenuXDesktops = {
|
||||
NULL, dmenuExit },
|
||||
{ "2 KDE", "The K Desktop Environment.",
|
||||
NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=kde" },
|
||||
{ "3 GNOME + Sawfish", "GNOME + Sawfish window manager.",
|
||||
NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=gnome" },
|
||||
{ "4 GNOME + Enlightenment","GNOME + The E window manager",
|
||||
NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=enlightenment" },
|
||||
{ "5 Afterstep", "The Afterstep window manager",
|
||||
{ "3 GNOME 2", "The GNOME 2 Desktop Environment",
|
||||
NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=gnome2" },
|
||||
{ "4 Afterstep", "The Afterstep window manager",
|
||||
NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=afterstep" },
|
||||
{ "6 Windowmaker", "The Windowmaker window manager",
|
||||
{ "5 Windowmaker", "The Windowmaker window manager",
|
||||
NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=windowmaker" },
|
||||
{ "7 fvwm", "The fvwm window manager",
|
||||
{ "6 fvwm", "The fvwm window manager",
|
||||
NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=fvwm2" },
|
||||
{ NULL } },
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
*default host=CHANGE_THIS.FreeBSD.org
|
||||
*default base=/usr
|
||||
*default prefix=/usr
|
||||
*default release=cvs tag=RELENG_4
|
||||
*default release=cvs tag=RELENG_4_8
|
||||
*default delete use-rel-suffix
|
||||
|
||||
# If your network link is a T1 or faster, comment out the following line.
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
.\" Copyright (c) 1983, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
.\"
|
||||
.\" From: @(#)lo.4 8.1 (Berkeley) 6/5/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 25, 2002
|
||||
.Dt DISC 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm disc
|
||||
.Nd software discard network interface
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device disc"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
interface is a software discard mechanism which may be
|
||||
used for performance analysis and/or software testing.
|
||||
As with other network interfaces, the discard interface must have
|
||||
network addresses assigned for each address family with which it is to be used.
|
||||
These addresses
|
||||
may be set or changed with the
|
||||
.Dv SIOCSIFADDR
|
||||
.Xr ioctl 2 .
|
||||
.Pp
|
||||
Each
|
||||
.Nm
|
||||
interface is created at runtime using interface cloning.
|
||||
This is
|
||||
most easily done with the
|
||||
.Xr ifconfig 8
|
||||
.Cm create
|
||||
command or using the
|
||||
.Va cloned_interfaces
|
||||
variable in
|
||||
.Xr rc.conf 5 .
|
||||
.Sh SEE ALSO
|
||||
.Xr inet 4 ,
|
||||
.Xr intro 4
|
||||
.\" .Xr ns 4
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
device appears to have been derived from the
|
||||
.Xr lo 4
|
||||
device around the time of
|
||||
.Bx 4.4 .
|
||||
This manpage was adapted from
|
||||
.Xr lo 4
|
||||
and first appeared in
|
||||
.Fx 5.0 .
|
||||
@@ -1,124 +0,0 @@
|
||||
.\" Copyright (c) 2000 Sheldon Hearn
|
||||
.\" 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 August 17, 2000
|
||||
.Dt LINUX 4 i386
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm linux
|
||||
.Nd Linux ABI support
|
||||
.Sh SYNOPSIS
|
||||
To link Linux ABI support into the kernel:
|
||||
.Cd "options COMPAT_LINUX"
|
||||
.Pp
|
||||
To load the Linux ABI support kernel module:
|
||||
.Dl kldload linux
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
module provides limited
|
||||
Linux ABI (application binary interface) compatibility
|
||||
for userland applications.
|
||||
The module provides the following significant facilities:
|
||||
.Bl -bullet
|
||||
.It
|
||||
An image activator
|
||||
for correctly branded
|
||||
.Xr elf 5
|
||||
executable images
|
||||
.It
|
||||
Special signal handling for activated images
|
||||
.It
|
||||
Linux to native system call translation
|
||||
.El
|
||||
.Pp
|
||||
It is important to note that the Linux ABI support
|
||||
it not provided through an emulator.
|
||||
Rather, a true (albeit limited) ABI implementation is provided.
|
||||
.Pp
|
||||
The following
|
||||
.Xr sysctl 8
|
||||
tunable variables are available:
|
||||
.Bl -tag -width compat.linux.oss_version
|
||||
.It compat.linux.osname
|
||||
Linux kernel operating system name.
|
||||
.It compat.linux.osrelease
|
||||
Linux kernel operating system release.
|
||||
.It compat.linux.oss_version
|
||||
Linux Open Sound System version.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
module can be linked into the kernel statically with the
|
||||
.Dv COMPAT_LINUX
|
||||
kernel configuration option
|
||||
or loaded as required.
|
||||
The following command will load the module
|
||||
if it is neither linked into the kernel
|
||||
nor already loaded as a module:
|
||||
.Bd -literal -offset indent
|
||||
if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
|
||||
kldload linux > /dev/null 2>&1
|
||||
fi
|
||||
.Ed
|
||||
.Pp
|
||||
Note that dynamically linked Linux executables
|
||||
will require a suitable environment in
|
||||
.Pa /compat/linux .
|
||||
Specifically, the Linux run-time linker's hints files
|
||||
should be correctly initialized.
|
||||
For this reason, it is common to execute the following commands
|
||||
to prepare the system to correctly run Linux executables:
|
||||
.Bd -literal -offset indent
|
||||
if [ -x /compat/linux/sbin/ldconfig ]; then
|
||||
/compat/linux/sbin/ldconfig
|
||||
fi
|
||||
.Ed
|
||||
.Pp
|
||||
For information on loading the
|
||||
.Nm
|
||||
kernel loadable module automatically on system startup,
|
||||
see
|
||||
.Xr rc.conf 5 .
|
||||
This information applies
|
||||
regardless of whether the
|
||||
.Nm
|
||||
module is statically linked into the kernel
|
||||
or loaded as a module.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /compat/linux/proc -compact
|
||||
.It Pa /compat/linux
|
||||
minimal Linux run-time environment
|
||||
.It Pa /compat/linux/proc
|
||||
limited Linux process file system
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr brandelf 1 ,
|
||||
.Xr elf 5 ,
|
||||
.Xr linprocfs 5
|
||||
.Sh HISTORY
|
||||
Linux ABI support first appeared in
|
||||
.Fx 2.1 .
|
||||
@@ -126,6 +126,7 @@ dev/aac/aac.c optional aac
|
||||
#dev/aac/aac_debug.c optional aac
|
||||
dev/aac/aac_disk.c optional aac
|
||||
dev/aac/aac_pci.c optional aac pci
|
||||
dev/aac/aac_linux.c optional aac compat_linux
|
||||
dev/aac/aac_cam.c optional aacp aac
|
||||
dev/advansys/adv_eisa.c optional adv eisa
|
||||
dev/advansys/adv_pci.c optional adv pci
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
|
||||
TYPE="FreeBSD"
|
||||
REVISION="4.8"
|
||||
BRANCH="RC"
|
||||
BRANCH="RELEASE"
|
||||
RELEASE="${REVISION}-${BRANCH}"
|
||||
VERSION="${TYPE} ${RELEASE}"
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
|
||||
# Adaptec Array Controller driver options
|
||||
AAC_COMPAT_LINUX opt_aac.h # Enable the linux ioctl interface
|
||||
|
||||
|
||||
AAC_DEBUG opt_aac.h # Debugging levels:
|
||||
# 0 - quiet, only emit warnings
|
||||
# 1 - noisy, emit major function
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
#include <sys/conf.h>
|
||||
#include <sys/devicestat.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/eventhandler.h>
|
||||
@@ -2611,53 +2610,6 @@ aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Linux Management Interface
|
||||
* This is soon to be removed!
|
||||
*/
|
||||
|
||||
#ifdef AAC_COMPAT_LINUX
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <machine/../linux/linux.h>
|
||||
#include <machine/../linux/linux_proto.h>
|
||||
#include <compat/linux/linux_ioctl.h>
|
||||
|
||||
/* There are multiple ioctl number ranges that need to be handled */
|
||||
#define AAC_LINUX_IOCTL_MIN 0x0000
|
||||
#define AAC_LINUX_IOCTL_MAX 0x21ff
|
||||
|
||||
static linux_ioctl_function_t aac_linux_ioctl;
|
||||
static struct linux_ioctl_handler aac_handler = {aac_linux_ioctl,
|
||||
AAC_LINUX_IOCTL_MIN,
|
||||
AAC_LINUX_IOCTL_MAX};
|
||||
|
||||
SYSINIT (aac_register, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
linux_ioctl_register_handler, &aac_handler);
|
||||
SYSUNINIT(aac_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
linux_ioctl_unregister_handler, &aac_handler);
|
||||
|
||||
MODULE_DEPEND(aac, linux, 1, 1, 1);
|
||||
|
||||
static int
|
||||
aac_linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
|
||||
{
|
||||
struct file *fp;
|
||||
u_long cmd;
|
||||
|
||||
debug_called(2);
|
||||
|
||||
fp = p->p_fd->fd_ofiles[args->fd];
|
||||
cmd = args->cmd;
|
||||
|
||||
/*
|
||||
* Pass the ioctl off to our standard handler.
|
||||
*/
|
||||
return(fo_ioctl(fp, cmd, (caddr_t)args->arg, p));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return the Revision of the driver to userspace and check to see if the
|
||||
* userspace app is possibly compatible. This is extremely bogus since
|
||||
|
||||
+11
-15
@@ -1,5 +1,8 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 Scott Long
|
||||
* Copyright (c) 2000 Michael Smith
|
||||
* Copyright (c) 2001 Scott Long
|
||||
* Copyright (c) 2000 BSDi
|
||||
* Copyright (c) 2001 Adaptec, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -26,10 +29,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Linux ioctl handler for the aac device driver
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
@@ -49,9 +48,9 @@ static struct linux_ioctl_handler aac_linux_handler = {aac_linux_ioctl,
|
||||
AAC_LINUX_IOCTL_MIN,
|
||||
AAC_LINUX_IOCTL_MAX};
|
||||
|
||||
SYSINIT (aac_linux_register, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
SYSINIT (aac_register, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
linux_ioctl_register_handler, &aac_linux_handler);
|
||||
SYSUNINIT(aac_linux_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
SYSUNINIT(aac_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,
|
||||
linux_ioctl_unregister_handler, &aac_linux_handler);
|
||||
|
||||
static int
|
||||
@@ -62,23 +61,20 @@ aac_linux_modevent(module_t mod, int type, void *data)
|
||||
}
|
||||
|
||||
DEV_MODULE(aac_linux, aac_linux_modevent, NULL);
|
||||
MODULE_DEPEND(aac_linux, linux, 1, 1, 1);
|
||||
MODULE_DEPEND(aac, linux, 1, 1, 1);
|
||||
|
||||
static int
|
||||
aac_linux_ioctl(struct thread *td, struct linux_ioctl_args *args)
|
||||
aac_linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
|
||||
{
|
||||
struct file *fp;
|
||||
u_long cmd;
|
||||
int error;
|
||||
|
||||
if ((error = fget(td, args->fd, &fp)) != 0)
|
||||
return (error);
|
||||
fp = p->p_fd->fd_ofiles[args->fd];
|
||||
cmd = args->cmd;
|
||||
|
||||
/*
|
||||
* Pass the ioctl off to our standard handler.
|
||||
*/
|
||||
error = (fo_ioctl(fp, cmd, (caddr_t)args->arg, td->td_ucred, td));
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
return(fo_ioctl(fp, cmd, (caddr_t)args->arg, p));
|
||||
}
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 Michael Smith
|
||||
* Copyright (c) 2000 BSDi
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* 6.5 : Interrupt handling
|
||||
*/
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
|
||||
#define _COMPONENT ACPI_OS_SERVICES
|
||||
ACPI_MODULE_NAME("INTERRUPT")
|
||||
|
||||
static void InterruptWrapper(void *arg);
|
||||
static OSD_HANDLER InterruptHandler;
|
||||
|
||||
/*
|
||||
* XXX this does not correctly free resources in the case of partically successful
|
||||
* attachment.
|
||||
*/
|
||||
ACPI_STATUS
|
||||
AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine, void *Context)
|
||||
{
|
||||
struct acpi_softc *sc;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
if ((sc = devclass_get_softc(devclass_find("acpi"), 0)) == NULL)
|
||||
panic("can't find ACPI device to register interrupt");
|
||||
if (sc->acpi_dev == NULL)
|
||||
panic("acpi softc has invalid device");
|
||||
|
||||
if ((InterruptNumber < 0) || (InterruptNumber > 255))
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
if (ServiceRoutine == NULL)
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
if (InterruptHandler != NULL && InterruptHandler != ServiceRoutine) {
|
||||
device_printf(sc->acpi_dev, "can't register more than one ACPI interrupt\n");
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
InterruptHandler = ServiceRoutine;
|
||||
|
||||
/*
|
||||
* This isn't strictly true, as we ought to be able to handle > 1 interrupt. The ACPI
|
||||
* spec doesn't call for this though.
|
||||
*/
|
||||
if (sc->acpi_irq != NULL) {
|
||||
device_printf(sc->acpi_dev, "attempt to register more than one interrupt handler\n");
|
||||
return_ACPI_STATUS(AE_ALREADY_EXISTS);
|
||||
}
|
||||
sc->acpi_irq_rid = 0;
|
||||
bus_set_resource(sc->acpi_dev, SYS_RES_IRQ, 0, InterruptNumber, 1);
|
||||
if ((sc->acpi_irq = bus_alloc_resource(sc->acpi_dev, SYS_RES_IRQ, &sc->acpi_irq_rid, 0, ~0, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE)) == NULL) {
|
||||
device_printf(sc->acpi_dev, "could not allocate SCI interrupt\n");
|
||||
return_ACPI_STATUS(AE_ALREADY_EXISTS);
|
||||
}
|
||||
if (bus_setup_intr(sc->acpi_dev, sc->acpi_irq, INTR_TYPE_MISC, (driver_intr_t *)InterruptWrapper,
|
||||
Context, &sc->acpi_irq_handle)) {
|
||||
device_printf(sc->acpi_dev, "could not set up SCI interrupt\n");
|
||||
return_ACPI_STATUS(AE_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsRemoveInterruptHandler (UINT32 InterruptNumber, OSD_HANDLER ServiceRoutine)
|
||||
{
|
||||
struct acpi_softc *sc;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
if ((InterruptNumber < 0) || (InterruptNumber > 255))
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
if (ServiceRoutine == NULL)
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
|
||||
if ((sc = devclass_get_softc(devclass_find("acpi"), 0)) == NULL)
|
||||
panic("can't find ACPI device to deregister interrupt");
|
||||
|
||||
if (sc->acpi_irq == NULL)
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
|
||||
bus_teardown_intr(sc->acpi_dev, sc->acpi_irq, sc->acpi_irq_handle);
|
||||
bus_release_resource(sc->acpi_dev, SYS_RES_IRQ, 0, sc->acpi_irq);
|
||||
bus_delete_resource(sc->acpi_dev, SYS_RES_IRQ, 0);
|
||||
|
||||
sc->acpi_irq = NULL;
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt handler wrapper.
|
||||
*/
|
||||
static void
|
||||
InterruptWrapper(void *arg)
|
||||
{
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
ACPI_LOCK;
|
||||
InterruptHandler(arg);
|
||||
ACPI_UNLOCK;
|
||||
}
|
||||
@@ -1,282 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 Michael Smith
|
||||
* Copyright (c) 2000 BSDi
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* 6.3 : Scheduling services
|
||||
*/
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
#include "opt_acpi.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/taskqueue.h>
|
||||
#include <machine/clock.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
|
||||
#define _COMPONENT ACPI_OS_SERVICES
|
||||
ACPI_MODULE_NAME("SCHEDULE")
|
||||
|
||||
/*
|
||||
* This is a little complicated due to the fact that we need to build and then
|
||||
* free a 'struct task' for each task we enqueue.
|
||||
*/
|
||||
|
||||
MALLOC_DEFINE(M_ACPITASK, "acpitask", "ACPI deferred task");
|
||||
|
||||
static void AcpiOsExecuteQueue(void *arg, int pending);
|
||||
|
||||
struct acpi_task {
|
||||
struct task at_task;
|
||||
OSD_EXECUTION_CALLBACK at_function;
|
||||
void *at_context;
|
||||
};
|
||||
|
||||
struct acpi_task_queue {
|
||||
STAILQ_ENTRY(acpi_task_queue) at_q;
|
||||
struct acpi_task *at;
|
||||
};
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
/*
|
||||
* Private task queue definition for ACPI
|
||||
*/
|
||||
TASKQUEUE_DECLARE(acpi);
|
||||
static void *taskqueue_acpi_ih;
|
||||
|
||||
static void
|
||||
taskqueue_acpi_enqueue(void *context)
|
||||
{
|
||||
swi_sched(taskqueue_acpi_ih, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
taskqueue_acpi_run(void *dummy)
|
||||
{
|
||||
taskqueue_run(taskqueue_acpi);
|
||||
}
|
||||
|
||||
TASKQUEUE_DEFINE(acpi, taskqueue_acpi_enqueue, 0,
|
||||
swi_add(NULL, "acpitaskq", taskqueue_acpi_run, NULL,
|
||||
SWI_TQ, 0, &taskqueue_acpi_ih));
|
||||
|
||||
#ifdef ACPI_USE_THREADS
|
||||
STAILQ_HEAD(, acpi_task_queue) acpi_task_queue;
|
||||
static struct mtx acpi_task_mtx;
|
||||
|
||||
static void
|
||||
acpi_task_thread(void *arg)
|
||||
{
|
||||
struct acpi_task_queue *atq;
|
||||
OSD_EXECUTION_CALLBACK Function;
|
||||
void *Context;
|
||||
|
||||
for (;;) {
|
||||
mtx_lock(&acpi_task_mtx);
|
||||
if ((atq = STAILQ_FIRST(&acpi_task_queue)) == NULL) {
|
||||
msleep(&acpi_task_queue, &acpi_task_mtx, PCATCH, "actask", 0);
|
||||
mtx_unlock(&acpi_task_mtx);
|
||||
continue;
|
||||
}
|
||||
|
||||
STAILQ_REMOVE_HEAD(&acpi_task_queue, at_q);
|
||||
mtx_unlock(&acpi_task_mtx);
|
||||
|
||||
Function = (OSD_EXECUTION_CALLBACK)atq->at->at_function;
|
||||
Context = atq->at->at_context;
|
||||
|
||||
mtx_lock(&Giant);
|
||||
Function(Context);
|
||||
|
||||
free(atq->at, M_ACPITASK);
|
||||
free(atq, M_ACPITASK);
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
|
||||
kthread_exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
acpi_task_thread_init(void)
|
||||
{
|
||||
int i, err;
|
||||
struct proc *acpi_kthread_proc;
|
||||
|
||||
err = 0;
|
||||
STAILQ_INIT(&acpi_task_queue);
|
||||
mtx_init(&acpi_task_mtx, "ACPI task", NULL, MTX_DEF);
|
||||
|
||||
for (i = 0; i < ACPI_MAX_THREADS; i++) {
|
||||
err = kthread_create(acpi_task_thread, NULL, &acpi_kthread_proc,
|
||||
0, 0, "acpi_task%d", i);
|
||||
if (err != 0) {
|
||||
printf("%s: kthread_create failed(%d)\n", __func__, err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void *Context)
|
||||
{
|
||||
struct acpi_task *at;
|
||||
int pri;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
if (Function == NULL)
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
|
||||
at = malloc(sizeof(*at), M_ACPITASK, M_NOWAIT); /* Interrupt Context */
|
||||
if (at == NULL)
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
bzero(at, sizeof(*at));
|
||||
|
||||
at->at_function = Function;
|
||||
at->at_context = Context;
|
||||
switch (Priority) {
|
||||
case OSD_PRIORITY_GPE:
|
||||
pri = 4;
|
||||
break;
|
||||
case OSD_PRIORITY_HIGH:
|
||||
pri = 3;
|
||||
break;
|
||||
case OSD_PRIORITY_MED:
|
||||
pri = 2;
|
||||
break;
|
||||
case OSD_PRIORITY_LO:
|
||||
pri = 1;
|
||||
break;
|
||||
default:
|
||||
free(at, M_ACPITASK);
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
TASK_INIT(&at->at_task, pri, AcpiOsExecuteQueue, at);
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
taskqueue_enqueue(taskqueue_swi, (struct task *)at);
|
||||
#else
|
||||
taskqueue_enqueue(taskqueue_acpi, (struct task *)at);
|
||||
#endif
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
static void
|
||||
AcpiOsExecuteQueue(void *arg, int pending)
|
||||
{
|
||||
struct acpi_task *at;
|
||||
struct acpi_task_queue *atq;
|
||||
OSD_EXECUTION_CALLBACK Function;
|
||||
void *Context;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
at = (struct acpi_task *)arg;
|
||||
atq = NULL;
|
||||
Function = NULL;
|
||||
Context = NULL;
|
||||
|
||||
#ifdef ACPI_USE_THREADS
|
||||
atq = malloc(sizeof(*atq), M_ACPITASK, M_NOWAIT);
|
||||
if (atq == NULL) {
|
||||
printf("%s: no memory\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
atq->at = at;
|
||||
|
||||
mtx_lock(&acpi_task_mtx);
|
||||
STAILQ_INSERT_TAIL(&acpi_task_queue, atq, at_q);
|
||||
mtx_unlock(&acpi_task_mtx);
|
||||
wakeup_one(&acpi_task_queue);
|
||||
#else
|
||||
Function = (OSD_EXECUTION_CALLBACK)at->at_function;
|
||||
Context = at->at_context;
|
||||
|
||||
Function(Context);
|
||||
free(at, M_ACPITASK);
|
||||
#endif
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't have any sleep granularity better than hz, so
|
||||
* make do with that.
|
||||
*/
|
||||
void
|
||||
AcpiOsSleep (UINT32 Seconds, UINT32 Milliseconds)
|
||||
{
|
||||
int timo;
|
||||
static int dummy;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
timo = (Seconds * hz) + Milliseconds * hz / 1000;
|
||||
if (timo == 0)
|
||||
timo = 1;
|
||||
tsleep(&dummy, 0, "acpislp", timo);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
void
|
||||
AcpiOsStall (UINT32 Microseconds)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
DELAY(Microseconds);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
UINT32
|
||||
AcpiOsGetThreadId (void)
|
||||
{
|
||||
struct proc *p;
|
||||
/* XXX do not add FUNCTION_TRACE here, results in recursive call */
|
||||
|
||||
p = curproc;
|
||||
#if __FreeBSD_version < 500000
|
||||
if (p == NULL)
|
||||
p = &proc0;
|
||||
#endif
|
||||
KASSERT(p != NULL, ("%s: curproc is NULL!", __func__));
|
||||
return(p->p_pid + 1); /* can't return 0 */
|
||||
}
|
||||
@@ -1,415 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Michael Smith
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opt_acpi.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/power.h>
|
||||
|
||||
#include <machine/bus_pio.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
|
||||
/*
|
||||
* Support for ACPI Processor devices.
|
||||
*
|
||||
* Note that this only provides ACPI 1.0 support (with the exception of the
|
||||
* PSTATE_CNT field). 2.0 support will involve implementing _PTC, _PCT,
|
||||
* _PSS and _PPC.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Hooks for the ACPI CA debugging infrastructure
|
||||
*/
|
||||
#define _COMPONENT ACPI_PROCESSOR
|
||||
ACPI_MODULE_NAME("PROCESSOR")
|
||||
|
||||
struct acpi_cpu_softc {
|
||||
device_t cpu_dev;
|
||||
ACPI_HANDLE cpu_handle;
|
||||
|
||||
u_int32_t cpu_id;
|
||||
|
||||
/* CPU throttling control register */
|
||||
struct resource *cpu_p_blk;
|
||||
#define CPU_GET_P_CNT(sc) (bus_space_read_4(rman_get_bustag((sc)->cpu_p_blk), \
|
||||
rman_get_bushandle((sc)->cpu_p_blk), \
|
||||
0))
|
||||
#define CPU_SET_P_CNT(sc, val) (bus_space_write_4(rman_get_bustag((sc)->cpu_p_blk), \
|
||||
rman_get_bushandle((sc)->cpu_p_blk), \
|
||||
0, (val)))
|
||||
#define CPU_P_CNT_THT_EN (1<<4)
|
||||
};
|
||||
|
||||
/*
|
||||
* Speeds are stored in counts, from 1 - CPU_MAX_SPEED, and
|
||||
* reported to the user in tenths of a percent.
|
||||
*/
|
||||
static u_int32_t cpu_duty_offset;
|
||||
static u_int32_t cpu_duty_width;
|
||||
#define CPU_MAX_SPEED (1 << cpu_duty_width)
|
||||
#define CPU_SPEED_PERCENT(x) ((1000 * (x)) / CPU_MAX_SPEED)
|
||||
#define CPU_SPEED_PRINTABLE(x) (CPU_SPEED_PERCENT(x) / 10),(CPU_SPEED_PERCENT(x) % 10)
|
||||
|
||||
static u_int32_t cpu_smi_cmd; /* should be a generic way to do this */
|
||||
static u_int8_t cpu_pstate_cnt;
|
||||
|
||||
static u_int32_t cpu_current_state;
|
||||
static u_int32_t cpu_performance_state;
|
||||
static u_int32_t cpu_economy_state;
|
||||
static u_int32_t cpu_max_state;
|
||||
|
||||
static device_t *cpu_devices;
|
||||
static int cpu_ndevices;
|
||||
|
||||
static struct sysctl_ctx_list acpi_cpu_sysctl_ctx;
|
||||
static struct sysctl_oid *acpi_cpu_sysctl_tree;
|
||||
|
||||
static int acpi_cpu_probe(device_t dev);
|
||||
static int acpi_cpu_attach(device_t dev);
|
||||
static void acpi_cpu_init_throttling(void *arg);
|
||||
static void acpi_cpu_set_speed(u_int32_t speed);
|
||||
static void acpi_cpu_power_profile(void *arg);
|
||||
static int acpi_cpu_speed_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
static device_method_t acpi_cpu_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, acpi_cpu_probe),
|
||||
DEVMETHOD(device_attach, acpi_cpu_attach),
|
||||
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t acpi_cpu_driver = {
|
||||
"acpi_cpu",
|
||||
acpi_cpu_methods,
|
||||
sizeof(struct acpi_cpu_softc),
|
||||
};
|
||||
|
||||
static devclass_t acpi_cpu_devclass;
|
||||
DRIVER_MODULE(acpi_cpu, acpi, acpi_cpu_driver, acpi_cpu_devclass, 0, 0);
|
||||
|
||||
static int
|
||||
acpi_cpu_probe(device_t dev)
|
||||
{
|
||||
if (!acpi_disabled("cpu") &&
|
||||
(acpi_get_type(dev) == ACPI_TYPE_PROCESSOR)) {
|
||||
device_set_desc(dev, "CPU"); /* XXX get more verbose description? */
|
||||
return(0);
|
||||
}
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_cpu_attach(device_t dev)
|
||||
{
|
||||
struct acpi_cpu_softc *sc;
|
||||
struct acpi_softc *acpi_sc;
|
||||
ACPI_OBJECT processor;
|
||||
ACPI_BUFFER buf;
|
||||
ACPI_STATUS status;
|
||||
u_int32_t p_blk;
|
||||
u_int32_t p_blk_length;
|
||||
u_int32_t duty_end;
|
||||
int rid;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
sc->cpu_dev = dev;
|
||||
sc->cpu_handle = acpi_get_handle(dev);
|
||||
|
||||
/*
|
||||
* Get global parameters from the FADT.
|
||||
*/
|
||||
if (device_get_unit(sc->cpu_dev) == 0) {
|
||||
cpu_duty_offset = AcpiGbl_FADT->DutyOffset;
|
||||
cpu_duty_width = AcpiGbl_FADT->DutyWidth;
|
||||
cpu_smi_cmd = AcpiGbl_FADT->SmiCmd;
|
||||
cpu_pstate_cnt = AcpiGbl_FADT->PstateCnt;
|
||||
|
||||
/* validate the offset/width */
|
||||
if (cpu_duty_width > 0) {
|
||||
duty_end = cpu_duty_offset + cpu_duty_width - 1;
|
||||
/* check that it fits */
|
||||
if (duty_end > 31) {
|
||||
printf("acpi_cpu: CLK_VAL field overflows P_CNT register\n");
|
||||
cpu_duty_width = 0;
|
||||
}
|
||||
/* check for overlap with the THT_EN bit */
|
||||
if ((cpu_duty_offset <= 4) && (duty_end >= 4)) {
|
||||
printf("acpi_cpu: CLK_VAL field overlaps THT_EN bit\n");
|
||||
cpu_duty_width = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the throttling process once the probe phase completes, if we think that
|
||||
* it's going to be useful. If the duty width value is zero, there are no significant
|
||||
* bits in the register and thus no throttled states.
|
||||
*/
|
||||
if (cpu_duty_width > 0) {
|
||||
AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_cpu_init_throttling, NULL);
|
||||
|
||||
acpi_sc = acpi_device_get_parent_softc(dev);
|
||||
sysctl_ctx_init(&acpi_cpu_sysctl_ctx);
|
||||
acpi_cpu_sysctl_tree = SYSCTL_ADD_NODE(&acpi_cpu_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree),
|
||||
OID_AUTO, "cpu", CTLFLAG_RD, 0, "");
|
||||
|
||||
SYSCTL_ADD_INT(&acpi_cpu_sysctl_ctx, SYSCTL_CHILDREN(acpi_cpu_sysctl_tree),
|
||||
OID_AUTO, "max_speed", CTLFLAG_RD,
|
||||
&cpu_max_state, 0, "maximum CPU speed");
|
||||
SYSCTL_ADD_INT(&acpi_cpu_sysctl_ctx, SYSCTL_CHILDREN(acpi_cpu_sysctl_tree),
|
||||
OID_AUTO, "current_speed", CTLFLAG_RD,
|
||||
&cpu_current_state, 0, "current CPU speed");
|
||||
SYSCTL_ADD_PROC(&acpi_cpu_sysctl_ctx, SYSCTL_CHILDREN(acpi_cpu_sysctl_tree),
|
||||
OID_AUTO, "performance_speed", CTLTYPE_INT | CTLFLAG_RW,
|
||||
&cpu_performance_state, 0, acpi_cpu_speed_sysctl, "I", "");
|
||||
SYSCTL_ADD_PROC(&acpi_cpu_sysctl_ctx, SYSCTL_CHILDREN(acpi_cpu_sysctl_tree),
|
||||
OID_AUTO, "economy_speed", CTLTYPE_INT | CTLFLAG_RW,
|
||||
&cpu_economy_state, 0, acpi_cpu_speed_sysctl, "I", "");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the processor object.
|
||||
*/
|
||||
buf.Pointer = &processor;
|
||||
buf.Length = sizeof(processor);
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(sc->cpu_handle, NULL, NULL, &buf))) {
|
||||
device_printf(sc->cpu_dev, "couldn't get Processor object - %s\n", AcpiFormatException(status));
|
||||
return_VALUE(ENXIO);
|
||||
}
|
||||
if (processor.Type != ACPI_TYPE_PROCESSOR) {
|
||||
device_printf(sc->cpu_dev, "Processor object has bad type %d\n", processor.Type);
|
||||
return_VALUE(ENXIO);
|
||||
}
|
||||
sc->cpu_id = processor.Processor.ProcId;
|
||||
|
||||
/*
|
||||
* If it looks like we support throttling, find this CPU's P_BLK.
|
||||
*
|
||||
* Note that some systems seem to duplicate the P_BLK pointer across
|
||||
* multiple CPUs, so not getting the resource is not fatal.
|
||||
*
|
||||
* XXX should support _PTC here as well, once we work out how to parse it.
|
||||
*
|
||||
* XXX is it valid to assume that the P_BLK must be 6 bytes long?
|
||||
*/
|
||||
if (cpu_duty_width > 0) {
|
||||
p_blk = processor.Processor.PblkAddress;
|
||||
p_blk_length = processor.Processor.PblkLength;
|
||||
|
||||
/* allocate bus space if possible */
|
||||
if ((p_blk > 0) && (p_blk_length == 6)) {
|
||||
rid = 0;
|
||||
bus_set_resource(sc->cpu_dev, SYS_RES_IOPORT, rid, p_blk, p_blk_length);
|
||||
sc->cpu_p_blk = bus_alloc_resource(sc->cpu_dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
|
||||
RF_ACTIVE);
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_IO, "acpi_cpu%d: throttling with P_BLK at 0x%x/%d%s\n",
|
||||
device_get_unit(sc->cpu_dev), p_blk, p_blk_length,
|
||||
sc->cpu_p_blk ? "" : " (shadowed)"));
|
||||
}
|
||||
}
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Call this *after* all CPUs have been attached.
|
||||
*
|
||||
* Takes the ACPI lock to avoid fighting anyone over the SMI command
|
||||
* port. Could probably lock less code.
|
||||
*/
|
||||
static void
|
||||
acpi_cpu_init_throttling(void *arg)
|
||||
{
|
||||
int cpu_temp_speed;
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
ACPI_LOCK;
|
||||
|
||||
/* get set of CPU devices */
|
||||
devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices);
|
||||
|
||||
/* initialise throttling states */
|
||||
cpu_max_state = CPU_MAX_SPEED;
|
||||
cpu_performance_state = cpu_max_state;
|
||||
cpu_economy_state = cpu_performance_state / 2;
|
||||
if (cpu_economy_state == 0) /* 0 is 'reserved' */
|
||||
cpu_economy_state++;
|
||||
if (TUNABLE_INT_FETCH("hw.acpi.cpu.performance_speed",
|
||||
&cpu_temp_speed) && cpu_temp_speed > 0 &&
|
||||
cpu_temp_speed <= cpu_max_state)
|
||||
cpu_performance_state = cpu_temp_speed;
|
||||
if (TUNABLE_INT_FETCH("hw.acpi.cpu.economy_speed",
|
||||
&cpu_temp_speed) && cpu_temp_speed > 0 &&
|
||||
cpu_temp_speed <= cpu_max_state)
|
||||
cpu_economy_state = cpu_temp_speed;
|
||||
|
||||
/* register performance profile change handler */
|
||||
EVENTHANDLER_REGISTER(power_profile_change, acpi_cpu_power_profile, NULL, 0);
|
||||
|
||||
/* if ACPI 2.0+, signal platform that we are taking over throttling */
|
||||
if (cpu_pstate_cnt != 0) {
|
||||
/* XXX should be a generic interface for this */
|
||||
AcpiOsWritePort(cpu_smi_cmd, cpu_pstate_cnt, 8);
|
||||
}
|
||||
|
||||
ACPI_UNLOCK;
|
||||
|
||||
/* set initial speed */
|
||||
acpi_cpu_power_profile(NULL);
|
||||
|
||||
printf("acpi_cpu: throttling enabled, %d steps (100%% to %d.%d%%), "
|
||||
"currently %d.%d%%\n", CPU_MAX_SPEED, CPU_SPEED_PRINTABLE(1),
|
||||
CPU_SPEED_PRINTABLE(cpu_current_state));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set CPUs to the new state.
|
||||
*
|
||||
* Must be called with the ACPI lock held.
|
||||
*/
|
||||
static void
|
||||
acpi_cpu_set_speed(u_int32_t speed)
|
||||
{
|
||||
struct acpi_cpu_softc *sc;
|
||||
int i;
|
||||
u_int32_t p_cnt, clk_val;
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
/* iterate over processors */
|
||||
for (i = 0; i < cpu_ndevices; i++) {
|
||||
sc = device_get_softc(cpu_devices[i]);
|
||||
if (sc->cpu_p_blk == NULL)
|
||||
continue;
|
||||
|
||||
/* get the current P_CNT value and disable throttling */
|
||||
p_cnt = CPU_GET_P_CNT(sc);
|
||||
p_cnt &= ~CPU_P_CNT_THT_EN;
|
||||
CPU_SET_P_CNT(sc, p_cnt);
|
||||
|
||||
/* if we're at maximum speed, that's all */
|
||||
if (speed < CPU_MAX_SPEED) {
|
||||
|
||||
/* mask the old CLK_VAL off and or-in the new value */
|
||||
clk_val = CPU_MAX_SPEED << cpu_duty_offset;
|
||||
p_cnt &= ~clk_val;
|
||||
p_cnt |= (speed << cpu_duty_offset);
|
||||
|
||||
/* write the new P_CNT value and then enable throttling */
|
||||
CPU_SET_P_CNT(sc, p_cnt);
|
||||
p_cnt |= CPU_P_CNT_THT_EN;
|
||||
CPU_SET_P_CNT(sc, p_cnt);
|
||||
}
|
||||
ACPI_VPRINT(sc->cpu_dev, acpi_device_get_parent_softc(sc->cpu_dev),
|
||||
"set speed to %d.%d%%\n", CPU_SPEED_PRINTABLE(speed));
|
||||
}
|
||||
cpu_current_state = speed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Power profile change hook.
|
||||
*
|
||||
* Uses the ACPI lock to avoid reentrancy.
|
||||
*/
|
||||
static void
|
||||
acpi_cpu_power_profile(void *arg)
|
||||
{
|
||||
int state;
|
||||
u_int32_t new;
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
state = power_profile_get_state();
|
||||
if (state != POWER_PROFILE_PERFORMANCE &&
|
||||
state != POWER_PROFILE_ECONOMY) {
|
||||
return;
|
||||
}
|
||||
|
||||
ACPI_LOCK;
|
||||
|
||||
switch (state) {
|
||||
case POWER_PROFILE_PERFORMANCE:
|
||||
new = cpu_performance_state;
|
||||
break;
|
||||
case POWER_PROFILE_ECONOMY:
|
||||
new = cpu_economy_state;
|
||||
break;
|
||||
default:
|
||||
new = cpu_current_state;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cpu_current_state != new)
|
||||
acpi_cpu_set_speed(new);
|
||||
|
||||
ACPI_UNLOCK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle changes in the performance/ecomony CPU settings.
|
||||
*
|
||||
* Does not need the ACPI lock (although setting *argp should
|
||||
* probably be atomic).
|
||||
*/
|
||||
static int
|
||||
acpi_cpu_speed_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
u_int32_t *argp;
|
||||
u_int32_t arg;
|
||||
int error;
|
||||
|
||||
argp = (u_int32_t *)oidp->oid_arg1;
|
||||
arg = *argp;
|
||||
error = sysctl_handle_int(oidp, &arg, 0, req);
|
||||
|
||||
/* error or no new value */
|
||||
if ((error != 0) || (req->newptr == NULL))
|
||||
return(error);
|
||||
|
||||
/* range check */
|
||||
if ((arg < 1) || (arg > cpu_max_state))
|
||||
return(EINVAL);
|
||||
|
||||
/* set new value and possibly switch */
|
||||
*argp = arg;
|
||||
acpi_cpu_power_profile(NULL);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 Takanori Watanabe <takawata@jp.freebsd.org>
|
||||
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
|
||||
* Copyright (c) 2000 Michael Smith <msmith@freebd.org>
|
||||
* Copyright (c) 2000 BSDi
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opt_acpi.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
|
||||
/*
|
||||
* Hooks for the ACPI CA debugging infrastructure
|
||||
*/
|
||||
#define _COMPONENT ACPI_BUTTON
|
||||
ACPI_MODULE_NAME("LID")
|
||||
|
||||
struct acpi_lid_softc {
|
||||
device_t lid_dev;
|
||||
ACPI_HANDLE lid_handle;
|
||||
int lid_status; /* open or closed */
|
||||
};
|
||||
|
||||
static int acpi_lid_probe(device_t dev);
|
||||
static int acpi_lid_attach(device_t dev);
|
||||
static int acpi_lid_suspend(device_t dev);
|
||||
static int acpi_lid_resume(device_t dev);
|
||||
static void acpi_lid_notify_status_changed(void *arg);
|
||||
static void acpi_lid_notify_handler(ACPI_HANDLE h,UINT32 notify, void *context);
|
||||
|
||||
static device_method_t acpi_lid_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, acpi_lid_probe),
|
||||
DEVMETHOD(device_attach, acpi_lid_attach),
|
||||
DEVMETHOD(device_suspend, acpi_lid_suspend),
|
||||
DEVMETHOD(device_resume, acpi_lid_resume),
|
||||
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t acpi_lid_driver = {
|
||||
"acpi_lid",
|
||||
acpi_lid_methods,
|
||||
sizeof(struct acpi_lid_softc),
|
||||
};
|
||||
|
||||
static devclass_t acpi_lid_devclass;
|
||||
DRIVER_MODULE(acpi_lid, acpi, acpi_lid_driver, acpi_lid_devclass, 0, 0);
|
||||
|
||||
static int
|
||||
acpi_lid_probe(device_t dev)
|
||||
{
|
||||
if ((acpi_get_type(dev) == ACPI_TYPE_DEVICE) &&
|
||||
!acpi_disabled("lid") &&
|
||||
acpi_MatchHid(dev, "PNP0C0D")) {
|
||||
device_set_desc(dev, "Control Method Lid Switch");
|
||||
return(0);
|
||||
}
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_lid_attach(device_t dev)
|
||||
{
|
||||
struct acpi_lid_softc *sc;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
sc->lid_dev = dev;
|
||||
sc->lid_handle = acpi_get_handle(dev);
|
||||
|
||||
/*
|
||||
* Install notification handler
|
||||
*/
|
||||
AcpiInstallNotifyHandler(sc->lid_handle, ACPI_DEVICE_NOTIFY, acpi_lid_notify_handler, sc);
|
||||
acpi_device_enable_wake_capability(sc->lid_handle, 1);
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_lid_suspend(device_t dev)
|
||||
{
|
||||
struct acpi_lid_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
acpi_device_enable_wake_event(sc->lid_handle);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_lid_resume(device_t dev)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_lid_notify_status_changed(void *arg)
|
||||
{
|
||||
struct acpi_lid_softc *sc;
|
||||
struct acpi_softc *acpi_sc;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
sc = (struct acpi_lid_softc *)arg;
|
||||
|
||||
/*
|
||||
* Evaluate _LID and check the return value, update lid status.
|
||||
* Zero: The lid is closed
|
||||
* Non-zero: The lid is open
|
||||
*/
|
||||
if (ACPI_FAILURE(acpi_EvaluateInteger(sc->lid_handle, "_LID", &sc->lid_status)))
|
||||
return_VOID;
|
||||
|
||||
acpi_sc = acpi_device_get_parent_softc(sc->lid_dev);
|
||||
if (acpi_sc == NULL) {
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
ACPI_VPRINT(sc->lid_dev, acpi_sc,
|
||||
"Lid %s\n", sc->lid_status ? "opened" : "closed");
|
||||
|
||||
if (sc->lid_status == 0) {
|
||||
EVENTHANDLER_INVOKE(acpi_sleep_event, acpi_sc->acpi_lid_switch_sx);
|
||||
} else {
|
||||
EVENTHANDLER_INVOKE(acpi_wakeup_event, acpi_sc->acpi_lid_switch_sx);
|
||||
}
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* XXX maybe not here */
|
||||
#define ACPI_NOTIFY_STATUS_CHANGED 0x80
|
||||
|
||||
static void
|
||||
acpi_lid_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
|
||||
{
|
||||
struct acpi_lid_softc *sc = (struct acpi_lid_softc *)context;
|
||||
|
||||
ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, notify);
|
||||
|
||||
switch (notify) {
|
||||
case ACPI_NOTIFY_STATUS_CHANGED:
|
||||
AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_lid_notify_status_changed, sc);
|
||||
break;
|
||||
default:
|
||||
break; /* unknown notification value */
|
||||
}
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@@ -1,654 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Michael Smith
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opt_acpi.h" /* XXX trim includes */
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/ioccom.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/ctype.h>
|
||||
|
||||
#include <machine/clock.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
#include <dev/acpica/acpiio.h>
|
||||
|
||||
/*
|
||||
* ACPI power resource management.
|
||||
*
|
||||
* Power resource behaviour is slightly complicated by the fact that
|
||||
* a single power resource may provide power for more than one device.
|
||||
* Thus, we must track the device(s) being powered by a given power
|
||||
* resource, and only deactivate it when there are no powered devices.
|
||||
*
|
||||
* Note that this only manages resources for known devices. There is an
|
||||
* ugly case where we may turn of power to a device which is in use because
|
||||
* we don't know that it depends on a given resource. We should perhaps
|
||||
* try to be smarter about this, but a more complete solution would involve
|
||||
* scanning all of the ACPI namespace to find devices we're not currently
|
||||
* aware of, and this raises questions about whether they should be left
|
||||
* on, turned off, etc.
|
||||
*
|
||||
* XXX locking
|
||||
*/
|
||||
|
||||
MALLOC_DEFINE(M_ACPIPWR, "acpipwr", "ACPI power resources");
|
||||
|
||||
/*
|
||||
* Hooks for the ACPI CA debugging infrastructure
|
||||
*/
|
||||
#define _COMPONENT ACPI_POWER
|
||||
ACPI_MODULE_NAME("POWERRES")
|
||||
|
||||
/* return values from _STA on a power resource */
|
||||
#define ACPI_PWR_OFF 0
|
||||
#define ACPI_PWR_ON 1
|
||||
|
||||
/*
|
||||
* A relationship between a power resource and a consumer.
|
||||
*/
|
||||
struct acpi_powerreference {
|
||||
struct acpi_powerconsumer *ar_consumer;
|
||||
struct acpi_powerresource *ar_resource;
|
||||
TAILQ_ENTRY(acpi_powerreference) ar_rlink; /* link on resource list */
|
||||
TAILQ_ENTRY(acpi_powerreference) ar_clink; /* link on consumer */
|
||||
};
|
||||
|
||||
/*
|
||||
* A power-managed device.
|
||||
*/
|
||||
struct acpi_powerconsumer {
|
||||
ACPI_HANDLE ac_consumer; /* device which is powered */
|
||||
int ac_state;
|
||||
TAILQ_ENTRY(acpi_powerconsumer) ac_link;
|
||||
TAILQ_HEAD(,acpi_powerreference) ac_references;
|
||||
};
|
||||
|
||||
/*
|
||||
* A power resource.
|
||||
*/
|
||||
struct acpi_powerresource {
|
||||
TAILQ_ENTRY(acpi_powerresource) ap_link;
|
||||
TAILQ_HEAD(,acpi_powerreference) ap_references;
|
||||
ACPI_HANDLE ap_resource; /* the resource's handle */
|
||||
ACPI_INTEGER ap_systemlevel;
|
||||
ACPI_INTEGER ap_order;
|
||||
};
|
||||
|
||||
static TAILQ_HEAD(acpi_powerresource_list, acpi_powerresource) acpi_powerresources;
|
||||
static TAILQ_HEAD(acpi_powerconsumer_list, acpi_powerconsumer) acpi_powerconsumers;
|
||||
|
||||
static ACPI_STATUS acpi_pwr_register_consumer(ACPI_HANDLE consumer);
|
||||
static ACPI_STATUS acpi_pwr_deregister_consumer(ACPI_HANDLE consumer);
|
||||
static ACPI_STATUS acpi_pwr_register_resource(ACPI_HANDLE res);
|
||||
static ACPI_STATUS acpi_pwr_deregister_resource(ACPI_HANDLE res);
|
||||
static void acpi_pwr_reference_resource(ACPI_OBJECT *obj, void *arg);
|
||||
static ACPI_STATUS acpi_pwr_switch_power(void);
|
||||
static struct acpi_powerresource *acpi_pwr_find_resource(ACPI_HANDLE res);
|
||||
static struct acpi_powerconsumer *acpi_pwr_find_consumer(ACPI_HANDLE consumer);
|
||||
|
||||
/*
|
||||
* Initialise our lists.
|
||||
*/
|
||||
static void
|
||||
acpi_pwr_init(void *junk)
|
||||
{
|
||||
TAILQ_INIT(&acpi_powerresources);
|
||||
TAILQ_INIT(&acpi_powerconsumers);
|
||||
}
|
||||
SYSINIT(acpi_powerresource, SI_SUB_TUNABLES, SI_ORDER_ANY, acpi_pwr_init, NULL);
|
||||
|
||||
/*
|
||||
* Register a power resource.
|
||||
*
|
||||
* It's OK to call this if we already know about the resource.
|
||||
*/
|
||||
static ACPI_STATUS
|
||||
acpi_pwr_register_resource(ACPI_HANDLE res)
|
||||
{
|
||||
ACPI_STATUS status;
|
||||
ACPI_BUFFER buf;
|
||||
ACPI_OBJECT *obj;
|
||||
struct acpi_powerresource *rp, *srp;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
rp = NULL;
|
||||
buf.Pointer = NULL;
|
||||
|
||||
/* look to see if we know about this resource */
|
||||
if (acpi_pwr_find_resource(res) != NULL)
|
||||
return_ACPI_STATUS(AE_OK); /* already know about it */
|
||||
|
||||
/* allocate a new resource */
|
||||
if ((rp = malloc(sizeof(*rp), M_ACPIPWR, M_NOWAIT | M_ZERO)) == NULL) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
TAILQ_INIT(&rp->ap_references);
|
||||
rp->ap_resource = res;
|
||||
|
||||
/* get the Power Resource object */
|
||||
buf.Length = ACPI_ALLOCATE_BUFFER;
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(res, NULL, NULL, &buf))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "no power resource object\n"));
|
||||
goto out;
|
||||
}
|
||||
obj = buf.Pointer;
|
||||
if (obj->Type != ACPI_TYPE_POWER) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "questionable power resource object %s\n", acpi_name(res)));
|
||||
status = AE_TYPE;
|
||||
goto out;
|
||||
}
|
||||
rp->ap_systemlevel = obj->PowerResource.SystemLevel;
|
||||
rp->ap_order = obj->PowerResource.ResourceOrder;
|
||||
|
||||
/* sort the resource into the list */
|
||||
status = AE_OK;
|
||||
srp = TAILQ_FIRST(&acpi_powerresources);
|
||||
if ((srp == NULL) || (rp->ap_order < srp->ap_order)) {
|
||||
TAILQ_INSERT_HEAD(&acpi_powerresources, rp, ap_link);
|
||||
goto done;
|
||||
}
|
||||
TAILQ_FOREACH(srp, &acpi_powerresources, ap_link)
|
||||
if (rp->ap_order < srp->ap_order) {
|
||||
TAILQ_INSERT_BEFORE(srp, rp, ap_link);
|
||||
goto done;
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&acpi_powerresources, rp, ap_link);
|
||||
|
||||
done:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "registered power resource %s\n", acpi_name(res)));
|
||||
out:
|
||||
if (buf.Pointer != NULL)
|
||||
AcpiOsFree(buf.Pointer);
|
||||
if (ACPI_FAILURE(status) && (rp != NULL))
|
||||
free(rp, M_ACPIPWR);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Deregister a power resource.
|
||||
*/
|
||||
static ACPI_STATUS
|
||||
acpi_pwr_deregister_resource(ACPI_HANDLE res)
|
||||
{
|
||||
struct acpi_powerresource *rp;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
rp = NULL;
|
||||
|
||||
/* find the resource */
|
||||
if ((rp = acpi_pwr_find_resource(res)) == NULL)
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
|
||||
/* check that there are no consumers referencing this resource */
|
||||
if (TAILQ_FIRST(&rp->ap_references) != NULL)
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
|
||||
/* pull it off the list and free it */
|
||||
TAILQ_REMOVE(&acpi_powerresources, rp, ap_link);
|
||||
free(rp, M_ACPIPWR);
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "deregistered power resource %s\n", acpi_name(res)));
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a power consumer.
|
||||
*
|
||||
* It's OK to call this if we already know about the consumer.
|
||||
*/
|
||||
static ACPI_STATUS
|
||||
acpi_pwr_register_consumer(ACPI_HANDLE consumer)
|
||||
{
|
||||
struct acpi_powerconsumer *pc;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
/* check to see whether we know about this consumer already */
|
||||
if ((pc = acpi_pwr_find_consumer(consumer)) != NULL)
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
||||
/* allocate a new power consumer */
|
||||
if ((pc = malloc(sizeof(*pc), M_ACPIPWR, M_NOWAIT)) == NULL)
|
||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||
TAILQ_INSERT_HEAD(&acpi_powerconsumers, pc, ac_link);
|
||||
TAILQ_INIT(&pc->ac_references);
|
||||
pc->ac_consumer = consumer;
|
||||
|
||||
pc->ac_state = ACPI_STATE_UNKNOWN; /* XXX we should try to find its current state */
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "registered power consumer %s\n", acpi_name(consumer)));
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Deregister a power consumer.
|
||||
*
|
||||
* This should only be done once the consumer has been powered off.
|
||||
* (XXX is this correct? Check once implemented)
|
||||
*/
|
||||
static ACPI_STATUS
|
||||
acpi_pwr_deregister_consumer(ACPI_HANDLE consumer)
|
||||
{
|
||||
struct acpi_powerconsumer *pc;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
/* find the consumer */
|
||||
if ((pc = acpi_pwr_find_consumer(consumer)) == NULL)
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
|
||||
/* make sure the consumer's not referencing anything right now */
|
||||
if (TAILQ_FIRST(&pc->ac_references) != NULL)
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
|
||||
/* pull the consumer off the list and free it */
|
||||
TAILQ_REMOVE(&acpi_powerconsumers, pc, ac_link);
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "deregistered power consumer %s\n", acpi_name(consumer)));
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a power consumer to a particular power state.
|
||||
*/
|
||||
ACPI_STATUS
|
||||
acpi_pwr_switch_consumer(ACPI_HANDLE consumer, int state)
|
||||
{
|
||||
struct acpi_powerconsumer *pc;
|
||||
struct acpi_powerreference *pr;
|
||||
ACPI_HANDLE method_handle, reslist_handle, pr0_handle;
|
||||
ACPI_BUFFER reslist_buffer;
|
||||
ACPI_OBJECT *reslist_object;
|
||||
ACPI_STATUS status;
|
||||
char *method_name, *reslist_name;
|
||||
int res_changed;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
/* find the consumer */
|
||||
if ((pc = acpi_pwr_find_consumer(consumer)) == NULL) {
|
||||
if (ACPI_FAILURE(status = acpi_pwr_register_consumer(consumer)))
|
||||
return_ACPI_STATUS(status);
|
||||
if ((pc = acpi_pwr_find_consumer(consumer)) == NULL) {
|
||||
return_ACPI_STATUS(AE_ERROR); /* something very wrong */
|
||||
}
|
||||
}
|
||||
|
||||
/* check for valid transitions */
|
||||
if ((pc->ac_state == ACPI_STATE_D3) && (state != ACPI_STATE_D0))
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER); /* can only go to D0 from D3 */
|
||||
|
||||
/* find transition mechanism(s) */
|
||||
switch(state) {
|
||||
case ACPI_STATE_D0:
|
||||
method_name = "_PS0";
|
||||
reslist_name = "_PR0";
|
||||
break;
|
||||
case ACPI_STATE_D1:
|
||||
method_name = "_PS1";
|
||||
reslist_name = "_PR1";
|
||||
break;
|
||||
case ACPI_STATE_D2:
|
||||
method_name = "_PS2";
|
||||
reslist_name = "_PR2";
|
||||
break;
|
||||
case ACPI_STATE_D3:
|
||||
method_name = "_PS3";
|
||||
reslist_name = "_PR3";
|
||||
break;
|
||||
default:
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "setup to switch %s D%d -> D%d\n",
|
||||
acpi_name(consumer), pc->ac_state, state));
|
||||
|
||||
/*
|
||||
* Verify that this state is supported, ie. one of method or
|
||||
* reslist must be present. We need to do this before we go
|
||||
* dereferencing resources (since we might be trying to go to
|
||||
* a state we don't support).
|
||||
*
|
||||
* Note that if any states are supported, the device has to
|
||||
* support D0 and D3. It's never an error to try to go to
|
||||
* D0.
|
||||
*/
|
||||
reslist_buffer.Pointer = NULL;
|
||||
reslist_object = NULL;
|
||||
if (ACPI_FAILURE(AcpiGetHandle(consumer, method_name, &method_handle)))
|
||||
method_handle = NULL;
|
||||
if (ACPI_FAILURE(AcpiGetHandle(consumer, reslist_name, &reslist_handle)))
|
||||
reslist_handle = NULL;
|
||||
if ((reslist_handle == NULL) && (method_handle == NULL)) {
|
||||
if (state == ACPI_STATE_D0) {
|
||||
pc->ac_state = ACPI_STATE_D0;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
if (state != ACPI_STATE_D3) {
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* turn off the resources listed in _PR0 to go to D3. */
|
||||
if (ACPI_FAILURE(AcpiGetHandle(consumer, "_PR0", &pr0_handle))) {
|
||||
goto bad;
|
||||
}
|
||||
reslist_buffer.Length = ACPI_ALLOCATE_BUFFER;
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(pr0_handle, NULL, NULL, &reslist_buffer))) {
|
||||
goto bad;
|
||||
}
|
||||
reslist_object = (ACPI_OBJECT *)reslist_buffer.Pointer;
|
||||
if ((reslist_object->Type != ACPI_TYPE_PACKAGE) ||
|
||||
(reslist_object->Package.Count == 0)) {
|
||||
goto bad;
|
||||
}
|
||||
AcpiOsFree(reslist_buffer.Pointer);
|
||||
reslist_buffer.Pointer = NULL;
|
||||
reslist_object = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that we can actually fetch the list of power resources
|
||||
*/
|
||||
if (reslist_handle != NULL) {
|
||||
reslist_buffer.Length = ACPI_ALLOCATE_BUFFER;
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(reslist_handle, NULL, NULL, &reslist_buffer))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't evaluate resource list %s\n",
|
||||
acpi_name(reslist_handle)));
|
||||
goto out;
|
||||
}
|
||||
reslist_object = (ACPI_OBJECT *)reslist_buffer.Pointer;
|
||||
if (reslist_object->Type != ACPI_TYPE_PACKAGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "resource list is not ACPI_TYPE_PACKAGE (%d)\n",
|
||||
reslist_object->Type));
|
||||
status = AE_TYPE;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now we are ready to switch, so kill off any current power resource references.
|
||||
*/
|
||||
res_changed = 0;
|
||||
while((pr = TAILQ_FIRST(&pc->ac_references)) != NULL) {
|
||||
res_changed = 1;
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "removing reference to %s\n", acpi_name(pr->ar_resource->ap_resource)));
|
||||
TAILQ_REMOVE(&pr->ar_resource->ap_references, pr, ar_rlink);
|
||||
TAILQ_REMOVE(&pc->ac_references, pr, ar_clink);
|
||||
free(pr, M_ACPIPWR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add new power resource references, if we have any. Traverse the
|
||||
* package that we got from evaluating reslist_handle, and look up each
|
||||
* of the resources that are referenced.
|
||||
*/
|
||||
if (reslist_object != NULL) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "referencing %d new resources\n",
|
||||
reslist_object->Package.Count));
|
||||
acpi_ForeachPackageObject(reslist_object, acpi_pwr_reference_resource, pc);
|
||||
res_changed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we changed anything in the resource list, we need to run a switch
|
||||
* pass now.
|
||||
*/
|
||||
if (ACPI_FAILURE(status = acpi_pwr_switch_power())) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "failed to correctly switch resources to move %s to D%d\n",
|
||||
acpi_name(consumer), state));
|
||||
goto out; /* XXX is this appropriate? Should we return to previous state? */
|
||||
}
|
||||
|
||||
/* invoke power state switch method (if present) */
|
||||
if (method_handle != NULL) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "invoking state transition method %s\n",
|
||||
acpi_name(method_handle)));
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(method_handle, NULL, NULL, NULL))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "failed to set state - %s\n",
|
||||
AcpiFormatException(status)));
|
||||
pc->ac_state = ACPI_STATE_UNKNOWN;
|
||||
goto out; /* XXX Should we return to previous state? */
|
||||
}
|
||||
}
|
||||
|
||||
/* transition was successful */
|
||||
pc->ac_state = state;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
||||
bad:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "attempt to set unsupported state D%d\n",
|
||||
state));
|
||||
status = AE_BAD_PARAMETER;
|
||||
|
||||
out:
|
||||
if (reslist_buffer.Pointer != NULL)
|
||||
AcpiOsFree(reslist_buffer.Pointer);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called to create a reference between a power consumer and a power resource
|
||||
* identified in the object.
|
||||
*/
|
||||
static void
|
||||
acpi_pwr_reference_resource(ACPI_OBJECT *obj, void *arg)
|
||||
{
|
||||
struct acpi_powerconsumer *pc = (struct acpi_powerconsumer *)arg;
|
||||
struct acpi_powerreference *pr;
|
||||
struct acpi_powerresource *rp;
|
||||
ACPI_HANDLE res;
|
||||
ACPI_STATUS status;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
/* check the object type */
|
||||
switch (obj->Type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
|
||||
acpi_name(pc->ac_consumer), acpi_name(obj->Reference.Handle)));
|
||||
|
||||
res = obj->Reference.Handle;
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
|
||||
acpi_name(pc->ac_consumer), obj->String.Pointer));
|
||||
|
||||
/* get the handle of the resource */
|
||||
if (ACPI_FAILURE(status = AcpiGetHandle(NULL, obj->String.Pointer, &res))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "couldn't find power resource %s\n",
|
||||
obj->String.Pointer));
|
||||
return_VOID;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "don't know how to create a power reference to object type %d\n",
|
||||
obj->Type));
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/* create/look up the resource */
|
||||
if (ACPI_FAILURE(status = acpi_pwr_register_resource(res))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "couldn't register power resource %s - %s\n",
|
||||
obj->String.Pointer, AcpiFormatException(status)));
|
||||
return_VOID;
|
||||
}
|
||||
if ((rp = acpi_pwr_find_resource(res)) == NULL) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "power resource list corrupted\n"));
|
||||
return_VOID;
|
||||
}
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "found power resource %s\n", acpi_name(rp->ap_resource)));
|
||||
|
||||
/* create a reference between the consumer and resource */
|
||||
if ((pr = malloc(sizeof(*pr), M_ACPIPWR, M_NOWAIT | M_ZERO)) == NULL) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "couldn't allocate memory for a power consumer reference\n"));
|
||||
return_VOID;
|
||||
}
|
||||
pr->ar_consumer = pc;
|
||||
pr->ar_resource = rp;
|
||||
TAILQ_INSERT_TAIL(&pc->ac_references, pr, ar_clink);
|
||||
TAILQ_INSERT_TAIL(&rp->ap_references, pr, ar_rlink);
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Switch power resources to conform to the desired state.
|
||||
*
|
||||
* Consumers may have modified the power resource list in an arbitrary
|
||||
* fashion; we sweep it in sequence order.
|
||||
*/
|
||||
static ACPI_STATUS
|
||||
acpi_pwr_switch_power(void)
|
||||
{
|
||||
struct acpi_powerresource *rp;
|
||||
ACPI_STATUS status;
|
||||
int cur;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
/*
|
||||
* Sweep the list forwards turning things on.
|
||||
*/
|
||||
TAILQ_FOREACH(rp, &acpi_powerresources, ap_link) {
|
||||
if (TAILQ_FIRST(&rp->ap_references) == NULL) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "%s has no references, not turning on\n",
|
||||
acpi_name(rp->ap_resource)));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* we could cache this if we trusted it not to change under us */
|
||||
if (ACPI_FAILURE(status = acpi_EvaluateInteger(rp->ap_resource, "_STA", &cur))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get status of %s - %d\n",
|
||||
acpi_name(rp->ap_resource), status));
|
||||
continue; /* XXX is this correct? Always switch if in doubt? */
|
||||
}
|
||||
|
||||
/*
|
||||
* Switch if required. Note that we ignore the result of the switch
|
||||
* effort; we don't know what to do if it fails, so checking wouldn't
|
||||
* help much.
|
||||
*/
|
||||
if (cur != ACPI_PWR_ON) {
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(rp->ap_resource, "_ON", NULL, NULL))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "failed to switch %s on - %s\n",
|
||||
acpi_name(rp->ap_resource), AcpiFormatException(status)));
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "switched %s on\n", acpi_name(rp->ap_resource)));
|
||||
}
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "%s is already on\n", acpi_name(rp->ap_resource)));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Sweep the list backwards turning things off.
|
||||
*/
|
||||
TAILQ_FOREACH_REVERSE(rp, &acpi_powerresources, acpi_powerresource_list, ap_link) {
|
||||
if (TAILQ_FIRST(&rp->ap_references) != NULL) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "%s has references, not turning off\n",
|
||||
acpi_name(rp->ap_resource)));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* we could cache this if we trusted it not to change under us */
|
||||
if (ACPI_FAILURE(status = acpi_EvaluateInteger(rp->ap_resource, "_STA", &cur))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get status of %s - %d\n",
|
||||
acpi_name(rp->ap_resource), status));
|
||||
continue; /* XXX is this correct? Always switch if in doubt? */
|
||||
}
|
||||
|
||||
/*
|
||||
* Switch if required. Note that we ignore the result of the switch
|
||||
* effort; we don't know what to do if it fails, so checking wouldn't
|
||||
* help much.
|
||||
*/
|
||||
if (cur != ACPI_PWR_OFF) {
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(rp->ap_resource, "_OFF", NULL, NULL))) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "failed to switch %s off - %s\n",
|
||||
acpi_name(rp->ap_resource), AcpiFormatException(status)));
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "switched %s off\n", acpi_name(rp->ap_resource)));
|
||||
}
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "%s is already off\n", acpi_name(rp->ap_resource)));
|
||||
}
|
||||
}
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a power resource's control structure.
|
||||
*/
|
||||
static struct acpi_powerresource *
|
||||
acpi_pwr_find_resource(ACPI_HANDLE res)
|
||||
{
|
||||
struct acpi_powerresource *rp;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
TAILQ_FOREACH(rp, &acpi_powerresources, ap_link)
|
||||
if (rp->ap_resource == res)
|
||||
break;
|
||||
return_PTR(rp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a power consumer's control structure.
|
||||
*/
|
||||
static struct acpi_powerconsumer *
|
||||
acpi_pwr_find_consumer(ACPI_HANDLE consumer)
|
||||
{
|
||||
struct acpi_powerconsumer *pc;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
TAILQ_FOREACH(pc, &acpi_powerconsumers, ac_link)
|
||||
if (pc->ac_consumer == consumer)
|
||||
break;
|
||||
return_PTR(pc);
|
||||
}
|
||||
|
||||
@@ -1,592 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 Michael Smith
|
||||
* Copyright (c) 2000 BSDi
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opt_acpi.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
|
||||
/*
|
||||
* Hooks for the ACPI CA debugging infrastructure
|
||||
*/
|
||||
#define _COMPONENT ACPI_BUS
|
||||
ACPI_MODULE_NAME("RESOURCE")
|
||||
|
||||
/*
|
||||
* Fetch a device's resources and associate them with the device.
|
||||
*
|
||||
* Note that it might be nice to also locate ACPI-specific resource items, such
|
||||
* as GPE bits.
|
||||
*
|
||||
* We really need to split the resource-fetching code out from the
|
||||
* resource-parsing code, since we may want to use the parsing
|
||||
* code for _PRS someday.
|
||||
*/
|
||||
ACPI_STATUS
|
||||
acpi_parse_resources(device_t dev, ACPI_HANDLE handle, struct acpi_parse_resource_set *set)
|
||||
{
|
||||
ACPI_BUFFER buf;
|
||||
ACPI_RESOURCE *res;
|
||||
char *curr, *last;
|
||||
ACPI_STATUS status;
|
||||
void *context;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
/*
|
||||
* Special-case some devices that abuse _PRS/_CRS to mean
|
||||
* something other than "I consume this resource".
|
||||
*
|
||||
* XXX do we really need this? It's only relevant once
|
||||
* we start always-allocating these resources, and even
|
||||
* then, the only special-cased device is likely to be
|
||||
* the PCI interrupt link.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Fetch the device's current resources.
|
||||
*/
|
||||
buf.Length = ACPI_ALLOCATE_BUFFER;
|
||||
if (ACPI_FAILURE((status = AcpiGetCurrentResources(handle, &buf)))) {
|
||||
if (status != AE_NOT_FOUND)
|
||||
printf("can't fetch resources for %s - %s\n",
|
||||
acpi_name(handle), AcpiFormatException(status));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s - got %ld bytes of resources\n",
|
||||
acpi_name(handle), (long)buf.Length));
|
||||
set->set_init(dev, &context);
|
||||
|
||||
/*
|
||||
* Iterate through the resources
|
||||
*/
|
||||
curr = buf.Pointer;
|
||||
last = (char *)buf.Pointer + buf.Length;
|
||||
while (curr < last) {
|
||||
res = (ACPI_RESOURCE *)curr;
|
||||
curr += res->Length;
|
||||
|
||||
/*
|
||||
* Handle the individual resource types
|
||||
*/
|
||||
switch(res->Id) {
|
||||
case ACPI_RSTYPE_END_TAG:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "EndTag\n"));
|
||||
curr = last;
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_FIXED_IO:
|
||||
if (res->Data.FixedIo.RangeLength <= 0)
|
||||
break;
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "FixedIo 0x%x/%d\n",
|
||||
res->Data.FixedIo.BaseAddress,
|
||||
res->Data.FixedIo.RangeLength));
|
||||
set->set_ioport(dev, context,
|
||||
res->Data.FixedIo.BaseAddress,
|
||||
res->Data.FixedIo.RangeLength);
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_IO:
|
||||
if (res->Data.Io.RangeLength <= 0)
|
||||
break;
|
||||
if (res->Data.Io.MinBaseAddress == res->Data.Io.MaxBaseAddress) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Io 0x%x/%d\n",
|
||||
res->Data.Io.MinBaseAddress,
|
||||
res->Data.Io.RangeLength));
|
||||
set->set_ioport(dev, context,
|
||||
res->Data.Io.MinBaseAddress,
|
||||
res->Data.Io.RangeLength);
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Io 0x%x-0x%x/%d\n",
|
||||
res->Data.Io.MinBaseAddress,
|
||||
res->Data.Io.MaxBaseAddress,
|
||||
res->Data.Io.RangeLength));
|
||||
set->set_iorange(dev, context,
|
||||
res->Data.Io.MinBaseAddress,
|
||||
res->Data.Io.MaxBaseAddress,
|
||||
res->Data.Io.RangeLength, res->Data.Io.Alignment);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_FIXED_MEM32:
|
||||
if (res->Data.FixedMemory32.RangeLength <= 0)
|
||||
break;
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "FixedMemory32 0x%x/%d\n",
|
||||
res->Data.FixedMemory32.RangeBaseAddress,
|
||||
res->Data.FixedMemory32.RangeLength));
|
||||
set->set_memory(dev, context, res->Data.FixedMemory32.RangeBaseAddress,
|
||||
res->Data.FixedMemory32.RangeLength);
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_MEM32:
|
||||
if (res->Data.Memory32.RangeLength <= 0)
|
||||
break;
|
||||
if (res->Data.Memory32.MinBaseAddress == res->Data.Memory32.MaxBaseAddress) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory32 0x%x/%d\n",
|
||||
res->Data.Memory32.MinBaseAddress,
|
||||
res->Data.Memory32.RangeLength));
|
||||
set->set_memory(dev, context,
|
||||
res->Data.Memory32.MinBaseAddress,
|
||||
res->Data.Memory32.RangeLength);
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory32 0x%x-0x%x/%d\n",
|
||||
res->Data.Memory32.MinBaseAddress,
|
||||
res->Data.Memory32.MaxBaseAddress,
|
||||
res->Data.Memory32.RangeLength));
|
||||
set->set_memoryrange(dev, context,
|
||||
res->Data.Memory32.MinBaseAddress,
|
||||
res->Data.Memory32.MaxBaseAddress,
|
||||
res->Data.Memory32.RangeLength,
|
||||
res->Data.Memory32.Alignment);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_MEM24:
|
||||
if (res->Data.Memory24.RangeLength <= 0)
|
||||
break;
|
||||
if (res->Data.Memory24.MinBaseAddress == res->Data.Memory24.MaxBaseAddress) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory24 0x%x/%d\n",
|
||||
res->Data.Memory24.MinBaseAddress,
|
||||
res->Data.Memory24.RangeLength));
|
||||
set->set_memory(dev, context, res->Data.Memory24.MinBaseAddress,
|
||||
res->Data.Memory24.RangeLength);
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Memory24 0x%x-0x%x/%d\n",
|
||||
res->Data.Memory24.MinBaseAddress,
|
||||
res->Data.Memory24.MaxBaseAddress,
|
||||
res->Data.Memory24.RangeLength));
|
||||
set->set_memoryrange(dev, context,
|
||||
res->Data.Memory24.MinBaseAddress,
|
||||
res->Data.Memory24.MaxBaseAddress,
|
||||
res->Data.Memory24.RangeLength,
|
||||
res->Data.Memory24.Alignment);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_IRQ:
|
||||
/*
|
||||
* from 1.0b 6.4.2
|
||||
* "This structure is repeated for each separate interrupt
|
||||
* required"
|
||||
*/
|
||||
set->set_irq(dev, context, res->Data.Irq.Interrupts,
|
||||
res->Data.Irq.NumberOfInterrupts);
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_DMA:
|
||||
/*
|
||||
* from 1.0b 6.4.3
|
||||
* "This structure is repeated for each separate dma channel
|
||||
* required"
|
||||
*/
|
||||
|
||||
set->set_drq(dev, context, res->Data.Dma.Channels,
|
||||
res->Data.Dma.NumberOfChannels);
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_START_DPF:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "start dependant functions\n"));
|
||||
set->set_start_dependant(dev, context,
|
||||
res->Data.StartDpf.CompatibilityPriority);
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_END_DPF:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "end dependant functions\n"));
|
||||
set->set_end_dependant(dev, context);
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_ADDRESS32:
|
||||
if (res->Data.Address32.AddressLength <= 0)
|
||||
break;
|
||||
if (res->Data.Address32.ProducerConsumer != ACPI_CONSUMER) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "ignored Address32 %s producer\n",
|
||||
(res->Data.Address32.ResourceType == ACPI_IO_RANGE) ?
|
||||
"IO" : "Memory"));
|
||||
break;
|
||||
}
|
||||
if (res->Data.Address32.ResourceType != ACPI_MEMORY_RANGE &&
|
||||
res->Data.Address32.ResourceType != ACPI_IO_RANGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
|
||||
"ignored Address32 for non-memory, non-I/O\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
if ((res->Data.Address32.MinAddressFixed == ACPI_ADDRESS_FIXED) &&
|
||||
(res->Data.Address32.MaxAddressFixed == ACPI_ADDRESS_FIXED)) {
|
||||
if (res->Data.Address32.ResourceType == ACPI_MEMORY_RANGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address32/Memory 0x%x/%d\n",
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.AddressLength));
|
||||
set->set_memory(dev, context,
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.AddressLength);
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address32/IO 0x%x/%d\n",
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.AddressLength));
|
||||
set->set_ioport(dev, context,
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.AddressLength);
|
||||
}
|
||||
} else {
|
||||
if (res->Data.Address32.ResourceType == ACPI_MEMORY_RANGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address32/Memory 0x%x-0x%x/%d\n",
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.MaxAddressRange,
|
||||
res->Data.Address32.AddressLength));
|
||||
set->set_memoryrange(dev, context,
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.MaxAddressRange,
|
||||
res->Data.Address32.AddressLength,
|
||||
res->Data.Address32.Granularity);
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address32/IO 0x%x-0x%x/%d\n",
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.MaxAddressRange,
|
||||
res->Data.Address32.AddressLength));
|
||||
set->set_iorange(dev, context,
|
||||
res->Data.Address32.MinAddressRange,
|
||||
res->Data.Address32.MaxAddressRange,
|
||||
res->Data.Address32.AddressLength,
|
||||
res->Data.Address32.Granularity);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_ADDRESS16:
|
||||
if (res->Data.Address16.AddressLength <= 0)
|
||||
break;
|
||||
if (res->Data.Address16.ProducerConsumer != ACPI_CONSUMER) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "ignored Address16 %s producer\n",
|
||||
(res->Data.Address16.ResourceType == ACPI_IO_RANGE) ?
|
||||
"IO" : "Memory"));
|
||||
break;
|
||||
}
|
||||
if (res->Data.Address16.ResourceType != ACPI_MEMORY_RANGE &&
|
||||
res->Data.Address16.ResourceType != ACPI_IO_RANGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
|
||||
"ignored Address16 for non-memory, non-I/O\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
if ((res->Data.Address16.MinAddressFixed == ACPI_ADDRESS_FIXED) &&
|
||||
(res->Data.Address16.MaxAddressFixed == ACPI_ADDRESS_FIXED)) {
|
||||
if (res->Data.Address16.ResourceType == ACPI_MEMORY_RANGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address16/Memory 0x%x/%d\n",
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.AddressLength));
|
||||
set->set_memory(dev, context,
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.AddressLength);
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address16/IO 0x%x/%d\n",
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.AddressLength));
|
||||
set->set_ioport(dev, context,
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.AddressLength);
|
||||
}
|
||||
} else {
|
||||
if (res->Data.Address16.ResourceType == ACPI_MEMORY_RANGE) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address16/Memory 0x%x-0x%x/%d\n",
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.MaxAddressRange,
|
||||
res->Data.Address16.AddressLength));
|
||||
set->set_memoryrange(dev, context,
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.MaxAddressRange,
|
||||
res->Data.Address16.AddressLength,
|
||||
res->Data.Address16.Granularity);
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "Address16/IO 0x%x-0x%x/%d\n",
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.MaxAddressRange,
|
||||
res->Data.Address16.AddressLength));
|
||||
set->set_iorange(dev, context,
|
||||
res->Data.Address16.MinAddressRange,
|
||||
res->Data.Address16.MaxAddressRange,
|
||||
res->Data.Address16.AddressLength,
|
||||
res->Data.Address16.Granularity);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_ADDRESS64:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "unimplemented Address64 resource\n"));
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_EXT_IRQ:
|
||||
/* XXX special handling? */
|
||||
set->set_irq(dev, context,res->Data.ExtendedIrq.Interrupts,
|
||||
res->Data.ExtendedIrq.NumberOfInterrupts);
|
||||
break;
|
||||
|
||||
case ACPI_RSTYPE_VENDOR:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "unimplemented VendorSpecific resource\n"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
AcpiOsFree(buf.Pointer);
|
||||
set->set_done(dev, context);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Resource-set vectors used to attach _CRS-derived resources
|
||||
* to an ACPI device.
|
||||
*/
|
||||
static void acpi_res_set_init(device_t dev, void **context);
|
||||
static void acpi_res_set_done(device_t dev, void *context);
|
||||
static void acpi_res_set_ioport(device_t dev, void *context, u_int32_t base, u_int32_t length);
|
||||
static void acpi_res_set_iorange(device_t dev, void *context, u_int32_t low, u_int32_t high,
|
||||
u_int32_t length, u_int32_t align);
|
||||
static void acpi_res_set_memory(device_t dev, void *context, u_int32_t base, u_int32_t length);
|
||||
static void acpi_res_set_memoryrange(device_t dev, void *context, u_int32_t low, u_int32_t high,
|
||||
u_int32_t length, u_int32_t align);
|
||||
static void acpi_res_set_irq(device_t dev, void *context, u_int32_t *irq,
|
||||
int count);
|
||||
static void acpi_res_set_drq(device_t dev, void *context, u_int32_t *drq,
|
||||
int count);
|
||||
static void acpi_res_set_start_dependant(device_t dev, void *context, int preference);
|
||||
static void acpi_res_set_end_dependant(device_t dev, void *context);
|
||||
|
||||
struct acpi_parse_resource_set acpi_res_parse_set = {
|
||||
acpi_res_set_init,
|
||||
acpi_res_set_done,
|
||||
acpi_res_set_ioport,
|
||||
acpi_res_set_iorange,
|
||||
acpi_res_set_memory,
|
||||
acpi_res_set_memoryrange,
|
||||
acpi_res_set_irq,
|
||||
acpi_res_set_drq,
|
||||
acpi_res_set_start_dependant,
|
||||
acpi_res_set_end_dependant
|
||||
};
|
||||
|
||||
struct acpi_res_context {
|
||||
int ar_nio;
|
||||
int ar_nmem;
|
||||
int ar_nirq;
|
||||
int ar_ndrq;
|
||||
};
|
||||
|
||||
static void
|
||||
acpi_res_set_init(device_t dev, void **context)
|
||||
{
|
||||
struct acpi_res_context *cp;
|
||||
|
||||
if ((cp = AcpiOsAllocate(sizeof(*cp))) != NULL) {
|
||||
bzero(cp, sizeof(*cp));
|
||||
*context = cp;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_done(device_t dev, void *context)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
AcpiOsFree(cp);
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_ioport(device_t dev, void *context, u_int32_t base, u_int32_t length)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
bus_set_resource(dev, SYS_RES_IOPORT, cp->ar_nio++, base, length);
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_iorange(device_t dev, void *context, u_int32_t low, u_int32_t high, u_int32_t length, u_int32_t align)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
device_printf(dev, "I/O range not supported\n");
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_memory(device_t dev, void *context, u_int32_t base, u_int32_t length)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
|
||||
bus_set_resource(dev, SYS_RES_MEMORY, cp->ar_nmem++, base, length);
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_memoryrange(device_t dev, void *context, u_int32_t low, u_int32_t high, u_int32_t length, u_int32_t align)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
device_printf(dev, "memory range not supported\n");
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_irq(device_t dev, void *context, u_int32_t *irq, int count)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
if (irq == NULL)
|
||||
return;
|
||||
|
||||
/*This implements no resource relocation.*/
|
||||
if(count != 1)
|
||||
return;
|
||||
|
||||
bus_set_resource(dev, SYS_RES_IRQ, cp->ar_nirq++, *irq, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_drq(device_t dev, void *context, u_int32_t *drq, int count)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
if (drq == NULL)
|
||||
return;
|
||||
|
||||
/*This implements no resource relocation.*/
|
||||
if(count != 1)
|
||||
return;
|
||||
|
||||
bus_set_resource(dev, SYS_RES_DRQ, cp->ar_ndrq++, *drq, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_start_dependant(device_t dev, void *context, int preference)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
device_printf(dev, "dependant functions not supported\n");
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_res_set_end_dependant(device_t dev, void *context)
|
||||
{
|
||||
struct acpi_res_context *cp = (struct acpi_res_context *)context;
|
||||
|
||||
if (cp == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Resource-owning placeholders.
|
||||
*
|
||||
* This code "owns" system resource objects that aren't
|
||||
* otherwise useful to devices, and which shouldn't be
|
||||
* considered "free".
|
||||
*
|
||||
* Note that some systems claim *all* of the physical address space
|
||||
* with a PNP0C01 device, so we cannot correctly "own" system memory
|
||||
* here (must be done in the SMAP handler on x86 systems, for
|
||||
* example).
|
||||
*/
|
||||
|
||||
static int acpi_sysresource_probe(device_t dev);
|
||||
static int acpi_sysresource_attach(device_t dev);
|
||||
|
||||
static device_method_t acpi_sysresource_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, acpi_sysresource_probe),
|
||||
DEVMETHOD(device_attach, acpi_sysresource_attach),
|
||||
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t acpi_sysresource_driver = {
|
||||
"acpi_sysresource",
|
||||
acpi_sysresource_methods,
|
||||
0,
|
||||
};
|
||||
|
||||
static devclass_t acpi_sysresource_devclass;
|
||||
DRIVER_MODULE(acpi_sysresource, acpi, acpi_sysresource_driver, acpi_sysresource_devclass, 0, 0);
|
||||
|
||||
static int
|
||||
acpi_sysresource_probe(device_t dev)
|
||||
{
|
||||
if (acpi_disabled("sysresource"))
|
||||
return(ENXIO);
|
||||
if (acpi_MatchHid(dev, "PNP0C02")) {
|
||||
device_set_desc(dev, "system resource");
|
||||
} else {
|
||||
return(ENXIO);
|
||||
}
|
||||
device_quiet(dev);
|
||||
return(-100);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_sysresource_attach(device_t dev)
|
||||
{
|
||||
struct resource *res;
|
||||
int i, rid;
|
||||
|
||||
/*
|
||||
* Suck up all the resources that might have been assigned to us.
|
||||
* Note that it's impossible to tell the difference between a
|
||||
* resource that someone else has claimed, and one that doesn't
|
||||
* exist.
|
||||
*/
|
||||
for (i = 0; i < 100; i++) {
|
||||
rid = i;
|
||||
res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, 0);
|
||||
rid = i;
|
||||
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, 0);
|
||||
rid = i;
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_SHAREABLE);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -1,828 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 Michael Smith
|
||||
* Copyright (c) 2000 BSDi
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "opt_acpi.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <sys/power.h>
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
#include <dev/acpica/acpivar.h>
|
||||
|
||||
/*
|
||||
* Hooks for the ACPI CA debugging infrastructure
|
||||
*/
|
||||
#define _COMPONENT ACPI_THERMAL
|
||||
ACPI_MODULE_NAME("THERMAL")
|
||||
|
||||
#define TZ_ZEROC 2732
|
||||
#define TZ_KELVTOC(x) (((x) - TZ_ZEROC) / 10), (((x) - TZ_ZEROC) % 10)
|
||||
|
||||
#define TZ_NOTIFY_TEMPERATURE 0x80
|
||||
#define TZ_NOTIFY_DEVICES 0x81
|
||||
#define TZ_NOTIFY_LEVELS 0x82
|
||||
|
||||
#define TZ_POLLRATE 30 /* every 30 seconds by default */
|
||||
|
||||
#define TZ_NUMLEVELS 10 /* defined by ACPI spec */
|
||||
struct acpi_tz_zone {
|
||||
int ac[TZ_NUMLEVELS];
|
||||
ACPI_BUFFER al[TZ_NUMLEVELS];
|
||||
int crt;
|
||||
int hot;
|
||||
ACPI_BUFFER psl;
|
||||
int psv;
|
||||
int tc1;
|
||||
int tc2;
|
||||
int tsp;
|
||||
int tzp;
|
||||
};
|
||||
|
||||
|
||||
struct acpi_tz_softc {
|
||||
device_t tz_dev; /* device handle */
|
||||
ACPI_HANDLE tz_handle; /* thermal zone handle */
|
||||
int tz_temperature; /* current temperature */
|
||||
int tz_active; /* current active cooling */
|
||||
#define TZ_ACTIVE_NONE -1
|
||||
int tz_requested; /* user-requested minimum active cooling */
|
||||
int tz_thflags; /* current temperature-related flags */
|
||||
#define TZ_THFLAG_NONE 0
|
||||
#define TZ_THFLAG_PSV (1<<0)
|
||||
#define TZ_THFLAG_HOT (1<<2)
|
||||
#define TZ_THFLAG_CRT (1<<3)
|
||||
int tz_flags;
|
||||
#define TZ_FLAG_NO_SCP (1<<0) /* no _SCP method */
|
||||
#define TZ_FLAG_GETPROFILE (1<<1) /* fetch power_profile in timeout */
|
||||
struct timespec tz_cooling_started; /* current cooling starting time */
|
||||
|
||||
struct sysctl_ctx_list tz_sysctl_ctx; /* sysctl tree */
|
||||
struct sysctl_oid *tz_sysctl_tree;
|
||||
|
||||
struct acpi_tz_zone tz_zone; /* thermal zone parameters */
|
||||
int tz_tmp_updating;
|
||||
};
|
||||
|
||||
static int acpi_tz_probe(device_t dev);
|
||||
static int acpi_tz_attach(device_t dev);
|
||||
static int acpi_tz_establish(struct acpi_tz_softc *sc);
|
||||
static void acpi_tz_monitor(struct acpi_tz_softc *sc);
|
||||
static void acpi_tz_all_off(struct acpi_tz_softc *sc);
|
||||
static void acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg);
|
||||
static void acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg);
|
||||
static void acpi_tz_getparam(struct acpi_tz_softc *sc, char *node, int *data);
|
||||
static void acpi_tz_sanity(struct acpi_tz_softc *sc, int *val, char *what);
|
||||
static int acpi_tz_active_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static void acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context);
|
||||
static void acpi_tz_timeout(struct acpi_tz_softc *sc);
|
||||
static void acpi_tz_power_profile(void *arg);
|
||||
|
||||
static void acpi_tz_thread(void *arg);
|
||||
static struct proc *acpi_tz_proc;
|
||||
|
||||
static device_method_t acpi_tz_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, acpi_tz_probe),
|
||||
DEVMETHOD(device_attach, acpi_tz_attach),
|
||||
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t acpi_tz_driver = {
|
||||
"acpi_tz",
|
||||
acpi_tz_methods,
|
||||
sizeof(struct acpi_tz_softc),
|
||||
};
|
||||
|
||||
static devclass_t acpi_tz_devclass;
|
||||
DRIVER_MODULE(acpi_tz, acpi, acpi_tz_driver, acpi_tz_devclass, 0, 0);
|
||||
|
||||
static struct sysctl_ctx_list acpi_tz_sysctl_ctx;
|
||||
static struct sysctl_oid *acpi_tz_sysctl_tree;
|
||||
|
||||
static int acpi_tz_min_runtime = 0;/* minimum cooling run time */
|
||||
static int acpi_tz_polling_rate = TZ_POLLRATE;
|
||||
|
||||
/*
|
||||
* Match an ACPI thermal zone.
|
||||
*/
|
||||
static int
|
||||
acpi_tz_probe(device_t dev)
|
||||
{
|
||||
int result;
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
ACPI_LOCK;
|
||||
|
||||
/* no FUNCTION_TRACE - too noisy */
|
||||
|
||||
if ((acpi_get_type(dev) == ACPI_TYPE_THERMAL) &&
|
||||
!acpi_disabled("thermal")) {
|
||||
device_set_desc(dev, "thermal zone");
|
||||
result = -10;
|
||||
} else {
|
||||
result = ENXIO;
|
||||
}
|
||||
ACPI_UNLOCK;
|
||||
return(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attach to an ACPI thermal zone.
|
||||
*/
|
||||
static int
|
||||
acpi_tz_attach(device_t dev)
|
||||
{
|
||||
struct acpi_tz_softc *sc;
|
||||
struct acpi_softc *acpi_sc;
|
||||
int error;
|
||||
char oidname[8];
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_LOCK;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
sc->tz_dev = dev;
|
||||
sc->tz_handle = acpi_get_handle(dev);
|
||||
sc->tz_requested = TZ_ACTIVE_NONE;
|
||||
sc->tz_tmp_updating = 0;
|
||||
|
||||
/*
|
||||
* Parse the current state of the thermal zone and build control
|
||||
* structures.
|
||||
*/
|
||||
if ((error = acpi_tz_establish(sc)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Register for any Notify events sent to this zone.
|
||||
*/
|
||||
AcpiInstallNotifyHandler(sc->tz_handle, ACPI_DEVICE_NOTIFY,
|
||||
acpi_tz_notify_handler, sc);
|
||||
|
||||
/*
|
||||
* Create our sysctl nodes.
|
||||
*
|
||||
* XXX we need a mechanism for adding nodes under ACPI.
|
||||
*/
|
||||
if (device_get_unit(dev) == 0) {
|
||||
acpi_sc = acpi_device_get_parent_softc(dev);
|
||||
sysctl_ctx_init(&acpi_tz_sysctl_ctx);
|
||||
acpi_tz_sysctl_tree = SYSCTL_ADD_NODE(&acpi_tz_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree),
|
||||
OID_AUTO, "thermal", CTLFLAG_RD, 0, "");
|
||||
SYSCTL_ADD_INT(&acpi_tz_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(acpi_tz_sysctl_tree),
|
||||
OID_AUTO, "min_runtime", CTLFLAG_RD | CTLFLAG_RW,
|
||||
&acpi_tz_min_runtime, 0, "minimum cooling run time in sec");
|
||||
SYSCTL_ADD_INT(&acpi_tz_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(acpi_tz_sysctl_tree),
|
||||
OID_AUTO, "polling_rate", CTLFLAG_RD | CTLFLAG_RW,
|
||||
&acpi_tz_polling_rate, 0, "monitor polling rate");
|
||||
}
|
||||
sysctl_ctx_init(&sc->tz_sysctl_ctx);
|
||||
sprintf(oidname, "tz%d", device_get_unit(dev));
|
||||
sc->tz_sysctl_tree = SYSCTL_ADD_NODE(&sc->tz_sysctl_ctx,
|
||||
SYSCTL_CHILDREN(acpi_tz_sysctl_tree), OID_AUTO,
|
||||
oidname, CTLFLAG_RD, 0, "");
|
||||
SYSCTL_ADD_INT(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||
OID_AUTO, "temperature", CTLFLAG_RD,
|
||||
&sc->tz_temperature, 0, "current thermal zone temperature");
|
||||
SYSCTL_ADD_PROC(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||
OID_AUTO, "active", CTLTYPE_INT | CTLFLAG_RW,
|
||||
sc, 0, acpi_tz_active_sysctl, "I", "");
|
||||
|
||||
SYSCTL_ADD_INT(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||
OID_AUTO, "thermal_flags", CTLFLAG_RD,
|
||||
&sc->tz_thflags, 0, "thermal zone flags");
|
||||
SYSCTL_ADD_INT(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||
OID_AUTO, "_PSV", CTLFLAG_RD,
|
||||
&sc->tz_zone.psv, 0, "");
|
||||
SYSCTL_ADD_INT(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||
OID_AUTO, "_HOT", CTLFLAG_RD,
|
||||
&sc->tz_zone.hot, 0, "");
|
||||
SYSCTL_ADD_INT(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||
OID_AUTO, "_CRT", CTLFLAG_RD,
|
||||
&sc->tz_zone.crt, 0, "");
|
||||
SYSCTL_ADD_OPAQUE(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||
OID_AUTO, "_ACx", CTLFLAG_RD, &sc->tz_zone.ac,
|
||||
sizeof(sc->tz_zone.ac), "I", "");
|
||||
|
||||
|
||||
/*
|
||||
* Register our power profile event handler, and flag it for a manual
|
||||
* invocation by our timeout. We defer it like this so that the rest
|
||||
* of the subsystem has time to come up.
|
||||
*/
|
||||
EVENTHANDLER_REGISTER(power_profile_change, acpi_tz_power_profile, sc, 0);
|
||||
sc->tz_flags |= TZ_FLAG_GETPROFILE;
|
||||
|
||||
/*
|
||||
* Don't bother evaluating/printing the temperature at this point;
|
||||
* on many systems it'll be bogus until the EC is running.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create our thread; we only need one, it will service all of the
|
||||
* thermal zones.
|
||||
*/
|
||||
if (acpi_tz_proc == NULL) {
|
||||
error = kthread_create(acpi_tz_thread, NULL, &acpi_tz_proc,
|
||||
RFHIGHPID, 0, "acpi_thermal");
|
||||
if (error != 0) {
|
||||
device_printf(sc->tz_dev, "could not create thread - %d", error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
ACPI_UNLOCK;
|
||||
|
||||
return_VALUE(error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the current state of this thermal zone and set up to use it.
|
||||
*
|
||||
* Note that we may have previous state, which will have to be discarded.
|
||||
*/
|
||||
static int
|
||||
acpi_tz_establish(struct acpi_tz_softc *sc)
|
||||
{
|
||||
ACPI_OBJECT *obj;
|
||||
int i;
|
||||
char nbuf[8];
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
/*
|
||||
* Power everything off and erase any existing state.
|
||||
*/
|
||||
acpi_tz_all_off(sc);
|
||||
for (i = 0; i < TZ_NUMLEVELS; i++)
|
||||
if (sc->tz_zone.al[i].Pointer != NULL)
|
||||
AcpiOsFree(sc->tz_zone.al[i].Pointer);
|
||||
if (sc->tz_zone.psl.Pointer != NULL)
|
||||
AcpiOsFree(sc->tz_zone.psl.Pointer);
|
||||
bzero(&sc->tz_zone, sizeof(sc->tz_zone));
|
||||
|
||||
/*
|
||||
* Evaluate thermal zone parameters.
|
||||
*/
|
||||
for (i = 0; i < TZ_NUMLEVELS; i++) {
|
||||
sprintf(nbuf, "_AC%d", i);
|
||||
acpi_tz_getparam(sc, nbuf, &sc->tz_zone.ac[i]);
|
||||
sprintf(nbuf, "_AL%d", i);
|
||||
sc->tz_zone.al[i].Length = ACPI_ALLOCATE_BUFFER;
|
||||
sc->tz_zone.al[i].Pointer = NULL;
|
||||
AcpiEvaluateObject(sc->tz_handle, nbuf, NULL, &sc->tz_zone.al[i]);
|
||||
obj = (ACPI_OBJECT *)sc->tz_zone.al[i].Pointer;
|
||||
if (obj != NULL) {
|
||||
/* should be a package containing a list of power objects */
|
||||
if (obj->Type != ACPI_TYPE_PACKAGE) {
|
||||
device_printf(sc->tz_dev, "%s has unknown object type %d, rejecting\n",
|
||||
nbuf, obj->Type);
|
||||
return_VALUE(ENXIO);
|
||||
}
|
||||
}
|
||||
}
|
||||
acpi_tz_getparam(sc, "_CRT", &sc->tz_zone.crt);
|
||||
acpi_tz_getparam(sc, "_HOT", &sc->tz_zone.hot);
|
||||
sc->tz_zone.psl.Length = ACPI_ALLOCATE_BUFFER;
|
||||
sc->tz_zone.psl.Pointer = NULL;
|
||||
AcpiEvaluateObject(sc->tz_handle, "_PSL", NULL, &sc->tz_zone.psl);
|
||||
acpi_tz_getparam(sc, "_PSV", &sc->tz_zone.psv);
|
||||
acpi_tz_getparam(sc, "_TC1", &sc->tz_zone.tc1);
|
||||
acpi_tz_getparam(sc, "_TC2", &sc->tz_zone.tc2);
|
||||
acpi_tz_getparam(sc, "_TSP", &sc->tz_zone.tsp);
|
||||
acpi_tz_getparam(sc, "_TZP", &sc->tz_zone.tzp);
|
||||
|
||||
/*
|
||||
* Sanity-check the values we've been given.
|
||||
*
|
||||
* XXX what do we do about systems that give us the same value for
|
||||
* more than one of these setpoints?
|
||||
*/
|
||||
acpi_tz_sanity(sc, &sc->tz_zone.crt, "_CRT");
|
||||
acpi_tz_sanity(sc, &sc->tz_zone.hot, "_HOT");
|
||||
acpi_tz_sanity(sc, &sc->tz_zone.psv, "_PSV");
|
||||
for (i = 0; i < TZ_NUMLEVELS; i++)
|
||||
acpi_tz_sanity(sc, &sc->tz_zone.ac[i], "_ACx");
|
||||
|
||||
/*
|
||||
* Power off everything that we've just been given.
|
||||
*/
|
||||
acpi_tz_all_off(sc);
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static char *aclevel_string[] = {
|
||||
"NONE", "_AC0", "_AC1", "_AC2", "_AC3", "_AC4",
|
||||
"_AC5", "_AC6", "_AC7", "_AC8", "_AC9" };
|
||||
|
||||
static __inline const char *
|
||||
acpi_tz_aclevel_string(int active)
|
||||
{
|
||||
if (active < -1 || active >= TZ_NUMLEVELS) {
|
||||
return (aclevel_string[0]);
|
||||
}
|
||||
|
||||
return (aclevel_string[active+1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Evaluate the condition of a thermal zone, take appropriate actions.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_monitor(struct acpi_tz_softc *sc)
|
||||
{
|
||||
int temp;
|
||||
int i;
|
||||
int newactive, newflags;
|
||||
struct timespec curtime;
|
||||
ACPI_STATUS status;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
if (sc->tz_tmp_updating) {
|
||||
goto out;
|
||||
}
|
||||
sc->tz_tmp_updating = 1;
|
||||
|
||||
/*
|
||||
* Get the current temperature.
|
||||
*/
|
||||
if (ACPI_FAILURE(status = acpi_EvaluateInteger(sc->tz_handle, "_TMP", &temp))) {
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"error fetching current temperature -- %s\n",
|
||||
AcpiFormatException(status));
|
||||
/* XXX disable zone? go to max cooling? */
|
||||
goto out;
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_VALUES, "got %d.%dC\n", TZ_KELVTOC(temp)));
|
||||
sc->tz_temperature = temp;
|
||||
|
||||
/*
|
||||
* Work out what we ought to be doing right now.
|
||||
*
|
||||
* Note that the _ACx levels sort from hot to cold.
|
||||
*/
|
||||
newactive = TZ_ACTIVE_NONE;
|
||||
for (i = TZ_NUMLEVELS - 1; i >= 0; i--) {
|
||||
if ((sc->tz_zone.ac[i] != -1) && (temp >= sc->tz_zone.ac[i])) {
|
||||
newactive = i;
|
||||
if (sc->tz_active != newactive) {
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"_AC%d: temperature %d.%d >= setpoint %d.%d\n", i,
|
||||
TZ_KELVTOC(temp), TZ_KELVTOC(sc->tz_zone.ac[i]));
|
||||
getnanotime(&sc->tz_cooling_started);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are going to get _ACx level down (colder side), but give a guaranteed
|
||||
* minimum cooling run time if requested.
|
||||
*/
|
||||
if (acpi_tz_min_runtime > 0 && sc->tz_active != TZ_ACTIVE_NONE &&
|
||||
(newactive == TZ_ACTIVE_NONE || newactive > sc->tz_active)) {
|
||||
getnanotime(&curtime);
|
||||
timespecsub(&curtime, &sc->tz_cooling_started);
|
||||
if (curtime.tv_sec < acpi_tz_min_runtime) {
|
||||
newactive = sc->tz_active;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle user override of active mode */
|
||||
if (sc->tz_requested > newactive)
|
||||
newactive = sc->tz_requested;
|
||||
|
||||
/* update temperature-related flags */
|
||||
newflags = TZ_THFLAG_NONE;
|
||||
if ((sc->tz_zone.psv != -1) && (temp >= sc->tz_zone.psv))
|
||||
newflags |= TZ_THFLAG_PSV;
|
||||
if ((sc->tz_zone.hot != -1) && (temp >= sc->tz_zone.hot))
|
||||
newflags |= TZ_THFLAG_HOT;
|
||||
if ((sc->tz_zone.crt != -1) && (temp >= sc->tz_zone.crt))
|
||||
newflags |= TZ_THFLAG_CRT;
|
||||
|
||||
/*
|
||||
* If the active cooling state has changed, we have to switch things.
|
||||
*/
|
||||
if (newactive != sc->tz_active) {
|
||||
|
||||
/* turn off the cooling devices that are on, if any are */
|
||||
if (sc->tz_active != TZ_ACTIVE_NONE)
|
||||
acpi_ForeachPackageObject((ACPI_OBJECT *)sc->tz_zone.al[sc->tz_active].Pointer,
|
||||
acpi_tz_switch_cooler_off, sc);
|
||||
|
||||
/* turn on cooling devices that are required, if any are */
|
||||
if (newactive != TZ_ACTIVE_NONE)
|
||||
acpi_ForeachPackageObject((ACPI_OBJECT *)sc->tz_zone.al[newactive].Pointer,
|
||||
acpi_tz_switch_cooler_on, sc);
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"switched from %s to %s: %d.%dC\n",
|
||||
acpi_tz_aclevel_string(sc->tz_active),
|
||||
acpi_tz_aclevel_string(newactive), TZ_KELVTOC(temp));
|
||||
sc->tz_active = newactive;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX (de)activate any passive cooling that may be required.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If we have just become _HOT or _CRT, warn the user.
|
||||
*
|
||||
* We should actually shut down at this point, but it's not clear
|
||||
* that some systems don't actually map _CRT to the same value as _AC0.
|
||||
*/
|
||||
if ((newflags & (TZ_THFLAG_HOT | TZ_THFLAG_CRT)) &&
|
||||
!(sc->tz_thflags & (TZ_THFLAG_HOT | TZ_THFLAG_CRT))) {
|
||||
device_printf(sc->tz_dev, "WARNING - current temperature (%d.%dC) exceeds system limits\n",
|
||||
TZ_KELVTOC(sc->tz_temperature));
|
||||
/* shutdown_nice(RB_POWEROFF);*/
|
||||
}
|
||||
sc->tz_thflags = newflags;
|
||||
|
||||
out:
|
||||
sc->tz_tmp_updating = 0;
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn off all the cooling devices.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_all_off(struct acpi_tz_softc *sc)
|
||||
{
|
||||
int i;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
/*
|
||||
* Scan all the _ALx objects, and turn them all off.
|
||||
*/
|
||||
for (i = 0; i < TZ_NUMLEVELS; i++) {
|
||||
if (sc->tz_zone.al[i].Pointer == NULL)
|
||||
continue;
|
||||
acpi_ForeachPackageObject((ACPI_OBJECT *)sc->tz_zone.al[i].Pointer,
|
||||
acpi_tz_switch_cooler_off, sc);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX revert any passive-cooling options.
|
||||
*/
|
||||
|
||||
sc->tz_active = TZ_ACTIVE_NONE;
|
||||
sc->tz_thflags = TZ_THFLAG_NONE;
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given an object, verify that it's a reference to a device of some sort,
|
||||
* and try to switch it off.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg)
|
||||
{
|
||||
ACPI_HANDLE cooler;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
switch(obj->Type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", acpi_name(obj->Reference.Handle)));
|
||||
|
||||
acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D3);
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n", obj->String.Pointer));
|
||||
|
||||
/*
|
||||
* Find the handle for the device and turn it off.
|
||||
* The String object here seems to contain a fully-qualified path, so we
|
||||
* don't have to search for it in our parents.
|
||||
*
|
||||
* XXX This may not always be the case.
|
||||
*/
|
||||
if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler)))
|
||||
acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3);
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to handle unsupported object type %d\n",
|
||||
obj->Type));
|
||||
break;
|
||||
}
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given an object, verify that it's a reference to a device of some sort,
|
||||
* and try to switch it on.
|
||||
*
|
||||
* XXX replication of off/on function code is bad, mmmkay?
|
||||
*/
|
||||
static void
|
||||
acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg)
|
||||
{
|
||||
struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg;
|
||||
ACPI_HANDLE cooler;
|
||||
ACPI_STATUS status;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
switch(obj->Type) {
|
||||
case ACPI_TYPE_ANY:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", acpi_name(obj->Reference.Handle)));
|
||||
|
||||
if (ACPI_FAILURE(status = acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D0))) {
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"failed to activate %s - %s\n", acpi_name(obj->Reference.Handle),
|
||||
AcpiFormatException(status));
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n", obj->String.Pointer));
|
||||
|
||||
/*
|
||||
* Find the handle for the device and turn it off.
|
||||
* The String object here seems to contain a fully-qualified path, so we
|
||||
* don't have to search for it in our parents.
|
||||
*
|
||||
* XXX This may not always be the case.
|
||||
*/
|
||||
if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler))) {
|
||||
if (ACPI_FAILURE(status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0))) {
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"failed to activate %s - %s\n",
|
||||
obj->String.Pointer, AcpiFormatException(status));
|
||||
}
|
||||
} else {
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"couldn't find %s\n", obj->String.Pointer);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to handle unsupported object type %d\n",
|
||||
obj->Type));
|
||||
break;
|
||||
}
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read/debug-print a parameter, default it to -1.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_getparam(struct acpi_tz_softc *sc, char *node, int *data)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
if (ACPI_FAILURE(acpi_EvaluateInteger(sc->tz_handle, node, data))) {
|
||||
*data = -1;
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_VALUES, "%s.%s = %d\n", acpi_name(sc->tz_handle),
|
||||
node, *data));
|
||||
}
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sanity-check a temperature value. Assume that setpoints
|
||||
* should be between 0C and 150C.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_sanity(struct acpi_tz_softc *sc, int *val, char *what)
|
||||
{
|
||||
if ((*val != -1) && ((*val < TZ_ZEROC) || (*val > (TZ_ZEROC + 1500)))) {
|
||||
device_printf(sc->tz_dev, "%s value is absurd, ignored (%d.%dC)\n",
|
||||
what, TZ_KELVTOC(*val));
|
||||
*val = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Respond to a sysctl on the active state node.
|
||||
*/
|
||||
static int
|
||||
acpi_tz_active_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct acpi_tz_softc *sc;
|
||||
int active;
|
||||
int error;
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
ACPI_LOCK;
|
||||
|
||||
sc = (struct acpi_tz_softc *)oidp->oid_arg1;
|
||||
active = sc->tz_active;
|
||||
error = sysctl_handle_int(oidp, &active, 0, req);
|
||||
|
||||
/* error or no new value */
|
||||
if ((error != 0) || (req->newptr == NULL))
|
||||
goto out;
|
||||
|
||||
/* range check */
|
||||
if ((active < -1) || (active >= TZ_NUMLEVELS)) {
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* set new preferred level and re-switch */
|
||||
sc->tz_requested = active;
|
||||
acpi_tz_monitor(sc);
|
||||
|
||||
out:
|
||||
ACPI_UNLOCK;
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Respond to a Notify event sent to the zone.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
|
||||
{
|
||||
struct acpi_tz_softc *sc = (struct acpi_tz_softc *)context;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
switch(notify) {
|
||||
case TZ_NOTIFY_TEMPERATURE:
|
||||
/* temperature change occurred */
|
||||
AcpiOsQueueForExecution(OSD_PRIORITY_HIGH, (OSD_EXECUTION_CALLBACK)acpi_tz_monitor, sc);
|
||||
break;
|
||||
case TZ_NOTIFY_DEVICES:
|
||||
case TZ_NOTIFY_LEVELS:
|
||||
/* zone devices/setpoints changed */
|
||||
AcpiOsQueueForExecution(OSD_PRIORITY_HIGH, (OSD_EXECUTION_CALLBACK)acpi_tz_establish, sc);
|
||||
break;
|
||||
default:
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"unknown Notify event 0x%x\n", notify);
|
||||
break;
|
||||
}
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Poll the thermal zone.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_timeout(struct acpi_tz_softc *sc)
|
||||
{
|
||||
|
||||
/* do we need to get the power profile settings? */
|
||||
if (sc->tz_flags & TZ_FLAG_GETPROFILE) {
|
||||
acpi_tz_power_profile((void *)sc);
|
||||
sc->tz_flags &= ~TZ_FLAG_GETPROFILE;
|
||||
}
|
||||
|
||||
ACPI_ASSERTLOCK;
|
||||
|
||||
/* check the current temperature and take action based on it */
|
||||
acpi_tz_monitor(sc);
|
||||
|
||||
/* XXX passive cooling actions? */
|
||||
}
|
||||
|
||||
/*
|
||||
* System power profile may have changed; fetch and notify the
|
||||
* thermal zone accordingly.
|
||||
*
|
||||
* Since this can be called from an arbitrary eventhandler, it needs
|
||||
* to get the ACPI lock itself.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_power_profile(void *arg)
|
||||
{
|
||||
ACPI_OBJECT_LIST args;
|
||||
ACPI_OBJECT obj;
|
||||
ACPI_STATUS status;
|
||||
struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg;
|
||||
int state;
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
state = power_profile_get_state();
|
||||
if (state != POWER_PROFILE_PERFORMANCE &&
|
||||
state != POWER_PROFILE_ECONOMY) {
|
||||
return;
|
||||
}
|
||||
|
||||
ACPI_LOCK;
|
||||
|
||||
/* check that we haven't decided there's no _SCP method */
|
||||
if (!(sc->tz_flags & TZ_FLAG_NO_SCP)) {
|
||||
|
||||
/* call _SCP to set the new profile */
|
||||
obj.Type = ACPI_TYPE_INTEGER;
|
||||
obj.Integer.Value = (state == POWER_PROFILE_PERFORMANCE) ? 0 : 1;
|
||||
args.Count = 1;
|
||||
args.Pointer = &obj;
|
||||
if (ACPI_FAILURE(status = AcpiEvaluateObject(sc->tz_handle, "_SCP", &args, NULL))) {
|
||||
if (status != AE_NOT_FOUND)
|
||||
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
|
||||
"can't evaluate %s._SCP - %s\n", acpi_name(sc->tz_handle),
|
||||
AcpiFormatException(status));
|
||||
sc->tz_flags |= TZ_FLAG_NO_SCP;
|
||||
} else {
|
||||
/* we have to re-evaluate the entire zone now */
|
||||
AcpiOsQueueForExecution(OSD_PRIORITY_HIGH, (OSD_EXECUTION_CALLBACK)acpi_tz_establish, sc);
|
||||
}
|
||||
}
|
||||
ACPI_UNLOCK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Thermal zone monitor thread.
|
||||
*/
|
||||
static void
|
||||
acpi_tz_thread(void *arg)
|
||||
{
|
||||
device_t *devs;
|
||||
int devcount, i;
|
||||
ACPI_LOCK_DECL;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
|
||||
|
||||
|
||||
devs = NULL;
|
||||
devcount = 0;
|
||||
|
||||
for (;;) {
|
||||
tsleep(&acpi_tz_proc, PZERO, "nothing", hz * acpi_tz_polling_rate);
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
mtx_lock(&Giant);
|
||||
#endif
|
||||
|
||||
if (devcount == 0)
|
||||
devclass_get_devices(acpi_tz_devclass, &devs, &devcount);
|
||||
|
||||
ACPI_LOCK;
|
||||
for (i = 0; i < devcount; i++)
|
||||
acpi_tz_timeout(device_get_softc(devs[i]));
|
||||
ACPI_UNLOCK;
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
mtx_unlock(&Giant);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Mitsuru IWASAKI
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "acpi.h"
|
||||
#include <machine/cpufunc.h>
|
||||
#include <dev/acpica/acpica_support.h>
|
||||
|
||||
ACPI_MODULE_NAME("SUPPORT")
|
||||
|
||||
/*
|
||||
* Implement support code temporary here until officially merged into
|
||||
* Intel ACPI CA release.
|
||||
*/
|
||||
|
||||
#undef _COMPONENT
|
||||
#define _COMPONENT ACPI_HARDWARE
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEnterSleepStateS4Bios
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Enter a system sleep state S4BIOS
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEnterSleepStateS4Bios (
|
||||
void)
|
||||
{
|
||||
ACPI_OBJECT_LIST ArgList;
|
||||
ACPI_OBJECT Arg;
|
||||
UINT32 Value;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4Bios");
|
||||
|
||||
/* run the _PTS and _GTS methods */
|
||||
|
||||
ACPI_MEMSET(&ArgList, 0, sizeof(ArgList));
|
||||
ArgList.Count = 1;
|
||||
ArgList.Pointer = &Arg;
|
||||
|
||||
ACPI_MEMSET(&Arg, 0, sizeof(Arg));
|
||||
Arg.Type = ACPI_TYPE_INTEGER;
|
||||
Arg.Integer.Value = ACPI_STATE_S4;
|
||||
|
||||
AcpiEvaluateObject (NULL, "\\_PTS", &ArgList, NULL);
|
||||
AcpiEvaluateObject (NULL, "\\_GTS", &ArgList, NULL);
|
||||
|
||||
/* clear wake status */
|
||||
|
||||
AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK);
|
||||
|
||||
ACPI_DISABLE_IRQS ();
|
||||
|
||||
AcpiHwDisableNonWakeupGpes();
|
||||
|
||||
/* flush caches */
|
||||
|
||||
ACPI_FLUSH_CPU_CACHE ();
|
||||
|
||||
/* write the value to command port and wait until we enter sleep state */
|
||||
do
|
||||
{
|
||||
AcpiOsStall(1000000);
|
||||
AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->S4BiosReq, 8);
|
||||
AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &Value, ACPI_MTX_LOCK);
|
||||
}
|
||||
while (!Value);
|
||||
|
||||
AcpiHwEnableNonWakeupGpes();
|
||||
|
||||
ACPI_ENABLE_IRQS ();
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Mitsuru IWASAKI
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#include "acpi.h"
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiEnterSleepStateS4Bios (
|
||||
void);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiSetDsdtTablePtr(
|
||||
ACPI_TABLE_HEADER *Ptr);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#64 $"
|
||||
VERSION = "$Id: aic79xx.reg,v 1.2.2.4 2003/03/07 23:20:36 gibbs Exp $"
|
||||
|
||||
/*
|
||||
* This file is processed by the aic7xxx_asm utility for use in assembling
|
||||
@@ -2545,10 +2545,10 @@ const AHD_PRECOMP_CUTBACK_37 0x07
|
||||
const AHD_SLEWRATE_MASK 0x78
|
||||
const AHD_SLEWRATE_SHIFT 3
|
||||
/*
|
||||
* Rev A has only a single bit of slew adjustment.
|
||||
* Rev B has 4 bits.
|
||||
* Rev A has only a single bit (high bit of field) of slew adjustment.
|
||||
* Rev B has 4 bits. The current default happens to be the same for both.
|
||||
*/
|
||||
const AHD_SLEWRATE_DEF_REVA 0x01
|
||||
const AHD_SLEWRATE_DEF_REVA 0x08
|
||||
const AHD_SLEWRATE_DEF_REVB 0x08
|
||||
|
||||
/* Rev A does not have any amplitude setting. */
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
/* ati_pcigart.h -- ATI PCI GART support -*- linux-c -*-
|
||||
* Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "dev/drm/drmP.h"
|
||||
|
||||
#if PAGE_SIZE == 8192
|
||||
# define ATI_PCIGART_TABLE_ORDER 2
|
||||
# define ATI_PCIGART_TABLE_PAGES (1 << 2)
|
||||
#elif PAGE_SIZE == 4096
|
||||
# define ATI_PCIGART_TABLE_ORDER 3
|
||||
# define ATI_PCIGART_TABLE_PAGES (1 << 3)
|
||||
#elif
|
||||
# error - PAGE_SIZE not 8K or 4K
|
||||
#endif
|
||||
|
||||
# define ATI_MAX_PCIGART_PAGES 8192 /* 32 MB aperture, 4K pages */
|
||||
# define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
|
||||
|
||||
int DRM(ati_pcigart_init)( drm_device_t *dev,
|
||||
unsigned long *addr,
|
||||
dma_addr_t *bus_addr)
|
||||
{
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
unsigned long address = 0;
|
||||
unsigned long pages;
|
||||
u32 *pci_gart=0, page_base, bus_address = 0;
|
||||
int i, j, ret = 0;
|
||||
|
||||
if ( !entry ) {
|
||||
DRM_ERROR( "no scatter/gather memory!\n" );
|
||||
goto done;
|
||||
}
|
||||
|
||||
address = (long)contigmalloc((1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE,
|
||||
DRM(M_DRM), M_WAITOK, 0ul, 0xfffffffful, PAGE_SIZE, 0);
|
||||
if ( !address ) {
|
||||
DRM_ERROR( "cannot allocate PCI GART page!\n" );
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* XXX: we need to busdma this */
|
||||
bus_address = vtophys( address );
|
||||
|
||||
pci_gart = (u32 *)address;
|
||||
|
||||
pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES )
|
||||
? entry->pages : ATI_MAX_PCIGART_PAGES;
|
||||
|
||||
bzero( pci_gart, ATI_MAX_PCIGART_PAGES * sizeof(u32) );
|
||||
|
||||
for ( i = 0 ; i < pages ; i++ ) {
|
||||
entry->busaddr[i] = vtophys( entry->handle + (i*PAGE_SIZE) );
|
||||
page_base = (u32) entry->busaddr[i];
|
||||
|
||||
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
|
||||
*pci_gart++ = cpu_to_le32( page_base );
|
||||
page_base += ATI_PCIGART_PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
done:
|
||||
*addr = address;
|
||||
*bus_addr = bus_address;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int DRM(ati_pcigart_cleanup)( drm_device_t *dev,
|
||||
unsigned long addr,
|
||||
dma_addr_t bus_addr)
|
||||
{
|
||||
drm_sg_mem_t *entry = dev->sg;
|
||||
|
||||
/* we need to support large memory configurations */
|
||||
if ( !entry ) {
|
||||
DRM_ERROR( "no scatter/gather memory!\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if __FreeBSD_version > 500000
|
||||
contigfree( (void *)addr, (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, DRM(M_DRM)); /* Not available on 4.x */
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -1,475 +0,0 @@
|
||||
/* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
|
||||
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
* Acknowledgements:
|
||||
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _DRM_H_
|
||||
#define _DRM_H_
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/config.h>
|
||||
#include <asm/ioctl.h> /* For _IO* macros */
|
||||
#define DRM_IOCTL_NR(n) _IOC_NR(n)
|
||||
#define DRM_IOC_VOID _IOC_NONE
|
||||
#define DRM_IOC_READ _IOC_READ
|
||||
#define DRM_IOC_WRITE _IOC_WRITE
|
||||
#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
|
||||
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#if defined(__FreeBSD__) && defined(XFree86Server)
|
||||
/* Prevent name collision when including sys/ioccom.h */
|
||||
#undef ioctl
|
||||
#include <sys/ioccom.h>
|
||||
#define ioctl(a,b,c) xf86ioctl(a,b,c)
|
||||
#else
|
||||
#include <sys/ioccom.h>
|
||||
#endif /* __FreeBSD__ && xf86ioctl */
|
||||
#define DRM_IOCTL_NR(n) ((n) & 0xff)
|
||||
#define DRM_IOC_VOID IOC_VOID
|
||||
#define DRM_IOC_READ IOC_OUT
|
||||
#define DRM_IOC_WRITE IOC_IN
|
||||
#define DRM_IOC_READWRITE IOC_INOUT
|
||||
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
|
||||
#endif
|
||||
|
||||
#define XFREE86_VERSION(major,minor,patch,snap) \
|
||||
((major << 16) | (minor << 8) | patch)
|
||||
|
||||
#ifndef CONFIG_XFREE86_VERSION
|
||||
#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0)
|
||||
#endif
|
||||
|
||||
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
|
||||
#define DRM_PROC_DEVICES "/proc/devices"
|
||||
#define DRM_PROC_MISC "/proc/misc"
|
||||
#define DRM_PROC_DRM "/proc/drm"
|
||||
#define DRM_DEV_DRM "/dev/drm"
|
||||
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
|
||||
#define DRM_DEV_UID 0
|
||||
#define DRM_DEV_GID 0
|
||||
#endif
|
||||
|
||||
#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
|
||||
#define DRM_MAJOR 226
|
||||
#define DRM_MAX_MINOR 15
|
||||
#endif
|
||||
#define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */
|
||||
#define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */
|
||||
#define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */
|
||||
#define DRM_RAM_PERCENT 10 /* How much system ram can we lock? */
|
||||
|
||||
#define _DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */
|
||||
#define _DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */
|
||||
#define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD)
|
||||
#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT)
|
||||
#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
|
||||
|
||||
typedef unsigned long drm_handle_t;
|
||||
typedef unsigned int drm_context_t;
|
||||
typedef unsigned int drm_drawable_t;
|
||||
typedef unsigned int drm_magic_t;
|
||||
|
||||
/* Warning: If you change this structure, make sure you change
|
||||
* XF86DRIClipRectRec in the server as well */
|
||||
|
||||
/* KW: Actually it's illegal to change either for
|
||||
* backwards-compatibility reasons.
|
||||
*/
|
||||
|
||||
typedef struct drm_clip_rect {
|
||||
unsigned short x1;
|
||||
unsigned short y1;
|
||||
unsigned short x2;
|
||||
unsigned short y2;
|
||||
} drm_clip_rect_t;
|
||||
|
||||
typedef struct drm_tex_region {
|
||||
unsigned char next;
|
||||
unsigned char prev;
|
||||
unsigned char in_use;
|
||||
unsigned char padding;
|
||||
unsigned int age;
|
||||
} drm_tex_region_t;
|
||||
|
||||
typedef struct drm_version {
|
||||
int version_major; /* Major version */
|
||||
int version_minor; /* Minor version */
|
||||
int version_patchlevel;/* Patch level */
|
||||
size_t name_len; /* Length of name buffer */
|
||||
char *name; /* Name of driver */
|
||||
size_t date_len; /* Length of date buffer */
|
||||
char *date; /* User-space buffer to hold date */
|
||||
size_t desc_len; /* Length of desc buffer */
|
||||
char *desc; /* User-space buffer to hold desc */
|
||||
} drm_version_t;
|
||||
|
||||
typedef struct drm_unique {
|
||||
size_t unique_len; /* Length of unique */
|
||||
char *unique; /* Unique name for driver instantiation */
|
||||
} drm_unique_t;
|
||||
|
||||
typedef struct drm_list {
|
||||
int count; /* Length of user-space structures */
|
||||
drm_version_t *version;
|
||||
} drm_list_t;
|
||||
|
||||
typedef struct drm_block {
|
||||
int unused;
|
||||
} drm_block_t;
|
||||
|
||||
typedef struct drm_control {
|
||||
enum {
|
||||
DRM_ADD_COMMAND,
|
||||
DRM_RM_COMMAND,
|
||||
DRM_INST_HANDLER,
|
||||
DRM_UNINST_HANDLER
|
||||
} func;
|
||||
int irq;
|
||||
} drm_control_t;
|
||||
|
||||
typedef enum drm_map_type {
|
||||
_DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */
|
||||
_DRM_REGISTERS = 1, /* no caching, no core dump */
|
||||
_DRM_SHM = 2, /* shared, cached */
|
||||
_DRM_AGP = 3, /* AGP/GART */
|
||||
_DRM_SCATTER_GATHER = 4 /* Scatter/gather memory for PCI DMA */
|
||||
} drm_map_type_t;
|
||||
|
||||
typedef enum drm_map_flags {
|
||||
_DRM_RESTRICTED = 0x01, /* Cannot be mapped to user-virtual */
|
||||
_DRM_READ_ONLY = 0x02,
|
||||
_DRM_LOCKED = 0x04, /* shared, cached, locked */
|
||||
_DRM_KERNEL = 0x08, /* kernel requires access */
|
||||
_DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */
|
||||
_DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */
|
||||
_DRM_REMOVABLE = 0x40 /* Removable mapping */
|
||||
} drm_map_flags_t;
|
||||
|
||||
typedef struct drm_ctx_priv_map {
|
||||
unsigned int ctx_id; /* Context requesting private mapping */
|
||||
void *handle; /* Handle of map */
|
||||
} drm_ctx_priv_map_t;
|
||||
|
||||
typedef struct drm_map {
|
||||
unsigned long offset; /* Requested physical address (0 for SAREA)*/
|
||||
unsigned long size; /* Requested physical size (bytes) */
|
||||
drm_map_type_t type; /* Type of memory to map */
|
||||
drm_map_flags_t flags; /* Flags */
|
||||
void *handle; /* User-space: "Handle" to pass to mmap */
|
||||
/* Kernel-space: kernel-virtual address */
|
||||
int mtrr; /* MTRR slot used */
|
||||
/* Private data */
|
||||
} drm_map_t;
|
||||
|
||||
typedef struct drm_client {
|
||||
int idx; /* Which client desired? */
|
||||
int auth; /* Is client authenticated? */
|
||||
unsigned long pid; /* Process id */
|
||||
unsigned long uid; /* User id */
|
||||
unsigned long magic; /* Magic */
|
||||
unsigned long iocs; /* Ioctl count */
|
||||
} drm_client_t;
|
||||
|
||||
typedef enum {
|
||||
_DRM_STAT_LOCK,
|
||||
_DRM_STAT_OPENS,
|
||||
_DRM_STAT_CLOSES,
|
||||
_DRM_STAT_IOCTLS,
|
||||
_DRM_STAT_LOCKS,
|
||||
_DRM_STAT_UNLOCKS,
|
||||
_DRM_STAT_VALUE, /* Generic value */
|
||||
_DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */
|
||||
_DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */
|
||||
|
||||
_DRM_STAT_IRQ, /* IRQ */
|
||||
_DRM_STAT_PRIMARY, /* Primary DMA bytes */
|
||||
_DRM_STAT_SECONDARY, /* Secondary DMA bytes */
|
||||
_DRM_STAT_DMA, /* DMA */
|
||||
_DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */
|
||||
_DRM_STAT_MISSED /* Missed DMA opportunity */
|
||||
|
||||
/* Add to the *END* of the list */
|
||||
} drm_stat_type_t;
|
||||
|
||||
typedef struct drm_stats {
|
||||
unsigned long count;
|
||||
struct {
|
||||
unsigned long value;
|
||||
drm_stat_type_t type;
|
||||
} data[15];
|
||||
} drm_stats_t;
|
||||
|
||||
typedef enum drm_lock_flags {
|
||||
_DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */
|
||||
_DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */
|
||||
_DRM_LOCK_FLUSH = 0x04, /* Flush this context's DMA queue first */
|
||||
_DRM_LOCK_FLUSH_ALL = 0x08, /* Flush all DMA queues first */
|
||||
/* These *HALT* flags aren't supported yet
|
||||
-- they will be used to support the
|
||||
full-screen DGA-like mode. */
|
||||
_DRM_HALT_ALL_QUEUES = 0x10, /* Halt all current and future queues */
|
||||
_DRM_HALT_CUR_QUEUES = 0x20 /* Halt all current queues */
|
||||
} drm_lock_flags_t;
|
||||
|
||||
typedef struct drm_lock {
|
||||
int context;
|
||||
drm_lock_flags_t flags;
|
||||
} drm_lock_t;
|
||||
|
||||
typedef enum drm_dma_flags { /* These values *MUST* match xf86drm.h */
|
||||
/* Flags for DMA buffer dispatch */
|
||||
_DRM_DMA_BLOCK = 0x01, /* Block until buffer dispatched.
|
||||
Note, the buffer may not yet have
|
||||
been processed by the hardware --
|
||||
getting a hardware lock with the
|
||||
hardware quiescent will ensure
|
||||
that the buffer has been
|
||||
processed. */
|
||||
_DRM_DMA_WHILE_LOCKED = 0x02, /* Dispatch while lock held */
|
||||
_DRM_DMA_PRIORITY = 0x04, /* High priority dispatch */
|
||||
|
||||
/* Flags for DMA buffer request */
|
||||
_DRM_DMA_WAIT = 0x10, /* Wait for free buffers */
|
||||
_DRM_DMA_SMALLER_OK = 0x20, /* Smaller-than-requested buffers ok */
|
||||
_DRM_DMA_LARGER_OK = 0x40 /* Larger-than-requested buffers ok */
|
||||
} drm_dma_flags_t;
|
||||
|
||||
typedef struct drm_buf_desc {
|
||||
int count; /* Number of buffers of this size */
|
||||
int size; /* Size in bytes */
|
||||
int low_mark; /* Low water mark */
|
||||
int high_mark; /* High water mark */
|
||||
enum {
|
||||
_DRM_PAGE_ALIGN = 0x01, /* Align on page boundaries for DMA */
|
||||
_DRM_AGP_BUFFER = 0x02, /* Buffer is in agp space */
|
||||
_DRM_SG_BUFFER = 0x04 /* Scatter/gather memory buffer */
|
||||
} flags;
|
||||
unsigned long agp_start; /* Start address of where the agp buffers
|
||||
* are in the agp aperture */
|
||||
} drm_buf_desc_t;
|
||||
|
||||
typedef struct drm_buf_info {
|
||||
int count; /* Entries in list */
|
||||
drm_buf_desc_t *list;
|
||||
} drm_buf_info_t;
|
||||
|
||||
typedef struct drm_buf_free {
|
||||
int count;
|
||||
int *list;
|
||||
} drm_buf_free_t;
|
||||
|
||||
typedef struct drm_buf_pub {
|
||||
int idx; /* Index into master buflist */
|
||||
int total; /* Buffer size */
|
||||
int used; /* Amount of buffer in use (for DMA) */
|
||||
void *address; /* Address of buffer */
|
||||
} drm_buf_pub_t;
|
||||
|
||||
typedef struct drm_buf_map {
|
||||
int count; /* Length of buflist */
|
||||
void *virtual; /* Mmaped area in user-virtual */
|
||||
drm_buf_pub_t *list; /* Buffer information */
|
||||
} drm_buf_map_t;
|
||||
|
||||
typedef struct drm_dma {
|
||||
/* Indices here refer to the offset into
|
||||
buflist in drm_buf_get_t. */
|
||||
int context; /* Context handle */
|
||||
int send_count; /* Number of buffers to send */
|
||||
int *send_indices; /* List of handles to buffers */
|
||||
int *send_sizes; /* Lengths of data to send */
|
||||
drm_dma_flags_t flags; /* Flags */
|
||||
int request_count; /* Number of buffers requested */
|
||||
int request_size; /* Desired size for buffers */
|
||||
int *request_indices; /* Buffer information */
|
||||
int *request_sizes;
|
||||
int granted_count; /* Number of buffers granted */
|
||||
} drm_dma_t;
|
||||
|
||||
typedef enum {
|
||||
_DRM_CONTEXT_PRESERVED = 0x01,
|
||||
_DRM_CONTEXT_2DONLY = 0x02
|
||||
} drm_ctx_flags_t;
|
||||
|
||||
typedef struct drm_ctx {
|
||||
drm_context_t handle;
|
||||
drm_ctx_flags_t flags;
|
||||
} drm_ctx_t;
|
||||
|
||||
typedef struct drm_ctx_res {
|
||||
int count;
|
||||
drm_ctx_t *contexts;
|
||||
} drm_ctx_res_t;
|
||||
|
||||
typedef struct drm_draw {
|
||||
drm_drawable_t handle;
|
||||
} drm_draw_t;
|
||||
|
||||
typedef struct drm_auth {
|
||||
drm_magic_t magic;
|
||||
} drm_auth_t;
|
||||
|
||||
typedef struct drm_irq_busid {
|
||||
int irq;
|
||||
int busnum;
|
||||
int devnum;
|
||||
int funcnum;
|
||||
} drm_irq_busid_t;
|
||||
|
||||
typedef enum {
|
||||
_DRM_VBLANK_ABSOLUTE = 0x0, /* Wait for specific vblank sequence number */
|
||||
_DRM_VBLANK_RELATIVE = 0x1, /* Wait for given number of vblanks */
|
||||
_DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */
|
||||
} drm_vblank_seq_type_t;
|
||||
|
||||
#define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL
|
||||
|
||||
struct drm_wait_vblank_request {
|
||||
drm_vblank_seq_type_t type;
|
||||
unsigned int sequence;
|
||||
unsigned long signal;
|
||||
};
|
||||
|
||||
struct drm_wait_vblank_reply {
|
||||
drm_vblank_seq_type_t type;
|
||||
unsigned int sequence;
|
||||
long tval_sec;
|
||||
long tval_usec;
|
||||
};
|
||||
|
||||
typedef union drm_wait_vblank {
|
||||
struct drm_wait_vblank_request request;
|
||||
struct drm_wait_vblank_reply reply;
|
||||
} drm_wait_vblank_t;
|
||||
|
||||
typedef struct drm_agp_mode {
|
||||
unsigned long mode;
|
||||
} drm_agp_mode_t;
|
||||
|
||||
/* For drm_agp_alloc -- allocated a buffer */
|
||||
typedef struct drm_agp_buffer {
|
||||
unsigned long size; /* In bytes -- will round to page boundary */
|
||||
unsigned long handle; /* Used for BIND/UNBIND ioctls */
|
||||
unsigned long type; /* Type of memory to allocate */
|
||||
unsigned long physical; /* Physical used by i810 */
|
||||
} drm_agp_buffer_t;
|
||||
|
||||
/* For drm_agp_bind */
|
||||
typedef struct drm_agp_binding {
|
||||
unsigned long handle; /* From drm_agp_buffer */
|
||||
unsigned long offset; /* In bytes -- will round to page boundary */
|
||||
} drm_agp_binding_t;
|
||||
|
||||
typedef struct drm_agp_info {
|
||||
int agp_version_major;
|
||||
int agp_version_minor;
|
||||
unsigned long mode;
|
||||
unsigned long aperture_base; /* physical address */
|
||||
unsigned long aperture_size; /* bytes */
|
||||
unsigned long memory_allowed; /* bytes */
|
||||
unsigned long memory_used;
|
||||
|
||||
/* PCI information */
|
||||
unsigned short id_vendor;
|
||||
unsigned short id_device;
|
||||
} drm_agp_info_t;
|
||||
|
||||
typedef struct drm_scatter_gather {
|
||||
unsigned long size; /* In bytes -- will round to page boundary */
|
||||
unsigned long handle; /* Used for mapping / unmapping */
|
||||
} drm_scatter_gather_t;
|
||||
|
||||
#define DRM_IOCTL_BASE 'd'
|
||||
#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
|
||||
#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)
|
||||
#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type)
|
||||
#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)
|
||||
|
||||
#define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t)
|
||||
#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t)
|
||||
#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t)
|
||||
#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t)
|
||||
#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t)
|
||||
#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t)
|
||||
#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t)
|
||||
|
||||
#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t)
|
||||
#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t)
|
||||
#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, drm_block_t)
|
||||
#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, drm_block_t)
|
||||
#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, drm_control_t)
|
||||
#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, drm_map_t)
|
||||
#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, drm_buf_desc_t)
|
||||
#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, drm_buf_desc_t)
|
||||
#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm_buf_info_t)
|
||||
#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t)
|
||||
#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t)
|
||||
|
||||
#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t)
|
||||
|
||||
#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t)
|
||||
#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t)
|
||||
|
||||
#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t)
|
||||
#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t)
|
||||
#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t)
|
||||
#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, drm_ctx_t)
|
||||
#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, drm_ctx_t)
|
||||
#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, drm_ctx_t)
|
||||
#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, drm_ctx_res_t)
|
||||
#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, drm_draw_t)
|
||||
#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, drm_draw_t)
|
||||
#define DRM_IOCTL_DMA DRM_IOWR(0x29, drm_dma_t)
|
||||
#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, drm_lock_t)
|
||||
#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t)
|
||||
#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t)
|
||||
|
||||
#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
|
||||
#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
|
||||
#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t)
|
||||
#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t)
|
||||
#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t)
|
||||
#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t)
|
||||
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
|
||||
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
|
||||
|
||||
#define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t)
|
||||
#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t)
|
||||
|
||||
#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t)
|
||||
|
||||
/* Device specfic ioctls should only be in their respective headers
|
||||
* The device specific ioctl range is 0x40 to 0x79. */
|
||||
#define DRM_COMMAND_BASE 0x40
|
||||
|
||||
#endif
|
||||
@@ -1,333 +0,0 @@
|
||||
/* drm_agpsupport.h -- DRM support for AGP/GART backend -*- linux-c -*-
|
||||
* Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "dev/drm/drmP.h"
|
||||
|
||||
int DRM(agp_info)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
struct agp_info *kern;
|
||||
drm_agp_info_t info;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
|
||||
kern = &dev->agp->info;
|
||||
agp_get_info(dev->agp->agpdev, kern);
|
||||
info.agp_version_major = 1;
|
||||
info.agp_version_minor = 0;
|
||||
info.mode = kern->ai_mode;
|
||||
info.aperture_base = kern->ai_aperture_base;
|
||||
info.aperture_size = kern->ai_aperture_size;
|
||||
info.memory_allowed = kern->ai_memory_allowed;
|
||||
info.memory_used = kern->ai_memory_used;
|
||||
info.id_vendor = kern->ai_devid & 0xffff;
|
||||
info.id_device = kern->ai_devid >> 16;
|
||||
|
||||
*(drm_agp_info_t *) data = info;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_acquire)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
int retcode;
|
||||
|
||||
if (!dev->agp || dev->agp->acquired)
|
||||
return EINVAL;
|
||||
retcode = agp_acquire(dev->agp->agpdev);
|
||||
if (retcode)
|
||||
return retcode;
|
||||
dev->agp->acquired = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_release)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
agp_release(dev->agp->agpdev);
|
||||
dev->agp->acquired = 0;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void DRM(agp_do_release)(void)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
agpdev = DRM_AGP_FIND_DEVICE();
|
||||
if (agpdev)
|
||||
agp_release(agpdev);
|
||||
}
|
||||
|
||||
int DRM(agp_enable)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_mode_t mode;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
|
||||
mode = *(drm_agp_mode_t *) data;
|
||||
|
||||
dev->agp->mode = mode.mode;
|
||||
agp_enable(dev->agp->agpdev, mode.mode);
|
||||
dev->agp->base = dev->agp->info.ai_aperture_base;
|
||||
dev->agp->enabled = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_alloc)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_buffer_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
void *handle;
|
||||
unsigned long pages;
|
||||
u_int32_t type;
|
||||
struct agp_memory_info info;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
|
||||
if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS)))
|
||||
return ENOMEM;
|
||||
|
||||
bzero(entry, sizeof(*entry));
|
||||
|
||||
pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
type = (u_int32_t) request.type;
|
||||
|
||||
if (!(handle = DRM(alloc_agp)(pages, type))) {
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
entry->handle = handle;
|
||||
entry->bound = 0;
|
||||
entry->pages = pages;
|
||||
entry->prev = NULL;
|
||||
entry->next = dev->agp->memory;
|
||||
if (dev->agp->memory)
|
||||
dev->agp->memory->prev = entry;
|
||||
dev->agp->memory = entry;
|
||||
|
||||
agp_memory_info(dev->agp->agpdev, entry->handle, &info);
|
||||
|
||||
request.handle = (unsigned long) entry->handle;
|
||||
request.physical = info.ami_physical;
|
||||
|
||||
*(drm_agp_buffer_t *) data = request;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static drm_agp_mem_t * DRM(agp_lookup_entry)(drm_device_t *dev, void *handle)
|
||||
{
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
for (entry = dev->agp->memory; entry; entry = entry->next) {
|
||||
if (entry->handle == handle) return entry;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int DRM(agp_unbind)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_binding_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
int retcode;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
return EINVAL;
|
||||
if (!entry->bound) return EINVAL;
|
||||
retcode=DRM(unbind_agp)(entry->handle);
|
||||
if (!retcode)
|
||||
{
|
||||
entry->bound=0;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int DRM(agp_bind)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_binding_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
int retcode;
|
||||
int page;
|
||||
|
||||
DRM_DEBUG("agp_bind, page_size=%x\n", PAGE_SIZE);
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_binding_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void *) request.handle)))
|
||||
return EINVAL;
|
||||
if (entry->bound) return EINVAL;
|
||||
page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
if ((retcode = DRM(bind_agp)(entry->handle, page)))
|
||||
return retcode;
|
||||
entry->bound = dev->agp->base + (page << PAGE_SHIFT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(agp_free)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_agp_buffer_t request;
|
||||
drm_agp_mem_t *entry;
|
||||
|
||||
if (!dev->agp || !dev->agp->acquired)
|
||||
return EINVAL;
|
||||
request = *(drm_agp_buffer_t *) data;
|
||||
if (!(entry = DRM(agp_lookup_entry)(dev, (void*) request.handle)))
|
||||
return EINVAL;
|
||||
if (entry->bound)
|
||||
DRM(unbind_agp)(entry->handle);
|
||||
|
||||
if (entry->prev)
|
||||
entry->prev->next = entry->next;
|
||||
else
|
||||
dev->agp->memory = entry->next;
|
||||
if (entry->next)
|
||||
entry->next->prev = entry->prev;
|
||||
DRM(free_agp)(entry->handle, entry->pages);
|
||||
DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
drm_agp_head_t *DRM(agp_init)(void)
|
||||
{
|
||||
device_t agpdev;
|
||||
drm_agp_head_t *head = NULL;
|
||||
int agp_available = 1;
|
||||
|
||||
agpdev = DRM_AGP_FIND_DEVICE();
|
||||
if (!agpdev)
|
||||
agp_available = 0;
|
||||
|
||||
DRM_DEBUG("agp_available = %d\n", agp_available);
|
||||
|
||||
if (agp_available) {
|
||||
if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS)))
|
||||
return NULL;
|
||||
bzero((void *)head, sizeof(*head));
|
||||
head->agpdev = agpdev;
|
||||
agp_get_info(agpdev, &head->info);
|
||||
head->memory = NULL;
|
||||
#if 0 /* bogus */
|
||||
switch (head->agp_info.chipset) {
|
||||
case INTEL_GENERIC: head->chipset = "Intel"; break;
|
||||
case INTEL_LX: head->chipset = "Intel 440LX"; break;
|
||||
case INTEL_BX: head->chipset = "Intel 440BX"; break;
|
||||
case INTEL_GX: head->chipset = "Intel 440GX"; break;
|
||||
case INTEL_I810: head->chipset = "Intel i810"; break;
|
||||
case VIA_GENERIC: head->chipset = "VIA"; break;
|
||||
case VIA_VP3: head->chipset = "VIA VP3"; break;
|
||||
case VIA_MVP3: head->chipset = "VIA MVP3"; break;
|
||||
case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; break;
|
||||
case SIS_GENERIC: head->chipset = "SiS"; break;
|
||||
case AMD_GENERIC: head->chipset = "AMD"; break;
|
||||
case AMD_IRONGATE: head->chipset = "AMD Irongate"; break;
|
||||
case ALI_GENERIC: head->chipset = "ALi"; break;
|
||||
case ALI_M1541: head->chipset = "ALi M1541"; break;
|
||||
default:
|
||||
}
|
||||
#endif
|
||||
DRM_INFO("AGP at 0x%08lx %dMB\n",
|
||||
(long)head->info.ai_aperture_base,
|
||||
(int)(head->info.ai_aperture_size >> 20));
|
||||
}
|
||||
return head;
|
||||
}
|
||||
|
||||
void DRM(agp_uninit)(void)
|
||||
{
|
||||
/* FIXME: What goes here */
|
||||
}
|
||||
|
||||
|
||||
agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
agpdev = DRM_AGP_FIND_DEVICE();
|
||||
if (!agpdev)
|
||||
return NULL;
|
||||
|
||||
return agp_alloc_memory(agpdev, type, pages << AGP_PAGE_SHIFT);
|
||||
}
|
||||
|
||||
int DRM(agp_free_memory)(agp_memory *handle)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
agpdev = DRM_AGP_FIND_DEVICE();
|
||||
if (!agpdev || !handle)
|
||||
return 0;
|
||||
|
||||
agp_free_memory(agpdev, handle);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int DRM(agp_bind_memory)(agp_memory *handle, off_t start)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
agpdev = DRM_AGP_FIND_DEVICE();
|
||||
if (!agpdev || !handle)
|
||||
return EINVAL;
|
||||
|
||||
return agp_bind_memory(agpdev, handle, start * PAGE_SIZE);
|
||||
}
|
||||
|
||||
int DRM(agp_unbind_memory)(agp_memory *handle)
|
||||
{
|
||||
device_t agpdev;
|
||||
|
||||
agpdev = DRM_AGP_FIND_DEVICE();
|
||||
if (!agpdev || !handle)
|
||||
return EINVAL;
|
||||
|
||||
return agp_unbind_memory(agpdev, handle);
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
/* drm_auth.h -- IOCTLs for authentication -*- linux-c -*-
|
||||
* Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "dev/drm/drmP.h"
|
||||
|
||||
static int DRM(hash_magic)(drm_magic_t magic)
|
||||
{
|
||||
return magic & (DRM_HASH_SIZE-1);
|
||||
}
|
||||
|
||||
static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic)
|
||||
{
|
||||
drm_file_t *retval = NULL;
|
||||
drm_magic_entry_t *pt;
|
||||
int hash = DRM(hash_magic)(magic);
|
||||
|
||||
DRM_LOCK;
|
||||
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
|
||||
if (pt->magic == magic) {
|
||||
retval = pt->priv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||
{
|
||||
int hash;
|
||||
drm_magic_entry_t *entry;
|
||||
|
||||
DRM_DEBUG("%d\n", magic);
|
||||
|
||||
hash = DRM(hash_magic)(magic);
|
||||
entry = (drm_magic_entry_t*) DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC);
|
||||
if (!entry) return DRM_ERR(ENOMEM);
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
entry->magic = magic;
|
||||
entry->priv = priv;
|
||||
entry->next = NULL;
|
||||
|
||||
DRM_LOCK;
|
||||
if (dev->magiclist[hash].tail) {
|
||||
dev->magiclist[hash].tail->next = entry;
|
||||
dev->magiclist[hash].tail = entry;
|
||||
} else {
|
||||
dev->magiclist[hash].head = entry;
|
||||
dev->magiclist[hash].tail = entry;
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
|
||||
{
|
||||
drm_magic_entry_t *prev = NULL;
|
||||
drm_magic_entry_t *pt;
|
||||
int hash;
|
||||
|
||||
DRM_DEBUG("%d\n", magic);
|
||||
hash = DRM(hash_magic)(magic);
|
||||
|
||||
DRM_LOCK;
|
||||
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
|
||||
if (pt->magic == magic) {
|
||||
if (dev->magiclist[hash].head == pt) {
|
||||
dev->magiclist[hash].head = pt->next;
|
||||
}
|
||||
if (dev->magiclist[hash].tail == pt) {
|
||||
dev->magiclist[hash].tail = prev;
|
||||
}
|
||||
if (prev) {
|
||||
prev->next = pt->next;
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
|
||||
DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
int DRM(getmagic)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
static drm_magic_t sequence = 0;
|
||||
drm_auth_t auth;
|
||||
DRM_DEVICE;
|
||||
DRM_PRIV;
|
||||
|
||||
/* Find unique magic */
|
||||
if (priv->magic) {
|
||||
auth.magic = priv->magic;
|
||||
} else {
|
||||
do {
|
||||
int old = sequence;
|
||||
|
||||
auth.magic = old+1;
|
||||
|
||||
if (!atomic_cmpset_int(&sequence, old, auth.magic))
|
||||
continue;
|
||||
} while (DRM(find_file)(dev, auth.magic));
|
||||
priv->magic = auth.magic;
|
||||
DRM(add_magic)(dev, priv, auth.magic);
|
||||
}
|
||||
|
||||
DRM_DEBUG("%u\n", auth.magic);
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL((drm_auth_t *)data, auth, sizeof(auth));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(authmagic)(DRM_IOCTL_ARGS)
|
||||
{
|
||||
drm_auth_t auth;
|
||||
drm_file_t *file;
|
||||
DRM_DEVICE;
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(auth, (drm_auth_t *)data, sizeof(auth));
|
||||
|
||||
DRM_DEBUG("%u\n", auth.magic);
|
||||
if ((file = DRM(find_file)(dev, auth.magic))) {
|
||||
file->authenticated = 1;
|
||||
DRM(remove_magic)(dev, auth.magic);
|
||||
return 0;
|
||||
}
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/* drm_drawable.h -- IOCTLs for drawables -*- linux-c -*-
|
||||
* Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "dev/drm/drmP.h"
|
||||
|
||||
int DRM(adddraw)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
drm_draw_t draw;
|
||||
|
||||
draw.handle = 0; /* NOOP */
|
||||
DRM_DEBUG("%d\n", draw.handle);
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL( (drm_draw_t *)data, draw, sizeof(draw) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DRM(rmdraw)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
return 0; /* NOOP */
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/* sarea.h -- SAREA definitions -*- linux-c -*-
|
||||
*
|
||||
* Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Michel Dänzer <michel@daenzer.net>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _DRM_SAREA_H_
|
||||
#define _DRM_SAREA_H_
|
||||
|
||||
#define SAREA_MAX_DRAWABLES 256
|
||||
|
||||
typedef struct _drm_sarea_drawable_t {
|
||||
unsigned int stamp;
|
||||
unsigned int flags;
|
||||
} drm_sarea_drawable_t;
|
||||
|
||||
typedef struct _dri_sarea_frame_t {
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int fullscreen;
|
||||
} drm_sarea_frame_t;
|
||||
|
||||
typedef struct _drm_sarea_t {
|
||||
/* first thing is always the drm locking structure */
|
||||
drm_hw_lock_t lock;
|
||||
/* NOT_DONE: Use readers/writer lock for drawable_lock */
|
||||
drm_hw_lock_t drawable_lock;
|
||||
drm_sarea_drawable_t drawableTable[SAREA_MAX_DRAWABLES];
|
||||
drm_sarea_frame_t frame;
|
||||
drm_context_t dummy_context;
|
||||
} drm_sarea_t;
|
||||
|
||||
#endif /* _DRM_SAREA_H_ */
|
||||
@@ -1,151 +0,0 @@
|
||||
/* drm_scatter.h -- IOCTLs to manage scatter/gather memory -*- linux-c -*-
|
||||
* Created: Mon Dec 18 23:20:54 2000 by gareth@valinux.com
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "dev/drm/drmP.h"
|
||||
|
||||
#define DEBUG_SCATTER 0
|
||||
|
||||
#if __REALLY_HAVE_SG
|
||||
|
||||
void DRM(sg_cleanup)( drm_sg_mem_t *entry )
|
||||
{
|
||||
free( entry->virtual, DRM(M_DRM) );
|
||||
|
||||
DRM(free)( entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
DRM(free)( entry,
|
||||
sizeof(*entry),
|
||||
DRM_MEM_SGLISTS );
|
||||
}
|
||||
|
||||
int DRM(sg_alloc)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_scatter_gather_t request;
|
||||
drm_sg_mem_t *entry;
|
||||
unsigned long pages;
|
||||
|
||||
DRM_DEBUG( "%s\n", __FUNCTION__ );
|
||||
|
||||
if ( dev->sg )
|
||||
return EINVAL;
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(request, (drm_scatter_gather_t *)data,
|
||||
sizeof(request) );
|
||||
|
||||
entry = DRM(alloc)( sizeof(*entry), DRM_MEM_SGLISTS );
|
||||
if ( !entry )
|
||||
return ENOMEM;
|
||||
|
||||
bzero( entry, sizeof(*entry) );
|
||||
|
||||
pages = round_page(request.size) / PAGE_SIZE;
|
||||
DRM_DEBUG( "sg size=%ld pages=%ld\n", request.size, pages );
|
||||
|
||||
entry->pages = pages;
|
||||
|
||||
entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
if ( !entry->busaddr ) {
|
||||
DRM(free)( entry,
|
||||
sizeof(*entry),
|
||||
DRM_MEM_SGLISTS );
|
||||
return ENOMEM;
|
||||
}
|
||||
bzero( (void *)entry->busaddr, pages * sizeof(*entry->busaddr) );
|
||||
|
||||
entry->virtual = malloc( pages << PAGE_SHIFT, DRM(M_DRM), M_WAITOK );
|
||||
if ( !entry->virtual ) {
|
||||
DRM(free)( entry->busaddr,
|
||||
entry->pages * sizeof(*entry->busaddr),
|
||||
DRM_MEM_PAGES );
|
||||
DRM(free)( entry,
|
||||
sizeof(*entry),
|
||||
DRM_MEM_SGLISTS );
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
bzero( entry->virtual, pages << PAGE_SHIFT );
|
||||
|
||||
entry->handle = (unsigned long)entry->virtual;
|
||||
|
||||
DRM_DEBUG( "sg alloc handle = %08lx\n", entry->handle );
|
||||
DRM_DEBUG( "sg alloc virtual = %p\n", entry->virtual );
|
||||
|
||||
request.handle = entry->handle;
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL( (drm_scatter_gather_t *)data,
|
||||
request,
|
||||
sizeof(request) );
|
||||
|
||||
dev->sg = entry;
|
||||
|
||||
return 0;
|
||||
|
||||
DRM(sg_cleanup)( entry );
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
int DRM(sg_free)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_scatter_gather_t request;
|
||||
drm_sg_mem_t *entry;
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL( request, (drm_scatter_gather_t *)data,
|
||||
sizeof(request) );
|
||||
|
||||
entry = dev->sg;
|
||||
dev->sg = NULL;
|
||||
|
||||
if ( !entry || entry->handle != request.handle )
|
||||
return EINVAL;
|
||||
|
||||
DRM_DEBUG( "sg free virtual = %p\n", entry->virtual );
|
||||
|
||||
DRM(sg_cleanup)( entry );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* __REALLY_HAVE_SG */
|
||||
|
||||
int DRM(sg_alloc)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
int DRM(sg_free)( DRM_IOCTL_ARGS )
|
||||
{
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,100 +0,0 @@
|
||||
/* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*-
|
||||
* Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __MGA_H__
|
||||
#define __MGA_H__
|
||||
|
||||
/* This remains constant for all DRM template files.
|
||||
*/
|
||||
#define DRM(x) mga_##x
|
||||
|
||||
/* General customization:
|
||||
*/
|
||||
#define __HAVE_AGP 1
|
||||
#define __MUST_HAVE_AGP 1
|
||||
#define __HAVE_MTRR 1
|
||||
#define __HAVE_CTX_BITMAP 1
|
||||
|
||||
#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
|
||||
|
||||
#define DRIVER_NAME "mga"
|
||||
#define DRIVER_DESC "Matrox G200/G400"
|
||||
#define DRIVER_DATE "20021029"
|
||||
|
||||
#define DRIVER_MAJOR 3
|
||||
#define DRIVER_MINOR 1
|
||||
#define DRIVER_PATCHLEVEL 0
|
||||
|
||||
#define DRIVER_IOCTLS \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_MGA_GETPARAM)]= { mga_getparam, 1, 0 },
|
||||
|
||||
#define __HAVE_COUNTERS 3
|
||||
#define __HAVE_COUNTER6 _DRM_STAT_IRQ
|
||||
#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY
|
||||
#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
|
||||
|
||||
/* Driver customization:
|
||||
*/
|
||||
#define DRIVER_PRETAKEDOWN() do { \
|
||||
if ( dev->dev_private ) mga_do_cleanup_dma( dev ); \
|
||||
} while (0)
|
||||
|
||||
/* DMA customization:
|
||||
*/
|
||||
#define __HAVE_DMA 1
|
||||
#define __HAVE_DMA_IRQ 1
|
||||
#define __HAVE_VBL_IRQ 1
|
||||
#define __HAVE_SHARED_IRQ 1
|
||||
|
||||
#define __HAVE_DMA_QUIESCENT 1
|
||||
#define DRIVER_DMA_QUIESCENT() do { \
|
||||
drm_mga_private_t *dev_priv = dev->dev_private; \
|
||||
return mga_do_wait_for_idle( dev_priv ); \
|
||||
} while (0)
|
||||
|
||||
/* Buffer customization:
|
||||
*/
|
||||
#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t
|
||||
|
||||
#define DRIVER_AGP_BUFFERS_MAP( dev ) \
|
||||
((drm_mga_private_t *)((dev)->dev_private))->buffers
|
||||
|
||||
#endif
|
||||
@@ -1,338 +0,0 @@
|
||||
/* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*-
|
||||
* Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com
|
||||
*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Jeff Hartmann <jhartmann@valinux.com>
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
*
|
||||
* Rewritten by:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __MGA_DRM_H__
|
||||
#define __MGA_DRM_H__
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the Xserver file (mga_sarea.h)
|
||||
*/
|
||||
|
||||
#ifndef __MGA_SAREA_DEFINES__
|
||||
#define __MGA_SAREA_DEFINES__
|
||||
|
||||
/* WARP pipe flags
|
||||
*/
|
||||
#define MGA_F 0x1 /* fog */
|
||||
#define MGA_A 0x2 /* alpha */
|
||||
#define MGA_S 0x4 /* specular */
|
||||
#define MGA_T2 0x8 /* multitexture */
|
||||
|
||||
#define MGA_WARP_TGZ 0
|
||||
#define MGA_WARP_TGZF (MGA_F)
|
||||
#define MGA_WARP_TGZA (MGA_A)
|
||||
#define MGA_WARP_TGZAF (MGA_F|MGA_A)
|
||||
#define MGA_WARP_TGZS (MGA_S)
|
||||
#define MGA_WARP_TGZSF (MGA_S|MGA_F)
|
||||
#define MGA_WARP_TGZSA (MGA_S|MGA_A)
|
||||
#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A)
|
||||
#define MGA_WARP_T2GZ (MGA_T2)
|
||||
#define MGA_WARP_T2GZF (MGA_T2|MGA_F)
|
||||
#define MGA_WARP_T2GZA (MGA_T2|MGA_A)
|
||||
#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F)
|
||||
#define MGA_WARP_T2GZS (MGA_T2|MGA_S)
|
||||
#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F)
|
||||
#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A)
|
||||
#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A)
|
||||
|
||||
#define MGA_MAX_G200_PIPES 8 /* no multitex */
|
||||
#define MGA_MAX_G400_PIPES 16
|
||||
#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES
|
||||
#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */
|
||||
|
||||
#define MGA_CARD_TYPE_G200 1
|
||||
#define MGA_CARD_TYPE_G400 2
|
||||
|
||||
|
||||
#define MGA_FRONT 0x1
|
||||
#define MGA_BACK 0x2
|
||||
#define MGA_DEPTH 0x4
|
||||
|
||||
/* What needs to be changed for the current vertex dma buffer?
|
||||
*/
|
||||
#define MGA_UPLOAD_CONTEXT 0x1
|
||||
#define MGA_UPLOAD_TEX0 0x2
|
||||
#define MGA_UPLOAD_TEX1 0x4
|
||||
#define MGA_UPLOAD_PIPE 0x8
|
||||
#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */
|
||||
#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */
|
||||
#define MGA_UPLOAD_2D 0x40
|
||||
#define MGA_WAIT_AGE 0x80 /* handled client-side */
|
||||
#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */
|
||||
#if 0
|
||||
#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock
|
||||
quiescent */
|
||||
#endif
|
||||
|
||||
/* 32 buffers of 64k each, total 2 meg.
|
||||
*/
|
||||
#define MGA_BUFFER_SIZE (1 << 16)
|
||||
#define MGA_NUM_BUFFERS 128
|
||||
|
||||
/* Keep these small for testing.
|
||||
*/
|
||||
#define MGA_NR_SAREA_CLIPRECTS 8
|
||||
|
||||
/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
|
||||
* regions, subject to a minimum region size of (1<<16) == 64k.
|
||||
*
|
||||
* Clients may subdivide regions internally, but when sharing between
|
||||
* clients, the region size is the minimum granularity.
|
||||
*/
|
||||
|
||||
#define MGA_CARD_HEAP 0
|
||||
#define MGA_AGP_HEAP 1
|
||||
#define MGA_NR_TEX_HEAPS 2
|
||||
#define MGA_NR_TEX_REGIONS 16
|
||||
#define MGA_LOG_MIN_TEX_REGION_SIZE 16
|
||||
|
||||
#endif /* __MGA_SAREA_DEFINES__ */
|
||||
|
||||
|
||||
/* Setup registers for 3D context
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int dstorg;
|
||||
unsigned int maccess;
|
||||
unsigned int plnwt;
|
||||
unsigned int dwgctl;
|
||||
unsigned int alphactrl;
|
||||
unsigned int fogcolor;
|
||||
unsigned int wflag;
|
||||
unsigned int tdualstage0;
|
||||
unsigned int tdualstage1;
|
||||
unsigned int fcol;
|
||||
unsigned int stencil;
|
||||
unsigned int stencilctl;
|
||||
} drm_mga_context_regs_t;
|
||||
|
||||
/* Setup registers for 2D, X server
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int pitch;
|
||||
} drm_mga_server_regs_t;
|
||||
|
||||
/* Setup registers for each texture unit
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int texctl;
|
||||
unsigned int texctl2;
|
||||
unsigned int texfilter;
|
||||
unsigned int texbordercol;
|
||||
unsigned int texorg;
|
||||
unsigned int texwidth;
|
||||
unsigned int texheight;
|
||||
unsigned int texorg1;
|
||||
unsigned int texorg2;
|
||||
unsigned int texorg3;
|
||||
unsigned int texorg4;
|
||||
} drm_mga_texture_regs_t;
|
||||
|
||||
/* General aging mechanism
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int head; /* Position of head pointer */
|
||||
unsigned int wrap; /* Primary DMA wrap count */
|
||||
} drm_mga_age_t;
|
||||
|
||||
typedef struct _drm_mga_sarea {
|
||||
/* The channel for communication of state information to the kernel
|
||||
* on firing a vertex dma buffer.
|
||||
*/
|
||||
drm_mga_context_regs_t context_state;
|
||||
drm_mga_server_regs_t server_state;
|
||||
drm_mga_texture_regs_t tex_state[2];
|
||||
unsigned int warp_pipe;
|
||||
unsigned int dirty;
|
||||
unsigned int vertsize;
|
||||
|
||||
/* The current cliprects, or a subset thereof.
|
||||
*/
|
||||
drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS];
|
||||
unsigned int nbox;
|
||||
|
||||
/* Information about the most recently used 3d drawable. The
|
||||
* client fills in the req_* fields, the server fills in the
|
||||
* exported_ fields and puts the cliprects into boxes, above.
|
||||
*
|
||||
* The client clears the exported_drawable field before
|
||||
* clobbering the boxes data.
|
||||
*/
|
||||
unsigned int req_drawable; /* the X drawable id */
|
||||
unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */
|
||||
|
||||
unsigned int exported_drawable;
|
||||
unsigned int exported_index;
|
||||
unsigned int exported_stamp;
|
||||
unsigned int exported_buffers;
|
||||
unsigned int exported_nfront;
|
||||
unsigned int exported_nback;
|
||||
int exported_back_x, exported_front_x, exported_w;
|
||||
int exported_back_y, exported_front_y, exported_h;
|
||||
drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS];
|
||||
|
||||
/* Counters for aging textures and for client-side throttling.
|
||||
*/
|
||||
unsigned int status[4];
|
||||
unsigned int last_wrap;
|
||||
|
||||
drm_mga_age_t last_frame;
|
||||
unsigned int last_enqueue; /* last time a buffer was enqueued */
|
||||
unsigned int last_dispatch; /* age of the most recently dispatched buffer */
|
||||
unsigned int last_quiescent; /* */
|
||||
|
||||
/* LRU lists for texture memory in agp space and on the card.
|
||||
*/
|
||||
drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1];
|
||||
unsigned int texAge[MGA_NR_TEX_HEAPS];
|
||||
|
||||
/* Mechanism to validate card state.
|
||||
*/
|
||||
int ctxOwner;
|
||||
} drm_mga_sarea_t;
|
||||
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the Xserver file (xf86drmMga.h)
|
||||
*/
|
||||
|
||||
/* MGA specific ioctls
|
||||
* The device specific ioctl range is 0x40 to 0x79.
|
||||
*/
|
||||
#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t)
|
||||
#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t)
|
||||
#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42)
|
||||
#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43)
|
||||
#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t)
|
||||
#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t)
|
||||
#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t)
|
||||
#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t)
|
||||
#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t)
|
||||
#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(0x49, drm_mga_getparam_t)
|
||||
|
||||
typedef struct _drm_mga_warp_index {
|
||||
int installed;
|
||||
unsigned long phys_addr;
|
||||
int size;
|
||||
} drm_mga_warp_index_t;
|
||||
|
||||
typedef struct drm_mga_init {
|
||||
enum {
|
||||
MGA_INIT_DMA = 0x01,
|
||||
MGA_CLEANUP_DMA = 0x02
|
||||
} func;
|
||||
|
||||
unsigned long sarea_priv_offset;
|
||||
|
||||
int chipset;
|
||||
int sgram;
|
||||
|
||||
unsigned int maccess;
|
||||
|
||||
unsigned int fb_cpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
|
||||
unsigned int depth_cpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
|
||||
unsigned int texture_offset[MGA_NR_TEX_HEAPS];
|
||||
unsigned int texture_size[MGA_NR_TEX_HEAPS];
|
||||
|
||||
unsigned long fb_offset;
|
||||
unsigned long mmio_offset;
|
||||
unsigned long status_offset;
|
||||
unsigned long warp_offset;
|
||||
unsigned long primary_offset;
|
||||
unsigned long buffers_offset;
|
||||
} drm_mga_init_t;
|
||||
|
||||
typedef struct drm_mga_fullscreen {
|
||||
enum {
|
||||
MGA_INIT_FULLSCREEN = 0x01,
|
||||
MGA_CLEANUP_FULLSCREEN = 0x02
|
||||
} func;
|
||||
} drm_mga_fullscreen_t;
|
||||
|
||||
typedef struct drm_mga_clear {
|
||||
unsigned int flags;
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_depth;
|
||||
unsigned int color_mask;
|
||||
unsigned int depth_mask;
|
||||
} drm_mga_clear_t;
|
||||
|
||||
typedef struct drm_mga_vertex {
|
||||
int idx; /* buffer to queue */
|
||||
int used; /* bytes in use */
|
||||
int discard; /* client finished with buffer? */
|
||||
} drm_mga_vertex_t;
|
||||
|
||||
typedef struct drm_mga_indices {
|
||||
int idx; /* buffer to queue */
|
||||
unsigned int start;
|
||||
unsigned int end;
|
||||
int discard; /* client finished with buffer? */
|
||||
} drm_mga_indices_t;
|
||||
|
||||
typedef struct drm_mga_iload {
|
||||
int idx;
|
||||
unsigned int dstorg;
|
||||
unsigned int length;
|
||||
} drm_mga_iload_t;
|
||||
|
||||
typedef struct _drm_mga_blit {
|
||||
unsigned int planemask;
|
||||
unsigned int srcorg;
|
||||
unsigned int dstorg;
|
||||
int src_pitch, dst_pitch;
|
||||
int delta_sx, delta_sy;
|
||||
int delta_dx, delta_dy;
|
||||
int height, ydir; /* flip image vertically */
|
||||
int source_pitch, dest_pitch;
|
||||
} drm_mga_blit_t;
|
||||
|
||||
/* 3.1: An ioctl to get parameters that aren't available to the 3d
|
||||
* client any other way.
|
||||
*/
|
||||
#define MGA_PARAM_IRQ_NR 1
|
||||
|
||||
typedef struct drm_mga_getparam {
|
||||
int param;
|
||||
int *value;
|
||||
} drm_mga_getparam_t;
|
||||
|
||||
#endif
|
||||
@@ -1,102 +0,0 @@
|
||||
/* mga_irq.c -- IRQ handling for radeon -*- linux-c -*-
|
||||
*
|
||||
* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
|
||||
*
|
||||
* The Weather Channel (TM) funded Tungsten Graphics to develop the
|
||||
* initial release of the Radeon 8500 driver under the XFree86 license.
|
||||
* This notice must be preserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Eric Anholt <anholt@FreeBSD.org>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "dev/drm/mga.h"
|
||||
#include "dev/drm/drmP.h"
|
||||
#include "dev/drm/drm.h"
|
||||
#include "dev/drm/mga_drm.h"
|
||||
#include "dev/drm/mga_drv.h"
|
||||
|
||||
void mga_dma_service( DRM_IRQ_ARGS )
|
||||
{
|
||||
drm_device_t *dev = (drm_device_t *) arg;
|
||||
drm_mga_private_t *dev_priv =
|
||||
(drm_mga_private_t *)dev->dev_private;
|
||||
int status;
|
||||
|
||||
status = MGA_READ( MGA_STATUS );
|
||||
|
||||
/* VBLANK interrupt */
|
||||
if ( status & MGA_VLINEPEN ) {
|
||||
MGA_WRITE( MGA_ICLEAR, MGA_VLINEICLR );
|
||||
atomic_inc(&dev->vbl_received);
|
||||
DRM_WAKEUP(&dev->vbl_queue);
|
||||
DRM(vbl_send_signals)( dev );
|
||||
}
|
||||
}
|
||||
|
||||
int mga_vblank_wait(drm_device_t *dev, unsigned int *sequence)
|
||||
{
|
||||
unsigned int cur_vblank;
|
||||
int ret = 0;
|
||||
|
||||
/* Assume that the user has missed the current sequence number
|
||||
* by about a day rather than she wants to wait for years
|
||||
* using vertical blanks...
|
||||
*/
|
||||
DRM_WAIT_ON( ret, dev->vbl_queue, 3*DRM_HZ,
|
||||
( ( ( cur_vblank = atomic_read(&dev->vbl_received ) )
|
||||
- *sequence ) <= (1<<23) ) );
|
||||
|
||||
*sequence = cur_vblank;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void mga_driver_irq_preinstall( drm_device_t *dev ) {
|
||||
drm_mga_private_t *dev_priv =
|
||||
(drm_mga_private_t *)dev->dev_private;
|
||||
|
||||
/* Disable *all* interrupts */
|
||||
MGA_WRITE( MGA_IEN, 0 );
|
||||
/* Clear bits if they're already high */
|
||||
MGA_WRITE( MGA_ICLEAR, ~0 );
|
||||
}
|
||||
|
||||
void mga_driver_irq_postinstall( drm_device_t *dev ) {
|
||||
drm_mga_private_t *dev_priv =
|
||||
(drm_mga_private_t *)dev->dev_private;
|
||||
|
||||
/* Turn on VBL interrupt */
|
||||
MGA_WRITE( MGA_IEN, MGA_VLINEIEN );
|
||||
}
|
||||
|
||||
void mga_driver_irq_uninstall( drm_device_t *dev ) {
|
||||
drm_mga_private_t *dev_priv =
|
||||
(drm_mga_private_t *)dev->dev_private;
|
||||
if ( dev_priv ) {
|
||||
/* Disable *all* interrupts */
|
||||
MGA_WRITE( MGA_IEN, 0 );
|
||||
}
|
||||
}
|
||||
-11647
File diff suppressed because it is too large.
Load diff
@@ -1,214 +0,0 @@
|
||||
/* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*-
|
||||
* Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define __NO_VERSION__
|
||||
#include "dev/drm/mga.h"
|
||||
#include "dev/drm/drmP.h"
|
||||
#include "dev/drm/drm.h"
|
||||
#include "dev/drm/mga_drm.h"
|
||||
#include "dev/drm/mga_drv.h"
|
||||
#include "dev/drm/mga_ucode.h"
|
||||
|
||||
|
||||
#define MGA_WARP_CODE_ALIGN 256 /* in bytes */
|
||||
|
||||
#define WARP_UCODE_SIZE( which ) \
|
||||
((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN)
|
||||
|
||||
#define WARP_UCODE_INSTALL( which, where ) \
|
||||
do { \
|
||||
DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\
|
||||
dev_priv->warp_pipe_phys[where] = pcbase; \
|
||||
memcpy( vcbase, which, sizeof(which) ); \
|
||||
pcbase += WARP_UCODE_SIZE( which ); \
|
||||
vcbase += WARP_UCODE_SIZE( which ); \
|
||||
} while (0)
|
||||
|
||||
|
||||
static unsigned int mga_warp_g400_microcode_size( drm_mga_private_t *dev_priv )
|
||||
{
|
||||
unsigned int size;
|
||||
|
||||
size = ( WARP_UCODE_SIZE( warp_g400_tgz ) +
|
||||
WARP_UCODE_SIZE( warp_g400_tgza ) +
|
||||
WARP_UCODE_SIZE( warp_g400_tgzaf ) +
|
||||
WARP_UCODE_SIZE( warp_g400_tgzf ) +
|
||||
WARP_UCODE_SIZE( warp_g400_tgzs ) +
|
||||
WARP_UCODE_SIZE( warp_g400_tgzsa ) +
|
||||
WARP_UCODE_SIZE( warp_g400_tgzsaf ) +
|
||||
WARP_UCODE_SIZE( warp_g400_tgzsf ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gz ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gza ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gzaf ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gzf ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gzs ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gzsa ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gzsaf ) +
|
||||
WARP_UCODE_SIZE( warp_g400_t2gzsf ) );
|
||||
|
||||
size = PAGE_ALIGN( size );
|
||||
|
||||
DRM_DEBUG( "G400 ucode size = %d bytes\n", size );
|
||||
return size;
|
||||
}
|
||||
|
||||
static unsigned int mga_warp_g200_microcode_size( drm_mga_private_t *dev_priv )
|
||||
{
|
||||
unsigned int size;
|
||||
|
||||
size = ( WARP_UCODE_SIZE( warp_g200_tgz ) +
|
||||
WARP_UCODE_SIZE( warp_g200_tgza ) +
|
||||
WARP_UCODE_SIZE( warp_g200_tgzaf ) +
|
||||
WARP_UCODE_SIZE( warp_g200_tgzf ) +
|
||||
WARP_UCODE_SIZE( warp_g200_tgzs ) +
|
||||
WARP_UCODE_SIZE( warp_g200_tgzsa ) +
|
||||
WARP_UCODE_SIZE( warp_g200_tgzsaf ) +
|
||||
WARP_UCODE_SIZE( warp_g200_tgzsf ) );
|
||||
|
||||
size = PAGE_ALIGN( size );
|
||||
|
||||
DRM_DEBUG( "G200 ucode size = %d bytes\n", size );
|
||||
return size;
|
||||
}
|
||||
|
||||
static int mga_warp_install_g400_microcode( drm_mga_private_t *dev_priv )
|
||||
{
|
||||
unsigned char *vcbase = dev_priv->warp->handle;
|
||||
unsigned long pcbase = dev_priv->warp->offset;
|
||||
unsigned int size;
|
||||
|
||||
size = mga_warp_g400_microcode_size( dev_priv );
|
||||
if ( size > dev_priv->warp->size ) {
|
||||
DRM_ERROR( "microcode too large! (%u > %lu)\n",
|
||||
size, dev_priv->warp->size );
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
memset( dev_priv->warp_pipe_phys, 0,
|
||||
sizeof(dev_priv->warp_pipe_phys) );
|
||||
|
||||
WARP_UCODE_INSTALL( warp_g400_tgz, MGA_WARP_TGZ );
|
||||
WARP_UCODE_INSTALL( warp_g400_tgzf, MGA_WARP_TGZF );
|
||||
WARP_UCODE_INSTALL( warp_g400_tgza, MGA_WARP_TGZA );
|
||||
WARP_UCODE_INSTALL( warp_g400_tgzaf, MGA_WARP_TGZAF );
|
||||
WARP_UCODE_INSTALL( warp_g400_tgzs, MGA_WARP_TGZS );
|
||||
WARP_UCODE_INSTALL( warp_g400_tgzsf, MGA_WARP_TGZSF );
|
||||
WARP_UCODE_INSTALL( warp_g400_tgzsa, MGA_WARP_TGZSA );
|
||||
WARP_UCODE_INSTALL( warp_g400_tgzsaf, MGA_WARP_TGZSAF );
|
||||
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gz, MGA_WARP_T2GZ );
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gzf, MGA_WARP_T2GZF );
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gza, MGA_WARP_T2GZA );
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gzaf, MGA_WARP_T2GZAF );
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gzs, MGA_WARP_T2GZS );
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gzsf, MGA_WARP_T2GZSF );
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gzsa, MGA_WARP_T2GZSA );
|
||||
WARP_UCODE_INSTALL( warp_g400_t2gzsaf, MGA_WARP_T2GZSAF );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv )
|
||||
{
|
||||
unsigned char *vcbase = dev_priv->warp->handle;
|
||||
unsigned long pcbase = dev_priv->warp->offset;
|
||||
unsigned int size;
|
||||
|
||||
size = mga_warp_g200_microcode_size( dev_priv );
|
||||
if ( size > dev_priv->warp->size ) {
|
||||
DRM_ERROR( "microcode too large! (%u > %lu)\n",
|
||||
size, dev_priv->warp->size );
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
memset( dev_priv->warp_pipe_phys, 0,
|
||||
sizeof(dev_priv->warp_pipe_phys) );
|
||||
|
||||
WARP_UCODE_INSTALL( warp_g200_tgz, MGA_WARP_TGZ );
|
||||
WARP_UCODE_INSTALL( warp_g200_tgzf, MGA_WARP_TGZF );
|
||||
WARP_UCODE_INSTALL( warp_g200_tgza, MGA_WARP_TGZA );
|
||||
WARP_UCODE_INSTALL( warp_g200_tgzaf, MGA_WARP_TGZAF );
|
||||
WARP_UCODE_INSTALL( warp_g200_tgzs, MGA_WARP_TGZS );
|
||||
WARP_UCODE_INSTALL( warp_g200_tgzsf, MGA_WARP_TGZSF );
|
||||
WARP_UCODE_INSTALL( warp_g200_tgzsa, MGA_WARP_TGZSA );
|
||||
WARP_UCODE_INSTALL( warp_g200_tgzsaf, MGA_WARP_TGZSAF );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mga_warp_install_microcode( drm_mga_private_t *dev_priv )
|
||||
{
|
||||
switch ( dev_priv->chipset ) {
|
||||
case MGA_CARD_TYPE_G400:
|
||||
return mga_warp_install_g400_microcode( dev_priv );
|
||||
case MGA_CARD_TYPE_G200:
|
||||
return mga_warp_install_g200_microcode( dev_priv );
|
||||
default:
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE)
|
||||
|
||||
int mga_warp_init( drm_mga_private_t *dev_priv )
|
||||
{
|
||||
u32 wmisc;
|
||||
|
||||
/* FIXME: Get rid of these damned magic numbers...
|
||||
*/
|
||||
switch ( dev_priv->chipset ) {
|
||||
case MGA_CARD_TYPE_G400:
|
||||
MGA_WRITE( MGA_WIADDR2, MGA_WMODE_SUSPEND );
|
||||
MGA_WRITE( MGA_WGETMSB, 0x00000E00 );
|
||||
MGA_WRITE( MGA_WVRTXSZ, 0x00001807 );
|
||||
MGA_WRITE( MGA_WACCEPTSEQ, 0x18000000 );
|
||||
break;
|
||||
case MGA_CARD_TYPE_G200:
|
||||
MGA_WRITE( MGA_WIADDR, MGA_WMODE_SUSPEND );
|
||||
MGA_WRITE( MGA_WGETMSB, 0x1606 );
|
||||
MGA_WRITE( MGA_WVRTXSZ, 7 );
|
||||
break;
|
||||
default:
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE |
|
||||
MGA_WMASTER_ENABLE |
|
||||
MGA_WCACHEFLUSH_ENABLE) );
|
||||
wmisc = MGA_READ( MGA_WMISC );
|
||||
if ( wmisc != WMISC_EXPECTED ) {
|
||||
DRM_ERROR( "WARP engine config failed! 0x%x != 0x%x\n",
|
||||
wmisc, WMISC_EXPECTED );
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*-
|
||||
* Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __R128_H__
|
||||
#define __R128_H__
|
||||
|
||||
/* This remains constant for all DRM template files.
|
||||
*/
|
||||
#define DRM(x) r128_##x
|
||||
|
||||
/* General customization:
|
||||
*/
|
||||
#define __HAVE_AGP 1
|
||||
#define __MUST_HAVE_AGP 0
|
||||
#define __HAVE_MTRR 1
|
||||
#define __HAVE_CTX_BITMAP 1
|
||||
#define __HAVE_SG 1
|
||||
#define __HAVE_PCI_DMA 1
|
||||
|
||||
#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
|
||||
|
||||
#define DRIVER_NAME "r128"
|
||||
#define DRIVER_DESC "ATI Rage 128"
|
||||
#define DRIVER_DATE "20021029"
|
||||
|
||||
#define DRIVER_MAJOR 2
|
||||
#define DRIVER_MINOR 3
|
||||
#define DRIVER_PATCHLEVEL 0
|
||||
|
||||
|
||||
#define DRIVER_IOCTLS \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, \
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_R128_GETPARAM)] = { r128_getparam, 1, 0 },
|
||||
|
||||
/* Driver customization:
|
||||
*/
|
||||
#define DRIVER_PRERELEASE() do { \
|
||||
if ( dev->dev_private ) { \
|
||||
drm_r128_private_t *dev_priv = dev->dev_private; \
|
||||
if ( dev_priv->page_flipping ) { \
|
||||
r128_do_cleanup_pageflip( dev ); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DRIVER_PRETAKEDOWN() do { \
|
||||
if ( dev->dev_private ) r128_do_cleanup_cce( dev ); \
|
||||
} while (0)
|
||||
|
||||
/* DMA customization:
|
||||
*/
|
||||
#define __HAVE_DMA 1
|
||||
#define __HAVE_DMA_IRQ 1
|
||||
#define __HAVE_VBL_IRQ 1
|
||||
#define __HAVE_SHARED_IRQ 1
|
||||
|
||||
#if 0
|
||||
/* GH: Remove this for now... */
|
||||
#define __HAVE_DMA_QUIESCENT 1
|
||||
#define DRIVER_DMA_QUIESCENT() do { \
|
||||
drm_r128_private_t *dev_priv = dev->dev_private; \
|
||||
return r128_do_cce_idle( dev_priv ); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/* Buffer customization:
|
||||
*/
|
||||
#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t
|
||||
|
||||
#define DRIVER_AGP_BUFFERS_MAP( dev ) \
|
||||
((drm_r128_private_t *)((dev)->dev_private))->buffers
|
||||
|
||||
#endif
|
||||
@@ -1,321 +0,0 @@
|
||||
/* r128_drm.h -- Public header for the r128 driver -*- linux-c -*-
|
||||
* Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com
|
||||
*
|
||||
* Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __R128_DRM_H__
|
||||
#define __R128_DRM_H__
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the X server file (r128_sarea.h)
|
||||
*/
|
||||
#ifndef __R128_SAREA_DEFINES__
|
||||
#define __R128_SAREA_DEFINES__
|
||||
|
||||
/* What needs to be changed for the current vertex buffer?
|
||||
*/
|
||||
#define R128_UPLOAD_CONTEXT 0x001
|
||||
#define R128_UPLOAD_SETUP 0x002
|
||||
#define R128_UPLOAD_TEX0 0x004
|
||||
#define R128_UPLOAD_TEX1 0x008
|
||||
#define R128_UPLOAD_TEX0IMAGES 0x010
|
||||
#define R128_UPLOAD_TEX1IMAGES 0x020
|
||||
#define R128_UPLOAD_CORE 0x040
|
||||
#define R128_UPLOAD_MASKS 0x080
|
||||
#define R128_UPLOAD_WINDOW 0x100
|
||||
#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */
|
||||
#define R128_REQUIRE_QUIESCENCE 0x400
|
||||
#define R128_UPLOAD_ALL 0x7ff
|
||||
|
||||
#define R128_FRONT 0x1
|
||||
#define R128_BACK 0x2
|
||||
#define R128_DEPTH 0x4
|
||||
|
||||
/* Primitive types
|
||||
*/
|
||||
#define R128_POINTS 0x1
|
||||
#define R128_LINES 0x2
|
||||
#define R128_LINE_STRIP 0x3
|
||||
#define R128_TRIANGLES 0x4
|
||||
#define R128_TRIANGLE_FAN 0x5
|
||||
#define R128_TRIANGLE_STRIP 0x6
|
||||
|
||||
/* Vertex/indirect buffer size
|
||||
*/
|
||||
#define R128_BUFFER_SIZE 16384
|
||||
|
||||
/* Byte offsets for indirect buffer data
|
||||
*/
|
||||
#define R128_INDEX_PRIM_OFFSET 20
|
||||
#define R128_HOSTDATA_BLIT_OFFSET 32
|
||||
|
||||
/* Keep these small for testing.
|
||||
*/
|
||||
#define R128_NR_SAREA_CLIPRECTS 12
|
||||
|
||||
/* There are 2 heaps (local/AGP). Each region within a heap is a
|
||||
* minimum of 64k, and there are at most 64 of them per heap.
|
||||
*/
|
||||
#define R128_LOCAL_TEX_HEAP 0
|
||||
#define R128_AGP_TEX_HEAP 1
|
||||
#define R128_NR_TEX_HEAPS 2
|
||||
#define R128_NR_TEX_REGIONS 64
|
||||
#define R128_LOG_TEX_GRANULARITY 16
|
||||
|
||||
#define R128_NR_CONTEXT_REGS 12
|
||||
|
||||
#define R128_MAX_TEXTURE_LEVELS 11
|
||||
#define R128_MAX_TEXTURE_UNITS 2
|
||||
|
||||
#endif /* __R128_SAREA_DEFINES__ */
|
||||
|
||||
typedef struct {
|
||||
/* Context state - can be written in one large chunk */
|
||||
unsigned int dst_pitch_offset_c;
|
||||
unsigned int dp_gui_master_cntl_c;
|
||||
unsigned int sc_top_left_c;
|
||||
unsigned int sc_bottom_right_c;
|
||||
unsigned int z_offset_c;
|
||||
unsigned int z_pitch_c;
|
||||
unsigned int z_sten_cntl_c;
|
||||
unsigned int tex_cntl_c;
|
||||
unsigned int misc_3d_state_cntl_reg;
|
||||
unsigned int texture_clr_cmp_clr_c;
|
||||
unsigned int texture_clr_cmp_msk_c;
|
||||
unsigned int fog_color_c;
|
||||
|
||||
/* Texture state */
|
||||
unsigned int tex_size_pitch_c;
|
||||
unsigned int constant_color_c;
|
||||
|
||||
/* Setup state */
|
||||
unsigned int pm4_vc_fpu_setup;
|
||||
unsigned int setup_cntl;
|
||||
|
||||
/* Mask state */
|
||||
unsigned int dp_write_mask;
|
||||
unsigned int sten_ref_mask_c;
|
||||
unsigned int plane_3d_mask_c;
|
||||
|
||||
/* Window state */
|
||||
unsigned int window_xy_offset;
|
||||
|
||||
/* Core state */
|
||||
unsigned int scale_3d_cntl;
|
||||
} drm_r128_context_regs_t;
|
||||
|
||||
/* Setup registers for each texture unit
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int tex_cntl;
|
||||
unsigned int tex_combine_cntl;
|
||||
unsigned int tex_size_pitch;
|
||||
unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS];
|
||||
unsigned int tex_border_color;
|
||||
} drm_r128_texture_regs_t;
|
||||
|
||||
|
||||
typedef struct drm_r128_sarea {
|
||||
/* The channel for communication of state information to the kernel
|
||||
* on firing a vertex buffer.
|
||||
*/
|
||||
drm_r128_context_regs_t context_state;
|
||||
drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS];
|
||||
unsigned int dirty;
|
||||
unsigned int vertsize;
|
||||
unsigned int vc_format;
|
||||
|
||||
/* The current cliprects, or a subset thereof.
|
||||
*/
|
||||
drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS];
|
||||
unsigned int nbox;
|
||||
|
||||
/* Counters for client-side throttling of rendering clients.
|
||||
*/
|
||||
unsigned int last_frame;
|
||||
unsigned int last_dispatch;
|
||||
|
||||
drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1];
|
||||
int tex_age[R128_NR_TEX_HEAPS];
|
||||
int ctx_owner;
|
||||
} drm_r128_sarea_t;
|
||||
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the Xserver file (xf86drmR128.h)
|
||||
*/
|
||||
|
||||
/* Rage 128 specific ioctls
|
||||
* The device specific ioctl range is 0x40 to 0x79.
|
||||
*/
|
||||
#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t)
|
||||
#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41)
|
||||
#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t)
|
||||
#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43)
|
||||
#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44)
|
||||
#define DRM_IOCTL_R128_RESET DRM_IO( 0x46)
|
||||
#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47)
|
||||
#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t)
|
||||
#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t)
|
||||
#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t)
|
||||
#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t)
|
||||
#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t)
|
||||
#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t)
|
||||
#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t)
|
||||
#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t)
|
||||
#define DRM_IOCTL_R128_CLEAR2 DRM_IOW( 0x51, drm_r128_clear2_t)
|
||||
#define DRM_IOCTL_R128_GETPARAM DRM_IOW( 0x52, drm_r128_getparam_t)
|
||||
|
||||
typedef struct drm_r128_init {
|
||||
enum {
|
||||
R128_INIT_CCE = 0x01,
|
||||
R128_CLEANUP_CCE = 0x02
|
||||
} func;
|
||||
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
|
||||
int sarea_priv_offset;
|
||||
#else
|
||||
unsigned long sarea_priv_offset;
|
||||
#endif
|
||||
int is_pci;
|
||||
int cce_mode;
|
||||
int cce_secure;
|
||||
int ring_size;
|
||||
int usec_timeout;
|
||||
|
||||
unsigned int fb_bpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_bpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
unsigned int span_offset;
|
||||
|
||||
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
|
||||
unsigned int fb_offset;
|
||||
unsigned int mmio_offset;
|
||||
unsigned int ring_offset;
|
||||
unsigned int ring_rptr_offset;
|
||||
unsigned int buffers_offset;
|
||||
unsigned int agp_textures_offset;
|
||||
#else
|
||||
unsigned long fb_offset;
|
||||
unsigned long mmio_offset;
|
||||
unsigned long ring_offset;
|
||||
unsigned long ring_rptr_offset;
|
||||
unsigned long buffers_offset;
|
||||
unsigned long agp_textures_offset;
|
||||
#endif
|
||||
} drm_r128_init_t;
|
||||
|
||||
typedef struct drm_r128_cce_stop {
|
||||
int flush;
|
||||
int idle;
|
||||
} drm_r128_cce_stop_t;
|
||||
|
||||
typedef struct drm_r128_clear {
|
||||
unsigned int flags;
|
||||
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
|
||||
int x, y, w, h;
|
||||
#endif
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_depth;
|
||||
#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
|
||||
unsigned int color_mask;
|
||||
unsigned int depth_mask;
|
||||
#endif
|
||||
} drm_r128_clear_t;
|
||||
|
||||
typedef struct drm_r128_vertex {
|
||||
int prim;
|
||||
int idx; /* Index of vertex buffer */
|
||||
int count; /* Number of vertices in buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
} drm_r128_vertex_t;
|
||||
|
||||
typedef struct drm_r128_indices {
|
||||
int prim;
|
||||
int idx;
|
||||
int start;
|
||||
int end;
|
||||
int discard; /* Client finished with buffer? */
|
||||
} drm_r128_indices_t;
|
||||
|
||||
typedef struct drm_r128_blit {
|
||||
int idx;
|
||||
int pitch;
|
||||
int offset;
|
||||
int format;
|
||||
unsigned short x, y;
|
||||
unsigned short width, height;
|
||||
} drm_r128_blit_t;
|
||||
|
||||
typedef struct drm_r128_depth {
|
||||
enum {
|
||||
R128_WRITE_SPAN = 0x01,
|
||||
R128_WRITE_PIXELS = 0x02,
|
||||
R128_READ_SPAN = 0x03,
|
||||
R128_READ_PIXELS = 0x04
|
||||
} func;
|
||||
int n;
|
||||
int *x;
|
||||
int *y;
|
||||
unsigned int *buffer;
|
||||
unsigned char *mask;
|
||||
} drm_r128_depth_t;
|
||||
|
||||
typedef struct drm_r128_stipple {
|
||||
unsigned int *mask;
|
||||
} drm_r128_stipple_t;
|
||||
|
||||
typedef struct drm_r128_indirect {
|
||||
int idx;
|
||||
int start;
|
||||
int end;
|
||||
int discard;
|
||||
} drm_r128_indirect_t;
|
||||
|
||||
typedef struct drm_r128_fullscreen {
|
||||
enum {
|
||||
R128_INIT_FULLSCREEN = 0x01,
|
||||
R128_CLEANUP_FULLSCREEN = 0x02
|
||||
} func;
|
||||
} drm_r128_fullscreen_t;
|
||||
|
||||
/* 2.3: An ioctl to get parameters that aren't available to the 3d
|
||||
* client any other way.
|
||||
*/
|
||||
#define R128_PARAM_IRQ_NR 1
|
||||
|
||||
typedef struct drm_r128_getparam {
|
||||
int param;
|
||||
int *value;
|
||||
} drm_r128_getparam_t;
|
||||
|
||||
#endif
|
||||
@@ -1,102 +0,0 @@
|
||||
/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*-
|
||||
*
|
||||
* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
|
||||
*
|
||||
* The Weather Channel (TM) funded Tungsten Graphics to develop the
|
||||
* initial release of the Radeon 8500 driver under the XFree86 license.
|
||||
* This notice must be preserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Eric Anholt <anholt@FreeBSD.org>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "dev/drm/r128.h"
|
||||
#include "dev/drm/drmP.h"
|
||||
#include "dev/drm/drm.h"
|
||||
#include "dev/drm/r128_drm.h"
|
||||
#include "dev/drm/r128_drv.h"
|
||||
|
||||
void r128_dma_service( DRM_IRQ_ARGS )
|
||||
{
|
||||
drm_device_t *dev = (drm_device_t *) arg;
|
||||
drm_r128_private_t *dev_priv =
|
||||
(drm_r128_private_t *)dev->dev_private;
|
||||
int status;
|
||||
|
||||
status = R128_READ( R128_GEN_INT_STATUS );
|
||||
|
||||
/* VBLANK interrupt */
|
||||
if ( status & R128_CRTC_VBLANK_INT ) {
|
||||
R128_WRITE( R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK );
|
||||
atomic_inc(&dev->vbl_received);
|
||||
DRM_WAKEUP(&dev->vbl_queue);
|
||||
DRM(vbl_send_signals)( dev );
|
||||
}
|
||||
}
|
||||
|
||||
int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence)
|
||||
{
|
||||
unsigned int cur_vblank;
|
||||
int ret = 0;
|
||||
|
||||
/* Assume that the user has missed the current sequence number
|
||||
* by about a day rather than she wants to wait for years
|
||||
* using vertical blanks...
|
||||
*/
|
||||
DRM_WAIT_ON( ret, dev->vbl_queue, 3*DRM_HZ,
|
||||
( ( ( cur_vblank = atomic_read(&dev->vbl_received ) )
|
||||
- *sequence ) <= (1<<23) ) );
|
||||
|
||||
*sequence = cur_vblank;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void r128_driver_irq_preinstall( drm_device_t *dev ) {
|
||||
drm_r128_private_t *dev_priv =
|
||||
(drm_r128_private_t *)dev->dev_private;
|
||||
|
||||
/* Disable *all* interrupts */
|
||||
R128_WRITE( R128_GEN_INT_CNTL, 0 );
|
||||
/* Clear vblank bit if it's already high */
|
||||
R128_WRITE( R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK );
|
||||
}
|
||||
|
||||
void r128_driver_irq_postinstall( drm_device_t *dev ) {
|
||||
drm_r128_private_t *dev_priv =
|
||||
(drm_r128_private_t *)dev->dev_private;
|
||||
|
||||
/* Turn on VBL interrupt */
|
||||
R128_WRITE( R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN );
|
||||
}
|
||||
|
||||
void r128_driver_irq_uninstall( drm_device_t *dev ) {
|
||||
drm_r128_private_t *dev_priv =
|
||||
(drm_r128_private_t *)dev->dev_private;
|
||||
if ( dev_priv ) {
|
||||
/* Disable *all* interrupts */
|
||||
R128_WRITE( R128_GEN_INT_CNTL, 0 );
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*-
|
||||
* Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __TDFX_H__
|
||||
#define __TDFX_H__
|
||||
|
||||
/* This remains constant for all DRM template files.
|
||||
*/
|
||||
#define DRM(x) tdfx_##x
|
||||
|
||||
/* General customization:
|
||||
*/
|
||||
#define __HAVE_MTRR 1
|
||||
#define __HAVE_CTX_BITMAP 1
|
||||
|
||||
#endif
|
||||
@@ -155,10 +155,13 @@ fwohci_pci_init(device_t self)
|
||||
|
||||
cmd = pci_read_config(self, PCIR_COMMAND, 2);
|
||||
cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN;
|
||||
#if 1
|
||||
cmd &= ~PCIM_CMD_MWRICEN;
|
||||
#endif
|
||||
pci_write_config(self, PCIR_COMMAND, cmd, 2);
|
||||
|
||||
latency = pci_read_config(self, PCIR_LATTIMER, 1);
|
||||
#define DEF_LATENCY 250 /* Derived from Max Bulk Transfer size 512 Bytes*/
|
||||
#define DEF_LATENCY 0x20
|
||||
if( latency < DEF_LATENCY ) {
|
||||
latency = DEF_LATENCY;
|
||||
device_printf(self, "PCI bus latency was changing to");
|
||||
|
||||
@@ -825,6 +825,7 @@ ieattach(struct isa_device *dvp)
|
||||
ifp->if_type = IFT_ETHER;
|
||||
ifp->if_addrlen = 6;
|
||||
ifp->if_hdrlen = 14;
|
||||
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
|
||||
|
||||
if (ie->hard_type == IE_EE16)
|
||||
EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000,2001 Jonathan Chen.
|
||||
* 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,
|
||||
* without modification, immediately at the beginning of the file.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Register definitions for TDK 78Q2120
|
||||
*/
|
||||
|
||||
#ifndef _DEV_MII_TDKPHYREG_H_
|
||||
#define _DEV_MII_TDKPHYREG_H_
|
||||
|
||||
#define MII_VENDOR 16
|
||||
#define VENDOR_RXCC 0x0001
|
||||
#define VENDOR_PCSBP 0x0002
|
||||
#define VENDOR_RVSPOL 0x0010
|
||||
#define VENDOR_NOAPOL 0x0020
|
||||
#define VENDOR_GPIO0DIR 0x0040
|
||||
#define VENDOR_GPIO0DAT 0x0080
|
||||
#define VENDOR_GPIO1DIR 0x0100
|
||||
#define VENDOR_GPIO1DAT 0x0200
|
||||
#define VENDOR_10BTLOOP 0x0400
|
||||
#define VENDOR_NOSQE 0x0800
|
||||
#define VENDOR_TXHIM 0x1000
|
||||
#define VENDOR_INTLVL 0x4000
|
||||
#define VENDOR_RPTR 0x8000
|
||||
|
||||
#define MII_INT 17
|
||||
#define INT_STAT_MASK 0x00ff
|
||||
#define INT_STAT_ACOMP 0x0001
|
||||
#define INT_STAT_RFAULT 0x0002
|
||||
#define INT_STAT_LSCHG 0x0004
|
||||
#define INT_STAT_LPACK 0x0008
|
||||
#define INT_STAT_PDF 0x0010
|
||||
#define INT_STAT_PRX 0x0020
|
||||
#define INT_STAT_RXERR 0x0040
|
||||
#define INT_STAT_JABBER 0x0080
|
||||
#define INT_CTRL_MASK 0xff00
|
||||
#define INT_CTRL_ACOMP 0x0100
|
||||
#define INT_CTRL_RFAULT 0x0200
|
||||
#define INT_CTRL_LSCHG 0x0400
|
||||
#define INT_CTRL_LPACK 0x0800
|
||||
#define INT_CTRL_PDF 0x1000
|
||||
#define INT_CTRL_PRX 0x2000
|
||||
#define INT_CTRL_RXERR 0x4000
|
||||
#define INT_CTRL_JABBER 0x8000
|
||||
|
||||
|
||||
#define MII_DIAG 18
|
||||
#define DIAG_RLOCK 0x0100
|
||||
#define DIAG_RPASS 0x0200
|
||||
#define DIAG_RATE_100 0x0400
|
||||
#define DIAG_DUPLEX 0x0800
|
||||
#define DIAG_NEGFAIL 0x1000
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,395 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jason L. Wright
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/random.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
#include <dev/rndtest/rndtest.h>
|
||||
|
||||
static void rndtest_test(struct rndtest_state *);
|
||||
static void rndtest_timeout(void *);
|
||||
|
||||
/* The tests themselves */
|
||||
static int rndtest_monobit(struct rndtest_state *);
|
||||
static int rndtest_runs(struct rndtest_state *);
|
||||
static int rndtest_longruns(struct rndtest_state *);
|
||||
static int rndtest_chi_4(struct rndtest_state *);
|
||||
|
||||
static int rndtest_runs_check(struct rndtest_state *, int, int *);
|
||||
static void rndtest_runs_record(struct rndtest_state *, int, int *);
|
||||
|
||||
static const struct rndtest_testfunc {
|
||||
int (*test)(struct rndtest_state *);
|
||||
} rndtest_funcs[] = {
|
||||
{ rndtest_monobit },
|
||||
{ rndtest_runs },
|
||||
{ rndtest_chi_4 },
|
||||
{ rndtest_longruns },
|
||||
};
|
||||
|
||||
#define RNDTEST_NTESTS (sizeof(rndtest_funcs)/sizeof(rndtest_funcs[0]))
|
||||
|
||||
SYSCTL_NODE(_kern, OID_AUTO, rndtest, CTLFLAG_RD, 0, "RNG test parameters");
|
||||
|
||||
static int rndtest_retest = 120; /* interval in seconds */
|
||||
SYSCTL_INT(_kern_rndtest, OID_AUTO, reset, CTLFLAG_RW, &rndtest_retest,
|
||||
0, "retest interval (seconds)");
|
||||
static struct rndtest_stats rndstats;
|
||||
SYSCTL_STRUCT(_kern_rndtest, OID_AUTO, stats, CTLFLAG_RD, &rndstats,
|
||||
rndtest_stats, "RNG test statistics");
|
||||
static int rndtest_verbose = 1; /* report only failures */
|
||||
SYSCTL_INT(_kern_rndtest, OID_AUTO, verbose, CTLFLAG_RW, &rndtest_verbose,
|
||||
0, "display results on console");
|
||||
|
||||
struct rndtest_state *
|
||||
rndtest_attach(device_t dev)
|
||||
{
|
||||
struct rndtest_state *rsp;
|
||||
|
||||
rsp = malloc(sizeof (*rsp), M_DEVBUF, M_NOWAIT);
|
||||
if (rsp != NULL) {
|
||||
rsp->rs_begin = rsp->rs_buf;
|
||||
rsp->rs_end = rsp->rs_buf + sizeof(rsp->rs_buf);
|
||||
rsp->rs_current = rsp->rs_begin;
|
||||
rsp->rs_discard = 1;
|
||||
rsp->rs_collect = 1;
|
||||
rsp->rs_parent = dev;
|
||||
/* NB: 1 means the callout runs w/o Giant locked */
|
||||
callout_init(&rsp->rs_to, 1);
|
||||
} else
|
||||
device_printf(dev, "rndtest_init: no memory for state block\n");
|
||||
return (rsp);
|
||||
}
|
||||
|
||||
void
|
||||
rndtest_detach(struct rndtest_state *rsp)
|
||||
{
|
||||
callout_stop(&rsp->rs_to);
|
||||
free(rsp, M_DEVBUF);
|
||||
}
|
||||
|
||||
void
|
||||
rndtest_harvest(struct rndtest_state *rsp, void *buf, u_int len)
|
||||
{
|
||||
/*
|
||||
* If enabled, collect data and run tests when we have enough.
|
||||
*/
|
||||
if (rsp->rs_collect) {
|
||||
size_t i;
|
||||
for (i = 0; i < len; i++) {
|
||||
*rsp->rs_current = ((u_char *) buf)[i];
|
||||
if (++rsp->rs_current == rsp->rs_end) {
|
||||
rndtest_test(rsp);
|
||||
rsp->rs_current = rsp->rs_begin;
|
||||
/*
|
||||
* If tests passed, turn off collection and
|
||||
* schedule another test. Otherwise we keep
|
||||
* testing until the data looks ok.
|
||||
*/
|
||||
if (!rsp->rs_discard && rndtest_retest != 0) {
|
||||
rsp->rs_collect = 0;
|
||||
callout_reset(&rsp->rs_to,
|
||||
hz * rndtest_retest,
|
||||
rndtest_timeout, rsp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Only stir entropy that passes muster into the pool.
|
||||
*/
|
||||
if (rsp->rs_discard)
|
||||
rndstats.rst_discard += len;
|
||||
else
|
||||
random_harvest(buf, len, len*NBBY, 0, RANDOM_PURE);
|
||||
}
|
||||
|
||||
static void
|
||||
rndtest_test(struct rndtest_state *rsp)
|
||||
{
|
||||
int i, rv = 0;
|
||||
|
||||
rndstats.rst_tests++;
|
||||
for (i = 0; i < RNDTEST_NTESTS; i++)
|
||||
rv |= (*rndtest_funcs[i].test)(rsp);
|
||||
rsp->rs_discard = (rv != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
rndtest_report(struct rndtest_state *rsp, int failure, const char *fmt, ...)
|
||||
{
|
||||
char buf[80];
|
||||
va_list ap;
|
||||
|
||||
if (rndtest_verbose == 0)
|
||||
return;
|
||||
if (!failure && rndtest_verbose == 1) /* don't report successes */
|
||||
return;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buf, sizeof (buf), fmt, ap);
|
||||
va_end(ap);
|
||||
device_printf(rsp->rs_parent, "rndtest: %s\n", buf);
|
||||
}
|
||||
|
||||
#define RNDTEST_MONOBIT_MINONES 9725
|
||||
#define RNDTEST_MONOBIT_MAXONES 10275
|
||||
|
||||
static int
|
||||
rndtest_monobit(struct rndtest_state *rsp)
|
||||
{
|
||||
int i, ones = 0, j;
|
||||
u_int8_t r;
|
||||
|
||||
for (i = 0; i < RNDTEST_NBYTES; i++) {
|
||||
r = rsp->rs_buf[i];
|
||||
for (j = 0; j < 8; j++, r <<= 1)
|
||||
if (r & 0x80)
|
||||
ones++;
|
||||
}
|
||||
if (ones > RNDTEST_MONOBIT_MINONES &&
|
||||
ones < RNDTEST_MONOBIT_MAXONES) {
|
||||
if (rndtest_verbose > 1)
|
||||
rndtest_report(rsp, 0, "monobit pass (%d < %d < %d)",
|
||||
RNDTEST_MONOBIT_MINONES, ones,
|
||||
RNDTEST_MONOBIT_MAXONES);
|
||||
return (0);
|
||||
} else {
|
||||
if (rndtest_verbose)
|
||||
rndtest_report(rsp, 1,
|
||||
"monobit failed (%d ones)", ones);
|
||||
rndstats.rst_monobit++;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
#define RNDTEST_RUNS_NINTERVAL 6
|
||||
|
||||
static const struct rndtest_runs_tabs {
|
||||
u_int16_t min, max;
|
||||
} rndtest_runs_tab[] = {
|
||||
{ 2343, 2657 },
|
||||
{ 1135, 1365 },
|
||||
{ 542, 708 },
|
||||
{ 251, 373 },
|
||||
{ 111, 201 },
|
||||
{ 111, 201 },
|
||||
};
|
||||
|
||||
static int
|
||||
rndtest_runs(struct rndtest_state *rsp)
|
||||
{
|
||||
int i, j, ones, zeros, rv = 0;
|
||||
int onei[RNDTEST_RUNS_NINTERVAL], zeroi[RNDTEST_RUNS_NINTERVAL];
|
||||
u_int8_t c;
|
||||
|
||||
bzero(onei, sizeof(onei));
|
||||
bzero(zeroi, sizeof(zeroi));
|
||||
ones = zeros = 0;
|
||||
for (i = 0; i < RNDTEST_NBYTES; i++) {
|
||||
c = rsp->rs_buf[i];
|
||||
for (j = 0; j < 8; j++, c <<= 1) {
|
||||
if (c & 0x80) {
|
||||
ones++;
|
||||
rndtest_runs_record(rsp, zeros, zeroi);
|
||||
zeros = 0;
|
||||
} else {
|
||||
zeros++;
|
||||
rndtest_runs_record(rsp, ones, onei);
|
||||
ones = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
rndtest_runs_record(rsp, ones, onei);
|
||||
rndtest_runs_record(rsp, zeros, zeroi);
|
||||
|
||||
rv |= rndtest_runs_check(rsp, 0, zeroi);
|
||||
rv |= rndtest_runs_check(rsp, 1, onei);
|
||||
|
||||
if (rv)
|
||||
rndstats.rst_runs++;
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
static void
|
||||
rndtest_runs_record(struct rndtest_state *rsp, int len, int *intrv)
|
||||
{
|
||||
if (len == 0)
|
||||
return;
|
||||
if (len > RNDTEST_RUNS_NINTERVAL)
|
||||
len = RNDTEST_RUNS_NINTERVAL;
|
||||
len -= 1;
|
||||
intrv[len]++;
|
||||
}
|
||||
|
||||
static int
|
||||
rndtest_runs_check(struct rndtest_state *rsp, int val, int *src)
|
||||
{
|
||||
int i, rv = 0;
|
||||
|
||||
for (i = 0; i < RNDTEST_RUNS_NINTERVAL; i++) {
|
||||
if (src[i] < rndtest_runs_tab[i].min ||
|
||||
src[i] > rndtest_runs_tab[i].max) {
|
||||
rndtest_report(rsp, 1,
|
||||
"%s interval %d failed (%d, %d-%d)",
|
||||
val ? "ones" : "zeros",
|
||||
i + 1, src[i], rndtest_runs_tab[i].min,
|
||||
rndtest_runs_tab[i].max);
|
||||
rv = -1;
|
||||
} else {
|
||||
rndtest_report(rsp, 0,
|
||||
"runs pass %s interval %d (%d < %d < %d)",
|
||||
val ? "ones" : "zeros",
|
||||
i + 1, rndtest_runs_tab[i].min, src[i],
|
||||
rndtest_runs_tab[i].max);
|
||||
}
|
||||
}
|
||||
return (rv);
|
||||
}
|
||||
|
||||
static int
|
||||
rndtest_longruns(struct rndtest_state *rsp)
|
||||
{
|
||||
int i, j, ones = 0, zeros = 0, maxones = 0, maxzeros = 0;
|
||||
u_int8_t c;
|
||||
|
||||
for (i = 0; i < RNDTEST_NBYTES; i++) {
|
||||
c = rsp->rs_buf[i];
|
||||
for (j = 0; j < 8; j++, c <<= 1) {
|
||||
if (c & 0x80) {
|
||||
zeros = 0;
|
||||
ones++;
|
||||
if (ones > maxones)
|
||||
maxones = ones;
|
||||
} else {
|
||||
ones = 0;
|
||||
zeros++;
|
||||
if (zeros > maxzeros)
|
||||
maxzeros = zeros;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (maxones < 26 && maxzeros < 26) {
|
||||
rndtest_report(rsp, 0, "longruns pass (%d ones, %d zeros)",
|
||||
maxones, maxzeros);
|
||||
return (0);
|
||||
} else {
|
||||
rndtest_report(rsp, 1, "longruns fail (%d ones, %d zeros)",
|
||||
maxones, maxzeros);
|
||||
rndstats.rst_longruns++;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* chi^2 test over 4 bits: (this is called the poker test in FIPS 140-2,
|
||||
* but it is really the chi^2 test over 4 bits (the poker test as described
|
||||
* by Knuth vol 2 is something different, and I take him as authoritative
|
||||
* on nomenclature over NIST).
|
||||
*/
|
||||
#define RNDTEST_CHI4_K 16
|
||||
#define RNDTEST_CHI4_K_MASK (RNDTEST_CHI4_K - 1)
|
||||
|
||||
/*
|
||||
* The unnormalized values are used so that we don't have to worry about
|
||||
* fractional precision. The "real" value is found by:
|
||||
* (V - 1562500) * (16 / 5000) = Vn (where V is the unnormalized value)
|
||||
*/
|
||||
#define RNDTEST_CHI4_VMIN 1563181 /* 2.1792 */
|
||||
#define RNDTEST_CHI4_VMAX 1576929 /* 46.1728 */
|
||||
|
||||
static int
|
||||
rndtest_chi_4(struct rndtest_state *rsp)
|
||||
{
|
||||
unsigned int freq[RNDTEST_CHI4_K], i, sum;
|
||||
|
||||
for (i = 0; i < RNDTEST_CHI4_K; i++)
|
||||
freq[i] = 0;
|
||||
|
||||
/* Get number of occurances of each 4 bit pattern */
|
||||
for (i = 0; i < RNDTEST_NBYTES; i++) {
|
||||
freq[(rsp->rs_buf[i] >> 4) & RNDTEST_CHI4_K_MASK]++;
|
||||
freq[(rsp->rs_buf[i] >> 0) & RNDTEST_CHI4_K_MASK]++;
|
||||
}
|
||||
|
||||
for (i = 0, sum = 0; i < RNDTEST_CHI4_K; i++)
|
||||
sum += freq[i] * freq[i];
|
||||
|
||||
if (sum >= 1563181 && sum <= 1576929) {
|
||||
rndtest_report(rsp, 0, "chi^2(4): pass (sum %u)", sum);
|
||||
return (0);
|
||||
} else {
|
||||
rndtest_report(rsp, 1, "chi^2(4): failed (sum %u)", sum);
|
||||
rndstats.rst_chi++;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
rndtest_timeout(void *xrsp)
|
||||
{
|
||||
struct rndtest_state *rsp = xrsp;
|
||||
|
||||
rsp->rs_collect = 1;
|
||||
}
|
||||
|
||||
static int
|
||||
rndtest_modevent(module_t mod, int type, void *unused)
|
||||
{
|
||||
switch (type) {
|
||||
case MOD_LOAD:
|
||||
return 0;
|
||||
case MOD_UNLOAD:
|
||||
return 0;
|
||||
}
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
static moduledata_t rndtest_mod = {
|
||||
"rndtest",
|
||||
rndtest_modevent,
|
||||
0
|
||||
};
|
||||
DECLARE_MODULE(rndtest, rndtest_mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
|
||||
MODULE_VERSION(rndtest, 1);
|
||||
@@ -1,60 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jason L. Wright
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
/* Some of the tests depend on these values */
|
||||
#define RNDTEST_NBYTES 2500
|
||||
#define RNDTEST_NBITS (8 * RNDTEST_NBYTES)
|
||||
|
||||
struct rndtest_state {
|
||||
device_t rs_parent; /* associated device */
|
||||
u_int8_t *rs_end, *rs_begin, *rs_current;
|
||||
struct callout rs_to;
|
||||
int rs_collect; /* collect and test data */
|
||||
int rs_discard; /* discard/accept random data */
|
||||
u_int8_t rs_buf[RNDTEST_NBYTES];
|
||||
};
|
||||
|
||||
struct rndtest_stats {
|
||||
u_int32_t rst_discard; /* number of bytes discarded */
|
||||
u_int32_t rst_tests; /* number of test runs */
|
||||
u_int32_t rst_monobit; /* monobit test failures */
|
||||
u_int32_t rst_runs; /* 0/1 runs failures */
|
||||
u_int32_t rst_longruns; /* longruns failures */
|
||||
u_int32_t rst_chi; /* chi^2 failures */
|
||||
};
|
||||
|
||||
extern struct rndtest_state *rndtest_attach(device_t dev);
|
||||
extern void rndtest_detach(struct rndtest_state *);
|
||||
extern void rndtest_harvest(struct rndtest_state *arg, void * buf, u_int len);
|
||||
@@ -1,92 +0,0 @@
|
||||
/* $NetBSD: usb/ugraphire_rdesc.h,v 1.1 2000/12/29 01:47:49 augustss Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (c) 2000 Nick Hibma <n_hibma@freebsd.org>
|
||||
* 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.
|
||||
*/
|
||||
|
||||
static uByte uhid_graphire_report_descr[] = {
|
||||
0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
|
||||
0x09, 0x01, /* USAGE (Digitizer) */
|
||||
0xa1, 0x01, /* COLLECTION (Application) */
|
||||
0x85, 0x02, /* REPORT_ID (2) */
|
||||
0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
|
||||
0x09, 0x01, /* USAGE (Digitizer) */
|
||||
0xa1, 0x00, /* COLLECTION (Physical) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
|
||||
0x09, 0x33, /* USAGE (Touch) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x09, 0x44, /* USAGE (Barrel Switch) */
|
||||
0x95, 0x02, /* REPORT_COUNT (2) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x09, 0x00, /* USAGE (Undefined) */
|
||||
0x95, 0x02, /* REPORT_COUNT (2) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x03, /* INPUT (Cnst,Var,Abs) */
|
||||
0x09, 0x3c, /* USAGE (Invert) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x09, 0x38, /* USAGE (Transducer Index) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x09, 0x32, /* USAGE (In Range) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x01, /* REPORT_SIZE (1) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
|
||||
0x09, 0x30, /* USAGE (X) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x26, 0xde, 0x27, /* LOGICAL_MAXIMUM (10206) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x10, /* REPORT_SIZE (16) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x09, 0x31, /* USAGE (Y) */
|
||||
0x26, 0xfe, 0x1c, /* LOGICAL_MAXIMUM (7422) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x10, /* REPORT_SIZE (16) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
|
||||
0x09, 0x30, /* USAGE (Tip Pressure) */
|
||||
0x26, 0xff, 0x01, /* LOGICAL_MAXIMUM (511) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0x75, 0x10, /* REPORT_SIZE (16) */
|
||||
0x81, 0x02, /* INPUT (Data,Var,Abs) */
|
||||
0xc0, /* END_COLLECTION */
|
||||
0x05, 0x0d, /* USAGE_PAGE (Digitizers) */
|
||||
0x09, 0x00, /* USAGE (Undefined) */
|
||||
0x85, 0x02, /* REPORT_ID (2) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0xb1, 0x02, /* FEATURE (Data,Var,Abs) */
|
||||
0x09, 0x00, /* USAGE (Undefined) */
|
||||
0x85, 0x03, /* REPORT_ID (3) */
|
||||
0x95, 0x01, /* REPORT_COUNT (1) */
|
||||
0xb1, 0x02, /* FEATURE (Data,Var,Abs) */
|
||||
0xc0, /* END_COLLECTION */
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
# Correct path for kernel builds
|
||||
# Don't rely on the kernel's .depend file
|
||||
.ifdef MAKESRCPATH
|
||||
.PATH: ${MAKESRCPATH}
|
||||
DEPENDFILE=
|
||||
.else
|
||||
MAKESRCPATH= ${.CURDIR}
|
||||
CLEANFILES= acpi_wakecode.h acpi_wakecode.bin acpi_wakecode.o
|
||||
.endif
|
||||
CFLAGS+= -I.
|
||||
|
||||
all: acpi_wakecode.h
|
||||
|
||||
acpi_wakecode.o: acpi_wakecode.S
|
||||
|
||||
acpi_wakecode.bin: acpi_wakecode.o
|
||||
objcopy -S -O binary acpi_wakecode.o acpi_wakecode.bin
|
||||
|
||||
acpi_wakecode.h: acpi_wakecode.bin acpi_wakecode.o
|
||||
sh ${MAKESRCPATH}/genwakecode.sh > acpi_wakecode.h
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
#
|
||||
echo 'static char wakecode[] = {';
|
||||
hexdump -Cv acpi_wakecode.bin | \
|
||||
sed -e 's/^[0-9a-f][0-9a-f]*//' -e 's/\|.*$//' | \
|
||||
while read line
|
||||
do
|
||||
for code in ${line}
|
||||
do
|
||||
echo -n "0x${code},";
|
||||
done
|
||||
done
|
||||
echo '};'
|
||||
|
||||
nm -n acpi_wakecode.o | while read offset dummy what
|
||||
do
|
||||
echo "#define ${what} 0x${offset}"
|
||||
done
|
||||
|
||||
exit 0
|
||||
+10
-7
@@ -64,6 +64,9 @@ options AHD_REG_PRETTY_PRINT # Print register bitfields in debug
|
||||
#options SMP # Symmetric MultiProcessor Kernel
|
||||
#options APIC_IO # Symmetric (APIC) I/O
|
||||
|
||||
# To support HyperThreading, HTT is needed in addition to SMP and APIC_IO
|
||||
#options HTT # HyperThreading Technology
|
||||
|
||||
device isa
|
||||
device eisa
|
||||
device pci
|
||||
@@ -205,10 +208,10 @@ device bge # Broadcom BCM570x (``Tigon III'')
|
||||
|
||||
# ISA Ethernet NICs.
|
||||
# 'device ed' requires 'device miibus'
|
||||
device ed0 at isa? port 0x280 irq 10 iomem 0xd8000
|
||||
device ed0 at isa? disable port 0x280 irq 10 iomem 0xd8000
|
||||
device ex
|
||||
device ep
|
||||
device fe0 at isa? port 0x300
|
||||
device fe0 at isa? disable port 0x300
|
||||
# Xircom Ethernet
|
||||
device xe
|
||||
# PRISM I IEEE 802.11b wireless NIC.
|
||||
@@ -224,11 +227,11 @@ device wi
|
||||
# those parameters here.
|
||||
device an
|
||||
# The probe order of these is presently determined by i386/isa/isa_compat.c.
|
||||
device ie0 at isa? port 0x300 irq 10 iomem 0xd0000
|
||||
#device le0 at isa? port 0x300 irq 5 iomem 0xd0000
|
||||
device lnc0 at isa? port 0x280 irq 10 drq 0
|
||||
device cs0 at isa? port 0x300
|
||||
device sn0 at isa? port 0x300 irq 10
|
||||
device ie0 at isa? disable port 0x300 irq 10 iomem 0xd0000
|
||||
#device le0 at isa? disable port 0x300 irq 5 iomem 0xd0000
|
||||
device lnc0 at isa? disable port 0x280 irq 10 drq 0
|
||||
device cs0 at isa? disable port 0x300
|
||||
device sn0 at isa? disable port 0x300 irq 10
|
||||
|
||||
# Pseudo devices - the number indicates how many units to allocate.
|
||||
pseudo-device loop # Network loopback
|
||||
|
||||
@@ -1230,10 +1230,6 @@ device stg0 at isa? port 0x140 irq 11
|
||||
# Adaptec FSA RAID controllers, including integrated DELL controller,
|
||||
# the Dell PERC 2/QC and the HP NetRAID-4M
|
||||
#
|
||||
# AAC_COMPAT_LINUX Include code to support Linux-binary management
|
||||
# utilities (requires Linux compatibility
|
||||
# support).
|
||||
#
|
||||
device aac
|
||||
device aacp # SCSI Passthrough interface (optional, CAM required)
|
||||
|
||||
|
||||
@@ -7,9 +7,6 @@ SRCS= aac.c aac_pci.c aac_disk.c aac_cam.c
|
||||
SRCS+= opt_scsi.h opt_cam.h opt_aac.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h
|
||||
|
||||
CFLAGS+= -DAAC_COMPAT_LINUX
|
||||
KMODDEPS= linux
|
||||
|
||||
#CFLAGS+= -DAAC_DEBUG=2
|
||||
#SRCS+= aac_debug.c
|
||||
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/aac
|
||||
.PATH: ${.CURDIR}/../../dev/aac
|
||||
|
||||
KMOD= aac_linux
|
||||
SRCS= aac_linux.c
|
||||
SUBDIR= aac_linux
|
||||
|
||||
KMOD= aac
|
||||
SRCS= aac.c aac_pci.c aac_disk.c aac_cam.c
|
||||
SRCS+= opt_scsi.h opt_cam.h opt_aac.h
|
||||
SRCS+= device_if.h bus_if.h pci_if.h
|
||||
|
||||
#CFLAGS+= -DAAC_DEBUG=2
|
||||
#SRCS+= aac_debug.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
@@ -1,5 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR = mga r128 radeon tdfx
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -1,3 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include "../Makefile.inc"
|
||||
@@ -1,10 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/drm
|
||||
KMOD = mga
|
||||
NOMAN = YES
|
||||
SRCS = mga_drv.c mga_state.c mga_warp.c mga_dma.c \
|
||||
mga_irq.c
|
||||
SRCS +=device_if.h bus_if.h pci_if.h opt_drm.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
@@ -1,9 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/drm
|
||||
KMOD = r128
|
||||
NOMAN = YES
|
||||
SRCS = r128_cce.c r128_drv.c r128_irq.c r128_state.c
|
||||
SRCS +=device_if.h bus_if.h pci_if.h opt_drm.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
@@ -1,10 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/drm
|
||||
KMOD = radeon
|
||||
NOMAN = YES
|
||||
SRCS = radeon_cp.c radeon_drv.c radeon_irq.c \
|
||||
radeon_mem.c radeon_state.c
|
||||
SRCS +=device_if.h bus_if.h pci_if.h opt_drm.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
@@ -1,9 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/drm
|
||||
KMOD = tdfx
|
||||
NOMAN = YES
|
||||
SRCS = tdfx_drv.c
|
||||
SRCS +=device_if.h bus_if.h pci_if.h opt_drm.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
@@ -1,17 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../dev/ed
|
||||
|
||||
KMOD= if_ed
|
||||
SRCS= if_ed.c if_ed_pccard.c if_ed_pci.c
|
||||
|
||||
.if ${MACHINE} == "pc98"
|
||||
SRCS+= if_ed_cbus.c
|
||||
.else
|
||||
SRCS+= if_ed_isa.c
|
||||
.endif
|
||||
|
||||
SRCS+= opt_ed.h opt_bdg.h bus_if.h card_if.h device_if.h isa_if.h pci_if.h \
|
||||
miibus_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
@@ -1,8 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../../dev/syscons/dragon
|
||||
|
||||
KMOD= dragon_saver
|
||||
SRCS= dragon_saver.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
@@ -1,5 +1,40 @@
|
||||
/* $FreeBSD$ */
|
||||
/* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
|
||||
/* $OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $ */
|
||||
/*
|
||||
* The authors of this code are John Ioannidis (ji@tla.org),
|
||||
* Angelos D. Keromytis (kermit@csd.uch.gr) and
|
||||
* Niels Provos (provos@physnet.uni-hamburg.de).
|
||||
*
|
||||
* This code was written by John Ioannidis for BSD/OS in Athens, Greece,
|
||||
* in November 1995.
|
||||
*
|
||||
* Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
|
||||
* by Angelos D. Keromytis.
|
||||
*
|
||||
* Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
|
||||
* and Niels Provos.
|
||||
*
|
||||
* Additional features in 1999 by Angelos D. Keromytis.
|
||||
*
|
||||
* Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
|
||||
* Angelos D. Keromytis and Niels Provos.
|
||||
* Copyright (c) 2001, Angelos D. Keromytis.
|
||||
*
|
||||
* Permission to use, copy, and modify this software with or without fee
|
||||
* is hereby granted, provided that this entire notice is included in
|
||||
* all copies of any software which is or includes a copy or
|
||||
* modification of this software.
|
||||
* You may use this code under the GNU public license if you so wish. Please
|
||||
* contribute changes back to the authors under this freer than GPL license
|
||||
* so that we may further the use of strong encryption without limitations to
|
||||
* all.
|
||||
*
|
||||
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
|
||||
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
|
||||
* MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
|
||||
* PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* IPsec input processing.
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* IPsec-specific mbuf routines.
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
/* $FreeBSD$ */
|
||||
/* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* IPsec output processing.
|
||||
|
||||
+16
-1
@@ -835,16 +835,19 @@ void
|
||||
crypto_freereq(struct cryptop *crp)
|
||||
{
|
||||
struct cryptodesc *crd;
|
||||
int s;
|
||||
|
||||
if (crp == NULL)
|
||||
return;
|
||||
|
||||
/* NB: see below for an explanation */
|
||||
s = splcrypto();
|
||||
while ((crd = crp->crp_desc) != NULL) {
|
||||
crp->crp_desc = crd->crd_next;
|
||||
zfree(cryptodesc_zone, crd);
|
||||
}
|
||||
|
||||
zfree(cryptop_zone, crp);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -855,7 +858,17 @@ crypto_getreq(int num)
|
||||
{
|
||||
struct cryptodesc *crd;
|
||||
struct cryptop *crp;
|
||||
int s;
|
||||
|
||||
/*
|
||||
* Must interlock access to the zone. Calls may come in
|
||||
* at raised ipl from network protocols, but in general
|
||||
* we cannot be certain where we'll be called from. We
|
||||
* could use zalloci/zfreei which is safe to be called
|
||||
* from anywhere or use splhigh, but for now splcrypto
|
||||
* is safe as it blocks crypto drivers and network threads.
|
||||
*/
|
||||
s = splcrypto();
|
||||
crp = zalloc(cryptop_zone);
|
||||
if (crp != NULL) {
|
||||
bzero(crp, sizeof (*crp));
|
||||
@@ -863,6 +876,7 @@ crypto_getreq(int num)
|
||||
crd = zalloc(cryptodesc_zone);
|
||||
if (crd == NULL) {
|
||||
crypto_freereq(crp);
|
||||
splx(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -871,6 +885,7 @@ crypto_getreq(int num)
|
||||
crp->crp_desc = crd;
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
return crp;
|
||||
}
|
||||
|
||||
|
||||
+21
-10
@@ -178,13 +178,18 @@ int sched_setparam(struct proc *p,
|
||||
int sched_getparam(struct proc *p,
|
||||
struct sched_getparam_args *uap)
|
||||
{
|
||||
int e;
|
||||
struct proc *targetp;
|
||||
struct sched_param sched_param;
|
||||
|
||||
(void) (0
|
||||
|| (e = p31b_proc(p, uap->pid, &p))
|
||||
|| (e = ksched_getparam(&p->p_retval[0], ksched, p, &sched_param))
|
||||
);
|
||||
int e;
|
||||
|
||||
if (uap->pid != 0 && uap->pid != p->p_pid) {
|
||||
e = p31b_proc(p, uap->pid, &targetp);
|
||||
if (e)
|
||||
return e;
|
||||
} else
|
||||
targetp = p;
|
||||
|
||||
e = ksched_getparam(&p->p_retval[0], ksched, targetp, &sched_param);
|
||||
|
||||
if (!e)
|
||||
copyout(&sched_param, uap->param, sizeof(sched_param));
|
||||
@@ -211,11 +216,17 @@ int sched_setscheduler(struct proc *p,
|
||||
int sched_getscheduler(struct proc *p,
|
||||
struct sched_getscheduler_args *uap)
|
||||
{
|
||||
struct proc *targetp;
|
||||
int e;
|
||||
(void) (0
|
||||
|| (e = p31b_proc(p, uap->pid, &p))
|
||||
|| (e = ksched_getscheduler(&p->p_retval[0], ksched, p))
|
||||
);
|
||||
|
||||
if (uap->pid != 0 && uap->pid != p->p_pid) {
|
||||
e = p31b_proc(p, uap->pid, &targetp);
|
||||
if (e)
|
||||
return e;
|
||||
} else
|
||||
targetp = p;
|
||||
|
||||
e = ksched_getscheduler(&p->p_retval[0], ksched, targetp);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@
|
||||
* doc/en_US.ISO8859-1/books/porters-handbook/book.sgml
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 470103 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 480000 /* Master, propagated to newvers */
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Mitsuru IWASAKI
|
||||
* 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$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_POWER_H_
|
||||
#define _SYS_POWER_H_
|
||||
|
||||
#include <sys/eventhandler.h>
|
||||
|
||||
/* Power management system type */
|
||||
#define POWER_PM_TYPE_APM 0x00
|
||||
#define POWER_PM_TYPE_ACPI 0x01
|
||||
#define POWER_PM_TYPE_NONE 0xff
|
||||
|
||||
/* Commands for Power management function */
|
||||
#define POWER_CMD_SUSPEND 0x00
|
||||
|
||||
/* Sleep state */
|
||||
#define POWER_SLEEP_STATE_STANDBY 0x00
|
||||
#define POWER_SLEEP_STATE_SUSPEND 0x01
|
||||
#define POWER_SLEEP_STATE_HIBERNATE 0x02
|
||||
|
||||
typedef int (*power_pm_fn_t)(u_long, void*, ...);
|
||||
extern int power_pm_register(u_int, power_pm_fn_t, void *);
|
||||
extern u_int power_pm_get_type(void);
|
||||
extern void power_pm_suspend(int);
|
||||
|
||||
/*
|
||||
* System power API.
|
||||
*/
|
||||
#define POWER_PROFILE_PERFORMANCE 0
|
||||
#define POWER_PROFILE_ECONOMY 1
|
||||
|
||||
extern int power_profile_get_state(void);
|
||||
extern void power_profile_set_state(int);
|
||||
|
||||
typedef void (*power_profile_change_hook)(void *, int);
|
||||
EVENTHANDLER_DECLARE(power_profile_change, power_profile_change_hook);
|
||||
|
||||
#endif /* !_SYS_POWER_H_ */
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Lord Of The Rings
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _calendar_lotr_
|
||||
#define _calendar_lotr_
|
||||
|
||||
01/05 Fellowship enters Moria
|
||||
01/09 Fellowship reaches Lorien
|
||||
01/17 Passing of Gandalf
|
||||
02/07 Fellowship leaves Lorien
|
||||
02/17 Death of Boromir
|
||||
02/20 Meriadoc & Pippin meet Treebeard
|
||||
02/22 Passing of King Ellesar
|
||||
02/24 Ents destroy Isengard
|
||||
02/26 Aragorn takes the Paths of the Dead
|
||||
03/05 Frodo & Samwise encounter Shelob
|
||||
03/08 Deaths of Denethor & Theoden
|
||||
03/18 Destruction of the Ring
|
||||
03/29 Flowering of the Mallorn
|
||||
04/04 Gandalf visits Bilbo
|
||||
04/17 An unexpected party
|
||||
04/23 Crowning of King Ellesar
|
||||
05/19 Arwen leaves Lorian to wed King Ellesar
|
||||
06/11 Sauron attacks Osgilliath
|
||||
06/13 Bilbo returns to Bag End
|
||||
06/23 Wedding of Ellesar & Arwen
|
||||
07/04 Gandalf imprisoned by Saruman
|
||||
07/24 The ring comes to Bilbo
|
||||
07/26 Bilbo rescued from Wargs by Eagles
|
||||
08/03 Funeral of King Theoden
|
||||
08/29 Saruman enters the Shire
|
||||
09/10 Gandalf escapes from Orthanc
|
||||
09/14 Frodo & Bilbo's birthday
|
||||
09/15 Black riders enter the Shire
|
||||
09/18 Frodo and company rescued by Bombadil
|
||||
09/28 Frodo wounded at Weathertop
|
||||
10/16 Boromir reaches Rivendell
|
||||
10/17 Council of Elrond
|
||||
10/25 End of War of the Ring
|
||||
11/16 Bilbo reaches the Lonely Mountain
|
||||
12/05 Death of Smaug
|
||||
12/16 Fellowship begins Quest
|
||||
|
||||
#endif /* !_calendar_lotr_ */
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* South African holidays
|
||||
* Note: The Public Holidays Act (Act No 36 of 1994) determines whenever
|
||||
* any public holiday falls on a Sunday, the Monday following on it shall
|
||||
* be an unnamed public holiday in addition to the named holiday the day
|
||||
* before. This file format is not complex enough to reflect this, but
|
||||
* if it ever is, the change should be made.
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _calendar_southafrica_
|
||||
#define _calendar_southafrica_
|
||||
|
||||
03/01 Human Rights Day in South Africa
|
||||
04/27 Freedom Day in South Africa
|
||||
05/01 Workers Day in South Africa
|
||||
06/16 Youth Day in South Africa
|
||||
08/09 National Women's Day in South Africa
|
||||
09/24 Heritage Day in South Africa
|
||||
12/16 Day of Reconciliation in South Africa
|
||||
12/26 Day of Goodwill in South Africa
|
||||
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= makewhatis
|
||||
DPADD= ${LIBZ}
|
||||
LDADD= -lz
|
||||
SCRIPTS= makewhatis.local.sh
|
||||
MAN= makewhatis.1 makewhatis.local.8
|
||||
SCRIPTSDIR= /usr/libexec
|
||||
LINKS= ${SCRIPTSDIR}/makewhatis.local ${SCRIPTSDIR}/catman.local
|
||||
MLINKS= makewhatis.local.8 catman.local.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -1,133 +0,0 @@
|
||||
.\" Copyright (c) 2002 John Rochester
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 12, 2002
|
||||
.Dt MAKEWHATIS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm makewhatis
|
||||
.Nd "create whatis database"
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl a
|
||||
.Op Fl i Ar column
|
||||
.Op Fl n Ar name
|
||||
.Op Fl o Ar file
|
||||
.Op Fl v
|
||||
.Op Fl L
|
||||
.Op Ar directories ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility collects the names and short descriptions from all the unformatted
|
||||
man pages in the
|
||||
.Ar directories
|
||||
and puts them into a file used by the
|
||||
.Xr whatis 1
|
||||
and
|
||||
.Xr apropos 1
|
||||
commands.
|
||||
Directories may be separated by colons instead of spaces.
|
||||
If no
|
||||
.Ar directories
|
||||
are specified, the contents of the
|
||||
.Ev MANPATH
|
||||
environment variable will be used, or if that is not set, the default directory
|
||||
.Pa /usr/share/man
|
||||
will be processed.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width ".Fl i Ar column"
|
||||
.It Fl a
|
||||
Appends to the output file(s) instead of replacing them.
|
||||
The output
|
||||
will be sorted with duplicate lines removed, but may have obsolete
|
||||
entries.
|
||||
.It Fl i Ar column
|
||||
Indents the description by
|
||||
.Ar column
|
||||
characters.
|
||||
The default value is 24.
|
||||
.It Fl n Ar name
|
||||
Uses
|
||||
.Ar name
|
||||
instead of
|
||||
.Pa whatis .
|
||||
.It Fl o Ar file
|
||||
Outputs all lines to the
|
||||
.Ar file
|
||||
instead of
|
||||
.Pa */man/whatis .
|
||||
.It Fl v
|
||||
Makes
|
||||
.Nm
|
||||
more verbose about what it is doing.
|
||||
.It Fl L
|
||||
Process only localized subdirectories corresponding to the locale specified
|
||||
in the standard environment variables.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width ".Ev MANPATH"
|
||||
.It Ev LC_ALL , LC_CTYPE , LANG
|
||||
These variables control what subdirectories will be processed if the
|
||||
.Fl L
|
||||
option is used.
|
||||
.It Ev MACHINE
|
||||
If set, its value is used to override the current
|
||||
machine type when searching machine specific subdirectories.
|
||||
.It Ev MANPATH
|
||||
Determines the set of directories to be processed if none are given on
|
||||
the command line.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width ".Pa /usr/share/man" -compact
|
||||
.It Pa /usr/share/man
|
||||
Default directory to process if the
|
||||
.Ev MANPATH
|
||||
environment variable is not set.
|
||||
.It Pa */man/whatis
|
||||
The default output file.
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
.Xr apropos 1 ,
|
||||
.Xr whatis 1
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in
|
||||
.Fx 2.1 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
program was originally written in Perl and was contributed by
|
||||
.An Wolfram Schneider .
|
||||
The current version of
|
||||
.Nm
|
||||
was rewritten in C by
|
||||
.An John Rochester .
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,82 +0,0 @@
|
||||
.\" Copyright (c) April 1996 Wolfram Schneider <[email protected]>. Berlin.
|
||||
.\" 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 April 26, 1996
|
||||
.Dt MAKEWHATIS.LOCAL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm makewhatis.local , catman.local
|
||||
.Nd start makewhatis or catman for local file systems
|
||||
.Sh SYNOPSIS
|
||||
.Nm /usr/libexec/makewhatis.local
|
||||
.Op options
|
||||
.Ar directories ...
|
||||
.Nm /usr/libexec/catman.local
|
||||
.Op options
|
||||
.Ar directories ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility starts
|
||||
.Xr makewhatis 1
|
||||
only for file systems physically mounted on the system
|
||||
where the
|
||||
.Nm
|
||||
is being executed. Running makewhatis
|
||||
by
|
||||
.Pa periodic weekly
|
||||
for rw nfs-mounted /usr may kill
|
||||
your NFS server -- all NFS clients start makewhatis at the same time!
|
||||
So use this wrapper for
|
||||
.Xr cron 8
|
||||
instead of calling makewhatis directly.
|
||||
The
|
||||
.Nm catman.local
|
||||
utility is using for same purposes as
|
||||
.Nm
|
||||
but for
|
||||
.Xr catman 1 .
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/periodic/weekly/320.whatis.XXX -compact
|
||||
.It Pa /etc/periodic/weekly/320.whatis
|
||||
run
|
||||
.Nm
|
||||
every week
|
||||
.It Pa /etc/periodic/weekly/330.catman
|
||||
run
|
||||
.Nm catman.local
|
||||
every week
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr catman 1 ,
|
||||
.Xr find 1 ,
|
||||
.Xr makewhatis 1 ,
|
||||
.Xr cron 8 ,
|
||||
.Xr periodic 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility appeared in
|
||||
.Fx 2.2 .
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) April 1996 Wolfram Schneider <[email protected]>. Berlin.
|
||||
# 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.
|
||||
#
|
||||
# makewhatis.local - start makewhatis(1) only for file systems
|
||||
# physically mounted on the system
|
||||
#
|
||||
# Running makewhatis from /etc/periodic/weekly/320.whatis for rw nfs-mounted
|
||||
# /usr may kill your NFS server -- all clients start makewhatis at the same
|
||||
# time! So use this wrapper instead calling makewhatis directly.
|
||||
#
|
||||
# PS: this wrapper works also for catman(1)
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
PATH=/bin:/usr/bin:$PATH; export PATH
|
||||
opt= dirs= localdirs=
|
||||
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-*) opt="$opt $arg";;
|
||||
*) dirs="$dirs $arg";;
|
||||
esac
|
||||
done
|
||||
|
||||
dirs=`echo $dirs | sed 's/:/ /g'`
|
||||
case X"$dirs" in X) echo "usage: $0 [options] directories ..."; exit 1;; esac
|
||||
|
||||
localdirs=`find -H $dirs -fstype local -type d -prune -print`
|
||||
|
||||
case X"$localdirs" in
|
||||
X) echo "$0: no local-mounted manual directories found: $dirs"
|
||||
exit 1;;
|
||||
*) exec `basename $0 .local` $opt $localdirs;;
|
||||
esac
|
||||
@@ -1,11 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= stat
|
||||
MAN= stat.1
|
||||
SRCS= stat.c
|
||||
WARNS?= 2
|
||||
|
||||
LINKS= ${BINDIR}/stat ${BINDIR}/readlink
|
||||
MLINKS= stat.1 readlink.1
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -1,149 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2000 Dan Papasian. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void usage(void);
|
||||
static int print_matches(char *, char *);
|
||||
|
||||
int silent;
|
||||
int allpaths;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *p, *path;
|
||||
ssize_t pathlen;
|
||||
int opt, status;
|
||||
|
||||
status = EXIT_SUCCESS;
|
||||
|
||||
/* If called without args, die silently to conform */
|
||||
if (argc < 2)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
while ((opt = getopt(argc, argv, "as")) != -1) {
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
allpaths = 1;
|
||||
break;
|
||||
case 's':
|
||||
silent = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
if ((p = getenv("PATH")) == NULL)
|
||||
exit(EXIT_FAILURE);
|
||||
pathlen = strlen(p) + 1;
|
||||
path = malloc(pathlen);
|
||||
if (path == NULL)
|
||||
err(EXIT_FAILURE, NULL);
|
||||
|
||||
if (argc == 0)
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
while (argc > 0) {
|
||||
memcpy(path, p, pathlen);
|
||||
|
||||
if (strlen(*argv) >= FILENAME_MAX ||
|
||||
print_matches(path, *argv) == -1)
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
|
||||
exit(status);
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
errx(EXIT_FAILURE, "usage: which [-as] program ...");
|
||||
}
|
||||
|
||||
static int
|
||||
is_there(char *candidate)
|
||||
{
|
||||
struct stat fin;
|
||||
|
||||
/* XXX work around access(2) false positives for superuser */
|
||||
if (access(candidate, X_OK) == 0 &&
|
||||
stat(candidate, &fin) == 0 &&
|
||||
S_ISREG(fin.st_mode) &&
|
||||
(getuid() != 0 ||
|
||||
(fin.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0)) {
|
||||
if (!silent)
|
||||
printf("%s\n", candidate);
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
print_matches(char *path, char *filename)
|
||||
{
|
||||
char candidate[PATH_MAX];
|
||||
const char *d;
|
||||
int found;
|
||||
|
||||
if (strchr(filename, '/') != NULL)
|
||||
return (is_there(filename) ? 0 : -1);
|
||||
found = 0;
|
||||
while ((d = strsep(&path, ":")) != NULL) {
|
||||
if (*d == '\0')
|
||||
d = ".";
|
||||
if (snprintf(candidate, sizeof(candidate), "%s/%s", d,
|
||||
filename) >= (int)sizeof(candidate))
|
||||
continue;
|
||||
if (is_there(candidate)) {
|
||||
found = 1;
|
||||
if (!allpaths)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (found ? 0 : -1);
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1995 Andrew McRae. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <pccard/cardinfo.h>
|
||||
#include <pccard/cis.h>
|
||||
#include "readcis.h"
|
||||
|
||||
static void
|
||||
scanfile(name)
|
||||
char *name;
|
||||
{
|
||||
int fd;
|
||||
struct cis *cp;
|
||||
|
||||
fd = open(name, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return;
|
||||
cp = readcis(fd);
|
||||
if (cp) {
|
||||
printf("Configuration data for file %s\n",
|
||||
name);
|
||||
dumpcis(cp);
|
||||
freecis(cp);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
int
|
||||
dumpcisfile_main(int argc, char **argv)
|
||||
{
|
||||
|
||||
isdumpcisfile = 1;
|
||||
for (argc--, argv++; argc; argc--, argv++)
|
||||
scanfile(*argv);
|
||||
return 0;
|
||||
}
|
||||
@@ -59,6 +59,7 @@ struct {
|
||||
{ 460000, 460001, "/packages-4.6-release" },
|
||||
{ 460002, 460099, "/packages-4.6.2-release" },
|
||||
{ 470000, 470099, "/packages-4.7-release" },
|
||||
{ 480000, 480099, "/packages-4.8-release" },
|
||||
{ 300000, 399000, "/packages-3-stable" },
|
||||
{ 400000, 499000, "/packages-4-stable" },
|
||||
{ 510000, 599000, "/packages-5-stable" },
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* FreeBSD install - a package for the installation and maintenance
|
||||
* of non-core utilities.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Maxim Sobolev
|
||||
* 8 September 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "lib.h"
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#undef main
|
||||
|
||||
#define SEPARATORS " \t"
|
||||
|
||||
extern char **environ;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FILE *f;
|
||||
char buffer[FILENAME_MAX], *cp, *verstr;
|
||||
int len;
|
||||
|
||||
if (getenv("PKG_NOWRAP") != NULL)
|
||||
goto nowrap;
|
||||
f = fopen(PKG_WRAPCONF_FNAME, "r");
|
||||
if (f == NULL)
|
||||
goto nowrap;
|
||||
cp = fgets(buffer, 256, f);
|
||||
fclose(f);
|
||||
if (cp == NULL)
|
||||
goto nowrap;
|
||||
len = strlen(cp);
|
||||
if (cp[len - 1] == '\n')
|
||||
cp[len - 1] = '\0';
|
||||
while (strchr(SEPARATORS, *cp) != NULL)
|
||||
cp++;
|
||||
verstr = cp;
|
||||
cp = strpbrk(cp, SEPARATORS);
|
||||
if (cp == NULL)
|
||||
goto nowrap;
|
||||
*cp = '\0';
|
||||
for (cp = verstr; *cp != '\0'; cp++)
|
||||
if (isdigit(*cp) == 0)
|
||||
goto nowrap;
|
||||
if (atoi(verstr) < PKG_INSTALL_VERSION)
|
||||
goto nowrap;
|
||||
cp++;
|
||||
while (*cp != '\0' && strchr(SEPARATORS, *cp) != NULL)
|
||||
cp++;
|
||||
if (*cp == '\0')
|
||||
goto nowrap;
|
||||
bcopy(cp, buffer, strlen(cp) + 1);
|
||||
cp = strpbrk(buffer, SEPARATORS);
|
||||
if (cp != NULL)
|
||||
*cp = '\0';
|
||||
if (!isdir(buffer))
|
||||
goto nowrap;
|
||||
cp = strrchr(argv[0], '/');
|
||||
if (cp == NULL)
|
||||
cp = argv[0];
|
||||
else
|
||||
cp++;
|
||||
strlcat(buffer, "/", sizeof(buffer));
|
||||
strlcat(buffer, cp, sizeof(buffer));
|
||||
setenv("PKG_NOWRAP", "1", 1);
|
||||
execve(buffer, argv, environ);
|
||||
|
||||
nowrap:
|
||||
unsetenv("PKG_NOWRAP");
|
||||
return(real_main(argc, argv));
|
||||
}
|
||||
Reference in new issue
Block a user