summaryrefslogtreecommitdiff
path: root/sys/arch/mvme68k/stand/sboot
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-22 06:56:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-22 06:56:32 +0000
commit44cd2448a12527a02751d5f8264c38c25eafa8fd (patch)
tree6b45ce670fb389fb316c129391cfd45d6ba586b3 /sys/arch/mvme68k/stand/sboot
parent2683e3ff84743ade2c2617d20b6785d422c9e366 (diff)
NetBSD -> OpenBSD; kernel is called /bsd
Diffstat (limited to 'sys/arch/mvme68k/stand/sboot')
-rw-r--r--sys/arch/mvme68k/stand/sboot/sboot.c193
1 files changed, 94 insertions, 99 deletions
diff --git a/sys/arch/mvme68k/stand/sboot/sboot.c b/sys/arch/mvme68k/stand/sboot/sboot.c
index 3a8d1bf8a34..70135614b80 100644
--- a/sys/arch/mvme68k/stand/sboot/sboot.c
+++ b/sys/arch/mvme68k/stand/sboot/sboot.c
@@ -29,122 +29,117 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * main driver, plus machdep stuff
- */
+#include <sys/cdefs.h>
#include "sboot.h"
-void sboot()
-
+void
+main()
{
- char * mesg;
- char buf[128];
- buf[0] = '0';
- consinit();
- printf("\nsboot: serial line bootstrap program (&end = %x)\n\n", &end);
- if (reboot) { /* global flag from AAstart.s */
- reboot = 0;
- printf("[rebooting...]\n");
- do_cmd("b");
- }
- while (1) {
- printf(">>> ");
- ngets(buf, sizeof(buf));
- do_cmd(buf);
- }
- /* not reached */
+ char buf[128];
+
+ buf[0] = '0';
+ printf("\nsboot: MVME147 bootstrap program\n");
+ while (1) {
+ printf(">>> ");
+ gets(buf);
+ do_cmd(buf);
+ }
+ /* not reached */
}
/*
* exit to rom
*/
-
-void callrom ()
+void
+callrom()
{
- asm("trap #15; .word 0x0063");
+ asm("trap #15; .word 0x0063");
}
/*
* do_cmd: do a command
*/
-
-void do_cmd(buf)
-
-char *buf;
-
+void
+do_cmd(buf)
+ char *buf;
{
- switch (*buf) {
- case '\0':
- return;
- case 'a':
- if ( rev_arp() ) {
- printf ("My ip address is: %d.%d.%d.%d\n", myip[0],
- myip[1], myip[2], myip[3]);
- printf ("Server ip address is: %d.%d.%d.%d\n", servip[0],
- servip[1], servip[2], servip[3]);
- } else {
- printf ("Failed.\n");
- }
- return;
- case 'e':
- printf("exiting to ROM\n");
- callrom();
- return;
- case 'f':
- if (do_get_file() == 1) {
- printf("Download Failed\n");
- } else {
- printf("Download was a success!\n");
- }
- return;
- case 'b':
- le_init();
- if ( rev_arp() ) {
- printf ("My ip address is: %d.%d.%d.%d\n", myip[0],
- myip[1], myip[2], myip[3]);
- printf ("Server ip address is: %d.%d.%d.%d\n", servip[0],
- servip[1], servip[2], servip[3]);
- } else {
- printf ("REVARP: Failed.\n");
- return;
- }
- if (do_get_file() == 1) {
- printf("Download Failed\n");
- return;
- } else {
- printf("Download was a success!\n");
- }
- go(buf);
- return;
- case 'h':
- case '?':
- printf("valid commands\n");
- printf("a - send a RARP\n");
- printf("b - boot the system\n");
- printf("e - exit to ROM\n");
- printf("f - ftp the boot file\n");
- printf("g - execute the boot file\n");
- printf("h - help\n");
- printf("i - init LANCE enet chip\n");
- return;
- case 'i':
- le_init();
- return;
- case 'g':
- go(buf);
- return;
- default:
- printf("sboot: %s: Unknown command\n", buf);
- }
+ switch (*buf) {
+ case '\0':
+ break;
+ case 'a':
+ if (rev_arp()) {
+ printf("My ip address is: %d.%d.%d.%d\n", myip[0],
+ myip[1], myip[2], myip[3]);
+ printf("Server ip address is: %d.%d.%d.%d\n", servip[0],
+ servip[1], servip[2], servip[3]);
+ } else {
+ printf("Failed.\n");
+ }
+ break;
+ case 'q':
+ printf("exiting to ROM\n");
+ callrom();
+ break;
+ case 'f':
+ if (do_get_file() == 1) {
+ printf("Download Failed\n");
+ } else {
+ printf("Download was a success!\n");
+ }
+ break;
+ case 'b':
+ le_init();
+ if (rev_arp()) {
+ printf("client IP address %d.%d.%d.%d\n", myip[0],
+ myip[1], myip[2], myip[3]);
+ printf("server IP address %d.%d.%d.%d\n", servip[0],
+ servip[1], servip[2], servip[3]);
+ } else {
+ printf("REVARP: Failed.\n");
+ return;
+ }
+ if (do_get_file() == 1) {
+ printf("Download Failed\n");
+ return;
+ } else {
+ printf("received secondary boot program.\n");
+ }
+ if (*++buf == '\0')
+ buf = "bsd";
+ go(buf);
+ break;
+ case 'h':
+ case '?':
+ printf("valid commands\n");
+ printf("a - send a RARP\n");
+ printf("b - boot the system\n");
+ printf("q - exit to ROM\n");
+ printf("f - ftp the boot file\n");
+ printf("g - execute the boot file\n");
+ printf("h - help\n");
+ printf("i - init LANCE enet chip\n");
+ break;
+ case 'i':
+ le_init();
+ break;
+ case 'g':
+ go(buf);
+ break;
+ default:
+ printf("sboot: %s: Unknown command\n", buf);
+ }
}
-go(buf)
-char *buf;
-
+go(buf)
+ char *buf;
{
- void (*entry)() = (void (*)) LOAD_ADDR ;
- printf("Start @ 0x%x ... \n", entry);
- (*entry)(buf);
-}
+ void (*entry)() = (void (*))LOAD_ADDR;
+
+ printf("jumping to boot program at 0x%x.\n", entry);
+ asm("clrl d0; clrl d1"); /* XXX network device */
+ asm("movl %0, a3" : : "a" (buf) : "a3");
+ asm("movl %0, a4" : : "a" (buf + strlen(buf)) : "a4");
+ asm("jmp %0@" : : "a" (entry));
+}