From 84b399de519961b8ef8fb45fa4c029c20755158c Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Mon, 3 May 1999 09:36:29 +0000 Subject: [PATCH] Changes to support diskless booting on the alpha: * Make the network code in the bootstrap more chatty (helps debugging) * Add nfs root stuff to cpu_rootconf(). I also added a check to make sure it really was netbooting which allows the use of the same kernel for local and network boots. * Tweak the de driver so that it takes the speed setting from the console for the alpha (some PWSs have broken de chipsets). This is the same behaviour as NetBSD/alpha. Submitted by: Andrew Gallatin --- sys/alpha/alpha/autoconf.c | 21 ++++++++++++++++++++- sys/boot/common/dev_net.c | 25 +++++++++++++++++++++---- sys/dev/de/if_de.c | 10 +++++----- sys/pci/if_de.c | 10 +++++----- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/sys/alpha/alpha/autoconf.c b/sys/alpha/alpha/autoconf.c index e5489c6c11d1..032fbdd61127 100644 --- a/sys/alpha/alpha/autoconf.c +++ b/sys/alpha/alpha/autoconf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: autoconf.c,v 1.15 1999/03/28 17:33:38 dfr Exp $ + * $Id: autoconf.c,v 1.16 1999/04/16 21:21:25 peter Exp $ */ #include "opt_bootp.h" @@ -67,6 +67,8 @@ static int setdumpdev __P((dev_t dev)); device_t isa_bus_device = 0; struct cam_sim *boot_sim = 0; +extern int nfs_diskless_valid; + static void configure_start() @@ -227,6 +229,23 @@ cpu_rootconf() } #endif +#ifdef BOOTP_NFSROOT + if (!strcmp(bootdev_protocol(), "BOOTP") + && !mountrootfsname && !nfs_diskless_valid) { + if (bootverbose) + printf("Considering BOOTP NFS root f/s.\n"); + mountrootfsname = "nfs"; + } +#endif /* BOOTP_NFSROOT */ +#if defined(NFS) || defined(NFS_ROOT) + if (!mountrootfsname && nfs_diskless_valid) { + if (bootverbose) + printf("Considering NFS root f/s.\n"); + mountrootfsname = "nfs"; + } +#endif /* NFS */ + + #if defined(FFS) || defined(FFS_ROOT) if (!mountrootfsname) { static char rootname[] = "da0a"; diff --git a/sys/boot/common/dev_net.c b/sys/boot/common/dev_net.c index d4b8a9c46b0d..a66523a08ac0 100644 --- a/sys/boot/common/dev_net.c +++ b/sys/boot/common/dev_net.c @@ -1,5 +1,5 @@ /* - * $Id: dev_net.c,v 1.2 1998/08/22 10:31:01 dfr Exp $ + * $Id: dev_net.c,v 1.3 1998/09/20 21:46:19 dfr Exp $ * From: $NetBSD: dev_net.c,v 1.12 1997/12/10 20:38:37 gwr Exp $ */ @@ -65,6 +65,7 @@ #include #include +#include #include #include #include @@ -206,6 +207,8 @@ net_getparams(sock) int sock; { char buf[MAXHOSTNAMELEN]; + char temp[FNAME_SIZE]; + int i; n_long smask; #ifdef SUPPORT_BOOTP @@ -218,7 +221,7 @@ net_getparams(sock) if (try_bootp) bootp(sock); if (myip.s_addr != 0) - return (0); + goto exit; if (debug) printf("net_open: BOOTP failed, trying RARP/RPC...\n"); #endif @@ -262,9 +265,23 @@ net_getparams(sock) printf("net_open: bootparam/getfile RPC failed\n"); return (EIO); } - + exit: printf("net_open: server addr: %s\n", inet_ntoa(rootip)); - printf("net_open: server path: %s\n", rootpath); + /* + * If present, strip the server's address off of the rootpath + * before passing it along. This allows us to be compatible with + * the kernel's diskless (BOOTP_NFSROOT) booting conventions + */ + + for(i=0; itulip_pci_busno = parent; \ (sc)->tulip_pci_devno = pa->pa_device; \ } while (0) +#endif /* __NetBSD__ */ #if defined(__alpha__) tulip_media_t media = TULIP_MEDIA_UNKNOWN; #endif -#endif /* __NetBSD__ */ int retval, idx; u_int32_t revinfo, cfdainfo, id; #if !defined(TULIP_IOMAPPED) && defined(__FreeBSD__) @@ -5713,7 +5713,7 @@ tulip_pci_attach( PCI_CONF_WRITE(PCI_CFDA, cfdainfo); DELAY(11*1000); } -#if defined(__alpha__) && defined(__NetBSD__) +#if defined(__alpha__) /* * The Alpha SRM console encodes a console set media in the driver * part of the CFDA register. Note that the Multia presents a @@ -5915,11 +5915,11 @@ tulip_pci_attach( #endif s = TULIP_RAISESPL(); -#if defined(__alpha__) && defined(__NetBSD__) +#if defined(__alpha__) sc->tulip_media = media; #endif tulip_attach(sc); -#if defined(__alpha__) && defined(__NetBSD__) +#if defined(__alpha__) if (sc->tulip_media != TULIP_MEDIA_UNKNOWN) tulip_linkup(sc, media); #endif diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index 045d75a5f85a..8728d3992a45 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -1,5 +1,5 @@ /* $NetBSD: if_de.c,v 1.82 1999/02/28 17:08:51 explorer Exp $ */ -/* $Id: if_de.c,v 1.102 1999/03/17 16:44:52 luigi Exp $ */ +/* $Id: if_de.c,v 1.103 1999/04/24 20:13:59 peter Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -5607,10 +5607,10 @@ tulip_pci_attach( (sc)->tulip_pci_busno = parent; \ (sc)->tulip_pci_devno = pa->pa_device; \ } while (0) +#endif /* __NetBSD__ */ #if defined(__alpha__) tulip_media_t media = TULIP_MEDIA_UNKNOWN; #endif -#endif /* __NetBSD__ */ int retval, idx; u_int32_t revinfo, cfdainfo, id; #if !defined(TULIP_IOMAPPED) && defined(__FreeBSD__) @@ -5713,7 +5713,7 @@ tulip_pci_attach( PCI_CONF_WRITE(PCI_CFDA, cfdainfo); DELAY(11*1000); } -#if defined(__alpha__) && defined(__NetBSD__) +#if defined(__alpha__) /* * The Alpha SRM console encodes a console set media in the driver * part of the CFDA register. Note that the Multia presents a @@ -5915,11 +5915,11 @@ tulip_pci_attach( #endif s = TULIP_RAISESPL(); -#if defined(__alpha__) && defined(__NetBSD__) +#if defined(__alpha__) sc->tulip_media = media; #endif tulip_attach(sc); -#if defined(__alpha__) && defined(__NetBSD__) +#if defined(__alpha__) if (sc->tulip_media != TULIP_MEDIA_UNKNOWN) tulip_linkup(sc, media); #endif