Module Name:    src
Committed By:   jdc
Date:           Sat Nov 24 20:20:29 UTC 2012

Modified Files:
        src/sys/arch/x68k/stand/boot [netbsd-6]: dp8390.c dp8390.h if_ne.c ne.c
        src/sys/arch/x68k/stand/boot_ufs [netbsd-6]: boot.S
        src/sys/arch/x68k/stand/libsa [netbsd-6]: clock.c sdcd.c
        src/sys/arch/x68k/stand/netboot [netbsd-6]: Makefile boot.c conf.c
        src/sys/arch/x68k/stand/xxboot [netbsd-6]: boot.S bootmain.c version
            xx.c
        src/sys/arch/x68k/stand/xxboot/cdboot_cd9660 [netbsd-6]: Makefile
        src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1 [netbsd-6]: Makefile
        src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2 [netbsd-6]: Makefile
        src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1 [netbsd-6]: Makefile
        src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2 [netbsd-6]: Makefile
Removed Files:
        src/sys/arch/x68k/stand/bootlogo [netbsd-6]: MANIFEST netbsd.xpm
            setbootimg.c xpm2bootimg.c

Log Message:
Pull up revisions:
  src/sys/arch/x68k/stand/boot_ufs/boot.S revision 1.10
  src/sys/arch/x68k/stand/boot/dp8390.c revision 1.2
  src/sys/arch/x68k/stand/boot/dp8390.h revision 1.2
  src/sys/arch/x68k/stand/boot/if_ne.c revision 1.2
  src/sys/arch/x68k/stand/boot/ne.c revision 1.2
  src/sys/arch/x68k/stand/libsa/clock.c revision 1.2
  src/sys/arch/x68k/stand/netboot/Makefile revision 1.2
  src/sys/arch/x68k/stand/netboot/boot.c revision 1.2
  src/sys/arch/x68k/stand/netboot/conf.c revision 1.2
  src/sys/arch/x68k/stand/bootlogo/MANIFEST delete
  src/sys/arch/x68k/stand/bootlogo/netbsd.xpm delete
  src/sys/arch/x68k/stand/bootlogo/setbootimg.c delete
  src/sys/arch/x68k/stand/bootlogo/xpm2bootimg.c delete
  src/sys/arch/x68k/stand/xxboot/boot.S revisions 1.2,1.3
  src/sys/arch/x68k/stand/xxboot/bootmain.c revisions 1.2,1.3,1.4
  src/sys/arch/x68k/stand/xxboot/xx.c revision 1.2
  src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile revisions 1.2,1.3,1.4
  src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile revisions 1.2,1.3,1.4
  src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile revisions 1.2,1.3,1.4
  src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile revisions 1.2,1.3,1.4
  src/sys/arch/x68k/stand/xxboot/version revision 1.2
  src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile revision 1.2
  src/sys/arch/x68k/stand/libsa/sdcd.c revision 1.14
