Module Name: src Committed By: tsutsui Date: Sat Nov 17 19:10:47 UTC 2012
Modified Files: src/sys/arch/x68k/stand/xxboot: bootmain.c version src/sys/arch/x68k/stand/xxboot/cdboot_cd9660: Makefile src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1: Makefile src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2: Makefile src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1: Makefile src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2: Makefile Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x68k/stand/xxboot/bootmain.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x68k/stand/xxboot/version cvs rdiff -u -r1.1 -r1.2 \ src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile cvs rdiff -u -r1.3 -r1.4 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/xxboot/bootmain.c diff -u src/sys/arch/x68k/stand/xxboot/bootmain.c:1.3 src/sys/arch/x68k/stand/xxboot/bootmain.c:1.4 --- src/sys/arch/x68k/stand/xxboot/bootmain.c:1.3 Sat Nov 17 16:16:46 2012 +++ src/sys/arch/x68k/stand/xxboot/bootmain.c Sat Nov 17 19:10:46 2012 @@ -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 @@ get_scsi_host_adapter(char *devstr) 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 @@ get_scsi_host_adapter(char *devstr) 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 @@ 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); Index: src/sys/arch/x68k/stand/xxboot/version diff -u src/sys/arch/x68k/stand/xxboot/version:1.1 src/sys/arch/x68k/stand/xxboot/version:1.2 --- src/sys/arch/x68k/stand/xxboot/version:1.1 Tue Mar 20 13:01:32 2012 +++ src/sys/arch/x68k/stand/xxboot/version Sat Nov 17 19:10:46 2012 @@ -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. Index: src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile diff -u src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile:1.1 src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile:1.2 --- src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile:1.1 Tue Mar 20 13:01:32 2012 +++ src/sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile Sat Nov 17 19:10:46 2012 @@ -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 ) ; \ Index: src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile diff -u src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile:1.3 src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile:1.4 --- src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile:1.3 Sat Nov 17 17:58:59 2012 +++ src/sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile Sat Nov 17 19:10:47 2012 @@ -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 Index: src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile diff -u src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile:1.3 src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile:1.4 --- src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile:1.3 Sat Nov 17 17:58:59 2012 +++ src/sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile Sat Nov 17 19:10:47 2012 @@ -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 Index: src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile diff -u src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile:1.3 src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile:1.4 --- src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile:1.3 Sat Nov 17 17:59:00 2012 +++ src/sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile Sat Nov 17 19:10:47 2012 @@ -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 Index: src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile diff -u src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile:1.3 src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile:1.4 --- src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile:1.3 Sat Nov 17 17:59:00 2012 +++ src/sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile Sat Nov 17 19:10:47 2012 @@ -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