diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-01-01 17:18:50 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-01-01 17:18:50 +0000 |
commit | 09483410d6c16f2e5c8c9bb95d292904a53b18d2 (patch) | |
tree | 7d1d71f1a1b820a352ea244c24d715606dc8925c /sys/arch | |
parent | 246e62282b1efbb28be85d6c5a9c54cef747c7d8 (diff) |
Switch hp300 boot blocks to MI loadfile code.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hp300/include/loadfile_machdep.h | 49 | ||||
-rw-r--r-- | sys/arch/hp300/stand/common/version.c | 34 | ||||
-rw-r--r-- | sys/arch/hp300/stand/libsa/Makefile | 9 | ||||
-rw-r--r-- | sys/arch/hp300/stand/libsa/exec_hp300.c | 59 |
4 files changed, 131 insertions, 20 deletions
diff --git a/sys/arch/hp300/include/loadfile_machdep.h b/sys/arch/hp300/include/loadfile_machdep.h new file mode 100644 index 00000000000..830569e1489 --- /dev/null +++ b/sys/arch/hp300/include/loadfile_machdep.h @@ -0,0 +1,49 @@ +/* $OpenBSD: loadfile_machdep.h,v 1.1 2013/01/01 17:18:49 miod Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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. + */ + +#define BOOT_AOUT +#define BOOT_ELF + +#define LOAD_KERNEL LOAD_ALL +#define COUNT_KERNEL COUNT_ALL + +#define LOADADDR(a) (((u_long)(a)) + offset) +#define ALIGNENTRY(a) 0 +#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) +#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) +#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) +#define WARN(a) (void)(printf a, \ + printf((errno ? ": %s\n" : "\n"), \ + strerror(errno))) +#define PROGRESS(a) (void) printf a +#define ALLOC(a) alloc(a) +#define FREE(a, b) free(a, b) +#define OKMAGIC(a) ((a) == NMAGIC) diff --git a/sys/arch/hp300/stand/common/version.c b/sys/arch/hp300/stand/common/version.c index bd02be8a131..5a3fa7ca5af 100644 --- a/sys/arch/hp300/stand/common/version.c +++ b/sys/arch/hp300/stand/common/version.c @@ -1,4 +1,4 @@ -/* $OpenBSD: version.c,v 1.10 2011/08/18 20:02:58 miod Exp $ */ +/* $OpenBSD: version.c,v 1.11 2013/01/01 17:18:49 miod Exp $ */ /* * Record major changes in the boot code here, and increment the version @@ -6,21 +6,21 @@ */ /* - * 2.0 INITIAL REVISION - * 2.1 APCI support, config changes from NetBSD. - * 2.2 Grand reorganization. - * 2.3 Added CD9660 boot support. - * 2.4 Added/fixed 425e support. - * 2.5 Added SYS_CDBOOT. - * 2.6 Fixed RTC reading for 2001. - * 2.7 Minor syncs with the kernel (recognize more models - * and use the same logic to pick the console on 425e). - * 2.8 TurboVRX frame buffer support. - * 2.9 SGC frame buffers support, bug fixes and code cleanup. - * 2.10 blind SGC support on models 362 and 382, turned out - * to be useless. - * 2.11 sti@dio frame buffer support (for models 362 and 382), - * and various cleanups. + * 2.0 INITIAL REVISION + * 2.1 APCI support, config changes from NetBSD. + * 2.2 Grand reorganization. + * 2.3 Added CD9660 boot support. + * 2.4 Added/fixed 425e support. + * 2.5 Added SYS_CDBOOT. + * 2.6 Fixed RTC reading for 2001. + * 2.7 Minor syncs with the kernel (recognize more models and use the same + * logic to pick the console on 425e). + * 2.8 TurboVRX frame buffer support. + * 2.9 SGC frame buffers support, bug fixes and code cleanup. + * 2.10 Blind SGC support on models 362 and 382, turned out to be useless. + * 2.11 sti@dio frame buffer support (for models 362 and 382), and various + * cleanups. + * 2.12 Switch to MI loadfile code. */ -const char version[] = "2.11"; +const char version[] = "2.12"; diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile index d6049d666e2..4290dff1c02 100644 --- a/sys/arch/hp300/stand/libsa/Makefile +++ b/sys/arch/hp300/stand/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.16 2013/01/01 17:17:44 miod Exp $ +# $OpenBSD: Makefile,v 1.17 2013/01/01 17:18:49 miod Exp $ LIB= sa @@ -8,9 +8,12 @@ CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../include -I${.CURDIR}/../.. \ -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. \ -I${.CURDIR}/../../../../lib/libsa +# local source +SRCS+= devopen.c exec_hp300.c rawfs.c + # stand routines .PATH: ${.CURDIR}/../../../../lib/libsa -SRCS+= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \ +SRCS+= alloc.c exit.c getfile.c gets.c globals.c loadfile.c \ memcmp.c memcpy.c memset.c printf.c snprintf.c strcmp.c \ strerror.c strlen.c strncmp.c strncpy.c @@ -28,7 +31,7 @@ SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c SRCS+= bootp.c bootparam.c rarp.c # boot filesystems -SRCS+= ufs.c nfs.c rawfs.c cd9660.c +SRCS+= ufs.c nfs.c cd9660.c NOPROFILE= NOPIC= diff --git a/sys/arch/hp300/stand/libsa/exec_hp300.c b/sys/arch/hp300/stand/libsa/exec_hp300.c new file mode 100644 index 00000000000..5ba662833e6 --- /dev/null +++ b/sys/arch/hp300/stand/libsa/exec_hp300.c @@ -0,0 +1,59 @@ +/* $OpenBSD: exec_hp300.c,v 1.1 2013/01/01 17:18:49 miod Exp $ */ +/* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */ + +/*- + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/reboot.h> + +#include "stand.h" + +#include <lib/libsa/loadfile.h> + +void +exec(char *path, void *loadaddr, int howto) +{ + u_long marks[MARK_MAX]; + int rc; + + marks[MARK_START] = (u_long)loadaddr; + rc = loadfile(path, marks, LOAD_KERNEL | COUNT_KERNEL); + if (rc != 0) + return; + + printf("Start @ 0x%lx\n", marks[MARK_START]); + + machdep_start((char *)marks[MARK_START], howto, loadaddr, + (char *)marks[MARK_SYM], (char *)marks[MARK_END]); + + /* exec failed */ + printf("exec: kernel returned!\n"); + errno = ENOEXEC; +} |