(requested by tsutsui in ticket #707).

Fix typo in comment. s/d1/d0/

Remove my local RCS IDs.

Remove x68k/stand/bootlogo/ directory.
It was a tool before the bootloader becomes multi-stage (>10 years ago),
and it does not work anymore today.

Pull fixes in comments from x68k/stand/boot_ufs/boot.S rev 1.9 and 1.10.

Use a correct function name in .globl decl.

- fix comments
- use proper uintNN_t types
- use ANSI function decls
- remove unnecessary function decl
- remove __P()
- misc KNF and cosmetics

- use declarations in <lib/libsa/stand.h>
- remove __P() and some KNF
- remove extern variable decl
- use uintNN_t type

Set *file for FS_OPS() pathname properly in devopen().
Now bootxx_ffsv1 (and other bootxx ufs variants) work properly.

XXX: cd9660_open() in sys/lib/libsa/cd9660.c seems to open a file in
     the first entry of root directory if specified path is empty.
     Not sure if it's intentional behavoir.

Appease warning "nbmake: ${TOUCHPROG} expands to empty string".

Fix previous; no need to echo dummy command.

Make xxboot for ufs variants actually functional:
- set bootdev properly even on SCSI HD and floppy boot
  per SDBOOT/FDBOOT/CDBOOT defines in each Makefile
- always print xxboot name and version
- use IOCS PRINT calls instead of printf to avoid size overflow in DEBUG case
- wrap debug stuff with #ifdef XXBOOT_DEBUG
- bump version to denote changes
Mostly taken from old boot_ufs.

XXX: xxboot_lfs[12] are untested.

Make sure to initialize partition offset in cdopen(),
i.e. fix an uninitialized auto variable which happened
to be zero on XM6i emulator.

Now cdboot also works on real X68030.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/x68k/stand/boot/dp8390.c \
    src/sys/arch/x68k/stand/boot/dp8390.h \
    src/sys/arch/x68k/stand/boot/if_ne.c src/sys/arch/x68k/stand/boot/ne.c
cvs rdiff -u -r1.9 -r1.9.10.1 src/sys/arch/x68k/stand/boot_ufs/boot.S
cvs rdiff -u -r1.1 -r0 src/sys/arch/x68k/stand/bootlogo/MANIFEST \
    src/sys/arch/x68k/stand/bootlogo/netbsd.xpm
cvs rdiff -u -r1.4 -r0 src/sys/arch/x68k/stand/bootlogo/setbootimg.c
cvs rdiff -u -r1.5 -r0 src/sys/arch/x68k/stand/bootlogo/xpm2bootimg.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/x68k/stand/libsa/clock.c
cvs rdiff -u -r1.11.8.1 -r1.11.8.2 src/sys/arch/x68k/stand/libsa/sdcd.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/x68k/stand/netboot/Makefile \
    src/sys/arch/x68k/stand/netboot/boot.c \
    src/sys/arch/x68k/stand/netboot/conf.c
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/arch/x68k/stand/xxboot/boot.S
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/sys/arch/x68k/stand/xxboot/bootmain.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/arch/x68k/stand/xxboot/version \
    src/sys/arch/x68k/stand/xxboot/xx.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \
    src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \
    src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \
    src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \
    src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \
    src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x68k/stand/boot/dp8390.c
diff -u src/sys/arch/x68k/stand/boot/dp8390.c:1.2.2.2 src/sys/arch/x68k/stand/boot/dp8390.c:1.2.2.3
--- src/sys/arch/x68k/stand/boot/dp8390.c:1.2.2.2	Sun Nov 18 19:05:19 2012
+++ src/sys/arch/x68k/stand/boot/dp8390.c	Sat Nov 24 20:20:25 2012
@@ -1,5 +1,4 @@
-/*	$NetBSD: dp8390.c,v 1.2.2.2 2012/11/18 19:05:19 riz Exp $	*/
-/*	Id: dp8390.c,v 1.14 2011/10/05 13:16:20 isaki Exp 	*/
+/*	$NetBSD: dp8390.c,v 1.2.2.3 2012/11/24 20:20:25 jdc Exp $	*/
 
 /*
  * This file is derived from sys/arch/i386/stand/lib/netif/dp8390.c
Index: src/sys/arch/x68k/stand/boot/dp8390.h
diff -u src/sys/arch/x68k/stand/boot/dp8390.h:1.2.2.2 src/sys/arch/x68k/stand/boot/dp8390.h:1.2.2.3
--- src/sys/arch/x68k/stand/boot/dp8390.h:1.2.2.2	Sun Nov 18 19:05:19 2012
+++ src/sys/arch/x68k/stand/boot/dp8390.h	Sat Nov 24 20:20:25 2012
@@ -1,5 +1,4 @@
-/*	$NetBSD: dp8390.h,v 1.2.2.2 2012/11/18 19:05:19 riz Exp $	*/
-/*	Id: dp8390.h,v 1.7 2011/10/05 13:16:20 isaki Exp 	*/
+/*	$NetBSD: dp8390.h,v 1.2.2.3 2012/11/24 20:20:25 jdc Exp $	*/
 
 /*
  * This file is derived from sys/arch/i386/stand/lib/netif/dp8390.h
Index: src/sys/arch/x68k/stand/boot/if_ne.c
diff -u src/sys/arch/x68k/stand/boot/if_ne.c:1.2.2.2 src/sys/arch/x68k/stand/boot/if_ne.c:1.2.2.3
--- src/sys/arch/x68k/stand/boot/if_ne.c:1.2.2.2	Sun Nov 18 19:05:19 2012
+++ src/sys/arch/x68k/stand/boot/if_ne.c	Sat Nov 24 20:20:25 2012
@@ -1,5 +1,4 @@
-/* $NetBSD: if_ne.c,v 1.2.2.2 2012/11/18 19:05:19 riz Exp $ */
-/* Id: if_ne.c,v 1.28 2011/10/05 13:17:06 isaki Exp  */
+/* $NetBSD: if_ne.c,v 1.2.2.3 2012/11/24 20:20:25 jdc Exp $ */
 
 /*
  * Copyright (c) 2003 Tetsuya Isaki. All rights reserved.
Index: src/sys/arch/x68k/stand/boot/ne.c
diff -u src/sys/arch/x68k/stand/boot/ne.c:1.2.2.2 src/sys/arch/x68k/stand/boot/ne.c:1.2.2.3
--- src/sys/arch/x68k/stand/boot/ne.c:1.2.2.2	Sun Nov 18 19:05:18 2012
+++ src/sys/arch/x68k/stand/boot/ne.c	Sat Nov 24 20:20:25 2012
@@ -1,5 +1,4 @@
-/*	$NetBSD: ne.c,v 1.2.2.2 2012/11/18 19:05:18 riz Exp $	*/
-/*	Id: ne.c,v 1.22 2011/10/05 13:16:20 isaki Exp 	*/
+/*	$NetBSD: ne.c,v 1.2.2.3 2012/11/24 20:20:25 jdc Exp $	*/
 
 /*
  * This file is derived from sys/arch/i386/stand/lib/netif/ne.c

Index: src/sys/arch/x68k/stand/boot_ufs/boot.S
diff -u src/sys/arch/x68k/stand/boot_ufs/boot.S:1.9 src/sys/arch/x68k/stand/boot_ufs/boot.S:1.9.10.1
--- src/sys/arch/x68k/stand/boot_ufs/boot.S:1.9	Mon Feb 21 02:31:58 2011
+++ src/sys/arch/x68k/stand/boot_ufs/boot.S	Sat Nov 24 20:20:24 2012
@@ -2,7 +2,7 @@
 | author: chapuni(webmas...@chapuni.com)
 |         ITOH Yasufumi
 |
-| $NetBSD: boot.S,v 1.9 2011/02/21 02:31:58 itohy Exp $
+| $NetBSD: boot.S,v 1.9.10.1 2012/11/24 20:20:24 jdc Exp $
 
 #include <machine/asm.h>
 #include "iocscall.h"
@@ -64,7 +64,7 @@ clrbss:		clrb	%a1@+
 
 		| we use 68020 instructions, and check MPU beforehand
 		|
-		| here d1.w = -1, and the above "subw a1,d0" = 0x9049, and
+		| here d0.w = -1, and the above "subw a1,d0" = 0x9049, and
 		|	if MPU <= 010	loads 0x49,
 		|	if MPU >= 020	loads 0x90.
 		| This is a move, not a tst instruction

Index: src/sys/arch/x68k/stand/libsa/clock.c
diff -u src/sys/arch/x68k/stand/libsa/clock.c:1.2.2.2 src/sys/arch/x68k/stand/libsa/clock.c:1.2.2.3
--- src/sys/arch/x68k/stand/libsa/clock.c:1.2.2.2	Sun Nov 18 19:05:20 2012
+++ src/sys/arch/x68k/stand/libsa/clock.c	Sat Nov 24 20:20:26 2012
@@ -1,5 +1,4 @@
-/* $NetBSD: clock.c,v 1.2.2.2 2012/11/18 19:05:20 riz Exp $ */
-/* Id: clock.c,v 1.4 2011/04/10 09:21:45 isaki Exp  */
+/* $NetBSD: clock.c,v 1.2.2.3 2012/11/24 20:20:26 jdc Exp $ */
 
 /*
  * Copyright (c) 2003 Tetsuya Isaki. All rights reserved.

Index: src/sys/arch/x68k/stand/libsa/sdcd.c
diff -u src/sys/arch/x68k/stand/libsa/sdcd.c:1.11.8.1 src/sys/arch/x68k/stand/libsa/sdcd.c:1.11.8.2
--- src/sys/arch/x68k/stand/libsa/sdcd.c:1.11.8.1	Sun Nov 18 19:05:20 2012
+++ src/sys/arch/x68k/stand/libsa/sdcd.c	Sat Nov 24 20:20:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdcd.c,v 1.11.8.1 2012/11/18 19:05:20 riz Exp $	*/
+/*	$NetBSD: sdcd.c,v 1.11.8.2 2012/11/24 20:20:26 jdc Exp $	*/
 
 /*
  * Copyright (c) 2001 MINOURA Makoto.
@@ -339,6 +339,7 @@ cdopen(struct open_file *f, ...)
 	sc = alloc(sizeof(struct sdcd_softc));
 	current_npart = 3;
 	sc->sc_part = 0;
+	sc->sc_partinfo.start = 0;
 	sc->sc_partinfo.size = current_devsize;
 	sc->sc_blocksize = current_blklen << 9;
 	f->f_devdata = sc;

Index: src/sys/arch/x68k/stand/netboot/Makefile
diff -u src/sys/arch/x68k/stand/netboot/Makefile:1.2.2.2 src/sys/arch/x68k/stand/netboot/Makefile:1.2.2.3
--- src/sys/arch/x68k/stand/netboot/Makefile:1.2.2.2	Sun Nov 18 19:05:22 2012
+++ src/sys/arch/x68k/stand/netboot/Makefile	Sat Nov 24 20:20:26 2012
@@ -1,5 +1,4 @@
-#	$NetBSD: Makefile,v 1.2.2.2 2012/11/18 19:05:22 riz Exp $
-#	Id: Makefile,v 1.14 2011/10/04 12:59:33 isaki Exp 
+#	$NetBSD: Makefile,v 1.2.2.3 2012/11/24 20:20:26 jdc Exp $
 
 NOMAN=		# defined
 
Index: src/sys/arch/x68k/stand/netboot/boot.c
diff -u src/sys/arch/x68k/stand/netboot/boot.c:1.2.2.2 src/sys/arch/x68k/stand/netboot/boot.c:1.2.2.3
--- src/sys/arch/x68k/stand/netboot/boot.c:1.2.2.2	Sun Nov 18 19:05:21 2012
+++ src/sys/arch/x68k/stand/netboot/boot.c	Sat Nov 24 20:20:26 2012
@@ -1,5 +1,4 @@
-/*	$NetBSD: boot.c,v 1.2.2.2 2012/11/18 19:05:21 riz Exp $	*/
-/*	Id: boot.c,v 1.19 2011/10/04 12:45:16 isaki Exp 	*/
+/*	$NetBSD: boot.c,v 1.2.2.3 2012/11/24 20:20:26 jdc Exp $	*/
 
 /*
  * Copyright (c) 2001 Minoura Makoto
Index: src/sys/arch/x68k/stand/netboot/conf.c
diff -u src/sys/arch/x68k/stand/netboot/conf.c:1.2.2.2 src/sys/arch/x68k/stand/netboot/conf.c:1.2.2.3
--- src/sys/arch/x68k/stand/netboot/conf.c:1.2.2.2	Sun Nov 18 19:05:21 2012
+++ src/sys/arch/x68k/stand/netboot/conf.c	Sat Nov 24 20:20:26 2012
@@ -1,5 +1,4 @@
-/*	$NetBSD: conf.c,v 1.2.2.2 2012/11/18 19:05:21 riz Exp $	*/
-/*	Id: conf.c,v 1.7 2011/04/10 09:20:27 isaki Exp 	*/
+/*	$NetBSD: conf.c,v 1.2.2.3 2012/11/24 20:20:26 jdc Exp $	*/
 
 /*
  * Copyright (c) 2001 Minoura Makoto

Index: src/sys/arch/x68k/stand/xxboot/boot.S
diff -u src/sys/arch/x68k/stand/xxboot/boot.S:1.3.2.2 src/sys/arch/x68k/stand/xxboot/boot.S:1.3.2.3
--- src/sys/arch/x68k/stand/xxboot/boot.S:1.3.2.2	Sun Nov 18 19:05:17 2012
+++ src/sys/arch/x68k/stand/xxboot/boot.S	Sat Nov 24 20:20:27 2012
@@ -1,8 +1,8 @@
 | file: boot.S
 | author: chapuni(webmas...@chapuni.com)
-|         Yasha(it...@netbsd.org)
+|         ITOH Yasufumi
 |
-| $NetBSD: boot.S,v 1.3.2.2 2012/11/18 19:05:17 riz Exp $
+| $NetBSD: boot.S,v 1.3.2.3 2012/11/24 20:20:27 jdc Exp $
 
 #include <machine/asm.h>
 #include "iocscall.h"
@@ -19,7 +19,7 @@
 
 #define BOOT_ERROR(s)	jbsr boot_error; .asciz s; .even
 
-	.globl	_C_LABEL(bootufs)
+	.globl	_C_LABEL(bootmain)
 	.text
 ASENTRY_NOPROFILE(start)
 ASENTRY_NOPROFILE(top)
@@ -66,7 +66,7 @@ clrbss:		clrb	%a1@+
 
 		| we use 68020 instructions, and check MPU beforehand
 		|
-		| here d1.w = -1, and the above "subw a1,d0" = 0x9049, and
+		| here d0.w = -1, and the above "subw a1,d0" = 0x9049, and
 		|	if MPU <= 010	loads 0x49,
 		|	if MPU >= 020	loads 0x90.
 		| This is a move, not a tst instruction

Index: src/sys/arch/x68k/stand/xxboot/bootmain.c
diff -u src/sys/arch/x68k/stand/xxboot/bootmain.c:1.4.2.2 src/sys/arch/x68k/stand/xxboot/bootmain.c:1.4.2.3
--- src/sys/arch/x68k/stand/xxboot/bootmain.c:1.4.2.2	Sun Nov 18 19:05:17 2012
+++ src/sys/arch/x68k/stand/xxboot/bootmain.c	Sat Nov 24 20:20:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootmain.c,v 1.4.2.2 2012/11/18 19:05:17 riz Exp $	*/
+/*	$NetBSD: bootmain.c,v 1.4.2.3 2012/11/24 20:20:27 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1993, 1994 Takumi Nakamura.
@@ -43,47 +43,65 @@
 #include "iocs.h"
 #include "exec_image.h"
 
-#define EXSCSI_BDID	((void*) 0x00ea0001)
+#define EXSCSI_BDID	((void *)0x00ea0001)
+#define BINF_ISFD(pbinf)	(*((uint8_t *)(pbinf) + 1) == 0)
 
-/* boot_cd9660.S */
-extern int badbaddr __P((volatile void *adr));
+/* boot.S */
+extern int badbaddr(volatile void *);
 extern unsigned int ID;		/* target SCSI ID */
 extern unsigned int BOOT_INFO;	/* result of IOCS(__BOOTINF) */
+extern struct {
+	struct fdfmt{
+		uint8_t	N;	/* sector length 0: 128, ..., 3: 1K */
+		uint8_t	C;	/* cylinder # */
+		uint8_t	H;	/* head # */
+		uint8_t	R;	/* sector # */
+	} minsec, maxsec;
+} FDSECMINMAX;			/* FD format type of the first track */
 
 /* for debug */
 unsigned int startregs[16];
 
-static int get_scsi_host_adapter (char *);
-void bootmain (void) __attribute__ ((__noreturn__));
+static int get_scsi_host_adapter(char *);
+void bootmain(void) __attribute__ ((__noreturn__));
 
 /*
  * Check the type of SCSI interface
  */
 static int
-get_scsi_host_adapter(devstr)
-	char *devstr;
+get_scsi_host_adapter(char *devstr)
 {
-	char *bootrom;
+	uint8_t *bootrom;
 	int ha;
 
-	*(int *)devstr = '/' << 24 | 's' << 16 | 'p' << 8 | 'c';
-	*(int *)(devstr + 4) = '@' << 24 | '0' << 16 | '/' << 8 | 'c';
-	*(int *)(devstr + 8) = 'd' << 24 | '@' << 16 | '0' << 8 | ',';
-	*(int *)(devstr + 12) = '0' << 24 | ':' << 16 | 'a' << 8 | '\0';
+#ifdef XXBOOT_DEBUG
+	*(uint32_t *)(devstr +  0) = '/' << 24 | 's' << 16 | 'p' << 8 | 'c';
+#if defined(CDBOOT)
+	*(uint32_t *)(devstr +  4) = '@' << 24 | '0' << 16 | '/' << 8 | 'c';
+#else
+	*(uint32_t *)(devstr +  4) = '@' << 24 | '0' << 16 | '/' << 8 | 's';
+#endif
+	*(uint32_t *)(devstr +  8) = 'd' << 24 | '@' << 16 | '0' << 8 | ',';
+	*(uint32_t *)(devstr + 12) = '0' << 24 | ':' << 16 | 'a' << 8 | '\0';
+#endif
 
-	bootrom = (char *) (BOOT_INFO & 0x00ffffe0);
+	bootrom = (uint8_t *)(BOOT_INFO & 0x00ffffe0);
 	/*
 	 * bootrom+0x24	"SCSIIN" ... Internal SCSI (spc@0)
 	 *		"SCSIEX" ... External SCSI (spc@1 or mha@0)
 	 */
-	if (*(u_short *)(bootrom + 0x24 + 4) == 0x494e) {	/* "IN" */
+	if (*(uint16_t *)(bootrom + 0x24 + 4) == 0x494e) {	/* "IN" */
 		ha = (X68K_BOOT_SCSIIF_SPC << 4) | 0;
 	} else if (badbaddr(EXSCSI_BDID)) {
 		ha = (X68K_BOOT_SCSIIF_MHA << 4) | 0;
-		*(int *)devstr = '/' << 24 | 'm' << 16 | 'h' << 8 | 'a';
+#ifdef XXBOOT_DEBUG
+		*(uint32_t *)devstr = '/' << 24 | 'm' << 16 | 'h' << 8 | 'a';
+#endif
 	} else {
 		ha = (X68K_BOOT_SCSIIF_SPC << 4) | 1;
+#ifdef XXBOOT_DEBUG
 		devstr[5] = '1';
+#endif
 	}
 
 	return ha;
@@ -98,19 +116,46 @@ bootmain(void)
 	char bootdevstr[16];
 	u_long marks[MARK_MAX];
 
-#ifdef DEBUG
-	printf("%s rev.%s\n", bootprog_name, bootprog_rev);
-#endif
+	IOCS_B_PRINT(bootprog_name);
+	IOCS_B_PRINT(" rev.");
+	IOCS_B_PRINT(bootprog_rev);
+	IOCS_B_PRINT("\r\n");
 
 	ha = get_scsi_host_adapter(bootdevstr);
+#ifdef XXBOOT_DEBUG
 	bootdevstr[10] = '0' + (ID & 7);
 	bootdevstr[14] = 'a';
+#endif
+
+#if defined(CDBOOT)
 	bootdev = X68K_MAKESCSIBOOTDEV(X68K_MAJOR_CD, ha >> 4, ha & 15,
 				       ID & 7, 0, 0);
-#ifdef DEBUG
-	printf(" boot device: %s\n", bootdevstr);
+#elif defined(FDBOOT) || defined(SDBOOT)
+	if (BINF_ISFD(&BOOT_INFO)) {
+		/* floppy */
+#ifdef XXBOOT_DEBUG
+		*(uint32_t *)bootdevstr =
+		    ('f' << 24 | 'd' << 16 | '@' << 8 | '0' + (BOOT_INFO & 3));
+		bootdevstr[4] = '\0';
+#endif
+		/* fdNa for 1024 bytes/sector, fdNc for 512 bytes/sector */
+		bootdev = X68K_MAKEBOOTDEV(X68K_MAJOR_FD, BOOT_INFO & 3,
+		    (FDSECMINMAX.minsec.N == 3) ? 0 : 2);
+	} else {
+		/* SCSI */
+		bootdev = X68K_MAKESCSIBOOTDEV(X68K_MAJOR_SD, ha >> 4, ha & 15,
+		    ID & 7, 0, 0 /* XXX: assume partition a */);
+	}
+#else
+	bootdev = 0;
 #endif
 
+#ifdef XXBOOT_DEBUG
+	IOCS_B_PRINT("boot device: ");
+	IOCS_B_PRINT(bootdevstr);
+#endif
+	IOCS_B_PRINT("\r\n");
+
 	marks[MARK_START] = BOOT_TEXTADDR;
 	fd = loadfile("x68k/boot", marks, LOAD_TEXT|LOAD_DATA|LOAD_BSS);
 	if (fd < 0)
@@ -127,9 +172,10 @@ bootmain(void)
 	exit(0);
 }
 
-extern int xxboot(struct open_file *);
 int
 devopen(struct open_file *f, const char *fname, char **file)
 {
+
+	*file = __UNCONST(fname);
 	return xxopen(f);
 }

Index: src/sys/arch/x68k/stand/xxboot/version
diff -u src/sys/arch/x68k/stand/xxboot/version:1.2.2.2 src/sys/arch/x68k/stand/xxboot/version:1.2.2.3
--- src/sys/arch/x68k/stand/xxboot/version:1.2.2.2	Sun Nov 18 19:05:18 2012
+++ src/sys/arch/x68k/stand/xxboot/version	Sat Nov 24 20:20:27 2012
@@ -1,7 +1,8 @@
-$NetBSD: version,v 1.2.2.2 2012/11/18 19:05:18 riz Exp $
+$NetBSD: version,v 1.2.2.3 2012/11/24 20:20:27 jdc Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
 is taken as the current.
 
 1.0:	Initial revision.
+1.1:	Fix FFS and LFS boot from SCSI HD and floppies.  Always print version.
Index: src/sys/arch/x68k/stand/xxboot/xx.c
diff -u src/sys/arch/x68k/stand/xxboot/xx.c:1.2.2.2 src/sys/arch/x68k/stand/xxboot/xx.c:1.2.2.3
--- src/sys/arch/x68k/stand/xxboot/xx.c:1.2.2.2	Sun Nov 18 19:05:17 2012
+++ src/sys/arch/x68k/stand/xxboot/xx.c	Sat Nov 24 20:20:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: xx.c,v 1.2.2.2 2012/11/18 19:05:17 riz Exp $	*/
+/*	$NetBSD: xx.c,v 1.2.2.3 2012/11/24 20:20:27 jdc Exp $	*/
 
 /*
  * Copyright (c) 2010 MINOURA Makoto.
@@ -26,31 +26,30 @@
  */
 
 #include <sys/param.h>
+#include <lib/libsa/stand.h>
 
-struct open_file;
-extern void RAW_READ __P((void *buf, u_int32_t blkpos, size_t bytelen));
-int xxopen(struct open_file *);
-int xxclose(struct open_file *);
-int xxstrategy(void *, int, daddr_t, size_t, void *, size_t *);
+extern void RAW_READ(void *buf, uint32_t blkpos, size_t bytelen);
 
 int
-xxopen(struct open_file *f)
+xxopen(struct open_file *f, ...)
 {
+
 	return 0;
 }
 
 int
 xxclose(struct open_file *f)
 {
+
 	return 0;
 }
 
-extern unsigned int SCSI_BLKLEN;
 int
 xxstrategy(void *arg, int rw, daddr_t dblk, size_t size,
            void *buf, size_t *rsize)
 {
-	RAW_READ(buf, (u_int32_t)dblk, size);
+
+	RAW_READ(buf, (uint32_t)dblk, size);
 	if (rsize)
 		*rsize = size;
 	return 0;

Index: src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile
diff -u src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile:1.2.2.2 src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile:1.2.2.3
--- src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile:1.2.2.2	Sun Nov 18 19:05:23 2012
+++ src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile	Sat Nov 24 20:20:28 2012
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.2.2.2 2012/11/18 19:05:23 riz Exp $
+#	$NetBSD: Makefile,v 1.2.2.3 2012/11/24 20:20:28 jdc Exp $
 
 DEV=		xx
 DEVDRV=		xx
 FS=		cd9660
-BOOTCPPFLAGS=	-DCDBOOT -DFDBOOT -DSDBOOT
+BOOTCPPFLAGS=	-DCDBOOT
 
 TOUCHPROG=								\
 	( ( echo -n X68SCSI1 | dd bs=2048 conv=sync ) ;			\

Index: src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile
diff -u src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile:1.4.2.2 src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile:1.4.2.3
--- src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile:1.4.2.2	Sun Nov 18 19:05:16 2012
+++ src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile	Sat Nov 24 20:20:27 2012
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.4.2.2 2012/11/18 19:05:16 riz Exp $
+#	$NetBSD: Makefile,v 1.4.2.3 2012/11/24 20:20:27 jdc Exp $
 
 DEV=		xx
 DEVDRV=		xx
 FS=		ffsv1
-BOOTCPPFLAGS=	-DSDBOOT
+BOOTCPPFLAGS=	-DSDBOOT -DFDBOOT
 
-TOUCHPROG=	
+TOUCHPROG=	@true
 
 .include "../Makefile.xxboot"

Index: src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile
diff -u src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile:1.4.2.2 src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile:1.4.2.3
--- src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile:1.4.2.2	Sun Nov 18 19:05:23 2012
+++ src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile	Sat Nov 24 20:20:27 2012
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.4.2.2 2012/11/18 19:05:23 riz Exp $
+#	$NetBSD: Makefile,v 1.4.2.3 2012/11/24 20:20:27 jdc Exp $
 
 DEV=		xx
 DEVDRV=		xx
 FS=		ffsv2
-BOOTCPPFLAGS=	-DSDBOOT
+BOOTCPPFLAGS=	-DSDBOOT -DFDBOOT
 
-TOUCHPROG=	
+TOUCHPROG=	@true
 
 .include "../Makefile.xxboot"

Index: src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile
diff -u src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile:1.4.2.2 src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile:1.4.2.3
--- src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile:1.4.2.2	Sun Nov 18 19:05:22 2012
+++ src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile	Sat Nov 24 20:20:28 2012
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.4.2.2 2012/11/18 19:05:22 riz Exp $
+#	$NetBSD: Makefile,v 1.4.2.3 2012/11/24 20:20:28 jdc Exp $
 
 DEV=		xx
 DEVDRV=		xx
 FS=		lfsv1
-BOOTCPPFLAGS=	-DSDBOOT
+BOOTCPPFLAGS=	-DSDBOOT -DFDBOOT
 
-TOUCHPROG=	
+TOUCHPROG=	@true
 
 .include "../Makefile.xxboot"

Index: src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile
diff -u src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile:1.4.2.2 src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile:1.4.2.3
--- src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile:1.4.2.2	Sun Nov 18 19:05:22 2012
+++ src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile	Sat Nov 24 20:20:28 2012
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.4.2.2 2012/11/18 19:05:22 riz Exp $
+#	$NetBSD: Makefile,v 1.4.2.3 2012/11/24 20:20:28 jdc Exp $
 
 DEV=		xx
 DEVDRV=		xx
 FS=		lfsv2
-BOOTCPPFLAGS=	-DSDBOOT
+BOOTCPPFLAGS=	-DSDBOOT -DFDBOOT
 
-TOUCHPROG=	
+TOUCHPROG=	@true
 
 .include "../Makefile.xxboot"

Reply via email to