Merge from vmcontention

This commit is contained in:
attilio 2012-07-12 02:15:06 +00:00
commit cc7c02f8bf
183 changed files with 4162 additions and 2092 deletions

View File

@ -186,7 +186,7 @@ preadfd(void)
if (rl_cp == NULL)
rl_cp = el_gets(el, &el_len);
if (rl_cp == NULL)
nr = 0;
nr = el_len == 0 ? 0 : -1;
else {
nr = el_len;
if (nr > BUFSIZ)

View File

@ -45,6 +45,7 @@ SRCS= dt_aggregate.c \
gmatch.c
DSRCS= errno.d \
io.d \
psinfo.d \
signal.d \
unistd.d

View File

@ -27,114 +27,50 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#pragma D depends_on module unix
#pragma D depends_on provider io
inline int B_BUSY = B_BUSY;
#pragma D binding "1.0" B_BUSY
inline int B_DONE = 0x00000200;
#pragma D binding "1.0" B_DONE
inline int B_ERROR = B_ERROR;
#pragma D binding "1.0" B_ERROR
inline int B_PAGEIO = B_PAGEIO;
#pragma D binding "1.0" B_PAGEIO
inline int B_PHYS = B_PHYS;
#pragma D binding "1.0" B_PHYS
inline int B_READ = B_READ;
#pragma D binding "1.0" B_READ
inline int B_WRITE = B_WRITE;
#pragma D binding "1.0" B_WRITE
inline int B_ASYNC = 0x00000004;
#pragma D binding "1.0" B_ASYNC
typedef struct bufinfo {
int b_flags; /* buffer status */
size_t b_bcount; /* number of bytes */
caddr_t b_addr; /* buffer address */
uint64_t b_lblkno; /* block # on device */
uint64_t b_blkno; /* expanded block # on device */
size_t b_resid; /* # of bytes not transferred */
size_t b_bufsize; /* size of allocated buffer */
caddr_t b_iodone; /* I/O completion routine */
int b_error; /* expanded error field */
dev_t b_edev; /* extended device */
} bufinfo_t;
#pragma D binding "1.0" translator
translator bufinfo_t < struct buf *B > {
b_flags = B->b_flags;
b_addr = B->b_un.b_addr;
b_bcount = B->b_bcount;
b_lblkno = B->_b_blkno._f;
b_blkno = sizeof (long) == 8 ? B->_b_blkno._f : B->_b_blkno._p._l;
b_resid = B->b_resid;
b_bufsize = B->b_bufsize;
b_iodone = (caddr_t)B->b_iodone;
b_error = B->b_error;
b_edev = B->b_edev;
};
typedef struct devinfo {
int dev_major; /* major number */
int dev_minor; /* minor number */
int dev_instance; /* instance number */
string dev_name; /* name of device */
string dev_statname; /* name of device + instance/minor */
string dev_pathname; /* pathname of device */
int dev_major; /* major number */
int dev_minor; /* minor number */
int dev_instance; /* instance number */
string dev_name; /* name of device */
string dev_statname; /* name of device + instance/minor */
string dev_pathname; /* pathname of device */
} devinfo_t;
#pragma D binding "1.0" translator
translator devinfo_t < struct buf *B > {
dev_major = B->b_dip != NULL ? getmajor(B->b_edev) :
getmajor(B->b_file->v_vfsp->vfs_dev);
dev_minor = B->b_dip != NULL ? getminor(B->b_edev) :
getminor(B->b_file->v_vfsp->vfs_dev);
dev_instance = B->b_dip == NULL ?
getminor(B->b_file->v_vfsp->vfs_dev) :
((struct dev_info *)B->b_dip)->devi_instance;
dev_name = B->b_dip == NULL ? "nfs" :
stringof(`devnamesp[getmajor(B->b_edev)].dn_name);
dev_statname = strjoin(B->b_dip == NULL ? "nfs" :
stringof(`devnamesp[getmajor(B->b_edev)].dn_name),
lltostr(B->b_dip == NULL ? getminor(B->b_file->v_vfsp->vfs_dev) :
((struct dev_info *)B->b_dip)->devi_instance == 0 &&
((struct dev_info *)B->b_dip)->devi_parent != NULL &&
((struct dev_info *)B->b_dip)->devi_parent->devi_node_name ==
"pseudo" ? getminor(B->b_edev) :
((struct dev_info *)B->b_dip)->devi_instance));
dev_pathname = B->b_dip == NULL ? "<nfs>" :
ddi_pathname(B->b_dip, getminor(B->b_edev));
translator devinfo_t < struct devstat *D > {
dev_major = D->device_number;
dev_minor = D->unit_number;
dev_instance = 0;
dev_name = stringof(D->device_name);
dev_statname = stringof(D->device_name);
dev_pathname = stringof(D->device_name);
};
typedef struct fileinfo {
string fi_name; /* name (basename of fi_pathname) */
string fi_dirname; /* directory (dirname of fi_pathname) */
string fi_pathname; /* full pathname */
offset_t fi_offset; /* offset within file */
string fi_fs; /* filesystem */
string fi_mount; /* mount point of file system */
int fi_oflags; /* open(2) flags for file descriptor */
} fileinfo_t;
typedef struct bufinfo {
int b_flags; /* flags */
long b_bcount; /* number of bytes */
caddr_t b_addr; /* buffer address */
uint64_t b_blkno; /* expanded block # on device */
uint64_t b_lblkno; /* block # on device */
size_t b_resid; /* # of bytes not transferred */
size_t b_bufsize; /* size of allocated buffer */
/* caddr_t b_iodone; I/O completion routine */
int b_error; /* expanded error field */
/* dev_t b_edev; extended device */
} bufinfo_t;
#pragma D binding "1.0" translator
translator fileinfo_t < struct buf *B > {
fi_name = B->b_file == NULL ? "<none>" :
B->b_file->v_path == NULL ? "<unknown>" :
basename(cleanpath(B->b_file->v_path));
fi_dirname = B->b_file == NULL ? "<none>" :
B->b_file->v_path == NULL ? "<unknown>" :
dirname(cleanpath(B->b_file->v_path));
fi_pathname = B->b_file == NULL ? "<none>" :
B->b_file->v_path == NULL ? "<unknown>" :
cleanpath(B->b_file->v_path);
fi_offset = B->b_offset;
fi_fs = B->b_file == NULL ? "<none>" :
stringof(B->b_file->v_op->vnop_name);
fi_mount = B->b_file == NULL ? "<none>" :
B->b_file->v_vfsp->vfs_vnodecovered == NULL ? "/" :
B->b_file->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
cleanpath(B->b_file->v_vfsp->vfs_vnodecovered->v_path);
fi_oflags = 0;
translator bufinfo_t < struct bio *B > {
b_flags = B->bio_flags;
b_bcount = B->bio_bcount;
b_addr = B->bio_data;
b_blkno = 0;
b_lblkno = 0;
b_resid = B->bio_resid;
b_bufsize = 0; /* XXX gnn */
b_error = B->bio_error;
};
/*
@ -158,63 +94,17 @@ inline int O_APPEND = 0x0008;
#pragma D binding "1.1" O_APPEND
inline int O_CREAT = 0x0200;
#pragma D binding "1.1" O_CREAT
inline int O_DSYNC = O_DSYNC;
#pragma D binding "1.1" O_DSYNC
inline int O_EXCL = 0x0800;
#pragma D binding "1.1" O_EXCL
inline int O_LARGEFILE = O_LARGEFILE;
#pragma D binding "1.1" O_LARGEFILE
inline int O_NOCTTY = 0x8000;
#pragma D binding "1.1" O_NOCTTY
inline int O_NONBLOCK = 0x0004;
#pragma D binding "1.1" O_NONBLOCK
inline int O_NDELAY = 0x0004;
#pragma D binding "1.1" O_NDELAY
inline int O_RSYNC = O_RSYNC;
#pragma D binding "1.1" O_RSYNC
inline int O_SYNC = 0x0080;
#pragma D binding "1.1" O_SYNC
inline int O_TRUNC = 0x0400;
#pragma D binding "1.1" O_TRUNC
inline int O_XATTR = O_XATTR;
#pragma D binding "1.1" O_XATTR
#pragma D binding "1.1" translator
translator fileinfo_t < struct file *F > {
fi_name = F == NULL ? "<none>" :
F->f_vnode->v_path == NULL ? "<unknown>" :
basename(cleanpath(F->f_vnode->v_path));
fi_dirname = F == NULL ? "<none>" :
F->f_vnode->v_path == NULL ? "<unknown>" :
dirname(cleanpath(F->f_vnode->v_path));
fi_pathname = F == NULL ? "<none>" :
F->f_vnode->v_path == NULL ? "<unknown>" :
cleanpath(F->f_vnode->v_path);
fi_offset = F == NULL ? 0 : F->f_offset;
fi_fs = F == NULL ? "<none>" : stringof(F->f_vnode->v_op->vnop_name);
fi_mount = F == NULL ? "<none>" :
F->f_vnode->v_vfsp->vfs_vnodecovered == NULL ? "/" :
F->f_vnode->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
cleanpath(F->f_vnode->v_vfsp->vfs_vnodecovered->v_path);
fi_oflags = F == NULL ? 0 : F->f_flag + (int)FOPEN;
};
inline fileinfo_t fds[int fd] = xlate <fileinfo_t> (
fd >= 0 && fd < curthread->t_procp->p_user.u_finfo.fi_nfiles ?
curthread->t_procp->p_user.u_finfo.fi_list[fd].uf_file : NULL);
#pragma D attributes Stable/Stable/Common fds
#pragma D binding "1.1" fds
#pragma D binding "1.2" translator
translator fileinfo_t < struct vnode *V > {
fi_name = V->v_path == NULL ? "<unknown>" :
basename(cleanpath(V->v_path));
fi_dirname = V->v_path == NULL ? "<unknown>" :
dirname(cleanpath(V->v_path));
fi_pathname = V->v_path == NULL ? "<unknown>" : cleanpath(V->v_path);
fi_fs = stringof(V->v_op->vnop_name);
fi_mount = V->v_vfsp->vfs_vnodecovered == NULL ? "/" :
V->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
cleanpath(V->v_vfsp->vfs_vnodecovered->v_path);
};

View File

@ -123,6 +123,7 @@ firewall_script="/etc/rc.firewall" # Which script to run to set up the firewall
firewall_type="UNKNOWN" # Firewall type (see /etc/rc.firewall)
firewall_quiet="NO" # Set to YES to suppress rule display
firewall_logging="NO" # Set to YES to enable events logging
firewall_logif="NO" # Set to YES to create logging-pseudo interface
firewall_flags="" # Flags passed to ipfw when type is a file
firewall_coscripts="" # List of executables/scripts to run after
# firewall starts/stops

View File

@ -320,7 +320,7 @@ notify 10 {
notify 0 {
match "system" "RCTL";
match "rule" "user:70:swap:.*";
action "/usr/local/etc/rc.d/postgresql restart"
action "/usr/local/etc/rc.d/postgresql restart";
};
*/

View File

@ -57,6 +57,10 @@ ipfw_start()
echo 'Firewall logging enabled.'
sysctl net.inet.ip.fw.verbose=1 >/dev/null
fi
if checkyesno firewall_logif; then
ifconfig ipfw0 create
echo 'Firewall logging pseudo-interface (ipfw0) created.'
fi
}
ipfw_poststart()

View File

@ -13,8 +13,9 @@
name="rarpd"
rcvar="rarpd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/ethers"
load_rc_config $name
pidfile="${rarpd_pidfile:-/var/run/${name}.pid}"
run_rc_command "$1"

View File

@ -68,7 +68,7 @@ __getcontextx_size(void)
" movl %%ebx,%1\n"
" popl %%ebx\n"
: "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3])
: "0" (0x0));
: "0" (0x1));
if ((p[2] & CPUID2_OSXSAVE) != 0) {
__asm __volatile(
" pushl %%ebx\n"

View File

@ -365,9 +365,6 @@ FBSD_1.2 {
cap_getmode;
cap_new;
cap_getrights;
ffclock_getcounter;
ffclock_getestimate;
ffclock_setestimate;
getloginclass;
pdfork;
pdgetpid;
@ -382,6 +379,9 @@ FBSD_1.2 {
};
FBSD_1.3 {
ffclock_getcounter;
ffclock_getestimate;
ffclock_setestimate;
posix_fadvise;
};

View File

@ -162,6 +162,11 @@ is modified to contain the number of characters read.
Returns the line read if successful, or
.Dv NULL
if no characters were read or if an error occurred.
If an error occurred,
.Fa count
is set to \-1 and
.Dv errno
contains the error code that caused it.
The return value may not remain valid across calls to
.Fn el_gets
and must be copied if the data is to be retained.

View File

@ -115,6 +115,7 @@ struct editline {
FILE *el_errfile; /* Stdio stuff */
int el_infd; /* Input file descriptor */
int el_flags; /* Various flags. */
int el_errno; /* Local copy of errno */
coord_t el_cursor; /* Cursor location */
char **el_display; /* Real screen image = what is there */
char **el_vdisplay; /* Virtual screen image = what we see */

View File

@ -235,9 +235,12 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
el_action_t cmd;
int num;
el->el_errno = 0;
do {
if ((num = el_getc(el, ch)) != 1) /* if EOF or error */
if ((num = el_getc(el, ch)) != 1) { /* if EOF or error */
el->el_errno = num == 0 ? 0 : errno;
return (num);
}
#ifdef KANJI
if ((*ch & 0200)) {
@ -289,14 +292,21 @@ read_char(EditLine *el, char *cp)
ssize_t num_read;
int tried = 0;
while ((num_read = read(el->el_infd, cp, 1)) == -1)
again:
el->el_signal->sig_no = 0;
while ((num_read = read(el->el_infd, cp, 1)) == -1) {
if (el->el_signal->sig_no == SIGCONT) {
sig_set(el);
el_set(el, EL_REFRESH);
goto again;
}
if (!tried && read__fixio(el->el_infd, errno) == 0)
tried = 1;
else {
*cp = '\0';
return (-1);
}
}
return (int)num_read;
}
@ -403,10 +413,13 @@ el_gets(EditLine *el, int *nread)
int num; /* how many chars we have read at NL */
char ch;
int crlf = 0;
int nrb;
#ifdef FIONREAD
c_macro_t *ma = &el->el_chared.c_macro;
#endif /* FIONREAD */
if (nread == NULL)
nread = &nrb;
*nread = 0;
if (el->el_flags & NO_TTY) {
@ -427,12 +440,13 @@ el_gets(EditLine *el, int *nread)
if (cp[-1] == '\r' || cp[-1] == '\n')
break;
}
if (num == -1)
el->el_errno = errno;
el->el_line.cursor = el->el_line.lastchar = cp;
*cp = '\0';
if (nread)
*nread = (int)(el->el_line.cursor - el->el_line.buffer);
return (*nread ? el->el_line.buffer : NULL);
*nread = (int)(el->el_line.cursor - el->el_line.buffer);
goto done;
}
@ -443,8 +457,8 @@ el_gets(EditLine *el, int *nread)
(void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
if (chrs == 0) {
if (tty_rawmode(el) < 0) {
if (nread)
*nread = 0;
errno = 0;
*nread = 0;
return (NULL);
}
}
@ -457,6 +471,7 @@ el_gets(EditLine *el, int *nread)
if (el->el_flags & EDIT_DISABLED) {
char *cp;
size_t idx;
if ((el->el_flags & UNBUFFERED) == 0)
cp = el->el_line.buffer;
else
@ -480,11 +495,13 @@ el_gets(EditLine *el, int *nread)
break;
}
if (num == -1) {
el->el_errno = errno;
}
el->el_line.cursor = el->el_line.lastchar = cp;
*cp = '\0';
if (nread)
*nread = (int)(el->el_line.cursor - el->el_line.buffer);
return (*nread ? el->el_line.buffer : NULL);
goto done;
}
for (num = OKCMD; num == OKCMD;) { /* while still editing this
@ -617,12 +634,17 @@ el_gets(EditLine *el, int *nread)
/* make sure the tty is set up correctly */
if ((el->el_flags & UNBUFFERED) == 0) {
read_finish(el);
if (nread)
*nread = num;
*nread = num != -1 ? num : 0;
} else {
if (nread)
*nread =
(int)(el->el_line.lastchar - el->el_line.buffer);
*nread = (int)(el->el_line.lastchar - el->el_line.buffer);
}
return (num ? el->el_line.buffer : NULL);
done:
if (*nread == 0) {
if (num == -1) {
*nread = -1;
errno = el->el_errno;
}
return NULL;
} else
return el->el_line.buffer;
}

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $NetBSD: sig.c,v 1.14 2009/02/18 15:04:40 christos Exp $
* $NetBSD: sig.c,v 1.15 2009/02/19 15:20:22 christos Exp $
*/
#if !defined(lint) && !defined(SCCSID)
@ -73,6 +73,8 @@ sig_handler(int signo)
(void) sigaddset(&nset, signo);
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
sel->el_signal->sig_no = signo;
switch (signo) {
case SIGCONT:
tty_rawmode(sel);
@ -158,12 +160,12 @@ sig_set(EditLine *el)
struct sigaction osa, nsa;
nsa.sa_handler = sig_handler;
nsa.sa_flags = 0;
sigemptyset(&nsa.sa_mask);
(void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
for (i = 0; sighdl[i] != -1; i++) {
nsa.sa_flags = SIGINT ? 0 : SA_RESTART;
/* This could happen if we get interrupted */
if (sigaction(sighdl[i], &nsa, &osa) != -1 &&
osa.sa_handler != sig_handler)

View File

@ -30,7 +30,7 @@
* SUCH DAMAGE.
*
* @(#)sig.h 8.1 (Berkeley) 6/4/93
* $NetBSD: sig.h,v 1.7 2009/02/15 21:25:01 christos Exp $
* $NetBSD: sig.h,v 1.8 2009/02/19 15:20:22 christos Exp $
* $FreeBSD$
*/
@ -61,6 +61,7 @@
typedef struct {
struct sigaction sig_action[ALLSIGSNO];
sigset_t sig_set;
volatile sig_atomic_t sig_no;
} *el_signal_t;
protected void sig_end(EditLine*);

View File

@ -509,8 +509,6 @@ static struct cmd inet6_cmds[] = {
DEF_CMD("-ifdisabled", -ND6_IFF_IFDISABLED, setnd6flags),
DEF_CMD("nud", ND6_IFF_PERFORMNUD, setnd6flags),
DEF_CMD("-nud", -ND6_IFF_PERFORMNUD, setnd6flags),
DEF_CMD("prefer_source",ND6_IFF_PREFER_SOURCE, setnd6flags),
DEF_CMD("-prefer_source",-ND6_IFF_PREFER_SOURCE,setnd6flags),
DEF_CMD("auto_linklocal",ND6_IFF_AUTO_LINKLOCAL,setnd6flags),
DEF_CMD("-auto_linklocal",-ND6_IFF_AUTO_LINKLOCAL,setnd6flags),
DEF_CMD_ARG("pltime", setip6pltime),

View File

@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
.Dd May 27, 2012
.Dd July 9, 2012
.Dt IFCONFIG 8
.Os
.Sh NAME
@ -716,12 +716,6 @@ Set a flag to enable Neighbor Unreachability Detection.
.It Cm -nud
Clear a flag
.Cm nud .
.It Cm prefer_source
Set a flag to prefer addresses on the interface as candidates of the
source address for outgoing packets.
.It Cm -prefer_source
Clear a flag
.Cm prefer_source .
.El
.Pp
The following parameters are specific to cloning

View File

@ -1,7 +1,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 3, 2012
.Dd July 9, 2012
.Dt IPFW 8
.Os
.Sh NAME
@ -560,7 +560,22 @@ is set to 0 (default), one can use
.Xr bpf 4
attached to the
.Li ipfw0
pseudo interface. There is no overhead if no
pseudo interface.
This pseudo interface can be created after a boot
manually by using the following command:
.Bd -literal -offset indent
# ifconfig ipfw0 create
.Ed
.Pp
Or, automatically at boot time by adding the following
line to the
.Xr rc.conf 5
file:
.Bd -literal -offset indent
firewall_logif="YES"
.Ed
.Pp
There is no overhead if no
.Xr bpf 4
is attached to the pseudo interface.
.Pp

View File

@ -16,7 +16,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd June 7, 2012
.Dd July 9, 2012
.Dt RUN 4
.Os
.Sh NAME
@ -122,6 +122,8 @@ driver supports the following wireless adapters:
.It Buffalo WLI-UC-G300N
.It Buffalo WLI-UC-G301N
.It Buffalo WLI-UC-GN
.It Buffalo WLI-UC-GNM
.It Buffalo WLI-UC-GNM2
.It Corega CG-WLUSB2GNL
.It Corega CG-WLUSB2GNR
.It Corega CG-WLUSB300AGN
@ -142,6 +144,7 @@ driver supports the following wireless adapters:
.It Hercules HWNU-300
.It Linksys WUSB54GC v3
.It Linksys WUSB600N
.It Logitec LAN-W150N/U2
.It Mvix Nubbin MS-811N
.It Planex GW-USMicroN
.It Planex GW-US300MiniS

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd May 6, 2012
.Dd July 9, 2012
.Dt RC.CONF 5
.Os
.Sh NAME
@ -501,6 +501,16 @@ to enable firewall event logging.
This is equivalent to the
.Dv IPFIREWALL_VERBOSE
kernel option.
.It Va firewall_logif
.Pq Vt bool
Set to
.Dq Li YES
to create pseudo interface
.Li ipfw0
for logging.
For more details, see
.Xr ipfw 8
manual page.
.It Va firewall_flags
.Pq Vt str
Flags passed to

View File

@ -73,10 +73,6 @@ __FBSDID("$FreeBSD$");
#define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr)))
#define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr)))
#define ldmxcsr(csr) __asm __volatile("ldmxcsr %0" : : "m" (csr))
#define start_emulating() __asm __volatile( \
"smsw %%ax; orb %0,%%al; lmsw %%ax" \
: : "n" (CR0_TS) : "ax")
#define stop_emulating() __asm __volatile("clts")
static __inline void
xrstor(char *addr, uint64_t mask)
@ -109,13 +105,14 @@ void fnstsw(caddr_t addr);
void fxsave(caddr_t addr);
void fxrstor(caddr_t addr);
void ldmxcsr(u_int csr);
void start_emulating(void);
void stop_emulating(void);
void xrstor(char *addr, uint64_t mask);
void xsave(char *addr, uint64_t mask);
#endif /* __GNUCLIKE_ASM && !lint */
#define start_emulating() load_cr0(rcr0() | CR0_TS)
#define stop_emulating() clts()
#define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_cw)
#define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_sw)

View File

@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
#include <sys/linker.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/memrange.h>
#include <sys/msgbuf.h>
#include <sys/mutex.h>
#include <sys/pcpu.h>
@ -206,6 +207,8 @@ struct pcpu __pcpu[MAXCPU];
struct mtx icu_lock;
struct mem_range_softc mem_range_softc;
struct mtx dt_lock; /* lock for GDT and LDT */
static void

View File

@ -72,8 +72,6 @@ __FBSDID("$FreeBSD$");
*/
MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors");
struct mem_range_softc mem_range_softc;
/* ARGSUSED */
int
memrw(struct cdev *dev, struct uio *uio, int flags)

View File

@ -106,6 +106,13 @@ clflush(u_long addr)
__asm __volatile("clflush %0" : : "m" (*(char *)addr));
}
static __inline void
clts(void)
{
__asm __volatile("clts");
}
static __inline void
disable_intr(void)
{
@ -702,6 +709,9 @@ intr_restore(register_t rflags)
int breakpoint(void);
u_int bsfl(u_int mask);
u_int bsrl(u_int mask);
void clflush(u_long addr);
void clts(void);
void cpuid_count(u_int ax, u_int cx, u_int *p);
void disable_intr(void);
void do_cpuid(u_int ax, u_int *p);
void enable_intr(void);

View File

@ -270,10 +270,12 @@ at91_attach(device_t dev)
}
/* Our device list will be added automatically by the cpu device
/*
* Our device list will be added automatically by the cpu device
* e.g. at91rm9200.c when it is identified. To ensure that the
* CPU and PMC are attached first any other "identified" devices
* call BUS_ADD_CHILD(9) with an "order" of at least 2. */
* call BUS_ADD_CHILD(9) with an "order" of at least 2.
*/
bus_generic_probe(dev);
bus_generic_attach(dev);
@ -363,7 +365,7 @@ at91_setup_intr(device_t dev, device_t child,
struct at91_softc *sc = device_get_softc(dev);
int error;
if (rman_get_start(ires) == sc->sc_irq_system && filt == NULL)
if (rman_get_start(ires) == AT91_IRQ_SYSTEM && filt == NULL)
panic("All system interrupt ISRs must be FILTER");
error = BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags,
filt, intr, arg, cookiep);
@ -471,6 +473,41 @@ at91_eoi(void *unused)
IC_EOICR, 0);
}
void
at91_add_child(device_t dev, int prio, const char *name, int unit,
bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
device_t kid;
struct at91_ivar *ivar;
kid = device_add_child_ordered(dev, prio, name, unit);
if (kid == NULL) {
printf("Can't add child %s%d ordered\n", name, unit);
return;
}
ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ivar == NULL) {
device_delete_child(dev, kid);
printf("Can't add alloc ivar\n");
return;
}
device_set_ivars(kid, ivar);
resource_list_init(&ivar->resources);
if (irq0 != -1) {
bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
if (irq0 != AT91_IRQ_SYSTEM)
at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
}
if (irq1 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
if (irq2 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
if (addr != 0 && addr < AT91_BASE)
addr += AT91_BASE;
if (addr != 0)
bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
static device_method_t at91_methods[] = {
DEVMETHOD(device_probe, at91_probe),
DEVMETHOD(device_attach, at91_attach),

View File

@ -90,6 +90,8 @@ __FBSDID("$FreeBSD$");
#include <arm/at91/at91board.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91soc.h>
#include <arm/at91/at91_usartreg.h>
#include <arm/at91/at91rm92reg.h>
#include <arm/at91/at91sam9g20reg.h>
@ -115,10 +117,6 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -126,7 +124,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;
@ -282,7 +279,7 @@ static const char *soc_subtype_name[] = {
[AT91_ST_SAM9X35] = "at91sam9x35",
};
struct at91_soc_info soc_data;
struct at91_soc_info soc_info;
/*
* Read the SoC ID from the CIDR register and try to match it against the
@ -295,103 +292,117 @@ at91_try_id(uint32_t dbgu_base)
{
uint32_t socid;
soc_data.cidr = *(volatile uint32_t *)(AT91_BASE + dbgu_base +
soc_info.cidr = *(volatile uint32_t *)(AT91_BASE + dbgu_base +
DBGU_C1R);
socid = soc_data.cidr & ~AT91_CPU_VERSION_MASK;
socid = soc_info.cidr & ~AT91_CPU_VERSION_MASK;
soc_data.type = AT91_T_NONE;
soc_data.subtype = AT91_ST_NONE;
soc_data.family = (soc_data.cidr & AT91_CPU_FAMILY_MASK) >> 20;
soc_data.exid = *(volatile uint32_t *)(AT91_BASE + dbgu_base +
soc_info.type = AT91_T_NONE;
soc_info.subtype = AT91_ST_NONE;
soc_info.family = (soc_info.cidr & AT91_CPU_FAMILY_MASK) >> 20;
soc_info.exid = *(volatile uint32_t *)(AT91_BASE + dbgu_base +
DBGU_C2R);
switch (socid) {
case AT91_CPU_CAP9:
soc_data.type = AT91_T_CAP9;
soc_info.type = AT91_T_CAP9;
break;
case AT91_CPU_RM9200:
soc_data.type = AT91_T_RM9200;
soc_info.type = AT91_T_RM9200;
break;
case AT91_CPU_SAM9XE128:
case AT91_CPU_SAM9XE256:
case AT91_CPU_SAM9XE512:
case AT91_CPU_SAM9260:
soc_data.type = AT91_T_SAM9260;
if (soc_data.family == AT91_FAMILY_SAM9XE)
soc_data.subtype = AT91_ST_SAM9XE;
soc_info.type = AT91_T_SAM9260;
if (soc_info.family == AT91_FAMILY_SAM9XE)
soc_info.subtype = AT91_ST_SAM9XE;
break;
case AT91_CPU_SAM9261:
soc_data.type = AT91_T_SAM9261;
soc_info.type = AT91_T_SAM9261;
break;
case AT91_CPU_SAM9263:
soc_data.type = AT91_T_SAM9263;
soc_info.type = AT91_T_SAM9263;
break;
case AT91_CPU_SAM9G10:
soc_data.type = AT91_T_SAM9G10;
soc_info.type = AT91_T_SAM9G10;
break;
case AT91_CPU_SAM9G20:
soc_data.type = AT91_T_SAM9G20;
soc_info.type = AT91_T_SAM9G20;
break;
case AT91_CPU_SAM9G45:
soc_data.type = AT91_T_SAM9G45;
soc_info.type = AT91_T_SAM9G45;
break;
case AT91_CPU_SAM9N12:
soc_data.type = AT91_T_SAM9N12;
soc_info.type = AT91_T_SAM9N12;
break;
case AT91_CPU_SAM9RL64:
soc_data.type = AT91_T_SAM9RL;
soc_info.type = AT91_T_SAM9RL;
break;
case AT91_CPU_SAM9X5:
soc_data.type = AT91_T_SAM9X5;
soc_info.type = AT91_T_SAM9X5;
break;
default:
return (0);
}
switch (soc_data.type) {
switch (soc_info.type) {
case AT91_T_SAM9G45:
switch (soc_data.exid) {
switch (soc_info.exid) {
case AT91_EXID_SAM9G45:
soc_data.subtype = AT91_ST_SAM9G45;
soc_info.subtype = AT91_ST_SAM9G45;
break;
case AT91_EXID_SAM9G46:
soc_data.subtype = AT91_ST_SAM9G46;
soc_info.subtype = AT91_ST_SAM9G46;
break;
case AT91_EXID_SAM9M10:
soc_data.subtype = AT91_ST_SAM9M10;
soc_info.subtype = AT91_ST_SAM9M10;
break;
case AT91_EXID_SAM9M11:
soc_data.subtype = AT91_ST_SAM9M11;
soc_info.subtype = AT91_ST_SAM9M11;
break;
}
break;
case AT91_T_SAM9X5:
switch (soc_data.exid) {
switch (soc_info.exid) {
case AT91_EXID_SAM9G15:
soc_data.subtype = AT91_ST_SAM9G15;
soc_info.subtype = AT91_ST_SAM9G15;
break;
case AT91_EXID_SAM9G25:
soc_data.subtype = AT91_ST_SAM9G25;
soc_info.subtype = AT91_ST_SAM9G25;
break;
case AT91_EXID_SAM9G35:
soc_data.subtype = AT91_ST_SAM9G35;
soc_info.subtype = AT91_ST_SAM9G35;
break;
case AT91_EXID_SAM9X25:
soc_data.subtype = AT91_ST_SAM9X25;
soc_info.subtype = AT91_ST_SAM9X25;
break;
case AT91_EXID_SAM9X35:
soc_data.subtype = AT91_ST_SAM9X35;
soc_info.subtype = AT91_ST_SAM9X35;
break;
}
break;
default:
break;
}
snprintf(soc_data.name, sizeof(soc_data.name), "%s%s%s",
soc_type_name[soc_data.type],
soc_data.subtype == AT91_ST_NONE ? "" : " subtype ",
soc_data.subtype == AT91_ST_NONE ? "" :
soc_subtype_name[soc_data.subtype]);
/*
* Disable interrupts in the DBGU unit...
*/
*(volatile uint32_t *)(AT91_BASE + dbgu_base + USART_IDR) = 0xffffffff;
/*
* Save the name for later...
*/
snprintf(soc_info.name, sizeof(soc_info.name), "%s%s%s",
soc_type_name[soc_info.type],
soc_info.subtype == AT91_ST_NONE ? "" : " subtype ",
soc_info.subtype == AT91_ST_NONE ? "" :
soc_subtype_name[soc_info.subtype]);
/*
* try to get the matching CPU support.
*/
soc_info.soc_data = at91_match_soc(soc_info.type, soc_info.subtype);
return (1);
}
@ -544,6 +555,9 @@ initarm(struct arm_boot_params *abp)
cninit();
if (soc_info.soc_data == NULL)
printf("Warning: No soc support for %s found.\n", soc_info.name);
memsize = board_init();
physmem = memsize / PAGE_SIZE;
@ -633,16 +647,16 @@ void
DELAY(int n)
{
if (soc_data.delay)
soc_data.delay(n);
if (soc_info.soc_data)
soc_info.soc_data->soc_delay(n);
}
void
cpu_reset(void)
{
if (soc_data.reset)
soc_data.reset();
if (soc_info.soc_data)
soc_info.soc_data->soc_reset();
while (1)
continue;
}

View File

@ -313,7 +313,7 @@ static int
at91_mci_is_mci1rev2xx(void)
{
switch (soc_data.type) {
switch (soc_info.type) {
case AT91_T_SAM9260:
case AT91_T_SAM9263:
case AT91_T_CAP9:

View File

@ -59,7 +59,7 @@ static struct pit_softc {
} *sc;
static uint32_t timecount = 0;
static unsigned at91pit_get_timecount(struct timecounter *tc);
static unsigned at91_pit_get_timecount(struct timecounter *tc);
static int pit_intr(void *arg);
static inline uint32_t
@ -76,8 +76,8 @@ WR4(struct pit_softc *sc, bus_size_t off, uint32_t val)
bus_write_4(sc->mem_res, off, val);
}
static void
at91pit_delay(int us)
void
at91_pit_delay(int us)
{
int32_t cnt, last, piv;
uint64_t pit_freq;
@ -99,8 +99,8 @@ at91pit_delay(int us)
}
}
static struct timecounter at91pit_timecounter = {
at91pit_get_timecount, /* get_timecount */
static struct timecounter at91_pit_timecounter = {
at91_pit_get_timecount, /* get_timecount */
NULL, /* no poll_pps */
0xffffffff, /* counter mask */
0 / PIT_PRESCALE, /* frequency */
@ -109,7 +109,7 @@ static struct timecounter at91pit_timecounter = {
};
static int
at91pit_probe(device_t dev)
at91_pit_probe(device_t dev)
{
device_set_desc(dev, "AT91SAM9 PIT");
@ -117,7 +117,7 @@ at91pit_probe(device_t dev)
}
static int
at91pit_attach(device_t dev)
at91_pit_attach(device_t dev)
{
void *ih;
int rid, err = 0;
@ -148,32 +148,31 @@ at91pit_attach(device_t dev)
err = bus_setup_intr(dev, irq, INTR_TYPE_CLK, pit_intr, NULL, NULL,
&ih);
at91pit_timecounter.tc_frequency = at91_master_clock / PIT_PRESCALE;
tc_init(&at91pit_timecounter);
at91_pit_timecounter.tc_frequency = at91_master_clock / PIT_PRESCALE;
tc_init(&at91_pit_timecounter);
/* Enable the PIT here. */
WR4(sc, PIT_MR, PIT_PIV(at91_master_clock / PIT_PRESCALE / hz) |
PIT_EN | PIT_IEN);
soc_data.delay = at91pit_delay;
out:
return (err);
}
static device_method_t at91pit_methods[] = {
DEVMETHOD(device_probe, at91pit_probe),
DEVMETHOD(device_attach, at91pit_attach),
static device_method_t at91_pit_methods[] = {
DEVMETHOD(device_probe, at91_pit_probe),
DEVMETHOD(device_attach, at91_pit_attach),
DEVMETHOD_END
};
static driver_t at91pit_driver = {
static driver_t at91_pit_driver = {
"at91_pit",
at91pit_methods,
at91_pit_methods,
sizeof(struct pit_softc),
};
static devclass_t at91pit_devclass;
static devclass_t at91_pit_devclass;
DRIVER_MODULE(at91_pit, atmelarm, at91pit_driver, at91pit_devclass, NULL,
DRIVER_MODULE(at91_pit, atmelarm, at91_pit_driver, at91_pit_devclass, NULL,
NULL);
static int
@ -195,7 +194,7 @@ pit_intr(void *arg)
}
static unsigned
at91pit_get_timecount(struct timecounter *tc)
at91_pit_get_timecount(struct timecounter *tc)
{
uint32_t piir, icnt;

View File

@ -25,8 +25,8 @@
/* $FreeBSD$ */
#ifndef ARM_AT91_AT91PITREG_H
#define ARM_AT91_AT91PITREG_H
#ifndef ARM_AT91_AT91_PITREG_H
#define ARM_AT91_AT91_PITREG_H
#define PIT_MR 0x0
#define PIT_SR 0x4
@ -42,4 +42,6 @@
/* PIT_SR */
#define PIT_PITS_DONE 1 /* interrupt done */
#endif /* ARM_AT91_AT91PITREG_H */
void at91_pit_delay(int us);
#endif /* ARM_AT91_AT91_PITREG_H */

View File

@ -1,13 +1,14 @@
#include <machine/asm.h>
#include <arm/at91/at91_rstreg.h>
#include <arm/at91/at91reg.h>
#include <arm/at91/at91sam9g20reg.h>
__FBSDID("$FreeBSD$");
#define SDRAM_TR (AT91SAM9G20_BASE + \
#define SDRAM_TR (AT91_BASE + \
AT91SAM9G20_SDRAMC_BASE + AT91SAM9G20_SDRAMC_TR)
#define SDRAM_LPR (AT91SAM9G20_BASE + \
#define SDRAM_LPR (AT91_BASE + \
AT91SAM9G20_SDRAMC_BASE + AT91SAM9G20_SDRAMC_LPR)
#define RSTC_RCR (AT91SAM9G20_BASE + \
#define RSTC_RCR (AT91_BASE + \
AT91SAM9G20_RSTC_BASE + RST_CR)
/*

View File

@ -42,26 +42,26 @@ __FBSDID("$FreeBSD$");
#define RST_TIMEOUT (5) /* Seconds to hold NRST for hard reset */
#define RST_TICK (20) /* sample NRST at hz/RST_TICK intervals */
static int at91rst_intr(void *arg);
static int at91_rst_intr(void *arg);
static struct at91rst_softc {
static struct at91_rst_softc {
struct resource *mem_res; /* Memory resource */
struct resource *irq_res; /* IRQ resource */
void *intrhand; /* Interrupt handle */
struct callout tick_ch; /* Tick callout */
device_t sc_dev;
u_int shutdown; /* Shutdown in progress */
} *at91rst_sc;
} *at91_rst_sc;
static inline uint32_t
RD4(struct at91rst_softc *sc, bus_size_t off)
RD4(struct at91_rst_softc *sc, bus_size_t off)
{
return (bus_read_4(sc->mem_res, off));
}
static inline void
WR4(struct at91rst_softc *sc, bus_size_t off, uint32_t val)
WR4(struct at91_rst_softc *sc, bus_size_t off, uint32_t val)
{
bus_write_4(sc->mem_res, off, val);
@ -70,17 +70,17 @@ WR4(struct at91rst_softc *sc, bus_size_t off, uint32_t val)
void cpu_reset_sam9g20(void) __attribute__((weak));
void cpu_reset_sam9g20(void) {}
static void
at91rst_cpu_reset(void)
void
at91_rst_cpu_reset(void)
{
if (at91rst_sc) {
if (at91_rst_sc) {
cpu_reset_sam9g20(); /* May be null */
WR4(at91rst_sc, RST_MR,
WR4(at91_rst_sc, RST_MR,
RST_MR_ERSTL(0xd) | RST_MR_URSTEN | RST_MR_KEY);
WR4(at91rst_sc, RST_CR,
WR4(at91_rst_sc, RST_CR,
RST_CR_PROCRST |
RST_CR_PERRST |
RST_CR_EXTRST |
@ -91,7 +91,7 @@ at91rst_cpu_reset(void)
}
static int
at91rst_probe(device_t dev)
at91_rst_probe(device_t dev)
{
device_set_desc(dev, "AT91SAM9 Reset Controller");
@ -99,13 +99,13 @@ at91rst_probe(device_t dev)
}
static int
at91rst_attach(device_t dev)
at91_rst_attach(device_t dev)
{
struct at91rst_softc *sc;
struct at91_rst_softc *sc;
const char *cause;
int rid, err;
at91rst_sc = sc = device_get_softc(dev);
at91_rst_sc = sc = device_get_softc(dev);
sc->sc_dev = dev;
callout_init(&sc->tick_ch, 0);
@ -129,11 +129,11 @@ at91rst_attach(device_t dev)
/* Activate the interrupt. */
err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
at91rst_intr, NULL, sc, &sc->intrhand);
at91_rst_intr, NULL, sc, &sc->intrhand);
if (err)
device_printf(dev, "could not establish interrupt handler.\n");
WR4(at91rst_sc, RST_MR, RST_MR_ERSTL(0xd) | RST_MR_URSIEN | RST_MR_KEY);
WR4(at91_rst_sc, RST_MR, RST_MR_ERSTL(0xd) | RST_MR_URSIEN | RST_MR_KEY);
switch (RD4(sc, RST_SR) & RST_SR_RST_MASK) {
case RST_SR_RST_POW:
@ -157,15 +157,14 @@ at91rst_attach(device_t dev)
}
device_printf(dev, "Reset cause: %s.\n", cause);
soc_data.reset = at91rst_cpu_reset;
out:
return (err);
}
static void
at91rst_tick(void *argp)
at91_rst_tick(void *argp)
{
struct at91rst_softc *sc = argp;
struct at91_rst_softc *sc = argp;
if (sc->shutdown++ >= RST_TIMEOUT * RST_TICK) {
/* User released the button in morre than RST_TIMEOUT */
@ -176,36 +175,36 @@ at91rst_tick(void *argp)
device_printf(sc->sc_dev, "shutting down...\n");
shutdown_nice(0);
} else {
callout_reset(&sc->tick_ch, hz/RST_TICK, at91rst_tick, sc);
callout_reset(&sc->tick_ch, hz/RST_TICK, at91_rst_tick, sc);
}
}
static int
at91rst_intr(void *argp)
at91_rst_intr(void *argp)
{
struct at91rst_softc *sc = argp;
struct at91_rst_softc *sc = argp;
if (RD4(sc, RST_SR) & RST_SR_URSTS) {
if (sc->shutdown == 0)
callout_reset(&sc->tick_ch, hz/RST_TICK, at91rst_tick, sc);
callout_reset(&sc->tick_ch, hz/RST_TICK, at91_rst_tick, sc);
return (FILTER_HANDLED);
}
return (FILTER_STRAY);
}
static device_method_t at91rst_methods[] = {
DEVMETHOD(device_probe, at91rst_probe),
DEVMETHOD(device_attach, at91rst_attach),
static device_method_t at91_rst_methods[] = {
DEVMETHOD(device_probe, at91_rst_probe),
DEVMETHOD(device_attach, at91_rst_attach),
DEVMETHOD_END
};
static driver_t at91rst_driver = {
static driver_t at91_rst_driver = {
"at91_rst",
at91rst_methods,
sizeof(struct at91rst_softc),
at91_rst_methods,
sizeof(struct at91_rst_softc),
};
static devclass_t at91rst_devclass;
static devclass_t at91_rst_devclass;
DRIVER_MODULE(at91_rst, atmelarm, at91rst_driver, at91rst_devclass, NULL,
DRIVER_MODULE(at91_rst, atmelarm, at91_rst_driver, at91_rst_devclass, NULL,
NULL);

View File

@ -25,8 +25,8 @@
/* $FreeBSD$ */
#ifndef ARM_AT91_AT91RSTREG_H
#define ARM_AT91_AT91RSTREG_H
#ifndef ARM_AT91_AT91_RSTREG_H
#define ARM_AT91_AT91_RSTREG_H
#define RST_CR 0x0 /* Control Register */
#define RST_SR 0x4 /* Status Register */
@ -56,4 +56,8 @@
#define RST_MR_ERSTL(x) ((x)<<8) /* External reset length */
#define RST_MR_KEY (0xa5<<24)
#endif /* ARM_AT91_AT91RSTREG_H */
#ifndef __ASSEMBLER__
void at91_rst_cpu_reset(void);
#endif
#endif /* ARM_AT91_AT91_RSTREG_H */

View File

@ -43,24 +43,45 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/frame.h>
#include <machine/intr.h>
#include <arm/at91/at91rm92reg.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91_streg.h>
#include <arm/at91/at91rm92reg.h>
static struct at91st_softc {
bus_space_tag_t sc_st;
bus_space_handle_t sc_sh;
device_t sc_dev;
static struct at91_st_softc {
struct resource * sc_irq_res;
struct resource * sc_mem_res;
void * sc_intrhand;
eventhandler_tag sc_wet; /* watchdog event handler tag */
} *timer_softc;
#define RD4(off) \
bus_space_read_4(timer_softc->sc_st, timer_softc->sc_sh, (off))
#define WR4(off, val) \
bus_space_write_4(timer_softc->sc_st, timer_softc->sc_sh, (off), (val))
static inline uint32_t
RD4(bus_size_t off)
{
static void at91st_watchdog(void *, u_int, int *);
static void at91st_initclocks(struct at91st_softc *);
if (timer_softc == NULL) {
uint32_t *p = (uint32_t *)(AT91_BASE + AT91RM92_ST_BASE + off);
return *p;
}
return (bus_read_4(timer_softc->sc_mem_res, off));
}
static inline void
WR4(bus_size_t off, uint32_t val)
{
if (timer_softc == NULL) {
uint32_t *p = (uint32_t *)(AT91_BASE + AT91RM92_ST_BASE + off);
*p = val;
}
else
bus_write_4(timer_softc->sc_mem_res, off, val);
}
static void at91_st_watchdog(void *, u_int, int *);
static void at91_st_initclocks(device_t , struct at91_st_softc *);
static inline int
st_crtr(void)
@ -73,10 +94,10 @@ st_crtr(void)
return (cur1);
}
static unsigned at91st_get_timecount(struct timecounter *tc);
static unsigned at91_st_get_timecount(struct timecounter *tc);
static struct timecounter at91st_timecounter = {
at91st_get_timecount, /* get_timecount */
static struct timecounter at91_st_timecounter = {
at91_st_get_timecount, /* get_timecount */
NULL, /* no poll_pps */
0xfffffu, /* counter_mask */
32768, /* frequency */
@ -84,8 +105,21 @@ static struct timecounter at91st_timecounter = {
1000 /* quality */
};
static void
at91st_delay(int n)
static int
clock_intr(void *arg)
{
struct trapframe *fp = arg;
/* The interrupt is shared, so we have to make sure it's for us. */
if (RD4(ST_SR) & ST_SR_PITS) {
hardclock(TRAPF_USERMODE(fp), TRAPF_PC(fp));
return (FILTER_HANDLED);
}
return (FILTER_STRAY);
}
void
at91_st_delay(int n)
{
uint32_t start, end, cur;
@ -104,8 +138,8 @@ at91st_delay(int n)
}
}
static void
at91st_cpu_reset(void)
void
at91_st_cpu_reset(void)
{
/*
* Reset the CPU by programmig the watchdog timer to reset the
@ -119,63 +153,102 @@ at91st_cpu_reset(void)
}
static int
at91st_probe(device_t dev)
at91_st_probe(device_t dev)
{
device_set_desc(dev, "ST");
return (0);
}
static int
at91st_attach(device_t dev)
static void
at91_st_deactivate(device_t dev)
{
struct at91_softc *sc = device_get_softc(device_get_parent(dev));
struct at91_st_softc *sc = timer_softc;
timer_softc = device_get_softc(dev);
timer_softc->sc_st = sc->sc_st;
timer_softc->sc_dev = dev;
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91RM92_ST_BASE,
AT91RM92_ST_SIZE, &timer_softc->sc_sh) != 0)
panic("couldn't subregion timer registers");
/*
* Real time counter increments every clock cycle, need to set before
* initializing clocks so that DELAY works.
*/
WR4(ST_RTMR, 1);
if (sc->sc_intrhand)
bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand);
sc->sc_intrhand = NULL;
if (sc->sc_irq_res)
bus_release_resource(dev, SYS_RES_IRQ,
rman_get_rid(sc->sc_irq_res), sc->sc_irq_res);
sc->sc_irq_res = NULL;
if (sc->sc_mem_res)
bus_release_resource(dev, SYS_RES_MEMORY,
rman_get_rid(sc->sc_mem_res), sc->sc_mem_res);
sc->sc_mem_res = NULL;
}
static int
at91_st_activate(device_t dev)
{
int rid;
int err;
struct at91_st_softc *sc = timer_softc;
rid = 0;
sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
err = ENOMEM;
if (sc->sc_mem_res == NULL)
goto out;
/* Disable all interrupts */
WR4(ST_IDR, 0xffffffff);
/* disable watchdog timer */
WR4(ST_WDMR, 0);
soc_data.delay = at91st_delay;
soc_data.reset = at91st_cpu_reset; // XXX kinda late to be setting this...
/* The system timer shares the system irq (1) */
rid = 0;
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_ACTIVE | RF_SHAREABLE);
if (sc->sc_irq_res == NULL) {
printf("Unable to allocate irq for the system timer");
goto out;
}
err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_CLK, clock_intr,
NULL, NULL, &sc->sc_intrhand);
out:
if (err != 0)
at91_st_deactivate(dev);
return (err);
}
static int
at91_st_attach(device_t dev)
{
int err;
timer_softc = device_get_softc(dev);
err = at91_st_activate(dev);
if (err)
return err;
timer_softc->sc_wet = EVENTHANDLER_REGISTER(watchdog_list,
at91st_watchdog, dev, 0);
at91_st_watchdog, dev, 0);
device_printf(dev,
"watchdog registered, timeout intervall max. 64 sec\n");
at91st_initclocks(timer_softc);
at91_st_initclocks(dev, timer_softc);
return (0);
}
static device_method_t at91st_methods[] = {
DEVMETHOD(device_probe, at91st_probe),
DEVMETHOD(device_attach, at91st_attach),
static device_method_t at91_st_methods[] = {
DEVMETHOD(device_probe, at91_st_probe),
DEVMETHOD(device_attach, at91_st_attach),
{0, 0},
};
static driver_t at91st_driver = {
static driver_t at91_st_driver = {
"at91_st",
at91st_methods,
sizeof(struct at91st_softc),
at91_st_methods,
sizeof(struct at91_st_softc),
};
static devclass_t at91st_devclass;
static devclass_t at91_st_devclass;
DRIVER_MODULE(at91_st, atmelarm, at91st_driver, at91st_devclass, 0, 0);
DRIVER_MODULE(at91_st, atmelarm, at91_st_driver, at91_st_devclass, 0, 0);
static unsigned
at91st_get_timecount(struct timecounter *tc)
at91_st_get_timecount(struct timecounter *tc)
{
return (st_crtr());
}
@ -194,7 +267,7 @@ at91st_get_timecount(struct timecounter *tc)
* interval, I think this is the best solution.
*/
static void
at91st_watchdog(void *argp, u_int cmd, int *error)
at91_st_watchdog(void *argp, u_int cmd, int *error)
{
uint32_t wdog;
int t;
@ -210,50 +283,31 @@ at91st_watchdog(void *argp, u_int cmd, int *error)
WR4(ST_CR, ST_CR_WDRST);
}
static int
clock_intr(void *arg)
{
struct trapframe *fp = arg;
/* The interrupt is shared, so we have to make sure it's for us. */
if (RD4(ST_SR) & ST_SR_PITS) {
hardclock(TRAPF_USERMODE(fp), TRAPF_PC(fp));
return (FILTER_HANDLED);
}
return (FILTER_STRAY);
}
static void
at91st_initclocks(struct at91st_softc *sc)
at91_st_initclocks(device_t dev, struct at91_st_softc *sc)
{
int rel_value;
struct resource *irq;
int rid = 0;
void *ih;
device_t dev = sc->sc_dev;
/*
* Real time counter increments every clock cycle, need to set before
* initializing clocks so that DELAY works.
*/
WR4(ST_RTMR, 1);
/* disable watchdog timer */
WR4(ST_WDMR, 0);
rel_value = 32768 / hz;
if (rel_value < 1)
rel_value = 1;
if (32768 % hz) {
printf("Cannot get %d Hz clock; using %dHz\n", hz, 32768 / rel_value);
device_printf(dev, "Cannot get %d Hz clock; using %dHz\n", hz,
32768 / rel_value);
hz = 32768 / rel_value;
tick = 1000000 / hz;
}
/* Disable all interrupts. */
WR4(ST_IDR, 0xffffffff);
/* The system timer shares the system irq (1) */
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 1, 1, 1,
RF_ACTIVE | RF_SHAREABLE);
if (!irq)
panic("Unable to allocate irq for the system timer");
else
bus_setup_intr(dev, irq, INTR_TYPE_CLK,
clock_intr, NULL, NULL, &ih);
WR4(ST_PIMR, rel_value);
/* Enable PITS interrupts. */
WR4(ST_IER, ST_SR_PITS);
tc_init(&at91st_timecounter);
tc_init(&at91_st_timecounter);
}

View File

@ -55,4 +55,7 @@
/* ST_CRTR */
#define ST_CRTR_MASK 0xfffff /* 20-bit counter */
void at91_st_delay(int n);
void at91_st_cpu_reset(void);
#endif /* ARM_AT91_AT91STREG_H */

View File

@ -85,4 +85,6 @@
#define AT91_EXID_SAM9G25 0x00000003
#define AT91_EXID_SAM9X25 0x00000004
#define AT91_IRQ_SYSTEM 1
#endif /* _AT91REG_H_ */

View File

@ -38,10 +38,14 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91reg.h>
#include <arm/at91/at91rm92reg.h>
#include <arm/at91/at91_aicreg.h>
#include <arm/at91/at91_pmcreg.h>
#include <arm/at91/at91_streg.h>
#include <arm/at91/at91_pmcvar.h>
#include <arm/at91/at91soc.h>
struct at91rm92_softc {
device_t dev;
@ -49,8 +53,6 @@ struct at91rm92_softc {
bus_space_handle_t sc_sh;
bus_space_handle_t sc_sys_sh;
bus_space_handle_t sc_aic_sh;
bus_space_handle_t sc_dbg_sh;
bus_space_handle_t sc_matrix_sh;
};
/*
* Standard priority levels for the system. 0 is lowest and 7 is highest.
@ -135,41 +137,6 @@ static const struct cpu_devs at91_devs[] =
{ 0, 0, 0, 0, 0 }
};
static void
at91_add_child(device_t dev, int prio, const char *name, int unit,
bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
device_t kid;
struct at91_ivar *ivar;
kid = device_add_child_ordered(dev, prio, name, unit);
if (kid == NULL) {
printf("Can't add child %s%d ordered\n", name, unit);
return;
}
ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ivar == NULL) {
device_delete_child(dev, kid);
printf("Can't add alloc ivar\n");
return;
}
device_set_ivars(kid, ivar);
resource_list_init(&ivar->resources);
if (irq0 != -1) {
bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
if (irq0 != AT91RM92_IRQ_SYSTEM)
at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
}
if (irq1 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
if (irq2 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
if (addr != 0 && addr < AT91RM92_BASE)
addr += AT91RM92_BASE;
if (addr != 0)
bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
static void
at91_cpu_add_builtin_children(device_t dev)
{
@ -207,7 +174,7 @@ static int
at91_probe(device_t dev)
{
device_set_desc(dev, soc_data.name);
device_set_desc(dev, soc_info.name);
return (0);
}
@ -228,17 +195,12 @@ at91_attach(device_t dev)
AT91RM92_SYS_SIZE, &sc->sc_sys_sh) != 0)
panic("Enable to map system registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91RM92_DBGU_BASE,
AT91RM92_DBGU_SIZE, &sc->sc_dbg_sh) != 0)
panic("Enable to map DBGU registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91RM92_AIC_BASE,
AT91RM92_AIC_SIZE, &sc->sc_aic_sh) != 0)
panic("Enable to map system registers");
/* XXX Hack to tell atmelarm about the AIC */
at91sc->sc_aic_sh = sc->sc_aic_sh;
at91sc->sc_irq_system = AT91RM92_IRQ_SYSTEM;
for (i = 0; i < 32; i++) {
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR +
@ -264,9 +226,6 @@ at91_attach(device_t dev)
/* Disable all interrupts for the SDRAM controller */
bus_space_write_4(sc->sc_st, sc->sc_sys_sh, 0xfa8, 0xffffffff);
/* Disable all interrupts for DBGU */
bus_space_write_4(sc->sc_st, sc->sc_dbg_sh, 0x0c, 0xffffffff);
/* Update USB device port clock info */
clk = at91_pmc_clock_ref("udpck");
clk->pmc_mask = PMC_SCER_UDP;
@ -321,3 +280,10 @@ static driver_t at91rm92_driver = {
static devclass_t at91rm92_devclass;
DRIVER_MODULE(at91rm920, atmelarm, at91rm92_driver, at91rm92_devclass, 0, 0);
static struct at91_soc_data soc_data = {
.soc_delay = at91_st_delay,
.soc_reset = at91_st_cpu_reset
};
AT91_SOC(AT91_T_RM9200, &soc_data);

View File

@ -70,7 +70,6 @@
* 0xf0000000 - 0xfffffffff : Peripherals
*/
#define AT91RM92_BASE 0xd0000000
/* Usart */
#define AT91RM92_USART_SIZE 0x4000

View File

@ -38,10 +38,14 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91reg.h>
#include <arm/at91/at91soc.h>
#include <arm/at91/at91_aicreg.h>
#include <arm/at91/at91sam9260reg.h>
#include <arm/at91/at91_pitreg.h>
#include <arm/at91/at91_pmcreg.h>
#include <arm/at91/at91_pmcvar.h>
#include <arm/at91/at91_rstreg.h>
struct at91sam9_softc {
device_t dev;
@ -49,7 +53,6 @@ struct at91sam9_softc {
bus_space_handle_t sc_sh;
bus_space_handle_t sc_sys_sh;
bus_space_handle_t sc_aic_sh;
bus_space_handle_t sc_dbg_sh;
bus_space_handle_t sc_matrix_sh;
};
@ -128,41 +131,6 @@ static const struct cpu_devs at91_devs[] =
{ 0, 0, 0, 0, 0 }
};
static void
at91_add_child(device_t dev, int prio, const char *name, int unit,
bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
device_t kid;
struct at91_ivar *ivar;
kid = device_add_child_ordered(dev, prio, name, unit);
if (kid == NULL) {
printf("Can't add child %s%d ordered\n", name, unit);
return;
}
ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ivar == NULL) {
device_delete_child(dev, kid);
printf("Can't add alloc ivar\n");
return;
}
device_set_ivars(kid, ivar);
resource_list_init(&ivar->resources);
if (irq0 != -1) {
bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
if (irq0 != AT91SAM9260_IRQ_SYSTEM)
at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
}
if (irq1 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
if (irq2 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
if (addr != 0 && addr < AT91SAM9260_BASE)
addr += AT91SAM9260_BASE;
if (addr != 0)
bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
static void
at91_cpu_add_builtin_children(device_t dev)
{
@ -197,7 +165,7 @@ static void
at91_identify(driver_t *drv, device_t parent)
{
if (soc_data.type == AT91_T_SAM9260) {
if (soc_info.type == AT91_T_SAM9260) {
at91_add_child(parent, 0, "at91sam9260", 0, 0, 0, -1, 0, 0);
at91_cpu_add_builtin_children(parent);
}
@ -207,7 +175,7 @@ static int
at91_probe(device_t dev)
{
device_set_desc(dev, soc_data.name);
device_set_desc(dev, soc_info.name);
return (0);
}
@ -228,17 +196,12 @@ at91_attach(device_t dev)
AT91SAM9260_SYS_SIZE, &sc->sc_sys_sh) != 0)
panic("Enable to map system registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9260_DBGU_BASE,
AT91SAM9260_DBGU_SIZE, &sc->sc_dbg_sh) != 0)
panic("Enable to map DBGU registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9260_AIC_BASE,
AT91SAM9260_AIC_SIZE, &sc->sc_aic_sh) != 0)
panic("Enable to map system registers");
/* XXX Hack to tell atmelarm about the AIC */
at91sc->sc_aic_sh = sc->sc_aic_sh;
at91sc->sc_irq_system = AT91SAM9260_IRQ_SYSTEM;
for (i = 0; i < 32; i++) {
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR +
@ -258,9 +221,6 @@ at91_attach(device_t dev)
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 0xffffffff);
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_ICCR, 0xffffffff);
/* Disable all interrupts for DBGU */
bus_space_write_4(sc->sc_st, sc->sc_dbg_sh, 0x0c, 0xffffffff);
if (bus_space_subregion(sc->sc_st, sc->sc_sh,
AT91SAM9260_MATRIX_BASE, AT91SAM9260_MATRIX_SIZE,
&sc->sc_matrix_sh) != 0)
@ -336,3 +296,10 @@ static devclass_t at91sam9260_devclass;
DRIVER_MODULE(at91sam9260, atmelarm, at91sam9260_driver, at91sam9260_devclass,
NULL, NULL);
static struct at91_soc_data soc_data = {
.soc_delay = at91_pit_delay,
.soc_reset = at91_rst_cpu_reset
};
AT91_SOC(AT91_T_SAM9260, &soc_data);

View File

@ -72,8 +72,6 @@
#define AT91_CHIPSELECT_7 0x80000000
#define AT91SAM9260_BASE 0xd0000000
#define AT91SAM9260_EMAC_BASE 0xffc4000
#define AT91SAM9260_EMAC_SIZE 0x4000

View File

@ -38,10 +38,14 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91reg.h>
#include <arm/at91/at91soc.h>
#include <arm/at91/at91_aicreg.h>
#include <arm/at91/at91sam9g20reg.h>
#include <arm/at91/at91_pitreg.h>
#include <arm/at91/at91_pmcreg.h>
#include <arm/at91/at91_pmcvar.h>
#include <arm/at91/at91_rstreg.h>
struct at91sam9_softc {
device_t dev;
@ -49,7 +53,6 @@ struct at91sam9_softc {
bus_space_handle_t sc_sh;
bus_space_handle_t sc_sys_sh;
bus_space_handle_t sc_aic_sh;
bus_space_handle_t sc_dbg_sh;
bus_space_handle_t sc_matrix_sh;
};
@ -128,41 +131,6 @@ static const struct cpu_devs at91_devs[] =
{ 0, 0, 0, 0, 0 }
};
static void
at91_add_child(device_t dev, int prio, const char *name, int unit,
bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
device_t kid;
struct at91_ivar *ivar;
kid = device_add_child_ordered(dev, prio, name, unit);
if (kid == NULL) {
printf("Can't add child %s%d ordered\n", name, unit);
return;
}
ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ivar == NULL) {
device_delete_child(dev, kid);
printf("Can't add alloc ivar\n");
return;
}
device_set_ivars(kid, ivar);
resource_list_init(&ivar->resources);
if (irq0 != -1) {
bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
if (irq0 != AT91SAM9G20_IRQ_SYSTEM)
at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
}
if (irq1 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
if (irq2 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
if (addr != 0 && addr < AT91SAM9G20_BASE)
addr += AT91SAM9G20_BASE;
if (addr != 0)
bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
static void
at91_cpu_add_builtin_children(device_t dev)
{
@ -214,7 +182,7 @@ static int
at91_probe(device_t dev)
{
device_set_desc(dev, soc_data.name);
device_set_desc(dev, soc_info.name);
return (0);
}
@ -239,17 +207,12 @@ at91_attach(device_t dev)
AT91SAM9G20_SYS_SIZE, &sc->sc_sys_sh) != 0)
panic("Enable to map system registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9G20_DBGU_BASE,
AT91SAM9G20_DBGU_SIZE, &sc->sc_dbg_sh) != 0)
panic("Enable to map DBGU registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9G20_AIC_BASE,
AT91SAM9G20_AIC_SIZE, &sc->sc_aic_sh) != 0)
panic("Enable to map system registers");
/* XXX Hack to tell atmelarm about the AIC */
at91sc->sc_aic_sh = sc->sc_aic_sh;
at91sc->sc_irq_system = AT91SAM9G20_IRQ_SYSTEM;
for (i = 0; i < 32; i++) {
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR +
@ -269,9 +232,6 @@ at91_attach(device_t dev)
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 0xffffffff);
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_ICCR, 0xffffffff);
/* Disable all interrupts for DBGU */
bus_space_write_4(sc->sc_st, sc->sc_dbg_sh, 0x0c, 0xffffffff);
if (bus_space_subregion(sc->sc_st, sc->sc_sh,
AT91SAM9G20_MATRIX_BASE, AT91SAM9G20_MATRIX_SIZE,
&sc->sc_matrix_sh) != 0)
@ -338,3 +298,10 @@ static driver_t at91sam9_driver = {
static devclass_t at91sam9_devclass;
DRIVER_MODULE(at91sam, atmelarm, at91sam9_driver, at91sam9_devclass, 0, 0);
static struct at91_soc_data soc_data = {
.soc_delay = at91_pit_delay,
.soc_reset = at91_rst_cpu_reset
};
AT91_SOC(AT91_T_SAM9G20, &soc_data);

View File

@ -73,8 +73,6 @@
#define AT91_CHIPSELECT_7 0x80000000
#define AT91SAM9G20_BASE 0xd0000000
#define AT91SAM9G20_EMAC_BASE 0xffc4000
#define AT91SAM9G20_EMAC_SIZE 0x4000

View File

@ -38,10 +38,14 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91reg.h>
#include <arm/at91/at91soc.h>
#include <arm/at91/at91_aicreg.h>
#include <arm/at91/at91sam9x25reg.h>
#include <arm/at91/at91_pitreg.h>
#include <arm/at91/at91_pmcreg.h>
#include <arm/at91/at91_pmcvar.h>
#include <arm/at91/at91_rstreg.h>
struct at91sam9x25_softc {
device_t dev;
@ -49,8 +53,6 @@ struct at91sam9x25_softc {
bus_space_handle_t sc_sh;
bus_space_handle_t sc_sys_sh;
bus_space_handle_t sc_aic_sh;
bus_space_handle_t sc_dbg_sh;
bus_space_handle_t sc_matrix_sh;
};
/*
@ -131,41 +133,6 @@ static const struct cpu_devs at91_devs[] =
{ 0, 0, 0, 0, 0 }
};
static void
at91_add_child(device_t dev, int prio, const char *name, int unit,
bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
device_t kid;
struct at91_ivar *ivar;
kid = device_add_child_ordered(dev, prio, name, unit);
if (kid == NULL) {
printf("Can't add child %s%d ordered\n", name, unit);
return;
}
ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ivar == NULL) {
device_delete_child(dev, kid);
printf("Can't add alloc ivar\n");
return;
}
device_set_ivars(kid, ivar);
resource_list_init(&ivar->resources);
if (irq0 != -1) {
bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
if (irq0 != AT91SAM9X25_IRQ_SYSTEM)
at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
}
if (irq1 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
if (irq2 != 0)
bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
if (addr != 0 && addr < AT91SAM9X25_BASE)
addr += AT91SAM9X25_BASE;
if (addr != 0)
bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
static void
at91_cpu_add_builtin_children(device_t dev)
{
@ -207,7 +174,7 @@ static void
at91_identify(driver_t *drv, device_t parent)
{
if (soc_data.type == AT91_T_SAM9X5 && soc_data.subtype == AT91_ST_SAM9X25) {
if (soc_info.type == AT91_T_SAM9X5 && soc_info.subtype == AT91_ST_SAM9X25) {
at91_add_child(parent, 0, "at91sam9x25", 0, 0, 0, -1, 0, 0);
at91_cpu_add_builtin_children(parent);
}
@ -242,17 +209,12 @@ at91_attach(device_t dev)
AT91SAM9X25_SYS_SIZE, &sc->sc_sys_sh) != 0)
panic("Enable to map system registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9X25_DBGU_BASE,
AT91SAM9X25_DBGU_SIZE, &sc->sc_dbg_sh) != 0)
panic("Enable to map DBGU registers");
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9X25_AIC_BASE,
AT91SAM9X25_AIC_SIZE, &sc->sc_aic_sh) != 0)
panic("Enable to map system registers");
/* XXX Hack to tell atmelarm about the AIC */
at91sc->sc_aic_sh = sc->sc_aic_sh;
at91sc->sc_irq_system = AT91SAM9X25_IRQ_SYSTEM;
for (i = 0; i < 32; i++) {
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR +
@ -272,23 +234,6 @@ at91_attach(device_t dev)
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 0xffffffff);
bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_ICCR, 0xffffffff);
/* Disable all interrupts for DBGU */
bus_space_write_4(sc->sc_st, sc->sc_dbg_sh, 0x0c, 0xffffffff);
if (bus_space_subregion(sc->sc_st, sc->sc_sh,
AT91SAM9X25_MATRIX_BASE, AT91SAM9X25_MATRIX_SIZE,
&sc->sc_matrix_sh) != 0)
panic("Enable to map matrix registers");
#if 0 /* wrong, placeholder */
/* activate NAND*/
i = bus_space_read_4(sc->sc_st, sc->sc_matrix_sh,
AT91SAM9X25_EBICSA);
bus_space_write_4(sc->sc_st, sc->sc_matrix_sh,
AT91SAM9X25_EBICSA,
i | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
#endif
/* Update USB device port clock info */
clk = at91_pmc_clock_ref("udpck");
clk->pmc_mask = PMC_SCER_UDP_SAM9;
@ -342,3 +287,10 @@ static driver_t at91sam9x25_driver = {
static devclass_t at91sam9x25_devclass;
DRIVER_MODULE(at91sam9x25, atmelarm, at91sam9x25_driver, at91sam9x25_devclass, 0, 0);
static struct at91_soc_data soc_data = {
.soc_delay = at91_pit_delay,
.soc_reset = at91_rst_cpu_reset
};
AT91_SOC_SUB(AT91_T_SAM9X5, AT91_ST_SAM9X25, &soc_data);

View File

@ -73,8 +73,6 @@
#define AT91_CHIPSELECT_4 0x50000000
#define AT91_CHIPSELECT_5 0x60000000
#define AT91SAM9X25_BASE 0xd0000000
#define AT91SAM9X25_EMAC_SIZE 0x4000
#define AT91SAM9X25_EMAC0_BASE 0x802c000
#define AT91SAM9X25_EMAC0_SIZE AT91SAM9X25_EMAC_SIZE

51
sys/arm/at91/at91soc.c Normal file
View File

@ -0,0 +1,51 @@
/*-
* Copyright (c) 2012 Warner Losh. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91soc.h>
SET_DECLARE(at91_socs, const struct at91_soc);
struct at91_soc_data *
at91_match_soc(enum at91_soc_type type, enum at91_soc_subtype subtype)
{
const struct at91_soc **socp;
SET_FOREACH(socp, at91_socs) {
if ((*socp)->soc_type != type)
continue;
if ((*socp)->soc_subtype != AT91_ST_ANY &&
(*socp)->soc_subtype != subtype)
continue;
return (*socp)->soc_data;
}
return NULL;
}

58
sys/arm/at91/at91soc.h Normal file
View File

@ -0,0 +1,58 @@
/*-
* Copyright (c) 2012 Warner Losh. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $FreeBSD$ */
#ifndef _ARM_AT91_AT91SOC_H_
#define _ARM_AT91_AT91SOC_H_
#include <sys/linker_set.h>
struct at91_soc {
enum at91_soc_type soc_type; /* Family of mail type of SoC */
enum at91_soc_subtype soc_subtype; /* More specific soc, if any */
struct at91_soc_data *soc_data;
};
// Make varadic
#define AT91_SOC(type, data) \
static struct at91_soc this_soc = { \
.soc_type = type, \
.soc_subtype = AT91_ST_ANY, \
.soc_data = data, \
}; \
DATA_SET(at91_socs, this_soc);
#define AT91_SOC_SUB(type, subtype, data) \
static struct at91_soc this_soc = { \
.soc_type = type, \
.soc_subtype = subtype, \
.soc_data = data, \
}; \
DATA_SET(at91_socs, this_soc);
struct at91_soc_data *at91_match_soc(enum at91_soc_type, enum at91_soc_subtype);
#endif /* _ARM_AT91_AT91SOC_H_ */

View File

@ -40,7 +40,6 @@ struct at91_softc {
bus_space_handle_t sc_aic_sh;
struct rman sc_irq_rman;
struct rman sc_mem_rman;
uint32_t sc_irq_system;
};
struct at91_ivar {
@ -75,6 +74,7 @@ enum at91_soc_type {
};
enum at91_soc_subtype {
AT91_ST_ANY = -1, /* Match any type */
AT91_ST_NONE = 0,
/* AT91RM9200 */
AT91_ST_RM9200_BGA,
@ -105,6 +105,11 @@ enum at91_soc_family {
typedef void (*DELAY_t)(int);
typedef void (*cpu_reset_t)(void);
struct at91_soc_data {
DELAY_t soc_delay;
cpu_reset_t soc_reset;
};
struct at91_soc_info {
enum at91_soc_type type;
enum at91_soc_subtype subtype;
@ -112,11 +117,10 @@ struct at91_soc_info {
uint32_t cidr;
uint32_t exid;
char name[AT91_SOC_NAME_MAX];
DELAY_t delay;
cpu_reset_t reset;
struct at91_soc_data *soc_data;
};
extern struct at91_soc_info soc_data;
extern struct at91_soc_info soc_info;
static inline int at91_is_rm92(void);
static inline int at91_is_sam9(void);
@ -127,30 +131,33 @@ static inline int
at91_is_rm92(void)
{
return (soc_data.type == AT91_T_RM9200);
return (soc_info.type == AT91_T_RM9200);
}
static inline int
at91_is_sam9(void)
{
return (soc_data.family == AT91_FAMILY_SAM9);
return (soc_info.family == AT91_FAMILY_SAM9);
}
static inline int
at91_is_sam9xe(void)
{
return (soc_data.family == AT91_FAMILY_SAM9XE);
return (soc_info.family == AT91_FAMILY_SAM9XE);
}
static inline int
at91_cpu_is(u_int cpu)
{
return (soc_data.type == cpu);
return (soc_info.type == cpu);
}
void at91_add_child(device_t dev, int prio, const char *name, int unit,
bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2);
extern uint32_t at91_irq_system;
extern uint32_t at91_master_clock;
void at91_pmc_init_clock(void);

View File

@ -27,6 +27,7 @@ arm/at91/uart_dev_at91usart.c optional uart
#
# All the "systems on a chip" we support
#
arm/at91/at91soc.c standard
arm/at91/at91rm9200.c optional at91rm9200
arm/at91/at91sam9260.c optional at91sam9260
arm/at91/at91sam9g20.c optional at91sam9g20

View File

@ -42,33 +42,32 @@ __FBSDID("$FreeBSD$");
#include <dev/uart/uart_bus.h>
#include <dev/uart/uart_cpu.h>
#include <arm/at91/at91rm92reg.h>
#include <arm/at91/at91var.h>
#include "uart_if.h"
static int usart_at91rm92_probe(device_t dev);
static int usart_at91_probe(device_t dev);
extern struct uart_class at91_usart_class;
static device_method_t usart_at91rm92_methods[] = {
static device_method_t usart_at91_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, usart_at91rm92_probe),
DEVMETHOD(device_probe, usart_at91_probe),
DEVMETHOD(device_attach, uart_bus_attach),
DEVMETHOD(device_detach, uart_bus_detach),
{ 0, 0 }
};
static driver_t usart_at91rm92_driver = {
static driver_t usart_at91_driver = {
uart_driver_name,
usart_at91rm92_methods,
usart_at91_methods,
sizeof(struct uart_softc),
};
extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs;
static int
usart_at91rm92_probe(device_t dev)
usart_at91_probe(device_t dev)
{
struct uart_softc *sc;
@ -104,4 +103,4 @@ usart_at91rm92_probe(device_t dev)
}
DRIVER_MODULE(uart, atmelarm, usart_at91rm92_driver, uart_devclass, 0, 0);
DRIVER_MODULE(uart, atmelarm, usart_at91_driver, uart_devclass, 0, 0);

View File

@ -73,7 +73,7 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
* XXX: Not pretty, but will work because we map the needed addresses
* early.
*/
di->bas.bsh = AT91RM92_BASE + AT91RM92_DBGU_BASE;
di->bas.bsh = AT91_BASE + AT91RM92_DBGU_BASE;
di->baudrate = 115200;
di->bas.regshft = 0;
di->bas.rclk = 0;

View File

@ -24,7 +24,7 @@ include "../at91/std.kb920x"
# The AT91 platform doesn't use /boot/loader, so we have to statically wire
# hints.
hints "KB920X.hints"
#makeoptions MODULES_OVERRIDE=""
makeoptions MODULES_OVERRIDE=""
makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
options DDB
@ -137,6 +137,7 @@ device wlan_wep # 802.11 WEP support
device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
device wlan_amrr # AMRR transmit rate control algorithm
options IEEE80211_SUPPORT_MESH
options AH_SUPPORT_AR5416

View File

@ -103,10 +103,6 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -114,7 +110,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;

View File

@ -115,16 +115,11 @@ extern unsigned char _edata[];
extern unsigned char __bss_start[];
extern unsigned char _end[];
#ifdef DDB
extern vm_offset_t ksym_start, ksym_end;
#endif
extern u_int data_abort_handler_address;
extern u_int prefetch_abort_handler_address;
extern u_int undefined_handler_address;
extern vm_offset_t pmap_bootstrap_lastaddr;
extern int *end;
struct pv_addr kernel_pt_table[KERNEL_PT_MAX];
struct pcpu __pcpu;
@ -134,7 +129,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
vm_offset_t pmap_bootstrap_lastaddr;
const struct pmap_devmap *pmap_devmap_bootstrap_table;

View File

@ -118,10 +118,6 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -129,7 +125,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;
@ -203,10 +198,6 @@ static const struct pmap_devmap s3c24x0_devmap[] = {
#define ioreg_read32(a) (*(volatile uint32_t *)(a))
#define ioreg_write32(a,v) (*(volatile uint32_t *)(a)=(v))
#ifdef DDB
extern vm_offset_t ksym_start, ksym_end;
#endif
struct arm32_dma_range s3c24x0_range = {
.dr_sysbase = 0,
.dr_busbase = 0,

View File

@ -119,14 +119,10 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern vm_offset_t sa1110_uart_vaddr;
extern vm_offset_t sa1_cache_clean_addr;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -140,7 +136,6 @@ vm_paddr_t dump_avail[4];
vm_paddr_t physical_start;
vm_paddr_t physical_end;
vm_paddr_t physical_freestart;
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr irqstack;

View File

@ -115,10 +115,6 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -126,7 +122,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;

View File

@ -115,10 +115,6 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -126,7 +122,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;

View File

@ -117,7 +117,6 @@ extern u_int prefetch_abort_handler_address;
extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -126,7 +125,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;

View File

@ -119,10 +119,6 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -130,7 +126,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[10];
vm_paddr_t dump_avail[4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;

View File

@ -115,10 +115,6 @@ extern u_int undefined_handler_address;
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
extern void *_end;
extern int *end;
struct pcpu __pcpu;
struct pcpu *pcpup = &__pcpu;
@ -126,7 +122,6 @@ struct pcpu *pcpup = &__pcpu;
vm_paddr_t phys_avail[PXA2X0_SDRAM_BANKS * 2 + 4];
vm_paddr_t dump_avail[PXA2X0_SDRAM_BANKS * 2 + 4];
vm_offset_t physical_pages;
struct pv_addr systempage;
struct pv_addr msgbufpv;

View File

@ -1,3 +1,3 @@
# $FreeBSD$
machine arm armeb
# machine arm armeb
options ARM_CACHE_LOCK_ENABLE

View File

@ -171,8 +171,8 @@ ata_op_string(struct ata_cmd *cmd)
case 0xf2: return ("SECURITY_UNLOCK");
case 0xf3: return ("SECURITY_ERASE_PREPARE");
case 0xf4: return ("SECURITY_ERASE_UNIT");
case 0xf5: return ("SECURITY_FREE_LOCK");
case 0xf6: return ("SECURITY DISABLE PASSWORD");
case 0xf5: return ("SECURITY_FREEZE_LOCK");
case 0xf6: return ("SECURITY_DISABLE_PASSWORD");
case 0xf8: return ("READ_NATIVE_MAX_ADDRESS");
case 0xf9: return ("SET_MAX_ADDRESS");
}

View File

@ -368,9 +368,9 @@ TUNABLE_INT("kern.cam.ada.retry_count", &ada_retry_count);
SYSCTL_INT(_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RW,
&ada_default_timeout, 0, "Normal I/O timeout (in seconds)");
TUNABLE_INT("kern.cam.ada.default_timeout", &ada_default_timeout);
SYSCTL_INT(_kern_cam_ada, OID_AUTO, ada_send_ordered, CTLFLAG_RW,
SYSCTL_INT(_kern_cam_ada, OID_AUTO, send_ordered, CTLFLAG_RW,
&ada_send_ordered, 0, "Send Ordered Tags");
TUNABLE_INT("kern.cam.ada.ada_send_ordered", &ada_send_ordered);
TUNABLE_INT("kern.cam.ada.send_ordered", &ada_send_ordered);
SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW,
&ada_spindown_shutdown, 0, "Spin down upon shutdown");
TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown);

View File

@ -883,9 +883,9 @@ TUNABLE_INT("kern.cam.da.retry_count", &da_retry_count);
SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RW,
&da_default_timeout, 0, "Normal I/O timeout (in seconds)");
TUNABLE_INT("kern.cam.da.default_timeout", &da_default_timeout);
SYSCTL_INT(_kern_cam_da, OID_AUTO, da_send_ordered, CTLFLAG_RW,
SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RW,
&da_send_ordered, 0, "Send Ordered Tags");
TUNABLE_INT("kern.cam.da.da_send_ordered", &da_send_ordered);
TUNABLE_INT("kern.cam.da.send_ordered", &da_send_ordered);
/*
* DA_ORDEREDTAG_INTERVAL determines how often, relative

View File

@ -412,6 +412,7 @@ contrib/dev/acpica/components/tables/tbfind.c optional acpi
contrib/dev/acpica/components/tables/tbinstal.c optional acpi
contrib/dev/acpica/components/tables/tbutils.c optional acpi
contrib/dev/acpica/components/tables/tbxface.c optional acpi
contrib/dev/acpica/components/tables/tbxfload.c optional acpi
contrib/dev/acpica/components/tables/tbxfroot.c optional acpi
contrib/dev/acpica/components/utilities/utaddress.c optional acpi
contrib/dev/acpica/components/utilities/utalloc.c optional acpi
@ -421,6 +422,7 @@ contrib/dev/acpica/components/utilities/utdebug.c optional acpi
contrib/dev/acpica/components/utilities/utdecode.c optional acpi
contrib/dev/acpica/components/utilities/utdelete.c optional acpi
contrib/dev/acpica/components/utilities/uteval.c optional acpi
contrib/dev/acpica/components/utilities/utexcep.c optional acpi
contrib/dev/acpica/components/utilities/utglobal.c optional acpi
contrib/dev/acpica/components/utilities/utids.c optional acpi
contrib/dev/acpica/components/utilities/utinit.c optional acpi

View File

@ -1,3 +1,81 @@
----------------------------------------
11 July 2012. Summary of changes for version 20120711:
This release is available at https://www.acpica.org/downloads The ACPI 5.0
specification is available at www.acpi.info
1) ACPICA Kernel-resident Subsystem:
Fixed a possible fault in the return package object repair code. Fixes a
problem that can occur when a lone package object is wrapped with an outer
package object in order to force conformance to the ACPI specification. Can
affect these predefined names: _ALR, _MLS, _PSS, _TRT, _TSS, _PRT, _HPX, _DLM,
_CSD, _PSD, _TSD.
Removed code to disable/enable bus master arbitration (ARB_DIS bit in the
PM2_CNT register) in the ACPICA sleep/wake interfaces. Management of the
ARB_DIS bit must be implemented in the host-dependent C3 processor power state
support. Note, ARB_DIS is obsolete and only applies to older chipsets, both
Intel and other vendors. (for Intel: ICH4-M and earlier)
This change removes the code to disable/enable bus master arbitration during
suspend/resume. Use of the ARB_DIS bit in the optional PM2_CNT register causes
resume problems on some machines. The change has been in use for over seven
years within Linux.
Implemented two new external interfaces to support host-directed dynamic ACPI
table load and unload. They are intended to simplify the host implementation
of hot-plug support:
AcpiLoadTable: Load an SSDT from a buffer into the namespace.
AcpiUnloadParentTable: Unload an SSDT via a named object owned by the table.
See the ACPICA reference for additional details. Adds one new file,
components/tables/tbxfload.c
Implemented and deployed two new interfaces for errors and warnings that are
known to be caused by BIOS/firmware issues:
AcpiBiosError: Prints "ACPI Firmware Error" message.
AcpiBiosWarning: Prints "ACPI Firmware Warning" message.
Deployed these new interfaces in the ACPICA Table Manager code for ACPI table
and FADT errors. Additional deployment to be completed as appropriate in the
future. The associated conditional macros are ACPI_BIOS_ERROR and
ACPI_BIOS_WARNING. See the ACPICA reference for additional details. ACPICA BZ
843.
Implicit notify support: ensure that no memory allocation occurs within a
critical region. This fix moves a memory allocation outside of the time that a
spinlock is held. Fixes issues on systems that do not allow this behavior.
Jung-uk Kim.
Split exception code utilities and tables into a new file, utilities/utexcep.c
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug
version of the code includes the debug output trace mechanism and has a much
larger code and data size.
Previous Release:
Non-Debug Version: 93.1K Code, 25.1K Data, 118.2K Total
Debug Version: 172.9K Code, 73.6K Data, 246.5K Total
Current Release:
Non-Debug Version: 93.5K Code, 25.3K Data, 118.8K Total
Debug Version: 173.7K Code, 74.0K Data, 247.7K Total
2) iASL Compiler/Disassembler and Tools:
iASL: Fixed a parser problem for hosts where EOF is defined as -1 instead of
0. Jung-uk Kim.
Debugger: Enhanced the "tables" command to emit additional information about
the current set of ACPI tables, including the owner ID and flags decode.
Debugger: Reimplemented the "unload" command to use the new
AcpiUnloadParentTable external interface. This command was disable previously
due to need for an unload interface.
AcpiHelp: Added a new option to decode ACPICA exception codes. The -e option
will decode 16-bit hex status codes (ACPI_STATUS) to name strings.
----------------------------------------
20 June 2012. Summary of changes for version 20120620:

View File

@ -96,7 +96,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:P^r:s|t|T:G^v|w|x:z"
#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:P^r:s|t|T:G^v^w|x:z"
/*******************************************************************************
@ -119,6 +119,7 @@ Options (
printf ("\nGlobal:\n");
ACPI_OPTION ("-@ <file>", "Specify command file");
ACPI_OPTION ("-I <dir>", "Specify additional include directory");
ACPI_OPTION ("-v", "Display compiler version");
printf ("\nPreprocessor:\n");
ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use");
@ -751,9 +752,13 @@ AslDoOptions (
break;
case 'v': /* Verbosity settings */
case 'v': /* Version and verbosity settings */
switch (AcpiGbl_Optarg[0])
{
case '^':
printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
exit (0);
case 'a':
/* Disable All error/warning messages */

View File

@ -254,12 +254,53 @@ AcpiDbDisplayTableInfo (
ACPI_STATUS Status;
/* Header */
AcpiOsPrintf ("Idx ID Status Type Sig Address Len Header\n");
/* Walk the entire root table list */
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
TableDesc = &AcpiGbl_RootTableList.Tables[i];
AcpiOsPrintf ("%u ", i);
/* Index and Table ID */
AcpiOsPrintf ("%3u %.2u ", i, TableDesc->OwnerId);
/* Decode the table flags */
if (!(TableDesc->Flags & ACPI_TABLE_IS_LOADED))
{
AcpiOsPrintf ("NotLoaded ");
}
else
{
AcpiOsPrintf (" Loaded ");
}
switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
{
case ACPI_TABLE_ORIGIN_UNKNOWN:
AcpiOsPrintf ("Unknown ");
break;
case ACPI_TABLE_ORIGIN_MAPPED:
AcpiOsPrintf ("Mapped ");
break;
case ACPI_TABLE_ORIGIN_ALLOCATED:
AcpiOsPrintf ("Allocated ");
break;
case ACPI_TABLE_ORIGIN_OVERRIDE:
AcpiOsPrintf ("Override ");
break;
default:
AcpiOsPrintf ("INVALID ");
break;
}
/* Make sure that the table is mapped */
@ -290,55 +331,45 @@ AcpiDbDisplayTableInfo (
*
* FUNCTION: AcpiDbUnloadAcpiTable
*
* PARAMETERS: TableArg - Name of the table to be unloaded
* InstanceArg - Which instance of the table to unload (if
* there are multiple tables of the same type)
* PARAMETERS: ObjectName - Namespace pathname for an object that
* is owned by the table to be unloaded
*
* RETURN: Nonde
* RETURN: None
*
* DESCRIPTION: Unload an ACPI table.
* Instance is not implemented
* DESCRIPTION: Unload an ACPI table, via any namespace node that is owned
* by the table.
*
******************************************************************************/
void
AcpiDbUnloadAcpiTable (
char *TableArg,
char *InstanceArg)
char *ObjectName)
{
/* TBD: Need to reimplement for new data structures */
#if 0
UINT32 i;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
/* Search all tables for the target type */
/* Translate name to an Named object */
for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++)
Node = AcpiDbConvertToNode (ObjectName);
if (!Node)
{
if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
AcpiGbl_TableData[i].SigLength))
{
/* Found the table, unload it */
Status = AcpiUnloadTable (i);
if (ACPI_SUCCESS (Status))
{
AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg);
}
else
{
AcpiOsPrintf ("%s, while unloading [%s]\n",
AcpiFormatException (Status), TableArg);
}
return;
}
AcpiOsPrintf ("Could not find [%s] in namespace\n",
ObjectName);
return;
}
AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);
#endif
Status = AcpiUnloadParentTable (ACPI_CAST_PTR (ACPI_HANDLE, Node));
if (ACPI_SUCCESS (Status))
{
AcpiOsPrintf ("Parent of [%s] (%p) unloaded and uninstalled\n",
ObjectName, Node);
}
else
{
AcpiOsPrintf ("%s, while unloading parent table of [%s]\n",
AcpiFormatException (Status), ObjectName);
}
}

View File

@ -250,7 +250,7 @@ AcpiDbDisplayHelp (
AcpiOsPrintf (" Stack Display CPU stack usage\n");
AcpiOsPrintf (" Tables Info about current ACPI table(s)\n");
AcpiOsPrintf (" Tables Display info about loaded ACPI tables\n");
AcpiOsPrintf (" Unload <TableSig> [Instance] Unload an ACPI table\n");
AcpiOsPrintf (" Unload <Namepath> Unload an ACPI table via namespace object\n");
AcpiOsPrintf (" ! <CommandNumber> Execute command from history buffer\n");
AcpiOsPrintf (" !! Execute last command again\n");
@ -894,7 +894,7 @@ AcpiDbCommandDispatch (
break;
case CMD_UNLOAD:
AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]);
break;
case CMD_EXIT:

View File

@ -83,7 +83,7 @@ AcpiUpdateAllGpes (
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiUpdateGpes);
ACPI_FUNCTION_TRACE (AcpiUpdateAllGpes);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@ -298,7 +298,8 @@ AcpiSetupGpeForWake (
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_NAMESPACE_NODE *DeviceNode;
ACPI_GPE_NOTIFY_INFO *NewNotify, *Notify;
ACPI_GPE_NOTIFY_INFO *Notify;
ACPI_GPE_NOTIFY_INFO *NewNotify;
ACPI_CPU_FLAGS Flags;
@ -334,6 +335,11 @@ AcpiSetupGpeForWake (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* Allocate a new notify object up front, in case it is needed.
* Memory allocation while holding a spinlock is a big no-no
* on some hosts.
*/
NewNotify = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO));
if (!NewNotify)
{
@ -401,8 +407,12 @@ AcpiSetupGpeForWake (
GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
Status = AE_OK;
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Delete the notify object if it was not used above */
if (NewNotify)
{
ACPI_FREE (NewNotify);

View File

@ -418,8 +418,8 @@ AcpiExPrepCommonFieldObject (
*
* RETURN: Status
*
* DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type DefField and
* connect it to the parent Node.
* DESCRIPTION: Construct an object of type ACPI_OPERAND_OBJECT with a
* subtype of DefField and connect it to the parent Node.
*
******************************************************************************/

View File

@ -165,7 +165,7 @@ AcpiExResolveObjectToValue (
StackDesc = *StackPtr;
/* This is an ACPI_OPERAND_OBJECT */
/* This is an object of type ACPI_OPERAND_OBJECT */
switch (StackDesc->Common.Type)
{

View File

@ -68,15 +68,15 @@ AcpiExStoreObjectToIndex (
* FUNCTION: AcpiExStore
*
* PARAMETERS: *SourceDesc - Value to be stored
* *DestDesc - Where to store it. Must be an NS node
* or an ACPI_OPERAND_OBJECT of type
* *DestDesc - Where to store it. Must be an NS node
* or ACPI_OPERAND_OBJECT of type
* Reference;
* WalkState - Current walk state
*
* RETURN: Status
*
* DESCRIPTION: Store the value described by SourceDesc into the location
* described by DestDesc. Called by various interpreter
* described by DestDesc. Called by various interpreter
* functions to store the result of an operation into
* the destination operand -- not just simply the actual "Store"
* ASL operator.

View File

@ -121,7 +121,7 @@ AcpiExEnterInterpreter (
*
* DESCRIPTION: Reacquire the interpreter execution region from within the
* interpreter code. Failure to enter the interpreter region is a
* fatal system error. Used in conjuction with
* fatal system error. Used in conjunction with
* RelinquishInterpreter
*
******************************************************************************/

View File

@ -100,20 +100,6 @@ AcpiHwLegacySleep (
return_ACPI_STATUS (Status);
}
if (SleepState != ACPI_STATE_S5)
{
/*
* Disable BM arbitration. This feature is contained within an
* optional register (PM2 Control), so ignore a BAD_ADDRESS
* exception.
*/
Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
if (ACPI_FAILURE (Status) && (Status != AE_BAD_ADDRESS))
{
return_ACPI_STATUS (Status);
}
}
/*
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
@ -394,17 +380,6 @@ AcpiHwLegacyWake (
AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
ACPI_CLEAR_STATUS);
/*
* Enable BM arbitration. This feature is contained within an
* optional register (PM2 Control), so ignore a BAD_ADDRESS
* exception.
*/
Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 0);
if (ACPI_FAILURE (Status) && (Status != AE_BAD_ADDRESS))
{
return_ACPI_STATUS (Status);
}
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
return_ACPI_STATUS (Status);
}

View File

@ -101,6 +101,14 @@ AcpiSetFirmwareWakingVector (
ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
/*
* According to the ACPI specification 2.0c and later, the 64-bit
* waking vector should be cleared and the 32-bit waking vector should
* be used, unless we want the wake-up code to be called by the BIOS in
* Protected Mode. Some systems (for example HP dv5-1004nr) are known
* to fail to resume if the 64-bit vector is used.
*/
/* Set the 32-bit vector */
AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress;

View File

@ -681,7 +681,7 @@ AcpiNsCheckPackage (
{
/* Create the new outer package and populate it */
Status = AcpiNsWrapWithPackage (Data, *Elements, ReturnObjectPtr);
Status = AcpiNsWrapWithPackage (Data, ReturnObject, ReturnObjectPtr);
if (ACPI_FAILURE (Status))
{
return (Status);

View File

@ -348,8 +348,8 @@ AcpiPsExecuteMethod (
}
/*
* Start method evaluation with an implicit return of zero. This is done
* for Windows compatibility.
* Start method evaluation with an implicit return of zero.
* This is done for Windows compatibility.
*/
if (AcpiGbl_EnableInterpreterSlack)
{

View File

@ -209,8 +209,8 @@ AcpiRsCreateResourceList (
*
* FUNCTION: AcpiRsCreatePciRoutingTable
*
* PARAMETERS: PackageObject - Pointer to an ACPI_OPERAND_OBJECT
* package
* PARAMETERS: PackageObject - Pointer to a package containing one
* of more ACPI_OPERAND_OBJECTs
* OutputBuffer - Pointer to the user's buffer
*
* RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code.
@ -218,7 +218,7 @@ AcpiRsCreateResourceList (
* AE_BUFFER_OVERFLOW and OutputBuffer->Length will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a
* DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a
* linked list of PCI interrupt descriptions
*
* NOTE: It is the caller's responsibility to ensure that the start of the

View File

@ -181,7 +181,7 @@ AcpiRsMoveData (
/*
* 16-, 32-, and 64-bit cases must use the move macros that perform
* endian conversion and/or accomodate hardware that cannot perform
* endian conversion and/or accommodate hardware that cannot perform
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:

View File

@ -192,7 +192,7 @@ static ACPI_FADT_PM_INFO FadtPmInfoTable[] =
*
* PARAMETERS: GenericAddress - GAS struct to be initialized
* SpaceId - ACPI Space ID for this register
* ByteWidth - Width of this register, in bytes
* ByteWidth - Width of this register
* Address - Address of the register
*
* RETURN: None
@ -338,7 +338,7 @@ AcpiTbCreateLocalFadt (
*/
if (Length > sizeof (ACPI_TABLE_FADT))
{
ACPI_WARNING ((AE_INFO,
ACPI_BIOS_WARNING ((AE_INFO,
"FADT (revision %u) is longer than ACPI 5.0 version, "
"truncating length %u to %u",
Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT)));
@ -486,8 +486,9 @@ AcpiTbConvertFadt (
if (Address64->Address && Address32 &&
(Address64->Address != (UINT64) Address32))
{
ACPI_ERROR ((AE_INFO,
"32/64X address mismatch in %s: 0x%8.8X/0x%8.8X%8.8X, using 32",
ACPI_BIOS_ERROR ((AE_INFO,
"32/64X address mismatch in FADT/%s: "
"0x%8.8X/0x%8.8X%8.8X, using 32",
FadtInfoTable[i].Name, Address32,
ACPI_FORMAT_UINT64 (Address64->Address)));
}
@ -546,7 +547,7 @@ AcpiTbValidateFadt (
if (AcpiGbl_FADT.Facs &&
(AcpiGbl_FADT.XFacs != (UINT64) AcpiGbl_FADT.Facs))
{
ACPI_WARNING ((AE_INFO,
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X FACS address mismatch in FADT - "
"0x%8.8X/0x%8.8X%8.8X, using 32",
AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs)));
@ -557,7 +558,7 @@ AcpiTbValidateFadt (
if (AcpiGbl_FADT.Dsdt &&
(AcpiGbl_FADT.XDsdt != (UINT64) AcpiGbl_FADT.Dsdt))
{
ACPI_WARNING ((AE_INFO,
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X DSDT address mismatch in FADT - "
"0x%8.8X/0x%8.8X%8.8X, using 32",
AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt)));
@ -593,8 +594,8 @@ AcpiTbValidateFadt (
if (Address64->Address &&
(Address64->BitWidth != ACPI_MUL_8 (Length)))
{
ACPI_WARNING ((AE_INFO,
"32/64X length mismatch in %s: %u/%u",
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X length mismatch in FADT/%s: %u/%u",
Name, ACPI_MUL_8 (Length), Address64->BitWidth));
}
@ -606,9 +607,9 @@ AcpiTbValidateFadt (
*/
if (!Address64->Address || !Length)
{
ACPI_ERROR ((AE_INFO,
"Required field %s has zero address and/or length:"
" 0x%8.8X%8.8X/0x%X",
ACPI_BIOS_ERROR ((AE_INFO,
"Required FADT field %s has zero address and/or length: "
"0x%8.8X%8.8X/0x%X",
Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
}
}
@ -622,8 +623,8 @@ AcpiTbValidateFadt (
if ((Address64->Address && !Length) ||
(!Address64->Address && Length))
{
ACPI_WARNING ((AE_INFO,
"Optional field %s has zero address or length: "
ACPI_BIOS_WARNING ((AE_INFO,
"Optional FADT field %s has zero address or length: "
"0x%8.8X%8.8X/0x%X",
Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
}
@ -674,8 +675,8 @@ AcpiTbSetupFadtRegisters (
(FadtInfoTable[i].DefaultLength > 0) &&
(FadtInfoTable[i].DefaultLength != Target64->BitWidth))
{
ACPI_WARNING ((AE_INFO,
"Invalid length for %s: %u, using default %u",
ACPI_BIOS_WARNING ((AE_INFO,
"Invalid length for FADT/%s: %u, using default %u",
FadtInfoTable[i].Name, Target64->BitWidth,
FadtInfoTable[i].DefaultLength));

View File

@ -157,8 +157,9 @@ AcpiTbAddTable (
(!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) &&
(ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3)))
{
ACPI_ERROR ((AE_INFO,
"Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx",
ACPI_BIOS_ERROR ((AE_INFO,
"Table has invalid signature [%4.4s] (0x%8.8X), "
"must be SSDT or OEMx",
AcpiUtValidAcpiName (*(UINT32 *) TableDesc->Pointer->Signature) ?
TableDesc->Pointer->Signature : "????",
*(UINT32 *) TableDesc->Pointer->Signature));

View File

@ -287,8 +287,9 @@ AcpiTbVerifyChecksum (
if (Checksum)
{
ACPI_WARNING ((AE_INFO,
"Incorrect checksum in table [%4.4s] - 0x%2.2X, should be 0x%2.2X",
ACPI_BIOS_WARNING ((AE_INFO,
"Incorrect checksum in table [%4.4s] - 0x%2.2X, "
"should be 0x%2.2X",
Table->Signature, Table->Checksum,
(UINT8) (Table->Checksum - Checksum)));
@ -356,8 +357,9 @@ AcpiTbCheckDsdtHeader (
if (AcpiGbl_OriginalDsdtHeader.Length != AcpiGbl_DSDT->Length ||
AcpiGbl_OriginalDsdtHeader.Checksum != AcpiGbl_DSDT->Checksum)
{
ACPI_ERROR ((AE_INFO,
"The DSDT has been corrupted or replaced - old, new headers below"));
ACPI_BIOS_ERROR ((AE_INFO,
"The DSDT has been corrupted or replaced - "
"old, new headers below"));
AcpiTbPrintTableHeader (0, &AcpiGbl_OriginalDsdtHeader);
AcpiTbPrintTableHeader (0, AcpiGbl_DSDT);
@ -460,27 +462,12 @@ AcpiTbInstallTable (
return;
}
/* Skip SSDT when DSDT is overriden */
if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) &&
(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags &
ACPI_TABLE_ORIGIN_OVERRIDE))
{
ACPI_INFO ((AE_INFO,
"%4.4s @ 0x%p Table override, replaced with:", ACPI_SIG_SSDT,
ACPI_CAST_PTR (void, Address)));
AcpiTbPrintTableHeader (
AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Address,
AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer);
goto UnmapAndExit;
}
/* If a particular signature is expected (DSDT/FACS), it must match */
if (Signature &&
!ACPI_COMPARE_NAME (Table->Signature, Signature))
{
ACPI_ERROR ((AE_INFO,
ACPI_BIOS_ERROR ((AE_INFO,
"Invalid signature 0x%X for ACPI table, expected [%s]",
*ACPI_CAST_PTR (UINT32, Table->Signature), Signature));
goto UnmapAndExit;
@ -498,6 +485,19 @@ AcpiTbInstallTable (
TableDesc->Flags = ACPI_TABLE_ORIGIN_MAPPED;
ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
/* When DSDT is overriden, assume SSDT is also overriden with it */
if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT) &&
(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags &
ACPI_TABLE_ORIGIN_OVERRIDE))
{
TableDesc->Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
ACPI_INFO ((AE_INFO,
"%4.4s %p Logical table override, replaced with %4.4s",
ACPI_SIG_SSDT, ACPI_CAST_PTR (void, Address), ACPI_SIG_DSDT));
goto UnmapAndExit;
}
/*
* ACPI Table Override:
*
@ -599,7 +599,7 @@ AcpiTbGetRootTableEntry (
{
/* Will truncate 64-bit address to 32 bits, issue warning */
ACPI_WARNING ((AE_INFO,
ACPI_BIOS_WARNING ((AE_INFO,
"64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X),"
" truncating",
ACPI_FORMAT_UINT64 (Address64)));
@ -701,7 +701,8 @@ AcpiTbParseRootTable (
if (Length < sizeof (ACPI_TABLE_HEADER))
{
ACPI_ERROR ((AE_INFO, "Invalid length 0x%X in RSDT/XSDT", Length));
ACPI_BIOS_ERROR ((AE_INFO,
"Invalid table length 0x%X in RSDT/XSDT", Length));
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
* Module Name: tbxface - ACPI table oriented external interfaces
*
*****************************************************************************/
@ -46,18 +45,11 @@
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/actables.h>
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbxface")
/* Local prototypes */
static ACPI_STATUS
AcpiTbLoadNamespace (
void);
/*******************************************************************************
*
@ -456,165 +448,6 @@ AcpiGetTableByIndex (
ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex)
/*******************************************************************************
*
* FUNCTION: AcpiTbLoadNamespace
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
* the RSDT/XSDT.
*
******************************************************************************/
static ACPI_STATUS
AcpiTbLoadNamespace (
void)
{
ACPI_STATUS Status;
UINT32 i;
ACPI_TABLE_HEADER *NewDsdt;
ACPI_FUNCTION_TRACE (TbLoadNamespace);
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
/*
* Load the namespace. The DSDT is required, but any SSDT and
* PSDT tables are optional. Verify the DSDT.
*/
if (!AcpiGbl_RootTableList.CurrentTableCount ||
!ACPI_COMPARE_NAME (
&(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
ACPI_SIG_DSDT) ||
ACPI_FAILURE (AcpiTbVerifyTable (
&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
{
Status = AE_NO_ACPI_TABLES;
goto UnlockAndExit;
}
/*
* Save the DSDT pointer for simple access. This is the mapped memory
* address. We must take care here because the address of the .Tables
* array can change dynamically as tables are loaded at run-time. Note:
* .Pointer field is not validated until after call to AcpiTbVerifyTable.
*/
AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer;
/*
* Optionally copy the entire DSDT to local memory (instead of simply
* mapping it.) There are some BIOSs that corrupt or replace the original
* DSDT, creating the need for this option. Default is FALSE, do not copy
* the DSDT.
*/
if (AcpiGbl_CopyDsdtLocally)
{
NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT);
if (NewDsdt)
{
AcpiGbl_DSDT = NewDsdt;
}
}
/*
* Save the original DSDT header for detection of table corruption
* and/or replacement of the DSDT from outside the OS.
*/
ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
sizeof (ACPI_TABLE_HEADER));
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
/* Load and parse tables */
Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
for (i = 2; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_SSDT) &&
!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_PSDT)) ||
ACPI_FAILURE (AcpiTbVerifyTable (
&AcpiGbl_RootTableList.Tables[i])))
{
continue;
}
/* Skip SSDT when DSDT is overriden */
if (ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_SSDT) &&
(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags &
ACPI_TABLE_ORIGIN_OVERRIDE))
{
continue;
}
/* Ignore errors while loading tables, get as many as possible */
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
(void) AcpiNsLoadTable (i, AcpiGbl_RootNode);
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiLoadTables
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
*
******************************************************************************/
ACPI_STATUS
AcpiLoadTables (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiLoadTables);
/* Load the namespace from the tables */
Status = AcpiTbLoadNamespace ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"While loading namespace from ACPI tables"));
}
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiLoadTables)
/*******************************************************************************
*
* FUNCTION: AcpiInstallTableHandler

View File

@ -0,0 +1,415 @@
/******************************************************************************
*
* Module Name: tbxfload - Table load/unload external interfaces
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2012, Intel Corp.
* 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.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
*/
#define __TBXFLOAD_C__
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/actables.h>
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbxfload")
/* Local prototypes */
static ACPI_STATUS
AcpiTbLoadNamespace (
void);
/*******************************************************************************
*
* FUNCTION: AcpiLoadTables
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
*
******************************************************************************/
ACPI_STATUS
AcpiLoadTables (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiLoadTables);
/* Load the namespace from the tables */
Status = AcpiTbLoadNamespace ();
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"While loading namespace from ACPI tables"));
}
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiLoadTables)
/*******************************************************************************
*
* FUNCTION: AcpiTbLoadNamespace
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
* the RSDT/XSDT.
*
******************************************************************************/
static ACPI_STATUS
AcpiTbLoadNamespace (
void)
{
ACPI_STATUS Status;
UINT32 i;
ACPI_TABLE_HEADER *NewDsdt;
ACPI_FUNCTION_TRACE (TbLoadNamespace);
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
/*
* Load the namespace. The DSDT is required, but any SSDT and
* PSDT tables are optional. Verify the DSDT.
*/
if (!AcpiGbl_RootTableList.CurrentTableCount ||
!ACPI_COMPARE_NAME (
&(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
ACPI_SIG_DSDT) ||
ACPI_FAILURE (AcpiTbVerifyTable (
&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
{
Status = AE_NO_ACPI_TABLES;
goto UnlockAndExit;
}
/*
* Save the DSDT pointer for simple access. This is the mapped memory
* address. We must take care here because the address of the .Tables
* array can change dynamically as tables are loaded at run-time. Note:
* .Pointer field is not validated until after call to AcpiTbVerifyTable.
*/
AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer;
/*
* Optionally copy the entire DSDT to local memory (instead of simply
* mapping it.) There are some BIOSs that corrupt or replace the original
* DSDT, creating the need for this option. Default is FALSE, do not copy
* the DSDT.
*/
if (AcpiGbl_CopyDsdtLocally)
{
NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT);
if (NewDsdt)
{
AcpiGbl_DSDT = NewDsdt;
}
}
/*
* Save the original DSDT header for detection of table corruption
* and/or replacement of the DSDT from outside the OS.
*/
ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
sizeof (ACPI_TABLE_HEADER));
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
/* Load and parse tables */
Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
for (i = 2; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_SSDT) &&
!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_PSDT)) ||
ACPI_FAILURE (AcpiTbVerifyTable (
&AcpiGbl_RootTableList.Tables[i])))
{
continue;
}
/* Skip SSDT when it is overriden with DSDT */
if (ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_SSDT) &&
(AcpiGbl_RootTableList.Tables[i].Flags &
ACPI_TABLE_ORIGIN_OVERRIDE))
{
continue;
}
/* Ignore errors while loading tables, get as many as possible */
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
(void) AcpiNsLoadTable (i, AcpiGbl_RootNode);
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiLoadTable
*
* PARAMETERS: Table - Pointer to a buffer containing the ACPI
* table to be loaded.
*
* RETURN: Status
*
* DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
* be a valid ACPI table with a valid ACPI table header.
* Note1: Mainly intended to support hotplug addition of SSDTs.
* Note2: Does not copy the incoming table. User is reponsible
* to ensure that the table is not deleted or unmapped.
*
******************************************************************************/
ACPI_STATUS
AcpiLoadTable (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_TABLE_DESC TableDesc;
UINT32 TableIndex;
ACPI_FUNCTION_TRACE (AcpiLoadTable);
/* Parameter validation */
if (!Table)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Init local table descriptor */
ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC));
TableDesc.Address = ACPI_PTR_TO_PHYSADDR (Table);
TableDesc.Pointer = Table;
TableDesc.Length = Table->Length;
TableDesc.Flags = ACPI_TABLE_ORIGIN_UNKNOWN;
/* Must acquire the interpreter lock during this operation */
Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Install the table and load it into the namespace */
ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:"));
Status = AcpiTbAddTable (&TableDesc, &TableIndex);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
Status = AcpiNsLoadTable (TableIndex, AcpiGbl_RootNode);
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
AcpiGbl_TableHandlerContext);
}
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiLoadTable)
/*******************************************************************************
*
* FUNCTION: AcpiUnloadParentTable
*
* PARAMETERS: Object - Handle to any namespace object owned by
* the table to be unloaded
*
* RETURN: Status
*
* DESCRIPTION: Via any namespace object within an SSDT or OEMx table, unloads
* the table and deletes all namespace objects associated with
* that table. Unloading of the DSDT is not allowed.
* Note: Mainly intended to support hotplug removal of SSDTs.
*
******************************************************************************/
ACPI_STATUS
AcpiUnloadParentTable (
ACPI_HANDLE Object)
{
ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object);
ACPI_STATUS Status = AE_NOT_EXIST;
ACPI_OWNER_ID OwnerId;
UINT32 i;
ACPI_FUNCTION_TRACE (AcpiUnloadParentTable);
/* Parameter validation */
if (!Object)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* The node OwnerId is currently the same as the parent table ID.
* However, this could change in the future.
*/
OwnerId = Node->OwnerId;
if (!OwnerId)
{
/* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */
return_ACPI_STATUS (AE_TYPE);
}
/* Must acquire the interpreter lock during this operation */
Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Find the table in the global table list */
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId)
{
continue;
}
/*
* Allow unload of SSDT and OEMx tables only. Do not allow unload
* of the DSDT. No other types of tables should get here, since
* only these types can contain AML and thus are the only types
* that can create namespace objects.
*/
if (ACPI_COMPARE_NAME (
AcpiGbl_RootTableList.Tables[i].Signature.Ascii,
ACPI_SIG_DSDT))
{
Status = AE_TYPE;
break;
}
/* Ensure the table is actually loaded */
if (!AcpiTbIsTableLoaded (i))
{
Status = AE_NOT_EXIST;
break;
}
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD,
AcpiGbl_RootTableList.Tables[i].Pointer,
AcpiGbl_TableHandlerContext);
}
/*
* Delete all namespace objects owned by this table. Note that
* these objects can appear anywhere in the namespace by virtue
* of the AML "Scope" operator. Thus, we need to track ownership
* by an ID, not simply a position within the hierarchy.
*/
Status = AcpiTbDeleteNamespaceByOwner (i);
if (ACPI_FAILURE (Status))
{
break;
}
Status = AcpiTbReleaseOwnerId (i);
AcpiTbSetTableLoadedFlag (i, FALSE);
break;
}
(void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiUnloadParentTable)

View File

@ -234,7 +234,7 @@ AcpiFindRootPointer (
/* A valid RSDP was not found */
ACPI_ERROR ((AE_INFO, "A valid RSDP was not found"));
ACPI_BIOS_ERROR ((AE_INFO, "A valid RSDP was not found"));
return_ACPI_STATUS (AE_NOT_FOUND);
}

View File

@ -51,47 +51,6 @@
ACPI_MODULE_NAME ("utdecode")
/*******************************************************************************
*
* FUNCTION: AcpiFormatException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. A valid pointer is
* always returned.
*
* DESCRIPTION: This function translates an ACPI exception into an ASCII string
* It is here instead of utxface.c so it is always present.
*
******************************************************************************/
const char *
AcpiFormatException (
ACPI_STATUS Status)
{
const char *Exception = NULL;
ACPI_FUNCTION_ENTRY ();
Exception = AcpiUtValidateException (Status);
if (!Exception)
{
/* Exception code was not recognized */
ACPI_ERROR ((AE_INFO,
"Unknown exception code: 0x%8.8X", Status));
Exception = "UNKNOWN_STATUS_CODE";
}
return (ACPI_CAST_PTR (const char, Exception));
}
ACPI_EXPORT_SYMBOL (AcpiFormatException)
/*
* Properties of the ACPI Object Types, both internal and external.
* The table is indexed by values of ACPI_OBJECT_TYPE
@ -180,16 +139,17 @@ AcpiUtHexToAsciiChar (
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
{
"SystemMemory",
"SystemIO",
"PCI_Config",
"EmbeddedControl",
"SMBus",
"SystemCMOS",
"PCIBARTarget",
"IPMI",
"GeneralPurposeIo",
"GenericSerialBus"
"SystemMemory", /* 0x00 */
"SystemIO", /* 0x01 */
"PCI_Config", /* 0x02 */
"EmbeddedControl", /* 0x03 */
"SMBus", /* 0x04 */
"SystemCMOS", /* 0x05 */
"PCIBARTarget", /* 0x06 */
"IPMI", /* 0x07 */
"GeneralPurposeIo", /* 0x08 */
"GenericSerialBus", /* 0x09 */
"PCC" /* 0x0A */
};

View File

@ -0,0 +1,174 @@
/*******************************************************************************
*
* Module Name: utexcep - Exception code support
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2012, Intel Corp.
* 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.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
*/
#define __UTEXCEP_C__
#define ACPI_DEFINE_EXCEPTION_TABLE
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utexcep")
/*******************************************************************************
*
* FUNCTION: AcpiFormatException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. A valid pointer is
* always returned.
*
* DESCRIPTION: This function translates an ACPI exception into an ASCII
* string. Returns "unknown status" string for invalid codes.
*
******************************************************************************/
const char *
AcpiFormatException (
ACPI_STATUS Status)
{
const char *Exception = NULL;
ACPI_FUNCTION_ENTRY ();
Exception = AcpiUtValidateException (Status);
if (!Exception)
{
/* Exception code was not recognized */
ACPI_ERROR ((AE_INFO,
"Unknown exception code: 0x%8.8X", Status));
Exception = "UNKNOWN_STATUS_CODE";
}
return (ACPI_CAST_PTR (const char, Exception));
}
ACPI_EXPORT_SYMBOL (AcpiFormatException)
/*******************************************************************************
*
* FUNCTION: AcpiUtValidateException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. NULL if exception is
* not valid.
*
* DESCRIPTION: This function validates and translates an ACPI exception into
* an ASCII string.
*
******************************************************************************/
const char *
AcpiUtValidateException (
ACPI_STATUS Status)
{
UINT32 SubStatus;
const char *Exception = NULL;
ACPI_FUNCTION_ENTRY ();
/*
* Status is composed of two parts, a "type" and an actual code
*/
SubStatus = (Status & ~AE_CODE_MASK);
switch (Status & AE_CODE_MASK)
{
case AE_CODE_ENVIRONMENTAL:
if (SubStatus <= AE_CODE_ENV_MAX)
{
Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
}
break;
case AE_CODE_PROGRAMMER:
if (SubStatus <= AE_CODE_PGM_MAX)
{
Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus];
}
break;
case AE_CODE_ACPI_TABLES:
if (SubStatus <= AE_CODE_TBL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus];
}
break;
case AE_CODE_AML:
if (SubStatus <= AE_CODE_AML_MAX)
{
Exception = AcpiGbl_ExceptionNames_Aml [SubStatus];
}
break;
case AE_CODE_CONTROL:
if (SubStatus <= AE_CODE_CTRL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus];
}
break;
default:
break;
}
return (ACPI_CAST_PTR (const char, Exception));
}

View File

@ -211,8 +211,9 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
*
* RETURN: Status
*
* DESCRIPTION: Init ACPICA globals. All globals that require specific
* initialization should be initialized here!
* DESCRIPTION: Initialize ACPICA globals. All globals that require specific
* initialization should be initialized here. This allows for
* a warm restart.
*
******************************************************************************/

View File

@ -90,86 +90,6 @@ UtConvertBackslashes (
#endif
/*******************************************************************************
*
* FUNCTION: AcpiUtValidateException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. NULL if exception is
* not valid.
*
* DESCRIPTION: This function validates and translates an ACPI exception into
* an ASCII string.
*
******************************************************************************/
const char *
AcpiUtValidateException (
ACPI_STATUS Status)
{
UINT32 SubStatus;
const char *Exception = NULL;
ACPI_FUNCTION_ENTRY ();
/*
* Status is composed of two parts, a "type" and an actual code
*/
SubStatus = (Status & ~AE_CODE_MASK);
switch (Status & AE_CODE_MASK)
{
case AE_CODE_ENVIRONMENTAL:
if (SubStatus <= AE_CODE_ENV_MAX)
{
Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
}
break;
case AE_CODE_PROGRAMMER:
if (SubStatus <= AE_CODE_PGM_MAX)
{
Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus];
}
break;
case AE_CODE_ACPI_TABLES:
if (SubStatus <= AE_CODE_TBL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus];
}
break;
case AE_CODE_AML:
if (SubStatus <= AE_CODE_AML_MAX)
{
Exception = AcpiGbl_ExceptionNames_Aml [SubStatus];
}
break;
case AE_CODE_CONTROL:
if (SubStatus <= AE_CODE_CTRL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus];
}
break;
default:
break;
}
return (ACPI_CAST_PTR (const char, Exception));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtIsPciRootBridge

View File

@ -366,7 +366,7 @@ AcpiUtCreateStringObject (
*
* RETURN: TRUE if object is valid, FALSE otherwise
*
* DESCRIPTION: Validate a pointer to be an ACPI_OPERAND_OBJECT
* DESCRIPTION: Validate a pointer to be of type ACPI_OPERAND_OBJECT
*
******************************************************************************/
@ -392,7 +392,7 @@ AcpiUtValidInternalObject (
{
case ACPI_DESC_TYPE_OPERAND:
/* The object appears to be a valid ACPI_OPERAND_OBJECT */
/* The object appears to be a valid ACPI_OPERAND_OBJECT */
return (TRUE);
@ -473,7 +473,7 @@ AcpiUtDeleteObjectDesc (
ACPI_FUNCTION_TRACE_PTR (UtDeleteObjectDesc, Object);
/* Object must be an ACPI_OPERAND_OBJECT */
/* Object must be of type ACPI_OPERAND_OBJECT */
if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
{

View File

@ -1,6 +1,6 @@
/*******************************************************************************
*
* Module Name: utresrc - Resource managment utilities
* Module Name: utresrc - Resource management utilities
*
******************************************************************************/
@ -57,7 +57,7 @@
/*
* Strings used to decode resource descriptors.
* Used by both the disasssembler and the debugger resource dump routines
* Used by both the disassembler and the debugger resource dump routines
*/
const char *AcpiGbl_BmDecode[] =
{

View File

@ -87,6 +87,9 @@ extern FILE *AcpiGbl_OutputFile;
#define ACPI_MSG_WARNING "ACPI Warning: "
#define ACPI_MSG_INFO "ACPI: "
#define ACPI_MSG_BIOS_ERROR "ACPI Firmware Error: "
#define ACPI_MSG_BIOS_WARNING "ACPI Firmware Warning: "
/*
* Common message suffix
*/
@ -257,6 +260,84 @@ AcpiInfo (
ACPI_EXPORT_SYMBOL (AcpiInfo)
/*******************************************************************************
*
* FUNCTION: AcpiBiosError
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
* Format - Printf format string + additional args
*
* RETURN: None
*
* DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
* info
*
******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
AcpiBiosError (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
...)
{
va_list ArgList;
ACPI_MSG_REDIRECT_BEGIN;
AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
va_start (ArgList, Format);
AcpiOsVprintf (Format, ArgList);
ACPI_MSG_SUFFIX;
va_end (ArgList);
ACPI_MSG_REDIRECT_END;
}
ACPI_EXPORT_SYMBOL (AcpiBiosError)
/*******************************************************************************
*
* FUNCTION: AcpiBiosWarning
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
* Format - Printf format string + additional args
*
* RETURN: None
*
* DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
* info
*
******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
AcpiBiosWarning (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
...)
{
va_list ArgList;
ACPI_MSG_REDIRECT_BEGIN;
AcpiOsPrintf (ACPI_MSG_BIOS_WARNING);
va_start (ArgList, Format);
AcpiOsVprintf (Format, ArgList);
ACPI_MSG_SUFFIX;
va_end (ArgList);
ACPI_MSG_REDIRECT_END;
}
ACPI_EXPORT_SYMBOL (AcpiBiosWarning)
/*
* The remainder of this module contains internal error functions that may
* be configured out.

View File

@ -112,8 +112,7 @@ AcpiDbDisplayTemplate (
void
AcpiDbUnloadAcpiTable (
char *TableArg,
char *InstanceArg);
char *Name);
void
AcpiDbSendNotify (

View File

@ -53,6 +53,7 @@
#define AE_CODE_ACPI_TABLES 0x2000
#define AE_CODE_AML 0x3000
#define AE_CODE_CONTROL 0x4000
#define AE_CODE_MAX 0x4000
#define AE_CODE_MASK 0xF000
@ -188,7 +189,7 @@
/* Exception strings for AcpiFormatException */
#ifdef DEFINE_ACPI_GLOBALS
#ifdef ACPI_DEFINE_EXCEPTION_TABLE
/*
* String versions of the exception codes above
@ -307,6 +308,6 @@ char const *AcpiGbl_ExceptionNames_Ctrl[] =
"AE_CTRL_PARSE_PENDING"
};
#endif /* ACPI GLOBALS */
#endif /* EXCEPTION_TABLE */
#endif /* __ACEXCEP_H__ */

View File

@ -287,17 +287,8 @@ ACPI_EXTERN UINT8 AcpiGbl_OsiData;
ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces;
ACPI_EXTERN ACPI_ADDRESS_RANGE *AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX];
#ifndef DEFINE_ACPI_GLOBALS
/* Exception codes */
extern char const *AcpiGbl_ExceptionNames_Env[];
extern char const *AcpiGbl_ExceptionNames_Pgm[];
extern char const *AcpiGbl_ExceptionNames_Tbl[];
extern char const *AcpiGbl_ExceptionNames_Aml[];
extern char const *AcpiGbl_ExceptionNames_Ctrl[];
/* Other miscellaneous */
extern BOOLEAN AcpiGbl_Shutdown;

View File

@ -274,8 +274,8 @@
#define ACPI_INSERT_BITS(Target, Mask, Source) Target = ((Target & (~(Mask))) | (Source & Mask))
/*
* An ACPI_NAMESPACE_NODE can appear in some contexts
* where a pointer to an ACPI_OPERAND_OBJECT can also
* An object of type ACPI_NAMESPACE_NODE can appear in some contexts
* where a pointer to an object of type ACPI_OPERAND_OBJECT can also
* appear. This macro is used to distinguish them.
*
* The "Descriptor" field is the first field in both structures.

View File

@ -123,8 +123,8 @@ typedef struct acpi_object_integer
/*
* Note: The String and Buffer object must be identical through the Pointer
* and Length elements. There is code that depends on this.
* Note: The String and Buffer object must be identical through the
* pointer and length elements. There is code that depends on this.
*
* Fields common to both Strings and Buffers
*/

View File

@ -217,6 +217,8 @@
#define ACPI_WARNING(plist) AcpiWarning plist
#define ACPI_EXCEPTION(plist) AcpiException plist
#define ACPI_ERROR(plist) AcpiError plist
#define ACPI_BIOS_WARNING(plist) AcpiBiosWarning plist
#define ACPI_BIOS_ERROR(plist) AcpiBiosError plist
#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i)
#else
@ -227,6 +229,8 @@
#define ACPI_WARNING(plist)
#define ACPI_EXCEPTION(plist)
#define ACPI_ERROR(plist)
#define ACPI_BIOS_WARNING(plist)
#define ACPI_BIOS_ERROR(plist)
#define ACPI_DEBUG_OBJECT(obj,l,i)
#endif /* ACPI_NO_ERROR_MESSAGES */

View File

@ -48,7 +48,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20120620
#define ACPI_CA_VERSION 0x20120711
#include <contrib/dev/acpica/include/acconfig.h>
#include <contrib/dev/acpica/include/actypes.h>
@ -200,6 +200,22 @@ AcpiFree (
void *Address);
/*
* ACPI table load/unload interfaces
*/
ACPI_STATUS
AcpiLoadTable (
ACPI_TABLE_HEADER *Table);
ACPI_STATUS
AcpiUnloadParentTable (
ACPI_HANDLE Object);
ACPI_STATUS
AcpiLoadTables (
void);
/*
* ACPI table manipulation interfaces
*/
@ -211,10 +227,6 @@ ACPI_STATUS
AcpiFindRootPointer (
ACPI_SIZE *RsdpAddress);
ACPI_STATUS
AcpiLoadTables (
void);
ACPI_STATUS
AcpiGetTableHeader (
ACPI_STRING Signature,
@ -757,6 +769,20 @@ AcpiInfo (
const char *Format,
...) ACPI_PRINTF_LIKE(3);
void ACPI_INTERNAL_VAR_XFACE
AcpiBiosError (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
...) ACPI_PRINTF_LIKE(3);
void ACPI_INTERNAL_VAR_XFACE
AcpiBiosWarning (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
...) ACPI_PRINTF_LIKE(3);
/*
* Debug output

View File

@ -130,7 +130,7 @@ typedef struct acpi_table_bert
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
UINT32 RegionLength; /* Length of the boot error region */
UINT64 Address; /* Physical addresss of the error region */
UINT64 Address; /* Physical address of the error region */
} ACPI_TABLE_BERT;

View File

@ -108,9 +108,9 @@
#endif
#ifdef ACPI_HELP_APP
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#define ACPI_NO_ERROR_MESSAGES
#endif
/* Linkable ACPICA library */

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