diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-12-31 11:44:58 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-12-31 11:44:58 +0000 |
commit | 6cb55580502e7d6436fc68e5d9dac0ae96da8645 (patch) | |
tree | 4ddebfe3af16458c5f1ade77ddaf3ab3fa0c7071 /sys/arch | |
parent | 4ade9923db59bbcb1599af6d0c9b5bbd1d525a45 (diff) |
Cleanup bootloader code. Compile with -ffreestanding and add ffs.S as a
build dependency which is required because of that. Add various include
files and some prototypes and change some code so that clang does not issue
warnings anymore.
OK kettenis@ deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/stand/Makefile.inc | 5 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/Locore.c | 7 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/boot.c | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/disk.h | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/diskprobe.c | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/elf64_exec.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/net.c | 12 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/ofdev.c | 10 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/ofdev.h | 5 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/vers.c | 2 |
12 files changed, 43 insertions, 19 deletions
diff --git a/sys/arch/sparc64/stand/Makefile.inc b/sys/arch/sparc64/stand/Makefile.inc index f0e3c2383f6..51515136486 100644 --- a/sys/arch/sparc64/stand/Makefile.inc +++ b/sys/arch/sparc64/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.10 2011/04/10 12:32:11 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.11 2018/12/31 11:44:57 claudio Exp $ # $NetBSD: Makefile.inc,v 1.7 2000/08/20 14:57:16 mrg Exp $ .ifndef __INCLUDED_STAND_MAKEFILE_INC @@ -17,8 +17,7 @@ CPPFLAGS+= -I. CFLAGS+= -fno-stack-protector CFLAGS+= -msoft-float -CFLAGS+= -fno-builtin-vprintf -fno-builtin-printf -fno-builtin-putchar -CFLAGS+= -fno-builtin-exit +CFLAGS+= -ffreestanding .endif ### Figure out what to use for libsa diff --git a/sys/arch/sparc64/stand/ofwboot/Locore.c b/sys/arch/sparc64/stand/ofwboot/Locore.c index 6342c2ccbb4..d43e29623c4 100644 --- a/sys/arch/sparc64/stand/ofwboot/Locore.c +++ b/sys/arch/sparc64/stand/ofwboot/Locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: Locore.c,v 1.15 2018/06/26 19:43:27 kettenis Exp $ */ +/* $OpenBSD: Locore.c,v 1.16 2018/12/31 11:44:57 claudio Exp $ */ /* $NetBSD: Locore.c,v 1.1 2000/08/20 14:58:36 mrg Exp $ */ /* @@ -38,6 +38,11 @@ #include <machine/cpu.h> +#ifdef SOFTRAID +#include <dev/softraidvar.h> +#include <lib/libsa/softraid.h> +#endif + static vaddr_t OF_claim_virt(vaddr_t vaddr, int len); static vaddr_t OF_alloc_virt(int len, int align); static int OF_free_virt(vaddr_t vaddr, int len); diff --git a/sys/arch/sparc64/stand/ofwboot/Makefile b/sys/arch/sparc64/stand/ofwboot/Makefile index 88beb85fd19..2cf8dfc74ef 100644 --- a/sys/arch/sparc64/stand/ofwboot/Makefile +++ b/sys/arch/sparc64/stand/ofwboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.25 2016/11/06 16:04:21 tb Exp $ +# $OpenBSD: Makefile,v 1.26 2018/12/31 11:44:57 claudio Exp $ # $NetBSD: Makefile,v 1.2 2001/03/04 14:50:05 mrg Exp $ CURDIR= ${.CURDIR} @@ -27,7 +27,7 @@ SRCS+= diskprobe.c softraid_sparc64.c .endif .PATH: ${S}/lib/libkern/arch/sparc64 ${S}/lib/libkern -SRCS+= strlcpy.c strcmp.c strlcat.c strlen.c +SRCS+= strlcpy.c strcmp.c strlcat.c strlen.c ffs.S .if ${SOFTRAID:L} == "yes" .PATH: ${S}/lib/libsa diff --git a/sys/arch/sparc64/stand/ofwboot/boot.c b/sys/arch/sparc64/stand/ofwboot/boot.c index 2321dea65ed..fdf818a0c75 100644 --- a/sys/arch/sparc64/stand/ofwboot/boot.c +++ b/sys/arch/sparc64/stand/ofwboot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.29 2018/08/10 16:41:35 jsing Exp $ */ +/* $OpenBSD: boot.c,v 1.30 2018/12/31 11:44:57 claudio Exp $ */ /* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */ /* * Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved. @@ -46,6 +46,7 @@ #define ELFSIZE 64 #include <lib/libsa/stand.h> +#include <lib/libkern/funcs.h> #include <sys/param.h> #include <sys/exec.h> diff --git a/sys/arch/sparc64/stand/ofwboot/disk.h b/sys/arch/sparc64/stand/ofwboot/disk.h index 929ed93758d..2e4518596fa 100644 --- a/sys/arch/sparc64/stand/ofwboot/disk.h +++ b/sys/arch/sparc64/stand/ofwboot/disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.h,v 1.2 2018/03/29 08:12:58 stsp Exp $ */ +/* $OpenBSD: disk.h,v 1.3 2018/12/31 11:44:57 claudio Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -50,4 +50,6 @@ extern struct disklist_lh disklist; extern struct diskinfo *bootdev_dip; +void diskprobe(void); + #endif /* _DISK_H */ diff --git a/sys/arch/sparc64/stand/ofwboot/diskprobe.c b/sys/arch/sparc64/stand/ofwboot/diskprobe.c index 568cfb7dab6..e4933b850ce 100644 --- a/sys/arch/sparc64/stand/ofwboot/diskprobe.c +++ b/sys/arch/sparc64/stand/ofwboot/diskprobe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diskprobe.c,v 1.5 2018/06/26 19:43:27 kettenis Exp $ */ +/* $OpenBSD: diskprobe.c,v 1.6 2018/12/31 11:44:57 claudio Exp $ */ /* * Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org> @@ -20,6 +20,7 @@ #include <sys/param.h> #include <sys/disklabel.h> +#include <lib/libkern/funcs.h> #include <lib/libsa/stand.h> #include "ofdev.h" diff --git a/sys/arch/sparc64/stand/ofwboot/elf64_exec.c b/sys/arch/sparc64/stand/ofwboot/elf64_exec.c index bc25fcc4309..4ae5bee3821 100644 --- a/sys/arch/sparc64/stand/ofwboot/elf64_exec.c +++ b/sys/arch/sparc64/stand/ofwboot/elf64_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elf64_exec.c,v 1.8 2016/09/11 15:54:11 jsing Exp $ */ +/* $OpenBSD: elf64_exec.c,v 1.9 2018/12/31 11:44:57 claudio Exp $ */ /* $NetBSD: elfXX_exec.c,v 1.2 2001/08/15 20:08:15 eeh Exp $ */ /* @@ -69,6 +69,8 @@ #include "openfirm.h" +void syncicache(void *, int); + int elf64_exec(int fd, Elf_Ehdr *elf, u_int64_t *entryp, void **ssymp, void **esymp){ Elf_Shdr *shp; diff --git a/sys/arch/sparc64/stand/ofwboot/net.c b/sys/arch/sparc64/stand/ofwboot/net.c index 052a879f99a..e416190349a 100644 --- a/sys/arch/sparc64/stand/ofwboot/net.c +++ b/sys/arch/sparc64/stand/ofwboot/net.c @@ -1,4 +1,4 @@ -/* $OpenBSD: net.c,v 1.6 2014/08/21 14:24:08 mpi Exp $ */ +/* $OpenBSD: net.c,v 1.7 2018/12/31 11:44:57 claudio Exp $ */ /* $NetBSD: net.c,v 1.1 2000/08/20 14:58:38 mrg Exp $ */ /* @@ -60,11 +60,15 @@ #include <lib/libsa/stand.h> #include <lib/libsa/net.h> #include <lib/libsa/netif.h> +#include <lib/libsa/bootparam.h> +#include <lib/libsa/bootp.h> +#include <lib/libsa/nfs.h> #include "ofdev.h" -static int net_mountroot_bootparams(void); -static int net_mountroot_bootp(void); +int net_mountroot_bootparams(void); +int net_mountroot_bootp(void); +int net_mountroot(void); char rootpath[FNAME_SIZE]; @@ -101,7 +105,7 @@ bad: return error; } -int +void net_close(struct of_dev *op) { /* diff --git a/sys/arch/sparc64/stand/ofwboot/ofdev.c b/sys/arch/sparc64/stand/ofwboot/ofdev.c index 8e2d22d0616..cc9d59703b2 100644 --- a/sys/arch/sparc64/stand/ofwboot/ofdev.c +++ b/sys/arch/sparc64/stand/ofwboot/ofdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofdev.c,v 1.26 2018/03/29 08:12:58 stsp Exp $ */ +/* $OpenBSD: ofdev.c,v 1.27 2018/12/31 11:44:57 claudio Exp $ */ /* $NetBSD: ofdev.c,v 1.1 2000/08/20 14:58:41 mrg Exp $ */ /* @@ -40,6 +40,7 @@ #include <netinet/in.h> #endif +#include <lib/libkern/funcs.h> #include <lib/libsa/stand.h> #include <lib/libsa/ufs.h> #include <lib/libsa/cd9660.h> @@ -50,12 +51,17 @@ #ifdef SOFTRAID #include <sys/queue.h> #include <dev/softraidvar.h> +#include "softraid_sparc64.h" #include "disk.h" #endif #include <dev/sun/disklabel.h> +#include "openfirm.h" #include "ofdev.h" +/* needed for DISKLABELV1_FFS_FRAGBLOCK */ +int ffs(int); + extern char bootdev[]; /* @@ -687,7 +693,7 @@ devopen(struct open_file *of, const char *name, char **file) of->f_devdata = &ofdev; bcopy(&file_system_nfs, file_system, sizeof file_system[0]); nfsys = 1; - if (error = net_open(&ofdev)) + if ((error = net_open(&ofdev))) goto bad; return 0; } diff --git a/sys/arch/sparc64/stand/ofwboot/ofdev.h b/sys/arch/sparc64/stand/ofwboot/ofdev.h index a3ec6a9f63a..a2b198370b7 100644 --- a/sys/arch/sparc64/stand/ofwboot/ofdev.h +++ b/sys/arch/sparc64/stand/ofwboot/ofdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ofdev.h,v 1.5 2014/11/26 20:30:41 stsp Exp $ */ +/* $OpenBSD: ofdev.h,v 1.6 2018/12/31 11:44:57 claudio Exp $ */ /* $NetBSD: ofdev.h,v 1.1 2000/08/20 14:58:41 mrg Exp $ */ /* @@ -66,4 +66,7 @@ extern int floppyboot; int load_disklabel(struct of_dev *, struct disklabel *); int strategy(void *, int, daddr32_t, size_t, void *, size_t *); +int net_open(struct of_dev *); +void net_close(struct of_dev *); + #endif diff --git a/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c b/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c index 534b4ebbf15..c7fc477432d 100644 --- a/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c +++ b/sys/arch/sparc64/stand/ofwboot/softraid_sparc64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_sparc64.c,v 1.3 2018/03/29 08:12:58 stsp Exp $ */ +/* $OpenBSD: softraid_sparc64.c,v 1.4 2018/12/31 11:44:57 claudio Exp $ */ /* * Copyright (c) 2012 Joel Sing <jsing@openbsd.org> @@ -29,6 +29,7 @@ #include <lib/libsa/softraid.h> #include "disk.h" +#include "openfirm.h" #include "ofdev.h" #include "softraid_sparc64.h" diff --git a/sys/arch/sparc64/stand/ofwboot/vers.c b/sys/arch/sparc64/stand/ofwboot/vers.c index 563b9218a97..46d497a5426 100644 --- a/sys/arch/sparc64/stand/ofwboot/vers.c +++ b/sys/arch/sparc64/stand/ofwboot/vers.c @@ -1 +1 @@ -const char version[] = "1.11"; +const char version[] = "1.12"; |