Merge ^/head r327341 through r327623.
This commit is contained in:
commit
4b49587c3d
@ -4,7 +4,7 @@
|
||||
The compilation of software known as FreeBSD is distributed under the
|
||||
following terms:
|
||||
|
||||
Copyright (c) 1992-2017 The FreeBSD Project. All rights reserved.
|
||||
Copyright (c) 1992-2018 The FreeBSD Project. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
@ -262,10 +262,11 @@ SUBDIR+= tests
|
||||
SUBDIR+=contrib/ofed
|
||||
.endif
|
||||
|
||||
# Local directories are last, since it is nice to at least get the base
|
||||
# system rebuilt before you do them.
|
||||
# Local directories are built in parallel with the base system directories.
|
||||
# Users may insert a .WAIT directive at the beginning or elsewhere within
|
||||
# the LOCAL_DIRS and LOCAL_LIB_DIRS lists as needed.
|
||||
.for _DIR in ${LOCAL_DIRS}
|
||||
.if exists(${.CURDIR}/${_DIR}/Makefile)
|
||||
.if ${_DIR} == ".WAIT" || exists(${.CURDIR}/${_DIR}/Makefile)
|
||||
SUBDIR+= ${_DIR}
|
||||
.endif
|
||||
.endfor
|
||||
@ -276,7 +277,7 @@ SUBDIR+= ${_DIR}
|
||||
_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*}
|
||||
.endfor
|
||||
.for _DIR in ${LOCAL_LIB_DIRS}
|
||||
.if empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
|
||||
.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile))
|
||||
SUBDIR+= ${_DIR}
|
||||
.endif
|
||||
.endfor
|
||||
@ -2445,7 +2446,7 @@ _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin
|
||||
_generic_libs+= sbin/ipf/libipf
|
||||
.endif
|
||||
.for _DIR in ${LOCAL_LIB_DIRS}
|
||||
.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR})
|
||||
.if ${_DIR} == ".WAIT" || (empty(_generic_libs:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile))
|
||||
_generic_libs+= ${_DIR}
|
||||
.endif
|
||||
.endfor
|
||||
|
@ -38,7 +38,7 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 2017mmdd: new clang import which bumps version from 5.0.1 to 6.0.0.
|
||||
# 2018mmdd: new clang import which bumps version from 5.0.1 to 6.0.0.
|
||||
OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/allocator_interface.h
|
||||
OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/asan_interface.h
|
||||
OLD_FILES+=usr/lib/clang/5.0.1/include/sanitizer/common_interface_defs.h
|
||||
@ -155,6 +155,8 @@ OLD_FILES+=usr/lib/clang/5.0.1/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_
|
||||
OLD_DIRS+=usr/lib/clang/5.0.1/lib/freebsd
|
||||
OLD_DIRS+=usr/lib/clang/5.0.1/lib
|
||||
OLD_DIRS+=usr/lib/clang/5.0.1
|
||||
# 20171230: Remove /etc/skel from mtree
|
||||
OLD_DIRS+=/etc/skel
|
||||
# 20171208: Remove basename_r(3)
|
||||
OLD_FILES+=usr/share/man/man3/basename_r.3.gz
|
||||
# 20171204: Move fdformat man page from volume 1 to volume 8.
|
||||
|
14
UPDATING
14
UPDATING
@ -51,6 +51,20 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
|
||||
|
||||
****************************** SPECIAL WARNING: ******************************
|
||||
|
||||
20180104:
|
||||
The use of RSS hash from the network card aka flowid has been
|
||||
disabled by default for lagg(4) as it's currently incompatible with
|
||||
the lacp and loadbalance protocols.
|
||||
|
||||
This can be re-enabled by setting the following in loader.conf:
|
||||
net.link.lagg.default_use_flowid="1"
|
||||
|
||||
20180102:
|
||||
The SW_WATCHDOG option is no longer necessary to enable the
|
||||
hardclock-based software watchdog if no hardware watchdog is
|
||||
configured. As before, SW_WATCHDOG will cause the software
|
||||
watchdog to be enabled even if a hardware watchdog is configured.
|
||||
|
||||
20171215:
|
||||
r326887 fixes the issue described in the 20171214 UPDATING entry.
|
||||
r326888 flips the switch back to building GELI support always.
|
||||
|
@ -300,6 +300,7 @@ cook_cat(FILE *fp)
|
||||
static void
|
||||
raw_cat(int rfd)
|
||||
{
|
||||
long pagesize;
|
||||
int off, wfd;
|
||||
ssize_t nr, nw;
|
||||
static size_t bsize;
|
||||
@ -316,9 +317,12 @@ raw_cat(int rfd)
|
||||
bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8);
|
||||
else
|
||||
bsize = BUFSIZE_SMALL;
|
||||
} else
|
||||
bsize = MAX(sbuf.st_blksize,
|
||||
(blksize_t)sysconf(_SC_PAGESIZE));
|
||||
} else {
|
||||
bsize = sbuf.st_blksize;
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
if (pagesize > 0)
|
||||
bsize = MAX(bsize, (size_t)pagesize);
|
||||
}
|
||||
if ((buf = malloc(bsize)) == NULL)
|
||||
err(1, "malloc() failure of IO buffer");
|
||||
}
|
||||
|
@ -75,6 +75,42 @@ __FBSDID("$FreeBSD$");
|
||||
#include "builtins.h"
|
||||
|
||||
|
||||
/*
|
||||
* A job structure contains information about a job. A job is either a
|
||||
* single process or a set of processes contained in a pipeline. In the
|
||||
* latter case, pidlist will be non-NULL, and will point to a -1 terminated
|
||||
* array of pids.
|
||||
*/
|
||||
|
||||
struct procstat {
|
||||
pid_t pid; /* process id */
|
||||
int status; /* status flags (defined above) */
|
||||
char *cmd; /* text of command being run */
|
||||
};
|
||||
|
||||
|
||||
/* states */
|
||||
#define JOBSTOPPED 1 /* all procs are stopped */
|
||||
#define JOBDONE 2 /* all procs are completed */
|
||||
|
||||
|
||||
struct job {
|
||||
struct procstat ps0; /* status of process */
|
||||
struct procstat *ps; /* status or processes when more than one */
|
||||
short nprocs; /* number of processes */
|
||||
pid_t pgrp; /* process group of this job */
|
||||
char state; /* true if job is finished */
|
||||
char used; /* true if this entry is in used */
|
||||
char changed; /* true if status has changed */
|
||||
char foreground; /* true if running in the foreground */
|
||||
char remembered; /* true if $! referenced */
|
||||
#if JOBS
|
||||
char jobctl; /* job running under job control */
|
||||
struct job *next; /* job used after this one */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
static struct job *jobtab; /* array of jobs */
|
||||
static int njobs; /* size of array */
|
||||
static pid_t backgndpid = -1; /* pid of last background process */
|
||||
|
@ -40,40 +40,7 @@
|
||||
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
|
||||
/*
|
||||
* A job structure contains information about a job. A job is either a
|
||||
* single process or a set of processes contained in a pipeline. In the
|
||||
* latter case, pidlist will be non-NULL, and will point to a -1 terminated
|
||||
* array of pids.
|
||||
*/
|
||||
|
||||
struct procstat {
|
||||
pid_t pid; /* process id */
|
||||
int status; /* status flags (defined above) */
|
||||
char *cmd; /* text of command being run */
|
||||
};
|
||||
|
||||
|
||||
/* states */
|
||||
#define JOBSTOPPED 1 /* all procs are stopped */
|
||||
#define JOBDONE 2 /* all procs are completed */
|
||||
|
||||
|
||||
struct job {
|
||||
struct procstat ps0; /* status of process */
|
||||
struct procstat *ps; /* status or processes when more than one */
|
||||
short nprocs; /* number of processes */
|
||||
pid_t pgrp; /* process group of this job */
|
||||
char state; /* true if job is finished */
|
||||
char used; /* true if this entry is in used */
|
||||
char changed; /* true if status has changed */
|
||||
char foreground; /* true if running in the foreground */
|
||||
char remembered; /* true if $! referenced */
|
||||
#if JOBS
|
||||
char jobctl; /* job running under job control */
|
||||
struct job *next; /* job used after this one */
|
||||
#endif
|
||||
};
|
||||
struct job;
|
||||
|
||||
enum {
|
||||
SHOWJOBS_DEFAULT, /* job number, status, command */
|
||||
|
@ -101,10 +101,10 @@ create_binary(int ifd, int ofd)
|
||||
sh.sh_size == 0)
|
||||
continue;
|
||||
(void) elf_errno();
|
||||
if ((d = elf_getdata(scn, NULL)) == NULL) {
|
||||
if ((d = elf_rawdata(scn, NULL)) == NULL) {
|
||||
elferr = elf_errno();
|
||||
if (elferr != 0)
|
||||
warnx("elf_getdata failed: %s", elf_errmsg(-1));
|
||||
warnx("elf_rawdata failed: %s", elf_errmsg(-1));
|
||||
continue;
|
||||
}
|
||||
if (d->d_buf == NULL || d->d_size == 0)
|
||||
|
@ -70,8 +70,6 @@
|
||||
..
|
||||
security
|
||||
..
|
||||
skel
|
||||
..
|
||||
ssh
|
||||
..
|
||||
ssl
|
||||
|
@ -664,6 +664,8 @@
|
||||
..
|
||||
file2c
|
||||
..
|
||||
find
|
||||
..
|
||||
fold
|
||||
..
|
||||
getconf
|
||||
|
@ -2291,6 +2291,7 @@ ipfix 4739/udp #IP Flow Info Export
|
||||
ipfixs 4740/sctp #ipfix protocol over DTLS
|
||||
ipfixs 4740/tcp #ipfix protocol over TLS
|
||||
ipfixs 4740/udp #ipfix protocol over DTLS
|
||||
vxlan 4789/udp #Virtual eXtensible Local Area Network (VXLAN)
|
||||
commplex-main 5000/tcp
|
||||
commplex-main 5000/udp
|
||||
commplex-link 5001/tcp
|
||||
|
@ -75,9 +75,9 @@ macro takes arguments
|
||||
.Fa x
|
||||
and
|
||||
.Fa y
|
||||
and returns non-zero if and only if neither
|
||||
and returns non-zero if and only if any of
|
||||
.Fa x
|
||||
nor
|
||||
or
|
||||
.Fa y
|
||||
are NaNs.
|
||||
For any pair of floating-point values, one
|
||||
|
@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
@ -275,7 +275,7 @@ locale_t newlocale(int mask, const char *locale, locale_t base)
|
||||
for (type=0 ; type<XLC_LAST ; type++) {
|
||||
if (mask & 1) {
|
||||
if (useenv) {
|
||||
realLocale = __get_locale_env(type);
|
||||
realLocale = __get_locale_env(type + 1);
|
||||
}
|
||||
new->components[type] =
|
||||
constructors[type](realLocale, new);
|
||||
|
@ -457,8 +457,8 @@ iruserok_sa(const void *ra, int rlen, int superuser, const char *ruser,
|
||||
first = 0;
|
||||
if ((pwd = getpwnam(luser)) == NULL)
|
||||
return (-1);
|
||||
(void)strcpy(pbuf, pwd->pw_dir);
|
||||
(void)strcat(pbuf, "/.rhosts");
|
||||
(void)strlcpy(pbuf, pwd->pw_dir, sizeof(pbuf));
|
||||
(void)strlcat(pbuf, "/.rhosts", sizeof(pbuf));
|
||||
|
||||
/*
|
||||
* Change effective uid while opening .rhosts. If root and
|
||||
|
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 29, 2017
|
||||
.Dd January 3, 2018
|
||||
.Dt LIBCASPER 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -190,6 +190,30 @@ obtained via the
|
||||
.Fn cap_init
|
||||
function.
|
||||
The function returns capability that provides access to opened service.
|
||||
Casper supports the following services in the base system:
|
||||
.Bl -tag -width "system.random" -compact -offset indent
|
||||
.Pp
|
||||
.It system.dns
|
||||
provides DNS libc compatible API
|
||||
.It system.grp
|
||||
provides
|
||||
.Xr getgrent 3
|
||||
compatible API
|
||||
.It system.pwd
|
||||
provides
|
||||
.Xr getpwent 3
|
||||
compatible API
|
||||
.It system.random
|
||||
allows to obtain entropy from
|
||||
.Pa /dev/random
|
||||
.It system.sysctl
|
||||
provides
|
||||
.Xr sysctlbyname 3
|
||||
compatible API
|
||||
.It system.syslog
|
||||
provides
|
||||
.Xr syslog 3
|
||||
compatible API
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn cap_clone ,
|
||||
|
@ -122,7 +122,15 @@ cap_wrap(int sock)
|
||||
#ifdef WITH_CASPER
|
||||
int cap_unwrap(cap_channel_t *chan);
|
||||
#else
|
||||
#define cap_unwrap(chan) (chan->cch_fd)
|
||||
static inline int
|
||||
cap_unwrap(cap_channel_t *chan)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = chan->cch_fd;
|
||||
free(chan);
|
||||
return (fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -7,6 +7,7 @@ TAP_TESTS_C= dns_test
|
||||
.if ${MK_CASPER} != "no"
|
||||
LIBADD+= casper
|
||||
LIBADD+= cap_dns
|
||||
CFLAGS+=-DWITH_CASPER
|
||||
.endif
|
||||
LIBADD+= nv
|
||||
|
||||
|
@ -7,6 +7,7 @@ TAP_TESTS_C= grp_test
|
||||
.if ${MK_CASPER} != "no"
|
||||
LIBADD+= casper
|
||||
LIBADD+= cap_grp
|
||||
CFLAGS+=-DWITH_CASPER
|
||||
.endif
|
||||
LIBADD+= nv
|
||||
|
||||
|
@ -7,6 +7,7 @@ TAP_TESTS_C= pwd_test
|
||||
.if ${MK_CASPER} != "no"
|
||||
LIBADD+= casper
|
||||
LIBADD+= cap_pwd
|
||||
CFLAGS+=-DWITH_CASPER
|
||||
.endif
|
||||
LIBADD+= nv
|
||||
|
||||
|
@ -7,6 +7,7 @@ TAP_TESTS_C= sysctl_test
|
||||
.if ${MK_CASPER} != "no"
|
||||
LIBADD+= casper
|
||||
LIBADD+= cap_sysctl
|
||||
CFLAGS+=-DWITH_CASPER
|
||||
.endif
|
||||
LIBADD+= nv
|
||||
|
||||
|
@ -527,12 +527,17 @@ find_geom_efimedia(struct gmesh *mesh, const char *dev)
|
||||
static int
|
||||
build_dp(const char *efimedia, const char *relpath, efidp *dp)
|
||||
{
|
||||
char *fp, *dptxt = NULL;
|
||||
char *fp, *dptxt = NULL, *cp, *rp;
|
||||
int rv = 0;
|
||||
efidp out = NULL;
|
||||
size_t len;
|
||||
|
||||
fp = path_to_file_dp(relpath);
|
||||
rp = strdup(relpath);
|
||||
for (cp = rp; *cp; cp++)
|
||||
if (*cp == '/')
|
||||
*cp = '\\';
|
||||
fp = path_to_file_dp(rp);
|
||||
free(rp);
|
||||
if (fp == NULL) {
|
||||
rv = ENOMEM;
|
||||
goto errout;
|
||||
@ -663,6 +668,7 @@ path_to_dp(struct gmesh *mesh, char *path, efidp *dp)
|
||||
free(rp);
|
||||
if (rv != 0) {
|
||||
free(*dp);
|
||||
*dp = NULL;
|
||||
}
|
||||
return (rv);
|
||||
}
|
||||
|
@ -136,9 +136,9 @@ corresponding ranges for the return values, adopted by the C language.
|
||||
.It Sy Function Ta Sy Branch Cut(s) Ta Sy Range
|
||||
.It cacos Ta (-\*(If, -1) \*(Un (1, \*(If) Ta [0, \*(Pi]
|
||||
.It casin Ta (-\*(If, -1) \*(Un (1, \*(If) Ta [-\*(Pi/2, \*(Pi/2]
|
||||
.It catan Ta (-\*(If*I, -i) \*(Un (I, \*(If*I) Ta [-\*(Pi/2, \*(Pi/2]
|
||||
.It catan Ta (-\*(If*I, -I) \*(Un (I, \*(If*I) Ta [-\*(Pi/2, \*(Pi/2]
|
||||
.It cacosh Ta (-\*(If, 1) Ta [-\*(Pi*I, \*(Pi*I]
|
||||
.It casinh Ta (-\*(If*I, -i) \*(Un (I, \*(If*I) Ta [-\*(Pi/2*I, \*(Pi/2*I]
|
||||
.It casinh Ta (-\*(If*I, -I) \*(Un (I, \*(If*I) Ta [-\*(Pi/2*I, \*(Pi/2*I]
|
||||
.It catanh Ta (-\*(If, -1) \*(Un (1, \*(If) Ta [-\*(Pi/2*I, \*(Pi/2*I]
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
|
@ -23,31 +23,9 @@
|
||||
# extra-bits-dir, if provided, contains additional files to be merged
|
||||
# into base-bits-dir as part of making the image.
|
||||
|
||||
|
||||
if [ "$1" = "-b" ]; then
|
||||
# Apple boot code
|
||||
uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu"
|
||||
bzip2 -d /tmp/hfs-boot-block.bz2
|
||||
OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ')
|
||||
OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}')
|
||||
dd if="$4/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc
|
||||
|
||||
bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot"
|
||||
|
||||
# pSeries/PAPR boot code
|
||||
mkdir -p "$4/ppc/chrp"
|
||||
cp "$4/boot/loader" "$4/ppc/chrp"
|
||||
cat > "$4/ppc/bootinfo.txt" << EOF
|
||||
<chrp-boot>
|
||||
<description>FreeBSD Install</description>
|
||||
<os-name>FreeBSD</os-name>
|
||||
<boot-script>boot &device;:,\ppc\chrp\loader</boot-script>
|
||||
</chrp-boot>
|
||||
EOF
|
||||
bootable="$bootable -o chrp-boot"
|
||||
|
||||
# Playstation 3 boot code
|
||||
echo "FreeBSD Install='/boot/loader.ps3'" > "$4/etc/kboot.conf"
|
||||
|
||||
bootable=1
|
||||
shift
|
||||
else
|
||||
bootable=""
|
||||
@ -61,6 +39,34 @@ fi
|
||||
LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
|
||||
NAME="$1"; shift
|
||||
|
||||
if [ -n "$bootable" ]; then
|
||||
echo "Building bootable disc"
|
||||
|
||||
# Apple boot code
|
||||
uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu"
|
||||
bzip2 -d /tmp/hfs-boot-block.bz2
|
||||
OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ')
|
||||
OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}')
|
||||
dd if="$1/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc
|
||||
|
||||
bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot"
|
||||
|
||||
# pSeries/PAPR boot code
|
||||
mkdir -p "$1/ppc/chrp"
|
||||
cp "$1/boot/loader" "$1/ppc/chrp"
|
||||
cat > "$1/ppc/bootinfo.txt" << EOF
|
||||
<chrp-boot>
|
||||
<description>FreeBSD Install</description>
|
||||
<os-name>FreeBSD</os-name>
|
||||
<boot-script>boot &device;:,\ppc\chrp\loader</boot-script>
|
||||
</chrp-boot>
|
||||
EOF
|
||||
bootable="$bootable -o chrp-boot"
|
||||
|
||||
# Petitboot config for PS3/PowerNV
|
||||
echo FreeBSD Install=\'/boot/kernel/kernel vfs.root.mountfrom=cd9660:/dev/iso9660/$LABEL\' > "$1/etc/kboot.conf"
|
||||
fi
|
||||
|
||||
publisher="The FreeBSD Project. https://www.FreeBSD.org/"
|
||||
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
|
||||
makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@"
|
||||
|
@ -1,5 +1,3 @@
|
||||
.\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@ -14,13 +12,6 @@
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
@ -34,6 +25,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 3, 2016
|
||||
|
@ -1,7 +1,5 @@
|
||||
/* $NetBSD: ccdconfig.c,v 1.6 1996/05/16 07:11:18 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-4-Clause
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2003 Poul-Henning Kamp
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -18,13 +16,6 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
@ -37,6 +28,8 @@
|
||||
* 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.
|
||||
*
|
||||
* NetBSD: ccdconfig.c,v 1.6 1996/05/16 07:11:18 thorpej Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
@ -1,5 +1,3 @@
|
||||
/* $NetBSD: pathnames.h,v 1.4 2008/04/28 20:23:07 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
|
||||
*
|
||||
@ -30,6 +28,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: pathnames.h,v 1.4 2008/04/28 20:23:07 martin Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
|
@ -236,25 +236,23 @@ DECL_CMD_FUNC(setvxlan_local, addr, d)
|
||||
switch (ai->ai_family) {
|
||||
#ifdef INET
|
||||
case AF_INET: {
|
||||
struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr;
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
||||
|
||||
if (IN_MULTICAST(ntohl(addr.s_addr)))
|
||||
if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
|
||||
errx(1, "local address cannot be multicast");
|
||||
|
||||
cmd.vxlcmd_sa.in4.sin_family = AF_INET;
|
||||
cmd.vxlcmd_sa.in4.sin_addr = addr;
|
||||
cmd.vxlcmd_sa.in4 = *sin;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6: {
|
||||
struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
|
||||
|
||||
if (IN6_IS_ADDR_MULTICAST(addr))
|
||||
if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
|
||||
errx(1, "local address cannot be multicast");
|
||||
|
||||
cmd.vxlcmd_sa.in6.sin6_family = AF_INET6;
|
||||
cmd.vxlcmd_sa.in6.sin6_addr = *addr;
|
||||
cmd.vxlcmd_sa.in6 = *sin6;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -267,10 +265,10 @@ DECL_CMD_FUNC(setvxlan_local, addr, d)
|
||||
if (!vxlan_exists(s)) {
|
||||
if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) {
|
||||
params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4;
|
||||
params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr;
|
||||
params.vxlp_local_sa.in4 = cmd.vxlcmd_sa.in4;
|
||||
} else {
|
||||
params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6;
|
||||
params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr;
|
||||
params.vxlp_local_sa.in6 = cmd.vxlcmd_sa.in6;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -298,25 +296,23 @@ DECL_CMD_FUNC(setvxlan_remote, addr, d)
|
||||
switch (ai->ai_family) {
|
||||
#ifdef INET
|
||||
case AF_INET: {
|
||||
struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr;
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
||||
|
||||
if (IN_MULTICAST(ntohl(addr.s_addr)))
|
||||
if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
|
||||
errx(1, "remote address cannot be multicast");
|
||||
|
||||
cmd.vxlcmd_sa.in4.sin_family = AF_INET;
|
||||
cmd.vxlcmd_sa.in4.sin_addr = addr;
|
||||
cmd.vxlcmd_sa.in4 = *sin;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6: {
|
||||
struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
|
||||
|
||||
if (IN6_IS_ADDR_MULTICAST(addr))
|
||||
if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
|
||||
errx(1, "remote address cannot be multicast");
|
||||
|
||||
cmd.vxlcmd_sa.in6.sin6_family = AF_INET6;
|
||||
cmd.vxlcmd_sa.in6.sin6_addr = *addr;
|
||||
cmd.vxlcmd_sa.in6 = *sin6;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -329,10 +325,10 @@ DECL_CMD_FUNC(setvxlan_remote, addr, d)
|
||||
if (!vxlan_exists(s)) {
|
||||
if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) {
|
||||
params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4;
|
||||
params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr;
|
||||
params.vxlp_remote_sa.in4 = cmd.vxlcmd_sa.in4;
|
||||
} else {
|
||||
params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6;
|
||||
params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr;
|
||||
params.vxlp_remote_sa.in6 = cmd.vxlcmd_sa.in6;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -360,25 +356,23 @@ DECL_CMD_FUNC(setvxlan_group, addr, d)
|
||||
switch (ai->ai_family) {
|
||||
#ifdef INET
|
||||
case AF_INET: {
|
||||
struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr;
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
||||
|
||||
if (!IN_MULTICAST(ntohl(addr.s_addr)))
|
||||
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
|
||||
errx(1, "group address must be multicast");
|
||||
|
||||
cmd.vxlcmd_sa.in4.sin_family = AF_INET;
|
||||
cmd.vxlcmd_sa.in4.sin_addr = addr;
|
||||
cmd.vxlcmd_sa.in4 = *sin;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6: {
|
||||
struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
|
||||
|
||||
if (!IN6_IS_ADDR_MULTICAST(addr))
|
||||
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
|
||||
errx(1, "group address must be multicast");
|
||||
|
||||
cmd.vxlcmd_sa.in6.sin6_family = AF_INET6;
|
||||
cmd.vxlcmd_sa.in6.sin6_addr = *addr;
|
||||
cmd.vxlcmd_sa.in6 = *sin6;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -391,10 +385,10 @@ DECL_CMD_FUNC(setvxlan_group, addr, d)
|
||||
if (!vxlan_exists(s)) {
|
||||
if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) {
|
||||
params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4;
|
||||
params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr;
|
||||
params.vxlp_remote_sa.in4 = cmd.vxlcmd_sa.in4;
|
||||
} else {
|
||||
params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6;
|
||||
params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr;
|
||||
params.vxlp_remote_sa.in6 = cmd.vxlcmd_sa.in6;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -717,8 +717,10 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
|
||||
rv = 0;
|
||||
done:
|
||||
free(img);
|
||||
close(fd);
|
||||
close(fd1);
|
||||
if (fd != -1)
|
||||
close(fd);
|
||||
if (fd1 != -1)
|
||||
close(fd1);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 23, 2017
|
||||
.Dd January 1, 2018
|
||||
.Dt SHUTDOWN 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -138,6 +138,14 @@ suffix:
|
||||
.Dq Li min .
|
||||
.Dq Li h ,
|
||||
.Dq Li hour .
|
||||
.Pp
|
||||
If an absolute time is specified, but not a date,
|
||||
and that time today has already passed,
|
||||
.Nm
|
||||
will assume that the same time tomorrow was meant.
|
||||
(If a complete date is specified which has already passed,
|
||||
.Nm
|
||||
will print an error and exit without shutting the system down.)
|
||||
.It Ar warning-message
|
||||
Any other arguments comprise the warning message that is broadcast
|
||||
to users currently logged into the system.
|
||||
|
@ -431,7 +431,7 @@ getoffset(char *timearg)
|
||||
struct tm *lt;
|
||||
char *p;
|
||||
time_t now;
|
||||
int this_year;
|
||||
int maybe_today, this_year;
|
||||
char *timeunit;
|
||||
|
||||
(void)time(&now);
|
||||
@ -482,6 +482,7 @@ getoffset(char *timearg)
|
||||
|
||||
unsetenv("TZ"); /* OUR timezone */
|
||||
lt = localtime(&now); /* current time val */
|
||||
maybe_today = 1;
|
||||
|
||||
switch(strlen(timearg)) {
|
||||
case 10:
|
||||
@ -503,6 +504,7 @@ getoffset(char *timearg)
|
||||
badtime();
|
||||
/* FALLTHROUGH */
|
||||
case 6:
|
||||
maybe_today = 0;
|
||||
lt->tm_mday = ATOI2(timearg);
|
||||
if (lt->tm_mday < 1 || lt->tm_mday > 31)
|
||||
badtime();
|
||||
@ -517,8 +519,23 @@ getoffset(char *timearg)
|
||||
lt->tm_sec = 0;
|
||||
if ((shuttime = mktime(lt)) == -1)
|
||||
badtime();
|
||||
if ((offset = shuttime - now) < 0)
|
||||
errx(1, "that time is already past.");
|
||||
|
||||
if ((offset = shuttime - now) < 0) {
|
||||
if (!maybe_today)
|
||||
errx(1, "that time is already past.");
|
||||
|
||||
/*
|
||||
* If the user only gave a time, assume that
|
||||
* any time earlier than the current time
|
||||
* was intended to be that time tomorrow.
|
||||
*/
|
||||
lt->tm_mday++;
|
||||
if ((shuttime = mktime(lt)) == -1)
|
||||
badtime();
|
||||
if ((offset = shuttime - now) < 0) {
|
||||
errx(1, "tomorrow is before today?");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
badtime();
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "msg.h" /* need this too: msg.h will be generated by rpcgen */
|
||||
|
||||
/*
|
||||
* Remote verson of "printmessage"
|
||||
* Remote version of "printmessage"
|
||||
*/
|
||||
int *
|
||||
printmessage_1(msg)
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)assert.3 8.1 (Berkeley) 6/9/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 26, 1999
|
||||
.Dd January 1, 2018
|
||||
.Dt ASSERT 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -68,6 +68,14 @@ as a macro
|
||||
.Xr cc 1
|
||||
option
|
||||
.Fl D Ns Dv NDEBUG ) .
|
||||
Unlike most other include files,
|
||||
.In assert.h
|
||||
may be included multiple times.
|
||||
Each time whether or not
|
||||
.Dv NDEBUG
|
||||
is defined determines the behavior of assert from that point forward
|
||||
until the end of the unit or another include of
|
||||
.In assert.h .
|
||||
.Sh EXAMPLES
|
||||
The assertion:
|
||||
.Pp
|
||||
@ -87,4 +95,4 @@ macro conforms to
|
||||
An
|
||||
.Nm
|
||||
macro appeared in
|
||||
.At v6 .
|
||||
.At v7 .
|
||||
|
@ -73,6 +73,7 @@ MAN= aac.4 \
|
||||
${_aw_gpio.4} \
|
||||
${_aw_mmc.4} \
|
||||
${_aw_rtc.4} \
|
||||
${_aw_sid.4} \
|
||||
axe.4 \
|
||||
axge.4 \
|
||||
bce.4 \
|
||||
@ -763,6 +764,7 @@ _armv8crypto.4= armv8crypto.4
|
||||
_aw_gpio.4= aw_gpio.4
|
||||
_aw_mmc.4= aw_mmc.4
|
||||
_aw_rtc.4= aw_rtc.4
|
||||
_aw_sid.4= aw_sid.4
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
||||
|
74
share/man/man4/aw_sid.4
Normal file
74
share/man/man4/aw_sid.4
Normal file
@ -0,0 +1,74 @@
|
||||
.\"-
|
||||
.\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 2, 2018
|
||||
.Dt AW_SID 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm aw_sid
|
||||
.Nd driver for the SID controller in Allwinner SoC
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
device driver provides support for the Allwinner SID (Security ID) controller.
|
||||
This controller provides root security keys that may be used as either a device
|
||||
unique ID or to generate a MAC address.
|
||||
.Sh HARDWARE
|
||||
The
|
||||
.Nm
|
||||
driver supports the SID controller with one of the following compatible
|
||||
strings:
|
||||
.Pp
|
||||
.Bl -bullet -compact
|
||||
.It
|
||||
allwinner,sun4i-a10-sid
|
||||
.It
|
||||
allwinner,sun7i-a20-sid
|
||||
.It
|
||||
allwinner,sun50i-a64-sid
|
||||
.It
|
||||
allwinner,sun8i-a83t-sid
|
||||
.El
|
||||
.Sh SYSCTL VARIABLES
|
||||
The following read-only variables are available via
|
||||
.Xr sysctl 8 :
|
||||
.Bl -tag -width indent
|
||||
.It Va dev.aw_sid.rootkey
|
||||
Root security key for this device.
|
||||
.El
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
device driver first appeared in
|
||||
.Fx 11.0 .
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
device driver was written by
|
||||
.An Jared McNeill Aq Mt jmcneill@invisible.ca .
|
||||
This manual page was written by
|
||||
.An Kyle Evans Aq Mt kevans@FreeBSD.org .
|
@ -243,6 +243,13 @@ Permitted interrupt types.
|
||||
Bit 0 represents INTx (line interrupts), bit 1 MSI, and bit 2 MSI-X.
|
||||
The default is 7 (all allowed).
|
||||
The driver selects the best possible type out of the allowed types.
|
||||
.It Va hw.cxgbe.pcie_relaxed_ordering
|
||||
PCIe Relaxed Ordering.
|
||||
-1 indicates the driver should determine whether to enable or disable PCIe RO.
|
||||
0 disables PCIe RO.
|
||||
1 enables PCIe RO.
|
||||
2 indicates the driver should not modify the PCIe RO setting.
|
||||
The default is -1.
|
||||
.It Va hw.cxgbe.fw_install
|
||||
0 prohibits the driver from installing a firmware on the card.
|
||||
1 allows the driver to install a new firmware if internal driver
|
||||
|
@ -116,19 +116,19 @@ The default value is 32, which is sufficient to map 128 MiB.
|
||||
.It Cd options VM_KMEM_SIZE_SCALE=<num>
|
||||
This configures the amount of kernel virtual address (KVA) space to
|
||||
dedicate to the kmem_arena map.
|
||||
The value is the ratio of physical to virtual pages.
|
||||
The scale value is the ratio of physical to virtual pages.
|
||||
The default value of 3 allocates a page of KVA for each 3 pages
|
||||
of physical ram in the system.
|
||||
|
||||
The kernel and modules, including the root image, also consume KVA.
|
||||
The combination of a large root image and the default scaling
|
||||
may preallocate so much KVA to kmem_arena that there is not enough
|
||||
may preallocate so much KVA that there is not enough
|
||||
remaining address space to allocate kernel stacks, IO buffers,
|
||||
and other resources that are not part of kmem_arena.
|
||||
Overallocating kmem_arena space is likely to manifest as failure to
|
||||
launch userland processes with "cannot allocate kernel stack" messages.
|
||||
|
||||
Setting the value too high may result in kernel failure to allocate
|
||||
Setting the scale value too high may result in kernel failure to allocate
|
||||
memory because kmem_arena is too small, and the failure may require
|
||||
significant runtime to manifest.
|
||||
Empirically, a value of 5 works well for a 200 MiB root image on
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 19, 2016
|
||||
.Dd December 28, 2017
|
||||
.Dt "VT" 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -45,6 +45,7 @@ In
|
||||
.Xr loader.conf 5 :
|
||||
.Cd hw.vga.textmode=1
|
||||
.Cd kern.vty=vt
|
||||
.Cd kern.vt.color.<colornum>.rgb="<colorspec>"
|
||||
.Cd kern.vt.fb.default_mode="<X>x<Y>"
|
||||
.Cd kern.vt.fb.modes.<connector>="<X>x<Y>"
|
||||
.Pp
|
||||
@ -206,6 +207,16 @@ The
|
||||
kernel uses
|
||||
.Nm
|
||||
when this value is not set.
|
||||
.It Va kern.vt.color. Ns Ar colornum Ns Va .rgb
|
||||
Set this value to override default palette entry for color
|
||||
.Pa colornum
|
||||
which should be in a range from 0 to 15 inclusive.
|
||||
The value should be either a comma-separated triplet of
|
||||
red, green, and blue values in a range from 0 to 255 or
|
||||
HTML-like hex triplet.
|
||||
See
|
||||
.Sx EXAMPLES
|
||||
below.
|
||||
.It Va kern.vt.fb.default_mode
|
||||
Set this value to a graphic mode to override the default mode picked by the
|
||||
.Nm
|
||||
@ -310,6 +321,11 @@ The connector name was found in
|
||||
.Dl info: [drm] Connector LVDS-1: get mode from tunables:
|
||||
.Dl info: [drm] - kern.vt.fb.modes.LVDS-1
|
||||
.Dl info: [drm] - kern.vt.fb.default_mode
|
||||
.Pp
|
||||
To set black and white colors of console palette
|
||||
.Pp
|
||||
.Dl kern.vt.color.0.rgb="10,10,10"
|
||||
.Dl kern.vt.color.15.rgb="#f0f0f0"
|
||||
.Sh SEE ALSO
|
||||
.Xr kbdcontrol 1 ,
|
||||
.Xr login 1 ,
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 16, 2014
|
||||
.Dd December 31, 2017
|
||||
.Dt VXLAN 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -214,10 +214,21 @@ Once created, the
|
||||
.Nm
|
||||
interface can be configured with
|
||||
.Xr ifconfig 8 .
|
||||
.Ed
|
||||
.Pp
|
||||
The following when placed in the file
|
||||
.Pa /etc/rc.conf
|
||||
will cause a vxlan interface called
|
||||
.Dq Li vxlan0
|
||||
to be created, and will configure the interface in unicast mode.
|
||||
.Bd -literal -offset indent
|
||||
cloned_interfaces="vxlan0"
|
||||
create_args_vxlan0="vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 192.168.100.2"
|
||||
.Sh SEE ALSO
|
||||
.Xr inet 4 ,
|
||||
.Xr inet6 4 ,
|
||||
.Xr vlan 4 ,
|
||||
.Xr rc.conf 5 ,
|
||||
.Xr ifconfig 8 ,
|
||||
.Xr sysctl 8
|
||||
.Rs
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 21, 2009
|
||||
.Dd January 2, 2018
|
||||
.Dt WATCHDOG 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -40,8 +40,11 @@ facility is used for controlling hardware and software watchdogs.
|
||||
.Pp
|
||||
The device
|
||||
.Pa /dev/fido
|
||||
responds to a single
|
||||
supports several optional
|
||||
.Xr ioctl 2
|
||||
calls for configuration, and
|
||||
responds to a single operational
|
||||
.Xr ioctl
|
||||
call,
|
||||
.Dv WDIOCPATPAT .
|
||||
It takes a single argument which represents a timeout value specified as a
|
||||
@ -60,12 +63,16 @@ indicates that the
|
||||
will be kept from timing out from the kernel.
|
||||
.Pp
|
||||
The
|
||||
.Dv WDIOCPATPAT
|
||||
.Xr ioctl 2
|
||||
call will return success if just one of the available
|
||||
.Xr watchdog 9
|
||||
implementations supports setting the timeout to the specified timeout.
|
||||
This
|
||||
means that at least one watchdog is armed.
|
||||
By default, this will be a hardware watchdog if one is present, but if
|
||||
no hardware watchdog is able to process the request, a default software
|
||||
watchdog is enabled.
|
||||
If the call fails, for instance if
|
||||
none of
|
||||
.Xr watchdog 9
|
||||
@ -77,8 +84,53 @@ To disable the watchdogs pass
|
||||
If disarming the watchdog(s) failed an error is returned.
|
||||
The watchdog might
|
||||
still be armed!
|
||||
.Pp
|
||||
The optional configuration
|
||||
.Xr ioctl
|
||||
commands are listed here, along with the type of the parameter used.
|
||||
Examples of their use can be found in
|
||||
.Xr watchdogd 8 .
|
||||
.Bl -tag -width "WDIOC_SETSOFTTIMEOUTACT int "
|
||||
.It Dv WDIOC_SETTIMEOUT Fa int
|
||||
set/reset the timer
|
||||
.It Dv WDIOC_GETTIMEOUT Fa int
|
||||
get total timeout
|
||||
.It Dv WDIOC_GETTIMELEFT Fa int
|
||||
get time left
|
||||
.It Dv WDIOC_GETPRETIMEOUT Fa int
|
||||
get the pre-timeout
|
||||
.It Dv WDIOC_SETPRETIMEOUT Fa int
|
||||
set the pre-timeout
|
||||
.It Dv WDIOC_SETPRETIMEOUTACT Fa int
|
||||
Set the action when a pre-timeout occurs (see
|
||||
.Li WD_SOFT_*
|
||||
below).
|
||||
.It Dv WDIOC_SETSOFT Fa int
|
||||
Use an internal software watchdog instead of hardware.
|
||||
There is also an external software watchdog, which is used by default
|
||||
if no hardware watchdog was attached.
|
||||
.It Dv WDIOC_SETSOFTTIMEOUTACT Fa int
|
||||
Set the action whan a soft timeout occurs.
|
||||
.El
|
||||
.Pp
|
||||
The actions that may be specified for the pre-timeout or the internal software
|
||||
watchdog are listed here.
|
||||
Multiple actions can be specified by ORing values together.
|
||||
.Bl -tag -width WD_SOFT_PRINT
|
||||
.It Dv WD_SOFT_PANIC
|
||||
panic
|
||||
.It Dv WD_SOFT_DDB
|
||||
enter debugger
|
||||
.It Dv WD_SOFT_LOG
|
||||
log(9)
|
||||
.It Dv WD_SOFT_PRINT
|
||||
printf(9)
|
||||
.El
|
||||
.Sh RETURN VALUES
|
||||
The ioctl returns zero on success and non-zero on failure.
|
||||
The
|
||||
.Dv WDIOCPATPAT
|
||||
.Xr ioctl
|
||||
returns zero on success and non-zero on failure.
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EOPNOTSUPP
|
||||
No watchdog present in the kernel or
|
||||
@ -89,6 +141,10 @@ Watchdog could not be disabled (timeout value of 0).
|
||||
.It Bq Er EINVAL
|
||||
Invalid flag combination passed.
|
||||
.El
|
||||
.Pp
|
||||
The configuration
|
||||
.Xr ioctl
|
||||
operations return zero on success and non-zero on failure.
|
||||
.Sh EXAMPLES
|
||||
.Bd -literal -offset indent
|
||||
#include <paths.h>
|
||||
@ -122,8 +178,10 @@ Enables a watchdog to recover from a potentially freezing piece of code.
|
||||
.Pp
|
||||
.Dl "options SW_WATCHDOG"
|
||||
.Pp
|
||||
in your kernel config adds a software watchdog in the kernel, dropping to KDB
|
||||
or panic-ing when firing.
|
||||
in your kernel config forces a software watchdog in the kernel
|
||||
to be configured even if a hardware watchdog is configured,
|
||||
dropping to KDB or panicking when firing, depending
|
||||
on the KDB and KDB_UNATTENDED kernel configuration options.
|
||||
.Sh SEE ALSO
|
||||
.Xr watchdogd 8 ,
|
||||
.Xr watchdog 9
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 3, 2017
|
||||
.Dd December 24, 2017
|
||||
.Dt BUILD 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -509,6 +509,15 @@ If set, this variable supplies a list of additional directories relative to
|
||||
the root of the source tree to build as part of the
|
||||
.Cm everything
|
||||
target.
|
||||
The directories are built in parallel with each other,
|
||||
and with the base system directories.
|
||||
Insert a
|
||||
.Va .WAIT
|
||||
directive at the beginning of the
|
||||
.Va LOCAL_DIRS
|
||||
list to ensure all base system directories are built first.
|
||||
.Va .WAIT
|
||||
may also be used as needed elsewhere within the list.
|
||||
.It Va LOCAL_ITOOLS
|
||||
If set, this variable supplies a list of additional tools that are used by the
|
||||
.Cm installworld
|
||||
@ -520,6 +529,15 @@ If set, this variable supplies a list of additional directories relative to
|
||||
the root of the source tree to build as part of the
|
||||
.Cm libraries
|
||||
target.
|
||||
The directories are built in parallel with each other,
|
||||
and with the base system libraries.
|
||||
Insert a
|
||||
.Va .WAIT
|
||||
directive at the beginning of the
|
||||
.Va LOCAL_DIRS
|
||||
list to ensure all base system libraries are built first.
|
||||
.Va .WAIT
|
||||
may also be used as needed elsewhere within the list.
|
||||
.It Va LOCAL_MTREE
|
||||
If set, this variable supplies a list of additional mtrees relative to the
|
||||
root of the source tree to use as part of the
|
||||
|
@ -1,4 +1,6 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
|
||||
.\" Copyright (c) 2004 Darron Broad <darron@kewl.org>
|
||||
.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@ -25,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 28, 2010
|
||||
.Dd December 31, 2017
|
||||
.Dt IEEE80211 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -34,9 +36,31 @@
|
||||
.Sh SYNOPSIS
|
||||
.In net80211/ieee80211_var.h
|
||||
.Ft void
|
||||
.Fn ieee80211_ifattach "struct ieee80211com *ic" "const uint8_t macaddr[IEEE80211_ADDR_LEN]"
|
||||
.Fn ieee80211_ifattach "struct ieee80211com *ic"
|
||||
.Ft void
|
||||
.Fn ieee80211_ifdetach "struct ieee80211com *ic"
|
||||
.Ft int
|
||||
.Fn ieee80211_mhz2ieee "u_int freq" "u_int flags"
|
||||
.Ft int
|
||||
.Fn ieee80211_chan2ieee "struct ieee80211com *ic" "const struct ieee80211_channel *c"
|
||||
.Ft u_int
|
||||
.Fn ieee80211_ieee2mhz "u_int chan" "u_int flags"
|
||||
.Ft int
|
||||
.Fn ieee80211_media_change "struct ifnet *ifp"
|
||||
.Ft void
|
||||
.Fn ieee80211_media_status "struct ifnet *ifp" "struct ifmediareq *imr"
|
||||
.Ft int
|
||||
.Fn ieee80211_setmode "struct ieee80211com *ic" "enum ieee80211_phymode mode"
|
||||
.Ft enum ieee80211_phymode
|
||||
.Fo ieee80211_chan2mode
|
||||
.Fa "const struct ieee80211_channel *chan"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo ieee80211_rate2media
|
||||
.Fa "struct ieee80211com *ic" "int rate" "enum ieee80211_phymode mode"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fn ieee80211_media2rate "int mword"
|
||||
.Sh DESCRIPTION
|
||||
IEEE 802.11 device drivers are written to use the infrastructure provided
|
||||
by the
|
||||
@ -89,6 +113,112 @@ The virtual radio interface defined by the
|
||||
layer means that drivers must be structured to follow specific rules.
|
||||
Drivers that support only a single interface at any time must still
|
||||
follow these rules.
|
||||
.Pp
|
||||
Most of these functions require that attachment to the stack is performed
|
||||
before calling.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_ifattach
|
||||
function attaches the wireless network interface
|
||||
.Fa ic
|
||||
to the 802.11 network stack layer.
|
||||
This function must be called before using any of the
|
||||
.Nm
|
||||
functions which need to store driver state across invocations.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_ifdetach
|
||||
function frees any
|
||||
.Nm
|
||||
structures associated with the driver, and performs Ethernet and BPF
|
||||
detachment on behalf of the caller.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_mhz2ieee
|
||||
utility function converts the frequency
|
||||
.Fa freq
|
||||
(specified in MHz) to an IEEE 802.11 channel number.
|
||||
The
|
||||
.Fa flags
|
||||
argument is a hint which specifies whether the frequency is in
|
||||
the 2GHz ISM band
|
||||
.Pq Vt IEEE80211_CHAN_2GHZ
|
||||
or the 5GHz band
|
||||
.Pq Vt IEEE80211_CHAN_5GHZ ;
|
||||
appropriate clipping of the result is then performed.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_chan2ieee
|
||||
function converts the channel specified in
|
||||
.Fa *c
|
||||
to an IEEE channel number for the driver
|
||||
.Fa ic .
|
||||
If the conversion would be invalid, an error message is printed to the
|
||||
system console.
|
||||
This function REQUIRES that the driver is hooked up to the
|
||||
.Nm
|
||||
subsystem.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_ieee2mhz
|
||||
utility function converts the IEEE channel number
|
||||
.Ft chan
|
||||
to a frequency (in MHz).
|
||||
The
|
||||
.Fa flags
|
||||
argument is a hint which specifies whether the frequency is in
|
||||
the 2GHz ISM band
|
||||
.Pq Vt IEEE80211_CHAN_2GHZ
|
||||
or the 5GHz band
|
||||
.Pq Vt IEEE80211_CHAN_5GHZ ;
|
||||
appropriate clipping of the result is then performed.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_media_status
|
||||
and
|
||||
.Fn ieee80211_media_change
|
||||
functions are device-independent handlers for
|
||||
.Vt ifmedia
|
||||
commands and are not intended to be called directly.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_setmode
|
||||
function is called from within the 802.11 stack to change the mode
|
||||
of the driver's PHY; it is not intended to be called directly.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_chan2mode
|
||||
function returns the PHY mode required for use with the channel
|
||||
.Fa chan .
|
||||
This is typically used when selecting a rate set, to be advertised in
|
||||
beacons, for example.
|
||||
.Pp
|
||||
.\"
|
||||
The
|
||||
.Fn ieee80211_rate2media
|
||||
function converts the bit rate
|
||||
.Fa rate
|
||||
(measured in units of 0.5Mbps) to an
|
||||
.Vt ifmedia
|
||||
sub-type, for the device
|
||||
.Fa ic
|
||||
running in PHY mode
|
||||
.Fa mode .
|
||||
The
|
||||
.Fn ieee80211_media2rate
|
||||
performs the reverse of this conversion, returning the bit rate (in 0.5Mbps
|
||||
units) corresponding to an
|
||||
.Vt ifmedia
|
||||
sub-type.
|
||||
.
|
||||
.Sh DATA STRUCTURES
|
||||
The virtual radio architecture splits state between a single per-device
|
||||
.Vt ieee80211com
|
||||
@ -566,3 +696,23 @@ Device supports Reduced Inter Frame Spacing (RIFS).
|
||||
.Xr ieee80211_vap 9 ,
|
||||
.Xr ifnet 9 ,
|
||||
.Xr malloc 9
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
series of functions first appeared in
|
||||
.Nx 1.5 ,
|
||||
and were later ported to
|
||||
.Fx 4.6 .
|
||||
This man page was updated with the information from
|
||||
.Nx
|
||||
.Nm
|
||||
man page.
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The original
|
||||
.Nx
|
||||
.Nm
|
||||
man page was written by
|
||||
.An Bruce M. Simpson Aq Mt bms@FreeBSD.org
|
||||
and
|
||||
.An Darron Broad Aq Mt darron@kewl.org .
|
||||
|
@ -355,28 +355,22 @@ FreeBSD 5.2 | | | |
|
||||
| 11.0 | 10.12 | | NetBSD 7.0.2 | |
|
||||
| | | | | | | |
|
||||
| | | | | *- NetBSD 7.1 | |
|
||||
| | | macOS | | DragonFly 4.8.0
|
||||
| | | 10.13 | OpenBSD 6.1 |
|
||||
| FreeBSD | | | | DragonFly 5.0.0
|
||||
| 11.1 FreeBSD | | | |
|
||||
| | 10.4 | | OpenBSD 6.2 DragonFly 5.0.1
|
||||
| | | v | | |
|
||||
| | | | | DragonFly 5.0.2
|
||||
| | | | | |
|
||||
| | FreeBSD | | |
|
||||
| | 10-stable | | |
|
||||
| FreeBSD \ | | |
|
||||
| 11-stable \ | | |
|
||||
| / `| | | |
|
||||
| HardenedBSD | | | |
|
||||
| 11-stable HardenedBSD | | |
|
||||
| 10-stable | | |
|
||||
| | | |
|
||||
| | | |
|
||||
| | | |
|
||||
FreeBSD 12 -current NetBSD -current OpenBSD -current DragonFly -current
|
||||
| | | |
|
||||
v v v v
|
||||
| | | | | | | |
|
||||
| | | | | | | |
|
||||
| | | macOS | | | DragonFly 4.8.0
|
||||
| | | 10.13 | | OpenBSD 6.1 |
|
||||
| FreeBSD | | | | | DragonFly 5.0.0
|
||||
| 11.1 FreeBSD | | | | |
|
||||
| | 10.4 | | | OpenBSD 6.2 DragonFly 5.0.1
|
||||
| | | | | | |
|
||||
| | | | NetBSD 7.1.1 | DragonFly 5.0.2
|
||||
| | | | | | |
|
||||
| | | | v | |
|
||||
| v | | | |
|
||||
| | | | |
|
||||
FreeBSD 12 -current | NetBSD -current OpenBSD -current DragonFly -current
|
||||
| | | | |
|
||||
v v v v v
|
||||
|
||||
Time
|
||||
----------------
|
||||
@ -698,15 +692,15 @@ NetBSD 6.0.4 2014-01-25 [NBD]
|
||||
NetBSD 6.1.3 2014-01-25 [NBD]
|
||||
DragonFly 3.6.1 2014-02-22 [DFB]
|
||||
DragonFly 3.6.2 2014-04-10 [DFB]
|
||||
NetBSD 6.0.5 2014-04-12 [NDB]
|
||||
NetBSD 6.1.4 2014-04-12 [NDB]
|
||||
NetBSD 6.0.5 2014-04-12 [NBD]
|
||||
NetBSD 6.1.4 2014-04-12 [NBD]
|
||||
OpenBSD 5.5 2014-05-01 [OBD]
|
||||
DragonFly 3.8.0 2014-06-04 [DFB]
|
||||
DragonFly 3.8.1 2014-06-16 [DFB]
|
||||
DragonFly 3.6.3 2014-06-17 [DFB]
|
||||
FreeBSD 9.3 2014-07-05 [FBD]
|
||||
DragonFly 3.8.2 2014-08-08 [DFB]
|
||||
NetBSD 6.0.6 2014-09-22 [NDB]
|
||||
NetBSD 6.0.6 2014-09-22 [NBD]
|
||||
NetBSD 6.1.5 2014-09-22 [NBD]
|
||||
Mac OS X 10.10 2014-10-16 [APL]
|
||||
OpenBSD 5.6 2014-11-01 [OBD]
|
||||
@ -729,8 +723,8 @@ NetBSD 7.0.1 2016-05-22 [NBD]
|
||||
DragonFly 4.6.0 2016-08-02 [DFB]
|
||||
OpenBSD 6.0 2016-09-01 [OBD]
|
||||
macOS 10.12 2016-09-20 [APL]
|
||||
NetBSD 7.0.2 2016-10-21 [NBD]
|
||||
FreeBSD 11.0 2016-10-10 [FBD]
|
||||
NetBSD 7.0.2 2016-10-21 [NBD]
|
||||
NetBSD 7.1 2017-03-11 [NBD]
|
||||
DragonFly 4.8.0 2017-03-27 [DFB]
|
||||
OpenBSD 6.1 2017-04-11 [OBD]
|
||||
@ -741,6 +735,7 @@ OpenBSD 6.2 2017-10-09 [OBD]
|
||||
DragonFly 5.0.0 2017-10-16 [DFB]
|
||||
DragonFly 5.0.1 2017-11-06 [DFB]
|
||||
DragonFly 5.0.2 2017-12-04 [DFB]
|
||||
NetBSD 7.1.1 2017-12-22 [NBD]
|
||||
|
||||
Bibliography
|
||||
------------------------
|
||||
|
@ -127,6 +127,7 @@ cu chu chu Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Chur
|
||||
cv chv chv Chuvash
|
||||
chy chy Cheyenne
|
||||
cmc cmc Chamic languages
|
||||
cnr cnr Montenegrin
|
||||
cop cop Coptic
|
||||
kw cor cor Cornish
|
||||
co cos cos Corsican
|
||||
|
@ -34,7 +34,7 @@ portmgr [label="Port Management Team\nportmgr@FreeBSD.org\nadamw, antoine, bapt,
|
||||
portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nrene"]
|
||||
re [label="Primary Release Engineering Team\nre@FreeBSD.org\ngjb, kib,\nbdrewery, blackend,\nrgrimes, delphij,\nhrs, glebius,\nmarius, rwatson"]
|
||||
secteam [label="Security Team\nsecteam@FreeBSD.org\ndelphij,\ndes, gavin, gjb,\nglebius, remko"]
|
||||
portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, amdmi3, eadler, feld, jgh, junovitch, rea, sbz, simon, swills, zi"]
|
||||
portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, amdmi3, eadler, feld, jgh, rea, sbz, simon, swills, zi"]
|
||||
secteamsecretary [label="Security Team Secretary\nsecteam-secretary@FreeBSD.org\nremko"]
|
||||
securityofficer [label="Security Officer Team\nsecurity-officer@FreeBSD.org\ndelphij, des,\ngavin, gjb,\nglebius, remko"]
|
||||
srccommitters [label="Src Committers\nsrc-committers@FreeBSD.org"]
|
||||
|
@ -21,7 +21,7 @@
|
||||
# some useful aliases
|
||||
alias h='fc -l'
|
||||
alias j=jobs
|
||||
alias m=$PAGER
|
||||
alias m="$PAGER"
|
||||
alias ll='ls -laFo'
|
||||
alias l='ls -l'
|
||||
alias g='egrep -i'
|
||||
|
@ -58,6 +58,13 @@ LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a
|
||||
.endif # MK_LOADER_GELI
|
||||
.endif # HAVE_GELI
|
||||
|
||||
# These should be confined to loader.mk, but can't because uboot/lib
|
||||
# also uses it. It's part of loader, but isn't a loader so we can't
|
||||
# just include loader.mk
|
||||
.if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
|
||||
CFLAGS+= -DLOADER_DISK_SUPPORT
|
||||
.endif
|
||||
|
||||
# Machine specific flags for all builds here
|
||||
|
||||
# All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc
|
||||
|
@ -44,19 +44,27 @@ int
|
||||
fdt_platform_load_dtb(void)
|
||||
{
|
||||
struct fdt_header *hdr;
|
||||
const char *s;
|
||||
|
||||
hdr = efi_get_table(&fdtdtb);
|
||||
if (hdr != NULL) {
|
||||
if (fdt_load_dtb_addr(hdr) == 0) {
|
||||
printf("Using DTB provided by EFI at %p.\n", hdr);
|
||||
return (0);
|
||||
}
|
||||
if (hdr == NULL)
|
||||
return (1);
|
||||
if (fdt_load_dtb_addr(hdr) != 0)
|
||||
return (1);
|
||||
printf("Using DTB provided by EFI at %p.\n", hdr);
|
||||
|
||||
s = getenv("fdt_overlays");
|
||||
if (s != NULL && *s != '\0') {
|
||||
printf("Loading DTB overlays: '%s'\n", s);
|
||||
fdt_load_dtb_overlays(s);
|
||||
}
|
||||
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
fdt_platform_fixups(void)
|
||||
{
|
||||
|
||||
fdt_apply_overlays();
|
||||
}
|
||||
|
@ -31,8 +31,8 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
#include <fdt.h>
|
||||
#include <libfdt.h>
|
||||
#include <fdt.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/linker.h>
|
||||
#include <machine/elf.h>
|
||||
@ -386,7 +386,8 @@ fdt_apply_overlays()
|
||||
for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) {
|
||||
printf("applying DTB overlay '%s'\n", fp->f_name);
|
||||
COPYOUT(fp->f_addr, overlay, fp->f_size);
|
||||
fdt_overlay_apply(new_fdtp, overlay, fp->f_size);
|
||||
/* Both overlay and new_fdtp may be modified in place */
|
||||
fdt_overlay_apply(new_fdtp, overlay);
|
||||
}
|
||||
|
||||
free(fdtp);
|
||||
|
@ -409,41 +409,23 @@ fdt_overlay_apply_fragments(void *main_fdtp, void *overlay_fdtp)
|
||||
}
|
||||
|
||||
int
|
||||
fdt_overlay_apply(void *main_fdtp, void *overlay_fdtp, size_t overlay_length)
|
||||
fdt_overlay_apply(void *main_fdtp, void *overlay_fdtp)
|
||||
{
|
||||
void *overlay_copy;
|
||||
int rv;
|
||||
|
||||
rv = 0;
|
||||
|
||||
/* We modify overlay in-place, so we need writable copy */
|
||||
overlay_copy = malloc(overlay_length);
|
||||
if (overlay_copy == NULL) {
|
||||
printf("failed to allocate memory for overlay copy\n");
|
||||
if (fdt_overlay_do_fixups(main_fdtp, overlay_fdtp) < 0) {
|
||||
printf("failed to perform fixups in overlay\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
memcpy(overlay_copy, overlay_fdtp, overlay_length);
|
||||
|
||||
if (fdt_overlay_do_fixups(main_fdtp, overlay_copy) < 0) {
|
||||
printf("failed to perform fixups in overlay\n");
|
||||
rv = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fdt_overlay_do_local_fixups(main_fdtp, overlay_copy) < 0) {
|
||||
if (fdt_overlay_do_local_fixups(main_fdtp, overlay_fdtp) < 0) {
|
||||
printf("failed to perform local fixups in overlay\n");
|
||||
rv = -1;
|
||||
goto out;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (fdt_overlay_apply_fragments(main_fdtp, overlay_copy) < 0) {
|
||||
if (fdt_overlay_apply_fragments(main_fdtp, overlay_fdtp) < 0) {
|
||||
printf("failed to apply fragments\n");
|
||||
rv = -1;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
out:
|
||||
free(overlay_copy);
|
||||
|
||||
return (rv);
|
||||
return (0);
|
||||
}
|
||||
|
@ -29,6 +29,6 @@
|
||||
#ifndef FDT_OVERLAY_H
|
||||
#define FDT_OVERLAY_H
|
||||
|
||||
int fdt_overlay_apply(void *main_fdtp, void *overlay_fdtp, size_t overlay_length);
|
||||
int fdt_overlay_apply(void *main_fdtp, void *overlay_fdtp);
|
||||
|
||||
#endif /* FDT_OVERLAY_H */
|
||||
|
@ -108,11 +108,11 @@ fw_probe(int index, struct fwohci_softc *sc)
|
||||
biospci_write_config(sc->locator,
|
||||
0x4 /* command */,
|
||||
0x6 /* enable bus master and memory mapped I/O */,
|
||||
1 /* word */);
|
||||
BIOSPCI_16BITS);
|
||||
|
||||
biospci_read_config(sc->locator, 0x00 /*devid*/, 2 /*dword*/,
|
||||
biospci_read_config(sc->locator, 0x00 /*devid*/, BIOSPCI_32BITS,
|
||||
&sc->devid);
|
||||
biospci_read_config(sc->locator, 0x10 /*base_addr*/, 2 /*dword*/,
|
||||
biospci_read_config(sc->locator, 0x10 /*base_addr*/, BIOSPCI_32BITS,
|
||||
&sc->base_addr);
|
||||
|
||||
sc->handle = (uint32_t)PTOV(sc->base_addr);
|
||||
|
@ -285,7 +285,7 @@ biospci_enumerate(void)
|
||||
break;
|
||||
|
||||
/* Read the device identifier from the nominated device */
|
||||
err = biospci_read_config(locator, 0, 2, &devid);
|
||||
err = biospci_read_config(locator, 0, BIOSPCI_32BITS, &devid);
|
||||
if (err != 0)
|
||||
break;
|
||||
|
||||
|
@ -263,10 +263,20 @@ comc_pcidev_handle(uint32_t locator)
|
||||
uint32_t port;
|
||||
|
||||
if (biospci_read_config(locator & 0xffff,
|
||||
(locator & 0xff0000) >> 16, 2, &port) == -1) {
|
||||
(locator & 0xff0000) >> 16, BIOSPCI_32BITS, &port) == -1) {
|
||||
printf("Cannot read bar at 0x%x\n", locator);
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* biospci_read_config() sets port == 0xffffffff if the pcidev
|
||||
* isn't found on the bus. Check for 0xffffffff and return to not
|
||||
* panic in BTX.
|
||||
*/
|
||||
if (port == 0xffffffff) {
|
||||
printf("Cannot find specified pcidev\n");
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
if (!PCI_BAR_IO(port)) {
|
||||
printf("Memory bar at 0x%x\n", locator);
|
||||
return (CMD_ERROR);
|
||||
|
@ -135,6 +135,13 @@ extern vm_offset_t memtop_copyin; /* memtop less heap size for the cases */
|
||||
extern uint32_t high_heap_size; /* extended memory region available */
|
||||
extern vm_offset_t high_heap_base; /* for use as the heap */
|
||||
|
||||
/*
|
||||
* Values for width parameter to biospci_{read,write}_config
|
||||
*/
|
||||
#define BIOSPCI_8BITS 0
|
||||
#define BIOSPCI_16BITS 1
|
||||
#define BIOSPCI_32BITS 2
|
||||
|
||||
void biospci_detect(void);
|
||||
int biospci_find_devclass(uint32_t class, int index, uint32_t *locator);
|
||||
int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val);
|
||||
|
@ -36,7 +36,7 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c fls.c \
|
||||
memccpy.c memchr.c memcmp.c memcpy.c memmove.c memset.c \
|
||||
qdivrem.c strcat.c strchr.c strcmp.c strcpy.c stpcpy.c stpncpy.c \
|
||||
strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \
|
||||
strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
|
||||
strnlen.c strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
|
||||
.if ${MACHINE_CPUARCH} == "arm"
|
||||
.PATH: ${LIBC_SRC}/arm/gen
|
||||
|
||||
|
@ -354,6 +354,7 @@ extern char const hex2ascii_data[];
|
||||
#define bcd2bin(bcd) (bcd2bin_data[bcd])
|
||||
#define bin2bcd(bin) (bin2bcd_data[bin])
|
||||
#define hex2ascii(hex) (hex2ascii_data[hex])
|
||||
#define validbcd(bcd) (bcd == 0 || (bcd > 0 && bcd <= 0x99 && bcd2bin_data[bcd] != 0))
|
||||
|
||||
/* min/max (undocumented) */
|
||||
static __inline int imax(int a, int b) { return (a > b ? a : b); }
|
||||
|
@ -105,16 +105,13 @@ CFLAGS+= -DLOADER_NFS_SUPPORT
|
||||
CFLAGS+= -DLOADER_TFTP_SUPPORT
|
||||
.endif
|
||||
|
||||
# Disk and partition support
|
||||
.if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
|
||||
CFLAGS+= -DLOADER_DISK_SUPPORT
|
||||
# Partition support
|
||||
.if ${LOADER_GPT_SUPPORT:Uyes} == "yes"
|
||||
CFLAGS+= -DLOADER_GPT_SUPPORT
|
||||
.endif
|
||||
.if ${LOADER_MBR_SUPPORT:Uyes} == "yes"
|
||||
CFLAGS+= -DLOADER_MBR_SUPPORT
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if defined(HAVE_ZFS)
|
||||
CFLAGS+= -DLOADER_ZFS_SUPPORT
|
||||
|
@ -53,8 +53,7 @@ CFLAGS+= -I${LDRSRC} \
|
||||
-fno-pic -mno-abicalls \
|
||||
-g
|
||||
|
||||
LDFLAGS= -nostdlib \
|
||||
-static \
|
||||
LDFLAGS+= -static \
|
||||
-Wl,-N \
|
||||
-G0 \
|
||||
-L${.CURDIR}
|
||||
|
@ -109,10 +109,10 @@
|
||||
ALTERA_SDCARD_RR1_COMMANDCRCFAILED | ALTERA_SDCARD_RR1_ADDRESSMISALIGNED |\
|
||||
ALTERA_SDCARD_RR1_ADDRBLOCKRANGE)
|
||||
|
||||
extern void __cheri_sdcard_vaddr__;
|
||||
extern uint8_t __cheri_sdcard_vaddr__[];
|
||||
|
||||
#define ALTERA_SDCARD_PTR(type, offset) \
|
||||
(volatile type *)((uint8_t *)&__cheri_sdcard_vaddr__ + (offset))
|
||||
(volatile type *)(&__cheri_sdcard_vaddr__[(offset)])
|
||||
|
||||
static __inline uint16_t
|
||||
altera_sdcard_read_uint16(u_int offset)
|
||||
|
@ -85,8 +85,7 @@ CFLAGS+= -G0 \
|
||||
-mno-abicalls \
|
||||
-g
|
||||
|
||||
LDFLAGS= -nostdlib \
|
||||
-static \
|
||||
LDFLAGS+= -static \
|
||||
-T ${.CURDIR}/loader.ldscript \
|
||||
-L${.CURDIR} \
|
||||
-e __start
|
||||
|
@ -78,8 +78,8 @@ struct console *consoles[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
extern void __bss_start, __bss_end;
|
||||
extern void __heap_start, __heap_end;
|
||||
extern uint8_t __bss_start, __bss_end;
|
||||
extern uint8_t __heap_start, __heap_end;
|
||||
|
||||
static int
|
||||
__elfN(exec)(struct preloaded_file *fp)
|
||||
@ -108,14 +108,14 @@ main(int argc, char *argv[], char *envv[], struct bootinfo *bootinfop)
|
||||
struct devsw **dp;
|
||||
|
||||
/* NB: Must be sure to bzero() before using any globals. */
|
||||
bzero(&__bss_start, (uintptr_t)&__bss_end - (uintptr_t)&__bss_start);
|
||||
bzero(&__bss_start, &__bss_end - &__bss_start);
|
||||
|
||||
boot2_argc = argc;
|
||||
boot2_argv = argv;
|
||||
boot2_envv = envv;
|
||||
boot2_bootinfo = *bootinfop; /* Copy rather than by reference. */
|
||||
|
||||
setheap((void *)&__heap_start, (void *)&__heap_end);
|
||||
setheap(&__heap_start, &__heap_end);
|
||||
|
||||
/*
|
||||
* Pick up console settings from boot2; probe console.
|
||||
|
@ -1,47 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
LOADER_UFS_SUPPORT?= yes
|
||||
LOADER_CD9660_SUPPORT?= yes
|
||||
LOADER_EXT2FS_SUPPORT?= yes
|
||||
LOADER_NET_SUPPORT?= yes
|
||||
LOADER_NFS_SUPPORT?= yes
|
||||
LOADER_TFTP_SUPPORT?= no
|
||||
LOADER_GZIP_SUPPORT?= yes
|
||||
LOADER_BZIP2_SUPPORT?= no
|
||||
|
||||
.include <bsd.init.mk>
|
||||
MK_SSP= no
|
||||
MAN=
|
||||
|
||||
PROG= loader.ps3
|
||||
NEWVERSWHAT= "Playstation 3 loader" ${MACHINE_ARCH}
|
||||
INSTALLFLAGS= -b
|
||||
|
||||
# Architecture-specific loader code
|
||||
SRCS= start.S conf.c metadata.c vers.c main.c devicename.c ppc64_elf_freebsd.c
|
||||
SRCS+= lv1call.S ps3cons.c font.h ps3mmu.c ps3net.c ps3repo.c \
|
||||
ps3stor.c ps3disk.c ps3cdrom.c
|
||||
SRCS+= ucmpdi2.c
|
||||
|
||||
CFLAGS+= -mcpu=powerpc64
|
||||
|
||||
# Always add MI sources
|
||||
.include "${BOOTSRC}/loader.mk"
|
||||
.PATH: ${SYSDIR}/libkern
|
||||
|
||||
CFLAGS+= -Wall -DAIM
|
||||
# load address. set in linker script
|
||||
RELOC?= 0x0
|
||||
CFLAGS+= -DRELOC=${RELOC}
|
||||
|
||||
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
|
||||
|
||||
DPADD= ${LIBFICL} ${LIBOFW} ${LIBSA}
|
||||
LDADD= ${LIBFICL} ${LIBOFW} ${LIBSA}
|
||||
|
||||
SC_DFLT_FONT=cp437
|
||||
|
||||
font.h:
|
||||
uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,123 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 1999 Michael Smith <msmith@freebsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
#include "bootstrap.h"
|
||||
|
||||
#if defined(LOADER_NET_SUPPORT)
|
||||
#include "dev_net.h"
|
||||
#endif
|
||||
|
||||
extern struct devsw ps3disk;
|
||||
extern struct devsw ps3cdrom;
|
||||
|
||||
/*
|
||||
* We could use linker sets for some or all of these, but
|
||||
* then we would have to control what ended up linked into
|
||||
* the bootstrap. So it's easier to conditionalise things
|
||||
* here.
|
||||
*
|
||||
* XXX rename these arrays to be consistent and less namespace-hostile
|
||||
*/
|
||||
|
||||
/* Exported for libstand */
|
||||
struct devsw *devsw[] = {
|
||||
#if defined(LOADER_CD9660_SUPPORT)
|
||||
&ps3cdrom,
|
||||
#endif
|
||||
#if defined(LOADER_DISK_SUPPORT)
|
||||
&ps3disk,
|
||||
#endif
|
||||
#if defined(LOADER_NET_SUPPORT)
|
||||
&netdev,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
struct fs_ops *file_system[] = {
|
||||
#if defined(LOADER_UFS_SUPPORT)
|
||||
&ufs_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_CD9660_SUPPORT)
|
||||
&cd9660_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_EXT2FS_SUPPORT)
|
||||
&ext2fs_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_NFS_SUPPORT)
|
||||
&nfs_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_TFTP_SUPPORT)
|
||||
&tftp_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_GZIP_SUPPORT)
|
||||
&gzipfs_fsops,
|
||||
#endif
|
||||
#if defined(LOADER_BZIP2_SUPPORT)
|
||||
&bzipfs_fsops,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
extern struct netif_driver ps3net;
|
||||
|
||||
struct netif_driver *netif_drivers[] = {
|
||||
#if defined(LOADER_NET_SUPPORT)
|
||||
&ps3net,
|
||||
#endif
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* Exported for PowerPC only */
|
||||
/*
|
||||
* Sort formats so that those that can detect based on arguments
|
||||
* rather than reading the file go first.
|
||||
*/
|
||||
|
||||
extern struct file_format ppc_elf64;
|
||||
|
||||
struct file_format *file_formats[] = {
|
||||
&ppc_elf64,
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* Consoles
|
||||
*/
|
||||
extern struct console ps3console;
|
||||
|
||||
struct console *consoles[] = {
|
||||
&ps3console,
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* reloc - our load address
|
||||
*/
|
||||
vm_offset_t reloc = RELOC;
|
@ -1,238 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
#include "ps3.h"
|
||||
#include "ps3devdesc.h"
|
||||
|
||||
static int ps3_parsedev(struct ps3_devdesc **dev, const char *devspec,
|
||||
const char **path);
|
||||
|
||||
/*
|
||||
* Point (dev) at an allocated device specifier for the device matching the
|
||||
* path in (devspec). If it contains an explicit device specification,
|
||||
* use that. If not, use the default device.
|
||||
*/
|
||||
int
|
||||
ps3_getdev(void **vdev, const char *devspec, const char **path)
|
||||
{
|
||||
struct ps3_devdesc **dev = (struct ps3_devdesc **)vdev;
|
||||
int rv = 0;
|
||||
|
||||
/*
|
||||
* If it looks like this is just a path and no
|
||||
* device, go with the current device.
|
||||
*/
|
||||
if ((devspec == NULL) || (devspec[0] == '/') ||
|
||||
(strchr(devspec, ':') == NULL)) {
|
||||
rv = ps3_parsedev(dev, getenv("currdev"), NULL);
|
||||
|
||||
if (rv == 0 && path != NULL)
|
||||
*path = devspec;
|
||||
return(rv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to parse the device name off the beginning of the devspec.
|
||||
*/
|
||||
return (ps3_parsedev(dev, devspec, path));
|
||||
}
|
||||
|
||||
/*
|
||||
* Point (dev) at an allocated device specifier matching the string version
|
||||
* at the beginning of (devspec). Return a pointer to the remaining
|
||||
* text in (path).
|
||||
*
|
||||
* In all cases, the beginning of (devspec) is compared to the names
|
||||
* of known devices in the device switch, and then any following text
|
||||
* is parsed according to the rules applied to the device type.
|
||||
*
|
||||
* For disk-type devices, the syntax is:
|
||||
*
|
||||
* disk<unit>[<partition>]:
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ps3_parsedev(struct ps3_devdesc **dev, const char *devspec, const char **path)
|
||||
{
|
||||
struct ps3_devdesc *idev;
|
||||
struct devsw *dv;
|
||||
char *cp;
|
||||
const char *np;
|
||||
int i, unit, pnum, ptype, err;
|
||||
|
||||
/* minimum length check */
|
||||
if (strlen(devspec) < 2)
|
||||
return(EINVAL);
|
||||
|
||||
/* look for a device that matches */
|
||||
for (i = 0, dv = NULL; devsw[i] != NULL; i++) {
|
||||
if (!strncmp(devspec, devsw[i]->dv_name,
|
||||
strlen(devsw[i]->dv_name))) {
|
||||
dv = devsw[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dv == NULL)
|
||||
return(ENOENT);
|
||||
idev = malloc(sizeof(struct ps3_devdesc));
|
||||
err = 0;
|
||||
np = (devspec + strlen(dv->dv_name));
|
||||
|
||||
switch(dv->dv_type) {
|
||||
case DEVT_NONE:
|
||||
break;
|
||||
|
||||
case DEVT_DISK:
|
||||
unit = -1;
|
||||
pnum = -1;
|
||||
ptype = -1;
|
||||
if (*np && (*np != ':')) {
|
||||
/* next comes the unit number */
|
||||
unit = strtol(np, &cp, 10);
|
||||
if (cp == np) {
|
||||
err = EUNIT;
|
||||
goto fail;
|
||||
}
|
||||
if (*cp && (*cp != ':')) {
|
||||
/* get partition */
|
||||
if (*cp == 'p' && *(cp + 1) &&
|
||||
*(cp + 1) != ':') {
|
||||
pnum = strtol(cp + 1, &cp, 10);
|
||||
ptype = PTYPE_GPT;
|
||||
} else {
|
||||
pnum = *cp - 'a';
|
||||
ptype = PTYPE_BSDLABEL;
|
||||
if ((pnum < 0) ||
|
||||
(pnum >= MAXPARTITIONS)) {
|
||||
err = EPART;
|
||||
goto fail;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*cp && (*cp != ':')) {
|
||||
err = EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
idev->d_unit = unit;
|
||||
idev->d_disk.pnum = pnum;
|
||||
idev->d_disk.ptype = ptype;
|
||||
idev->d_disk.data = NULL;
|
||||
if (path != NULL)
|
||||
*path = (*cp == 0) ? cp : cp + 1;
|
||||
break;
|
||||
|
||||
case DEVT_NET:
|
||||
case DEVT_CD:
|
||||
/*
|
||||
* PS3 only has one network interface (well, two, but
|
||||
* netbooting over wireless is not something I'm going
|
||||
* to worry about.
|
||||
*/
|
||||
|
||||
idev->d_unit = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
err = EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
idev->d_dev = dv;
|
||||
idev->d_type = dv->dv_type;
|
||||
if (dev == NULL) {
|
||||
free(idev);
|
||||
} else {
|
||||
*dev = idev;
|
||||
}
|
||||
return (0);
|
||||
|
||||
fail:
|
||||
free(idev);
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
ps3_fmtdev(void *vdev)
|
||||
{
|
||||
struct ps3_devdesc *dev = (struct ps3_devdesc *)vdev;
|
||||
char *cp;
|
||||
static char buf[128];
|
||||
|
||||
switch(dev->d_type) {
|
||||
case DEVT_NONE:
|
||||
strcpy(buf, "(no device)");
|
||||
break;
|
||||
|
||||
case DEVT_DISK:
|
||||
cp = buf;
|
||||
cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit);
|
||||
if (dev->d_kind.disk.pnum >= 0) {
|
||||
if (dev->d_kind.disk.ptype == PTYPE_BSDLABEL)
|
||||
cp += sprintf(cp, "%c",
|
||||
dev->d_kind.disk.pnum + 'a');
|
||||
else if (dev->d_kind.disk.ptype == PTYPE_GPT)
|
||||
cp += sprintf(cp, "p%i",
|
||||
dev->d_kind.disk.pnum);
|
||||
}
|
||||
|
||||
strcat(cp, ":");
|
||||
break;
|
||||
|
||||
case DEVT_NET:
|
||||
case DEVT_CD:
|
||||
sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
|
||||
break;
|
||||
}
|
||||
return(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set currdev to suit the value being supplied in (value).
|
||||
*/
|
||||
int
|
||||
ps3_setcurrdev(struct env_var *ev, int flags, const void *value)
|
||||
{
|
||||
struct ps3_devdesc *ncurr;
|
||||
int rv;
|
||||
|
||||
if ((rv = ps3_parsedev(&ncurr, value, NULL)) != 0)
|
||||
return (rv);
|
||||
free(ncurr);
|
||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
|
||||
return (0);
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd",
|
||||
"elf32-powerpc-freebsd")
|
||||
OUTPUT_ARCH(powerpc:common)
|
||||
ENTRY(_start)
|
||||
SEARCH_DIR(/usr/lib);
|
||||
PROVIDE (__stack = 0);
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = 0x0;
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
} =0
|
||||
_etext = .;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rela.text :
|
||||
{ *(.rela.text) *(.rela.gnu.linkonce.t*) }
|
||||
.rela.data :
|
||||
{ *(.rela.data) *(.rela.gnu.linkonce.d*) }
|
||||
.rela.rodata :
|
||||
{ *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rela.got1 : { *(.rela.got1) }
|
||||
.rela.got2 : { *(.rela.got2) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.rela.sbss : { *(.rela.sbss) }
|
||||
.rela.sbss2 : { *(.rela.sbss2) }
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
} =0
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.init : { *(.init) } =0
|
||||
.fini : { *(.fini) } =0
|
||||
.rodata : { *(.rodata) *(.gnu.linkonce.r*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
.sbss2 : { *(.sbss2) }
|
||||
/* Adjust the address for the data segment to the next page up. */
|
||||
. = ((. + 0x1000) & ~(0x1000 - 1));
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
.got1 : { *(.got1) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
/* Put .ctors and .dtors next to the .got2 section, so that the pointers
|
||||
get relocated with -mrelocatable. Also put in the .fixup pointers.
|
||||
The current compiler no longer needs this, but keep it around for 2.7.2 */
|
||||
PROVIDE (_GOT2_START_ = .);
|
||||
.got2 : { *(.got2) }
|
||||
PROVIDE (__CTOR_LIST__ = .);
|
||||
.ctors : { *(.ctors) }
|
||||
PROVIDE (__CTOR_END__ = .);
|
||||
PROVIDE (__DTOR_LIST__ = .);
|
||||
.dtors : { *(.dtors) }
|
||||
PROVIDE (__DTOR_END__ = .);
|
||||
PROVIDE (_FIXUP_START_ = .);
|
||||
.fixup : { *(.fixup) }
|
||||
PROVIDE (_FIXUP_END_ = .);
|
||||
PROVIDE (_GOT2_END_ = .);
|
||||
PROVIDE (_GOT_START_ = .);
|
||||
.got : { *(.got) }
|
||||
.got.plt : { *(.got.plt) }
|
||||
PROVIDE (_GOT_END_ = .);
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
.sbss :
|
||||
{
|
||||
PROVIDE (__sbss_start = .);
|
||||
*(.sbss)
|
||||
*(.scommon)
|
||||
*(.dynsbss)
|
||||
PROVIDE (__sbss_end = .);
|
||||
}
|
||||
.plt : { *(.plt) }
|
||||
.bss :
|
||||
{
|
||||
PROVIDE (__bss_start = .);
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
@ -1,346 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/* Hypercall stubs. Note: this is all a hack and should die. */
|
||||
|
||||
#define hc .long 0x44000022
|
||||
|
||||
#define LD64_IM(r, highest, higher, high, low) \
|
||||
lis r,highest; \
|
||||
addi r,r,higher; \
|
||||
sldi r,r,32; \
|
||||
addis r,r,high; \
|
||||
addi r,r,low;
|
||||
|
||||
#define SIMPLE_HVCALL(x, c) \
|
||||
.global x; \
|
||||
x: \
|
||||
mflr %r0; \
|
||||
stw %r0,4(%r1); \
|
||||
clrldi %r3,%r3,32; \
|
||||
clrldi %r4,%r4,32; \
|
||||
clrldi %r5,%r5,32; \
|
||||
clrldi %r6,%r6,32; \
|
||||
clrldi %r7,%r7,32; \
|
||||
clrldi %r8,%r8,32; \
|
||||
clrldi %r9,%r9,32; \
|
||||
clrldi %r10,%r10,32; \
|
||||
li %r11,c; \
|
||||
hc; \
|
||||
extsw %r3,%r3; \
|
||||
lwz %r0,4(%r1); \
|
||||
mtlr %r0; \
|
||||
blr
|
||||
|
||||
SIMPLE_HVCALL(lv1_open_device, 170)
|
||||
SIMPLE_HVCALL(lv1_close_device, 171)
|
||||
SIMPLE_HVCALL(lv1_gpu_open, 210)
|
||||
SIMPLE_HVCALL(lv1_gpu_context_attribute, 225)
|
||||
SIMPLE_HVCALL(lv1_panic, 255)
|
||||
SIMPLE_HVCALL(lv1_net_start_tx_dma, 187)
|
||||
SIMPLE_HVCALL(lv1_net_stop_tx_dma, 188)
|
||||
SIMPLE_HVCALL(lv1_net_start_rx_dma, 189)
|
||||
SIMPLE_HVCALL(lv1_net_stop_rx_dma, 190)
|
||||
|
||||
.global lv1_get_physmem
|
||||
lv1_get_physmem:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
stw %r3,-8(%r1) /* Address for maxmem */
|
||||
|
||||
li %r11,69 /* Get PU ID */
|
||||
hc
|
||||
std %r4,-16(%r1)
|
||||
|
||||
li %r11,74 /* Get LPAR ID */
|
||||
hc
|
||||
std %r4,-24(%r1)
|
||||
|
||||
ld %r3,-24(%r1)
|
||||
LD64_IM(%r4,0x0000,0x0000,0x6269,0x0000 /* "bi" */)
|
||||
LD64_IM(%r5,0x7075,0x0000,0x0000,0x0000 /* "pu" */)
|
||||
ld %r6,-16(%r1)
|
||||
LD64_IM(%r7,0x726d,0x5f73,0x697a,0x6500 /* "rm_size" */)
|
||||
li %r11,91
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r5,-8(%r1)
|
||||
std %r4,0(%r5)
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_setup_address_space
|
||||
lv1_setup_address_space:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
|
||||
stw %r3,-4(%r1)
|
||||
stw %r4,-8(%r1)
|
||||
|
||||
li %r3,18 /* PT size: log2(256 KB) */
|
||||
li %r4,2 /* Two page sizes */
|
||||
li %r5,24 /* Page sizes: (24 << 56) | (16 << 48) */
|
||||
sldi %r5,%r5,24
|
||||
li %r6,16
|
||||
sldi %r6,%r6,16
|
||||
or %r5,%r5,%r6
|
||||
sldi %r5,%r5,32
|
||||
|
||||
li %r11,2 /* lv1_construct_virtual_address_space */
|
||||
hc
|
||||
|
||||
lwz %r6,-4(%r1)
|
||||
lwz %r7,-8(%r1)
|
||||
std %r4,0(%r6)
|
||||
std %r5,0(%r7)
|
||||
|
||||
/* AS_ID in r4 */
|
||||
mr %r3,%r4
|
||||
li %r11,7 /* lv1_select_virtual_address_space */
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_insert_pte
|
||||
lv1_insert_pte:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
|
||||
mr %r11,%r4 /* Save R4 */
|
||||
|
||||
clrldi %r3,%r3,32
|
||||
clrldi %r7,%r5,32
|
||||
|
||||
sldi %r4,%r3,3 /* Convert ptegidx into base PTE slot */
|
||||
li %r3,0 /* Current address space */
|
||||
ld %r5,0(%r11)
|
||||
ld %r6,8(%r11)
|
||||
li %r8,0 /* No other flags */
|
||||
|
||||
li %r11,158
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_gpu_context_allocate
|
||||
lv1_gpu_context_allocate:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
stw %r7,-4(%r1)
|
||||
|
||||
sldi %r3,%r3,32
|
||||
clrldi %r4,%r4,32
|
||||
or %r3,%r3,%r4
|
||||
clrldi %r4,%r5,32
|
||||
clrldi %r5,%r6,32
|
||||
|
||||
li %r11,217
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r7,-4(%r1)
|
||||
std %r4,0(%r7)
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_gpu_memory_allocate
|
||||
lv1_gpu_memory_allocate:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
stw %r8,-4(%r1)
|
||||
stw %r9,-8(%r1)
|
||||
|
||||
li %r11,214
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r8,-4(%r1)
|
||||
lwz %r9,-8(%r1)
|
||||
std %r4,0(%r8)
|
||||
std %r5,0(%r9)
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_net_control
|
||||
lv1_net_control:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
stw %r9,-4(%r1)
|
||||
|
||||
li %r11,194
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r8,-4(%r1)
|
||||
std %r4,0(%r8)
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_setup_dma
|
||||
lv1_setup_dma:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
stw %r3,-4(%r1)
|
||||
stw %r4,-8(%r1)
|
||||
stw %r5,-12(%r1)
|
||||
|
||||
lwz %r3,-4(%r1)
|
||||
lwz %r4,-8(%r1)
|
||||
lis %r5,0x0800 /* 128 MB */
|
||||
li %r6,24 /* log2(IO_PAGESIZE) */
|
||||
li %r7,0 /* flags */
|
||||
li %r11,174 /* lv1_allocate_device_dma_region */
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
cmpdi %r3,0
|
||||
bne 1f
|
||||
std %r4,-24(%r1)
|
||||
|
||||
lwz %r3,-4(%r1)
|
||||
lwz %r4,-8(%r1)
|
||||
li %r5,0
|
||||
ld %r6,-24(%r1)
|
||||
lis %r7,0x0800 /* 128 MB */
|
||||
lis %r8,0xf800 /* flags */
|
||||
sldi %r8,%r8,32
|
||||
li %r11,176 /* lv1_map_device_dma_region */
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r9,-12(%r1)
|
||||
ld %r6,-24(%r1)
|
||||
std %r6,0(%r9)
|
||||
|
||||
1: lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_get_repository_node_value
|
||||
lv1_get_repository_node_value:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
|
||||
sldi %r3,%r3,32
|
||||
clrldi %r4,%r4,32
|
||||
or %r3,%r3,%r4
|
||||
sldi %r4,%r5,32
|
||||
clrldi %r5,%r6,32
|
||||
or %r4,%r4,%r5
|
||||
sldi %r5,%r7,32
|
||||
clrldi %r6,%r8,32
|
||||
or %r5,%r5,%r6
|
||||
sldi %r6,%r9,32
|
||||
clrldi %r7,%r10,32
|
||||
or %r6,%r6,%r7
|
||||
lwz %r7,8(%r1)
|
||||
lwz %r8,12(%r1)
|
||||
sldi %r7,%r7,32
|
||||
or %r7,%r7,%r8
|
||||
|
||||
li %r11,91
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r6,16(%r1)
|
||||
std %r4,0(%r6)
|
||||
lwz %r6,20(%r1)
|
||||
std %r5,0(%r6)
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_storage_read
|
||||
lv1_storage_read:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
|
||||
sldi %r3,%r3,32
|
||||
clrldi %r4,%r4,32
|
||||
or %r3,%r3,%r4
|
||||
sldi %r4,%r5,32
|
||||
clrldi %r5,%r6,32
|
||||
or %r4,%r4,%r5
|
||||
sldi %r5,%r7,32
|
||||
clrldi %r6,%r8,32
|
||||
or %r5,%r5,%r6
|
||||
sldi %r6,%r9,32
|
||||
clrldi %r7,%r10,32
|
||||
or %r6,%r6,%r7
|
||||
ld %r7,8(%r1)
|
||||
ld %r8,16(%r1)
|
||||
|
||||
li %r11,245
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r5,24(%r1)
|
||||
std %r4,0(%r5)
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
||||
|
||||
.global lv1_storage_check_async_status
|
||||
lv1_storage_check_async_status:
|
||||
mflr %r0
|
||||
stw %r0,4(%r1)
|
||||
stw %r7,-4(%r1)
|
||||
|
||||
sldi %r3,%r3,32
|
||||
clrldi %r4,%r4,32
|
||||
or %r3,%r3,%r4
|
||||
sldi %r4,%r5,32
|
||||
clrldi %r5,%r6,32
|
||||
or %r4,%r4,%r5
|
||||
|
||||
li %r11,254
|
||||
hc
|
||||
extsw %r3,%r3
|
||||
|
||||
lwz %r5,-4(%r1)
|
||||
std %r4,0(%r5)
|
||||
|
||||
lwz %r0,4(%r1)
|
||||
mtlr %r0
|
||||
blr
|
@ -1,80 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _PS3_LV1CALL_H
|
||||
#define _PS3_LV1CALL_H
|
||||
|
||||
#include <machine/pte.h>
|
||||
|
||||
int lv1_get_physmem(uint64_t *maxmem);
|
||||
int lv1_setup_address_space(uint64_t *as_id, uint64_t *ptsize);
|
||||
int lv1_insert_pte(u_int ptegidx, struct lpte *pte, int lockflags);
|
||||
int lv1_panic(int reboot);
|
||||
|
||||
#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_MODE_SET 0x0100
|
||||
#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC 0x0101
|
||||
#define L1GPU_DISPLAY_SYNC_HSYNC 1
|
||||
#define L1GPU_DISPLAY_SYNC_VSYNC 2
|
||||
#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP 0x0102
|
||||
|
||||
int lv1_gpu_open(int);
|
||||
int lv1_gpu_context_attribute(int context, int op, int, int, int, int);
|
||||
int lv1_gpu_memory_allocate(int size, int, int, int, int, uint64_t *handle,
|
||||
uint64_t *paddr);
|
||||
int lv1_gpu_context_allocate(uint64_t handle, int, uint64_t *context);
|
||||
|
||||
int lv1_open_device(int, int, int /* 0 */);
|
||||
int lv1_close_device(int, int);
|
||||
int lv1_setup_dma(int, int, uint64_t *dmabase);
|
||||
|
||||
#define GELIC_GET_MAC_ADDRESS 0x0001
|
||||
#define GELIC_GET_LINK_STATUS 0x0002
|
||||
#define GELIC_LINK_UP 0x0001
|
||||
#define GELIC_FULL_DUPLEX 0x0002
|
||||
#define GELIC_AUTO_NEG 0x0004
|
||||
#define GELIC_SPEED_10 0x0010
|
||||
#define GELIC_SPEED_100 0x0020
|
||||
#define GELIC_SPEED_1000 0x0040
|
||||
#define GELIC_GET_VLAN_ID 0x0004
|
||||
|
||||
int lv1_net_init(int bus, int dev);
|
||||
int lv1_net_control(int bus, int dev, int, int, int, int, uint64_t *);
|
||||
int lv1_net_start_tx_dma(int bus, int dev, uint32_t addr, int);
|
||||
int lv1_net_start_rx_dma(int bus, int dev, uint32_t addr, int);
|
||||
int lv1_net_stop_tx_dma(int bus, int dev, int);
|
||||
int lv1_net_stop_rx_dma(int bus, int dev, int);
|
||||
|
||||
int lv1_get_repository_node_value(uint64_t lpar_id, uint64_t n1, uint64_t n2,
|
||||
uint64_t n3, uint64_t n4, uint64_t *v1, uint64_t *v2);
|
||||
|
||||
int lv1_storage_read(uint64_t dev_id, uint64_t region_id, uint64_t start_sector,
|
||||
uint64_t sector_count, uint64_t flags, uint64_t buf, uint64_t *tag);
|
||||
int lv1_storage_check_async_status(uint64_t dev_id, uint64_t tag,
|
||||
uint64_t *status);
|
||||
|
||||
#endif
|
||||
|
@ -1,248 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#define _KERNEL
|
||||
#include <machine/cpufunc.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
#include "lv1call.h"
|
||||
#include "ps3.h"
|
||||
#include "ps3devdesc.h"
|
||||
|
||||
struct arch_switch archsw;
|
||||
extern void *_end;
|
||||
|
||||
extern char bootprog_info[];
|
||||
|
||||
int ps3_getdev(void **vdev, const char *devspec, const char **path);
|
||||
ssize_t ps3_copyin(const void *src, vm_offset_t dest, const size_t len);
|
||||
ssize_t ps3_copyout(vm_offset_t src, void *dest, const size_t len);
|
||||
ssize_t ps3_readin(const int fd, vm_offset_t dest, const size_t len);
|
||||
int ps3_autoload(void);
|
||||
int ps3_setcurrdev(struct env_var *ev, int flags, const void *value);
|
||||
|
||||
static uint64_t basetb;
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
uint64_t maxmem = 0;
|
||||
void *heapbase;
|
||||
int i, err;
|
||||
struct ps3_devdesc currdev;
|
||||
struct open_file f;
|
||||
|
||||
lv1_get_physmem(&maxmem);
|
||||
|
||||
ps3mmu_init(maxmem);
|
||||
|
||||
/*
|
||||
* Set up console.
|
||||
*/
|
||||
cons_probe();
|
||||
|
||||
/*
|
||||
* Set the heap to one page after the end of the loader.
|
||||
*/
|
||||
heapbase = (void *)(maxmem - 0x80000);
|
||||
setheap(heapbase, maxmem);
|
||||
|
||||
/*
|
||||
* March through the device switch probing for things.
|
||||
*/
|
||||
for (i = 0; devsw[i] != NULL; i++) {
|
||||
if (devsw[i]->dv_init != NULL) {
|
||||
err = (devsw[i]->dv_init)();
|
||||
if (err) {
|
||||
printf("\n%s: initialization failed err=%d\n",
|
||||
devsw[i]->dv_name, err);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
currdev.d_dev = devsw[i];
|
||||
currdev.d_type = currdev.d_dev->dv_type;
|
||||
|
||||
if (strcmp(devsw[i]->dv_name, "cd") == 0) {
|
||||
f.f_devdata = &currdev;
|
||||
currdev.d_unit = 0;
|
||||
|
||||
if (devsw[i]->dv_open(&f, &currdev) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp(devsw[i]->dv_name, "disk") == 0) {
|
||||
f.f_devdata = &currdev;
|
||||
currdev.d_unit = 3;
|
||||
currdev.d_disk.pnum = 1;
|
||||
currdev.d_disk.ptype = PTYPE_GPT;
|
||||
|
||||
if (devsw[i]->dv_open(&f, &currdev) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp(devsw[i]->dv_name, "net") == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (devsw[i] == NULL)
|
||||
panic("No boot device found!");
|
||||
else
|
||||
printf("Boot device: %s\n", devsw[i]->dv_name);
|
||||
|
||||
/*
|
||||
* Get timebase at boot.
|
||||
*/
|
||||
basetb = mftb();
|
||||
|
||||
archsw.arch_getdev = ps3_getdev;
|
||||
archsw.arch_copyin = ps3_copyin;
|
||||
archsw.arch_copyout = ps3_copyout;
|
||||
archsw.arch_readin = ps3_readin;
|
||||
archsw.arch_autoload = ps3_autoload;
|
||||
|
||||
printf("\n%s", bootprog_info);
|
||||
printf("Memory: %lldKB\n", maxmem / 1024);
|
||||
|
||||
env_setenv("currdev", EV_VOLATILE, ps3_fmtdev(&currdev),
|
||||
ps3_setcurrdev, env_nounset);
|
||||
env_setenv("loaddev", EV_VOLATILE, ps3_fmtdev(&currdev), env_noset,
|
||||
env_nounset);
|
||||
setenv("LINES", "24", 1);
|
||||
setenv("hw.platform", "ps3", 1);
|
||||
|
||||
interact(); /* doesn't return */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ppc_exception(int code, vm_offset_t where, register_t msr)
|
||||
{
|
||||
mtmsr(PSL_IR | PSL_DR | PSL_RI);
|
||||
printf("Exception %x at %#lx!\n", code, where);
|
||||
printf("Rebooting in 5 seconds...\n");
|
||||
delay(10000000);
|
||||
lv1_panic(1);
|
||||
}
|
||||
|
||||
const u_int ns_per_tick = 12;
|
||||
|
||||
void
|
||||
exit(int code)
|
||||
{
|
||||
lv1_panic(code);
|
||||
}
|
||||
|
||||
void
|
||||
delay(int usecs)
|
||||
{
|
||||
uint64_t tb,ttb;
|
||||
tb = mftb();
|
||||
|
||||
ttb = tb + howmany(usecs * 1000, ns_per_tick);
|
||||
while (tb < ttb)
|
||||
tb = mftb();
|
||||
}
|
||||
|
||||
time_t
|
||||
getsecs(void)
|
||||
{
|
||||
return ((time_t)((mftb() - basetb)*ns_per_tick/1000000000));
|
||||
}
|
||||
|
||||
time_t
|
||||
time(time_t *tloc)
|
||||
{
|
||||
time_t rv;
|
||||
|
||||
rv = getsecs();
|
||||
if (tloc != NULL)
|
||||
*tloc = rv;
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
ps3_copyin(const void *src, vm_offset_t dest, const size_t len)
|
||||
{
|
||||
bcopy(src, (void *)dest, len);
|
||||
return (len);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
ps3_copyout(vm_offset_t src, void *dest, const size_t len)
|
||||
{
|
||||
bcopy((void *)src, dest, len);
|
||||
return (len);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
ps3_readin(const int fd, vm_offset_t dest, const size_t len)
|
||||
{
|
||||
void *buf;
|
||||
size_t resid, chunk, get;
|
||||
ssize_t got;
|
||||
vm_offset_t p;
|
||||
|
||||
p = dest;
|
||||
|
||||
chunk = min(PAGE_SIZE, len);
|
||||
buf = malloc(chunk);
|
||||
if (buf == NULL) {
|
||||
printf("ps3_readin: buf malloc failed\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
for (resid = len; resid > 0; resid -= got, p += got) {
|
||||
get = min(chunk, resid);
|
||||
got = read(fd, buf, get);
|
||||
if (got <= 0) {
|
||||
if (got < 0)
|
||||
printf("ps3_readin: read failed\n");
|
||||
break;
|
||||
}
|
||||
|
||||
bcopy(buf, (void *)p, got);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
return (len - resid);
|
||||
}
|
||||
|
||||
int
|
||||
ps3_autoload(void)
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,333 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: FreeBSD: src/sys/boot/sparc64/loader/metadata.c,v 1.6
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/boot.h>
|
||||
|
||||
#include <machine/metadata.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
|
||||
int
|
||||
md_getboothowto(char *kargs)
|
||||
{
|
||||
char *cp;
|
||||
int howto;
|
||||
int active;
|
||||
int i;
|
||||
|
||||
/* Parse kargs */
|
||||
howto = 0;
|
||||
if (kargs != NULL) {
|
||||
cp = kargs;
|
||||
active = 0;
|
||||
while (*cp != 0) {
|
||||
if (!active && (*cp == '-')) {
|
||||
active = 1;
|
||||
} else if (active)
|
||||
switch (*cp) {
|
||||
case 'a':
|
||||
howto |= RB_ASKNAME;
|
||||
break;
|
||||
case 'C':
|
||||
howto |= RB_CDROM;
|
||||
break;
|
||||
case 'd':
|
||||
howto |= RB_KDB;
|
||||
break;
|
||||
case 'D':
|
||||
howto |= RB_MULTIPLE;
|
||||
break;
|
||||
case 'm':
|
||||
howto |= RB_MUTE;
|
||||
break;
|
||||
case 'g':
|
||||
howto |= RB_GDB;
|
||||
break;
|
||||
case 'h':
|
||||
howto |= RB_SERIAL;
|
||||
break;
|
||||
case 'p':
|
||||
howto |= RB_PAUSE;
|
||||
break;
|
||||
case 'r':
|
||||
howto |= RB_DFLTROOT;
|
||||
break;
|
||||
case 's':
|
||||
howto |= RB_SINGLE;
|
||||
break;
|
||||
case 'v':
|
||||
howto |= RB_VERBOSE;
|
||||
break;
|
||||
default:
|
||||
active = 0;
|
||||
break;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
/* get equivalents from the environment */
|
||||
for (i = 0; howto_names[i].ev != NULL; i++)
|
||||
if (getenv(howto_names[i].ev) != NULL)
|
||||
howto |= howto_names[i].mask;
|
||||
if (!strcmp(getenv("console"), "comconsole"))
|
||||
howto |= RB_SERIAL;
|
||||
if (!strcmp(getenv("console"), "nullconsole"))
|
||||
howto |= RB_MUTE;
|
||||
return(howto);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the environment into the load area starting at (addr).
|
||||
* Each variable is formatted as <name>=<value>, with a single nul
|
||||
* separating each variable, and a double nul terminating the environment.
|
||||
*/
|
||||
vm_offset_t
|
||||
md_copyenv(vm_offset_t addr)
|
||||
{
|
||||
struct env_var *ep;
|
||||
|
||||
/* traverse the environment */
|
||||
for (ep = environ; ep != NULL; ep = ep->ev_next) {
|
||||
archsw.arch_copyin(ep->ev_name, addr, strlen(ep->ev_name));
|
||||
addr += strlen(ep->ev_name);
|
||||
archsw.arch_copyin("=", addr, 1);
|
||||
addr++;
|
||||
if (ep->ev_value != NULL) {
|
||||
archsw.arch_copyin(ep->ev_value, addr, strlen(ep->ev_value));
|
||||
addr += strlen(ep->ev_value);
|
||||
}
|
||||
archsw.arch_copyin("", addr, 1);
|
||||
addr++;
|
||||
}
|
||||
archsw.arch_copyin("", addr, 1);
|
||||
addr++;
|
||||
return(addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy module-related data into the load area, where it can be
|
||||
* used as a directory for loaded modules.
|
||||
*
|
||||
* Module data is presented in a self-describing format. Each datum
|
||||
* is preceded by a 32-bit identifier and a 32-bit size field.
|
||||
*
|
||||
* Currently, the following data are saved:
|
||||
*
|
||||
* MOD_NAME (variable) module name (string)
|
||||
* MOD_TYPE (variable) module type (string)
|
||||
* MOD_ARGS (variable) module parameters (string)
|
||||
* MOD_ADDR sizeof(vm_offset_t) module load address
|
||||
* MOD_SIZE sizeof(size_t) module size
|
||||
* MOD_METADATA (variable) type-specific metadata
|
||||
*/
|
||||
|
||||
static int align;
|
||||
|
||||
#define COPY32(v, a, c) { \
|
||||
u_int32_t x = (v); \
|
||||
if (c) \
|
||||
archsw.arch_copyin(&x, a, sizeof(x)); \
|
||||
a += sizeof(x); \
|
||||
}
|
||||
|
||||
#define MOD_STR(t, a, s, c) { \
|
||||
COPY32(t, a, c); \
|
||||
COPY32(strlen(s) + 1, a, c) \
|
||||
if (c) \
|
||||
archsw.arch_copyin(s, a, strlen(s) + 1);\
|
||||
a += roundup(strlen(s) + 1, align); \
|
||||
}
|
||||
|
||||
#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
|
||||
#define MOD_TYPE(a, s, c) MOD_STR(MODINFO_TYPE, a, s, c)
|
||||
#define MOD_ARGS(a, s, c) MOD_STR(MODINFO_ARGS, a, s, c)
|
||||
|
||||
#define MOD_VAR(t, a, s, c) { \
|
||||
COPY32(t, a, c); \
|
||||
COPY32(sizeof(s), a, c); \
|
||||
if (c) \
|
||||
archsw.arch_copyin(&s, a, sizeof(s)); \
|
||||
a += roundup(sizeof(s), align); \
|
||||
}
|
||||
|
||||
#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
|
||||
#define MOD_SIZE(a, s, c) MOD_VAR(MODINFO_SIZE, a, s, c)
|
||||
|
||||
#define MOD_METADATA(a, mm, c) { \
|
||||
COPY32(MODINFO_METADATA | mm->md_type, a, c);\
|
||||
COPY32(mm->md_size, a, c); \
|
||||
if (c) \
|
||||
archsw.arch_copyin(mm->md_data, a, mm->md_size);\
|
||||
a += roundup(mm->md_size, align); \
|
||||
}
|
||||
|
||||
#define MOD_END(a, c) { \
|
||||
COPY32(MODINFO_END, a, c); \
|
||||
COPY32(0, a, c); \
|
||||
}
|
||||
|
||||
vm_offset_t
|
||||
md_copymodules(vm_offset_t addr, int kern64)
|
||||
{
|
||||
struct preloaded_file *fp;
|
||||
struct file_metadata *md;
|
||||
uint64_t scratch64;
|
||||
int c;
|
||||
|
||||
c = addr != 0;
|
||||
/* start with the first module on the list, should be the kernel */
|
||||
for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) {
|
||||
|
||||
MOD_NAME(addr, fp->f_name, c); /* this field must come first */
|
||||
MOD_TYPE(addr, fp->f_type, c);
|
||||
if (fp->f_args)
|
||||
MOD_ARGS(addr, fp->f_args, c);
|
||||
if (kern64) {
|
||||
scratch64 = fp->f_addr;
|
||||
MOD_ADDR(addr, scratch64, c);
|
||||
scratch64 = fp->f_size;
|
||||
MOD_SIZE(addr, scratch64, c);
|
||||
} else {
|
||||
MOD_ADDR(addr, fp->f_addr, c);
|
||||
MOD_SIZE(addr, fp->f_size, c);
|
||||
}
|
||||
for (md = fp->f_metadata; md != NULL; md = md->md_next) {
|
||||
if (!(md->md_type & MODINFOMD_NOCOPY)) {
|
||||
MOD_METADATA(addr, md, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
MOD_END(addr, c);
|
||||
return(addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Load the information expected by a powerpc kernel.
|
||||
*
|
||||
* - The 'boothowto' argument is constructed
|
||||
* - The 'bootdev' argument is constructed
|
||||
* - The kernel environment is copied into kernel space.
|
||||
* - Module metadata are formatted and placed in kernel space.
|
||||
*/
|
||||
int
|
||||
md_load_dual(char *args, vm_offset_t *modulep, int kern64)
|
||||
{
|
||||
struct preloaded_file *kfp;
|
||||
struct preloaded_file *xp;
|
||||
struct file_metadata *md;
|
||||
vm_offset_t kernend;
|
||||
vm_offset_t addr;
|
||||
vm_offset_t envp;
|
||||
vm_offset_t size;
|
||||
uint64_t scratch64;
|
||||
char *rootdevname;
|
||||
int howto;
|
||||
|
||||
align = kern64 ? 8 : 4;
|
||||
howto = md_getboothowto(args);
|
||||
|
||||
/*
|
||||
* Allow the environment variable 'rootdev' to override the supplied device
|
||||
* This should perhaps go to MI code and/or have $rootdev tested/set by
|
||||
* MI code before launching the kernel.
|
||||
*/
|
||||
rootdevname = getenv("rootdev");
|
||||
if (rootdevname == NULL)
|
||||
rootdevname = getenv("currdev");
|
||||
/* Try reading the /etc/fstab file to select the root device */
|
||||
getrootmount(rootdevname);
|
||||
|
||||
/* find the last module in the chain */
|
||||
addr = 0;
|
||||
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
|
||||
if (addr < (xp->f_addr + xp->f_size))
|
||||
addr = xp->f_addr + xp->f_size;
|
||||
}
|
||||
/* pad to a page boundary */
|
||||
addr = roundup(addr, PAGE_SIZE);
|
||||
|
||||
/* copy our environment */
|
||||
envp = addr;
|
||||
addr = md_copyenv(addr);
|
||||
|
||||
/* pad to a page boundary */
|
||||
addr = roundup(addr, PAGE_SIZE);
|
||||
|
||||
kernend = 0;
|
||||
kfp = file_findfile(NULL, kern64 ? "elf64 kernel" : "elf32 kernel");
|
||||
if (kfp == NULL)
|
||||
kfp = file_findfile(NULL, "elf kernel");
|
||||
if (kfp == NULL)
|
||||
panic("can't find kernel file");
|
||||
file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto);
|
||||
if (kern64) {
|
||||
scratch64 = envp;
|
||||
file_addmetadata(kfp, MODINFOMD_ENVP, sizeof scratch64, &scratch64);
|
||||
scratch64 = kernend;
|
||||
file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof scratch64, &scratch64);
|
||||
} else {
|
||||
file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp);
|
||||
file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend);
|
||||
}
|
||||
|
||||
*modulep = addr;
|
||||
size = md_copymodules(0, kern64);
|
||||
kernend = roundup(addr + size, PAGE_SIZE);
|
||||
|
||||
md = file_findmetadata(kfp, MODINFOMD_KERNEND);
|
||||
if (kern64) {
|
||||
scratch64 = kernend;
|
||||
bcopy(&scratch64, md->md_data, sizeof scratch64);
|
||||
} else {
|
||||
bcopy(&kernend, md->md_data, sizeof kernend);
|
||||
}
|
||||
|
||||
(void)md_copymodules(addr, kern64);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
md_load(char *args, vm_offset_t *modulep)
|
||||
{
|
||||
return (md_load_dual(args, modulep, 0));
|
||||
}
|
||||
|
||||
int
|
||||
md_load64(char *args, vm_offset_t *modulep)
|
||||
{
|
||||
return (md_load_dual(args, modulep, 1));
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Benno Rice <benno@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define __ELF_WORD_SIZE 64
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/linker.h>
|
||||
|
||||
#include <machine/metadata.h>
|
||||
#include <machine/elf.h>
|
||||
|
||||
#include <stand.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
|
||||
extern char end[];
|
||||
extern vm_offset_t reloc; /* From <arch>/conf.c */
|
||||
|
||||
int
|
||||
ppc64_elf_loadfile(char *filename, u_int64_t dest,
|
||||
struct preloaded_file **result)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = __elfN(loadfile)(filename, dest, result);
|
||||
if (r != 0)
|
||||
return (r);
|
||||
|
||||
/*
|
||||
* No need to sync the icache for modules: this will
|
||||
* be done by the kernel after relocation.
|
||||
*/
|
||||
if (!strcmp((*result)->f_type, "elf kernel"))
|
||||
__syncicache((void *) (*result)->f_addr, (*result)->f_size);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
ppc64_elf_exec(struct preloaded_file *fp)
|
||||
{
|
||||
struct file_metadata *fmp;
|
||||
vm_offset_t mdp;
|
||||
Elf_Ehdr *e;
|
||||
int error;
|
||||
int (*entry)(u_long, u_long, u_long, void *, u_long);
|
||||
|
||||
if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
|
||||
return(EFTYPE);
|
||||
}
|
||||
e = (Elf_Ehdr *)&fmp->md_data;
|
||||
|
||||
/* Handle function descriptor for ELFv1 kernels */
|
||||
if ((e->e_flags & 3) == 2)
|
||||
entry = e->e_entry;
|
||||
else
|
||||
entry = (void *)(uintptr_t)(*(uint64_t *)e->e_entry);
|
||||
|
||||
if ((error = md_load64(fp->f_args, &mdp)) != 0)
|
||||
return (error);
|
||||
|
||||
printf("Kernel entry at %p ...\n", entry);
|
||||
|
||||
dev_cleanup();
|
||||
|
||||
entry(0 /* FDT */, 0 /* Phys. mem offset */, 0 /* OF entry */,
|
||||
(void *)mdp, 0xfb5d104d);
|
||||
|
||||
panic("exec returned");
|
||||
}
|
||||
|
||||
struct file_format ppc_elf64 =
|
||||
{
|
||||
ppc64_elf_loadfile,
|
||||
ppc64_elf_exec
|
||||
};
|
@ -1,35 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _PS3_H
|
||||
#define _PS3_H
|
||||
|
||||
int ps3mmu_init(int maxmem);
|
||||
int ps3mmu_map(uint64_t va, uint64_t pa);
|
||||
void *ps3mmu_mapdev(uint64_t pa, size_t length);
|
||||
|
||||
#endif
|
@ -1,41 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _PS3_BUS_H
|
||||
#define _PS3_BUS_H
|
||||
|
||||
enum {
|
||||
PS3_BUS_TYPE_STOR = 5,
|
||||
};
|
||||
|
||||
enum {
|
||||
PS3_DEV_TYPE_STOR_DISK = 0,
|
||||
PS3_DEV_TYPE_STOR_CDROM = 5,
|
||||
PS3_DEV_TYPE_STOR_FLASH = 14,
|
||||
};
|
||||
|
||||
#endif
|
@ -1,156 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2011 glevand <geoffrey.levand@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/endian.h>
|
||||
#include <machine/stdarg.h>
|
||||
#include <stand.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
#include "ps3bus.h"
|
||||
#include "ps3devdesc.h"
|
||||
#include "ps3stor.h"
|
||||
|
||||
#define dev_printf(dev, fmt, args...) \
|
||||
printf("%s%d: " fmt "\n", dev->d_dev->dv_name, dev->d_unit, ##args)
|
||||
|
||||
#ifdef CD_DEBUG
|
||||
#define DEBUG(fmt, args...) printf("%s:%d: " fmt "\n", __func__, __LINE__, ##args)
|
||||
#else
|
||||
#define DEBUG(fmt, args...)
|
||||
#endif
|
||||
|
||||
static int ps3cdrom_init(void);
|
||||
static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk,
|
||||
size_t size, char *buf, size_t *rsize);
|
||||
static int ps3cdrom_open(struct open_file *f, ...);
|
||||
static int ps3cdrom_close(struct open_file *f);
|
||||
static int ps3cdrom_print(int verbose);
|
||||
|
||||
struct devsw ps3cdrom = {
|
||||
"cd",
|
||||
DEVT_CD,
|
||||
ps3cdrom_init,
|
||||
ps3cdrom_strategy,
|
||||
ps3cdrom_open,
|
||||
ps3cdrom_close,
|
||||
noioctl,
|
||||
ps3cdrom_print,
|
||||
};
|
||||
|
||||
static struct ps3_stordev stor_dev;
|
||||
|
||||
static int ps3cdrom_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = ps3stor_setup(&stor_dev, PS3_DEV_TYPE_STOR_CDROM);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk,
|
||||
size_t size, char *buf, size_t *rsize)
|
||||
{
|
||||
struct ps3_devdesc *dev = (struct ps3_devdesc *) devdata;
|
||||
int err;
|
||||
|
||||
DEBUG("d_unit=%u dblk=%llu size=%u", dev->d_unit, dblk, size);
|
||||
|
||||
flag &= F_MASK;
|
||||
if (flag != F_READ) {
|
||||
dev_printf(dev, "write operation is not supported!");
|
||||
return EROFS;
|
||||
}
|
||||
|
||||
if (dblk % (stor_dev.sd_blksize / DEV_BSIZE) != 0)
|
||||
return EINVAL;
|
||||
|
||||
dblk /= (stor_dev.sd_blksize / DEV_BSIZE);
|
||||
|
||||
if (size % stor_dev.sd_blksize) {
|
||||
dev_printf(dev,
|
||||
"size=%u is not multiple of device block size=%llu", size,
|
||||
stor_dev.sd_blksize);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (rsize)
|
||||
*rsize = 0;
|
||||
|
||||
err = ps3stor_read_sectors(&stor_dev, dev->d_unit, dblk,
|
||||
size / stor_dev.sd_blksize, 0, buf);
|
||||
|
||||
if (!err && rsize)
|
||||
*rsize = size;
|
||||
|
||||
if (err)
|
||||
dev_printf(dev,
|
||||
"read operation failed dblk=%llu size=%d err=%d", dblk,
|
||||
size, err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ps3cdrom_open(struct open_file *f, ...)
|
||||
{
|
||||
char buf[2048];
|
||||
va_list ap;
|
||||
struct ps3_devdesc *dev;
|
||||
int err;
|
||||
|
||||
va_start(ap, f);
|
||||
dev = va_arg(ap, struct ps3_devdesc *);
|
||||
va_end(ap);
|
||||
|
||||
if (dev->d_unit > 0) {
|
||||
dev_printf(dev, "attempt to open nonexistent disk");
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
err = ps3stor_read_sectors(&stor_dev, dev->d_unit, 16, 1, 0, buf);
|
||||
if (err)
|
||||
return EIO;
|
||||
|
||||
/* Do not attach if not ISO9660 (workaround for buggy firmware) */
|
||||
if (memcmp(buf, "\001CD001", 6) != 0)
|
||||
return EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ps3cdrom_close(struct open_file *f)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ps3cdrom_print(int verbose)
|
||||
{
|
||||
return (0);
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
#include "bootstrap.h"
|
||||
#include "font.h"
|
||||
#include "lv1call.h"
|
||||
#include "ps3.h"
|
||||
|
||||
#define FONT_SIZE 14
|
||||
#define FONT dflt_font_14
|
||||
#define XMARGIN 40
|
||||
#define YMARGIN 30
|
||||
#define BG_COLOR 0x00000000
|
||||
#define FG_COLOR 0xffffffff
|
||||
|
||||
#define FB_SIZE (16*1024*1024)
|
||||
uint64_t fb_paddr = 0;
|
||||
uint32_t *fb_vaddr;
|
||||
|
||||
int fb_width, fb_height;
|
||||
int x, y;
|
||||
|
||||
static void ps3cons_probe(struct console *cp);
|
||||
static int ps3cons_init(int arg);
|
||||
static void ps3cons_putchar(int c);
|
||||
static int ps3cons_getchar();
|
||||
static int ps3cons_poll();
|
||||
|
||||
struct console ps3console = {
|
||||
"ps3",
|
||||
"Playstation 3 Framebuffer",
|
||||
0,
|
||||
ps3cons_probe,
|
||||
ps3cons_init,
|
||||
ps3cons_putchar,
|
||||
ps3cons_getchar,
|
||||
ps3cons_poll,
|
||||
};
|
||||
|
||||
static void
|
||||
ps3cons_probe(struct console *cp)
|
||||
{
|
||||
/* XXX: Get from HV */
|
||||
fb_width = 720;
|
||||
fb_height = 480;
|
||||
|
||||
cp->c_flags |= C_PRESENTIN|C_PRESENTOUT;
|
||||
}
|
||||
|
||||
static int
|
||||
ps3cons_init(int arg)
|
||||
{
|
||||
uint64_t fbhandle, fbcontext;
|
||||
int i;
|
||||
|
||||
lv1_gpu_open(0);
|
||||
lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_MODE_SET,
|
||||
0,0,0,0);
|
||||
lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_MODE_SET,
|
||||
0,0,1,0);
|
||||
lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
|
||||
0,L1GPU_DISPLAY_SYNC_VSYNC,0,0);
|
||||
lv1_gpu_context_attribute(0, L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC,
|
||||
1,L1GPU_DISPLAY_SYNC_VSYNC,0,0);
|
||||
lv1_gpu_memory_allocate(FB_SIZE, 0, 0, 0, 0, &fbhandle, &fb_paddr);
|
||||
lv1_gpu_context_allocate(fbhandle, 0, &fbcontext);
|
||||
|
||||
lv1_gpu_context_attribute(fbcontext,
|
||||
L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 0, 0, 0, 0);
|
||||
lv1_gpu_context_attribute(fbcontext,
|
||||
L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 1, 0, 0, 0);
|
||||
|
||||
fb_vaddr = ps3mmu_mapdev(fb_paddr, FB_SIZE);
|
||||
|
||||
x = y = 0;
|
||||
|
||||
/* Blank console */
|
||||
for (i = 0; i < fb_width*fb_height; i++)
|
||||
fb_vaddr[i] = BG_COLOR;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
ps3cons_putchar(int c)
|
||||
{
|
||||
uint32_t fg, bg;
|
||||
uint32_t *addr;
|
||||
int i, j, k;
|
||||
u_char *p;
|
||||
|
||||
fg = FG_COLOR;
|
||||
bg = BG_COLOR;
|
||||
|
||||
switch (c) {
|
||||
case '\0':
|
||||
break;
|
||||
case '\r':
|
||||
x = 0;
|
||||
break;
|
||||
case '\n':
|
||||
y += FONT_SIZE;
|
||||
break;
|
||||
case '\b':
|
||||
x = max(0, x - 8);
|
||||
break;
|
||||
default:
|
||||
/* Wrap long lines */
|
||||
if (x + XMARGIN + FONT_SIZE > fb_width - XMARGIN) {
|
||||
y += FONT_SIZE;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if (y + YMARGIN + FONT_SIZE > fb_height - YMARGIN)
|
||||
y = 0;
|
||||
|
||||
addr = fb_vaddr + (y + YMARGIN)*fb_width + (x + XMARGIN);
|
||||
p = FONT + c*FONT_SIZE;
|
||||
|
||||
for (i = 0; i < FONT_SIZE; i++) {
|
||||
for (j = 0, k = 7; j < 8; j++, k--) {
|
||||
if ((p[i] & (1 << k)) == 0)
|
||||
*(addr + j) = bg;
|
||||
else
|
||||
*(addr + j) = fg;
|
||||
}
|
||||
|
||||
addr += fb_width;
|
||||
}
|
||||
|
||||
x += 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
ps3cons_getchar()
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static int
|
||||
ps3cons_poll()
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2000 Benno Rice.
|
||||
* Copyright (C) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com>
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _PS3_DEV_DESC_H
|
||||
#define _PS3_DEV_DESC_H
|
||||
|
||||
/* Note: Must match the 'struct devdesc' in bootstrap.h */
|
||||
struct ps3_devdesc {
|
||||
struct devsw *d_dev;
|
||||
int d_type;
|
||||
int d_unit;
|
||||
|
||||
union {
|
||||
struct {
|
||||
void *data;
|
||||
int pnum;
|
||||
int ptype;
|
||||
} disk;
|
||||
} d_kind;
|
||||
};
|
||||
|
||||
#define d_disk d_kind.disk
|
||||
|
||||
#define PTYPE_BSDLABEL 1
|
||||
#define PTYPE_GPT 2
|
||||
|
||||
#endif
|
@ -1,315 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2008 Semihalf, Rafal Jaworowski
|
||||
* Copyright (C) 2009 Semihalf, Piotr Ziecik
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/endian.h>
|
||||
#include <machine/stdarg.h>
|
||||
#include <stand.h>
|
||||
#include <uuid.h>
|
||||
|
||||
#define FSTYPENAMES
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/diskmbr.h>
|
||||
#include <sys/gpt.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
#include "ps3bus.h"
|
||||
#include "ps3devdesc.h"
|
||||
#include "ps3stor.h"
|
||||
|
||||
#define dev_printf(dev, fmt, args...) \
|
||||
printf("%s%d: " fmt "\n" , dev->d_dev->dv_name, dev->d_unit, ##args)
|
||||
|
||||
#ifdef DISK_DEBUG
|
||||
#define DEBUG(fmt, args...) printf("%s:%d: " fmt "\n" , __func__ , __LINE__, ##args)
|
||||
#else
|
||||
#define DEBUG(fmt, args...)
|
||||
#endif
|
||||
|
||||
struct open_dev;
|
||||
|
||||
static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev *od);
|
||||
static void ps3disk_uuid_letoh(uuid_t *uuid);
|
||||
|
||||
static int ps3disk_init(void);
|
||||
static int ps3disk_strategy(void *devdata, int flag, daddr_t dblk,
|
||||
size_t size, char *buf, size_t *rsize);
|
||||
static int ps3disk_open(struct open_file *f, ...);
|
||||
static int ps3disk_close(struct open_file *f);
|
||||
static int ps3disk_print(int verbose);
|
||||
|
||||
struct devsw ps3disk = {
|
||||
"disk",
|
||||
DEVT_DISK,
|
||||
ps3disk_init,
|
||||
ps3disk_strategy,
|
||||
ps3disk_open,
|
||||
ps3disk_close,
|
||||
noioctl,
|
||||
ps3disk_print,
|
||||
};
|
||||
|
||||
struct gpt_part {
|
||||
int gp_index;
|
||||
uuid_t gp_type;
|
||||
uint64_t gp_start;
|
||||
uint64_t gp_end;
|
||||
};
|
||||
|
||||
struct open_dev {
|
||||
uint64_t od_start;
|
||||
|
||||
union {
|
||||
struct {
|
||||
int nparts;
|
||||
struct gpt_part *parts;
|
||||
} gpt;
|
||||
} od_kind;
|
||||
};
|
||||
|
||||
#define od_gpt_nparts od_kind.gpt.nparts
|
||||
#define od_gpt_parts od_kind.gpt.parts
|
||||
|
||||
static struct ps3_stordev stor_dev;
|
||||
|
||||
static int ps3disk_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = ps3stor_setup(&stor_dev, PS3_DEV_TYPE_STOR_DISK);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ps3disk_strategy(void *devdata, int flag, daddr_t dblk,
|
||||
size_t size, char *buf, size_t *rsize)
|
||||
{
|
||||
struct ps3_devdesc *dev = (struct ps3_devdesc *) devdata;
|
||||
struct open_dev *od = (struct open_dev *) dev->d_disk.data;
|
||||
int err;
|
||||
|
||||
flag &= F_MASK;
|
||||
if (flag != F_READ) {
|
||||
dev_printf(dev, "write operation is not supported!\n");
|
||||
return EROFS;
|
||||
}
|
||||
|
||||
if (size % stor_dev.sd_blksize) {
|
||||
dev_printf(dev, "size=%u is not multiple of device block size=%llu\n",
|
||||
size, stor_dev.sd_blksize);
|
||||
return EIO;
|
||||
}
|
||||
|
||||
if (rsize)
|
||||
*rsize = 0;
|
||||
|
||||
err = ps3stor_read_sectors(&stor_dev, dev->d_unit, od->od_start + dblk,
|
||||
size / stor_dev.sd_blksize, 0, buf);
|
||||
|
||||
if (!err && rsize)
|
||||
*rsize = size;
|
||||
|
||||
if (err)
|
||||
dev_printf(dev, "read operation failed dblk=%llu size=%d err=%d\n",
|
||||
dblk, size, err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ps3disk_open(struct open_file *f, ...)
|
||||
{
|
||||
va_list ap;
|
||||
struct ps3_devdesc *dev;
|
||||
struct open_dev *od;
|
||||
int err;
|
||||
|
||||
va_start(ap, f);
|
||||
dev = va_arg(ap, struct ps3_devdesc *);
|
||||
va_end(ap);
|
||||
|
||||
od = malloc(sizeof(struct open_dev));
|
||||
if (!od) {
|
||||
dev_printf(dev, "couldn't allocate memory for new open_dev\n");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
err = ps3disk_open_gpt(dev, od);
|
||||
|
||||
if (err) {
|
||||
dev_printf(dev, "couldn't open GPT disk error=%d\n", err);
|
||||
free(od);
|
||||
} else {
|
||||
((struct ps3_devdesc *) (f->f_devdata))->d_disk.data = od;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ps3disk_close(struct open_file *f)
|
||||
{
|
||||
struct ps3_devdesc *dev = f->f_devdata;
|
||||
struct open_dev *od = dev->d_disk.data;
|
||||
|
||||
if (dev->d_disk.ptype == PTYPE_GPT && od->od_gpt_nparts)
|
||||
free(od->od_gpt_parts);
|
||||
|
||||
free(od);
|
||||
|
||||
dev->d_disk.data = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ps3disk_print(int verbose)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int ps3disk_open_gpt(struct ps3_devdesc *dev, struct open_dev *od)
|
||||
{
|
||||
char buf[512];
|
||||
struct gpt_hdr *hdr;
|
||||
struct gpt_ent *ent;
|
||||
daddr_t slba, elba, lba;
|
||||
int nparts, eps, i, part, err;
|
||||
|
||||
od->od_gpt_nparts = 0;
|
||||
od->od_gpt_parts = NULL;
|
||||
|
||||
err = ps3stor_read_sectors(&stor_dev, dev->d_unit, 0, 1, 0, buf);
|
||||
if (err) {
|
||||
err = EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (le16toh(*((uint16_t *) (buf + DOSMAGICOFFSET))) != DOSMAGIC) {
|
||||
err = ENXIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = ps3stor_read_sectors(&stor_dev, dev->d_unit, 1, 1, 0, buf);
|
||||
if (err) {
|
||||
err = EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
hdr = (struct gpt_hdr *) buf;
|
||||
|
||||
if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) ||
|
||||
le64toh(hdr->hdr_lba_self) != 1 || le32toh(hdr->hdr_revision) < 0x00010000 ||
|
||||
le32toh(hdr->hdr_entsz) < sizeof(struct gpt_ent) ||
|
||||
stor_dev.sd_blksize % le32toh(hdr->hdr_entsz) != 0) {
|
||||
err = ENXIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
nparts = 0;
|
||||
eps = stor_dev.sd_blksize / le32toh(hdr->hdr_entsz);
|
||||
slba = le64toh(hdr->hdr_lba_table);
|
||||
elba = slba + le32toh(hdr->hdr_entries) / eps;
|
||||
|
||||
for (lba = slba; lba < elba; lba++) {
|
||||
err = ps3stor_read_sectors(&stor_dev, dev->d_unit, lba, 1, 0, buf);
|
||||
if (err) {
|
||||
err = EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ent = (struct gpt_ent *) buf;
|
||||
|
||||
for (i = 0; i < eps; i++) {
|
||||
if (uuid_is_nil(&ent[i].ent_type, NULL) ||
|
||||
le64toh(ent[i].ent_lba_start) == 0 ||
|
||||
le64toh(ent[i].ent_lba_end) < le64toh(ent[i].ent_lba_start))
|
||||
continue;
|
||||
|
||||
nparts++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nparts) {
|
||||
od->od_gpt_nparts = nparts;
|
||||
|
||||
od->od_gpt_parts = malloc(nparts * sizeof(struct gpt_part));
|
||||
if (!od->od_gpt_parts) {
|
||||
err = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (lba = slba, part = 0; lba < elba; lba++) {
|
||||
err = ps3stor_read_sectors(&stor_dev, dev->d_unit, lba, 1, 0, buf);
|
||||
if (err) {
|
||||
err = EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ent = (struct gpt_ent *) buf;
|
||||
|
||||
for (i = 0; i < eps; i++) {
|
||||
if (uuid_is_nil(&ent[i].ent_type, NULL) ||
|
||||
le64toh(ent[i].ent_lba_start) == 0 ||
|
||||
le64toh(ent[i].ent_lba_end) < le64toh(ent[i].ent_lba_start))
|
||||
continue;
|
||||
|
||||
od->od_gpt_parts[part].gp_index = (lba - slba) * eps + i + 1;
|
||||
od->od_gpt_parts[part].gp_type = ent[i].ent_type;
|
||||
od->od_gpt_parts[part].gp_start = le64toh(ent[i].ent_lba_start);
|
||||
od->od_gpt_parts[part].gp_end = le64toh(ent[i].ent_lba_end);
|
||||
ps3disk_uuid_letoh(&od->od_gpt_parts[part].gp_type);
|
||||
part++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dev->d_disk.ptype = PTYPE_GPT;
|
||||
|
||||
if (od->od_gpt_nparts && !dev->d_disk.pnum)
|
||||
dev->d_disk.pnum = od->od_gpt_parts[0].gp_index;
|
||||
|
||||
for (i = 0; i < od->od_gpt_nparts; i++)
|
||||
if (od->od_gpt_parts[i].gp_index == dev->d_disk.pnum)
|
||||
od->od_start = od->od_gpt_parts[i].gp_start;
|
||||
|
||||
err = 0;
|
||||
|
||||
out:
|
||||
|
||||
if (err && od->od_gpt_parts)
|
||||
free(od->od_gpt_parts);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ps3disk_uuid_letoh(uuid_t *uuid)
|
||||
{
|
||||
uuid->time_low = le32toh(uuid->time_low);
|
||||
uuid->time_mid = le16toh(uuid->time_mid);
|
||||
uuid->time_hi_and_version = le16toh(uuid->time_hi_and_version);
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define _KERNEL
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/slb.h>
|
||||
#include <machine/param.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
#include "lv1call.h"
|
||||
#include "ps3.h"
|
||||
|
||||
register_t pteg_count, pteg_mask;
|
||||
uint64_t as_id;
|
||||
uint64_t virtual_avail;
|
||||
|
||||
int
|
||||
ps3mmu_map(uint64_t va, uint64_t pa)
|
||||
{
|
||||
struct lpte pt;
|
||||
int shift;
|
||||
uint64_t vsid, ptegidx;
|
||||
|
||||
if (pa < 0x8000000) { /* Phys mem? */
|
||||
pt.pte_hi = LPTE_BIG;
|
||||
pt.pte_lo = LPTE_M;
|
||||
shift = 24;
|
||||
vsid = 0;
|
||||
} else {
|
||||
pt.pte_hi = 0;
|
||||
pt.pte_lo = LPTE_I | LPTE_G | LPTE_M | LPTE_NOEXEC;
|
||||
shift = ADDR_PIDX_SHFT;
|
||||
vsid = 1;
|
||||
}
|
||||
|
||||
pt.pte_hi |= (vsid << LPTE_VSID_SHIFT) |
|
||||
(((uint64_t)(va & ADDR_PIDX) >> ADDR_API_SHFT64) & LPTE_API);
|
||||
pt.pte_lo |= pa;
|
||||
ptegidx = vsid ^ (((uint64_t)va & ADDR_PIDX) >> shift);
|
||||
|
||||
pt.pte_hi |= LPTE_LOCKED | LPTE_VALID;
|
||||
ptegidx &= pteg_mask;
|
||||
|
||||
return (lv1_insert_pte(ptegidx, &pt, LPTE_LOCKED));
|
||||
}
|
||||
|
||||
void *
|
||||
ps3mmu_mapdev(uint64_t pa, size_t length)
|
||||
{
|
||||
uint64_t spa;
|
||||
void *mapstart;
|
||||
int err;
|
||||
|
||||
mapstart = (void *)(uintptr_t)virtual_avail;
|
||||
|
||||
for (spa = pa; spa < pa + length; spa += PAGE_SIZE) {
|
||||
err = ps3mmu_map(virtual_avail, spa);
|
||||
virtual_avail += PAGE_SIZE;
|
||||
if (err != 0)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (mapstart);
|
||||
}
|
||||
|
||||
int
|
||||
ps3mmu_init(int maxmem)
|
||||
{
|
||||
uint64_t ptsize;
|
||||
int i;
|
||||
|
||||
i = lv1_setup_address_space(&as_id, &ptsize);
|
||||
pteg_count = ptsize / sizeof(struct lpteg);
|
||||
pteg_mask = pteg_count - 1;
|
||||
|
||||
for (i = 0; i < maxmem; i += 16*1024*1024)
|
||||
ps3mmu_map(i,i);
|
||||
|
||||
virtual_avail = 0x10000000;
|
||||
|
||||
__asm __volatile ("slbia; slbmte %0, %1; slbmte %2,%3" ::
|
||||
"r"((0 << SLBV_VSID_SHIFT) | SLBV_L), "r"(0 | SLBE_VALID),
|
||||
"r"(1 << SLBV_VSID_SHIFT),
|
||||
"r"((1 << SLBE_ESID_SHIFT) | SLBE_VALID | 1));
|
||||
|
||||
mtmsr(PSL_IR | PSL_DR | PSL_RI | PSL_ME);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,278 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#define _KERNEL
|
||||
#include <machine/cpufunc.h>
|
||||
|
||||
#include <stand.h>
|
||||
#include <net.h>
|
||||
#include <netif.h>
|
||||
#include "bootstrap.h"
|
||||
#include "lv1call.h"
|
||||
#include "ps3.h"
|
||||
|
||||
#define GELIC_DESCR_OWNED 0xa0000000
|
||||
#define GELIC_CMDSTAT_NOIPSEC 0x00080000
|
||||
#define GELIC_CMDSTAT_LAST 0x00040000
|
||||
#define GELIC_RXERRORS 0x7def8000
|
||||
|
||||
#define GELIC_POLL_PERIOD 100 /* microseconds */
|
||||
|
||||
static int ps3net_probe(struct netif *, void *);
|
||||
static int ps3net_match(struct netif *, void *);
|
||||
static void ps3net_init(struct iodesc *, void *);
|
||||
static int ps3net_get(struct iodesc *, void *, size_t, time_t);
|
||||
static int ps3net_put(struct iodesc *, void *, size_t);
|
||||
static void ps3net_end(struct netif *);
|
||||
|
||||
struct netif_stats ps3net_stats[1];
|
||||
struct netif_dif ps3net_ifs[] = {{0, 1, ps3net_stats, 0}};
|
||||
|
||||
/* XXX: Get from firmware, not hardcoding */
|
||||
static int busid = 1;
|
||||
static int devid = 0;
|
||||
static int vlan;
|
||||
static uint64_t dma_base;
|
||||
|
||||
struct gelic_dmadesc {
|
||||
uint32_t paddr;
|
||||
uint32_t len;
|
||||
uint32_t next;
|
||||
uint32_t cmd_stat;
|
||||
uint32_t result_size;
|
||||
uint32_t valid_size;
|
||||
uint32_t data_stat;
|
||||
uint32_t rxerror;
|
||||
};
|
||||
|
||||
struct netif_driver ps3net = {
|
||||
"net",
|
||||
ps3net_match,
|
||||
ps3net_probe,
|
||||
ps3net_init,
|
||||
ps3net_get,
|
||||
ps3net_put,
|
||||
ps3net_end,
|
||||
ps3net_ifs, 1
|
||||
};
|
||||
|
||||
static int
|
||||
ps3net_match(struct netif *nif, void *machdep_hint)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
ps3net_probe(struct netif *nif, void *machdep_hint)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
ps3net_put(struct iodesc *desc, void *pkt, size_t len)
|
||||
{
|
||||
volatile static struct gelic_dmadesc txdesc __aligned(32);
|
||||
volatile static char txbuf[1536] __aligned(128);
|
||||
size_t sendlen;
|
||||
int err;
|
||||
|
||||
#if defined(NETIF_DEBUG)
|
||||
struct ether_header *eh;
|
||||
|
||||
printf("net_put: desc %p, pkt %p, len %d\n", desc, pkt, len);
|
||||
eh = pkt;
|
||||
printf("dst: %s ", ether_sprintf(eh->ether_dhost));
|
||||
printf("src: %s ", ether_sprintf(eh->ether_shost));
|
||||
printf("type: 0x%x\n", eh->ether_type & 0xffff);
|
||||
#endif
|
||||
|
||||
while (txdesc.cmd_stat & GELIC_DESCR_OWNED) {
|
||||
printf("Stalled XMIT!\n");
|
||||
delay(10);
|
||||
}
|
||||
|
||||
/*
|
||||
* We must add 4 extra bytes to this packet to store the destination
|
||||
* VLAN.
|
||||
*/
|
||||
memcpy(txbuf, pkt, 12);
|
||||
sendlen = 12;
|
||||
|
||||
if (vlan >= 0) {
|
||||
sendlen += 4;
|
||||
((uint8_t *)txbuf)[12] = 0x81;
|
||||
((uint8_t *)txbuf)[13] = 0x00;
|
||||
((uint8_t *)txbuf)[14] = vlan >> 8;
|
||||
((uint8_t *)txbuf)[15] = vlan & 0xff;
|
||||
}
|
||||
memcpy((void *)txbuf + sendlen, pkt + 12, len - 12);
|
||||
sendlen += len - 12;
|
||||
|
||||
bzero(&txdesc, sizeof(txdesc));
|
||||
txdesc.paddr = dma_base + (uint32_t)txbuf;
|
||||
txdesc.len = sendlen;
|
||||
txdesc.cmd_stat = GELIC_CMDSTAT_NOIPSEC | GELIC_CMDSTAT_LAST |
|
||||
GELIC_DESCR_OWNED;
|
||||
|
||||
powerpc_sync();
|
||||
|
||||
do {
|
||||
err = lv1_net_start_tx_dma(busid, devid,
|
||||
dma_base + (uint32_t)&txdesc, 0);
|
||||
delay(1);
|
||||
if (err != 0)
|
||||
printf("TX Error: %d\n",err);
|
||||
} while (err != 0);
|
||||
|
||||
return (len);
|
||||
}
|
||||
|
||||
static int
|
||||
ps3net_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
|
||||
{
|
||||
volatile static struct gelic_dmadesc rxdesc __aligned(32);
|
||||
volatile static char rxbuf[1536] __aligned(128);
|
||||
int err = 0;
|
||||
|
||||
if (len == 0)
|
||||
goto restartdma;
|
||||
|
||||
timeout *= 1000000; /* convert to microseconds */
|
||||
while (rxdesc.cmd_stat & GELIC_DESCR_OWNED) {
|
||||
if (timeout < GELIC_POLL_PERIOD)
|
||||
return (ETIMEDOUT);
|
||||
delay(GELIC_POLL_PERIOD);
|
||||
timeout -= GELIC_POLL_PERIOD;
|
||||
}
|
||||
|
||||
delay(200);
|
||||
if (rxdesc.rxerror & GELIC_RXERRORS) {
|
||||
err = -1;
|
||||
goto restartdma;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the packet to the receive buffer, leaving out the
|
||||
* 2 byte VLAN header.
|
||||
*/
|
||||
len = min(len, rxdesc.valid_size - 2);
|
||||
memcpy(pkt, (u_char *)rxbuf + 2, len);
|
||||
err = len;
|
||||
|
||||
#if defined(NETIF_DEBUG)
|
||||
{
|
||||
struct ether_header *eh;
|
||||
|
||||
printf("net_get: desc %p, pkt %p, len %d\n", desc, pkt, len);
|
||||
eh = pkt;
|
||||
printf("dst: %s ", ether_sprintf(eh->ether_dhost));
|
||||
printf("src: %s ", ether_sprintf(eh->ether_shost));
|
||||
printf("type: 0x%x\n", eh->ether_type & 0xffff);
|
||||
}
|
||||
#endif
|
||||
|
||||
restartdma:
|
||||
lv1_net_stop_rx_dma(busid, devid, 0);
|
||||
powerpc_sync();
|
||||
|
||||
bzero(&rxdesc, sizeof(rxdesc));
|
||||
rxdesc.paddr = dma_base + (uint32_t)rxbuf;
|
||||
rxdesc.len = sizeof(rxbuf);
|
||||
rxdesc.next = 0;
|
||||
rxdesc.cmd_stat = GELIC_DESCR_OWNED;
|
||||
powerpc_sync();
|
||||
|
||||
lv1_net_start_rx_dma(busid, devid, dma_base + (uint32_t)&rxdesc, 0);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
static void
|
||||
ps3net_init(struct iodesc *desc, void *machdep_hint)
|
||||
{
|
||||
uint64_t mac, val;
|
||||
int i,err;
|
||||
|
||||
err = lv1_open_device(busid, devid, 0);
|
||||
|
||||
lv1_net_stop_tx_dma(busid, devid, 0);
|
||||
lv1_net_stop_rx_dma(busid, devid, 0);
|
||||
|
||||
/*
|
||||
* Wait for link to come up
|
||||
*/
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
lv1_net_control(busid, devid, GELIC_GET_LINK_STATUS, 2, 0,
|
||||
0, &val);
|
||||
if (val & GELIC_LINK_UP)
|
||||
break;
|
||||
delay(500);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up DMA IOMMU entries
|
||||
*/
|
||||
|
||||
err = lv1_setup_dma(busid, devid, &dma_base);
|
||||
|
||||
/*
|
||||
* Get MAC address and VLAN IDs
|
||||
*/
|
||||
|
||||
lv1_net_control(busid, devid, GELIC_GET_MAC_ADDRESS, 0, 0, 0, &mac);
|
||||
bcopy(&((uint8_t *)&mac)[2], desc->myea, sizeof(desc->myea));
|
||||
|
||||
vlan = -1;
|
||||
err = lv1_net_control(busid, devid, GELIC_GET_VLAN_ID, 2, 0,
|
||||
0, &val);
|
||||
if (err == 0)
|
||||
vlan = val;
|
||||
|
||||
/*
|
||||
* Start RX DMA engine
|
||||
*/
|
||||
|
||||
ps3net_get(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
ps3net_end(struct netif *nif)
|
||||
{
|
||||
lv1_close_device(busid, devid);
|
||||
}
|
||||
|
@ -1,249 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <stand.h>
|
||||
|
||||
#include "lv1call.h"
|
||||
#include "ps3.h"
|
||||
#include "ps3repo.h"
|
||||
|
||||
static uint64_t make_n1(const char *text, unsigned int index)
|
||||
{
|
||||
uint64_t n1;
|
||||
|
||||
n1 = 0;
|
||||
strncpy((char *) &n1, text, sizeof(n1));
|
||||
n1 = (n1 >> 32) + index;
|
||||
|
||||
return n1;
|
||||
}
|
||||
|
||||
static uint64_t make_n(const char *text, unsigned int index)
|
||||
{
|
||||
uint64_t n;
|
||||
|
||||
n = 0;
|
||||
strncpy((char *) &n, text, sizeof(n));
|
||||
n = n + index;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_type(unsigned int bus_index, uint64_t *bus_type)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("type", 0), 0, 0, &v1, &v2);
|
||||
|
||||
*bus_type = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_id(unsigned int bus_index, uint64_t *bus_id)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("id", 0), 0, 0, &v1, &v2);
|
||||
|
||||
*bus_id = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_num_dev(unsigned int bus_index, uint64_t *num_dev)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("num_dev", 0), 0, 0, &v1, &v2);
|
||||
|
||||
*num_dev = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_type(unsigned int bus_index, unsigned int dev_index, uint64_t *dev_type)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("type", 0), 0, &v1, &v2);
|
||||
|
||||
*dev_type = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_id(unsigned int bus_index, unsigned int dev_index, uint64_t *dev_id)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("id", 0), 0, &v1, &v2);
|
||||
|
||||
*dev_id = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_blk_size(unsigned int bus_index, unsigned int dev_index, uint64_t *blk_size)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("blk_size", 0), 0, &v1, &v2);
|
||||
|
||||
*blk_size = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_nblocks(unsigned int bus_index, unsigned int dev_index, uint64_t *nblocks)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("n_blocks", 0), 0, &v1, &v2);
|
||||
|
||||
*nblocks = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_nregs(unsigned int bus_index, unsigned int dev_index, uint64_t *nregs)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("n_regs", 0), 0, &v1, &v2);
|
||||
|
||||
*nregs = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_reg_id(unsigned int bus_index, unsigned int dev_index,
|
||||
unsigned int reg_index, uint64_t *reg_id)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("region", reg_index), make_n("id", 0), &v1, &v2);
|
||||
|
||||
*reg_id = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_reg_start(unsigned int bus_index, unsigned int dev_index,
|
||||
unsigned int reg_index, uint64_t *reg_start)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("region", reg_index), make_n("start", 0), &v1, &v2);
|
||||
|
||||
*reg_start = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_read_bus_dev_reg_size(unsigned int bus_index, unsigned int dev_index,
|
||||
unsigned int reg_index, uint64_t *reg_size)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int err;
|
||||
|
||||
err = lv1_get_repository_node_value(PS3_LPAR_ID_PME, make_n1("bus", bus_index),
|
||||
make_n("dev", dev_index), make_n("region", reg_index), make_n("size", 0), &v1, &v2);
|
||||
|
||||
*reg_size = v1;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ps3repo_find_bus_by_type(uint64_t bus_type, unsigned int *bus_index)
|
||||
{
|
||||
unsigned int i;
|
||||
uint64_t type;
|
||||
int err;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
err = ps3repo_read_bus_type(i, &type);
|
||||
if (err) {
|
||||
*bus_index = (unsigned int) -1;
|
||||
return err;
|
||||
}
|
||||
|
||||
if (type == bus_type) {
|
||||
*bus_index = i;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*bus_index = (unsigned int) -1;
|
||||
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
int ps3repo_find_bus_dev_by_type(unsigned int bus_index, uint64_t dev_type,
|
||||
unsigned int *dev_index)
|
||||
{
|
||||
unsigned int i;
|
||||
uint64_t type;
|
||||
int err;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
err = ps3repo_read_bus_dev_type(bus_index, i, &type);
|
||||
if (err) {
|
||||
*dev_index = (unsigned int) -1;
|
||||
return err;
|
||||
}
|
||||
|
||||
if (type == dev_type) {
|
||||
*dev_index = i;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*dev_index = (unsigned int) -1;
|
||||
|
||||
return ENODEV;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _PS3_REPO_H
|
||||
#define _PS3_REPO_H
|
||||
|
||||
#define PS3_LPAR_ID_PME 1
|
||||
|
||||
int ps3repo_read_bus_type(unsigned int bus_index, uint64_t *bus_type);
|
||||
int ps3repo_read_bus_id(unsigned int bus_index, uint64_t *bus_id);
|
||||
int ps3repo_read_bus_num_dev(unsigned int bus_index, uint64_t *num_dev);
|
||||
int ps3repo_read_bus_dev_type(unsigned int bus_index, unsigned int dev_index, uint64_t *dev_type);
|
||||
int ps3repo_read_bus_dev_id(unsigned int bus_index, unsigned int dev_index, uint64_t *dev_id);
|
||||
int ps3repo_read_bus_dev_blk_size(unsigned int bus_index, unsigned int dev_index, uint64_t *blk_size);
|
||||
int ps3repo_read_bus_dev_nblocks(unsigned int bus_index, unsigned int dev_index, uint64_t *nblocks);
|
||||
int ps3repo_read_bus_dev_nregs(unsigned int bus_index, unsigned int dev_index, uint64_t *nregs);
|
||||
int ps3repo_read_bus_dev_reg_id(unsigned int bus_index, unsigned int dev_index,
|
||||
unsigned int reg_index, uint64_t *reg_id);
|
||||
int ps3repo_read_bus_dev_reg_start(unsigned int bus_index, unsigned int dev_index,
|
||||
unsigned int reg_index, uint64_t *reg_start);
|
||||
int ps3repo_read_bus_dev_reg_size(unsigned int bus_index, unsigned int dev_index,
|
||||
unsigned int reg_index, uint64_t *reg_size);
|
||||
int ps3repo_find_bus_by_type(uint64_t bus_type, unsigned int *bus_index);
|
||||
int ps3repo_find_bus_dev_by_type(unsigned int bus_index, uint64_t dev_type,
|
||||
unsigned int *dev_index);
|
||||
|
||||
#endif
|
@ -1,176 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <stand.h>
|
||||
|
||||
#include "bootstrap.h"
|
||||
#include "lv1call.h"
|
||||
#include "ps3bus.h"
|
||||
#include "ps3repo.h"
|
||||
#include "ps3stor.h"
|
||||
|
||||
int ps3stor_setup(struct ps3_stordev *sd, int type)
|
||||
{
|
||||
unsigned int i;
|
||||
int err;
|
||||
|
||||
sd->sd_type = type;
|
||||
|
||||
err = ps3repo_find_bus_by_type(PS3_BUS_TYPE_STOR, &sd->sd_busidx);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_read_bus_id(sd->sd_busidx, &sd->sd_busid);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_find_bus_dev_by_type(sd->sd_busidx, type, &sd->sd_devidx);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_read_bus_dev_id(sd->sd_busidx, sd->sd_devidx,
|
||||
&sd->sd_devid);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_read_bus_dev_blk_size(sd->sd_busidx, sd->sd_devidx,
|
||||
&sd->sd_blksize);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_read_bus_dev_nblocks(sd->sd_busidx, sd->sd_devidx,
|
||||
&sd->sd_nblocks);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_read_bus_dev_nregs(sd->sd_busidx, sd->sd_devidx,
|
||||
&sd->sd_nregs);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < sd->sd_nregs; i++) {
|
||||
err = ps3repo_read_bus_dev_reg_id(sd->sd_busidx, sd->sd_devidx,
|
||||
i, &sd->sd_regs[i].sr_id);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_read_bus_dev_reg_start(sd->sd_busidx,
|
||||
sd->sd_devidx, i, &sd->sd_regs[i].sr_start);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = ps3repo_read_bus_dev_reg_size(sd->sd_busidx,
|
||||
sd->sd_devidx, i, &sd->sd_regs[i].sr_size);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!sd->sd_nregs) {
|
||||
err = ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = lv1_open_device(sd->sd_busid, sd->sd_devid, 0);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = lv1_setup_dma(sd->sd_busid, sd->sd_devid, &sd->sd_dmabase);
|
||||
if (err)
|
||||
goto close_dev;
|
||||
|
||||
return 0;
|
||||
|
||||
close_dev:
|
||||
|
||||
lv1_close_device(sd->sd_busid, sd->sd_devid);
|
||||
|
||||
out:
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static char dma_buf[2048] __aligned(2048);
|
||||
|
||||
int ps3stor_read_sectors(struct ps3_stordev *sd, int regidx,
|
||||
uint64_t start_sector, uint64_t sector_count, uint64_t flags, char *buf)
|
||||
{
|
||||
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
|
||||
#define BOUNCE_SECTORS (sizeof(dma_buf) / sd->sd_blksize)
|
||||
#define ASYNC_STATUS_POLL_PERIOD 100 /* microseconds */
|
||||
|
||||
struct ps3_storreg *reg = &sd->sd_regs[regidx];
|
||||
uint64_t nleft, nread, nsectors;
|
||||
uint64_t tag, status;
|
||||
unsigned int timeout;
|
||||
int err = 0;
|
||||
|
||||
nleft = sector_count;
|
||||
nread = 0;
|
||||
|
||||
while (nleft) {
|
||||
nsectors = MIN(nleft, BOUNCE_SECTORS);
|
||||
|
||||
err = lv1_storage_read(sd->sd_devid, reg->sr_id,
|
||||
start_sector + nread, nsectors, flags, (uint32_t)dma_buf,
|
||||
&tag);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
timeout = 5000000; /* microseconds */
|
||||
|
||||
while (1) {
|
||||
if (timeout < ASYNC_STATUS_POLL_PERIOD)
|
||||
return ETIMEDOUT;
|
||||
|
||||
err = lv1_storage_check_async_status(sd->sd_devid, tag,
|
||||
&status);
|
||||
if (!err && !status)
|
||||
break;
|
||||
|
||||
delay(ASYNC_STATUS_POLL_PERIOD);
|
||||
timeout -= ASYNC_STATUS_POLL_PERIOD;
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
return EIO;
|
||||
|
||||
memcpy(buf + nread * sd->sd_blksize, (u_char *)dma_buf,
|
||||
nsectors * sd->sd_blksize);
|
||||
nread += nsectors;
|
||||
nleft -= nsectors;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
#undef MIN
|
||||
#undef BOUNCE_SECTORS
|
||||
#undef ASYNC_STATUS_POLL_PERIOD
|
||||
}
|
||||
|
||||
void ps3stor_print(struct ps3_stordev *sd)
|
||||
{
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2011 glevand (geoffrey.levand@mail.ru)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _PS3_STOR_H
|
||||
#define _PS3_STOR_H
|
||||
|
||||
#define PS3_STOR_DEV_MAXREGS 8
|
||||
|
||||
struct ps3_storreg {
|
||||
uint64_t sr_id;
|
||||
uint64_t sr_start;
|
||||
uint64_t sr_size;
|
||||
};
|
||||
|
||||
struct ps3_stordev {
|
||||
int sd_type;
|
||||
unsigned int sd_busidx;
|
||||
unsigned int sd_devidx;
|
||||
uint64_t sd_busid;
|
||||
uint64_t sd_devid;
|
||||
uint64_t sd_blksize;
|
||||
uint64_t sd_nblocks;
|
||||
uint64_t sd_nregs;
|
||||
struct ps3_storreg sd_regs[PS3_STOR_DEV_MAXREGS];
|
||||
uint64_t sd_dmabase;
|
||||
};
|
||||
|
||||
int ps3stor_setup(struct ps3_stordev *sd, int type);
|
||||
|
||||
int ps3stor_read_sectors(struct ps3_stordev *sd, int regidx,
|
||||
uint64_t start_sector, uint64_t sector_count, uint64_t flags, char *buf);
|
||||
|
||||
void ps3stor_print(struct ps3_stordev *sd);
|
||||
|
||||
#endif
|
@ -1,169 +0,0 @@
|
||||
/*-
|
||||
* Copyright (C) 2010 Nathan Whitehorn
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define LOCORE
|
||||
|
||||
#include <machine/trap.h>
|
||||
|
||||
/*
|
||||
* KBoot and simulators will start this program from the _start symbol, with
|
||||
* r3 pointing to a flattened device tree (kexec), r4 the physical address
|
||||
* at which we were loaded, and r5 0 (kexec) or a pointer to Open Firmware
|
||||
* (simulator). If r4 is non-zero, the first order of business is relocating
|
||||
* ourselves to 0. In the kboot case, the PPE secondary thread will enter
|
||||
* at 0x60.
|
||||
*
|
||||
* If started directly by the LV1 hypervisor, we are loaded to address 0
|
||||
* and execution on both threads begins at 0x100 (EXC_RST).
|
||||
*/
|
||||
|
||||
#define CACHELINE_SIZE 128
|
||||
#define SPR_CTRL 136
|
||||
|
||||
/* KBoot thread 0 entry -- do relocation, then jump to main */
|
||||
.global _start
|
||||
_start:
|
||||
mfmsr %r31
|
||||
clrldi %r31,%r31,1
|
||||
mtmsrd %r31
|
||||
isync
|
||||
cmpwi %r4,0
|
||||
bne relocate_self
|
||||
relocated_start:
|
||||
lis %r1,0x100
|
||||
bl main
|
||||
|
||||
. = 0x40
|
||||
.global secondary_spin_sem
|
||||
secondary_spin_sem:
|
||||
.long 0
|
||||
|
||||
. = 0x60
|
||||
thread1_start_kboot:
|
||||
mfmsr %r31
|
||||
clrldi %r31,%r31,1
|
||||
mtmsrd %r31
|
||||
isync
|
||||
|
||||
ba thread1_start /* kboot copies the first 256 bytes to
|
||||
* address 0, so we are safe to jump
|
||||
* (and stay) there */
|
||||
|
||||
thread1_start:
|
||||
li %r3,secondary_spin_sem@l
|
||||
1: lwz %r1,0(%r3) /* Spin on SECONDARY_SPIN_SEM_ADDRESS */
|
||||
cmpwi %r1,0
|
||||
beq 1b /* If the semaphore is still zero, spin again */
|
||||
|
||||
/* We have been woken up by thread 0 */
|
||||
li %r0,0x100 /* Invalidate reset vector cache line */
|
||||
icbi 0,%r0
|
||||
isync
|
||||
sync
|
||||
ba 0x100 /* Jump to the reset vector */
|
||||
|
||||
. = EXC_RST
|
||||
exc_rst:
|
||||
mfmsr %r31
|
||||
clrldi %r31,%r31,1
|
||||
mtmsrd %r31
|
||||
isync
|
||||
|
||||
mfspr %r3,SPR_CTRL
|
||||
/* The first two bits of r0 are 01 (thread 1) or 10 (thread 0) */
|
||||
cntlzw %r3,%r3 /* Now 0 for thread 0, 1 for thread 1 */
|
||||
|
||||
cmpwi %r3,0
|
||||
bne thread1_start /* Send thread 1 to wait */
|
||||
|
||||
b relocated_start /* Main entry point for thread 0 */
|
||||
|
||||
#define EXCEPTION_HANDLER(exc) \
|
||||
. = exc; \
|
||||
li %r3, exc; \
|
||||
mfsrr0 %r4; \
|
||||
mfmsr %r5; \
|
||||
clrldi %r6,%r5,1; \
|
||||
mtmsrd %r6; \
|
||||
isync; \
|
||||
lis %r1,0x100; \
|
||||
bl ppc_exception
|
||||
|
||||
EXCEPTION_HANDLER(EXC_MCHK)
|
||||
EXCEPTION_HANDLER(EXC_DSI)
|
||||
EXCEPTION_HANDLER(EXC_DSE)
|
||||
EXCEPTION_HANDLER(EXC_ISI)
|
||||
EXCEPTION_HANDLER(EXC_ISE)
|
||||
EXCEPTION_HANDLER(EXC_EXI)
|
||||
EXCEPTION_HANDLER(EXC_ALI)
|
||||
EXCEPTION_HANDLER(EXC_PGM)
|
||||
EXCEPTION_HANDLER(EXC_FPU)
|
||||
EXCEPTION_HANDLER(EXC_DECR)
|
||||
EXCEPTION_HANDLER(EXC_SC)
|
||||
|
||||
relocate_self:
|
||||
/* We enter this with r4 the physical offset for our relocation */
|
||||
lis %r8,_end@ha /* r8: copy length */
|
||||
addi %r8,%r8,_end@l
|
||||
li %r5,0x100 /* r5: dest address */
|
||||
1: add %r6,%r4,%r5 /* r6: source address */
|
||||
ld %r7,0(%r6)
|
||||
std %r7,0(%r5)
|
||||
addi %r5,%r5,8
|
||||
cmpw %r5,%r8
|
||||
blt 1b
|
||||
|
||||
/*
|
||||
* Now invalidate the cacheline with the second half of relocate_self,
|
||||
* and do an absolute branch there in case we overwrote part of
|
||||
* ourselves.
|
||||
*/
|
||||
|
||||
lis %r9,relocate_self_cache@ha
|
||||
addi %r9,%r9,relocate_self_cache@l
|
||||
dcbst 0,%r9
|
||||
sync
|
||||
icbi 0,%r9
|
||||
sync
|
||||
isync
|
||||
ba relocate_self_cache
|
||||
|
||||
relocate_self_cache:
|
||||
/* Now invalidate the icache */
|
||||
li %r5,0x100
|
||||
2: dcbst 0,%r5
|
||||
sync
|
||||
icbi 0,%r5
|
||||
sync
|
||||
isync
|
||||
cmpw %r5,%r8
|
||||
addi %r5,%r5,CACHELINE_SIZE
|
||||
blt 2b
|
||||
|
||||
/* All done: absolute jump to relocated entry point */
|
||||
ba relocated_start
|
||||
|
@ -1,8 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
|
||||
file is important. Make sure the current version number is on line 6.
|
||||
|
||||
0.3: Added GPT support to disk.
|
||||
0.2: Added disk support.
|
||||
0.1: Initial PS3/PowerPC version.
|
@ -64,7 +64,8 @@ fdt_platform_load_dtb(void)
|
||||
if (fdt_load_dtb_addr(hdr) == 0) {
|
||||
printf("Using DTB provided by U-Boot at "
|
||||
"address %p.\n", hdr);
|
||||
return (0);
|
||||
rv = 0;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,9 +84,11 @@ fdt_platform_load_dtb(void)
|
||||
if (fdt_load_dtb_file(s) == 0) {
|
||||
printf("Loaded DTB from file '%s'.\n", s);
|
||||
rv = 0;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
if (rv == 0) {
|
||||
s = getenv("fdt_overlays");
|
||||
if (s == NULL)
|
||||
|
@ -1525,6 +1525,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
size_t kstack0_sz;
|
||||
int late_console;
|
||||
|
||||
TSRAW(&thread0, TS_ENTER, __func__, NULL);
|
||||
|
||||
/*
|
||||
* This may be done better later if it gets more high level
|
||||
* components in it. If so just link td->td_proc here.
|
||||
@ -1533,7 +1535,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
|
||||
kmdp = init_ops.parse_preload_data(modulep);
|
||||
|
||||
identify_cpu();
|
||||
identify_cpu1();
|
||||
identify_hypervisor();
|
||||
|
||||
/* Init basic tunables, hz etc */
|
||||
@ -1774,6 +1776,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
#endif
|
||||
thread0.td_critnest = 0;
|
||||
|
||||
TSEXIT();
|
||||
|
||||
/* Location of kernel stack for locore */
|
||||
return ((u_int64_t)thread0.td_pcb);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ END(fillw)
|
||||
*/
|
||||
|
||||
/*
|
||||
* copyout(from_kernel, to_user, len) - MP SAFE
|
||||
* copyout(from_kernel, to_user, len)
|
||||
* %rdi, %rsi, %rdx
|
||||
*/
|
||||
ENTRY(copyout)
|
||||
@ -301,7 +301,7 @@ copyout_fault:
|
||||
END(copyout)
|
||||
|
||||
/*
|
||||
* copyin(from_user, to_kernel, len) - MP SAFE
|
||||
* copyin(from_user, to_kernel, len)
|
||||
* %rdi, %rsi, %rdx
|
||||
*/
|
||||
ENTRY(copyin)
|
||||
@ -518,7 +518,7 @@ fusufault:
|
||||
|
||||
/*
|
||||
* Store a 64-bit word, a 32-bit word, a 16-bit word, or an 8-bit byte to
|
||||
* user memory. All these functions are MPSAFE.
|
||||
* user memory.
|
||||
* addr = %rdi, value = %rsi
|
||||
*/
|
||||
ALTENTRY(suword64)
|
||||
@ -593,7 +593,7 @@ ENTRY(subyte)
|
||||
END(subyte)
|
||||
|
||||
/*
|
||||
* copyinstr(from, to, maxlen, int *lencopied) - MP SAFE
|
||||
* copyinstr(from, to, maxlen, int *lencopied)
|
||||
* %rdi, %rsi, %rdx, %rcx
|
||||
*
|
||||
* copy a string from 'from' to 'to', stop when a 0 character is reached.
|
||||
@ -664,7 +664,7 @@ cpystrflt_x:
|
||||
END(copyinstr)
|
||||
|
||||
/*
|
||||
* copystr(from, to, maxlen, int *lencopied) - MP SAFE
|
||||
* copystr(from, to, maxlen, int *lencopied)
|
||||
* %rdi, %rsi, %rdx, %rcx
|
||||
*/
|
||||
ENTRY(copystr)
|
||||
@ -704,7 +704,6 @@ END(copystr)
|
||||
|
||||
/*
|
||||
* Handling of special amd64 registers and descriptor tables etc
|
||||
* %rdi
|
||||
*/
|
||||
/* void lgdt(struct region_descriptor *rdp); */
|
||||
ENTRY(lgdt)
|
||||
|
@ -608,7 +608,6 @@ trap_pfault(struct trapframe *frame, int usermode)
|
||||
td = curthread;
|
||||
p = td->td_proc;
|
||||
eva = frame->tf_addr;
|
||||
rv = 0;
|
||||
|
||||
if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) {
|
||||
/*
|
||||
@ -660,7 +659,7 @@ trap_pfault(struct trapframe *frame, int usermode)
|
||||
* Don't allow user-mode faults in kernel address space.
|
||||
*/
|
||||
if (usermode)
|
||||
goto nogo;
|
||||
return (SIGSEGV);
|
||||
|
||||
map = kernel_map;
|
||||
} else {
|
||||
@ -715,7 +714,6 @@ trap_pfault(struct trapframe *frame, int usermode)
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
nogo:
|
||||
if (!usermode) {
|
||||
if (td->td_intr_nesting_level == 0 &&
|
||||
curpcb->pcb_onfault != NULL) {
|
||||
|
@ -246,8 +246,8 @@ struct vmcb_ctrl {
|
||||
uint8_t :3;
|
||||
uint8_t v_intr_masking:1; /* Guest and host sharing of RFLAGS. */
|
||||
uint8_t :7;
|
||||
uint8_t v_intr_vector; /* 0x65: Vector for virtual interrupt. */
|
||||
uint8_t pad3[3]; /* Bit64-40 Reserved. */
|
||||
uint8_t v_intr_vector; /* 0x64: Vector for virtual interrupt. */
|
||||
uint8_t pad3[3]; /* 0x65-0x67 Reserved. */
|
||||
uint64_t intr_shadow:1; /* 0x68: Interrupt shadow, section15.2.1 APM2 */
|
||||
uint64_t :63;
|
||||
uint64_t exitcode; /* 0x70, Exitcode */
|
||||
|
@ -52,28 +52,42 @@ __FBSDID("$FreeBSD$");
|
||||
#define SID_THERMAL_CALIB0 (SID_SRAM + 0x34)
|
||||
#define SID_THERMAL_CALIB1 (SID_SRAM + 0x38)
|
||||
|
||||
#define A10_ROOT_KEY_OFF 0x0
|
||||
#define A83T_ROOT_KEY_OFF SID_SRAM
|
||||
|
||||
#define ROOT_KEY_SIZE 4
|
||||
|
||||
enum sid_type {
|
||||
A10_SID = 1,
|
||||
A20_SID,
|
||||
A83T_SID,
|
||||
struct aw_sid_conf {
|
||||
bus_size_t rootkey_offset;
|
||||
bool has_thermal;
|
||||
};
|
||||
|
||||
static const struct aw_sid_conf a10_conf = {
|
||||
.rootkey_offset = 0,
|
||||
};
|
||||
|
||||
static const struct aw_sid_conf a20_conf = {
|
||||
.rootkey_offset = 0,
|
||||
};
|
||||
|
||||
static const struct aw_sid_conf a64_conf = {
|
||||
.rootkey_offset = SID_SRAM,
|
||||
.has_thermal = true,
|
||||
};
|
||||
|
||||
static const struct aw_sid_conf a83t_conf = {
|
||||
.rootkey_offset = SID_SRAM,
|
||||
.has_thermal = true,
|
||||
};
|
||||
|
||||
static struct ofw_compat_data compat_data[] = {
|
||||
{ "allwinner,sun4i-a10-sid", A10_SID},
|
||||
{ "allwinner,sun7i-a20-sid", A20_SID},
|
||||
{ "allwinner,sun8i-a83t-sid", A83T_SID},
|
||||
{ "allwinner,sun4i-a10-sid", (uintptr_t)&a10_conf},
|
||||
{ "allwinner,sun7i-a20-sid", (uintptr_t)&a20_conf},
|
||||
{ "allwinner,sun50i-a64-sid", (uintptr_t)&a64_conf},
|
||||
{ "allwinner,sun8i-a83t-sid", (uintptr_t)&a83t_conf},
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
struct aw_sid_softc {
|
||||
struct resource *res;
|
||||
int type;
|
||||
bus_size_t root_key_off;
|
||||
struct aw_sid_conf *sid_conf;
|
||||
};
|
||||
|
||||
static struct aw_sid_softc *aw_sid_sc;
|
||||
@ -118,16 +132,7 @@ aw_sid_attach(device_t dev)
|
||||
}
|
||||
|
||||
aw_sid_sc = sc;
|
||||
|
||||
sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
|
||||
switch (sc->type) {
|
||||
case A83T_SID:
|
||||
sc->root_key_off = A83T_ROOT_KEY_OFF;
|
||||
break;
|
||||
default:
|
||||
sc->root_key_off = A10_ROOT_KEY_OFF;
|
||||
break;
|
||||
}
|
||||
sc->sid_conf = (struct aw_sid_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data;
|
||||
|
||||
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
|
||||
@ -146,7 +151,7 @@ aw_sid_read_tscalib(uint32_t *calib0, uint32_t *calib1)
|
||||
sc = aw_sid_sc;
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
if (sc->type != A83T_SID)
|
||||
if (!sc->sid_conf->has_thermal)
|
||||
return (ENXIO);
|
||||
|
||||
*calib0 = RD4(sc, SID_THERMAL_CALIB0);
|
||||
@ -160,14 +165,15 @@ aw_sid_get_rootkey(u_char *out)
|
||||
{
|
||||
struct aw_sid_softc *sc;
|
||||
int i;
|
||||
bus_size_t root_key_off;
|
||||
u_int tmp;
|
||||
|
||||
sc = aw_sid_sc;
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
root_key_off = aw_sid_sc->sid_conf->rootkey_offset;
|
||||
for (i = 0; i < ROOT_KEY_SIZE ; i++) {
|
||||
tmp = RD4(aw_sid_sc, aw_sid_sc->root_key_off + (i * 4));
|
||||
tmp = RD4(aw_sid_sc, root_key_off + (i * 4));
|
||||
be32enc(&out[i * 4], tmp);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ arm/allwinner/aw_usbphy.c optional ehci | ohci
|
||||
arm/allwinner/aw_wdog.c standard
|
||||
arm/allwinner/axp209.c optional axp209
|
||||
arm/allwinner/axp81x.c optional axp81x
|
||||
arm/allwinner/if_awg.c optional awg
|
||||
arm/allwinner/if_awg.c optional awg ext_resources syscon
|
||||
arm/allwinner/if_emac.c optional emac
|
||||
arm/allwinner/sunxi_dma_if.m standard
|
||||
dev/iicbus/twsi/a10_twsi.c optional twsi
|
||||
|
@ -69,7 +69,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/extres/clk/clk.h>
|
||||
#include <dev/extres/hwreset/hwreset.h>
|
||||
#include <dev/extres/regulator/regulator.h>
|
||||
#include <dev/extres/syscon/syscon.h>
|
||||
|
||||
#include "syscon_if.h"
|
||||
#include "miibus_if.h"
|
||||
#include "gpio_if.h"
|
||||
|
||||
@ -105,6 +107,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define RX_BATCH_DEFAULT 64
|
||||
|
||||
/* syscon EMAC clock register */
|
||||
#define EMAC_CLK_REG 0x30
|
||||
#define EMAC_CLK_EPHY_ADDR (0x1f << 20) /* H3 */
|
||||
#define EMAC_CLK_EPHY_ADDR_SHIFT 20
|
||||
#define EMAC_CLK_EPHY_LED_POL (1 << 17) /* H3 */
|
||||
@ -203,6 +206,7 @@ struct awg_softc {
|
||||
int link;
|
||||
int if_flags;
|
||||
enum awg_type type;
|
||||
struct syscon *syscon;
|
||||
|
||||
struct awg_txring tx;
|
||||
struct awg_rxring rx;
|
||||
@ -217,6 +221,9 @@ static struct resource_spec awg_spec[] = {
|
||||
|
||||
static void awg_txeof(struct awg_softc *sc);
|
||||
|
||||
static uint32_t syscon_read_emac_clk_reg(device_t dev);
|
||||
static void syscon_write_emac_clk_reg(device_t dev, uint32_t val);
|
||||
|
||||
static int
|
||||
awg_miibus_readreg(device_t dev, int phy, int reg)
|
||||
{
|
||||
@ -1153,6 +1160,32 @@ awg_ioctl(if_t ifp, u_long cmd, caddr_t data)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
syscon_read_emac_clk_reg(device_t dev)
|
||||
{
|
||||
struct awg_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
if (sc->syscon != NULL)
|
||||
return (SYSCON_READ_4(sc->syscon, EMAC_CLK_REG));
|
||||
else if (sc->res[_RES_SYSCON] != NULL)
|
||||
return (bus_read_4(sc->res[_RES_SYSCON], 0));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
syscon_write_emac_clk_reg(device_t dev, uint32_t val)
|
||||
{
|
||||
struct awg_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
if (sc->syscon != NULL)
|
||||
SYSCON_WRITE_4(sc->syscon, EMAC_CLK_REG, val);
|
||||
else if (sc->res[_RES_SYSCON] != NULL)
|
||||
bus_write_4(sc->res[_RES_SYSCON], 0, val);
|
||||
}
|
||||
|
||||
static int
|
||||
awg_setup_phy(device_t dev)
|
||||
{
|
||||
@ -1163,19 +1196,31 @@ awg_setup_phy(device_t dev)
|
||||
phandle_t node;
|
||||
uint32_t reg, tx_delay, rx_delay;
|
||||
int error;
|
||||
bool use_syscon;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
node = ofw_bus_get_node(dev);
|
||||
use_syscon = false;
|
||||
|
||||
if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type) == 0)
|
||||
return (0);
|
||||
|
||||
if (sc->syscon != NULL || sc->res[_RES_SYSCON] != NULL)
|
||||
use_syscon = true;
|
||||
|
||||
if (bootverbose)
|
||||
device_printf(dev, "PHY type: %s, conf mode: %s\n", phy_type,
|
||||
sc->res[_RES_SYSCON] != NULL ? "reg" : "clk");
|
||||
use_syscon ? "reg" : "clk");
|
||||
|
||||
if (sc->res[_RES_SYSCON] != NULL) {
|
||||
reg = bus_read_4(sc->res[_RES_SYSCON], 0);
|
||||
if (use_syscon) {
|
||||
/*
|
||||
* Abstract away writing to syscon for devices like the pine64.
|
||||
* For the pine64, we get dtb from U-Boot and it still uses the
|
||||
* legacy setup of specifying syscon register in emac node
|
||||
* rather than as its own node and using an xref in emac.
|
||||
* These abstractions can go away once U-Boot dts is up-to-date.
|
||||
*/
|
||||
reg = syscon_read_emac_clk_reg(dev);
|
||||
reg &= ~(EMAC_CLK_PIT | EMAC_CLK_SRC | EMAC_CLK_RMII_EN);
|
||||
if (strncmp(phy_type, "rgmii", 5) == 0)
|
||||
reg |= EMAC_CLK_PIT_RGMII | EMAC_CLK_SRC_RGMII;
|
||||
@ -1215,7 +1260,7 @@ awg_setup_phy(device_t dev)
|
||||
|
||||
if (bootverbose)
|
||||
device_printf(dev, "EMAC clock: 0x%08x\n", reg);
|
||||
bus_write_4(sc->res[_RES_SYSCON], 0, reg);
|
||||
syscon_write_emac_clk_reg(dev, reg);
|
||||
} else {
|
||||
if (strncmp(phy_type, "rgmii", 5) == 0)
|
||||
tx_parent_name = "emac_int_tx";
|
||||
@ -1263,6 +1308,7 @@ static int
|
||||
awg_setup_extres(device_t dev)
|
||||
{
|
||||
struct awg_softc *sc;
|
||||
phandle_t node;
|
||||
hwreset_t rst_ahb, rst_ephy;
|
||||
clk_t clk_ahb, clk_ephy;
|
||||
regulator_t reg;
|
||||
@ -1273,6 +1319,7 @@ awg_setup_extres(device_t dev)
|
||||
rst_ahb = rst_ephy = NULL;
|
||||
clk_ahb = clk_ephy = NULL;
|
||||
reg = NULL;
|
||||
node = ofw_bus_get_node(dev);
|
||||
|
||||
/* Get AHB clock and reset resources */
|
||||
error = hwreset_get_by_ofw_name(dev, 0, "ahb", &rst_ahb);
|
||||
@ -1289,7 +1336,13 @@ awg_setup_extres(device_t dev)
|
||||
}
|
||||
if (clk_get_by_ofw_name(dev, 0, "ephy", &clk_ephy) != 0)
|
||||
clk_ephy = NULL;
|
||||
|
||||
|
||||
if (OF_hasprop(node, "syscon") && syscon_get_by_ofw_property(dev, node,
|
||||
"syscon", &sc->syscon) != 0) {
|
||||
device_printf(dev, "cannot get syscon driver handle\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Configure PHY for MII or RGMII mode */
|
||||
if (awg_setup_phy(dev) != 0)
|
||||
goto fail;
|
||||
|
@ -5,9 +5,6 @@ cpu CPU_CORTEXA
|
||||
machine arm armv7
|
||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||
|
||||
makeoptions KERNVIRTADDR=0xc0200000
|
||||
options KERNVIRTADDR=0xc0200000
|
||||
|
||||
options IPI_IRQ_START=0
|
||||
options IPI_IRQ_END=15
|
||||
|
||||
|
@ -5,9 +5,6 @@ cpu CPU_CORTEXA
|
||||
machine arm armv7
|
||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||
|
||||
makeoptions KERNVIRTADDR=0xc0200000
|
||||
options KERNVIRTADDR=0xc0200000
|
||||
|
||||
files "../allwinner/files.allwinner_up"
|
||||
files "../allwinner/files.allwinner"
|
||||
files "../allwinner/a10/files.a10"
|
||||
|
@ -10,6 +10,7 @@ arm/altera/socfpga/socfpga_mp.c optional smp
|
||||
arm/altera/socfpga/socfpga_gpio.c optional gpio
|
||||
|
||||
dev/mmc/host/dwmmc.c optional dwmmc
|
||||
dev/mmc/host/dwmmc_altera.c optional dwmmc
|
||||
|
||||
# Arria 10
|
||||
arm/altera/socfpga/socfpga_a10_manager.c standard
|
||||
|
@ -4,9 +4,6 @@ cpu CPU_CORTEXA
|
||||
machine arm armv7
|
||||
makeoptions CONF_CFLAGS="-march=armv7a"
|
||||
|
||||
makeoptions KERNVIRTADDR=0xc0f00000
|
||||
options KERNVIRTADDR=0xc0f00000
|
||||
|
||||
options IPI_IRQ_START=0
|
||||
options IPI_IRQ_END=15
|
||||
|
||||
|
@ -347,6 +347,7 @@ DELAY(int usec)
|
||||
}
|
||||
return;
|
||||
}
|
||||
TSENTER();
|
||||
|
||||
/*
|
||||
* Some of the other timers in the source tree do this calculation as:
|
||||
@ -391,4 +392,5 @@ DELAY(int usec)
|
||||
previous = now;
|
||||
remaining -= delta;
|
||||
}
|
||||
TSEXIT();
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/pcb.h>
|
||||
#include <machine/armreg.h>
|
||||
#include <machine/vmparam.h> /* For KERNVIRTADDR */
|
||||
|
||||
int do_minidump = 1;
|
||||
SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RWTUN, &do_minidump, 0,
|
||||
|
@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/armreg.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/vmparam.h> /* For KERNVIRTADDR */
|
||||
|
||||
#if __ARM_ARCH >= 6
|
||||
#error "elf_trampline is not supported on ARMv6/v7 platforms"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user