summaryrefslogtreecommitdiffstats
path: root/stand/powerpc
diff options
context:
space:
mode:
authorkevans <kevans@FreeBSD.org>2018-02-12 17:44:35 +0000
committerkevans <kevans@FreeBSD.org>2018-02-12 17:44:35 +0000
commit03afb65f3947c5fb7be12e5a7ab31bd61a10baf1 (patch)
treedb7e0d0392bd3b86fbdf18ba7bff2a71c4429ce0 /stand/powerpc
parent0bf44ac33507723b11556d27f10c9c1d165c4e2a (diff)
downloadFreeBSD-src-03afb65f3947c5fb7be12e5a7ab31bd61a10baf1.zip
FreeBSD-src-03afb65f3947c5fb7be12e5a7ab31bd61a10baf1.tar.gz
MFC Loader Fixes 2017q4p7: r324844,r326089,r326926,r326440,r326484,r326494,
r326588,r326708,r326784,r326914,r327390,r328446,r326090,r326143,r326144, r326182,r326384,r326421,r326440,r326441,r326442,r326443,r326444,r326445, r326446,r326447,r326448,r326484,r326485,r326486,r326487,r326488,r326490, r326491,r326492,r326493,r326494,r326495,r326504,r326507,r326509,r326584, r326585,r326586,r326587,r326588,r326589,r326590,r326591,r326592,r326593, r326594,r326600,r326616,r326671,r326707,r326708,r326709,r326710,r326711, r326712,r326714,r326720,r326768,r326772,r326784,r326792,r326812,r326854, r326855,r326856,r326858,r326886,r326887,r326914,r326926,r326927,r326960, r326961,r326962,r326963,r327351,r327453,r327390,r327523,r327524,r326489, r327880,r328437,r328438,r328439,r328441,r328446,r328448,r328449,r328612, r328613,r328615 While here, undo our libfdt hack of not including <stdlib.h> if we're compiling _STANDALONE. r324844: When building standalone, don't define errno. Let the definition from stand.h override. This is similar to what we do in the kernel. r326089: loader.efi: efipart does not recognize partitionless disks r326090: net_parse_rootpath() has no parameters r326143: Fix theoretical integer overflow issues. If the product here is r326144: Mark the func pointer as __dead2. It looks up loader_main, which r326182: Modify all FreeBSD bootloaders on PowerPC AIM (Book-S) systems r326384: Use const pointers to avoid casting away constness. r326421: loader.efi: efipart should exclude iPXE stub block protocol r326440: Remove stale dependency on ufsread.c r326441: Minor flags cleanup r326442: Cleanup CFALGS usage here r326443: We don't need both _STAND and _STANDALONE, use the latter. r326444: Move geli to common DO32 stuff r326445: Fix random() and srandom() prototypes to match the standard. r326446: Undefine _STANDALONE since this is test code. r326447: Tweaks to the beri boot loader so that it builds w/o warnings. r326448: Fix all warnings related to geli and ZFS support on x86. r326484: Const poison the propname. r326485: Delcare md_load in libofw.h. Make all prototypes match for ofw r326486: Include machine/md_var to pick up __syncicache prototype. r326487: Cast mdp (a vm_offset_t) to void * to match prototype. r326488: e_entry can be smaller than a pointer. Cast it to an intptr_t r326490: Declare our strange brand of main(). r326491: Disconnet ps3 from the build. There's too many warnings to fix. r326492: Cast void * pointer to char * so the arg matches the %s format. r326493: Provide a md_load64 prototype. r326494: Mark two things as unused (since they are only sometimes used) r326495: Now it's safe to bump WARNS to 1. r326504: Switch to proper MK_LOADER_GELI tests. r326507: increase maximum size of zfsboot r326509: loader.efi: add note about iPXE into the efipart.c r326584: When building standalone, include stand.h rather than the kernel r326585: Include ficl.h before anything else r326586: No need to include the userland md5.h, the kernel one is just fine. r326587: Use the kernel relative paths, rather than the userland relative paths r326588: Need to include skein in the include path r326589: Make sure we include the right path for skein.h r326590: Prefer stdint.h to inttypes.h r326591: This isn't NetBSD specific code. Include these for any kernel / r326592: Don't inherit CFLAGS. This a specialized test program. r326593: Stop building with the standard system headers. r326594: Now that we offer a semi-sane standards-ish set of #include files, stop hacking includes with sed. r326600: Since this is contrib code, create an upstreamable version of my r326616: dhcp_try_rfc1048() is not used any more r326671: Avoid setting -Wno-tentative-definition-incomplete-type with gcc. r326707: Add partial support signal.h functioanlity. Pull in machine/signal.h r326708: Remove _KERNEL hack now that errno.h does the right thing when built standalone. r326709: Provide implementations for iscntrl, ispunct and isgraph. r326710: Put the files we're copying over into a few variables and clean hings up. r326711: Const poison a couple of interfaces. r326712: Create interp class. r326714: boot1.c needs EFI_ZFS_BOOT too, so add it globally. r326720: This path belongs in ficl/Makefile, not the common defines for users r326768: Fix a comment to be more accurate r326772: Fix regression with lua import r326784: Revert part of 362772. It was causing problems for includes r326792: Attempt to unbreak buildworld r326812: Revert r326792, r326784, r326772, r326712 r326854: libefi: make efichar.h more usable in stand code r326855: Cargo cut a fix for the regressions r326585 caused. r326856: Fix comments after bump in size. r326858: Revert r326855: Cargo cut a fix for the regressions r326585 caused. r326886: Panic in sbrk if setheap hasn't been called yet. This is preferable o a mysterious crash r326887: Remove the 'mini libstand in libstand' that util.[ch] provided. r326914: Move loader-only defines to loader.mk from defs.mk r326926: Move loader help file definitions to being 100% inside of loader.mk. r326927: libficl is only ever used in a loader (never a boot) program. Move it. r326960: Simplify things a little. The RETURN macro isn't required. r326961: Interact is always called with NULL. Simplify code a little r326962: Hoist btx include stuff to i386/Makefile.inc r326963: No need to use relative paths like this here. r327351: Fix ubldr. uboot/lib uses defines for the loader. r327453: Add a validbcd() routine that uses the bcd2bin_data[] array r327390: Garbage-collect loader.ps3. It is currently disconnected from the build and kboot replaces. r327523: Don't clobber system LDFLAGS for beri boot loaders. r327524: Use 'extern uint8_t' instead of 'extern void' for external symbols. r326489: Allow this file to be used in libsa without warning... r327880: Move getsecs() prototype to stand.h from net.h so it can be used r328437: Split panic routine r328438: Implement abort() as a call to panic. r328439: Provide abs form stdlib.h. r328441: abort() should be marked __dead2 since it won't return. r328446: Now that exit is __dead2, we need to tag ub_exit() as __dead2. r328448: Make exit() never return until host_exit can be written. r328449: Tag unreachable places as such. I left the while (1); in place r328612: Move strtold wrapper from strtol.c to its own strtold.c. r328613: Kill copies of strtol and strtoul. r328615: Update stand.h for changes for strto*l PR: 223969
Diffstat (limited to 'stand/powerpc')
-rw-r--r--stand/powerpc/Makefile3
-rw-r--r--stand/powerpc/boot1.chrp/Makefile6
-rw-r--r--stand/powerpc/boot1.chrp/boot1.c3
-rw-r--r--stand/powerpc/kboot/Makefile3
-rw-r--r--stand/powerpc/kboot/host_syscall.h2
-rw-r--r--stand/powerpc/kboot/hostdisk.c2
-rw-r--r--stand/powerpc/kboot/kbootfdt.c4
-rw-r--r--stand/powerpc/kboot/main.c5
-rw-r--r--stand/powerpc/kboot/ppc64_elf_freebsd.c4
-rw-r--r--stand/powerpc/ofw/Makefile2
-rw-r--r--stand/powerpc/ofw/start.c2
-rw-r--r--stand/powerpc/ps3/Makefile48
-rw-r--r--stand/powerpc/ps3/conf.c123
-rw-r--r--stand/powerpc/ps3/devicename.c238
-rw-r--r--stand/powerpc/ps3/ldscript.powerpc111
-rw-r--r--stand/powerpc/ps3/lv1call.S346
-rw-r--r--stand/powerpc/ps3/lv1call.h80
-rw-r--r--stand/powerpc/ps3/main.c248
-rw-r--r--stand/powerpc/ps3/metadata.c333
-rw-r--r--stand/powerpc/ps3/ppc64_elf_freebsd.c101
-rw-r--r--stand/powerpc/ps3/ps3.h35
-rw-r--r--stand/powerpc/ps3/ps3bus.h41
-rw-r--r--stand/powerpc/ps3/ps3cdrom.c156
-rw-r--r--stand/powerpc/ps3/ps3cons.c173
-rw-r--r--stand/powerpc/ps3/ps3devdesc.h53
-rw-r--r--stand/powerpc/ps3/ps3disk.c315
-rw-r--r--stand/powerpc/ps3/ps3mmu.c120
-rw-r--r--stand/powerpc/ps3/ps3net.c278
-rw-r--r--stand/powerpc/ps3/ps3repo.c249
-rw-r--r--stand/powerpc/ps3/ps3repo.h51
-rw-r--r--stand/powerpc/ps3/ps3stor.c176
-rw-r--r--stand/powerpc/ps3/ps3stor.h59
-rw-r--r--stand/powerpc/ps3/start.S169
-rw-r--r--stand/powerpc/ps3/version8
-rw-r--r--stand/powerpc/uboot/Makefile1
35 files changed, 15 insertions, 3533 deletions
diff --git a/stand/powerpc/Makefile b/stand/powerpc/Makefile
index 969eee8..c8bbb17 100644
--- a/stand/powerpc/Makefile
+++ b/stand/powerpc/Makefile
@@ -3,9 +3,6 @@
.include <bsd.init.mk>
SUBDIR= boot1.chrp ofw uboot
-.if ${MACHINE_ARCH} != "powerpcspe"
-SUBDIR+= ps3
-.endif
.if ${MK_FDT} == "yes"
SUBDIR+= kboot
.endif
diff --git a/stand/powerpc/boot1.chrp/Makefile b/stand/powerpc/boot1.chrp/Makefile
index ee32ff5..d865248 100644
--- a/stand/powerpc/boot1.chrp/Makefile
+++ b/stand/powerpc/boot1.chrp/Makefile
@@ -2,8 +2,6 @@
.include <bsd.init.mk>
-SSP_CFLAGS=
-
PROG= boot1.elf
NEWVERSWHAT= "Open Firmware boot block" ${MACHINE_ARCH}
INSTALLFLAGS= -b
@@ -13,7 +11,7 @@ SRCS= boot1.c ashldi3.c syncicache.c
MAN=
-CFLAGS= -I${LDRSRC} -I${SYSDIR} -I${SASRC} -D_STANDALONE
+CFLAGS+=-I${LDRSRC}
LDFLAGS=-nostdlib -static -Wl,-N
.PATH: ${SYSDIR}/libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR}
@@ -34,7 +32,5 @@ boot1.hfs: boot1.elf bootinfo.txt
CLEANFILES+= boot1.hfs
-boot1.o: ${SASRC}/ufsread.c
-
.include <bsd.prog.mk>
diff --git a/stand/powerpc/boot1.chrp/boot1.c b/stand/powerpc/boot1.chrp/boot1.c
index 8de8e9f..e73186a 100644
--- a/stand/powerpc/boot1.chrp/boot1.c
+++ b/stand/powerpc/boot1.chrp/boot1.c
@@ -22,6 +22,7 @@ __FBSDID("$FreeBSD$");
#include <sys/dirent.h>
#include <machine/elf.h>
#include <machine/stdarg.h>
+#include <machine/md_var.h>
#include "paths.h"
@@ -75,8 +76,6 @@ static int __sputc(char c, void *arg);
static char *__uitoa(char *buf, u_int val, int base);
static char *__ultoa(char *buf, u_long val, int base);
-void __syncicache(void *, int);
-
/*
* Open Firmware interface functions
*/
diff --git a/stand/powerpc/kboot/Makefile b/stand/powerpc/kboot/Makefile
index b51a068..e91421d 100644
--- a/stand/powerpc/kboot/Makefile
+++ b/stand/powerpc/kboot/Makefile
@@ -28,7 +28,6 @@ SRCS+= ucmpdi2.c
CFLAGS+= -mcpu=powerpc64
# Always add MI sources
-HELP_FILES= # Disable
.include "${BOOTSRC}/loader.mk"
.PATH: ${SYSDIR}/libkern
@@ -45,6 +44,4 @@ CFLAGS+= -Wa,-mppc64bridge
DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA}
LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA}
-HELP_FILES+= ${FDTSRC}/help.fdt
-
.include <bsd.prog.mk>
diff --git a/stand/powerpc/kboot/host_syscall.h b/stand/powerpc/kboot/host_syscall.h
index 0d47bd5..349c54e 100644
--- a/stand/powerpc/kboot/host_syscall.h
+++ b/stand/powerpc/kboot/host_syscall.h
@@ -33,7 +33,7 @@
ssize_t host_read(int fd, void *buf, size_t nbyte);
ssize_t host_write(int fd, const void *buf, size_t nbyte);
ssize_t host_seek(int fd, int64_t offset, int whence);
-int host_open(char *path, int flags, int mode);
+int host_open(const char *path, int flags, int mode);
int host_close(int fd);
void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, int);
#define host_getmem(size) host_mmap(0, size, 3 /* RW */, 0x22 /* ANON */, -1, 0);
diff --git a/stand/powerpc/kboot/hostdisk.c b/stand/powerpc/kboot/hostdisk.c
index 22f5406..26d3959 100644
--- a/stand/powerpc/kboot/hostdisk.c
+++ b/stand/powerpc/kboot/hostdisk.c
@@ -94,7 +94,7 @@ hostdisk_open(struct open_file *f, ...)
if (desc->d_unit <= 0) {
printf("hostdisk_open: couldn't open %s: %d\n",
- desc->d_opendata, desc->d_unit);
+ (char *)desc->d_opendata, desc->d_unit);
return (ENOENT);
}
diff --git a/stand/powerpc/kboot/kbootfdt.c b/stand/powerpc/kboot/kbootfdt.c
index 5ab3c3d..67a2082 100644
--- a/stand/powerpc/kboot/kbootfdt.c
+++ b/stand/powerpc/kboot/kbootfdt.c
@@ -119,7 +119,7 @@ fdt_linux_fixups(void *fdtp)
offset = fdt_path_offset(fdtp, "/ibm,opal");
if (offset > 0) {
- uint64_t *base, *size;
+ const uint64_t *base, *size;
base = fdt_getprop(fdtp, offset, "opal-base-address",
&len);
size = fdt_getprop(fdtp, offset, "opal-runtime-size",
@@ -130,7 +130,7 @@ fdt_linux_fixups(void *fdtp)
}
offset = fdt_path_offset(fdtp, "/rtas");
if (offset > 0) {
- uint32_t *base, *size;
+ const uint32_t *base, *size;
base = fdt_getprop(fdtp, offset, "linux,rtas-base", &len);
size = fdt_getprop(fdtp, offset, "rtas-size", &len);
if (base != NULL && size != NULL)
diff --git a/stand/powerpc/kboot/main.c b/stand/powerpc/kboot/main.c
index 7a24c16..cbd1161 100644
--- a/stand/powerpc/kboot/main.c
+++ b/stand/powerpc/kboot/main.c
@@ -122,7 +122,7 @@ main(int argc, const char **argv)
setenv("loaddev", bootdev, 1);
setenv("LINES", "24", 1);
- interact(NULL); /* doesn't return */
+ interact(); /* doesn't return */
return (0);
}
@@ -130,7 +130,8 @@ main(int argc, const char **argv)
void
exit(int code)
{
- /* XXX: host_exit */
+ while (1); /* XXX: host_exit */
+ __unreachable();
}
void
diff --git a/stand/powerpc/kboot/ppc64_elf_freebsd.c b/stand/powerpc/kboot/ppc64_elf_freebsd.c
index 22fa7b5..987565e 100644
--- a/stand/powerpc/kboot/ppc64_elf_freebsd.c
+++ b/stand/powerpc/kboot/ppc64_elf_freebsd.c
@@ -46,6 +46,8 @@ extern size_t szkerneltramp;
extern int nkexec_segments;
extern void * loaded_segments;
+vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
+
int
ppc64_elf_loadfile(char *filename, u_int64_t dest,
struct preloaded_file **result)
@@ -96,7 +98,7 @@ ppc64_elf_exec(struct preloaded_file *fp)
trampoline[3] = dtb;
trampoline[6] = mdp;
- trampoline[7] = sizeof(mdp);
+ trampoline[7] = 0xfb5d104d;
printf("Kernel entry at %#jx (%#x) ...\n", e->e_entry, trampoline[2]);
printf("DTB at %#x, mdp at %#x\n", dtb, mdp);
diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile
index b28665d..e24b7af 100644
--- a/stand/powerpc/ofw/Makefile
+++ b/stand/powerpc/ofw/Makefile
@@ -27,7 +27,7 @@ SRCS+= ucmpdi2.c
SRCS+= ofwfdt.c
.endif
-HELP_FILES+= ${FDTSRC}/help.fdt
+HELP_FILES= ${FDTSRC}/help.fdt
# Always add MI sources
.include "${BOOTSRC}/loader.mk"
diff --git a/stand/powerpc/ofw/start.c b/stand/powerpc/ofw/start.c
index 911a2ec..5e0744b 100644
--- a/stand/powerpc/ofw/start.c
+++ b/stand/powerpc/ofw/start.c
@@ -67,6 +67,8 @@ _start: \n\
2: b startup \n\
");
+void main(int (*openfirm)(void *));
+
void
startup(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl)
{
diff --git a/stand/powerpc/ps3/Makefile b/stand/powerpc/ps3/Makefile
deleted file mode 100644
index fc6ec9c..0000000
--- a/stand/powerpc/ps3/Makefile
+++ /dev/null
@@ -1,48 +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
-HELP_FILES= # Disable
-.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>
diff --git a/stand/powerpc/ps3/conf.c b/stand/powerpc/ps3/conf.c
deleted file mode 100644
index 3a5ae4c..0000000
--- a/stand/powerpc/ps3/conf.c
+++ /dev/null
@@ -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;
diff --git a/stand/powerpc/ps3/devicename.c b/stand/powerpc/ps3/devicename.c
deleted file mode 100644
index 041f853..0000000
--- a/stand/powerpc/ps3/devicename.c
+++ /dev/null
@@ -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);
-}
diff --git a/stand/powerpc/ps3/ldscript.powerpc b/stand/powerpc/ps3/ldscript.powerpc
deleted file mode 100644
index 12f3e75..0000000
--- a/stand/powerpc/ps3/ldscript.powerpc
+++ /dev/null
@@ -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 = .);
-}
-
diff --git a/stand/powerpc/ps3/lv1call.S b/stand/powerpc/ps3/lv1call.S
deleted file mode 100644
index a399a9c..0000000
--- a/stand/powerpc/ps3/lv1call.S
+++ /dev/null
@@ -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
diff --git a/stand/powerpc/ps3/lv1call.h b/stand/powerpc/ps3/lv1call.h
deleted file mode 100644
index fb80448..0000000
--- a/stand/powerpc/ps3/lv1call.h
+++ /dev/null
@@ -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
-
diff --git a/stand/powerpc/ps3/main.c b/stand/powerpc/ps3/main.c
deleted file mode 100644
index be8708a..0000000
--- a/stand/powerpc/ps3/main.c
+++ /dev/null
@@ -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(NULL); /* 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);
-}
-
diff --git a/stand/powerpc/ps3/metadata.c b/stand/powerpc/ps3/metadata.c
deleted file mode 100644
index 6f29c57..0000000
--- a/stand/powerpc/ps3/metadata.c
+++ /dev/null
@@ -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));
-}
-
diff --git a/stand/powerpc/ps3/ppc64_elf_freebsd.c b/stand/powerpc/ps3/ppc64_elf_freebsd.c
deleted file mode 100644
index 3eb991e..0000000
--- a/stand/powerpc/ps3/ppc64_elf_freebsd.c
+++ /dev/null
@@ -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, sizeof(mdp));
-
- panic("exec returned");
-}
-
-struct file_format ppc_elf64 =
-{
- ppc64_elf_loadfile,
- ppc64_elf_exec
-};
diff --git a/stand/powerpc/ps3/ps3.h b/stand/powerpc/ps3/ps3.h
deleted file mode 100644
index 1a77002..0000000
--- a/stand/powerpc/ps3/ps3.h
+++ /dev/null
@@ -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
diff --git a/stand/powerpc/ps3/ps3bus.h b/stand/powerpc/ps3/ps3bus.h
deleted file mode 100644
index a3b20f3..0000000
--- a/stand/powerpc/ps3/ps3bus.h
+++ /dev/null
@@ -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
diff --git a/stand/powerpc/ps3/ps3cdrom.c b/stand/powerpc/ps3/ps3cdrom.c
deleted file mode 100644
index d8d41fd..0000000
--- a/stand/powerpc/ps3/ps3cdrom.c
+++ /dev/null
@@ -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);
-}
diff --git a/stand/powerpc/ps3/ps3cons.c b/stand/powerpc/ps3/ps3cons.c
deleted file mode 100644
index fa9ef32..0000000
--- a/stand/powerpc/ps3/ps3cons.c
+++ /dev/null
@@ -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);
-}
-
diff --git a/stand/powerpc/ps3/ps3devdesc.h b/stand/powerpc/ps3/ps3devdesc.h
deleted file mode 100644
index 5a6e52f..0000000
--- a/stand/powerpc/ps3/ps3devdesc.h
+++ /dev/null
@@ -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
diff --git a/stand/powerpc/ps3/ps3disk.c b/stand/powerpc/ps3/ps3disk.c
deleted file mode 100644
index c33a023..0000000
--- a/stand/powerpc/ps3/ps3disk.c
+++ /dev/null
@@ -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);
-}
diff --git a/stand/powerpc/ps3/ps3mmu.c b/stand/powerpc/ps3/ps3mmu.c
deleted file mode 100644
index 08dcf75..0000000
--- a/stand/powerpc/ps3/ps3mmu.c
+++ /dev/null
@@ -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);
-}
-
diff --git a/stand/powerpc/ps3/ps3net.c b/stand/powerpc/ps3/ps3net.c
deleted file mode 100644
index 142eab8..0000000
--- a/stand/powerpc/ps3/ps3net.c
+++ /dev/null
@@ -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);
-}
-
diff --git a/stand/powerpc/ps3/ps3repo.c b/stand/powerpc/ps3/ps3repo.c
deleted file mode 100644
index 0064769..0000000
--- a/stand/powerpc/ps3/ps3repo.c
+++ /dev/null
@@ -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;
-}
diff --git a/stand/powerpc/ps3/ps3repo.h b/stand/powerpc/ps3/ps3repo.h
deleted file mode 100644
index 68001df..0000000
--- a/stand/powerpc/ps3/ps3repo.h
+++ /dev/null
@@ -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
diff --git a/stand/powerpc/ps3/ps3stor.c b/stand/powerpc/ps3/ps3stor.c
deleted file mode 100644
index bbfc56a..0000000
--- a/stand/powerpc/ps3/ps3stor.c
+++ /dev/null
@@ -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)
-{
-}
diff --git a/stand/powerpc/ps3/ps3stor.h b/stand/powerpc/ps3/ps3stor.h
deleted file mode 100644
index 350b716..0000000
--- a/stand/powerpc/ps3/ps3stor.h
+++ /dev/null
@@ -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
diff --git a/stand/powerpc/ps3/start.S b/stand/powerpc/ps3/start.S
deleted file mode 100644
index 570b3f5..0000000
--- a/stand/powerpc/ps3/start.S
+++ /dev/null
@@ -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
-
diff --git a/stand/powerpc/ps3/version b/stand/powerpc/ps3/version
deleted file mode 100644
index fdac54e..0000000
--- a/stand/powerpc/ps3/version
+++ /dev/null
@@ -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.
diff --git a/stand/powerpc/uboot/Makefile b/stand/powerpc/uboot/Makefile
index 6622cf1..623c464 100644
--- a/stand/powerpc/uboot/Makefile
+++ b/stand/powerpc/uboot/Makefile
@@ -21,7 +21,6 @@ SRCS= start.S conf.c vers.c
SRCS+= ucmpdi2.c
# Always add MI sources
-HELP_FILES= # Disable
.include "${BOOTSRC}/loader.mk"
.PATH: ${SYSDIR}/libkern
OpenPOWER on IntegriCloud