Sun Jul 6 05:31:03 2014 UTC ()
Reduce diffs to prepare to merge these files.


(tsutsui)
diff -r1.18 -r1.19 src/sys/arch/x68k/stand/boot/boot.c
diff -r1.2 -r1.3 src/sys/arch/x68k/stand/netboot/boot.c

cvs diff -r1.18 -r1.19 src/sys/arch/x68k/stand/boot/boot.c (expand / switch to unified diff)

--- src/sys/arch/x68k/stand/boot/boot.c 2012/03/20 12:37:01 1.18
+++ src/sys/arch/x68k/stand/boot/boot.c 2014/07/06 05:31:02 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: boot.c,v 1.18 2012/03/20 12:37:01 minoura Exp $ */ 1/* $NetBSD: boot.c,v 1.19 2014/07/06 05:31:02 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Minoura Makoto 4 * Copyright (c) 2001 Minoura Makoto
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -35,28 +35,30 @@ @@ -35,28 +35,30 @@
35#include <lib/libkern/libkern.h> 35#include <lib/libkern/libkern.h>
36 36
37#include "libx68k.h" 37#include "libx68k.h"
38#include "iocs.h" 38#include "iocs.h"
39 39
40#include "exec_image.h" 40#include "exec_image.h"
41 41
42 42
43#define HEAP_START ((void*) 0x00080000) 43#define HEAP_START ((void*) 0x00080000)
44#define HEAP_END ((void*) 0x000fffff) 44#define HEAP_END ((void*) 0x000fffff)
45#define EXSCSI_BDID ((void*) 0x00ea0001) 45#define EXSCSI_BDID ((void*) 0x00ea0001)
46#define SRAM_MEMSIZE (*((long*) 0x00ed0008)) 46#define SRAM_MEMSIZE (*((long*) 0x00ed0008))
47 47
48char default_kernel[20] = "sd0a:netbsd"; 48char default_kernel[20] =
49int mpu, hostadaptor; 49 "sd0a:netbsd";
 50int mpu;
 51int hostadaptor;
50int console_device = -1; 52int console_device = -1;
51 53
52static void help(void); 54static void help(void);
53static int get_scsi_host_adapter(void); 55static int get_scsi_host_adapter(void);
54static void doboot(const char *, int); 56static void doboot(const char *, int);
55static void boot(char *); 57static void boot(char *);
56static void cmd_ls(char *); 58static void cmd_ls(char *);
57int bootmenu(void); 59int bootmenu(void);
58void bootmain(int); 60void bootmain(int);
59extern int detectmpu(void); 61extern int detectmpu(void);
60extern int badbaddr(void *); 62extern int badbaddr(void *);
61 63
62/* from boot_ufs/bootmain.c */ 64/* from boot_ufs/bootmain.c */
@@ -252,54 +254,57 @@ bootmenu(void) @@ -252,54 +254,57 @@ bootmenu(void)
252 printf("trying %s.\n", default_kernel); 254 printf("trying %s.\n", default_kernel);
253 doboot(default_kernel, 0); 255 doboot(default_kernel, 0);
254 printf("Could not start %s; ", default_kernel); 256 printf("Could not start %s; ", default_kernel);
255 } 257 }
256 258
257 printf("Please use the absolute unit# (e.g. SCSI ID)" 259 printf("Please use the absolute unit# (e.g. SCSI ID)"
258 " instead of the NetBSD logical #.\n"); 260 " instead of the NetBSD logical #.\n");
259 for (;;) { 261 for (;;) {
260 char *p, *options; 262 char *p, *options;
261 263
262 printf("> "); 264 printf("> ");
263 gets(input); 265 gets(input);
264 266
265 for (p = &input[0]; p - &input[0] < 80 && *p == ' '; p++); 267 for (p = &input[0]; p - &input[0] < 80 && *p == ' '; p++)
 268 ;
266 options = gettrailer(p); 269 options = gettrailer(p);
267 if (strcmp("boot", p) == 0) 270 if (strcmp("boot", p) == 0)
268 boot(options); 271 boot(options);
269 else if (strcmp("help", p) == 0 || 272 else if (strcmp("help", p) == 0 ||
270 strcmp("?", p) == 0) 273 strcmp("?", p) == 0)
271 help(); 274 help();
272 else if ((strcmp("halt", p) == 0) ||(strcmp("reboot", p) == 0)) 275 else if (strcmp("halt", p) == 0 ||
 276 strcmp("reboot", p) == 0)
273 exit(0); 277 exit(0);
274 else if (strcmp("ls", p) == 0) 278 else if (strcmp("ls", p) == 0)
275 cmd_ls(options); 279 cmd_ls(options);
276 else 280 else
277 printf("Unknown command %s\n", p); 281 printf("Unknown command %s\n", p);
278 } 282 }
279} 283}
280 284
281 285
282extern const char bootprog_rev[]; 286extern const char bootprog_rev[];
283extern const char bootprog_name[]; 287extern const char bootprog_name[];
284 288
285/* 289/*
286 * Arguments from the boot block: 290 * Arguments from the boot block:
287 * bootdev - specifies the device from which /boot was read, in  291 * bootdev - specifies the device from which /boot was read, in
288 * bootdev format. 292 * bootdev format.
289 */ 293 */
290void 294void
291bootmain(int bootdev) 295bootmain(int bootdev)
292{ 296{
 297
293 hostadaptor = get_scsi_host_adapter(); 298 hostadaptor = get_scsi_host_adapter();
294 mpu = detectmpu(); 299 mpu = detectmpu();
295 300
296 if (mpu < 3) { /* not tested on 68020 */ 301 if (mpu < 3) { /* not tested on 68020 */
297 printf("This MPU cannot run NetBSD.\n"); 302 printf("This MPU cannot run NetBSD.\n");
298 exit(1); 303 exit(1);
299 } 304 }
300 if (SRAM_MEMSIZE < 4*1024*1024) { 305 if (SRAM_MEMSIZE < 4*1024*1024) {
301 printf("Main memory too small.\n"); 306 printf("Main memory too small.\n");
302 exit(1); 307 exit(1);
303 } 308 }
304 309
305 console_device = consio_init(console_device); 310 console_device = consio_init(console_device);

cvs diff -r1.2 -r1.3 src/sys/arch/x68k/stand/netboot/Attic/boot.c (expand / switch to unified diff)

--- src/sys/arch/x68k/stand/netboot/Attic/boot.c 2012/11/01 14:46:26 1.2
+++ src/sys/arch/x68k/stand/netboot/Attic/boot.c 2014/07/06 05:31:03 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: boot.c,v 1.2 2012/11/01 14:46:26 isaki Exp $ */ 1/* $NetBSD: boot.c,v 1.3 2014/07/06 05:31:03 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Minoura Makoto 4 * Copyright (c) 2001 Minoura Makoto
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -36,27 +36,28 @@ @@ -36,27 +36,28 @@
36#include <lib/libkern/libkern.h> 36#include <lib/libkern/libkern.h>
37 37
38#include "libx68k.h" 38#include "libx68k.h"
39#include "iocs.h" 39#include "iocs.h"
40 40
41#include "exec_image.h" 41#include "exec_image.h"
42 42
43 43
44#define HEAP_START ((void*) 0x00080000) 44#define HEAP_START ((void*) 0x00080000)
45#define HEAP_END ((void*) 0x000fffff) 45#define HEAP_END ((void*) 0x000fffff)
46#define EXSCSI_BDID ((void*) 0x00ea0001) 46#define EXSCSI_BDID ((void*) 0x00ea0001)
47#define SRAM_MEMSIZE (*((long*) 0x00ed0008)) 47#define SRAM_MEMSIZE (*((long*) 0x00ed0008))
48 48
49char default_kernel[20] = "nfs:netbsd"; 49char default_kernel[20] =
 50 "nfs:netbsd";
50int mpu; 51int mpu;
51int console_device = -1; 52int console_device = -1;
52 53
53#ifdef DEBUG 54#ifdef DEBUG
54int debug = 1; 55int debug = 1;
55#endif 56#endif
56 57
57static void help(void); 58static void help(void);
58static void doboot(const char *, int); 59static void doboot(const char *, int);
59static void boot(char *); 60static void boot(char *);
60int bootmenu(void); 61int bootmenu(void);
61void bootmain(int); 62void bootmain(int);
62extern int detectmpu(void); 63extern int detectmpu(void);
@@ -90,37 +91,43 @@ doboot(const char *file, int flags) @@ -90,37 +91,43 @@ doboot(const char *file, int flags)
90 loadflag &= ~LOAD_BACKWARDS; 91 loadflag &= ~LOAD_BACKWARDS;
91  92
92 marks[MARK_START] = 0x100000; 93 marks[MARK_START] = 0x100000;
93 if ((fd = loadfile(file, marks, loadflag)) == -1) { 94 if ((fd = loadfile(file, marks, loadflag)) == -1) {
94 printf("loadfile failed\n"); 95 printf("loadfile failed\n");
95 return; 96 return;
96 } 97 }
97 close(fd); 98 close(fd);
98 99
99 if (devparse(file, &dev, &unit, &part, &name) != 0) { 100 if (devparse(file, &dev, &unit, &part, &name) != 0) {
100 printf("XXX: unknown corruption in /boot.\n"); 101 printf("XXX: unknown corruption in /boot.\n");
101 } 102 }
102 103
 104#ifdef DEBUG
103 printf("dev = %x, unit = %d, name = %s\n", 105 printf("dev = %x, unit = %d, name = %s\n",
104 dev, unit, name); 106 dev, unit, name);
 107#endif
105 108
106 dev = X68K_MAKEBOOTDEV(X68K_MAJOR_NE, unit, 0); 109 dev = X68K_MAKEBOOTDEV(X68K_MAJOR_NE, unit, 0);
 110#ifdef DEBUG
107 printf("boot device = %x\n", dev); 111 printf("boot device = %x\n", dev);
108 printf("if = %d, unit = %d\n", 112 printf("if = %d, unit = %d\n",
109 B_X68K_SCSI_IF(dev), 113 B_X68K_SCSI_IF(dev),
110 B_X68K_SCSI_IF_UN(dev)); 114 B_X68K_SCSI_IF_UN(dev));
 115#endif
111 116
112 p = ((short*) marks[MARK_ENTRY]) - 1; 117 p = ((short*) marks[MARK_ENTRY]) - 1;
 118#ifdef DEBUG
113 printf("Kernel Version: 0x%x\n", *p); 119 printf("Kernel Version: 0x%x\n", *p);
 120#endif
114 if (*p != 0x4e73 && *p != 0) { 121 if (*p != 0x4e73 && *p != 0) {
115 /* 122 /*
116 * XXX temporary solution; compatibility loader 123 * XXX temporary solution; compatibility loader
117 * must be written. 124 * must be written.
118 */ 125 */
119 printf("This kernel is too new to be loaded by " 126 printf("This kernel is too new to be loaded by "
120 "this version of /boot.\n"); 127 "this version of /boot.\n");
121 return; 128 return;
122 } 129 }
123 130
124 exec_image(marks[MARK_START], 0, marks[MARK_ENTRY]-marks[MARK_START], 131 exec_image(marks[MARK_START], 0, marks[MARK_ENTRY]-marks[MARK_START],
125 marks[MARK_END]-marks[MARK_START], dev, flags); 132 marks[MARK_END]-marks[MARK_START], dev, flags);
126 133
@@ -196,50 +203,53 @@ bootmenu(void) @@ -196,50 +203,53 @@ bootmenu(void)
196 printf("Please use the absolute unit# (e.g. SCSI ID)" 203 printf("Please use the absolute unit# (e.g. SCSI ID)"
197 " instead of the NetBSD logical #.\n"); 204 " instead of the NetBSD logical #.\n");
198 for (;;) { 205 for (;;) {
199 char *p, *options; 206 char *p, *options;
200 207
201 printf("> "); 208 printf("> ");
202 gets(input); 209 gets(input);
203 210
204 for (p = &input[0]; p - &input[0] < 80 && *p == ' '; p++) 211 for (p = &input[0]; p - &input[0] < 80 && *p == ' '; p++)
205 ; 212 ;
206 options = gettrailer(p); 213 options = gettrailer(p);
207 if (strcmp("boot", p) == 0) 214 if (strcmp("boot", p) == 0)
208 boot(options); 215 boot(options);
209 else if (strcmp("help", p) == 0 || strcmp("?", p) == 0) 216 else if (strcmp("help", p) == 0 ||
 217 strcmp("?", p) == 0)
210 help(); 218 help();
211 else if (strcmp("halt", p) == 0 || strcmp("reboot", p) == 0) 219 else if (strcmp("halt", p) == 0 ||
 220 strcmp("reboot", p) == 0)
212 exit(0); 221 exit(0);
213 else 222 else
214 printf("Unknown command %s\n", p); 223 printf("Unknown command %s\n", p);
215 } 224 }
216} 225}
217 226
218 227
219extern const char bootprog_rev[]; 228extern const char bootprog_rev[];
220extern const char bootprog_name[]; 229extern const char bootprog_name[];
221 230
222/* 231/*
223 * Arguments from the boot block: 232 * Arguments from the boot block:
224 * bootdev - specifies the device from which /boot was read, in  233 * bootdev - specifies the device from which /boot was read, in
225 * bootdev format. 234 * bootdev format.
226 */ 235 */
227void 236void
228bootmain(int bootdev) 237bootmain(int bootdev)
229{ 238{
230 mpu = detectmpu(); 239
231 rtc_offset = RTC_OFFSET; 240 rtc_offset = RTC_OFFSET;
232 try_bootp = 1; 241 try_bootp = 1;
 242 mpu = detectmpu();
233 243
234 if (mpu < 3) { /* not tested on 68020 */ 244 if (mpu < 3) { /* not tested on 68020 */
235 printf("This MPU cannot run NetBSD.\n"); 245 printf("This MPU cannot run NetBSD.\n");
236 exit(1); 246 exit(1);
237 } 247 }
238 if (SRAM_MEMSIZE < 4*1024*1024) { 248 if (SRAM_MEMSIZE < 4*1024*1024) {
239 printf("Main memory too small.\n"); 249 printf("Main memory too small.\n");
240 exit(1); 250 exit(1);
241 } 251 }
242 252
243 console_device = consio_init(console_device); 253 console_device = consio_init(console_device);
244 setheap(HEAP_START, HEAP_END); 254 setheap(HEAP_START, HEAP_END);
245 255