Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k/stand/xxboot Make xxboot for ufs variants actu...



details:   https://anonhg.NetBSD.org/src/rev/f138e6b2b294
branches:  trunk
changeset: 782730:f138e6b2b294
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Nov 17 19:10:46 2012 +0000

description:
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.

diffstat:

 sys/arch/x68k/stand/xxboot/bootmain.c             |  58 ++++++++++++++++++++--
 sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile |   4 +-
 sys/arch/x68k/stand/xxboot/version                |   3 +-
 sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile  |   4 +-
 sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile  |   4 +-
 sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile  |   4 +-
 sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile  |   4 +-
 7 files changed, 64 insertions(+), 17 deletions(-)

diffs (201 lines):

diff -r e37c8ac65ac1 -r f138e6b2b294 sys/arch/x68k/stand/xxboot/bootmain.c
--- a/sys/arch/x68k/stand/xxboot/bootmain.c     Sat Nov 17 17:58:59 2012 +0000
+++ b/sys/arch/x68k/stand/xxboot/bootmain.c     Sat Nov 17 19:10:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootmain.c,v 1.3 2012/11/17 16:16:46 tsutsui Exp $     */
+/*     $NetBSD: bootmain.c,v 1.4 2012/11/17 19:10:46 tsutsui Exp $     */
 
 /*-
  * Copyright (c) 1993, 1994 Takumi Nakamura.
@@ -44,11 +44,20 @@
 #include "exec_image.h"
 
 #define EXSCSI_BDID    ((void *)0x00ea0001)
+#define BINF_ISFD(pbinf)       (*((uint8_t *)(pbinf) + 1) == 0)
 
 /* 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];
@@ -65,10 +74,16 @@
        uint8_t *bootrom;
        int ha;
 
+#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 = (uint8_t *)(BOOT_INFO & 0x00ffffe0);
        /*
@@ -79,10 +94,14 @@
                ha = (X68K_BOOT_SCSIIF_SPC << 4) | 0;
        } else if (badbaddr(EXSCSI_BDID)) {
                ha = (X68K_BOOT_SCSIIF_MHA << 4) | 0;
+#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;
@@ -97,18 +116,45 @@
        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);
diff -r e37c8ac65ac1 -r f138e6b2b294 sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile
--- a/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile Sat Nov 17 17:58:59 2012 +0000
+++ b/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile Sat Nov 17 19:10:46 2012 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.1 2012/03/20 13:01:32 minoura Exp $
+#      $NetBSD: Makefile,v 1.2 2012/11/17 19:10:46 tsutsui Exp $
 
 DEV=           xx
 DEVDRV=                xx
 FS=            cd9660
-BOOTCPPFLAGS=  -DCDBOOT -DFDBOOT -DSDBOOT
+BOOTCPPFLAGS=  -DCDBOOT
 
 TOUCHPROG=                                                             \
        ( ( echo -n X68SCSI1 | dd bs=2048 conv=sync ) ;                 \
diff -r e37c8ac65ac1 -r f138e6b2b294 sys/arch/x68k/stand/xxboot/version
--- a/sys/arch/x68k/stand/xxboot/version        Sat Nov 17 17:58:59 2012 +0000
+++ b/sys/arch/x68k/stand/xxboot/version        Sat Nov 17 19:10:46 2012 +0000
@@ -1,7 +1,8 @@
-$NetBSD: version,v 1.1 2012/03/20 13:01:32 minoura Exp $
+$NetBSD: version,v 1.2 2012/11/17 19:10:46 tsutsui 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.
diff -r e37c8ac65ac1 -r f138e6b2b294 sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile
--- a/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile  Sat Nov 17 17:58:59 2012 +0000
+++ b/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile  Sat Nov 17 19:10:46 2012 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.3 2012/11/17 17:58:59 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.4 2012/11/17 19:10:47 tsutsui Exp $
 
 DEV=           xx
 DEVDRV=                xx
 FS=            ffsv1
-BOOTCPPFLAGS=  -DSDBOOT
+BOOTCPPFLAGS=  -DSDBOOT -DFDBOOT
 
 TOUCHPROG=     @true
 
diff -r e37c8ac65ac1 -r f138e6b2b294 sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile
--- a/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile  Sat Nov 17 17:58:59 2012 +0000
+++ b/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile  Sat Nov 17 19:10:46 2012 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.3 2012/11/17 17:58:59 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.4 2012/11/17 19:10:47 tsutsui Exp $
 
 DEV=           xx
 DEVDRV=                xx
 FS=            ffsv2
-BOOTCPPFLAGS=  -DSDBOOT
+BOOTCPPFLAGS=  -DSDBOOT -DFDBOOT
 
 TOUCHPROG=     @true
 
diff -r e37c8ac65ac1 -r f138e6b2b294 sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile
--- a/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile  Sat Nov 17 17:58:59 2012 +0000
+++ b/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile  Sat Nov 17 19:10:46 2012 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.3 2012/11/17 17:59:00 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.4 2012/11/17 19:10:47 tsutsui Exp $
 
 DEV=           xx
 DEVDRV=                xx
 FS=            lfsv1
-BOOTCPPFLAGS=  -DSDBOOT
+BOOTCPPFLAGS=  -DSDBOOT -DFDBOOT
 
 TOUCHPROG=     @true
 
diff -r e37c8ac65ac1 -r f138e6b2b294 sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile
--- a/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile  Sat Nov 17 17:58:59 2012 +0000
+++ b/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile  Sat Nov 17 19:10:46 2012 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: Makefile,v 1.3 2012/11/17 17:59:00 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.4 2012/11/17 19:10:47 tsutsui Exp $
 
 DEV=           xx
 DEVDRV=                xx
 FS=            lfsv2
-BOOTCPPFLAGS=  -DSDBOOT
+BOOTCPPFLAGS=  -DSDBOOT -DFDBOOT
 
 TOUCHPROG=     @true
 



Home | Main Index | Thread Index | Old Index