From b7878de7675efb80d45bc11a6695d640eb164ebb Mon Sep 17 00:00:00 2001 From: chs Date: Wed, 18 Sep 2002 01:45:04 +0000 Subject: [PATCH] add OF_boot(), call it if the user says "reboot". try loading "netbsd.ofppc" first, to allow sharing root fs. --- sys/arch/ofppc/stand/ofwboot/Locore.c | 22 +++++++++++++++++++++- sys/arch/ofppc/stand/ofwboot/boot.c | 9 ++++++--- sys/arch/ofppc/stand/ofwboot/openfirm.h | 3 ++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/sys/arch/ofppc/stand/ofwboot/Locore.c b/sys/arch/ofppc/stand/ofwboot/Locore.c index 1a3e5b6e20b0..f1c7e4c21e79 100644 --- a/sys/arch/ofppc/stand/ofwboot/Locore.c +++ b/sys/arch/ofppc/stand/ofwboot/Locore.c @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.6 2001/10/23 03:31:25 thorpej Exp $ */ +/* $NetBSD: Locore.c,v 1.7 2002/09/18 01:45:04 chs Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -109,6 +109,26 @@ OF_exit() for (;;); /* just in case */ } +__dead void +OF_boot(bootspec) + char *bootspec; +{ + static struct { + char *name; + int nargs; + int nreturns; + char *bootspec; + } args = { + "boot", + 1, + 0, + }; + + args.bootspec = bootspec; + openfirmware(&args); + for (;;); /* just is case */ +} + int OF_finddevice(name) char *name; diff --git a/sys/arch/ofppc/stand/ofwboot/boot.c b/sys/arch/ofppc/stand/ofwboot/boot.c index 8ea70dfceb3d..a07b3add3515 100644 --- a/sys/arch/ofppc/stand/ofwboot/boot.c +++ b/sys/arch/ofppc/stand/ofwboot/boot.c @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.11 2001/10/23 03:31:26 thorpej Exp $ */ +/* $NetBSD: boot.c,v 1.12 2002/09/18 01:45:04 chs Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -106,8 +106,7 @@ char bootfile[128]; int boothowto; int debug; -static int ofw_version = 0; -static char *kernels[] = { "/netbsd", "/netbsd.gz", "/netbsd.ofppc", NULL }; +static char *kernels[] = { "/netbsd.ofppc", "/netbsd", "/netbsd.gz", NULL }; static void prom2boot(dev) @@ -135,6 +134,10 @@ parseargs(str, howtop) /* Allow user to drop back to the PROM. */ if (strcmp(str, "exit") == 0) OF_exit(); + if (strcmp(str, "halt") == 0) + OF_exit(); + if (strcmp(str, "reboot") == 0) + OF_boot(""); *howtop = 0; diff --git a/sys/arch/ofppc/stand/ofwboot/openfirm.h b/sys/arch/ofppc/stand/ofwboot/openfirm.h index 5c064b10a873..de6493f31d80 100644 --- a/sys/arch/ofppc/stand/ofwboot/openfirm.h +++ b/sys/arch/ofppc/stand/ofwboot/openfirm.h @@ -1,4 +1,4 @@ -/* $NetBSD: openfirm.h,v 1.2 1998/02/22 07:42:31 mycroft Exp $ */ +/* $NetBSD: openfirm.h,v 1.3 2002/09/18 01:45:04 chs Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -38,6 +38,7 @@ #include __dead void OF_exit __P((void)) __attribute__((noreturn)); +__dead void OF_boot __P((char *)) __attribute__((noreturn)); int OF_finddevice __P((char *name)); int OF_instance_to_package __P((int ihandle)); int OF_getprop __P((int handle, char *prop, void *buf, int buflen));