diff options
Diffstat (limited to 'sys/arch/mvme68k/stand/netboot')
-rw-r--r-- | sys/arch/mvme68k/stand/netboot/conf.c | 23 | ||||
-rw-r--r-- | sys/arch/mvme68k/stand/netboot/dev_net.c | 107 | ||||
-rw-r--r-- | sys/arch/mvme68k/stand/netboot/if_ie.c | 27 | ||||
-rw-r--r-- | sys/arch/mvme68k/stand/netboot/if_le.c | 20 |
4 files changed, 102 insertions, 75 deletions
diff --git a/sys/arch/mvme68k/stand/netboot/conf.c b/sys/arch/mvme68k/stand/netboot/conf.c index a3067798fcb..963fd96ed42 100644 --- a/sys/arch/mvme68k/stand/netboot/conf.c +++ b/sys/arch/mvme68k/stand/netboot/conf.c @@ -1,21 +1,32 @@ -/* $NetBSD: conf.c,v 1.1.1.1.2.1 1995/10/12 20:38:59 chuck Exp $ */ +/* $NetBSD: conf.c,v 1.1.1.1 1995/06/09 22:02:40 gwr Exp $ */ #include <sys/types.h> #include <netinet/in.h> +#include <netinet/in_systm.h> -#include "stand.h" -#include "nfs.h" -#include "dev_net.h" +#include <stand.h> +#include <nfs.h> +#include <dev_net.h> struct fs_ops file_system[] = { { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat }, }; -int nfsys = 1; +int nfsys = sizeof(file_system) / sizeof(file_system[0]); struct devsw devsw[] = { { "net", net_strategy, net_open, net_close, net_ioctl }, }; -int ndevs = 1; +int ndevs = sizeof(devsw) / sizeof(devsw[0]); + +extern struct netif_driver le_driver; +extern struct netif_driver ie_driver; + +struct netif_driver *netif_drivers[] = { + &le_driver, + &ie_driver, +}; +int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]); + /* XXX */ int netif_debug; diff --git a/sys/arch/mvme68k/stand/netboot/dev_net.c b/sys/arch/mvme68k/stand/netboot/dev_net.c index fa6b03de9ce..fdcbbb012b3 100644 --- a/sys/arch/mvme68k/stand/netboot/dev_net.c +++ b/sys/arch/mvme68k/stand/netboot/dev_net.c @@ -1,4 +1,4 @@ -/* $NetBSD: dev_net.c,v 1.2.2.1 1995/10/12 20:39:02 chuck Exp $ */ +/* $NetBSD: dev_net.c,v 1.1.1.1 1995/06/09 22:02:40 gwr Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross @@ -58,34 +58,15 @@ #include "stand.h" #include "net.h" #include "netif.h" +#include "config.h" #include "bootparam.h" extern int nfs_root_node[]; /* XXX - get from nfs_mount() */ -/* - * Various globals needed by the network code: - */ - -/* for arp.c, rarp.c */ -u_char bcea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -struct in_addr myip; /* my ip address */ -struct in_addr rootip; /* root ip address */ -struct in_addr gateip; /* swap ip address */ -n_long netmask; /* subnet or net mask */ - +struct in_addr myip, rootip, gateip, mask; char rootpath[FNAME_SIZE]; -int hostnamelen; -char hostname[FNAME_SIZE]; - -int domainnamelen; -char domainname[FNAME_SIZE]; - -/* - * Local things... - */ -static int netdev_sock = -1; +int netdev_sock = -1; static int open_count; /* @@ -154,43 +135,77 @@ net_mountroot(f, devname) */ #ifdef SUN_BOOTPARAMS + /* Get boot info using RARP and Sun bootparams. */ + /* Get our IP address. (rarp.c) */ - if (rarp_getipaddress(netdev_sock)) + if ((myip.s_addr = rarp_getipaddress(netdev_sock)) == 0) return (EIO); -#else /* BOOTPARAMS */ - /* - * Get boot info using BOOTP. (RFC951, RFC1048) - * This also gets the server IP address, gateway, - * root path, etc. - */ - bootp(netdev_sock); /* XXX - Error return? */ -#endif /* BOOTPARAMS */ + printf("boot: client IP address: %s\n", intoa(myip.s_addr)); - printf("boot: client addr: %s\n", inet_ntoa(myip)); - -#ifdef SUN_BOOTPARAMS - /* Get our hostname, server IP address, gateway. */ + /* Get our hostname, server IP address. */ if (bp_whoami(netdev_sock)) return (EIO); -#endif /* BOOTPARAMS */ - printf("boot: client name: %s\n", hostname); - if (gateip.s_addr) { - printf("boot: subnet mask: %s\n", intoa(netmask)); - printf("boot: net gateway: %s\n", inet_ntoa(gateip)); - } -#ifdef SUN_BOOTPARAMS /* Get the root pathname. */ if (bp_getfile(netdev_sock, "root", &rootip, rootpath)) return (EIO); -#endif /* BOOTPARAMS */ - printf("boot: server addr: %s\n", inet_ntoa(rootip)); - printf("boot: server path: %s\n", rootpath); +#else + + /* Get boot info using BOOTP way. (RFC951, RFC1048) */ + bootp(netdev_sock); + + printf("Using IP address: %s\n", intoa(myip.s_addr)); + + printf("myip: %s (%s)", hostname, intoa(myip)); + if (gateip) + printf(", gateip: %s", intoa(gateip)); + if (mask) + printf(", mask: %s", intoa(mask)); + printf("\n"); + +#endif + + printf("root addr=%s path=%s\n", intoa(rootip.s_addr), rootpath); /* Get the NFS file handle (mount). */ error = nfs_mount(netdev_sock, rootip, rootpath); return (error); } + +/* + * machdep_common_ether: get ethernet address + */ +void +machdep_common_ether(ether) + u_char *ether; +{ + u_char *ea; + extern int cputyp; + + if (cputyp == CPU_147) { + ea = (u_char *) ETHER_ADDR_147; + + if ((*(int *) ea & 0x2fffff00) == 0x2fffff00) + panic("ERROR: ethernet address not set!\r\n"); + ether[0] = 0x08; + ether[1] = 0x00; + ether[2] = 0x3e; + ether[3] = ea[0]; + ether[4] = ea[1]; + ether[5] = ea[2]; + } else { + ea = (u_char *) ETHER_ADDR_16X; + + if (ea[0] + ea[1] + ea[2] + ea[3] + ea[4] + ea[5] == 0) + panic("ERROR: ethernet address not set!\r\n"); + ether[0] = ea[0]; + ether[1] = ea[1]; + ether[2] = ea[2]; + ether[3] = ea[3]; + ether[4] = ea[4]; + ether[5] = ea[5]; + } +} diff --git a/sys/arch/mvme68k/stand/netboot/if_ie.c b/sys/arch/mvme68k/stand/netboot/if_ie.c index 0038a51ff1f..7c0143f8b7b 100644 --- a/sys/arch/mvme68k/stand/netboot/if_ie.c +++ b/sys/arch/mvme68k/stand/netboot/if_ie.c @@ -56,12 +56,12 @@ int ie_debug = 0; void ie_stop __P((struct netif *)); void ie_end __P((struct netif *)); void ie_error __P((struct netif *, char *, volatile struct iereg *)); -int ie_get __P((struct iodesc *, void *, int, time_t)); +int ie_get __P((struct iodesc *, void *, size_t, time_t)); void ie_init __P((struct iodesc *, void *)); int ie_match __P((struct netif *, void *)); int ie_poll __P((struct iodesc *, void *, int)); int ie_probe __P((struct netif *, void *)); -int ie_put __P((struct iodesc *, void *, int)); +int ie_put __P((struct iodesc *, void *, size_t)); void ie_reset __P((struct netif *, u_char *)); struct netif_stats ie_stats; @@ -252,7 +252,7 @@ ie_reset(nif, myea) iem->im_ic.com.ie_cmd_status = 0; iem->im_ic.com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST; iem->im_ic.com.ie_cmd_link = 0xffff; - bcopy(myea, &iem->im_ic.ie_address, sizeof iem->im_ic.ie_address); + bcopy(myea, (void *)&iem->im_ic.ie_address, sizeof iem->im_ic.ie_address); ier->ie_attention = 1; /* chan attention! */ for (t = timo * 10; t--;) @@ -315,7 +315,7 @@ ie_poll(desc, pkt, len) length = iem->im_rbd[slot].ie_rbd_actual & 0x3fff; if (length > len) length = len; - bcopy(&iem->im_rxbuf[slot * IE_RBUF_SIZE], + bcopy((void *)&iem->im_rxbuf[slot * IE_RBUF_SIZE], pkt, length); iem->im_rfd[slot].ie_fd_status = 0; @@ -360,9 +360,9 @@ ie_poll(desc, pkt, len) int ie_put(desc, pkt, len) - struct iodesc *desc; - void *pkt; - int len; + struct iodesc *desc; + void *pkt; + size_t len; { volatile struct iereg *ier = ie_softc.sc_reg; struct iemem *iem = ie_softc.sc_mem; @@ -378,7 +378,7 @@ ie_put(desc, pkt, len) ; /* copy data */ - bcopy(p, &iem->im_txbuf[xx], len); + bcopy(p, (void *)&iem->im_txbuf[xx], len); len = MAX(len, ETHER_MIN_LEN); @@ -395,7 +395,8 @@ ie_put(desc, pkt, len) iem->im_xc[xx].com.ie_cmd_link = 0xffff; iem->im_xc[xx].ie_xmit_desc = (int) &iem->im_xd[xx] - (int) iem; iem->im_xc[xx].ie_xmit_length = len; - bcopy(p, &iem->im_xc[xx].ie_xmit_addr, sizeof iem->im_xc[xx].ie_xmit_addr); + bcopy(p, (void *)&iem->im_xc[xx].ie_xmit_addr, + sizeof iem->im_xc[xx].ie_xmit_addr); iem->im_scb.ie_command = IE_CU_START; iem->im_scb.ie_command_list = (int) &iem->im_xc[xx] - (int) iem; @@ -412,10 +413,10 @@ ie_put(desc, pkt, len) int ie_get(desc, pkt, len, timeout) - struct iodesc *desc; - void *pkt; - int len; - time_t timeout; + struct iodesc *desc; + void *pkt; + size_t len; + time_t timeout; { time_t t; int cc; diff --git a/sys/arch/mvme68k/stand/netboot/if_le.c b/sys/arch/mvme68k/stand/netboot/if_le.c index 8049b69b9e0..3f646f52536 100644 --- a/sys/arch/mvme68k/stand/netboot/if_le.c +++ b/sys/arch/mvme68k/stand/netboot/if_le.c @@ -47,12 +47,12 @@ int le_debug = 0; void le_end __P((struct netif *)); void le_error __P((struct netif *, char *, volatile struct lereg1 *)); -int le_get __P((struct iodesc *, void *, int, time_t)); +int le_get __P((struct iodesc *, void *, size_t, time_t)); void le_init __P((struct iodesc *, void *)); int le_match __P((struct netif *, void *)); int le_poll __P((struct iodesc *, void *, int)); int le_probe __P((struct netif *, void *)); -int le_put __P((struct iodesc *, void *, int)); +int le_put __P((struct iodesc *, void *, size_t)); void le_reset __P((struct netif *, u_char *)); struct netif_stats le_stats; @@ -289,7 +289,7 @@ le_poll(desc, pkt, len) if (length > len) length = len; - bcopy(&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length); + bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length); } cleanup: a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd]; @@ -304,9 +304,9 @@ cleanup: int le_put(desc, pkt, len) - struct iodesc *desc; - void *pkt; - int len; + struct iodesc *desc; + void *pkt; + size_t len; { volatile struct lereg1 *ler1 = le_softc.sc_r1; volatile struct lereg2 *ler2 = le_softc.sc_r2; @@ -380,10 +380,10 @@ le_put(desc, pkt, len) int le_get(desc, pkt, len, timeout) - struct iodesc *desc; - void *pkt; - int len; - time_t timeout; + struct iodesc *desc; + void *pkt; + size_t len; + time_t timeout; { time_t t; int cc; |