1 /* $NetBSD: sboot.c,v 1.5 2005/12/24 22:45:36 perry Exp $ */
5 * Copyright (c) 1995 Charles D. Cranor and Seth Widoff
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Charles D. Cranor
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 * main driver, plus machdep stuff
42 extern char bootprog_rev
[];
51 printf("\nsboot: serial line bootstrap program (&end = %p) [%s]\n\n",
53 if (reboot
) { /* global flag from AAstart.s */
55 printf("[rebooting...]\n");
62 ebuf
= ngets(buf
, sizeof(buf
));
76 __asm("trap #15; .word 0x0063");
80 * do_cmd: do a command
84 do_cmd(char *buf
, char *ebuf
)
92 printf("My ip address is: %d.%d.%d.%d\n",
93 myip
[0], myip
[1], myip
[2], myip
[3]);
94 printf("Server ip address is: %d.%d.%d.%d\n",
95 servip
[0], servip
[1], servip
[2], servip
[3]);
101 printf("exiting to ROM\n");
105 if (do_get_file() == 1) {
106 printf("Download Failed\n");
108 printf("Download was a success!\n");
114 printf("My ip address is: %d.%d.%d.%d\n",
115 myip
[0], myip
[1], myip
[2], myip
[3]);
116 printf("Server ip address is: %d.%d.%d.%d\n",
117 servip
[0], servip
[1], servip
[2], servip
[3]);
119 printf("REVARP: Failed.\n");
122 if (do_get_file() == 1) {
123 printf("Download Failed\n");
126 printf("Download was a success!\n");
130 printf("Start @ 0x%x ... \n", LOAD_ADDR
);
131 go(LOAD_ADDR
, buf
+1, ebuf
);
135 printf("valid commands\n");
136 printf("a - send a RARP\n");
137 printf("b - boot the system\n");
138 printf("e - exit to ROM\n");
139 printf("f - ftp the boot file\n");
140 printf("g - execute the boot file\n");
141 printf("h - help\n");
142 printf("i - init LANCE enet chip\n");
148 printf("sboot: %s: Unknown command\n", buf
);