diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-08-04 08:56:16 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-08-04 08:56:16 +0000 |
commit | 835c6787ec1cf918afba376e045c5ee685d8a28e (patch) | |
tree | 833cca4275493d55a8ce4c04301a192a5fec7b89 | |
parent | c0bd79a2d4bd06f202f76db77e02da77e0b8dd3c (diff) |
Remove the old, unfinished octeon bootloader.
-rw-r--r-- | sys/arch/octeon/stand/boot/Makefile.inc | 38 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/clock.c | 32 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/conf.c | 58 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/devopen.c | 121 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/exec.c | 9 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/libsa.h | 44 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/machdep.c | 183 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/start.S | 93 | ||||
-rw-r--r-- | sys/arch/octeon/stand/boot/uart.c | 137 |
9 files changed, 0 insertions, 715 deletions
diff --git a/sys/arch/octeon/stand/boot/Makefile.inc b/sys/arch/octeon/stand/boot/Makefile.inc deleted file mode 100644 index 990b8c073b4..00000000000 --- a/sys/arch/octeon/stand/boot/Makefile.inc +++ /dev/null @@ -1,38 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.3 2016/11/06 16:42:00 tb Exp $ - -NOMAN= -S= ${.CURDIR}/../../../.. -BOOTDIR= ${S}/arch/octeon/stand/boot - -CPPFLAGS+= ${SAABI} -mno-abicalls -D_NO_ABICALLS -Werror \ - -nostdinc -D__octeon__ -msoft-float \ - -I${S} -I${S}/lib/libsa \ - -I${.OBJDIR} -I${BOOTDIR} - -LDSCRIPT= ${.CURDIR}/../../conf/ld.script -LDFLAGS+= ${SALDFLAGS} -T ${LDSCRIPT} -Ttext=0xffffffff81000000 -e __start - -AFLAGS+= ${SAABI} - -.PATH: ${BOOTDIR} -SRCS= start.S -SRCS+= conf.c clock.c devopen.c exec.c machdep.c uart.c - -#### MI boot code -.PATH: ${S}/stand/boot -SRCS+= boot.c cmd.c vars.c - -#### libkern -.PATH: ${S}/lib/libkern/arch/mips64 ${S}/lib/libkern -SRCS+= strlcat.c strlcpy.c strlen.c -SRCS+= udivdi3.c qdivrem.c - -.if !make(clean) && !make(cleandir) && !make(includes) && !make(obj) -.BEGIN: - @([ -h machine ] || ln -s ${.CURDIR}/../../include machine) - @([ -h mips64 ] || ln -s ${.CURDIR}/../../../mips64/include mips64) -CLEANFILES+= machine mips64 -.endif - -${PROG}: ${OBJS} ${LIBSA} - ${LD} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBSA} diff --git a/sys/arch/octeon/stand/boot/clock.c b/sys/arch/octeon/stand/boot/clock.c deleted file mode 100644 index acccf606ecf..00000000000 --- a/sys/arch/octeon/stand/boot/clock.c +++ /dev/null @@ -1,32 +0,0 @@ -/* $OpenBSD: clock.c,v 1.3 2014/07/12 19:47:38 jasper Exp $ */ - -/* - * Copyright (c) 2013 Jasper Lievisse Adriaanse <jasper@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> - -#include "libsa.h" - -/* Arbitrarily chosen value, needs talking to cp0 for a delay loop. */ -#define DELAY_MULTIPLIER 10000 - -void -delay(int ms) -{ - volatile int i = ms * DELAY_MULTIPLIER; - for (; --i;) - ; -} diff --git a/sys/arch/octeon/stand/boot/conf.c b/sys/arch/octeon/stand/boot/conf.c deleted file mode 100644 index 31eb2f49fde..00000000000 --- a/sys/arch/octeon/stand/boot/conf.c +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: conf.c,v 1.5 2019/04/10 04:19:32 deraadt Exp $ */ - -/* - * Copyright (c) 2013 Jasper Lievisse Adriaanse <jasper@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <dev/cons.h> - -#include "libsa.h" -#include <lib/libsa/ufs.h> -#include <lib/libsa/cd9660.h> - -const char version[] = "0.5"; - -/* - * Device configuration - */ -struct devsw devsw[] = { - /* ATA storage device */ - /* XXX */ - { "wd", NULL, NULL, NULL, noioctl } -}; -int ndevs = nitems(devsw); - -/* - * Filesystem configuration - */ -struct fs_ops file_system[] = { - /* ufs filesystem */ - { ufs_open, ufs_close, ufs_read, ufs_write, - ufs_seek, ufs_stat, ufs_readdir }, - /* cd9660 filesystem - in case a cd image is dd'ed on non USB media */ - { cd9660_open, cd9660_close, cd9660_read, cd9660_write, - cd9660_seek, cd9660_stat, cd9660_readdir } -}; -int nfsys = nitems(file_system); - -/* - * Console configuration - */ -struct consdev constab[] = { - { cn30xxuartcnprobe, cn30xxuartcninit, cn30xxuartcngetc, cn30xxuartcnputc }, - { NULL } -}; -struct consdev *cn_tab; diff --git a/sys/arch/octeon/stand/boot/devopen.c b/sys/arch/octeon/stand/boot/devopen.c deleted file mode 100644 index 0b338beb165..00000000000 --- a/sys/arch/octeon/stand/boot/devopen.c +++ /dev/null @@ -1,121 +0,0 @@ -/* $OpenBSD: devopen.c,v 1.1 2013/06/05 01:02:29 jasper Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Rolf Grossmann. - * - * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "libsa.h" - -#define MAXDEVNAME 16 - -/* - * Parse a device spec. - * - * [A-Za-z]*[0-9]*[A-Za-z]:file - * dev uint part - */ -int -devparse(const char *fname, int *dev, int *unit, int *part, const char **file) -{ - const char *s; - - *unit = 0; /* default to wd0a */ - *part = 0; - *dev = 0; - - s = strchr(fname, ':'); - if (s != NULL) { - int devlen; - int i, u, p = 0; - struct devsw *dp; - char devname[MAXDEVNAME]; - - devlen = s - fname; - if (devlen > MAXDEVNAME) - return (EINVAL); - - /* extract device name */ - for (i = 0; isalpha(fname[i]) && (i < devlen); i++) - devname[i] = fname[i]; - devname[i] = 0; - - if (!isdigit(fname[i])) - return (EUNIT); - - /* device number */ - for (u = 0; isdigit(fname[i]) && (i < devlen); i++) - u = u * 10 + (fname[i] - '0'); - - if (!isalpha(fname[i])) - return (EPART); - - /* partition number */ - if (i < devlen) - p = fname[i++] - 'a'; - - if (i != devlen) - return (ENXIO); - - /* check device name */ - for (dp = devsw, i = 0; i < ndevs; dp++, i++) { - if (dp->dv_name && !strcmp(devname, dp->dv_name)) - break; - } - - if (i >= ndevs) - return (ENXIO); - - *unit = u; - *part = p; - *dev = i; - fname = ++s; - } - - *file = fname; - - return (0); -} - -int -devopen(struct open_file *f, const char *fname, char **file) -{ - struct devsw *dp; - int dev, unit, part, error; - - error = devparse(fname, &dev, &unit, &part, (const char **)file); - if (error) - return (error); - - dp = &devsw[dev]; - if ((void *)dp->dv_open == (void *)nodev) - return (ENXIO); - - f->f_dev = dp; - - return (*dp->dv_open)(f, unit, part); -} diff --git a/sys/arch/octeon/stand/boot/exec.c b/sys/arch/octeon/stand/boot/exec.c deleted file mode 100644 index 1a20a45b5f2..00000000000 --- a/sys/arch/octeon/stand/boot/exec.c +++ /dev/null @@ -1,9 +0,0 @@ -/* $OpenBSD: exec.c,v 1.3 2019/04/10 04:17:36 deraadt Exp $ */ -#include <sys/param.h> -#include "libsa.h" -#include <lib/libsa/loadfile.h> - -void -run_loadfile(uint64_t *marks, int howto) -{ -} diff --git a/sys/arch/octeon/stand/boot/libsa.h b/sys/arch/octeon/stand/boot/libsa.h deleted file mode 100644 index 9afddcf500b..00000000000 --- a/sys/arch/octeon/stand/boot/libsa.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: libsa.h,v 1.5 2019/04/10 04:17:36 deraadt Exp $ */ - -/* - * Copyright (c) 2013 Jasper Lievisse Adriaanse <jasper@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <lib/libsa/stand.h> - -#define DEFAULT_KERNEL_ADDRESS 0 - -extern char *kernelfile; - -/* - * MD interfaces for MI boot(9) - */ -void devboot(dev_t, char *); -void machdep(void); -void run_loadfile(uint64_t *, int); - -/* - * CN30XX UART - */ -void cn30xxuartcnprobe(struct consdev *); -void cn30xxuartcninit(struct consdev *); -void cn30xxuartcnputc(dev_t, int); -int cn30xxuartcngetc(dev_t); - -/* - * clock - */ -void delay(int); -u_int cp0_get_count(void); diff --git a/sys/arch/octeon/stand/boot/machdep.c b/sys/arch/octeon/stand/boot/machdep.c deleted file mode 100644 index e1d44dde3cc..00000000000 --- a/sys/arch/octeon/stand/boot/machdep.c +++ /dev/null @@ -1,183 +0,0 @@ -/* $OpenBSD: machdep.c,v 1.9 2016/10/09 11:25:40 tom Exp $ */ - -/* - * Copyright (c) 2009, 2010 Miodrag Vallat. - * Copyright (c) 2013, 2014 Jasper Lievisse Adriaanse <jasper@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * 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 THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include <sys/param.h> -#include <lib/libkern/libkern.h> -#include "libsa.h" -#include <stand/boot/cmd.h> -#include <machine/cpu.h> -#include <machine/octeonreg.h> -#include <machine/octeonvar.h> - -struct boot_desc *boot_desc; -struct boot_info *boot_info; - -char uboot_rootdev[OCTEON_ARGV_MAX]; -char bootdev[16]; - -int parse_rootdev(void); - -/* - * We need to save the arguments u-boot setup for us, so we can pass them - * onwards to the kernel later on. - */ -int -mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, - __register_t a3) -{ - boot_desc = (struct boot_desc *)a3; - boot_info = - (struct boot_info *)PHYS_TO_CKSEG0(boot_desc->boot_info_addr); - - boot(0); - return 0; -} - -/* - * Console and TTY related functions - */ - -int -cnspeed(dev_t dev, int s) -{ - return CONSPEED; -} - -char * -ttyname(int fd) -{ - return "uboot console"; -} - -dev_t -ttydev(char *name) -{ - return (NODEV); -} - -/* - * Boot -devices and -path related functions. - */ - -void -devboot(dev_t dev, char *path) -{ - int i; - - /* - * Decode the uboot 'rootdev' argument into a device and partition - * we can use to load the kernel off. We skip the first two arguments - * since they're always the same (bootoctlinux, $image). - * We expect the 'rootdev' argument to be 'octcf0a' or the like. - */ - for (i = 1; i < boot_desc->argc; i++) { - const char *arg = - (const char*)PHYS_TO_CKSEG0(boot_desc->argv[i]); - - if (arg == NULL) - continue; - - if (strncmp(arg, "rootdev=", 8) == 0) { - if (*uboot_rootdev == '\0') { - strlcpy(uboot_rootdev, arg, - sizeof(uboot_rootdev)); - if (parse_rootdev() == 0) { - strlcpy(path, bootdev, BOOTDEVLEN); - return; - } - } else { - break; /* No point in going on. */ - } - } - } - - /* No arguments given, or it couldn't be parsed. */ - strlcpy(path, "octcf0a", BOOTDEVLEN); -} - -int -parse_rootdev(void) -{ - char *p; - size_t len; - - /* - * Take 'rootdev=sd0a' and return the device. - */ - p = strchr(uboot_rootdev, '='); - if (p == NULL) - return 1; - p++; - len = strlen(p); - if (len <= 2 || len >= sizeof bootdev - 1) - return 1; - - memcpy(bootdev, p, len); - - return 0; -} - -time_t -getsecs(void) -{ - u_int nticks = cp0_get_count(); - uint32_t freq = boot_desc->eclock; - - return (time_t)((0xffffffff - nticks) / freq); -} - -void -machdep() -{ - cninit(); -} - -__dead void -_rtt() -{ - octeon_xkphys_write_8(OCTEON_CIU_BASE + CIU_SOFT_RST, 1); - for (;;) - continue; - /* NOTREACHED */ -} diff --git a/sys/arch/octeon/stand/boot/start.S b/sys/arch/octeon/stand/boot/start.S deleted file mode 100644 index 926c28588e7..00000000000 --- a/sys/arch/octeon/stand/boot/start.S +++ /dev/null @@ -1,93 +0,0 @@ -/* $OpenBSD: start.S,v 1.3 2014/07/12 20:36:52 jasper Exp $ */ - -/* - * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * 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 THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <machine/param.h> -#include <machine/asm.h> -#include <machine/cpu.h> -#include <mips64/mips_cpu.h> -#include <machine/regnum.h> -#include <machine/cpustate.h> - - .set noreorder - .set mips64r2 - - .globl __start - .globl kernel_text -kernel_text = __start -LEAF(cp0_get_count, 0) - MFC0 v0, COP_0_COUNT - MFC0_HAZARD - j ra - NOP -END(cp0_get_count) - -__start: -/* initialize ebase */ - dla t0, 0xffffffff80000000 - mtc0 t0, COP_0_EBASE - -/* initialize cvmctl */ - dli t0, 0x900043F0 - dmtc0 t0, COP_0_CVMCTL - -/* initialize cvmmemctl */ - dli t0, 0x1846104 # If you want to skip write buffer, use this - dmtc0 t0, COP_0_CVMMEMCTL - -/* initialize pagegrain */ - dli t0, 0x20000000 - dmtc0 t0, COP_0_TLB_PG_GRAIN - - mfc0 v0, COP_0_STATUS_REG - li v1, ~(SR_INT_ENAB | SR_ERL | SR_EXL) - and v0, v1 - mtc0 v0, COP_0_STATUS_REG # disable all interrupts - - mtc0 zero, COP_0_CAUSE_REG # Clear soft interrupts - - LA gp, _gp - - /* - * Initialize stack and call bootloader setup. - */ - LA t0, __start - FRAMESZ(CF_SZ) - PTR_S ra, CF_RA_OFFS(t0) # save uboot return address - PTR_S sp, 0(t0) # and stack - move sp, t0 - jal mips_init # mips_init(argc, argv, envp, - nop # callvec, esym) - - beqz v0, 1f # upon failure, return to uboot - nop - - move a0, zero - PANIC("Startup failed!") - -1: PTR_L ra, CF_RA_OFFS(sp) - PTR_L sp, 0(sp) - jr ra - nop diff --git a/sys/arch/octeon/stand/boot/uart.c b/sys/arch/octeon/stand/boot/uart.c deleted file mode 100644 index 02cee69cfdb..00000000000 --- a/sys/arch/octeon/stand/boot/uart.c +++ /dev/null @@ -1,137 +0,0 @@ -/* $OpenBSD: uart.c,v 1.8 2014/07/12 14:15:06 jasper Exp $ */ - -/* - * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) - * - * 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 THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include <sys/param.h> -#include <sys/device.h> -#include <sys/tty.h> - -#include <machine/bus.h> -#include <machine/cpu.h> - -#include <dev/ic/comreg.h> -#include <dev/ic/comvar.h> -#include <dev/cons.h> -#include <machine/octeonvar.h> - -#include "libsa.h" - -#define OCTEON_MIO_UART0_RBR 0x0001180000000800ull -#define OCTEON_MIO_UART0_IER 0x0001180000000808ull -#define OCTEON_MIO_UART0_IIR 0x0001180000000810ull -#define OCTEON_MIO_UART0_LCR 0x0001180000000818ull -#define OCTEON_MIO_UART0_MCR 0x0001180000000820ull -#define OCTEON_MIO_UART0_LSR 0x0001180000000828ull -#define OCTEON_MIO_UART0_MSR 0x0001180000000830ull -#define OCTEON_MIO_UART0_THR 0x0001180000000840ull -#define OCTEON_MIO_UART0_USR 0x0001180000000938ull -#define OCTEON_MIO_UART0_FCR 0x0001180000000850ull -#define OCTEON_MIO_UART0_DLL 0x0001180000000880ull -#define OCTEON_MIO_UART0_DLH 0x0001180000000888ull - -#define USR_TXFIFO_NOTFULL 2 - -int cn30xxuart_delay(void); -void cn30xxuart_wait_txhr_empty(int); - -/* - * Early console routines. - */ -int -cn30xxuart_delay(void) -{ - int divisor; - int lcr; - lcr = octeon_xkphys_read_8(OCTEON_MIO_UART0_LCR); - octeon_xkphys_write_8(OCTEON_MIO_UART0_LCR, lcr | LCR_DLAB); - - divisor = (octeon_xkphys_read_8(OCTEON_MIO_UART0_DLL) | - (octeon_xkphys_read_8(OCTEON_MIO_UART0_DLH) << 8)); - octeon_xkphys_write_8(OCTEON_MIO_UART0_LCR, lcr); - - return (10); -} - -void -cn30xxuart_wait_txhr_empty(int d) -{ - while(((octeon_xkphys_read_8(OCTEON_MIO_UART0_LSR) & LSR_TXRDY) == 0) && - ((octeon_xkphys_read_8(OCTEON_MIO_UART0_USR) & USR_TXFIFO_NOTFULL) == 0)) - delay(d); -} - -void -cn30xxuartcninit(struct consdev *consdev) -{ - int ier; - /* Disable interrupts */ - ier = octeon_xkphys_read_8(OCTEON_MIO_UART0_IER) & 0x0; - octeon_xkphys_write_8(OCTEON_MIO_UART0_IER, ier); - - /* Enable RTS & DTR */ - octeon_xkphys_write_8(OCTEON_MIO_UART0_MCR, MCR_RTS | MCR_DTR); -} - -void -cn30xxuartcnprobe(struct consdev *cn) -{ - cn->cn_pri = CN_HIGHPRI; - cn->cn_dev = makedev(CONSMAJOR, 0); -} - -void -cn30xxuartcnputc (dev_t dev, int c) -{ - int d; - - /* 1/10th the time to transmit 1 character (estimate). */ - d = cn30xxuart_delay(); - cn30xxuart_wait_txhr_empty(d); - octeon_xkphys_write_8(OCTEON_MIO_UART0_THR, c); - cn30xxuart_wait_txhr_empty(d); -} - -int -cn30xxuartcngetc (dev_t dev) -{ - int c, d; - - /* 1/10th the time to transmit 1 character (estimate). */ - d = cn30xxuart_delay(); - - if (dev & 0x80) - return octeon_xkphys_read_8(OCTEON_MIO_UART0_LSR) & LSR_RXRDY; - - while ((octeon_xkphys_read_8(OCTEON_MIO_UART0_LSR) & LSR_RXRDY) == 0) - delay(d); - - c = octeon_xkphys_read_8(OCTEON_MIO_UART0_RBR); - if (c == '\r') - c = '\n'; - - return (c); -} |