MFH
Sponsored by: The FreeBSD Foundation
This commit is contained in:
commit
317cec3c43
@ -25,7 +25,18 @@ test: ${PROG} gen
|
|||||||
LC_ALL=en_US.US-ASCII hexdump -C | \
|
LC_ALL=en_US.US-ASCII hexdump -C | \
|
||||||
diff -I FreeBSD - ${.CURDIR}/ref.${conv}
|
diff -I FreeBSD - ${.CURDIR}/ref.${conv}
|
||||||
.endfor
|
.endfor
|
||||||
@rm -f gen
|
@${ECHO} "testing sparse file (obs zeroes)"
|
||||||
|
@./gen 189284 | ./dd ibs=16 obs=8 conv=sparse of=obs_zeroes 2> /dev/null
|
||||||
|
@hexdump -C obs_zeroes | diff -I FreeBSD - ${.CURDIR}/ref.obs_zeroes
|
||||||
|
|
||||||
|
@${ECHO} "testing spase file (all zeroes)"
|
||||||
|
@./dd if=/dev/zero of=1M_zeroes bs=1048576 count=1 2> /dev/null
|
||||||
|
@./dd if=1M_zeroes of=1M_zeroes.1 bs=1048576 conv=sparse 2> /dev/null
|
||||||
|
@./dd if=1M_zeroes of=1M_zeroes.2 bs=1048576 2> /dev/null
|
||||||
|
@diff 1M_zeroes 1M_zeroes.1
|
||||||
|
@diff 1M_zeroes 1M_zeroes.2
|
||||||
|
|
||||||
|
@rm -f gen 1M_zeroes* obs_zeroes
|
||||||
|
|
||||||
.if ${MK_TESTS} != "no"
|
.if ${MK_TESTS} != "no"
|
||||||
SUBDIR+= tests
|
SUBDIR+= tests
|
||||||
|
@ -422,11 +422,10 @@ get_num(const char *val)
|
|||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
num = strtoumax(val, &expr, 0);
|
num = strtoumax(val, &expr, 0);
|
||||||
if (errno != 0) /* Overflow or underflow. */
|
|
||||||
err(1, "%s", oper);
|
|
||||||
|
|
||||||
if (expr == val) /* No valid digits. */
|
if (expr == val) /* No valid digits. */
|
||||||
errx(1, "%s: illegal numeric value", oper);
|
errx(1, "%s: invalid numeric value", oper);
|
||||||
|
if (errno != 0)
|
||||||
|
err(1, "%s", oper);
|
||||||
|
|
||||||
mult = postfix_to_mult(*expr);
|
mult = postfix_to_mult(*expr);
|
||||||
|
|
||||||
@ -472,11 +471,10 @@ get_off_t(const char *val)
|
|||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
num = strtoimax(val, &expr, 0);
|
num = strtoimax(val, &expr, 0);
|
||||||
if (errno != 0) /* Overflow or underflow. */
|
|
||||||
err(1, "%s", oper);
|
|
||||||
|
|
||||||
if (expr == val) /* No valid digits. */
|
if (expr == val) /* No valid digits. */
|
||||||
errx(1, "%s: illegal numeric value", oper);
|
errx(1, "%s: invalid numeric value", oper);
|
||||||
|
if (errno != 0)
|
||||||
|
err(1, "%s", oper);
|
||||||
|
|
||||||
mult = postfix_to_mult(*expr);
|
mult = postfix_to_mult(*expr);
|
||||||
|
|
||||||
|
36
bin/dd/dd.c
36
bin/dd/dd.c
@ -77,7 +77,6 @@ STAT st; /* statistics */
|
|||||||
void (*cfunc)(void); /* conversion function */
|
void (*cfunc)(void); /* conversion function */
|
||||||
uintmax_t cpy_cnt; /* # of blocks to copy */
|
uintmax_t cpy_cnt; /* # of blocks to copy */
|
||||||
static off_t pending = 0; /* pending seek if sparse */
|
static off_t pending = 0; /* pending seek if sparse */
|
||||||
static off_t last_sp = 0; /* size of last added sparse block */
|
|
||||||
u_int ddflags = 0; /* conversion options */
|
u_int ddflags = 0; /* conversion options */
|
||||||
size_t cbsz; /* conversion block size */
|
size_t cbsz; /* conversion block size */
|
||||||
uintmax_t files_cnt = 1; /* # of files to copy */
|
uintmax_t files_cnt = 1; /* # of files to copy */
|
||||||
@ -409,6 +408,15 @@ dd_close(void)
|
|||||||
}
|
}
|
||||||
if (out.dbcnt || pending)
|
if (out.dbcnt || pending)
|
||||||
dd_out(1);
|
dd_out(1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the file ends with a hole, ftruncate it to extend its size
|
||||||
|
* up to the end of the hole (without having to write any data).
|
||||||
|
*/
|
||||||
|
if (out.seek_offset > 0 && (out.flags & ISTRUNC)) {
|
||||||
|
if (ftruncate(out.fd, out.seek_offset) == -1)
|
||||||
|
err(1, "truncating %s", out.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -457,29 +465,27 @@ dd_out(int force)
|
|||||||
}
|
}
|
||||||
if (sparse && !force) {
|
if (sparse && !force) {
|
||||||
pending += cnt;
|
pending += cnt;
|
||||||
last_sp = cnt;
|
|
||||||
nw = cnt;
|
nw = cnt;
|
||||||
} else {
|
} else {
|
||||||
if (pending != 0) {
|
if (pending != 0) {
|
||||||
/* If forced to write, and we have no
|
/*
|
||||||
* data left, we need to write the last
|
* Seek past hole. Note that we need to record the
|
||||||
* sparse block explicitly.
|
* reached offset, because we might have no more data
|
||||||
|
* to write, in which case we'll need to call
|
||||||
|
* ftruncate to extend the file size.
|
||||||
*/
|
*/
|
||||||
if (force && cnt == 0) {
|
out.seek_offset = lseek(out.fd, pending, SEEK_CUR);
|
||||||
pending -= last_sp;
|
if (out.seek_offset == -1)
|
||||||
assert(outp == out.db);
|
|
||||||
memset(outp, 0, cnt);
|
|
||||||
}
|
|
||||||
if (lseek(out.fd, pending, SEEK_CUR) ==
|
|
||||||
-1)
|
|
||||||
err(2, "%s: seek error creating sparse file",
|
err(2, "%s: seek error creating sparse file",
|
||||||
out.name);
|
out.name);
|
||||||
pending = last_sp = 0;
|
pending = 0;
|
||||||
}
|
}
|
||||||
if (cnt)
|
if (cnt) {
|
||||||
nw = write(out.fd, outp, cnt);
|
nw = write(out.fd, outp, cnt);
|
||||||
else
|
out.seek_offset = 0;
|
||||||
|
} else {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nw <= 0) {
|
if (nw <= 0) {
|
||||||
|
@ -54,6 +54,7 @@ typedef struct {
|
|||||||
const char *name; /* name */
|
const char *name; /* name */
|
||||||
int fd; /* file descriptor */
|
int fd; /* file descriptor */
|
||||||
off_t offset; /* # of blocks to skip */
|
off_t offset; /* # of blocks to skip */
|
||||||
|
off_t seek_offset; /* offset of last seek past output hole */
|
||||||
} IO;
|
} IO;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
13
bin/dd/gen.c
13
bin/dd/gen.c
@ -5,13 +5,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc __unused, char **argv __unused)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
if (argc > 1 && !strcmp(argv[1], "189284")) {
|
||||||
putchar(i);
|
fputs("ABCDEFGH", stdout);
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
putchar(0);
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < 256; i++)
|
||||||
|
putchar(i);
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
3
bin/dd/ref.obs_zeroes
Normal file
3
bin/dd/ref.obs_zeroes
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
$FreeBSD$
|
||||||
|
00000000 41 42 43 44 45 46 47 48 00 00 00 00 00 00 00 00 |ABCDEFGH........|
|
||||||
|
00000010
|
@ -144,9 +144,11 @@ rmaliases(void)
|
|||||||
struct alias *
|
struct alias *
|
||||||
lookupalias(const char *name, int check)
|
lookupalias(const char *name, int check)
|
||||||
{
|
{
|
||||||
struct alias *ap = *hashalias(name);
|
struct alias *ap;
|
||||||
|
|
||||||
for (; ap; ap = ap->next) {
|
if (aliases == 0)
|
||||||
|
return (NULL);
|
||||||
|
for (ap = *hashalias(name); ap; ap = ap->next) {
|
||||||
if (equal(name, ap->name)) {
|
if (equal(name, ap->name)) {
|
||||||
if (check && (ap->flag & ALIASINUSE))
|
if (check && (ap->flag & ALIASINUSE))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -195,8 +195,7 @@ retry:
|
|||||||
int
|
int
|
||||||
preadbuffer(void)
|
preadbuffer(void)
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q, *r, *end;
|
||||||
int more;
|
|
||||||
char savec;
|
char savec;
|
||||||
|
|
||||||
while (parsefile->strpush) {
|
while (parsefile->strpush) {
|
||||||
@ -213,8 +212,6 @@ preadbuffer(void)
|
|||||||
}
|
}
|
||||||
if (parsenleft == EOF_NLEFT || parsefile->buf == NULL)
|
if (parsenleft == EOF_NLEFT || parsefile->buf == NULL)
|
||||||
return PEOF;
|
return PEOF;
|
||||||
flushout(&output);
|
|
||||||
flushout(&errout);
|
|
||||||
|
|
||||||
again:
|
again:
|
||||||
if (parselleft <= 0) {
|
if (parselleft <= 0) {
|
||||||
@ -224,34 +221,31 @@ again:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
q = p = parsefile->buf + (parsenextc - parsefile->buf);
|
p = parsefile->buf + (parsenextc - parsefile->buf);
|
||||||
|
end = p + parselleft;
|
||||||
/* delete nul characters */
|
*end = '\0';
|
||||||
for (more = 1; more;) {
|
q = strchrnul(p, '\n');
|
||||||
switch (*p) {
|
if (q != end && *q == '\0') {
|
||||||
case '\0':
|
/* delete nul characters */
|
||||||
p++; /* Skip nul */
|
for (r = q; q != end; q++) {
|
||||||
goto check;
|
if (*q != '\0')
|
||||||
|
*r++ = *q;
|
||||||
case '\n':
|
|
||||||
parsenleft = q - parsenextc;
|
|
||||||
more = 0; /* Stop processing here */
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
*q++ = *p++;
|
|
||||||
check:
|
|
||||||
if (--parselleft <= 0) {
|
|
||||||
parsenleft = q - parsenextc - 1;
|
|
||||||
if (parsenleft < 0)
|
|
||||||
goto again;
|
|
||||||
*q = '\0';
|
|
||||||
more = 0;
|
|
||||||
}
|
}
|
||||||
|
parselleft -= end - r;
|
||||||
|
if (parselleft == 0)
|
||||||
|
goto again;
|
||||||
|
end = p + parselleft;
|
||||||
|
*end = '\0';
|
||||||
|
q = strchrnul(p, '\n');
|
||||||
}
|
}
|
||||||
|
if (q == end) {
|
||||||
|
parsenleft = parselleft;
|
||||||
|
parselleft = 0;
|
||||||
|
} else /* *q == '\n' */ {
|
||||||
|
parsenleft = q - parsenextc + 1;
|
||||||
|
parselleft -= parsenleft;
|
||||||
|
}
|
||||||
|
parsenleft--;
|
||||||
|
|
||||||
savec = *q;
|
savec = *q;
|
||||||
*q = '\0';
|
*q = '\0';
|
||||||
|
@ -1930,6 +1930,8 @@ static void
|
|||||||
setprompt(int which)
|
setprompt(int which)
|
||||||
{
|
{
|
||||||
whichprompt = which;
|
whichprompt = which;
|
||||||
|
if (which == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifndef NO_HISTORY
|
#ifndef NO_HISTORY
|
||||||
if (!el)
|
if (!el)
|
||||||
|
@ -28,6 +28,8 @@ FILES+= alias15.0 alias15.0.stdout
|
|||||||
FILES+= and-pipe-not.0
|
FILES+= and-pipe-not.0
|
||||||
FILES+= case1.0
|
FILES+= case1.0
|
||||||
FILES+= case2.0
|
FILES+= case2.0
|
||||||
|
FILES+= comment1.0
|
||||||
|
FILES+= comment2.42
|
||||||
FILES+= dollar-quote1.0
|
FILES+= dollar-quote1.0
|
||||||
FILES+= dollar-quote2.0
|
FILES+= dollar-quote2.0
|
||||||
FILES+= dollar-quote3.0
|
FILES+= dollar-quote3.0
|
||||||
@ -74,6 +76,7 @@ FILES+= line-cont10.0
|
|||||||
FILES+= line-cont11.0
|
FILES+= line-cont11.0
|
||||||
FILES+= no-space1.0
|
FILES+= no-space1.0
|
||||||
FILES+= no-space2.0
|
FILES+= no-space2.0
|
||||||
|
FILES+= nul1.0
|
||||||
FILES+= only-redir1.0
|
FILES+= only-redir1.0
|
||||||
FILES+= only-redir2.0
|
FILES+= only-redir2.0
|
||||||
FILES+= only-redir3.0
|
FILES+= only-redir3.0
|
||||||
|
3
bin/sh/tests/parser/comment1.0
Normal file
3
bin/sh/tests/parser/comment1.0
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
${SH} -c '#'
|
4
bin/sh/tests/parser/comment2.42
Normal file
4
bin/sh/tests/parser/comment2.42
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
${SH} -c '#
|
||||||
|
exit 42'
|
12
bin/sh/tests/parser/nul1.0
Normal file
12
bin/sh/tests/parser/nul1.0
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
# Although POSIX does not specify the effect of NUL bytes in scripts,
|
||||||
|
# we ignore them.
|
||||||
|
|
||||||
|
{
|
||||||
|
printf 'v=%03000d\0%02000d' 7 2
|
||||||
|
dd if=/dev/zero bs=1000 count=1 status=none
|
||||||
|
printf '1 w=%03000d%02000d1\0\n' 7 2
|
||||||
|
printf '\0l\0v\0=\0$\0{\0#\0v\0}\n'
|
||||||
|
printf '\0l\0w\0=\0\0$\0{\0#\0w}\0\0\0\n'
|
||||||
|
printf '[ "$lv.$lw.$v" = "5001.5001.$w" ]\n'
|
||||||
|
} | ${SH}
|
@ -1713,7 +1713,7 @@ zfs_do_get(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("invalid column name "
|
gettext("invalid column name "
|
||||||
"'%s'\n"), value);
|
"'%s'\n"), suboptarg);
|
||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1750,7 +1750,7 @@ zfs_do_get(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("invalid source "
|
gettext("invalid source "
|
||||||
"'%s'\n"), value);
|
"'%s'\n"), suboptarg);
|
||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1786,7 +1786,7 @@ zfs_do_get(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("invalid type '%s'\n"),
|
gettext("invalid type '%s'\n"),
|
||||||
value);
|
suboptarg);
|
||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3156,7 +3156,7 @@ zfs_do_list(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("invalid type '%s'\n"),
|
gettext("invalid type '%s'\n"),
|
||||||
value);
|
suboptarg);
|
||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5431,7 +5431,7 @@ zpool_do_get(int argc, char **argv)
|
|||||||
default:
|
default:
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("invalid column name "
|
gettext("invalid column name "
|
||||||
"'%s'\n"), value);
|
"'%s'\n"), suboptarg);
|
||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,13 +59,6 @@
|
|||||||
#define elf_info_to_howto 0
|
#define elf_info_to_howto 0
|
||||||
#define elf_info_to_howto_rel elf32_arm_info_to_howto
|
#define elf_info_to_howto_rel elf32_arm_info_to_howto
|
||||||
|
|
||||||
#define ARM_ELF_ABI_VERSION 0
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#define ARM_ELF_OS_ABI_VERSION ELFOSABI_FREEBSD
|
|
||||||
#else
|
|
||||||
#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct elf_backend_data elf32_arm_vxworks_bed;
|
static struct elf_backend_data elf32_arm_vxworks_bed;
|
||||||
|
|
||||||
/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
|
/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
|
||||||
@ -9377,11 +9370,8 @@ elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATT
|
|||||||
|
|
||||||
i_ehdrp = elf_elfheader (abfd);
|
i_ehdrp = elf_elfheader (abfd);
|
||||||
|
|
||||||
if (EF_ARM_EABI_VERSION (i_ehdrp->e_flags) == EF_ARM_EABI_UNKNOWN)
|
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
|
||||||
i_ehdrp->e_ident[EI_OSABI] = ARM_ELF_OS_ABI_VERSION;
|
i_ehdrp->e_ident[EI_ABIVERSION] = 0;
|
||||||
else
|
|
||||||
i_ehdrp->e_ident[EI_OSABI] = 0;
|
|
||||||
i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION;
|
|
||||||
|
|
||||||
if (link_info)
|
if (link_info)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
|
.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd May 6, 2015
|
.Dd February 19, 2016
|
||||||
.Dt DIRECTORY 3
|
.Dt DIRECTORY 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -46,7 +46,6 @@
|
|||||||
.Sh LIBRARY
|
.Sh LIBRARY
|
||||||
.Lb libc
|
.Lb libc
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.In sys/types.h
|
|
||||||
.In dirent.h
|
.In dirent.h
|
||||||
.Ft DIR *
|
.Ft DIR *
|
||||||
.Fn opendir "const char *filename"
|
.Fn opendir "const char *filename"
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
.\" @(#)lseek.2 8.3 (Berkeley) 4/19/94
|
.\" @(#)lseek.2 8.3 (Berkeley) 4/19/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd May 26, 2012
|
.Dd February 18, 2016
|
||||||
.Dt LSEEK 2
|
.Dt LSEEK 2
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -131,8 +131,14 @@ Applications can use
|
|||||||
.Dv SEEK_HOLE
|
.Dv SEEK_HOLE
|
||||||
to optimise their behavior for ranges of zeros, but must not depend on it to
|
to optimise their behavior for ranges of zeros, but must not depend on it to
|
||||||
find all such ranges in a file.
|
find all such ranges in a file.
|
||||||
|
Each file is presented as having a zero-size virtual hole at the very
|
||||||
|
end of the file.
|
||||||
The existence of a hole at the end of every data region allows for easy
|
The existence of a hole at the end of every data region allows for easy
|
||||||
programming and implies that a virtual hole exists at the end of the file.
|
programming and also provides compatibility to the original implementation
|
||||||
|
in Solaris.
|
||||||
|
It also causes the current file size (i.e., end-of-file offset) to be returned
|
||||||
|
to indicate that there are no more holes past the supplied
|
||||||
|
.Fa offset .
|
||||||
Applications should use
|
Applications should use
|
||||||
.Fn fpathconf _PC_MIN_HOLE_SIZE
|
.Fn fpathconf _PC_MIN_HOLE_SIZE
|
||||||
or
|
or
|
||||||
@ -176,9 +182,11 @@ be negative for a non-character special file.
|
|||||||
For
|
For
|
||||||
.Dv SEEK_DATA ,
|
.Dv SEEK_DATA ,
|
||||||
there are no more data regions past the supplied offset.
|
there are no more data regions past the supplied offset.
|
||||||
For
|
Due to existence of the hole at the end of the file, for
|
||||||
.Dv SEEK_HOLE ,
|
.Dv SEEK_HOLE
|
||||||
there are no more holes past the supplied offset.
|
this error is only returned when the
|
||||||
|
.Fa offset
|
||||||
|
already points to the end-of-file position.
|
||||||
.It Bq Er EOVERFLOW
|
.It Bq Er EOVERFLOW
|
||||||
The resulting file offset would be a value which cannot be represented
|
The resulting file offset would be a value which cannot be represented
|
||||||
correctly in an object of type
|
correctly in an object of type
|
||||||
|
@ -24,7 +24,7 @@ CLEANFILES+= h_nonexec
|
|||||||
.include "../../Makefile.netbsd-tests"
|
.include "../../Makefile.netbsd-tests"
|
||||||
|
|
||||||
h_zero:
|
h_zero:
|
||||||
dd if=/dev/zero of=h_zero bs=1k count=2
|
dd if=/dev/zero of=h_zero bs=1k count=2 status=none
|
||||||
chmod a+x h_zero
|
chmod a+x h_zero
|
||||||
|
|
||||||
CLEANFILES+= h_zero
|
CLEANFILES+= h_zero
|
||||||
|
@ -84,6 +84,6 @@ FILESPACKAGE= ${PACKAGE}
|
|||||||
|
|
||||||
CLEANFILES= truncate_test.root_owned
|
CLEANFILES= truncate_test.root_owned
|
||||||
truncate_test.root_owned:
|
truncate_test.root_owned:
|
||||||
dd if=/dev/null bs=1 count=1 of=${.TARGET}
|
dd if=/dev/null bs=1 count=1 of=${.TARGET} status=none
|
||||||
|
|
||||||
.include <bsd.test.mk>
|
.include <bsd.test.mk>
|
||||||
|
@ -183,7 +183,7 @@ _arm_initvtop(kvm_t *kd)
|
|||||||
#define l1pte_section_p(pde) (((pde) & ARM_L1_TYPE_MASK) == ARM_L1_TYPE_S)
|
#define l1pte_section_p(pde) (((pde) & ARM_L1_TYPE_MASK) == ARM_L1_TYPE_S)
|
||||||
#define l1pte_valid(pde) ((pde) != 0)
|
#define l1pte_valid(pde) ((pde) != 0)
|
||||||
#define l2pte_valid(pte) ((pte) != 0)
|
#define l2pte_valid(pte) ((pte) != 0)
|
||||||
#define l2pte_index(v) (((v) & ARM_L2_ADDR_BITS) >> ARM_L2_S_SHIFT)
|
#define l2pte_index(v) (((v) & ARM_L1_S_OFFSET) >> ARM_L2_S_SHIFT)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -29,10 +29,6 @@
|
|||||||
#ifndef __KVM_ARM_H__
|
#ifndef __KVM_ARM_H__
|
||||||
#define __KVM_ARM_H__
|
#define __KVM_ARM_H__
|
||||||
|
|
||||||
#ifdef __arm__
|
|
||||||
#include <machine/pte.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef uint32_t arm_physaddr_t;
|
typedef uint32_t arm_physaddr_t;
|
||||||
typedef uint32_t arm_pd_entry_t;
|
typedef uint32_t arm_pd_entry_t;
|
||||||
typedef uint32_t arm_pt_entry_t;
|
typedef uint32_t arm_pt_entry_t;
|
||||||
@ -72,11 +68,15 @@ typedef uint32_t arm_pt_entry_t;
|
|||||||
#define ARM_L2_TYPE_T 0x03 /* Tiny Page - 1k - not used */
|
#define ARM_L2_TYPE_T 0x03 /* Tiny Page - 1k - not used */
|
||||||
#define ARM_L2_TYPE_MASK 0x03
|
#define ARM_L2_TYPE_MASK 0x03
|
||||||
|
|
||||||
#define ARM_L2_ADDR_BITS 0x000ff000 /* L2 PTE address bits */
|
|
||||||
|
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
#include <machine/acle-compat.h>
|
#include <machine/acle-compat.h>
|
||||||
|
|
||||||
|
#if __ARM_ARCH >= 6
|
||||||
|
#include <machine/pte-v6.h>
|
||||||
|
#else
|
||||||
|
#include <machine/pte-v4.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
_Static_assert(PAGE_SHIFT == ARM_PAGE_SHIFT, "PAGE_SHIFT mismatch");
|
_Static_assert(PAGE_SHIFT == ARM_PAGE_SHIFT, "PAGE_SHIFT mismatch");
|
||||||
_Static_assert(PAGE_SIZE == ARM_PAGE_SIZE, "PAGE_SIZE mismatch");
|
_Static_assert(PAGE_SIZE == ARM_PAGE_SIZE, "PAGE_SIZE mismatch");
|
||||||
_Static_assert(PAGE_MASK == ARM_PAGE_MASK, "PAGE_MASK mismatch");
|
_Static_assert(PAGE_MASK == ARM_PAGE_MASK, "PAGE_MASK mismatch");
|
||||||
@ -106,7 +106,6 @@ _Static_assert(L2_TYPE_S == ARM_L2_TYPE_S, "L2_TYPE_S mismatch");
|
|||||||
_Static_assert(L2_TYPE_T == ARM_L2_TYPE_T, "L2_TYPE_T mismatch");
|
_Static_assert(L2_TYPE_T == ARM_L2_TYPE_T, "L2_TYPE_T mismatch");
|
||||||
#endif
|
#endif
|
||||||
_Static_assert(L2_TYPE_MASK == ARM_L2_TYPE_MASK, "L2_TYPE_MASK mismatch");
|
_Static_assert(L2_TYPE_MASK == ARM_L2_TYPE_MASK, "L2_TYPE_MASK mismatch");
|
||||||
_Static_assert(L2_ADDR_BITS == ARM_L2_ADDR_BITS, "L2_ADDR_BITS mismatch");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int _arm_native(kvm_t *);
|
int _arm_native(kvm_t *);
|
||||||
|
@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <x86/segments.h>
|
#include <x86/segments.h>
|
||||||
#include <machine/specialreg.h>
|
#include <machine/specialreg.h>
|
||||||
#include <machine/param.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -144,11 +144,12 @@ ifclonecreate(int s, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we get a different name back than we put in, print it.
|
* If we get a different name back than we put in, update record and
|
||||||
|
* indicate it should be printed later.
|
||||||
*/
|
*/
|
||||||
if (strncmp(name, ifr.ifr_name, sizeof(name)) != 0) {
|
if (strncmp(name, ifr.ifr_name, sizeof(name)) != 0) {
|
||||||
strlcpy(name, ifr.ifr_name, sizeof(name));
|
strlcpy(name, ifr.ifr_name, sizeof(name));
|
||||||
printf("%s\n", name);
|
printifname = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ int clearaddr;
|
|||||||
int newaddr = 1;
|
int newaddr = 1;
|
||||||
int verbose;
|
int verbose;
|
||||||
int noload;
|
int noload;
|
||||||
|
int printifname = 0;
|
||||||
|
|
||||||
int supmedia = 0;
|
int supmedia = 0;
|
||||||
int printkeys = 0; /* Print keying material for interfaces. */
|
int printkeys = 0; /* Print keying material for interfaces. */
|
||||||
@ -108,6 +109,8 @@ static struct afswtch *af_getbyname(const char *name);
|
|||||||
static struct afswtch *af_getbyfamily(int af);
|
static struct afswtch *af_getbyfamily(int af);
|
||||||
static void af_other_status(int);
|
static void af_other_status(int);
|
||||||
|
|
||||||
|
void printifnamemaybe(void);
|
||||||
|
|
||||||
static struct option *opts = NULL;
|
static struct option *opts = NULL;
|
||||||
|
|
||||||
struct ifa_order_elt {
|
struct ifa_order_elt {
|
||||||
@ -297,6 +300,12 @@ sortifaddrs(struct ifaddrs *list,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printifnamemaybe()
|
||||||
|
{
|
||||||
|
if (printifname)
|
||||||
|
printf("%s\n", name);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -314,6 +323,12 @@ main(int argc, char *argv[])
|
|||||||
size_t iflen;
|
size_t iflen;
|
||||||
|
|
||||||
all = downonly = uponly = namesonly = noload = verbose = 0;
|
all = downonly = uponly = namesonly = noload = verbose = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ensure we print interface name when expected to,
|
||||||
|
* even if we terminate early due to error.
|
||||||
|
*/
|
||||||
|
atexit(printifnamemaybe);
|
||||||
|
|
||||||
/* Parse leading line options */
|
/* Parse leading line options */
|
||||||
strlcpy(options, "adklmnuv", sizeof(options));
|
strlcpy(options, "adklmnuv", sizeof(options));
|
||||||
@ -1011,6 +1026,8 @@ setifname(const char *val, int dummy __unused, int s,
|
|||||||
const struct afswtch *afp)
|
const struct afswtch *afp)
|
||||||
{
|
{
|
||||||
char *newname;
|
char *newname;
|
||||||
|
|
||||||
|
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
|
||||||
|
|
||||||
newname = strdup(val);
|
newname = strdup(val);
|
||||||
if (newname == NULL)
|
if (newname == NULL)
|
||||||
@ -1020,6 +1037,7 @@ setifname(const char *val, int dummy __unused, int s,
|
|||||||
free(newname);
|
free(newname);
|
||||||
err(1, "ioctl SIOCSIFNAME (set name)");
|
err(1, "ioctl SIOCSIFNAME (set name)");
|
||||||
}
|
}
|
||||||
|
printifname = 1;
|
||||||
strlcpy(name, newname, sizeof(name));
|
strlcpy(name, newname, sizeof(name));
|
||||||
free(newname);
|
free(newname);
|
||||||
}
|
}
|
||||||
@ -1031,6 +1049,8 @@ setifdescr(const char *val, int dummy __unused, int s,
|
|||||||
{
|
{
|
||||||
char *newdescr;
|
char *newdescr;
|
||||||
|
|
||||||
|
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
|
||||||
|
|
||||||
ifr.ifr_buffer.length = strlen(val) + 1;
|
ifr.ifr_buffer.length = strlen(val) + 1;
|
||||||
if (ifr.ifr_buffer.length == 1) {
|
if (ifr.ifr_buffer.length == 1) {
|
||||||
ifr.ifr_buffer.buffer = newdescr = NULL;
|
ifr.ifr_buffer.buffer = newdescr = NULL;
|
||||||
|
@ -133,6 +133,7 @@ extern int supmedia;
|
|||||||
extern int printkeys;
|
extern int printkeys;
|
||||||
extern int newaddr;
|
extern int newaddr;
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
extern int printifname;
|
||||||
|
|
||||||
void setifcap(const char *, int value, int s, const struct afswtch *);
|
void setifcap(const char *, int value, int s, const struct afswtch *);
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
.\" Copyright (c) 2006, Ceri Davies <ceri@FreeBSD.org>
|
||||||
.\" Copyright (c) 2014, Luiz Otavio O Souza <loos@FreeBSD.org>
|
.\" Copyright (c) 2014, Luiz Otavio O Souza <loos@FreeBSD.org>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
@ -100,8 +101,18 @@ Consumers:
|
|||||||
The
|
The
|
||||||
.Nm
|
.Nm
|
||||||
driver was written by
|
driver was written by
|
||||||
.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org
|
.An Max Khon Aq Mt fjoe@FreeBSD.org
|
||||||
and
|
as
|
||||||
.An Aleksandr Rybalko Aq Mt ray@FreeBSD.org .
|
.Xr geom_uzip 4 .
|
||||||
|
.An Aleksandr Rybalko Aq Mt ray@FreeBSD.org
|
||||||
|
copied it over as
|
||||||
|
.Nm
|
||||||
|
and added LZMA functionality .
|
||||||
This manual page was written by
|
This manual page was written by
|
||||||
.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org .
|
.An Ceri Davies Aq Mt ceri@FreeBSD.org
|
||||||
|
for the
|
||||||
|
.Xr geom_uzip 4 ,
|
||||||
|
and modified by
|
||||||
|
.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org
|
||||||
|
to match
|
||||||
|
.Nm .
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd October 8, 2010
|
.Dd February 18, 2016
|
||||||
.Dt MAILER.CONF 5
|
.Dt MAILER.CONF 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -101,9 +101,10 @@ mailq /usr/libexec/sendmail/sendmail
|
|||||||
newaliases /usr/libexec/sendmail/sendmail
|
newaliases /usr/libexec/sendmail/sendmail
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
This example shows how to invoke a sendmail-workalike like
|
Using
|
||||||
.Nm Postfix
|
.Nm Postfix
|
||||||
in place of
|
(from ports)
|
||||||
|
to replace
|
||||||
.Xr sendmail 8 :
|
.Xr sendmail 8 :
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
# Emulate sendmail using postfix
|
# Emulate sendmail using postfix
|
||||||
@ -113,12 +114,10 @@ mailq /usr/local/sbin/sendmail
|
|||||||
newaliases /usr/local/sbin/sendmail
|
newaliases /usr/local/sbin/sendmail
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
This example shows
|
Using
|
||||||
how to invoke
|
|
||||||
a sendmail-workalike with
|
|
||||||
.Nm Exim
|
.Nm Exim
|
||||||
(from ports)
|
(from ports)
|
||||||
in place of
|
to replace
|
||||||
.Xr sendmail 8 :
|
.Xr sendmail 8 :
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
# Emulate sendmail using exim
|
# Emulate sendmail using exim
|
||||||
@ -129,24 +128,40 @@ newaliases /usr/bin/true
|
|||||||
rmail /usr/local/sbin/exim -i -oee
|
rmail /usr/local/sbin/exim -i -oee
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
This example shows the use of the
|
Using
|
||||||
.Nm mini_sendmail
|
.Nm mini_sendmail
|
||||||
package from ports in place of
|
(from ports)
|
||||||
.Xr sendmail 8 .
|
to replace
|
||||||
Note the use of additional arguments.
|
.Xr sendmail 8 :
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
# Send outgoing mail to a smart relay using mini_sendmail
|
# Send outgoing mail to a smart relay using mini_sendmail
|
||||||
sendmail /usr/local/bin/mini_sendmail -srelayhost
|
sendmail /usr/local/bin/mini_sendmail -srelayhost
|
||||||
send-mail /usr/local/bin/mini_sendmail -srelayhost
|
send-mail /usr/local/bin/mini_sendmail -srelayhost
|
||||||
.Ed
|
.Ed
|
||||||
|
.Pp
|
||||||
|
Using
|
||||||
|
.Xr dma 8
|
||||||
|
to replace
|
||||||
|
.Xr sendmail 8 :
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
# Execute dma instead of sendmail
|
||||||
|
sendmail /usr/libexec/dma
|
||||||
|
send-mail /usr/libexec/dma
|
||||||
|
mailq /usr/libexec/dma
|
||||||
|
newaliases /usr/libexec/dma
|
||||||
|
rmail /usr/libexec/dma
|
||||||
|
.Ed
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr mail 1 ,
|
.Xr mail 1 ,
|
||||||
.Xr mailq 1 ,
|
.Xr mailq 1 ,
|
||||||
.Xr newaliases 1 ,
|
.Xr newaliases 1 ,
|
||||||
|
.Xr dma 8 ,
|
||||||
.Xr mailwrapper 8 ,
|
.Xr mailwrapper 8 ,
|
||||||
.Xr sendmail 8
|
.Xr sendmail 8
|
||||||
.Pp
|
.Pp
|
||||||
.Xr postfix 1 Pq Pa ports/mail/postfix ,
|
.Xr postfix 1 Pq Pa ports/mail/postfix ,
|
||||||
|
.Xr dma 8 Pq Pa ports/mail/dma ,
|
||||||
|
.Xr exim 8 Pq Pa ports/mail/exim ,
|
||||||
.Xr mini_sendmail 8 Pq Pa ports/mail/mini_sendmail
|
.Xr mini_sendmail 8 Pq Pa ports/mail/mini_sendmail
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
.In sys/param.h
|
.In sys/param.h
|
||||||
.In vm/vm.h
|
.In vm/vm.h
|
||||||
.In vm/pmap.h
|
.In vm/pmap.h
|
||||||
.In machine/param.h
|
|
||||||
.In machine/pmap.h
|
|
||||||
.In machine/pc/bios.h
|
.In machine/pc/bios.h
|
||||||
.Ft uint32_t
|
.Ft uint32_t
|
||||||
.Fn bios_sigsearch "uint32_t start" "u_char *sig" "int siglen" "int paralen" "int sigofs"
|
.Fn bios_sigsearch "uint32_t start" "u_char *sig" "int siglen" "int paralen" "int sigofs"
|
||||||
|
@ -81,6 +81,16 @@ tags: ${SRCS}
|
|||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# Skip reading .depend when not needed to speed up tree-walks
|
||||||
|
# and simple lookups.
|
||||||
|
.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
|
||||||
|
make(install*)
|
||||||
|
_SKIP_READ_DEPEND= 1
|
||||||
|
.if ${MK_DIRDEPS_BUILD} == "no"
|
||||||
|
.MAKE.DEPENDFILE= /dev/null
|
||||||
|
.endif
|
||||||
|
.endif
|
||||||
|
|
||||||
.if defined(SRCS)
|
.if defined(SRCS)
|
||||||
CLEANFILES?=
|
CLEANFILES?=
|
||||||
|
|
||||||
@ -181,7 +191,7 @@ DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
|
|||||||
DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
|
DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
|
||||||
.endif
|
.endif
|
||||||
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
|
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
|
||||||
.if ${.MAKEFLAGS:M-V} == ""
|
.if !defined(_SKIP_READ_DEPEND)
|
||||||
.for __depend_obj in ${DEPENDFILES_OBJS}
|
.for __depend_obj in ${DEPENDFILES_OBJS}
|
||||||
.sinclude "${__depend_obj}"
|
.sinclude "${__depend_obj}"
|
||||||
.endfor
|
.endfor
|
||||||
|
@ -204,6 +204,7 @@ CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
|
|||||||
.if !empty(TIME_STAMP)
|
.if !empty(TIME_STAMP)
|
||||||
TRACER= ${TIME_STAMP} ${:U}
|
TRACER= ${TIME_STAMP} ${:U}
|
||||||
.endif
|
.endif
|
||||||
|
WITH_META_STATS= t
|
||||||
|
|
||||||
# toolchains can be a pain - especially bootstrappping them
|
# toolchains can be a pain - especially bootstrappping them
|
||||||
.if ${MACHINE} == "host"
|
.if ${MACHINE} == "host"
|
||||||
|
@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <machine/atomic.h>
|
#include <machine/atomic.h>
|
||||||
#include <machine/elf.h>
|
#include <machine/elf.h>
|
||||||
#include <machine/md_var.h>
|
#include <machine/md_var.h>
|
||||||
#include <machine/vmparam.h>
|
|
||||||
#include <machine/minidump.h>
|
#include <machine/minidump.h>
|
||||||
|
|
||||||
CTASSERT(sizeof(struct kerneldumpheader) == 512);
|
CTASSERT(sizeof(struct kerneldumpheader) == 512);
|
||||||
|
@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <machine/frame.h>
|
#include <machine/frame.h>
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
#include <machine/pmap.h>
|
|
||||||
#include <machine/vmparam.h>
|
#include <machine/vmparam.h>
|
||||||
|
|
||||||
#include <compat/cloudabi/cloudabi_util.h>
|
#include <compat/cloudabi/cloudabi_util.h>
|
||||||
|
@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <vm/pmap.h>
|
#include <vm/pmap.h>
|
||||||
#include <vm/vm_extern.h>
|
#include <vm/vm_extern.h>
|
||||||
|
|
||||||
#include <machine/pmap.h>
|
|
||||||
|
|
||||||
#include "npt.h"
|
#include "npt.h"
|
||||||
|
|
||||||
SYSCTL_DECL(_hw_vmm);
|
SYSCTL_DECL(_hw_vmm);
|
||||||
|
@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <machine/cpufunc.h>
|
#include <machine/cpufunc.h>
|
||||||
#include <machine/psl.h>
|
#include <machine/psl.h>
|
||||||
#include <machine/pmap.h>
|
|
||||||
#include <machine/md_var.h>
|
#include <machine/md_var.h>
|
||||||
#include <machine/specialreg.h>
|
#include <machine/specialreg.h>
|
||||||
#include <machine/smp.h>
|
#include <machine/smp.h>
|
||||||
|
@ -53,12 +53,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <vm/vm_param.h>
|
#include <vm/vm_param.h>
|
||||||
|
|
||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
#include <machine/vm.h>
|
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
#include <machine/smp.h>
|
#include <machine/smp.h>
|
||||||
#include <x86/psl.h>
|
#include <x86/psl.h>
|
||||||
#include <x86/apicreg.h>
|
#include <x86/apicreg.h>
|
||||||
#include <machine/vmparam.h>
|
|
||||||
|
|
||||||
#include <machine/vmm.h>
|
#include <machine/vmm.h>
|
||||||
#include <machine/vmm_dev.h>
|
#include <machine/vmm_dev.h>
|
||||||
|
@ -8,8 +8,6 @@ makeoptions CONF_CFLAGS="-march=armv7a"
|
|||||||
makeoptions KERNVIRTADDR=0xc0200000
|
makeoptions KERNVIRTADDR=0xc0200000
|
||||||
options KERNVIRTADDR=0xc0200000
|
options KERNVIRTADDR=0xc0200000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options IPI_IRQ_START=0
|
options IPI_IRQ_START=0
|
||||||
options IPI_IRQ_END=15
|
options IPI_IRQ_END=15
|
||||||
|
|
||||||
|
@ -75,6 +75,23 @@ a20_attach(platform_t plat)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
a31_attach(platform_t plat)
|
||||||
|
{
|
||||||
|
soc_type = ALLWINNERSOC_A31;
|
||||||
|
soc_family = ALLWINNERSOC_SUN6I;
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
a31s_attach(platform_t plat)
|
||||||
|
{
|
||||||
|
soc_type = ALLWINNERSOC_A31S;
|
||||||
|
soc_family = ALLWINNERSOC_SUN6I;
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
static vm_offset_t
|
static vm_offset_t
|
||||||
allwinner_lastaddr(platform_t plat)
|
allwinner_lastaddr(platform_t plat)
|
||||||
@ -138,6 +155,22 @@ static platform_method_t a20_methods[] = {
|
|||||||
PLATFORMMETHOD_END,
|
PLATFORMMETHOD_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static platform_method_t a31_methods[] = {
|
||||||
|
PLATFORMMETHOD(platform_attach, a31_attach),
|
||||||
|
PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr),
|
||||||
|
PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init),
|
||||||
|
|
||||||
|
PLATFORMMETHOD_END,
|
||||||
|
};
|
||||||
|
|
||||||
|
static platform_method_t a31s_methods[] = {
|
||||||
|
PLATFORMMETHOD(platform_attach, a31s_attach),
|
||||||
|
PLATFORMMETHOD(platform_lastaddr, allwinner_lastaddr),
|
||||||
|
PLATFORMMETHOD(platform_devmap_init, allwinner_devmap_init),
|
||||||
|
|
||||||
|
PLATFORMMETHOD_END,
|
||||||
|
};
|
||||||
|
|
||||||
u_int
|
u_int
|
||||||
allwinner_soc_type(void)
|
allwinner_soc_type(void)
|
||||||
{
|
{
|
||||||
@ -152,3 +185,5 @@ allwinner_soc_family(void)
|
|||||||
|
|
||||||
FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
|
FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
|
||||||
FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
|
FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
|
||||||
|
FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31");
|
||||||
|
FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s");
|
||||||
|
@ -34,9 +34,12 @@
|
|||||||
#define ALLWINNERSOC_A13 0x13000000
|
#define ALLWINNERSOC_A13 0x13000000
|
||||||
#define ALLWINNERSOC_A10S 0x10000001
|
#define ALLWINNERSOC_A10S 0x10000001
|
||||||
#define ALLWINNERSOC_A20 0x20000000
|
#define ALLWINNERSOC_A20 0x20000000
|
||||||
|
#define ALLWINNERSOC_A31 0x31000000
|
||||||
|
#define ALLWINNERSOC_A31S 0x31000001
|
||||||
|
|
||||||
#define ALLWINNERSOC_SUN4I 0x40000000
|
#define ALLWINNERSOC_SUN4I 0x40000000
|
||||||
#define ALLWINNERSOC_SUN5I 0x50000000
|
#define ALLWINNERSOC_SUN5I 0x50000000
|
||||||
|
#define ALLWINNERSOC_SUN6I 0x60000000
|
||||||
#define ALLWINNERSOC_SUN7I 0x70000000
|
#define ALLWINNERSOC_SUN7I 0x70000000
|
||||||
|
|
||||||
u_int allwinner_soc_type(void);
|
u_int allwinner_soc_type(void);
|
||||||
|
@ -8,7 +8,5 @@ makeoptions CONF_CFLAGS="-march=armv7a"
|
|||||||
makeoptions KERNVIRTADDR=0xc0200000
|
makeoptions KERNVIRTADDR=0xc0200000
|
||||||
options KERNVIRTADDR=0xc0200000
|
options KERNVIRTADDR=0xc0200000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
files "../allwinner/files.allwinner"
|
files "../allwinner/files.allwinner"
|
||||||
files "../allwinner/files.a10"
|
files "../allwinner/files.a10"
|
||||||
|
@ -7,8 +7,6 @@ makeoptions CONF_CFLAGS="-march=armv7a"
|
|||||||
makeoptions KERNVIRTADDR=0xc0f00000
|
makeoptions KERNVIRTADDR=0xc0f00000
|
||||||
options KERNVIRTADDR=0xc0f00000
|
options KERNVIRTADDR=0xc0f00000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options IPI_IRQ_START=0
|
options IPI_IRQ_START=0
|
||||||
options IPI_IRQ_END=15
|
options IPI_IRQ_END=15
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ device fdt_pinctrl
|
|||||||
|
|
||||||
files "../amlogic/aml8726/files.aml8726"
|
files "../amlogic/aml8726/files.aml8726"
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
# Set all global interrupts to be edge triggered, active high.
|
# Set all global interrupts to be edge triggered, active high.
|
||||||
options GIC_DEFAULT_ICFGR_INIT=0xffffffff
|
options GIC_DEFAULT_ICFGR_INIT=0xffffffff
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
#include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */
|
#include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */
|
||||||
#include <machine/machdep.h>
|
#include <machine/machdep.h>
|
||||||
#include <machine/pmap.h>
|
|
||||||
#include <machine/devmap.h>
|
#include <machine/devmap.h>
|
||||||
#include <machine/platform.h>
|
#include <machine/platform.h>
|
||||||
#include <machine/fdt.h>
|
#include <machine/fdt.h>
|
||||||
|
@ -10,8 +10,6 @@ options KERNVIRTADDR=0xa0200000
|
|||||||
makeoptions KERNBASE=0xa0000000
|
makeoptions KERNBASE=0xa0000000
|
||||||
options KERNBASE=0xa0000000
|
options KERNBASE=0xa0000000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options IPI_IRQ_START=0
|
options IPI_IRQ_START=0
|
||||||
options IPI_IRQ_END=15
|
options IPI_IRQ_END=15
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
#include <machine/debug_monitor.h>
|
#include <machine/debug_monitor.h>
|
||||||
#include <machine/kdb.h>
|
#include <machine/kdb.h>
|
||||||
#include <machine/param.h>
|
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
#include <machine/reg.h>
|
#include <machine/reg.h>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/elf32.h>
|
#include <sys/elf32.h>
|
||||||
#include <sys/inflate.h>
|
#include <sys/inflate.h>
|
||||||
#include <machine/elf.h>
|
#include <machine/elf.h>
|
||||||
#include <machine/pte.h>
|
#include <machine/pte-v4.h>
|
||||||
#include <machine/cpufunc.h>
|
#include <machine/cpufunc.h>
|
||||||
#include <machine/armreg.h>
|
#include <machine/armreg.h>
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <vm/vm_map.h>
|
#include <vm/vm_map.h>
|
||||||
|
|
||||||
#include <machine/acle-compat.h>
|
#include <machine/acle-compat.h>
|
||||||
#include <machine/vmparam.h>
|
|
||||||
#include <machine/armreg.h>
|
#include <machine/armreg.h>
|
||||||
#include <machine/frame.h>
|
#include <machine/frame.h>
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include <machine/armreg.h>
|
#include <machine/armreg.h>
|
||||||
#include <machine/cpuconf.h>
|
#include <machine/cpuconf.h>
|
||||||
#include <machine/pte.h>
|
#include <machine/pte-v4.h>
|
||||||
|
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <machine/armreg.h>
|
#include <machine/armreg.h>
|
||||||
#include <machine/sysreg.h>
|
#include <machine/sysreg.h>
|
||||||
#include <machine/cpuconf.h>
|
#include <machine/cpuconf.h>
|
||||||
#include <machine/pte.h>
|
#include <machine/pte-v6.h>
|
||||||
|
|
||||||
__FBSDID("$FreeBSD$");
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <machine/debug_monitor.h>
|
#include <machine/debug_monitor.h>
|
||||||
#include <machine/smp.h>
|
#include <machine/smp.h>
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
#include <machine/pmap.h>
|
|
||||||
#include <machine/physmem.h>
|
#include <machine/physmem.h>
|
||||||
#include <machine/intr.h>
|
#include <machine/intr.h>
|
||||||
#include <machine/vmparam.h>
|
#include <machine/vmparam.h>
|
||||||
|
@ -85,6 +85,7 @@ static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
|
|||||||
rman_res_t, rman_res_t, rman_res_t, u_int);
|
rman_res_t, rman_res_t, rman_res_t, u_int);
|
||||||
static int nexus_activate_resource(device_t, device_t, int, int,
|
static int nexus_activate_resource(device_t, device_t, int, int,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
|
static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
|
||||||
#ifdef ARM_INTRNG
|
#ifdef ARM_INTRNG
|
||||||
#ifdef SMP
|
#ifdef SMP
|
||||||
static int nexus_bind_intr(device_t, device_t, struct resource *, int);
|
static int nexus_bind_intr(device_t, device_t, struct resource *, int);
|
||||||
@ -124,6 +125,7 @@ static device_method_t nexus_methods[] = {
|
|||||||
DEVMETHOD(bus_release_resource, nexus_release_resource),
|
DEVMETHOD(bus_release_resource, nexus_release_resource),
|
||||||
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
||||||
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
||||||
|
DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag),
|
||||||
#ifdef ARM_INTRNG
|
#ifdef ARM_INTRNG
|
||||||
DEVMETHOD(bus_describe_intr, nexus_describe_intr),
|
DEVMETHOD(bus_describe_intr, nexus_describe_intr),
|
||||||
#ifdef SMP
|
#ifdef SMP
|
||||||
@ -260,6 +262,17 @@ nexus_release_resource(device_t bus, device_t child, int type, int rid,
|
|||||||
return (rman_release_resource(res));
|
return (rman_release_resource(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bus_space_tag_t
|
||||||
|
nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef FDT
|
||||||
|
return(fdtbus_bs_tag);
|
||||||
|
#else
|
||||||
|
return((void *)1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
|
nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
|
||||||
enum intr_polarity pol)
|
enum intr_polarity pol)
|
||||||
|
@ -2549,7 +2549,7 @@ pmap_remove_pages(pmap_t pmap)
|
|||||||
l2b = pmap_get_l2_bucket(pmap, pv->pv_va);
|
l2b = pmap_get_l2_bucket(pmap, pv->pv_va);
|
||||||
KASSERT(l2b != NULL, ("No L2 bucket in pmap_remove_pages"));
|
KASSERT(l2b != NULL, ("No L2 bucket in pmap_remove_pages"));
|
||||||
pt = &l2b->l2b_kva[l2pte_index(pv->pv_va)];
|
pt = &l2b->l2b_kva[l2pte_index(pv->pv_va)];
|
||||||
m = PHYS_TO_VM_PAGE(*pt & L2_ADDR_MASK);
|
m = PHYS_TO_VM_PAGE(*pt & L2_S_FRAME);
|
||||||
KASSERT((vm_offset_t)m >= KERNBASE, ("Trying to access non-existent page va %x pte %x", pv->pv_va, *pt));
|
KASSERT((vm_offset_t)m >= KERNBASE, ("Trying to access non-existent page va %x pte %x", pv->pv_va, *pt));
|
||||||
*pt = 0;
|
*pt = 0;
|
||||||
PTE_SYNC(pt);
|
PTE_SYNC(pt);
|
@ -121,7 +121,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <machine/physmem.h>
|
#include <machine/physmem.h>
|
||||||
#include <machine/vmparam.h>
|
|
||||||
|
|
||||||
#include <vm/vm.h>
|
#include <vm/vm.h>
|
||||||
#include <vm/uma.h>
|
#include <vm/uma.h>
|
||||||
@ -1267,13 +1266,6 @@ pmap_kenter_prot_attr(vm_offset_t va, vm_paddr_t pa, uint32_t prot,
|
|||||||
pte2_store(pte2p, PTE2_KERN(pa, prot, attr));
|
pte2_store(pte2p, PTE2_KERN(pa, prot, attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void
|
|
||||||
pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr)
|
|
||||||
{
|
|
||||||
|
|
||||||
pmap_kenter_prot_attr(va, pa, PTE2_AP_KRW, attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
PMAP_INLINE void
|
PMAP_INLINE void
|
||||||
pmap_kenter(vm_offset_t va, vm_paddr_t pa)
|
pmap_kenter(vm_offset_t va, vm_paddr_t pa)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <machine/frame.h>
|
#include <machine/frame.h>
|
||||||
#include <machine/machdep.h>
|
#include <machine/machdep.h>
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
#include <machine/vmparam.h>
|
|
||||||
|
|
||||||
#ifdef KDB
|
#ifdef KDB
|
||||||
#include <sys/kdb.h>
|
#include <sys/kdb.h>
|
||||||
|
@ -164,7 +164,7 @@ at91_alloc_resource(device_t dev, device_t child, int type, int *rid,
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
if (rle->res)
|
if (rle->res)
|
||||||
panic("Resource rid %d type %d already in use", *rid, type);
|
panic("Resource rid %d type %d already in use", *rid, type);
|
||||||
if (start == 0UL && end == ~0UL) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
start = rle->start;
|
start = rle->start;
|
||||||
count = ulmax(count, rle->count);
|
count = ulmax(count, rle->count);
|
||||||
end = ulmax(rle->end, start + count - 1);
|
end = ulmax(rle->end, start + count - 1);
|
||||||
|
@ -280,7 +280,7 @@ pinctrl_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||||||
* Request for the default allocation with a given rid: use resource
|
* Request for the default allocation with a given rid: use resource
|
||||||
* list stored in the local device info.
|
* list stored in the local device info.
|
||||||
*/
|
*/
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
if ((di = device_get_ivars(child)) == NULL)
|
if ((di = device_get_ivars(child)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ cpu CPU_CORTEXA
|
|||||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||||
options SOC_BCM2836
|
options SOC_BCM2836
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
options IPI_IRQ_START=76
|
options IPI_IRQ_START=76
|
||||||
|
|
||||||
files "../broadcom/bcm2835/files.bcm2836"
|
files "../broadcom/bcm2835/files.bcm2836"
|
||||||
|
@ -425,7 +425,7 @@ econa_alloc_resource(device_t dev, device_t child, int type, int *rid,
|
|||||||
}
|
}
|
||||||
if (rle->res)
|
if (rle->res)
|
||||||
panic("Resource rid %d type %d already in use", *rid, type);
|
panic("Resource rid %d type %d already in use", *rid, type);
|
||||||
if (start == 0UL && end == ~0UL) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
start = rle->start;
|
start = rle->start;
|
||||||
count = ulmax(count, rle->count);
|
count = ulmax(count, rle->count);
|
||||||
end = ulmax(rle->end, start + count - 1);
|
end = ulmax(rle->end, start + count - 1);
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#
|
#
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
|
options ARM_L2_PIPT # Only L2 PIPT is supported
|
||||||
|
|
||||||
options PREEMPTION # Enable kernel thread preemption
|
options PREEMPTION # Enable kernel thread preemption
|
||||||
options INET # InterNETworking
|
options INET # InterNETworking
|
||||||
options INET6 # IPv6 communications protocols
|
options INET6 # IPv6 communications protocols
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
machine arm armv6
|
machine arm armv6
|
||||||
cpu CPU_CORTEXA
|
cpu CPU_CORTEXA
|
||||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options KERNVIRTADDR=0xc0100000
|
options KERNVIRTADDR=0xc0100000
|
||||||
makeoptions KERNVIRTADDR=0xc0100000
|
makeoptions KERNVIRTADDR=0xc0100000
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
machine arm armv6
|
machine arm armv6
|
||||||
cpu CPU_CORTEXA
|
cpu CPU_CORTEXA
|
||||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options KERNVIRTADDR=0xc0100000
|
options KERNVIRTADDR=0xc0100000
|
||||||
makeoptions KERNVIRTADDR=0xc0100000
|
makeoptions KERNVIRTADDR=0xc0100000
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
machine arm armv6
|
machine arm armv6
|
||||||
cpu CPU_CORTEXA
|
cpu CPU_CORTEXA
|
||||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options KERNVIRTADDR = 0xc2000000
|
options KERNVIRTADDR = 0xc2000000
|
||||||
makeoptions KERNVIRTADDR = 0xc2000000
|
makeoptions KERNVIRTADDR = 0xc2000000
|
||||||
|
@ -7,6 +7,4 @@ makeoptions CONF_CFLAGS="-march=armv7a"
|
|||||||
makeoptions KERNVIRTADDR=0xc0100000
|
makeoptions KERNVIRTADDR=0xc0100000
|
||||||
options KERNVIRTADDR=0xc0100000
|
options KERNVIRTADDR=0xc0100000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
files "../freescale/vybrid/files.vybrid"
|
files "../freescale/vybrid/files.vybrid"
|
||||||
|
516
sys/arm/include/pmap-v4.h
Normal file
516
sys/arm/include/pmap-v4.h
Normal file
@ -0,0 +1,516 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 1991 Regents of the University of California.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This code is derived from software contributed to Berkeley by
|
||||||
|
* the Systems Programming Group of the University of Utah Computer
|
||||||
|
* Science Department and William Jolitz of UUNET Technologies Inc.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* Derived from hp300 version by Mike Hibler, this version by William
|
||||||
|
* Jolitz uses a recursive map [a pde points to the page directory] to
|
||||||
|
* map the page tables using the pagetables themselves. This is done to
|
||||||
|
* reduce the impact on kernel virtual memory for lots of sparse address
|
||||||
|
* space, and to reduce the cost of memory to each process.
|
||||||
|
*
|
||||||
|
* from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
|
||||||
|
* from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
|
||||||
|
* from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30
|
||||||
|
*
|
||||||
|
* $FreeBSD$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MACHINE_PMAP_V4_H_
|
||||||
|
#define _MACHINE_PMAP_V4_H_
|
||||||
|
|
||||||
|
#include <machine/pte-v4.h>
|
||||||
|
#include <machine/cpuconf.h>
|
||||||
|
/*
|
||||||
|
* Pte related macros
|
||||||
|
*/
|
||||||
|
#define PTE_NOCACHE 1
|
||||||
|
#define PTE_CACHE 2
|
||||||
|
#define PTE_DEVICE PTE_NOCACHE
|
||||||
|
#define PTE_PAGETABLE 3
|
||||||
|
|
||||||
|
enum mem_type {
|
||||||
|
STRONG_ORD = 0,
|
||||||
|
DEVICE_NOSHARE,
|
||||||
|
DEVICE_SHARE,
|
||||||
|
NRML_NOCACHE,
|
||||||
|
NRML_IWT_OWT,
|
||||||
|
NRML_IWB_OWB,
|
||||||
|
NRML_IWBA_OWBA
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef LOCORE
|
||||||
|
|
||||||
|
#include <sys/queue.h>
|
||||||
|
#include <sys/_cpuset.h>
|
||||||
|
#include <sys/_lock.h>
|
||||||
|
#include <sys/_mutex.h>
|
||||||
|
|
||||||
|
#define PDESIZE sizeof(pd_entry_t) /* for assembly files */
|
||||||
|
#define PTESIZE sizeof(pt_entry_t) /* for assembly files */
|
||||||
|
|
||||||
|
#define pmap_page_get_memattr(m) ((m)->md.pv_memattr)
|
||||||
|
#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pmap stuff
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This structure is used to hold a virtual<->physical address
|
||||||
|
* association and is used mostly by bootstrap code
|
||||||
|
*/
|
||||||
|
struct pv_addr {
|
||||||
|
SLIST_ENTRY(pv_addr) pv_list;
|
||||||
|
vm_offset_t pv_va;
|
||||||
|
vm_paddr_t pv_pa;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pv_entry;
|
||||||
|
struct pv_chunk;
|
||||||
|
|
||||||
|
struct md_page {
|
||||||
|
int pvh_attrs;
|
||||||
|
vm_memattr_t pv_memattr;
|
||||||
|
vm_offset_t pv_kva; /* first kernel VA mapping */
|
||||||
|
TAILQ_HEAD(,pv_entry) pv_list;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct l1_ttable;
|
||||||
|
struct l2_dtable;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The number of L2 descriptor tables which can be tracked by an l2_dtable.
|
||||||
|
* A bucket size of 16 provides for 16MB of contiguous virtual address
|
||||||
|
* space per l2_dtable. Most processes will, therefore, require only two or
|
||||||
|
* three of these to map their whole working set.
|
||||||
|
*/
|
||||||
|
#define L2_BUCKET_LOG2 4
|
||||||
|
#define L2_BUCKET_SIZE (1 << L2_BUCKET_LOG2)
|
||||||
|
/*
|
||||||
|
* Given the above "L2-descriptors-per-l2_dtable" constant, the number
|
||||||
|
* of l2_dtable structures required to track all possible page descriptors
|
||||||
|
* mappable by an L1 translation table is given by the following constants:
|
||||||
|
*/
|
||||||
|
#define L2_LOG2 ((32 - L1_S_SHIFT) - L2_BUCKET_LOG2)
|
||||||
|
#define L2_SIZE (1 << L2_LOG2)
|
||||||
|
|
||||||
|
struct pmap {
|
||||||
|
struct mtx pm_mtx;
|
||||||
|
u_int8_t pm_domain;
|
||||||
|
struct l1_ttable *pm_l1;
|
||||||
|
struct l2_dtable *pm_l2[L2_SIZE];
|
||||||
|
cpuset_t pm_active; /* active on cpus */
|
||||||
|
struct pmap_statistics pm_stats; /* pmap statictics */
|
||||||
|
TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct pmap *pmap_t;
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
extern struct pmap kernel_pmap_store;
|
||||||
|
#define kernel_pmap (&kernel_pmap_store)
|
||||||
|
|
||||||
|
#define PMAP_ASSERT_LOCKED(pmap) \
|
||||||
|
mtx_assert(&(pmap)->pm_mtx, MA_OWNED)
|
||||||
|
#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)
|
||||||
|
#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx)
|
||||||
|
#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \
|
||||||
|
NULL, MTX_DEF | MTX_DUPOK)
|
||||||
|
#define PMAP_OWNED(pmap) mtx_owned(&(pmap)->pm_mtx)
|
||||||
|
#define PMAP_MTX(pmap) (&(pmap)->pm_mtx)
|
||||||
|
#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx)
|
||||||
|
#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For each vm_page_t, there is a list of all currently valid virtual
|
||||||
|
* mappings of that page. An entry is a pv_entry_t, the list is pv_list.
|
||||||
|
*/
|
||||||
|
typedef struct pv_entry {
|
||||||
|
vm_offset_t pv_va; /* virtual address for mapping */
|
||||||
|
TAILQ_ENTRY(pv_entry) pv_list;
|
||||||
|
int pv_flags; /* flags (wired, etc...) */
|
||||||
|
pmap_t pv_pmap; /* pmap where mapping lies */
|
||||||
|
TAILQ_ENTRY(pv_entry) pv_plist;
|
||||||
|
} *pv_entry_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* pv_entries are allocated in chunks per-process. This avoids the
|
||||||
|
* need to track per-pmap assignments.
|
||||||
|
*/
|
||||||
|
#define _NPCM 8
|
||||||
|
#define _NPCPV 252
|
||||||
|
|
||||||
|
struct pv_chunk {
|
||||||
|
pmap_t pc_pmap;
|
||||||
|
TAILQ_ENTRY(pv_chunk) pc_list;
|
||||||
|
uint32_t pc_map[_NPCM]; /* bitmap; 1 = free */
|
||||||
|
uint32_t pc_dummy[3]; /* aligns pv_chunk to 4KB */
|
||||||
|
TAILQ_ENTRY(pv_chunk) pc_lru;
|
||||||
|
struct pv_entry pc_pventry[_NPCPV];
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
|
||||||
|
boolean_t pmap_get_pde_pte(pmap_t, vm_offset_t, pd_entry_t **, pt_entry_t **);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* virtual address to page table entry and
|
||||||
|
* to physical address. Likewise for alternate address space.
|
||||||
|
* Note: these work recursively, thus vtopte of a pte will give
|
||||||
|
* the corresponding pde that in turn maps it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The current top of kernel VM.
|
||||||
|
*/
|
||||||
|
extern vm_offset_t pmap_curmaxkvaddr;
|
||||||
|
|
||||||
|
/* Virtual address to page table entry */
|
||||||
|
static __inline pt_entry_t *
|
||||||
|
vtopte(vm_offset_t va)
|
||||||
|
{
|
||||||
|
pd_entry_t *pdep;
|
||||||
|
pt_entry_t *ptep;
|
||||||
|
|
||||||
|
if (pmap_get_pde_pte(kernel_pmap, va, &pdep, &ptep) == FALSE)
|
||||||
|
return (NULL);
|
||||||
|
return (ptep);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt);
|
||||||
|
int pmap_change_attr(vm_offset_t, vm_size_t, int);
|
||||||
|
void pmap_kenter(vm_offset_t va, vm_paddr_t pa);
|
||||||
|
void pmap_kenter_nocache(vm_offset_t va, vm_paddr_t pa);
|
||||||
|
void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa);
|
||||||
|
vm_paddr_t pmap_dump_kextract(vm_offset_t, pt2_entry_t *);
|
||||||
|
void pmap_kremove(vm_offset_t);
|
||||||
|
vm_page_t pmap_use_pt(pmap_t, vm_offset_t);
|
||||||
|
void pmap_debug(int);
|
||||||
|
void pmap_map_section(vm_offset_t, vm_offset_t, vm_offset_t, int, int);
|
||||||
|
void pmap_link_l2pt(vm_offset_t, vm_offset_t, struct pv_addr *);
|
||||||
|
vm_size_t pmap_map_chunk(vm_offset_t, vm_offset_t, vm_offset_t, vm_size_t, int, int);
|
||||||
|
void
|
||||||
|
pmap_map_entry(vm_offset_t l1pt, vm_offset_t va, vm_offset_t pa, int prot,
|
||||||
|
int cache);
|
||||||
|
int pmap_fault_fixup(pmap_t, vm_offset_t, vm_prot_t, int);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definitions for MMU domains
|
||||||
|
*/
|
||||||
|
#define PMAP_DOMAINS 15 /* 15 'user' domains (1-15) */
|
||||||
|
#define PMAP_DOMAIN_KERNEL 0 /* The kernel uses domain #0 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The new pmap ensures that page-tables are always mapping Write-Thru.
|
||||||
|
* Thus, on some platforms we can run fast and loose and avoid syncing PTEs
|
||||||
|
* on every change.
|
||||||
|
*
|
||||||
|
* Unfortunately, not all CPUs have a write-through cache mode. So we
|
||||||
|
* define PMAP_NEEDS_PTE_SYNC for C code to conditionally do PTE syncs,
|
||||||
|
* and if there is the chance for PTE syncs to be needed, we define
|
||||||
|
* PMAP_INCLUDE_PTE_SYNC so e.g. assembly code can include (and run)
|
||||||
|
* the code.
|
||||||
|
*/
|
||||||
|
extern int pmap_needs_pte_sync;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros define the various bit masks in the PTE.
|
||||||
|
*
|
||||||
|
* We use these macros since we use different bits on different processor
|
||||||
|
* models.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define L1_S_CACHE_MASK_generic (L1_S_B|L1_S_C)
|
||||||
|
#define L1_S_CACHE_MASK_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X)|\
|
||||||
|
L1_S_XSCALE_TEX(TEX_XSCALE_T))
|
||||||
|
|
||||||
|
#define L2_L_CACHE_MASK_generic (L2_B|L2_C)
|
||||||
|
#define L2_L_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X) | \
|
||||||
|
L2_XSCALE_L_TEX(TEX_XSCALE_T))
|
||||||
|
|
||||||
|
#define L2_S_PROT_U_generic (L2_AP(AP_U))
|
||||||
|
#define L2_S_PROT_W_generic (L2_AP(AP_W))
|
||||||
|
#define L2_S_PROT_MASK_generic (L2_S_PROT_U|L2_S_PROT_W)
|
||||||
|
|
||||||
|
#define L2_S_PROT_U_xscale (L2_AP0(AP_U))
|
||||||
|
#define L2_S_PROT_W_xscale (L2_AP0(AP_W))
|
||||||
|
#define L2_S_PROT_MASK_xscale (L2_S_PROT_U|L2_S_PROT_W)
|
||||||
|
|
||||||
|
#define L2_S_CACHE_MASK_generic (L2_B|L2_C)
|
||||||
|
#define L2_S_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_T_TEX(TEX_XSCALE_X)| \
|
||||||
|
L2_XSCALE_T_TEX(TEX_XSCALE_X))
|
||||||
|
|
||||||
|
#define L1_S_PROTO_generic (L1_TYPE_S | L1_S_IMP)
|
||||||
|
#define L1_S_PROTO_xscale (L1_TYPE_S)
|
||||||
|
|
||||||
|
#define L1_C_PROTO_generic (L1_TYPE_C | L1_C_IMP2)
|
||||||
|
#define L1_C_PROTO_xscale (L1_TYPE_C)
|
||||||
|
|
||||||
|
#define L2_L_PROTO (L2_TYPE_L)
|
||||||
|
|
||||||
|
#define L2_S_PROTO_generic (L2_TYPE_S)
|
||||||
|
#define L2_S_PROTO_xscale (L2_TYPE_XSCALE_XS)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* User-visible names for the ones that vary with MMU class.
|
||||||
|
*/
|
||||||
|
#define L2_AP(x) (L2_AP0(x) | L2_AP1(x) | L2_AP2(x) | L2_AP3(x))
|
||||||
|
|
||||||
|
#if ARM_NMMUS > 1
|
||||||
|
/* More than one MMU class configured; use variables. */
|
||||||
|
#define L2_S_PROT_U pte_l2_s_prot_u
|
||||||
|
#define L2_S_PROT_W pte_l2_s_prot_w
|
||||||
|
#define L2_S_PROT_MASK pte_l2_s_prot_mask
|
||||||
|
|
||||||
|
#define L1_S_CACHE_MASK pte_l1_s_cache_mask
|
||||||
|
#define L2_L_CACHE_MASK pte_l2_l_cache_mask
|
||||||
|
#define L2_S_CACHE_MASK pte_l2_s_cache_mask
|
||||||
|
|
||||||
|
#define L1_S_PROTO pte_l1_s_proto
|
||||||
|
#define L1_C_PROTO pte_l1_c_proto
|
||||||
|
#define L2_S_PROTO pte_l2_s_proto
|
||||||
|
|
||||||
|
#elif ARM_MMU_GENERIC != 0
|
||||||
|
#define L2_S_PROT_U L2_S_PROT_U_generic
|
||||||
|
#define L2_S_PROT_W L2_S_PROT_W_generic
|
||||||
|
#define L2_S_PROT_MASK L2_S_PROT_MASK_generic
|
||||||
|
|
||||||
|
#define L1_S_CACHE_MASK L1_S_CACHE_MASK_generic
|
||||||
|
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_generic
|
||||||
|
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_generic
|
||||||
|
|
||||||
|
#define L1_S_PROTO L1_S_PROTO_generic
|
||||||
|
#define L1_C_PROTO L1_C_PROTO_generic
|
||||||
|
#define L2_S_PROTO L2_S_PROTO_generic
|
||||||
|
|
||||||
|
#elif ARM_MMU_XSCALE == 1
|
||||||
|
#define L2_S_PROT_U L2_S_PROT_U_xscale
|
||||||
|
#define L2_S_PROT_W L2_S_PROT_W_xscale
|
||||||
|
#define L2_S_PROT_MASK L2_S_PROT_MASK_xscale
|
||||||
|
|
||||||
|
#define L1_S_CACHE_MASK L1_S_CACHE_MASK_xscale
|
||||||
|
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_xscale
|
||||||
|
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_xscale
|
||||||
|
|
||||||
|
#define L1_S_PROTO L1_S_PROTO_xscale
|
||||||
|
#define L1_C_PROTO L1_C_PROTO_xscale
|
||||||
|
#define L2_S_PROTO L2_S_PROTO_xscale
|
||||||
|
|
||||||
|
#endif /* ARM_NMMUS > 1 */
|
||||||
|
|
||||||
|
#if defined(CPU_XSCALE_81342)
|
||||||
|
#define PMAP_NEEDS_PTE_SYNC 1
|
||||||
|
#define PMAP_INCLUDE_PTE_SYNC
|
||||||
|
#else
|
||||||
|
#define PMAP_NEEDS_PTE_SYNC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros return various bits based on kernel/user and protection.
|
||||||
|
* Note that the compiler will usually fold these at compile time.
|
||||||
|
*/
|
||||||
|
#define L1_S_PROT_U (L1_S_AP(AP_U))
|
||||||
|
#define L1_S_PROT_W (L1_S_AP(AP_W))
|
||||||
|
#define L1_S_PROT_MASK (L1_S_PROT_U|L1_S_PROT_W)
|
||||||
|
#define L1_S_WRITABLE(pd) ((pd) & L1_S_PROT_W)
|
||||||
|
|
||||||
|
#define L1_S_PROT(ku, pr) ((((ku) == PTE_USER) ? L1_S_PROT_U : 0) | \
|
||||||
|
(((pr) & VM_PROT_WRITE) ? L1_S_PROT_W : 0))
|
||||||
|
|
||||||
|
#define L2_L_PROT_U (L2_AP(AP_U))
|
||||||
|
#define L2_L_PROT_W (L2_AP(AP_W))
|
||||||
|
#define L2_L_PROT_MASK (L2_L_PROT_U|L2_L_PROT_W)
|
||||||
|
|
||||||
|
#define L2_L_PROT(ku, pr) ((((ku) == PTE_USER) ? L2_L_PROT_U : 0) | \
|
||||||
|
(((pr) & VM_PROT_WRITE) ? L2_L_PROT_W : 0))
|
||||||
|
|
||||||
|
#define L2_S_PROT(ku, pr) ((((ku) == PTE_USER) ? L2_S_PROT_U : 0) | \
|
||||||
|
(((pr) & VM_PROT_WRITE) ? L2_S_PROT_W : 0))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macros to test if a mapping is mappable with an L1 Section mapping
|
||||||
|
* or an L2 Large Page mapping.
|
||||||
|
*/
|
||||||
|
#define L1_S_MAPPABLE_P(va, pa, size) \
|
||||||
|
((((va) | (pa)) & L1_S_OFFSET) == 0 && (size) >= L1_S_SIZE)
|
||||||
|
|
||||||
|
#define L2_L_MAPPABLE_P(va, pa, size) \
|
||||||
|
((((va) | (pa)) & L2_L_OFFSET) == 0 && (size) >= L2_L_SIZE)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Provide a fallback in case we were not able to determine it at
|
||||||
|
* compile-time.
|
||||||
|
*/
|
||||||
|
#ifndef PMAP_NEEDS_PTE_SYNC
|
||||||
|
#define PMAP_NEEDS_PTE_SYNC pmap_needs_pte_sync
|
||||||
|
#define PMAP_INCLUDE_PTE_SYNC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARM_L2_PIPT
|
||||||
|
#define _sync_l2(pte, size) cpu_l2cache_wb_range(vtophys(pte), size)
|
||||||
|
#else
|
||||||
|
#define _sync_l2(pte, size) cpu_l2cache_wb_range(pte, size)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PTE_SYNC(pte) \
|
||||||
|
do { \
|
||||||
|
if (PMAP_NEEDS_PTE_SYNC) { \
|
||||||
|
cpu_dcache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\
|
||||||
|
cpu_drain_writebuf(); \
|
||||||
|
_sync_l2((vm_offset_t)(pte), sizeof(pt_entry_t));\
|
||||||
|
} else \
|
||||||
|
cpu_drain_writebuf(); \
|
||||||
|
} while (/*CONSTCOND*/0)
|
||||||
|
|
||||||
|
#define PTE_SYNC_RANGE(pte, cnt) \
|
||||||
|
do { \
|
||||||
|
if (PMAP_NEEDS_PTE_SYNC) { \
|
||||||
|
cpu_dcache_wb_range((vm_offset_t)(pte), \
|
||||||
|
(cnt) << 2); /* * sizeof(pt_entry_t) */ \
|
||||||
|
cpu_drain_writebuf(); \
|
||||||
|
_sync_l2((vm_offset_t)(pte), \
|
||||||
|
(cnt) << 2); /* * sizeof(pt_entry_t) */ \
|
||||||
|
} else \
|
||||||
|
cpu_drain_writebuf(); \
|
||||||
|
} while (/*CONSTCOND*/0)
|
||||||
|
|
||||||
|
extern pt_entry_t pte_l1_s_cache_mode;
|
||||||
|
extern pt_entry_t pte_l1_s_cache_mask;
|
||||||
|
|
||||||
|
extern pt_entry_t pte_l2_l_cache_mode;
|
||||||
|
extern pt_entry_t pte_l2_l_cache_mask;
|
||||||
|
|
||||||
|
extern pt_entry_t pte_l2_s_cache_mode;
|
||||||
|
extern pt_entry_t pte_l2_s_cache_mask;
|
||||||
|
|
||||||
|
extern pt_entry_t pte_l1_s_cache_mode_pt;
|
||||||
|
extern pt_entry_t pte_l2_l_cache_mode_pt;
|
||||||
|
extern pt_entry_t pte_l2_s_cache_mode_pt;
|
||||||
|
|
||||||
|
extern pt_entry_t pte_l2_s_prot_u;
|
||||||
|
extern pt_entry_t pte_l2_s_prot_w;
|
||||||
|
extern pt_entry_t pte_l2_s_prot_mask;
|
||||||
|
|
||||||
|
extern pt_entry_t pte_l1_s_proto;
|
||||||
|
extern pt_entry_t pte_l1_c_proto;
|
||||||
|
extern pt_entry_t pte_l2_s_proto;
|
||||||
|
|
||||||
|
extern void (*pmap_copy_page_func)(vm_paddr_t, vm_paddr_t);
|
||||||
|
extern void (*pmap_copy_page_offs_func)(vm_paddr_t a_phys,
|
||||||
|
vm_offset_t a_offs, vm_paddr_t b_phys, vm_offset_t b_offs, int cnt);
|
||||||
|
extern void (*pmap_zero_page_func)(vm_paddr_t, int, int);
|
||||||
|
|
||||||
|
#if ARM_MMU_GENERIC != 0 || defined(CPU_XSCALE_81342)
|
||||||
|
void pmap_copy_page_generic(vm_paddr_t, vm_paddr_t);
|
||||||
|
void pmap_zero_page_generic(vm_paddr_t, int, int);
|
||||||
|
|
||||||
|
void pmap_pte_init_generic(void);
|
||||||
|
#endif /* ARM_MMU_GENERIC != 0 */
|
||||||
|
|
||||||
|
#if ARM_MMU_XSCALE == 1
|
||||||
|
void pmap_copy_page_xscale(vm_paddr_t, vm_paddr_t);
|
||||||
|
void pmap_zero_page_xscale(vm_paddr_t, int, int);
|
||||||
|
|
||||||
|
void pmap_pte_init_xscale(void);
|
||||||
|
|
||||||
|
void xscale_setup_minidata(vm_offset_t, vm_offset_t, vm_offset_t);
|
||||||
|
|
||||||
|
void pmap_use_minicache(vm_offset_t, vm_size_t);
|
||||||
|
#endif /* ARM_MMU_XSCALE == 1 */
|
||||||
|
#if defined(CPU_XSCALE_81342)
|
||||||
|
#define ARM_HAVE_SUPERSECTIONS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PTE_KERNEL 0
|
||||||
|
#define PTE_USER 1
|
||||||
|
#define l1pte_valid(pde) ((pde) != 0)
|
||||||
|
#define l1pte_section_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_S)
|
||||||
|
#define l1pte_page_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_C)
|
||||||
|
#define l1pte_fpage_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_F)
|
||||||
|
|
||||||
|
#define l2pte_index(v) (((v) & L1_S_OFFSET) >> L2_S_SHIFT)
|
||||||
|
#define l2pte_valid(pte) ((pte) != 0)
|
||||||
|
#define l2pte_pa(pte) ((pte) & L2_S_FRAME)
|
||||||
|
#define l2pte_minidata(pte) (((pte) & \
|
||||||
|
(L2_B | L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X)))\
|
||||||
|
== (L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X)))
|
||||||
|
|
||||||
|
/* L1 and L2 page table macros */
|
||||||
|
#define pmap_pde_v(pde) l1pte_valid(*(pde))
|
||||||
|
#define pmap_pde_section(pde) l1pte_section_p(*(pde))
|
||||||
|
#define pmap_pde_page(pde) l1pte_page_p(*(pde))
|
||||||
|
#define pmap_pde_fpage(pde) l1pte_fpage_p(*(pde))
|
||||||
|
|
||||||
|
#define pmap_pte_v(pte) l2pte_valid(*(pte))
|
||||||
|
#define pmap_pte_pa(pte) l2pte_pa(*(pte))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flags that indicate attributes of pages or mappings of pages.
|
||||||
|
*
|
||||||
|
* The PVF_MOD and PVF_REF flags are stored in the mdpage for each
|
||||||
|
* page. PVF_WIRED, PVF_WRITE, and PVF_NC are kept in individual
|
||||||
|
* pv_entry's for each page. They live in the same "namespace" so
|
||||||
|
* that we can clear multiple attributes at a time.
|
||||||
|
*
|
||||||
|
* Note the "non-cacheable" flag generally means the page has
|
||||||
|
* multiple mappings in a given address space.
|
||||||
|
*/
|
||||||
|
#define PVF_MOD 0x01 /* page is modified */
|
||||||
|
#define PVF_REF 0x02 /* page is referenced */
|
||||||
|
#define PVF_WIRED 0x04 /* mapping is wired */
|
||||||
|
#define PVF_WRITE 0x08 /* mapping is writable */
|
||||||
|
#define PVF_EXEC 0x10 /* mapping is executable */
|
||||||
|
#define PVF_NC 0x20 /* mapping is non-cacheable */
|
||||||
|
#define PVF_MWC 0x40 /* mapping is used multiple times in userland */
|
||||||
|
#define PVF_UNMAN 0x80 /* mapping is unmanaged */
|
||||||
|
|
||||||
|
void vector_page_setprot(int);
|
||||||
|
|
||||||
|
#define SECTION_CACHE 0x1
|
||||||
|
#define SECTION_PT 0x2
|
||||||
|
void pmap_kenter_section(vm_offset_t, vm_paddr_t, int flags);
|
||||||
|
#ifdef ARM_HAVE_SUPERSECTIONS
|
||||||
|
void pmap_kenter_supersection(vm_offset_t, uint64_t, int flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void pmap_postinit(void);
|
||||||
|
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#endif /* !LOCORE */
|
||||||
|
|
||||||
|
#endif /* !_MACHINE_PMAP_V4_H_ */
|
@ -45,8 +45,8 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MACHINE_PMAP_H_
|
#ifndef _MACHINE_PMAP_V6_H_
|
||||||
#define _MACHINE_PMAP_H_
|
#define _MACHINE_PMAP_V6_H_
|
||||||
|
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
#include <sys/_cpuset.h>
|
#include <sys/_cpuset.h>
|
||||||
@ -88,27 +88,11 @@ typedef uint32_t ttb_entry_t; /* TTB entry */
|
|||||||
*/
|
*/
|
||||||
#define NKPT2PG 32
|
#define NKPT2PG 32
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* _KERNEL */
|
||||||
extern vm_paddr_t phys_avail[];
|
|
||||||
extern vm_paddr_t dump_avail[];
|
|
||||||
extern char *_tmppt; /* poor name! */
|
|
||||||
extern vm_offset_t virtual_avail;
|
|
||||||
extern vm_offset_t virtual_end;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pmap stuff
|
* Pmap stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This structure is used to hold a virtual<->physical address
|
|
||||||
* association and is used mostly by bootstrap code
|
|
||||||
*/
|
|
||||||
struct pv_addr {
|
|
||||||
SLIST_ENTRY(pv_addr) pv_list;
|
|
||||||
vm_offset_t pv_va;
|
|
||||||
vm_paddr_t pv_pa;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
struct pv_entry;
|
struct pv_entry;
|
||||||
struct pv_chunk;
|
struct pv_chunk;
|
||||||
|
|
||||||
@ -170,40 +154,27 @@ struct pv_chunk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
struct pcb;
|
|
||||||
extern ttb_entry_t pmap_kern_ttb; /* TTB for kernel pmap */
|
extern ttb_entry_t pmap_kern_ttb; /* TTB for kernel pmap */
|
||||||
|
|
||||||
#define pmap_page_get_memattr(m) ((m)->md.pat_mode)
|
#define pmap_page_get_memattr(m) ((m)->md.pat_mode)
|
||||||
#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only the following functions or macros may be used before pmap_bootstrap()
|
* Only the following functions or macros may be used before pmap_bootstrap()
|
||||||
* is called: pmap_kenter(), pmap_kextract(), pmap_kremove(), vtophys(), and
|
* is called: pmap_kenter(), pmap_kextract(), pmap_kremove(), vtophys(), and
|
||||||
* vtopte2().
|
* vtopte2().
|
||||||
*/
|
*/
|
||||||
void pmap_bootstrap(vm_offset_t );
|
void pmap_bootstrap(vm_offset_t);
|
||||||
void pmap_kenter(vm_offset_t , vm_paddr_t );
|
void pmap_kenter(vm_offset_t, vm_paddr_t);
|
||||||
void *pmap_kenter_temporary(vm_paddr_t , int );
|
|
||||||
void pmap_kremove(vm_offset_t);
|
void pmap_kremove(vm_offset_t);
|
||||||
void *pmap_mapdev(vm_paddr_t, vm_size_t);
|
|
||||||
void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int);
|
void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int);
|
||||||
boolean_t pmap_page_is_mapped(vm_page_t );
|
boolean_t pmap_page_is_mapped(vm_page_t);
|
||||||
void pmap_page_set_memattr(vm_page_t , vm_memattr_t );
|
|
||||||
void pmap_unmapdev(vm_offset_t, vm_size_t);
|
|
||||||
void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t);
|
|
||||||
void pmap_kremove_device(vm_offset_t, vm_size_t);
|
|
||||||
void pmap_set_pcb_pagedir(pmap_t , struct pcb *);
|
|
||||||
|
|
||||||
void pmap_tlb_flush(pmap_t , vm_offset_t );
|
void pmap_tlb_flush(pmap_t, vm_offset_t);
|
||||||
void pmap_tlb_flush_range(pmap_t , vm_offset_t , vm_size_t );
|
void pmap_tlb_flush_range(pmap_t, vm_offset_t, vm_size_t);
|
||||||
|
|
||||||
void pmap_dcache_wb_range(vm_paddr_t , vm_size_t , vm_memattr_t );
|
|
||||||
|
|
||||||
vm_paddr_t pmap_kextract(vm_offset_t );
|
|
||||||
vm_paddr_t pmap_dump_kextract(vm_offset_t, pt2_entry_t *);
|
vm_paddr_t pmap_dump_kextract(vm_offset_t, pt2_entry_t *);
|
||||||
|
|
||||||
int pmap_fault(pmap_t , vm_offset_t , uint32_t , int , bool);
|
int pmap_fault(pmap_t, vm_offset_t, uint32_t, int, bool);
|
||||||
#define vtophys(va) pmap_kextract((vm_offset_t)(va))
|
|
||||||
|
|
||||||
void pmap_set_tex(void);
|
void pmap_set_tex(void);
|
||||||
void reinit_mmu(ttb_entry_t ttb, u_int aux_clr, u_int aux_set);
|
void reinit_mmu(ttb_entry_t ttb, u_int aux_clr, u_int aux_set);
|
||||||
@ -211,13 +182,13 @@ void reinit_mmu(ttb_entry_t ttb, u_int aux_clr, u_int aux_set);
|
|||||||
/*
|
/*
|
||||||
* Pre-bootstrap epoch functions set.
|
* Pre-bootstrap epoch functions set.
|
||||||
*/
|
*/
|
||||||
void pmap_bootstrap_prepare(vm_paddr_t );
|
void pmap_bootstrap_prepare(vm_paddr_t);
|
||||||
vm_paddr_t pmap_preboot_get_pages(u_int );
|
vm_paddr_t pmap_preboot_get_pages(u_int);
|
||||||
void pmap_preboot_map_pages(vm_paddr_t , vm_offset_t , u_int );
|
void pmap_preboot_map_pages(vm_paddr_t, vm_offset_t, u_int);
|
||||||
vm_offset_t pmap_preboot_reserve_pages(u_int );
|
vm_offset_t pmap_preboot_reserve_pages(u_int);
|
||||||
vm_offset_t pmap_preboot_get_vpages(u_int );
|
vm_offset_t pmap_preboot_get_vpages(u_int);
|
||||||
void pmap_preboot_map_attr(vm_paddr_t, vm_offset_t, vm_size_t, vm_prot_t,
|
void pmap_preboot_map_attr(vm_paddr_t, vm_offset_t, vm_size_t, vm_prot_t,
|
||||||
vm_memattr_t);
|
vm_memattr_t);
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
#endif /* !_MACHINE_PMAP_H_ */
|
#endif /* !_MACHINE_PMAP_V6_H_ */
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1991 Regents of the University of California.
|
* Copyright (c) 2016 Svatopluk Kraus
|
||||||
|
* Copyright (c) 2016 Michal Meloun
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* the Systems Programming Group of the University of Utah Computer
|
|
||||||
* Science Department and William Jolitz of UUNET Technologies Inc.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@ -14,18 +11,11 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
@ -34,514 +24,45 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* Derived from hp300 version by Mike Hibler, this version by William
|
|
||||||
* Jolitz uses a recursive map [a pde points to the page directory] to
|
|
||||||
* map the page tables using the pagetables themselves. This is done to
|
|
||||||
* reduce the impact on kernel virtual memory for lots of sparse address
|
|
||||||
* space, and to reduce the cost of memory to each process.
|
|
||||||
*
|
|
||||||
* from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
|
|
||||||
* from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
|
|
||||||
* from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30
|
|
||||||
*
|
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
#include <machine/acle-compat.h>
|
|
||||||
|
|
||||||
#if __ARM_ARCH >= 6
|
|
||||||
#include <machine/pmap-v6.h>
|
|
||||||
#else /* __ARM_ARCH >= 6 */
|
|
||||||
|
|
||||||
#ifndef _MACHINE_PMAP_H_
|
#ifndef _MACHINE_PMAP_H_
|
||||||
#define _MACHINE_PMAP_H_
|
#define _MACHINE_PMAP_H_
|
||||||
|
|
||||||
#include <machine/pte.h>
|
#include <machine/acle-compat.h>
|
||||||
#include <machine/cpuconf.h>
|
|
||||||
/*
|
|
||||||
* Pte related macros
|
|
||||||
*/
|
|
||||||
#define PTE_NOCACHE 1
|
|
||||||
#define PTE_CACHE 2
|
|
||||||
#define PTE_DEVICE PTE_NOCACHE
|
|
||||||
#define PTE_PAGETABLE 3
|
|
||||||
|
|
||||||
enum mem_type {
|
|
||||||
STRONG_ORD = 0,
|
|
||||||
DEVICE_NOSHARE,
|
|
||||||
DEVICE_SHARE,
|
|
||||||
NRML_NOCACHE,
|
|
||||||
NRML_IWT_OWT,
|
|
||||||
NRML_IWB_OWB,
|
|
||||||
NRML_IWBA_OWBA
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef LOCORE
|
|
||||||
|
|
||||||
#include <sys/queue.h>
|
|
||||||
#include <sys/_cpuset.h>
|
|
||||||
#include <sys/_lock.h>
|
|
||||||
#include <sys/_mutex.h>
|
|
||||||
|
|
||||||
#define PDESIZE sizeof(pd_entry_t) /* for assembly files */
|
|
||||||
#define PTESIZE sizeof(pt_entry_t) /* for assembly files */
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
|
||||||
|
|
||||||
#define vtophys(va) pmap_kextract((vm_offset_t)(va))
|
|
||||||
|
|
||||||
|
#if __ARM_ARCH >= 6
|
||||||
|
#include <machine/pmap-v6.h>
|
||||||
|
#else
|
||||||
|
#include <machine/pmap-v4.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define pmap_page_get_memattr(m) ((m)->md.pv_memattr)
|
|
||||||
#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0)
|
|
||||||
#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list))
|
|
||||||
void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Pmap stuff
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This structure is used to hold a virtual<->physical address
|
|
||||||
* association and is used mostly by bootstrap code
|
|
||||||
*/
|
|
||||||
struct pv_addr {
|
|
||||||
SLIST_ENTRY(pv_addr) pv_list;
|
|
||||||
vm_offset_t pv_va;
|
|
||||||
vm_paddr_t pv_pa;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct pv_entry;
|
|
||||||
struct pv_chunk;
|
|
||||||
|
|
||||||
struct md_page {
|
|
||||||
int pvh_attrs;
|
|
||||||
vm_memattr_t pv_memattr;
|
|
||||||
vm_offset_t pv_kva; /* first kernel VA mapping */
|
|
||||||
TAILQ_HEAD(,pv_entry) pv_list;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct l1_ttable;
|
|
||||||
struct l2_dtable;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The number of L2 descriptor tables which can be tracked by an l2_dtable.
|
|
||||||
* A bucket size of 16 provides for 16MB of contiguous virtual address
|
|
||||||
* space per l2_dtable. Most processes will, therefore, require only two or
|
|
||||||
* three of these to map their whole working set.
|
|
||||||
*/
|
|
||||||
#define L2_BUCKET_LOG2 4
|
|
||||||
#define L2_BUCKET_SIZE (1 << L2_BUCKET_LOG2)
|
|
||||||
/*
|
|
||||||
* Given the above "L2-descriptors-per-l2_dtable" constant, the number
|
|
||||||
* of l2_dtable structures required to track all possible page descriptors
|
|
||||||
* mappable by an L1 translation table is given by the following constants:
|
|
||||||
*/
|
|
||||||
#define L2_LOG2 ((32 - L1_S_SHIFT) - L2_BUCKET_LOG2)
|
|
||||||
#define L2_SIZE (1 << L2_LOG2)
|
|
||||||
|
|
||||||
struct pmap {
|
|
||||||
struct mtx pm_mtx;
|
|
||||||
u_int8_t pm_domain;
|
|
||||||
struct l1_ttable *pm_l1;
|
|
||||||
struct l2_dtable *pm_l2[L2_SIZE];
|
|
||||||
cpuset_t pm_active; /* active on cpus */
|
|
||||||
struct pmap_statistics pm_stats; /* pmap statictics */
|
|
||||||
TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct pmap *pmap_t;
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
|
||||||
extern struct pmap kernel_pmap_store;
|
|
||||||
#define kernel_pmap (&kernel_pmap_store)
|
|
||||||
|
|
||||||
#define PMAP_ASSERT_LOCKED(pmap) \
|
|
||||||
mtx_assert(&(pmap)->pm_mtx, MA_OWNED)
|
|
||||||
#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)
|
|
||||||
#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx)
|
|
||||||
#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \
|
|
||||||
NULL, MTX_DEF | MTX_DUPOK)
|
|
||||||
#define PMAP_OWNED(pmap) mtx_owned(&(pmap)->pm_mtx)
|
|
||||||
#define PMAP_MTX(pmap) (&(pmap)->pm_mtx)
|
|
||||||
#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx)
|
|
||||||
#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For each vm_page_t, there is a list of all currently valid virtual
|
|
||||||
* mappings of that page. An entry is a pv_entry_t, the list is pv_list.
|
|
||||||
*/
|
|
||||||
typedef struct pv_entry {
|
|
||||||
vm_offset_t pv_va; /* virtual address for mapping */
|
|
||||||
TAILQ_ENTRY(pv_entry) pv_list;
|
|
||||||
int pv_flags; /* flags (wired, etc...) */
|
|
||||||
pmap_t pv_pmap; /* pmap where mapping lies */
|
|
||||||
TAILQ_ENTRY(pv_entry) pv_plist;
|
|
||||||
} *pv_entry_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* pv_entries are allocated in chunks per-process. This avoids the
|
|
||||||
* need to track per-pmap assignments.
|
|
||||||
*/
|
|
||||||
#define _NPCM 8
|
|
||||||
#define _NPCPV 252
|
|
||||||
|
|
||||||
struct pv_chunk {
|
|
||||||
pmap_t pc_pmap;
|
|
||||||
TAILQ_ENTRY(pv_chunk) pc_list;
|
|
||||||
uint32_t pc_map[_NPCM]; /* bitmap; 1 = free */
|
|
||||||
uint32_t pc_dummy[3]; /* aligns pv_chunk to 4KB */
|
|
||||||
TAILQ_ENTRY(pv_chunk) pc_lru;
|
|
||||||
struct pv_entry pc_pventry[_NPCPV];
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
|
|
||||||
boolean_t pmap_get_pde_pte(pmap_t, vm_offset_t, pd_entry_t **, pt_entry_t **);
|
extern vm_paddr_t dump_avail[];
|
||||||
|
|
||||||
/*
|
|
||||||
* virtual address to page table entry and
|
|
||||||
* to physical address. Likewise for alternate address space.
|
|
||||||
* Note: these work recursively, thus vtopte of a pte will give
|
|
||||||
* the corresponding pde that in turn maps it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The current top of kernel VM.
|
|
||||||
*/
|
|
||||||
extern vm_offset_t pmap_curmaxkvaddr;
|
|
||||||
|
|
||||||
struct pcb;
|
|
||||||
|
|
||||||
void pmap_set_pcb_pagedir(pmap_t, struct pcb *);
|
|
||||||
/* Virtual address to page table entry */
|
|
||||||
static __inline pt_entry_t *
|
|
||||||
vtopte(vm_offset_t va)
|
|
||||||
{
|
|
||||||
pd_entry_t *pdep;
|
|
||||||
pt_entry_t *ptep;
|
|
||||||
|
|
||||||
if (pmap_get_pde_pte(kernel_pmap, va, &pdep, &ptep) == FALSE)
|
|
||||||
return (NULL);
|
|
||||||
return (ptep);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern vm_paddr_t phys_avail[];
|
extern vm_paddr_t phys_avail[];
|
||||||
|
|
||||||
|
extern char *_tmppt; /* poor name! */
|
||||||
|
|
||||||
extern vm_offset_t virtual_avail;
|
extern vm_offset_t virtual_avail;
|
||||||
extern vm_offset_t virtual_end;
|
extern vm_offset_t virtual_end;
|
||||||
|
|
||||||
void pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt);
|
void *pmap_kenter_temporary(vm_paddr_t, int);
|
||||||
int pmap_change_attr(vm_offset_t, vm_size_t, int);
|
#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0)
|
||||||
void pmap_kenter(vm_offset_t va, vm_paddr_t pa);
|
void pmap_page_set_memattr(vm_page_t, vm_memattr_t);
|
||||||
void pmap_kenter_nocache(vm_offset_t va, vm_paddr_t pa);
|
|
||||||
void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t);
|
|
||||||
void pmap_kremove_device(vm_offset_t, vm_size_t);
|
|
||||||
void *pmap_kenter_temporary(vm_paddr_t pa, int i);
|
|
||||||
void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa);
|
|
||||||
vm_paddr_t pmap_kextract(vm_offset_t va);
|
|
||||||
vm_paddr_t pmap_dump_kextract(vm_offset_t, pt2_entry_t *);
|
|
||||||
void pmap_kremove(vm_offset_t);
|
|
||||||
void *pmap_mapdev(vm_offset_t, vm_size_t);
|
|
||||||
void pmap_unmapdev(vm_offset_t, vm_size_t);
|
|
||||||
vm_page_t pmap_use_pt(pmap_t, vm_offset_t);
|
|
||||||
void pmap_debug(int);
|
|
||||||
void pmap_map_section(vm_offset_t, vm_offset_t, vm_offset_t, int, int);
|
|
||||||
void pmap_link_l2pt(vm_offset_t, vm_offset_t, struct pv_addr *);
|
|
||||||
vm_size_t pmap_map_chunk(vm_offset_t, vm_offset_t, vm_offset_t, vm_size_t, int, int);
|
|
||||||
void
|
|
||||||
pmap_map_entry(vm_offset_t l1pt, vm_offset_t va, vm_offset_t pa, int prot,
|
|
||||||
int cache);
|
|
||||||
int pmap_fault_fixup(pmap_t, vm_offset_t, vm_prot_t, int);
|
|
||||||
|
|
||||||
/*
|
void *pmap_mapdev(vm_paddr_t, vm_size_t);
|
||||||
* Definitions for MMU domains
|
void pmap_unmapdev(vm_offset_t, vm_size_t);
|
||||||
*/
|
|
||||||
#define PMAP_DOMAINS 15 /* 15 'user' domains (1-15) */
|
|
||||||
#define PMAP_DOMAIN_KERNEL 0 /* The kernel uses domain #0 */
|
|
||||||
|
|
||||||
/*
|
struct pcb;
|
||||||
* The new pmap ensures that page-tables are always mapping Write-Thru.
|
void pmap_set_pcb_pagedir(pmap_t, struct pcb *);
|
||||||
* Thus, on some platforms we can run fast and loose and avoid syncing PTEs
|
|
||||||
* on every change.
|
|
||||||
*
|
|
||||||
* Unfortunately, not all CPUs have a write-through cache mode. So we
|
|
||||||
* define PMAP_NEEDS_PTE_SYNC for C code to conditionally do PTE syncs,
|
|
||||||
* and if there is the chance for PTE syncs to be needed, we define
|
|
||||||
* PMAP_INCLUDE_PTE_SYNC so e.g. assembly code can include (and run)
|
|
||||||
* the code.
|
|
||||||
*/
|
|
||||||
extern int pmap_needs_pte_sync;
|
|
||||||
|
|
||||||
/*
|
void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t);
|
||||||
* These macros define the various bit masks in the PTE.
|
void pmap_kremove_device(vm_offset_t, vm_size_t);
|
||||||
*
|
|
||||||
* We use these macros since we use different bits on different processor
|
|
||||||
* models.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define L1_S_CACHE_MASK_generic (L1_S_B|L1_S_C)
|
vm_paddr_t pmap_kextract(vm_offset_t);
|
||||||
#define L1_S_CACHE_MASK_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X)|\
|
#define vtophys(va) pmap_kextract((vm_offset_t)(va))
|
||||||
L1_S_XSCALE_TEX(TEX_XSCALE_T))
|
|
||||||
|
|
||||||
#define L2_L_CACHE_MASK_generic (L2_B|L2_C)
|
|
||||||
#define L2_L_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X) | \
|
|
||||||
L2_XSCALE_L_TEX(TEX_XSCALE_T))
|
|
||||||
|
|
||||||
#define L2_S_PROT_U_generic (L2_AP(AP_U))
|
|
||||||
#define L2_S_PROT_W_generic (L2_AP(AP_W))
|
|
||||||
#define L2_S_PROT_MASK_generic (L2_S_PROT_U|L2_S_PROT_W)
|
|
||||||
|
|
||||||
#define L2_S_PROT_U_xscale (L2_AP0(AP_U))
|
|
||||||
#define L2_S_PROT_W_xscale (L2_AP0(AP_W))
|
|
||||||
#define L2_S_PROT_MASK_xscale (L2_S_PROT_U|L2_S_PROT_W)
|
|
||||||
|
|
||||||
#define L2_S_CACHE_MASK_generic (L2_B|L2_C)
|
|
||||||
#define L2_S_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_T_TEX(TEX_XSCALE_X)| \
|
|
||||||
L2_XSCALE_T_TEX(TEX_XSCALE_X))
|
|
||||||
|
|
||||||
#define L1_S_PROTO_generic (L1_TYPE_S | L1_S_IMP)
|
|
||||||
#define L1_S_PROTO_xscale (L1_TYPE_S)
|
|
||||||
|
|
||||||
#define L1_C_PROTO_generic (L1_TYPE_C | L1_C_IMP2)
|
|
||||||
#define L1_C_PROTO_xscale (L1_TYPE_C)
|
|
||||||
|
|
||||||
#define L2_L_PROTO (L2_TYPE_L)
|
|
||||||
|
|
||||||
#define L2_S_PROTO_generic (L2_TYPE_S)
|
|
||||||
#define L2_S_PROTO_xscale (L2_TYPE_XSCALE_XS)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* User-visible names for the ones that vary with MMU class.
|
|
||||||
*/
|
|
||||||
#define L2_AP(x) (L2_AP0(x) | L2_AP1(x) | L2_AP2(x) | L2_AP3(x))
|
|
||||||
|
|
||||||
#if ARM_NMMUS > 1
|
|
||||||
/* More than one MMU class configured; use variables. */
|
|
||||||
#define L2_S_PROT_U pte_l2_s_prot_u
|
|
||||||
#define L2_S_PROT_W pte_l2_s_prot_w
|
|
||||||
#define L2_S_PROT_MASK pte_l2_s_prot_mask
|
|
||||||
|
|
||||||
#define L1_S_CACHE_MASK pte_l1_s_cache_mask
|
|
||||||
#define L2_L_CACHE_MASK pte_l2_l_cache_mask
|
|
||||||
#define L2_S_CACHE_MASK pte_l2_s_cache_mask
|
|
||||||
|
|
||||||
#define L1_S_PROTO pte_l1_s_proto
|
|
||||||
#define L1_C_PROTO pte_l1_c_proto
|
|
||||||
#define L2_S_PROTO pte_l2_s_proto
|
|
||||||
|
|
||||||
#elif ARM_MMU_GENERIC != 0
|
|
||||||
#define L2_S_PROT_U L2_S_PROT_U_generic
|
|
||||||
#define L2_S_PROT_W L2_S_PROT_W_generic
|
|
||||||
#define L2_S_PROT_MASK L2_S_PROT_MASK_generic
|
|
||||||
|
|
||||||
#define L1_S_CACHE_MASK L1_S_CACHE_MASK_generic
|
|
||||||
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_generic
|
|
||||||
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_generic
|
|
||||||
|
|
||||||
#define L1_S_PROTO L1_S_PROTO_generic
|
|
||||||
#define L1_C_PROTO L1_C_PROTO_generic
|
|
||||||
#define L2_S_PROTO L2_S_PROTO_generic
|
|
||||||
|
|
||||||
#elif ARM_MMU_XSCALE == 1
|
|
||||||
#define L2_S_PROT_U L2_S_PROT_U_xscale
|
|
||||||
#define L2_S_PROT_W L2_S_PROT_W_xscale
|
|
||||||
#define L2_S_PROT_MASK L2_S_PROT_MASK_xscale
|
|
||||||
|
|
||||||
#define L1_S_CACHE_MASK L1_S_CACHE_MASK_xscale
|
|
||||||
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_xscale
|
|
||||||
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_xscale
|
|
||||||
|
|
||||||
#define L1_S_PROTO L1_S_PROTO_xscale
|
|
||||||
#define L1_C_PROTO L1_C_PROTO_xscale
|
|
||||||
#define L2_S_PROTO L2_S_PROTO_xscale
|
|
||||||
|
|
||||||
#endif /* ARM_NMMUS > 1 */
|
|
||||||
|
|
||||||
#if defined(CPU_XSCALE_81342)
|
|
||||||
#define PMAP_NEEDS_PTE_SYNC 1
|
|
||||||
#define PMAP_INCLUDE_PTE_SYNC
|
|
||||||
#else
|
|
||||||
#define PMAP_NEEDS_PTE_SYNC 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These macros return various bits based on kernel/user and protection.
|
|
||||||
* Note that the compiler will usually fold these at compile time.
|
|
||||||
*/
|
|
||||||
#define L1_S_PROT_U (L1_S_AP(AP_U))
|
|
||||||
#define L1_S_PROT_W (L1_S_AP(AP_W))
|
|
||||||
#define L1_S_PROT_MASK (L1_S_PROT_U|L1_S_PROT_W)
|
|
||||||
#define L1_S_WRITABLE(pd) ((pd) & L1_S_PROT_W)
|
|
||||||
|
|
||||||
#define L1_S_PROT(ku, pr) ((((ku) == PTE_USER) ? L1_S_PROT_U : 0) | \
|
|
||||||
(((pr) & VM_PROT_WRITE) ? L1_S_PROT_W : 0))
|
|
||||||
|
|
||||||
#define L2_L_PROT_U (L2_AP(AP_U))
|
|
||||||
#define L2_L_PROT_W (L2_AP(AP_W))
|
|
||||||
#define L2_L_PROT_MASK (L2_L_PROT_U|L2_L_PROT_W)
|
|
||||||
|
|
||||||
#define L2_L_PROT(ku, pr) ((((ku) == PTE_USER) ? L2_L_PROT_U : 0) | \
|
|
||||||
(((pr) & VM_PROT_WRITE) ? L2_L_PROT_W : 0))
|
|
||||||
|
|
||||||
#define L2_S_PROT(ku, pr) ((((ku) == PTE_USER) ? L2_S_PROT_U : 0) | \
|
|
||||||
(((pr) & VM_PROT_WRITE) ? L2_S_PROT_W : 0))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Macros to test if a mapping is mappable with an L1 Section mapping
|
|
||||||
* or an L2 Large Page mapping.
|
|
||||||
*/
|
|
||||||
#define L1_S_MAPPABLE_P(va, pa, size) \
|
|
||||||
((((va) | (pa)) & L1_S_OFFSET) == 0 && (size) >= L1_S_SIZE)
|
|
||||||
|
|
||||||
#define L2_L_MAPPABLE_P(va, pa, size) \
|
|
||||||
((((va) | (pa)) & L2_L_OFFSET) == 0 && (size) >= L2_L_SIZE)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Provide a fallback in case we were not able to determine it at
|
|
||||||
* compile-time.
|
|
||||||
*/
|
|
||||||
#ifndef PMAP_NEEDS_PTE_SYNC
|
|
||||||
#define PMAP_NEEDS_PTE_SYNC pmap_needs_pte_sync
|
|
||||||
#define PMAP_INCLUDE_PTE_SYNC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ARM_L2_PIPT
|
|
||||||
#define _sync_l2(pte, size) cpu_l2cache_wb_range(vtophys(pte), size)
|
|
||||||
#else
|
|
||||||
#define _sync_l2(pte, size) cpu_l2cache_wb_range(pte, size)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PTE_SYNC(pte) \
|
|
||||||
do { \
|
|
||||||
if (PMAP_NEEDS_PTE_SYNC) { \
|
|
||||||
cpu_dcache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\
|
|
||||||
cpu_drain_writebuf(); \
|
|
||||||
_sync_l2((vm_offset_t)(pte), sizeof(pt_entry_t));\
|
|
||||||
} else \
|
|
||||||
cpu_drain_writebuf(); \
|
|
||||||
} while (/*CONSTCOND*/0)
|
|
||||||
|
|
||||||
#define PTE_SYNC_RANGE(pte, cnt) \
|
|
||||||
do { \
|
|
||||||
if (PMAP_NEEDS_PTE_SYNC) { \
|
|
||||||
cpu_dcache_wb_range((vm_offset_t)(pte), \
|
|
||||||
(cnt) << 2); /* * sizeof(pt_entry_t) */ \
|
|
||||||
cpu_drain_writebuf(); \
|
|
||||||
_sync_l2((vm_offset_t)(pte), \
|
|
||||||
(cnt) << 2); /* * sizeof(pt_entry_t) */ \
|
|
||||||
} else \
|
|
||||||
cpu_drain_writebuf(); \
|
|
||||||
} while (/*CONSTCOND*/0)
|
|
||||||
|
|
||||||
extern pt_entry_t pte_l1_s_cache_mode;
|
|
||||||
extern pt_entry_t pte_l1_s_cache_mask;
|
|
||||||
|
|
||||||
extern pt_entry_t pte_l2_l_cache_mode;
|
|
||||||
extern pt_entry_t pte_l2_l_cache_mask;
|
|
||||||
|
|
||||||
extern pt_entry_t pte_l2_s_cache_mode;
|
|
||||||
extern pt_entry_t pte_l2_s_cache_mask;
|
|
||||||
|
|
||||||
extern pt_entry_t pte_l1_s_cache_mode_pt;
|
|
||||||
extern pt_entry_t pte_l2_l_cache_mode_pt;
|
|
||||||
extern pt_entry_t pte_l2_s_cache_mode_pt;
|
|
||||||
|
|
||||||
extern pt_entry_t pte_l2_s_prot_u;
|
|
||||||
extern pt_entry_t pte_l2_s_prot_w;
|
|
||||||
extern pt_entry_t pte_l2_s_prot_mask;
|
|
||||||
|
|
||||||
extern pt_entry_t pte_l1_s_proto;
|
|
||||||
extern pt_entry_t pte_l1_c_proto;
|
|
||||||
extern pt_entry_t pte_l2_s_proto;
|
|
||||||
|
|
||||||
extern void (*pmap_copy_page_func)(vm_paddr_t, vm_paddr_t);
|
|
||||||
extern void (*pmap_copy_page_offs_func)(vm_paddr_t a_phys,
|
|
||||||
vm_offset_t a_offs, vm_paddr_t b_phys, vm_offset_t b_offs, int cnt);
|
|
||||||
extern void (*pmap_zero_page_func)(vm_paddr_t, int, int);
|
|
||||||
|
|
||||||
#if ARM_MMU_GENERIC != 0 || defined(CPU_XSCALE_81342)
|
|
||||||
void pmap_copy_page_generic(vm_paddr_t, vm_paddr_t);
|
|
||||||
void pmap_zero_page_generic(vm_paddr_t, int, int);
|
|
||||||
|
|
||||||
void pmap_pte_init_generic(void);
|
|
||||||
#endif /* ARM_MMU_GENERIC != 0 */
|
|
||||||
|
|
||||||
#if ARM_MMU_XSCALE == 1
|
|
||||||
void pmap_copy_page_xscale(vm_paddr_t, vm_paddr_t);
|
|
||||||
void pmap_zero_page_xscale(vm_paddr_t, int, int);
|
|
||||||
|
|
||||||
void pmap_pte_init_xscale(void);
|
|
||||||
|
|
||||||
void xscale_setup_minidata(vm_offset_t, vm_offset_t, vm_offset_t);
|
|
||||||
|
|
||||||
void pmap_use_minicache(vm_offset_t, vm_size_t);
|
|
||||||
#endif /* ARM_MMU_XSCALE == 1 */
|
|
||||||
#if defined(CPU_XSCALE_81342)
|
|
||||||
#define ARM_HAVE_SUPERSECTIONS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PTE_KERNEL 0
|
|
||||||
#define PTE_USER 1
|
|
||||||
#define l1pte_valid(pde) ((pde) != 0)
|
|
||||||
#define l1pte_section_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_S)
|
|
||||||
#define l1pte_page_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_C)
|
|
||||||
#define l1pte_fpage_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_F)
|
|
||||||
|
|
||||||
#define l2pte_index(v) (((v) & L2_ADDR_BITS) >> L2_S_SHIFT)
|
|
||||||
#define l2pte_valid(pte) ((pte) != 0)
|
|
||||||
#define l2pte_pa(pte) ((pte) & L2_S_FRAME)
|
|
||||||
#define l2pte_minidata(pte) (((pte) & \
|
|
||||||
(L2_B | L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X)))\
|
|
||||||
== (L2_C | L2_XSCALE_T_TEX(TEX_XSCALE_X)))
|
|
||||||
|
|
||||||
/* L1 and L2 page table macros */
|
|
||||||
#define pmap_pde_v(pde) l1pte_valid(*(pde))
|
|
||||||
#define pmap_pde_section(pde) l1pte_section_p(*(pde))
|
|
||||||
#define pmap_pde_page(pde) l1pte_page_p(*(pde))
|
|
||||||
#define pmap_pde_fpage(pde) l1pte_fpage_p(*(pde))
|
|
||||||
|
|
||||||
#define pmap_pte_v(pte) l2pte_valid(*(pte))
|
|
||||||
#define pmap_pte_pa(pte) l2pte_pa(*(pte))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Flags that indicate attributes of pages or mappings of pages.
|
|
||||||
*
|
|
||||||
* The PVF_MOD and PVF_REF flags are stored in the mdpage for each
|
|
||||||
* page. PVF_WIRED, PVF_WRITE, and PVF_NC are kept in individual
|
|
||||||
* pv_entry's for each page. They live in the same "namespace" so
|
|
||||||
* that we can clear multiple attributes at a time.
|
|
||||||
*
|
|
||||||
* Note the "non-cacheable" flag generally means the page has
|
|
||||||
* multiple mappings in a given address space.
|
|
||||||
*/
|
|
||||||
#define PVF_MOD 0x01 /* page is modified */
|
|
||||||
#define PVF_REF 0x02 /* page is referenced */
|
|
||||||
#define PVF_WIRED 0x04 /* mapping is wired */
|
|
||||||
#define PVF_WRITE 0x08 /* mapping is writable */
|
|
||||||
#define PVF_EXEC 0x10 /* mapping is executable */
|
|
||||||
#define PVF_NC 0x20 /* mapping is non-cacheable */
|
|
||||||
#define PVF_MWC 0x40 /* mapping is used multiple times in userland */
|
|
||||||
#define PVF_UNMAN 0x80 /* mapping is unmanaged */
|
|
||||||
|
|
||||||
void vector_page_setprot(int);
|
|
||||||
|
|
||||||
#define SECTION_CACHE 0x1
|
|
||||||
#define SECTION_PT 0x2
|
|
||||||
void pmap_kenter_section(vm_offset_t, vm_paddr_t, int flags);
|
|
||||||
#ifdef ARM_HAVE_SUPERSECTIONS
|
|
||||||
void pmap_kenter_supersection(vm_offset_t, uint64_t, int flags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char *_tmppt;
|
|
||||||
|
|
||||||
void pmap_postinit(void);
|
|
||||||
|
|
||||||
extern vm_paddr_t dump_avail[];
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
#endif /* !LOCORE */
|
|
||||||
|
|
||||||
#endif /* !_MACHINE_PMAP_H_ */
|
#endif /* !_MACHINE_PMAP_H_ */
|
||||||
#endif /* __ARM_ARCH >= 6 */
|
|
||||||
|
@ -33,14 +33,9 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
#include <machine/acle-compat.h>
|
|
||||||
|
|
||||||
#if __ARM_ARCH >= 6
|
#ifndef _MACHINE_PTE_V4_H_
|
||||||
#include <machine/pte-v6.h>
|
#define _MACHINE_PTE_V4_H_
|
||||||
#else /* __ARM_ARCH >= 6 */
|
|
||||||
|
|
||||||
#ifndef _MACHINE_PTE_H_
|
|
||||||
#define _MACHINE_PTE_H_
|
|
||||||
|
|
||||||
#ifndef LOCORE
|
#ifndef LOCORE
|
||||||
typedef uint32_t pd_entry_t; /* page directory entry */
|
typedef uint32_t pd_entry_t; /* page directory entry */
|
||||||
@ -72,10 +67,6 @@ typedef pt_entry_t pt2_entry_t; /* compatibility with v6 */
|
|||||||
#define L2_MASK 0x03 /* Mask for L2 entry type */
|
#define L2_MASK 0x03 /* Mask for L2 entry type */
|
||||||
#define L2_INVAL 0x00 /* L2 invalid type */
|
#define L2_INVAL 0x00 /* L2 invalid type */
|
||||||
|
|
||||||
/* L1 and L2 address masks */
|
|
||||||
#define L1_ADDR_MASK 0xfffffc00
|
|
||||||
#define L2_ADDR_MASK 0xfffff000
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The ARM MMU architecture was introduced with ARM v3 (previous ARM
|
* The ARM MMU architecture was introduced with ARM v3 (previous ARM
|
||||||
* architecture versions used an optional off-CPU memory controller
|
* architecture versions used an optional off-CPU memory controller
|
||||||
@ -152,9 +143,6 @@ typedef pt_entry_t pt2_entry_t; /* compatibility with v6 */
|
|||||||
* So, we allocate L2 tables 4 at a time, thus yielding a 4K L2
|
* So, we allocate L2 tables 4 at a time, thus yielding a 4K L2
|
||||||
* table.
|
* table.
|
||||||
*/
|
*/
|
||||||
#define L1_ADDR_BITS 0xfff00000 /* L1 PTE address bits */
|
|
||||||
#define L2_ADDR_BITS 0x000ff000 /* L2 PTE address bits */
|
|
||||||
|
|
||||||
#define L1_TABLE_SIZE 0x4000 /* 16K */
|
#define L1_TABLE_SIZE 0x4000 /* 16K */
|
||||||
#define L2_TABLE_SIZE 0x1000 /* 4K */
|
#define L2_TABLE_SIZE 0x1000 /* 4K */
|
||||||
/*
|
/*
|
||||||
@ -357,7 +345,6 @@ typedef pt_entry_t pt2_entry_t; /* compatibility with v6 */
|
|||||||
* 1 X 1 1 0 Y Y WT Y Y
|
* 1 X 1 1 0 Y Y WT Y Y
|
||||||
* 1 X 1 1 1 Y Y WT Y Y
|
* 1 X 1 1 1 Y Y WT Y Y
|
||||||
*/
|
*/
|
||||||
#endif /* !_MACHINE_PTE_H_ */
|
#endif /* !_MACHINE_PTE_V4_H_ */
|
||||||
#endif /* __ARM_ARCH >= 6 */
|
|
||||||
|
|
||||||
/* End of pte.h */
|
/* End of pte.h */
|
@ -27,8 +27,8 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MACHINE_PTE_H_
|
#ifndef _MACHINE_PTE_V6_H_
|
||||||
#define _MACHINE_PTE_H_
|
#define _MACHINE_PTE_V6_H_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Domain Types for the Domain Access Control Register.
|
* Domain Types for the Domain Access Control Register.
|
||||||
@ -288,41 +288,4 @@
|
|||||||
#define PTE2_KERN(pa, ap, attr) PTE2(pa, (ap) | PTE2_A | PTE2_G, attr)
|
#define PTE2_KERN(pa, ap, attr) PTE2(pa, (ap) | PTE2_A | PTE2_G, attr)
|
||||||
#define PTE2_KERN_NG(pa, ap, attr) PTE2(pa, (ap) | PTE2_A | PTE2_NG, attr)
|
#define PTE2_KERN_NG(pa, ap, attr) PTE2(pa, (ap) | PTE2_A | PTE2_NG, attr)
|
||||||
|
|
||||||
|
#endif /* !_MACHINE_PTE_V6_H_ */
|
||||||
// ----------------- TO BE DELETED ---------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
* sys/arm/arm/elf_trampoline.c
|
|
||||||
*/
|
|
||||||
#define AP_KRW 0x01 /* kernel read/write */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* lib/libkvm/kvm_arm.c
|
|
||||||
*/
|
|
||||||
#define L1_ADDR_MASK 0xfffffc00
|
|
||||||
|
|
||||||
/*
|
|
||||||
* lib/libkvm/kvm_arm.c
|
|
||||||
*/
|
|
||||||
#define L2_ADDR_BITS 0x000ff000 /* L2 PTE address bits */
|
|
||||||
|
|
||||||
#ifndef LOCORE
|
|
||||||
/*
|
|
||||||
* sys/arm/arm/minidump_machdep.c
|
|
||||||
* sys/arm/arm/pmap.c
|
|
||||||
* sys/arm/arm/pmap.h (hack for our hack in pmap.h )
|
|
||||||
* lib/libkvm/kvm_arm.c
|
|
||||||
*/
|
|
||||||
typedef uint32_t pd_entry_t; /* page directory entry */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* sys/arm/arm/minidump_machdep.c
|
|
||||||
* sys/arm/arm/pmap.c
|
|
||||||
* sys/arm/arm/pmap.h (hack for our hack in pmap.h )
|
|
||||||
* sys/arm/include/param.h
|
|
||||||
*/
|
|
||||||
typedef uint32_t pt_entry_t; /* page table entry */
|
|
||||||
#endif
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif /* !_MACHINE_PTE_H_ */
|
|
||||||
|
@ -2,5 +2,3 @@
|
|||||||
|
|
||||||
makeoptions KERNVIRTADDR=0xc0200000
|
makeoptions KERNVIRTADDR=0xc0200000
|
||||||
options KERNVIRTADDR=0xc0200000
|
options KERNVIRTADDR=0xc0200000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
@ -341,7 +341,7 @@ localbus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||||||
* Request for the default allocation with a given rid: use resource
|
* Request for the default allocation with a given rid: use resource
|
||||||
* list stored in the local device info.
|
* list stored in the local device info.
|
||||||
*/
|
*/
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
if ((di = device_get_ivars(child)) == NULL)
|
if ((di = device_get_ivars(child)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <dev/fdt/fdt_common.h>
|
#include <dev/fdt/fdt_common.h>
|
||||||
#include <dev/ofw/ofw_bus.h>
|
#include <dev/ofw/ofw_bus.h>
|
||||||
#include <dev/ofw/ofw_pci.h>
|
|
||||||
#include <dev/ofw/ofw_bus_subr.h>
|
#include <dev/ofw/ofw_bus_subr.h>
|
||||||
|
#include <dev/ofw/ofw_pci.h>
|
||||||
#include <dev/pci/pcivar.h>
|
#include <dev/pci/pcivar.h>
|
||||||
#include <dev/pci/pcireg.h>
|
#include <dev/pci/pcireg.h>
|
||||||
#include <dev/pci/pcib_private.h>
|
#include <dev/pci/pcib_private.h>
|
||||||
@ -844,7 +844,7 @@ mv_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
|
|||||||
type, rid, start, end, count, flags));
|
type, rid, start, end, count, flags));
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
start = sc->sc_mem_base;
|
start = sc->sc_mem_base;
|
||||||
end = sc->sc_mem_base + sc->sc_mem_size - 1;
|
end = sc->sc_mem_base + sc->sc_mem_size - 1;
|
||||||
count = sc->sc_mem_size;
|
count = sc->sc_mem_size;
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
#include <vm/vm.h>
|
#include <vm/vm.h>
|
||||||
#include <vm/pmap.h>
|
#include <vm/pmap.h>
|
||||||
#include <machine/vm.h>
|
|
||||||
|
|
||||||
#include <dev/ofw/openfirm.h>
|
#include <dev/ofw/openfirm.h>
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
machine arm armv6
|
machine arm armv6
|
||||||
cpu CPU_CORTEXA
|
cpu CPU_CORTEXA
|
||||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options KERNVIRTADDR = 0xc1000000
|
options KERNVIRTADDR = 0xc1000000
|
||||||
makeoptions KERNVIRTADDR = 0xc1000000
|
makeoptions KERNVIRTADDR = 0xc1000000
|
||||||
|
@ -8,8 +8,6 @@ makeoptions CONF_CFLAGS="-march=armv7a"
|
|||||||
makeoptions KERNVIRTADDR=0xc0400000
|
makeoptions KERNVIRTADDR=0xc0400000
|
||||||
options KERNVIRTADDR=0xc0400000
|
options KERNVIRTADDR=0xc0400000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options IPI_IRQ_START=0
|
options IPI_IRQ_START=0
|
||||||
options IPI_IRQ_END=15
|
options IPI_IRQ_END=15
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@ makeoptions CONF_CFLAGS="-march=armv7a"
|
|||||||
makeoptions KERNVIRTADDR=0xc0f00000
|
makeoptions KERNVIRTADDR=0xc0f00000
|
||||||
options KERNVIRTADDR=0xc0f00000
|
options KERNVIRTADDR=0xc0f00000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options IPI_IRQ_START=0
|
options IPI_IRQ_START=0
|
||||||
options IPI_IRQ_END=15
|
options IPI_IRQ_END=15
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@ makeoptions CONF_CFLAGS="-march=armv7a"
|
|||||||
makeoptions KERNVIRTADDR=0xc0f00000
|
makeoptions KERNVIRTADDR=0xc0f00000
|
||||||
options KERNVIRTADDR=0xc0f00000
|
options KERNVIRTADDR=0xc0f00000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options IPI_IRQ_START=0
|
options IPI_IRQ_START=0
|
||||||
options IPI_IRQ_END=15
|
options IPI_IRQ_END=15
|
||||||
|
|
||||||
|
@ -7,5 +7,3 @@ options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm
|
|||||||
makeoptions KERNVIRTADDR=0xc0200000
|
makeoptions KERNVIRTADDR=0xc0200000
|
||||||
|
|
||||||
options SOC_TI_AM335X
|
options SOC_TI_AM335X
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
@ -7,5 +7,3 @@ options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm
|
|||||||
makeoptions KERNVIRTADDR=0xc0200000
|
makeoptions KERNVIRTADDR=0xc0200000
|
||||||
|
|
||||||
options SOC_OMAP4
|
options SOC_OMAP4
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
@ -12,7 +12,5 @@ files "../xilinx/files.zynq7"
|
|||||||
options KERNVIRTADDR=0xc0100000 # Used in ldscript.arm
|
options KERNVIRTADDR=0xc0100000 # Used in ldscript.arm
|
||||||
makeoptions KERNVIRTADDR=0xc0100000
|
makeoptions KERNVIRTADDR=0xc0100000
|
||||||
|
|
||||||
options ARM_L2_PIPT
|
|
||||||
|
|
||||||
options IPI_IRQ_START=0
|
options IPI_IRQ_START=0
|
||||||
options IPI_IRQ_END=15
|
options IPI_IRQ_END=15
|
||||||
|
@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
#include <machine/debug_monitor.h>
|
#include <machine/debug_monitor.h>
|
||||||
#include <machine/kdb.h>
|
#include <machine/kdb.h>
|
||||||
#include <machine/param.h>
|
|
||||||
|
|
||||||
#include <ddb/ddb.h>
|
#include <ddb/ddb.h>
|
||||||
#include <ddb/db_sym.h>
|
#include <ddb/db_sym.h>
|
||||||
|
@ -211,7 +211,7 @@ arm_gic_fdt_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||||||
* Request for the default allocation with a given rid: use resource
|
* Request for the default allocation with a given rid: use resource
|
||||||
* list stored in the local device info.
|
* list stored in the local device info.
|
||||||
*/
|
*/
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
if ((di = device_get_ivars(child)) == NULL)
|
if ((di = device_get_ivars(child)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/bus.h>
|
#include <sys/bus.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/module.h>
|
#include <sys/module.h>
|
||||||
|
#include <sys/rman.h>
|
||||||
|
|
||||||
#include <machine/resource.h>
|
#include <machine/resource.h>
|
||||||
|
|
||||||
@ -180,7 +181,7 @@ gic_v3_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid,
|
|||||||
struct resource_list_entry *rle;
|
struct resource_list_entry *rle;
|
||||||
int ranges_len;
|
int ranges_len;
|
||||||
|
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
if ((di = device_get_ivars(child)) == NULL)
|
if ((di = device_get_ivars(child)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (type != SYS_RES_MEMORY)
|
if (type != SYS_RES_MEMORY)
|
||||||
|
@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "gic_v3_reg.h"
|
#include "gic_v3_reg.h"
|
||||||
#include "gic_v3_var.h"
|
#include "gic_v3_var.h"
|
||||||
|
|
||||||
#define GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET 144
|
#define GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET 88
|
||||||
|
|
||||||
#include "pic_if.h"
|
#include "pic_if.h"
|
||||||
|
|
||||||
|
@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <vm/pmap.h>
|
#include <vm/pmap.h>
|
||||||
|
|
||||||
#include <machine/md_var.h>
|
#include <machine/md_var.h>
|
||||||
#include <machine/pmap.h>
|
|
||||||
#include <machine/pte.h>
|
#include <machine/pte.h>
|
||||||
#include <machine/vmparam.h>
|
|
||||||
#include <machine/minidump.h>
|
#include <machine/minidump.h>
|
||||||
|
|
||||||
CTASSERT(sizeof(struct kerneldumpheader) == 512);
|
CTASSERT(sizeof(struct kerneldumpheader) == 512);
|
||||||
|
@ -113,6 +113,7 @@ static int nexus_deactivate_resource(device_t, device_t, int, int,
|
|||||||
static int nexus_setup_intr(device_t dev, device_t child, struct resource *res,
|
static int nexus_setup_intr(device_t dev, device_t child, struct resource *res,
|
||||||
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep);
|
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep);
|
||||||
static int nexus_teardown_intr(device_t, device_t, struct resource *, void *);
|
static int nexus_teardown_intr(device_t, device_t, struct resource *, void *);
|
||||||
|
static bus_space_tag_t nexus_get_bus_tag(device_t, device_t);
|
||||||
#ifdef SMP
|
#ifdef SMP
|
||||||
static int nexus_bind_intr(device_t, device_t, struct resource *, int);
|
static int nexus_bind_intr(device_t, device_t, struct resource *, int);
|
||||||
#endif
|
#endif
|
||||||
@ -134,6 +135,7 @@ static device_method_t nexus_methods[] = {
|
|||||||
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
|
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
|
||||||
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
||||||
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
||||||
|
DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag),
|
||||||
#ifdef SMP
|
#ifdef SMP
|
||||||
DEVMETHOD(bus_bind_intr, nexus_bind_intr),
|
DEVMETHOD(bus_bind_intr, nexus_bind_intr),
|
||||||
#endif
|
#endif
|
||||||
@ -221,7 +223,7 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||||||
* (ie. they aren't maintained by a child bus), then work out
|
* (ie. they aren't maintained by a child bus), then work out
|
||||||
* the start/end values.
|
* the start/end values.
|
||||||
*/
|
*/
|
||||||
if ((start == 0UL) && (end == ~0UL) && (count == 1)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) {
|
||||||
if (device_get_parent(child) != bus || ndev == NULL)
|
if (device_get_parent(child) != bus || ndev == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
rle = resource_list_find(&ndev->nx_resources, type, *rid);
|
rle = resource_list_find(&ndev->nx_resources, type, *rid);
|
||||||
@ -307,6 +309,13 @@ nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bus_space_tag_t
|
||||||
|
nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
|
||||||
|
{
|
||||||
|
|
||||||
|
return(&memmap_bus);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
struct resource *r)
|
struct resource *r)
|
||||||
|
@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <machine/frame.h>
|
#include <machine/frame.h>
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
#include <machine/pcpu.h>
|
#include <machine/pcpu.h>
|
||||||
#include <machine/vmparam.h>
|
|
||||||
|
|
||||||
#ifdef KDTRACE_HOOKS
|
#ifdef KDTRACE_HOOKS
|
||||||
#include <sys/dtrace_bsd.h>
|
#include <sys/dtrace_bsd.h>
|
||||||
|
@ -292,7 +292,7 @@ thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid,
|
|||||||
type, rid, start, end, count, flags));
|
type, rid, start, end, count, flags));
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
|
|
||||||
/* Read BAR manually to get resource address and size */
|
/* Read BAR manually to get resource address and size */
|
||||||
pci_read_bar(child, *rid, &map, &testval, NULL);
|
pci_read_bar(child, *rid, &map, &testval, NULL);
|
||||||
|
@ -283,7 +283,7 @@ thunder_pcie_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid,
|
|||||||
|
|
||||||
sc = device_get_softc(bus);
|
sc = device_get_softc(bus);
|
||||||
|
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
if ((di = device_get_ivars(child)) == NULL)
|
if ((di = device_get_ivars(child)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (type == SYS_RES_IOPORT)
|
if (type == SYS_RES_IOPORT)
|
||||||
|
@ -435,7 +435,7 @@ thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid,
|
|||||||
end, count, flags));
|
end, count, flags));
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((start == 0UL) && (end == ~0UL)) {
|
if (RMAN_IS_DEFAULT_RANGE(start, end)) {
|
||||||
device_printf(dev,
|
device_printf(dev,
|
||||||
"Cannot allocate resource with unspecified range\n");
|
"Cannot allocate resource with unspecified range\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <machine/frame.h>
|
#include <machine/frame.h>
|
||||||
#include <machine/pcb.h>
|
#include <machine/pcb.h>
|
||||||
#include <machine/pmap.h>
|
|
||||||
#include <machine/vmparam.h>
|
#include <machine/vmparam.h>
|
||||||
|
|
||||||
#include <compat/cloudabi/cloudabi_util.h>
|
#include <compat/cloudabi/cloudabi_util.h>
|
||||||
|
@ -113,7 +113,8 @@ boot1.efifat: boot1.efi
|
|||||||
uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
|
uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
|
||||||
mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
|
mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
|
||||||
bzip2 -f -d ${.TARGET}.bz2
|
bzip2 -f -d ${.TARGET}.bz2
|
||||||
dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
|
dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc \
|
||||||
|
status=none
|
||||||
|
|
||||||
CLEANFILES= boot1.efi boot1.efifat
|
CLEANFILES= boot1.efi boot1.efifat
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@ int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *, uint64_t *);
|
|||||||
int efi_handle_update_dev(EFI_HANDLE, struct devsw *, int, uint64_t);
|
int efi_handle_update_dev(EFI_HANDLE, struct devsw *, int, uint64_t);
|
||||||
|
|
||||||
int efi_status_to_errno(EFI_STATUS);
|
int efi_status_to_errno(EFI_STATUS);
|
||||||
time_t efi_time(EFI_TIME *);
|
|
||||||
|
|
||||||
EFI_STATUS main(int argc, CHAR16 *argv[]);
|
EFI_STATUS main(int argc, CHAR16 *argv[]);
|
||||||
void exit(EFI_STATUS status);
|
void exit(EFI_STATUS status);
|
||||||
|
@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define SECSPERHOUR ( 60*60 )
|
#define SECSPERHOUR ( 60*60 )
|
||||||
#define SECSPERDAY (24 * SECSPERHOUR)
|
#define SECSPERDAY (24 * SECSPERHOUR)
|
||||||
|
|
||||||
time_t
|
static time_t
|
||||||
efi_time(EFI_TIME *ETime)
|
efi_time(EFI_TIME *ETime)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -164,7 +164,7 @@ efi_time(EFI_TIME *ETime)
|
|||||||
return UTime;
|
return UTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
EFI_GetTimeOfDay(
|
EFI_GetTimeOfDay(
|
||||||
OUT struct timeval *tp,
|
OUT struct timeval *tp,
|
||||||
OUT struct timezone *tzp
|
OUT struct timezone *tzp
|
||||||
|
@ -117,6 +117,8 @@ elf64_exec(struct preloaded_file *fp)
|
|||||||
if (err != 0)
|
if (err != 0)
|
||||||
return (err);
|
return (err);
|
||||||
|
|
||||||
|
dev_cleanup();
|
||||||
|
|
||||||
/* Clean D-cache under kernel area and invalidate whole I-cache */
|
/* Clean D-cache under kernel area and invalidate whole I-cache */
|
||||||
clean_addr = (vm_offset_t)efi_translate(fp->f_addr);
|
clean_addr = (vm_offset_t)efi_translate(fp->f_addr);
|
||||||
clean_size = (vm_offset_t)efi_translate(kernendp) - clean_addr;
|
clean_size = (vm_offset_t)efi_translate(kernendp) - clean_addr;
|
||||||
|
@ -72,14 +72,14 @@ CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
|
|||||||
boot2: boot2.ld
|
boot2: boot2.ld
|
||||||
@set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
|
@set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
|
||||||
echo "$$x bytes available"; test $$x -ge 0
|
echo "$$x bytes available"; test $$x -ge 0
|
||||||
dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
|
dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync status=none
|
||||||
|
|
||||||
boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
|
boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
|
||||||
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
|
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
|
||||||
-o ${.TARGET} -P 1 boot2.bin
|
-o ${.TARGET} -P 1 boot2.bin
|
||||||
|
|
||||||
boot2.ldr:
|
boot2.ldr:
|
||||||
dd if=/dev/zero of=${.TARGET} bs=512 count=1
|
dd if=/dev/zero of=${.TARGET} bs=512 count=1 status=none
|
||||||
|
|
||||||
boot2.bin: boot2.out
|
boot2.bin: boot2.out
|
||||||
${OBJCOPY} -S -O binary boot2.out ${.TARGET}
|
${OBJCOPY} -S -O binary boot2.out ${.TARGET}
|
||||||
|
@ -31,7 +31,7 @@ CLEANFILES+= ${BOOT}.tmp
|
|||||||
|
|
||||||
${BOOT}: ${LDR} ${LOADER}
|
${BOOT}: ${LDR} ${LOADER}
|
||||||
cat ${LDR} ${LOADER} > ${.TARGET}.tmp
|
cat ${LDR} ${LOADER} > ${.TARGET}.tmp
|
||||||
dd if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync
|
dd if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync status=none
|
||||||
rm ${.TARGET}.tmp
|
rm ${.TARGET}.tmp
|
||||||
|
|
||||||
LDFLAGS+=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
|
LDFLAGS+=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
|
||||||
|
@ -65,7 +65,7 @@ BOOT2SIZE= 65536
|
|||||||
zfsboot2: zfsboot.ld
|
zfsboot2: zfsboot.ld
|
||||||
@set -- `ls -l zfsboot.ld`; x=$$((${BOOT2SIZE}-$$5)); \
|
@set -- `ls -l zfsboot.ld`; x=$$((${BOOT2SIZE}-$$5)); \
|
||||||
echo "$$x bytes available"; test $$x -ge 0
|
echo "$$x bytes available"; test $$x -ge 0
|
||||||
dd if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync
|
dd if=zfsboot.ld of=${.TARGET} obs=${BOOT2SIZE} conv=osync status=none
|
||||||
|
|
||||||
zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
|
zfsboot.ld: zfsboot.ldr zfsboot.bin ${BTXKERN}
|
||||||
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \
|
btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l zfsboot.ldr \
|
||||||
|
@ -3228,7 +3228,8 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
|
|||||||
softc->state = DA_STATE_PROBE_RC;
|
softc->state = DA_STATE_PROBE_RC;
|
||||||
xpt_schedule(periph, priority);
|
xpt_schedule(periph, priority);
|
||||||
return;
|
return;
|
||||||
} else
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attach to anything that claims to be a
|
* Attach to anything that claims to be a
|
||||||
* direct access or optical disk device,
|
* direct access or optical disk device,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user