CVS commit: src/sys/arch/x68k/stand/loadbsd

2023-12-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Dec 23 20:57:16 UTC 2023

Modified Files:
src/sys/arch/x68k/stand/loadbsd: loadbsd.c

Log Message:
update usage() and usage comment with missing options.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x68k/stand/loadbsd/loadbsd.c

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/loadbsd/loadbsd.c
diff -u src/sys/arch/x68k/stand/loadbsd/loadbsd.c:1.14 src/sys/arch/x68k/stand/loadbsd/loadbsd.c:1.15
--- src/sys/arch/x68k/stand/loadbsd/loadbsd.c:1.14	Mon Feb 21 02:31:59 2011
+++ src/sys/arch/x68k/stand/loadbsd/loadbsd.c	Sat Dec 23 20:57:16 2023
@@ -4,10 +4,11 @@
  *	written by ITOH Yasufumi
  *	public domain
  *
- *	loadbsd [-hvV] [-abDs] [-r root_device] netbsd
+ *	loadbsd [-hvV] [-abDNqs] [-r root_device] netbsd
  *
  *	loadbsd options:
  *		-h	help
+ *		-N	do not actually execute kernel
  *		-V	print version and exit
  *
  *	kernel options:
@@ -19,13 +20,13 @@
  *		-q	quiet boot
  *		-v	verbose boot (also turn on verbosity of loadbsd)
  *
- *	$NetBSD: loadbsd.c,v 1.14 2011/02/21 02:31:59 itohy Exp $
+ *	$NetBSD: loadbsd.c,v 1.15 2023/12/23 20:57:16 andvar Exp $
  */
 
 #include 
 
-__RCSID("$NetBSD: loadbsd.c,v 1.14 2011/02/21 02:31:59 itohy Exp $");
-#define VERSION	"$Revision: 1.14 $ $Date: 2011/02/21 02:31:59 $"
+__RCSID("$NetBSD: loadbsd.c,v 1.15 2023/12/23 20:57:16 andvar Exp $");
+#define VERSION	"$Revision: 1.15 $ $Date: 2023/12/23 20:57:16 $"
 
 #include 		/* ntohl */
 #include 
@@ -416,10 +417,11 @@ usage(int status, const char *msg)
 		xwarnx("%s", msg);
 
 	xerrprintf("\
-%s [-hvV] [-abDs] [-r root_device] netbsd\n\
+%s [-hvV] [-abDNqs] [-r root_device] netbsd\n\
 \n\
 loadbsd options:\n\
 \t-h	help\n\
+\t-N	do not execute kernel\n\
 \t-v	verbose\n\
 \t-V	print version and exit\n\
 \n\
@@ -427,6 +429,7 @@ kernel options:\n\
 \t-a	auto boot, opposite of -s\n\
 \t-s	single user boot (default)\n\
 \t-D	enter kernel debugger\n\
+\t-q	quiet boot\n\
 \t-b	ask root device\n\
 \t-r	specify root device (default %s)\n\
 \t	format:  [/interface/]device@unit[,lun][:partition]\n\



CVS commit: src/sys/arch/x68k/stand/loadbsd

2023-12-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Dec 23 20:57:16 UTC 2023

Modified Files:
src/sys/arch/x68k/stand/loadbsd: loadbsd.c

Log Message:
update usage() and usage comment with missing options.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x68k/stand/loadbsd/loadbsd.c

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



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2023-01-11 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jan 11 09:35:06 UTC 2023

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: Makefile

Log Message:
Add udivdi3/umoddi3 (and ashldi3) that were required by recent UFS change.
This increases xxboot_ufs from about 4.5KB to 5.5KB (The upper limit is 8KB).
Thanks tsutsui@ for advices.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/x68k/stand/boot_ufs/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_ufs/Makefile
diff -u src/sys/arch/x68k/stand/boot_ufs/Makefile:1.38 src/sys/arch/x68k/stand/boot_ufs/Makefile:1.39
--- src/sys/arch/x68k/stand/boot_ufs/Makefile:1.38	Wed Dec 15 13:22:34 2021
+++ src/sys/arch/x68k/stand/boot_ufs/Makefile	Wed Jan 11 09:35:06 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2021/12/15 13:22:34 christos Exp $
+#	$NetBSD: Makefile,v 1.39 2023/01/11 09:35:06 isaki Exp $
 
 NOMAN=		# defined
 
@@ -30,6 +30,12 @@ LIBIOCS=	$M/stand/libiocs
 SRCS=	boot.S bootmain.c readufs.c readufs_ffs.c readufs_lfs.c
 SRCS+=	exec_image.S memset.S strcmp.S
 
+.PATH:	${S}/../common/lib/libc/quad
+SRCS+=	udivdi3.c umoddi3.c qdivrem.c
+
+.PATH:	${.CURDIR}/../xxboot
+SRCS+=	ashldi3.S
+
 .include "${S}/conf/newvers_stand.mk"
 
 CFLAGS=	-Os -fomit-frame-pointer -fno-unwind-tables



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2023-01-11 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jan 11 09:35:06 UTC 2023

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: Makefile

Log Message:
Add udivdi3/umoddi3 (and ashldi3) that were required by recent UFS change.
This increases xxboot_ufs from about 4.5KB to 5.5KB (The upper limit is 8KB).
Thanks tsutsui@ for advices.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/x68k/stand/boot_ufs/Makefile

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



CVS commit: src/sys/arch/x68k/stand

2022-06-23 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Jun 23 12:32:22 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/boot: conf.c
src/sys/arch/x68k/stand/libsa: libx68k.h sdcd.c

Log Message:
x68k/stand: Merge {sd,cd}strategy and {sd,cd}close respectively.
For sd and cd devs, only open differs and the rest is the same.
No functional changes intended.
Suggested by tsutsui@ at port-x68k.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x68k/stand/boot/conf.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x68k/stand/libsa/libx68k.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/stand/libsa/sdcd.c

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/conf.c
diff -u src/sys/arch/x68k/stand/boot/conf.c:1.12 src/sys/arch/x68k/stand/boot/conf.c:1.13
--- src/sys/arch/x68k/stand/boot/conf.c:1.12	Mon Apr 25 15:12:07 2022
+++ src/sys/arch/x68k/stand/boot/conf.c	Thu Jun 23 12:32:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.12 2022/04/25 15:12:07 mlelstv Exp $	*/
+/*	$NetBSD: conf.c,v 1.13 2022/06/23 12:32:22 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Minoura Makoto
@@ -40,8 +40,8 @@
 #include "libx68k.h"
 
 struct devsw devsw[] = {
-	{ "sd",	sdstrategy, sdopen, sdclose, noioctl },
-	{ "cd",	cdstrategy, cdopen, cdclose, noioctl },
+	{ "sd",	sdcdstrategy, sdopen, sdcdclose, noioctl },
+	{ "cd",	sdcdstrategy, cdopen, sdcdclose, noioctl },
 	{ "fd",	fdstrategy, fdopen, fdclose, noioctl },
 	{ "nfs", net_strategy, net_open, net_close, net_ioctl },
 	{ 0, 0, 0, 0, 0 }

Index: src/sys/arch/x68k/stand/libsa/libx68k.h
diff -u src/sys/arch/x68k/stand/libsa/libx68k.h:1.7 src/sys/arch/x68k/stand/libsa/libx68k.h:1.8
--- src/sys/arch/x68k/stand/libsa/libx68k.h:1.7	Sun Jun 26 04:17:17 2016
+++ src/sys/arch/x68k/stand/libsa/libx68k.h	Thu Jun 23 12:32:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: libx68k.h,v 1.7 2016/06/26 04:17:17 isaki Exp $	*/
+/*	$NetBSD: libx68k.h,v 1.8 2022/06/23 12:32:22 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Minoura Makoto
@@ -50,13 +50,11 @@ int parseboot(char *, char **, int *);
 
 /* sdcd.c */
 struct sd_softc;
-int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
 int sdopen(struct open_file *, ...);
-int sdclose(struct open_file *);
+int sdcdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
+int sdcdclose(struct open_file *);
 int sd_getbsdpartition(int, int);
-int cdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
 int cdopen(struct open_file *, ...);
-int cdclose(struct open_file *);
 
 /* fd.c */
 int fdstrategy(void *, int, daddr_t, size_t, void *, size_t *);

Index: src/sys/arch/x68k/stand/libsa/sdcd.c
diff -u src/sys/arch/x68k/stand/libsa/sdcd.c:1.17 src/sys/arch/x68k/stand/libsa/sdcd.c:1.18
--- src/sys/arch/x68k/stand/libsa/sdcd.c:1.17	Tue Jun 21 12:43:57 2022
+++ src/sys/arch/x68k/stand/libsa/sdcd.c	Thu Jun 23 12:32:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdcd.c,v 1.17 2022/06/21 12:43:57 isaki Exp $	*/
+/*	$NetBSD: sdcd.c,v 1.18 2022/06/23 12:32:22 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 MINOURA Makoto.
@@ -301,7 +301,7 @@ sdopen(struct open_file *f, ...)
 }
 
 int
-sdclose(struct open_file *f)
+sdcdclose(struct open_file *f)
 {
 
 	dealloc(f->f_devdata, sizeof(struct sdcd_softc));
@@ -309,7 +309,7 @@ sdclose(struct open_file *f)
 }
 
 int
-sdstrategy(void *arg, int rw, daddr_t dblk, size_t size,
+sdcdstrategy(void *arg, int rw, daddr_t dblk, size_t size,
void *buf, size_t *rsize)
 {
 	struct sdcd_softc *sc = arg;
@@ -382,18 +382,3 @@ cdopen(struct open_file *f, ...)
 
 	return 0;
 }
-
-int
-cdclose(struct open_file *f)
-{
-
-	dealloc(f->f_devdata, sizeof(struct sdcd_softc));
-	return 0;
-}
-
-int
-cdstrategy(void *arg, int rw, daddr_t dblk, size_t size,
-   void *buf, size_t *rsize)
-{
-	return sdstrategy(arg, rw, dblk, size, buf, rsize);
-}



CVS commit: src/sys/arch/x68k/stand

2022-06-23 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Jun 23 12:32:22 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/boot: conf.c
src/sys/arch/x68k/stand/libsa: libx68k.h sdcd.c

Log Message:
x68k/stand: Merge {sd,cd}strategy and {sd,cd}close respectively.
For sd and cd devs, only open differs and the rest is the same.
No functional changes intended.
Suggested by tsutsui@ at port-x68k.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x68k/stand/boot/conf.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x68k/stand/libsa/libx68k.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/stand/libsa/sdcd.c

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



CVS commit: src/sys/arch/x68k/stand/boot

2022-06-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 21 12:45:46 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/boot: version

Log Message:
x68k/stand: Bump boot's version.  Fix blocksize parameter passes to SCSI IOCS.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x68k/stand/boot/version

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/version
diff -u src/sys/arch/x68k/stand/boot/version:1.8 src/sys/arch/x68k/stand/boot/version:1.9
--- src/sys/arch/x68k/stand/boot/version:1.8	Sat Jun 25 14:35:58 2016
+++ src/sys/arch/x68k/stand/boot/version	Tue Jun 21 12:45:46 2022
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.8 2016/06/25 14:35:58 isaki Exp $
+$NetBSD: version,v 1.9 2022/06/21 12:45:46 isaki 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
@@ -14,3 +14,4 @@ is taken as the current.
 	non ASCII keys (CTRL, OPT.1 etc.) are pressed during boot.
 1.6:	Disable slow gunzip CRC32 calculation.
 1.7:	Integrate netboot.
+1.8:	Fix blocksize parameter passes to SCSI IOCS.



CVS commit: src/sys/arch/x68k/stand/boot

2022-06-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 21 12:45:46 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/boot: version

Log Message:
x68k/stand: Bump boot's version.  Fix blocksize parameter passes to SCSI IOCS.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x68k/stand/boot/version

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



CVS commit: src/sys/arch/x68k/stand/libsa

2022-06-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 21 12:43:57 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/libsa: sdcd.c

Log Message:
x68k/stand: Correct blocksize in case of CD.
- Fix calculation of the blocksize passes to SCSI IOCS.
- Use three kind of sector size (blocksize) properly; media's sector size,
  DEV_BSIZE from xxstrategy, and Human68k's sector size.
By this change,
- For 512 bytes/sector HDD, no changes are intended.
- For CD, corrects the blocksize (%d5) passes to SCSI IOCS.
  It has worked previously though the blocksize was incorrect.  Now it
  works with correct blocksize.
- As a secondary effect, 256 or 1024 bytes/sector media may work but not
  well tested.
Reviewed by tsutsui@ at port-x68k.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x68k/stand/libsa/sdcd.c

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/libsa/sdcd.c
diff -u src/sys/arch/x68k/stand/libsa/sdcd.c:1.16 src/sys/arch/x68k/stand/libsa/sdcd.c:1.17
--- src/sys/arch/x68k/stand/libsa/sdcd.c:1.16	Tue Jun 21 12:20:43 2022
+++ src/sys/arch/x68k/stand/libsa/sdcd.c	Tue Jun 21 12:43:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdcd.c,v 1.16 2022/06/21 12:20:43 isaki Exp $	*/
+/*	$NetBSD: sdcd.c,v 1.17 2022/06/21 12:43:57 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 MINOURA Makoto.
@@ -26,6 +26,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,9 +37,14 @@
 
 
 static int current_id = -1;
-static int current_blklen, current_devsize, current_npart;
+static int current_blkbytes;
+static int current_blkshift;
+static int current_devsize, current_npart;
 static struct boot_partinfo partitions[MAXPARTITIONS];
 
+static uint human2blk(uint);
+static uint human2bsd(uint);
+static uint bsd2blk(uint);
 static int readdisklabel(int);
 static int check_unit(int);
 
@@ -48,6 +54,44 @@ static int check_unit(int);
 #define DPRINTF(x)	
 #endif
 
+/*
+ * Convert the number of sectors on Human68k
+ * into the number of blocks on the current device.
+ */
+static uint
+human2blk(uint n)
+{
+	uint blk_per_sect;
+
+	/* Human68k uses 1024 byte/sector. */
+	blk_per_sect = 4 >> current_blkshift;
+	if (blk_per_sect == 0)
+		blk_per_sect = 1;
+	return blk_per_sect * n;
+}
+
+/*
+ * Convert the number of sectors on Human68k
+ * into the number of DEV_BSIZE sectors.
+ */
+static uint
+human2bsd(uint n)
+{
+
+	return n * (1024 / DEV_BSIZE);
+}
+
+/*
+ * Convert the number of DEV_BSIZE sectors
+ * into the number of blocks on the current device.
+ */
+static uint
+bsd2blk(uint n)
+{
+
+	return ((DEV_BSIZE / 256) * n) >> current_blkshift;
+}
+
 static int
 check_unit(int id)
 {
@@ -90,12 +134,13 @@ check_unit(int id)
 			error = EUNIT;
 			goto out;
 		}
-		current_blklen = rcdata->size >> 9;
+		current_blkbytes = rcdata->size;
+		current_blkshift = fls32(current_blkbytes) - 9;
 		current_devsize = rcdata->block;
 	}
 
 	{
-		error = IOCS_S_READ(0, 1, id, current_blklen, buffer);
+		error = IOCS_S_READ(0, 1, id, current_blkshift, buffer);
 		if (error < 0) {
 			error =  EIO;
 			goto out;
@@ -125,15 +170,15 @@ readdisklabel(int id)
 	error = check_unit(id);
 	if (error)
 		return error;
-	if (current_blklen > 4) {
+	if (current_blkbytes > 2048) {
 		printf("FATAL: Unsupported block size %d.\n",
-		256 << current_blklen);
+		current_blkbytes);
 		return ERDLAB;
 	}
 
 	/* Try BSD disklabel first */
 	buffer = alloca(2048);
-	error = IOCS_S_READ(LABELSECTOR, 1, id, current_blklen, buffer);
+	error = IOCS_S_READ(LABELSECTOR, 1, id, current_blkshift, buffer);
 	if (error < 0)
 		return EIO;
 	label = (void *)(buffer + LABELOFFSET);
@@ -149,13 +194,7 @@ readdisklabel(int id)
 	}
 
 	/* Try Human68K-style partition table */
-#if 0
-	/* assumes 512byte/sec */
-	error = IOCS_S_READ(DOSPARTOFF, 2, id, current_blklen, buffer);
-#else
-	error = IOCS_S_READ(8 >> current_blklen, 8 >> current_blklen,
-			id, current_blklen, buffer);
-#endif
+	error = IOCS_S_READ(human2blk(2), 1, id, current_blkshift, buffer);
 	if (error < 0)
 		return EIO;
 	parttbl = (void *)(buffer + DOSBBSECTOR);
@@ -166,9 +205,9 @@ readdisklabel(int id)
 	 current_npart < MAXPARTITIONS && i < 15 && parttbl[i].dp_size;
 	 i++) {
 		partitions[current_npart].start
-			= parttbl[i].dp_start * 2;
+			= human2bsd(parttbl[i].dp_start);
 		partitions[current_npart].size
-			= parttbl[i].dp_size  * 2;
+			= human2bsd(parttbl[i].dp_size);
 		if (++current_npart == RAW_PART) {
 			partitions[current_npart].start = 0;
 			partitions[current_npart].size = -1; /* XXX */
@@ -205,8 +244,7 @@ sd_getbsdpartition(int id, int humanpart
 		return -1;
 	}
 	buffer = alloca(2048);
-	error = IOCS_S_READ(8 >> current_blklen, 8 >> current_blklen,
-			id, current_blklen, buffer);
+	error = IOCS_S_READ(human2blk(2), 1, id, current_blkshift, buffer);
 	if (error < 0) {
 		printf("Reading partition table: %s\n", 

CVS commit: src/sys/arch/x68k/stand/libsa

2022-06-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 21 12:43:57 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/libsa: sdcd.c

Log Message:
x68k/stand: Correct blocksize in case of CD.
- Fix calculation of the blocksize passes to SCSI IOCS.
- Use three kind of sector size (blocksize) properly; media's sector size,
  DEV_BSIZE from xxstrategy, and Human68k's sector size.
By this change,
- For 512 bytes/sector HDD, no changes are intended.
- For CD, corrects the blocksize (%d5) passes to SCSI IOCS.
  It has worked previously though the blocksize was incorrect.  Now it
  works with correct blocksize.
- As a secondary effect, 256 or 1024 bytes/sector media may work but not
  well tested.
Reviewed by tsutsui@ at port-x68k.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x68k/stand/libsa/sdcd.c

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



CVS commit: src/sys/arch/x68k/stand/libsa

2022-06-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 21 12:20:43 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/libsa: sdcd.c

Log Message:
x68k/stand: Correct a condition expression.
- start is LBA but dblk is relative from this partition.
- The first term was wrong.  It should be '(x & 0x1f) == x', but
  it's more simple to use numerical comparison.
There would have been no impact.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x68k/stand/libsa/sdcd.c

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/libsa/sdcd.c
diff -u src/sys/arch/x68k/stand/libsa/sdcd.c:1.15 src/sys/arch/x68k/stand/libsa/sdcd.c:1.16
--- src/sys/arch/x68k/stand/libsa/sdcd.c:1.15	Tue Feb 11 08:06:07 2014
+++ src/sys/arch/x68k/stand/libsa/sdcd.c	Tue Jun 21 12:20:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdcd.c,v 1.15 2014/02/11 08:06:07 tsutsui Exp $	*/
+/*	$NetBSD: sdcd.c,v 1.16 2022/06/21 12:20:43 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 MINOURA Makoto.
@@ -289,7 +289,7 @@ sdstrategy(void *arg, int rw, daddr_t db
 	}
 	nblks = howmany(size, 256 << current_blklen);
 
-	if ((dblk & 0x1f) == 0x1f && (nblks & 0xff) == nblks) {
+	if (start < 0x20 && nblks < 256) {
 		if (rw & F_WRITE)
 			error = IOCS_S_WRITE(start, nblks, current_id,
 			 current_blklen, buf);



CVS commit: src/sys/arch/x68k/stand/libsa

2022-06-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 21 12:20:43 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/libsa: sdcd.c

Log Message:
x68k/stand: Correct a condition expression.
- start is LBA but dblk is relative from this partition.
- The first term was wrong.  It should be '(x & 0x1f) == x', but
  it's more simple to use numerical comparison.
There would have been no impact.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x68k/stand/libsa/sdcd.c

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



Re: CVS commit: src/sys/arch/x68k/stand

2022-04-25 Thread Izumi Tsutsui
> Module Name:  src
> Committed By: mlelstv
> Date: Mon Apr 25 15:12:07 UTC 2022
> 
> Modified Files:
>   src/sys/arch/x68k/stand/boot: conf.c
>   src/sys/arch/x68k/stand/xxboot: Makefile.xxboot xx.c
> 
> Log Message:
> libsa now needs ioctl to support media with large sectors. Provide
> missing functions.

Only for bootloaders that load a kernel?

FS_xxx ops in libsa is also used to load secondary bootloaders
(not a kernel that might require module info) on several ports,
including x86, and I guess in that case ioctl or the "fsmod" variable
is not necessary as before.
(I'm afraid "const char *fsmod" might require some ifdefs)
---
Izumi Tsutsui


CVS commit: src/sys/arch/x68k/stand

2022-04-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Apr 25 15:12:07 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/boot: conf.c
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot xx.c

Log Message:
libsa now needs ioctl to support media with large sectors. Provide
missing functions.

libsa defines files[] array itself, just reference it.
This also adds another global variable that tracks the root
filesystem module.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x68k/stand/boot/conf.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x68k/stand/xxboot/xx.c

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



CVS commit: src/sys/arch/x68k/stand

2022-04-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Apr 25 15:12:07 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/boot: conf.c
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot xx.c

Log Message:
libsa now needs ioctl to support media with large sectors. Provide
missing functions.

libsa defines files[] array itself, just reference it.
This also adds another global variable that tracks the root
filesystem module.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x68k/stand/boot/conf.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x68k/stand/xxboot/xx.c

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/conf.c
diff -u src/sys/arch/x68k/stand/boot/conf.c:1.11 src/sys/arch/x68k/stand/boot/conf.c:1.12
--- src/sys/arch/x68k/stand/boot/conf.c:1.11	Sat Jun 25 14:35:58 2016
+++ src/sys/arch/x68k/stand/boot/conf.c	Mon Apr 25 15:12:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.11 2016/06/25 14:35:58 isaki Exp $	*/
+/*	$NetBSD: conf.c,v 1.12 2022/04/25 15:12:07 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2001 Minoura Makoto
@@ -84,5 +84,3 @@ struct netif_driver *netif_drivers[] = {
 };
 
 int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]);
-
-struct open_file files[SOPEN_MAX];

Index: src/sys/arch/x68k/stand/xxboot/Makefile.xxboot
diff -u src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.19 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.20
--- src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.19	Fri Feb  4 06:16:03 2022
+++ src/sys/arch/x68k/stand/xxboot/Makefile.xxboot	Mon Apr 25 15:12:07 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.xxboot,v 1.19 2022/02/04 06:16:03 isaki Exp $
+#	$NetBSD: Makefile.xxboot,v 1.20 2022/04/25 15:12:07 mlelstv Exp $
 
 NOMAN=		# defined
 
@@ -25,7 +25,7 @@ BINMODE=	444
 S=		${.CURDIR}/../../../../..
 M=		$S/arch/x68k
 .PATH:		${.CURDIR}/..
-SRCS=	boot.S bootmain.c conf.c xx.c
+SRCS=	boot.S bootmain.c xx.c
 SRCS+=	ashrdi3.S
 SRCS+=	ashldi3.S
 SRCS+=	memcpy.S
@@ -65,7 +65,7 @@ CPPFLAGS+= -DLIBSA_NO_RAW_ACCESS
 CPPFLAGS+= -DLIBSA_NO_TWIDDLE
 CPPFLAGS+= -DUSTAR_SECT_PER_CYL=30
 SRCS+=	open.c close.c read.c lseek.c loadfile.c loadfile_aout.c alloc.c
-SRCS+=	errno.c globals.c
+SRCS+=	errno.c globals.c files.c
 SRCS+=  $(FS).c
 SRCS+=	${BOOTSRCS}
 

Index: src/sys/arch/x68k/stand/xxboot/xx.c
diff -u src/sys/arch/x68k/stand/xxboot/xx.c:1.4 src/sys/arch/x68k/stand/xxboot/xx.c:1.5
--- src/sys/arch/x68k/stand/xxboot/xx.c:1.4	Sun Aug 16 06:43:43 2020
+++ src/sys/arch/x68k/stand/xxboot/xx.c	Mon Apr 25 15:12:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xx.c,v 1.4 2020/08/16 06:43:43 isaki Exp $	*/
+/*	$NetBSD: xx.c,v 1.5 2022/04/25 15:12:07 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2010 MINOURA Makoto.
@@ -72,3 +72,11 @@ xxstrategy(void *arg, int rw, daddr_t db
 		*rsize = size;
 	return 0;
 }
+
+int
+xxioctl(struct open_file *f, u_long cmd, void *data)
+{
+
+	return ENOTTY;
+}
+



CVS commit: src/sys/arch/x68k/stand/xxboot

2022-02-03 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Feb  4 06:16:03 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot

Log Message:
Add missing -m68020-60 option.  This makes xxboot_ustarfs work even on 68060.
Problem reported by Makoto Kamada.  Confirmed on XEiJ (68060 mode).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot

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/Makefile.xxboot
diff -u src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.18 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.19
--- src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.18	Sun Aug 16 06:43:43 2020
+++ src/sys/arch/x68k/stand/xxboot/Makefile.xxboot	Fri Feb  4 06:16:03 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.xxboot,v 1.18 2020/08/16 06:43:43 isaki Exp $
+#	$NetBSD: Makefile.xxboot,v 1.19 2022/02/04 06:16:03 isaki Exp $
 
 NOMAN=		# defined
 
@@ -35,6 +35,7 @@ SRCS+=	memcmp.S
 .include "${S}/conf/newvers_stand.mk"
 
 CFLAGS=	-Os -fomit-frame-pointer -fno-unwind-tables -Wno-attributes
+CFLAGS+= -m68020-60
 #CFLAGS+= -Wall
 CPPFLAGS+= -D_STANDALONE
 CPPFLAGS+= -DTEXTADDR="$(TEXT)" -DBOOT_TEXTADDR="$(BOOT_TEXT)"



CVS commit: src/sys/arch/x68k/stand/xxboot

2022-02-03 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Feb  4 06:16:03 UTC 2022

Modified Files:
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot

Log Message:
Add missing -m68020-60 option.  This makes xxboot_ustarfs work even on 68060.
Problem reported by Makoto Kamada.  Confirmed on XEiJ (68060 mode).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot

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



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2021-12-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 15 13:22:34 UTC 2021

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: Makefile

Log Message:
-W === -Wextra


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x68k/stand/boot_ufs/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_ufs/Makefile
diff -u src/sys/arch/x68k/stand/boot_ufs/Makefile:1.37 src/sys/arch/x68k/stand/boot_ufs/Makefile:1.38
--- src/sys/arch/x68k/stand/boot_ufs/Makefile:1.37	Wed Dec 15 07:52:36 2021
+++ src/sys/arch/x68k/stand/boot_ufs/Makefile	Wed Dec 15 08:22:34 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.37 2021/12/15 12:52:36 christos Exp $
+#	$NetBSD: Makefile,v 1.38 2021/12/15 13:22:34 christos Exp $
 
 NOMAN=		# defined
 
@@ -34,7 +34,7 @@ SRCS+=	exec_image.S memset.S strcmp.S
 
 CFLAGS=	-Os -fomit-frame-pointer -fno-unwind-tables
 CFLAGS+= -m68020-60
-CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS+= -Wextra -Wall -Wstrict-prototypes -Wmissing-prototypes
 CPPFLAGS+= -DTEXTADDR="$(TEXT)" -DBOOT_TEXTADDR="$(BOOT_TEXT)"
 CPPFLAGS+= -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\"
 CPPFLAGS+= -DSCSI_ADHOC_BOOTPART



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2021-12-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 15 13:22:34 UTC 2021

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: Makefile

Log Message:
-W === -Wextra


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x68k/stand/boot_ufs/Makefile

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



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2021-12-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 15 12:52:36 UTC 2021

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: Makefile

Log Message:
remove naked -W


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x68k/stand/boot_ufs/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_ufs/Makefile
diff -u src/sys/arch/x68k/stand/boot_ufs/Makefile:1.36 src/sys/arch/x68k/stand/boot_ufs/Makefile:1.37
--- src/sys/arch/x68k/stand/boot_ufs/Makefile:1.36	Sat Jan 18 02:25:11 2020
+++ src/sys/arch/x68k/stand/boot_ufs/Makefile	Wed Dec 15 07:52:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.36 2020/01/18 07:25:11 isaki Exp $
+#	$NetBSD: Makefile,v 1.37 2021/12/15 12:52:36 christos Exp $
 
 NOMAN=		# defined
 
@@ -34,7 +34,7 @@ SRCS+=	exec_image.S memset.S strcmp.S
 
 CFLAGS=	-Os -fomit-frame-pointer -fno-unwind-tables
 CFLAGS+= -m68020-60
-CFLAGS+= -W -Wall -Wstrict-prototypes -Wmissing-prototypes
+CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes
 CPPFLAGS+= -DTEXTADDR="$(TEXT)" -DBOOT_TEXTADDR="$(BOOT_TEXT)"
 CPPFLAGS+= -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\"
 CPPFLAGS+= -DSCSI_ADHOC_BOOTPART



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2021-12-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 15 12:52:36 UTC 2021

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: Makefile

Log Message:
remove naked -W


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x68k/stand/boot_ufs/Makefile

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



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2019-06-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Jun 14 14:17:58 UTC 2019

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: bootmain.c

Log Message:
Add missing newline.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x68k/stand/boot_ufs/bootmain.c

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



CVS commit: src/sys/arch/x68k/stand/boot_ufs

2019-06-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Jun 14 14:17:58 UTC 2019

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: bootmain.c

Log Message:
Add missing newline.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x68k/stand/boot_ufs/bootmain.c

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_ufs/bootmain.c
diff -u src/sys/arch/x68k/stand/boot_ufs/bootmain.c:1.13 src/sys/arch/x68k/stand/boot_ufs/bootmain.c:1.14
--- src/sys/arch/x68k/stand/boot_ufs/bootmain.c:1.13	Sat Jul 17 06:27:03 2010
+++ src/sys/arch/x68k/stand/boot_ufs/bootmain.c	Fri Jun 14 14:17:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootmain.c,v 1.13 2010/07/17 06:27:03 isaki Exp $	*/
+/*	$NetBSD: bootmain.c,v 1.14 2019/06/14 14:17:58 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1993, 1994 Takumi Nakamura.
@@ -229,7 +229,7 @@ load_file_ino(ino32_t ino, const char *f
 	if ((N_GETMAGIC(*header) != OMAGIC) ||
 	(N_GETMID(*header) != MID_M68K)) {
 		B_PRINT(fn);
-		B_PRINT(": inappropriate format");
+		B_PRINT(": inappropriate format\r\n");
 		return 0;
 	}
 



CVS commit: src/sys/arch/x68k/stand/boot

2019-06-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Jun 14 14:15:53 UTC 2019

Modified Files:
src/sys/arch/x68k/stand/boot: Makefile

Log Message:
boot_ufs (primary bootloader) expects /boot OMAGIC a.out.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x68k/stand/boot/Makefile

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



CVS commit: src/sys/arch/x68k/stand/boot

2019-06-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Jun 14 14:15:53 UTC 2019

Modified Files:
src/sys/arch/x68k/stand/boot: Makefile

Log Message:
boot_ufs (primary bootloader) expects /boot OMAGIC a.out.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x68k/stand/boot/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/Makefile
diff -u src/sys/arch/x68k/stand/boot/Makefile:1.30 src/sys/arch/x68k/stand/boot/Makefile:1.31
--- src/sys/arch/x68k/stand/boot/Makefile:1.30	Wed Jan  2 00:48:13 2019
+++ src/sys/arch/x68k/stand/boot/Makefile	Fri Jun 14 14:15:53 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2019/01/02 00:48:13 christos Exp $
+#	$NetBSD: Makefile,v 1.31 2019/06/14 14:15:53 isaki Exp $
 
 NOMAN=		# defined
 
@@ -42,6 +42,7 @@ CPPFLAGS+=	-DSUPPORT_BOOTP -DSUPPORT_DHC
 #CPPFLAGS+=	-DDEBUG
 CFLAGS=		-Wno-main -Os -m68020-60
 LINKFLAGS=	-N -static -T ${.CURDIR}/../boot/boot.ldscript
+ELF2AOUT_OPTS=	-O
 LIBIOCS!=	cd $M/stand/libiocs && ${PRINTOBJDIR}
 LIBSA!=		cd $M/stand/libsa && ${PRINTOBJDIR}
 L=		${LIBSA}/lib
@@ -55,7 +56,7 @@ ${PROG}:	${OBJS} ${LDLIBS}
 	${_MKTARGET_LINK}
 	${LD} ${LINKFLAGS} -o ${PROG}.sym ${OBJS} ${LDLIBS}
 	${STRIP} ${PROG}.sym -o ${PROG}.strip
-	${M68K_ELF2AOUT} ${PROG}.strip ${PROG}
+	${M68K_ELF2AOUT} ${ELF2AOUT_OPTS} ${PROG}.strip ${PROG}
 
 CLEANFILES+=	${PROG}.sym ${PROG}.strip
 



Re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-23 Thread David Laight
On Tue, Apr 15, 2014 at 12:43:42PM -0700, Dennis Ferguson wrote:
 
 I'm pretty sure NetBSD could never run on a 68000 since the 68000
 had no memory management unit.  The 68010 and 68020 didn't have memory
 management units either, but Sun did proprietary MMUs for both (that's
 sun2 and sun3, respectively) and I think other companies may have done
 MMUs for the 68020.  The 68030 was the first CPU in the series to come
 with an MMU built in.

ISTR that either (or both) of the 68000 or 68010 don't save enough
state to make all address faults recoverable.
This stops you running OS that do paging - so you could only run
OS that swap entire processes.

The '020 saves the mid-instruction state for some faults (as well as the
actual fault reason) so they can be recovered.
(Just don't continue on a cpu with a different mask level.)

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-17 Thread Frank Kardel

Dennis,

while the MC68020 did not have an MMU onboard there where Motorola PMMUs 
out there (MC68851). In the beginning there was an FPGA solution that 
emulated a subset of the MC68851 PMMU via the Coprocessor interface. 
Later when the PMMU became available it was also used in designs. E. g. 
I put an XC68851 (pre-production sample) into my Mac II  around 1988 and 
could run A/UX (or whatever it was called). Early versions of NetBSD did 
work too. So there was some 'common' MMU support for the '20 via the 
PMMU coprocessor support.  Sun had it's own MMU, though. The MC68851 
came late to the market, that's probably the cause why so many 
non-Motorola solutions existed for the 68020.


Frank

On 04/15/14 21:43, Dennis Ferguson wrote:

On 15 Apr, 2014, at 05:14 , Izumi Tsutsui tsut...@ceres.dti.ne.jp wrote:

- NetBSD/x68k supports only X680x0 machines with MC68030 and higher
  processors.

- Normal X68000 machines (i.e. all X680x0 except X68030) have MC68000,
  so 030 accelerators are required for the X68000 models, i.e.
  XVI, SUPER, EXPERT, PRO, and ACE.

  (BTW the normal X68030 has MC68EC030 so users also have to replace
   its CPU to with MC68030 to use NetBSD/x68k)

- On the other hand, probably early x68k developers considered
  that some stupid users could try to boot NetBSD/x68k on X68000
  without 030 and bootloaders should have some sanity checks.

I'm pretty sure NetBSD could never run on a 68000 since the 68000
had no memory management unit.  The 68010 and 68020 didn't have memory
management units either, but Sun did proprietary MMUs for both (that's
sun2 and sun3, respectively) and I think other companies may have done
MMUs for the 68020.  The 68030 was the first CPU in the series to come
with an MMU built in.

That generic x68x requires a 68030 makes sense since that's the first
CPU where the code can count on knowing how the MMU works.  A 68020
would have a manufacturer-specific MMU, while for the 68010 there is
only sun2.  There is no reason to restrict the instruction set to
that of the 68000 in any case since NetBSD won't run on that.

I once had a 68000 board that ran a 4.3 BSD kernel, but it was a
4.3 BSD kernel with all the process scheduling hacked out so that
it ran exactly 1 compiled-in user space process, without memory
protection.  I used it as an ntp server.

Dennis Ferguson




Re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-16 Thread Izumi Tsutsui
dennis wrote:

 That generic x68x requires a 68030 makes sense since that's the first
 CPU where the code can count on knowing how the MMU works.

Well, it's not a guess but the design of NetBSD/x68k.

 A 68020
 would have a manufacturer-specific MMU,

Note there is Motorola MC68851 PMMU for 68020 and
some hp300 and mac68k machines have it (and we support them).

 There is no reason to restrict the instruction set to
 that of the 68000 in any case since NetBSD won't run on that.

In this prinary bootloader case, 68000 was intended to be supported
to print wrong MPU warning for users, while it isn't implemented yet.

Actually X68000 EXPERT (emulated by XM6i) can run the primary boot_ustar
in NetBSD/x68k 6.1.3 boot floppy and it loads the secondary boot.
(though it fails in the secondary boot without proper warning yet)

Anyway,
 AFLAGS+=   -Wa,-march=m68000 -Wa,-mcpu=m68000
works both with gcc 4.5 and 4.8 (and same binaries are generated)
so I'll put it back to the Makefile.

---
Izumi Tsutsui


Re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-16 Thread Izumi Tsutsui
martin@ wrote:

 It doesn't really matter for .S files, as long as the code does not mutate
 due to ifdefs - or am I missing something?

Just FYI,

as(1) converts
jbsr [LABEL] lines into
jsr [absolute address] with -m68000, and
bsrl [relative address] with -m68020.

The latter is not supported by 68000/010.
(and probably faster on 020 and later?)

---
Izumi Tsutsui


re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-15 Thread matthew green

Tetsuya Isaki writes:
 Module Name:  src
 Committed By: isaki
 Date: Mon Apr 14 14:24:27 UTC 2014
 
 Modified Files:
   src/sys/arch/x68k/stand/boot_ustar: Makefile
 
 Log Message:
 Remove -mc68000 asm option for GCC4.8 (or new binutils?).
 With this option, new gcc complains that boot_ustar.S:21: Error:
 selected processor does not have all features of selected architecture.
 I'm not sure about the essence of this error, but this option maybe
 not needed because there is no need to consider about 68000 here.

hmmm this option is now called -march=68000.  i don't think any
x68k are 68000 are they?  all 020/030/040?  perhaps using
-mcpu=m68020 here might be best?  i would test some and see if
size or speed matters any.


.mrg.


Re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-15 Thread Martin Husemann
On Tue, Apr 15, 2014 at 04:51:29PM +1000, matthew green wrote:
 hmmm this option is now called -march=68000.  i don't think any
 x68k are 68000 are they?  all 020/030/040?  perhaps using
 -mcpu=m68020 here might be best?  i would test some and see if
 size or speed matters any.

It doesn't really matter for .S files, as long as the code does not mutate
due to ifdefs - or am I missing something?

Martin


re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-15 Thread matthew green

Martin Husemann writes:
 On Tue, Apr 15, 2014 at 04:51:29PM +1000, matthew green wrote:
  hmmm this option is now called -march=68000.  i don't think any
  x68k are 68000 are they?  all 020/030/040?  perhaps using
  -mcpu=m68020 here might be best?  i would test some and see if
  size or speed matters any.
 
 It doesn't really matter for .S files, as long as the code does not mutate
 due to ifdefs - or am I missing something?

i think it matters because as(1) might reject stuff otherwise,
but i would imagine that the defaults for m68k are ok defaults
for x68k port, so maybe this option going away is fine.


.mrg.


Re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-15 Thread Izumi Tsutsui
mrg@ wrote:
 Martin Husemann writes:
  On Tue, Apr 15, 2014 at 04:51:29PM +1000, matthew green wrote:
   hmmm this option is now called -march=68000.

I don't think this is correct.

   i don't think any
   x68k are 68000 are they?  all 020/030/040?  perhaps using
   -mcpu=m68020 here might be best?  i would test some and see if
   size or speed matters any.

In this case, it looks 68000 was intended to be supported.
(see below)

  It doesn't really matter for .S files, as long as the code does not mutate
  due to ifdefs - or am I missing something?

Probably as(1) might do some optimization or instruction replacement
per the specified processor (addressing, branch ranges etc). 

 i think it matters because as(1) might reject stuff otherwise,
 but i would imagine that the defaults for m68k are ok defaults
 for x68k port, so maybe this option going away is fine.

Here is my guess:

- NetBSD/x68k supports only X680x0 machines with MC68030 and higher
  processors.

- Normal X68000 machines (i.e. all X680x0 except X68030) have MC68000,
  so 030 accelerators are required for the X68000 models, i.e.
  XVI, SUPER, EXPERT, PRO, and ACE.

  (BTW the normal X68030 has MC68EC030 so users also have to replace
   its CPU to with MC68030 to use NetBSD/x68k)

- On the other hand, probably early x68k developers considered
  that some stupid users could try to boot NetBSD/x68k on X68000
  without 030 and bootloaders should have some sanity checks.

- All primary bootloaders except the boot_ustar have 020 checks:
  http://nxr.netbsd.org/xref/src/sys/arch/x68k/stand/boot_ufs/boot.S?r=1.10#65
  but the boot_ustar (for boot floppy) doesn't due to size restriction,
  so -mc68000 was intentionally specified for it:
  http://mail-index.netbsd.org/source-changes/2001/10/01/0037.html

- However, the secondary boot doesn't have proper 68000 check (yet?):
  http://nxr.netbsd.org/xref/src/sys/arch/x68k/stand/boot/srt0.S?r=1.2#60

Nowadays all (aged) X680x0 geeks know it won't work on normal X68000,
so probably it's safe to remove it.
(I'm not sure if -mc68000 actually emits different code though)


Note a possible change in gcc 4.8 that causes this trouble is:
http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/config/m68k/m68k.c?annotate=173256#l482

I guess that gcc 4.5 passes only explicitly specified -m680x0
(which seems equivalent to -march=m680x0) options
(i.e. as(1) will use its default -mcpu), but gcc 4.8 always passes
both -march and -mcpu per the specified -m options to gcc(1)
(m68k_cpu_entry is always set?) so passing only -Wa,-m[c]680x0
on gcc 4.8 makes as(1) complain arch vs cpu mismatch.

That's the reason why passing both -march=m68030 and -mcpu=m68030
solves build failure on mvme68k 060 kernels with both gcc 4.5 and 4.8.

In this boot_ustar case, passing only -Wa,-mcpu=m68000 fails with gcc 4.5,
and passing only -Wa,-march=m68000 (or -Wa,-m68030) fails with gcc 4.8.

---
Izumi Tsutsui


Re: CVS commit: src/sys/arch/x68k/stand/boot_ustar

2014-04-15 Thread Dennis Ferguson

On 15 Apr, 2014, at 05:14 , Izumi Tsutsui tsut...@ceres.dti.ne.jp wrote:
 - NetBSD/x68k supports only X680x0 machines with MC68030 and higher
  processors.
 
 - Normal X68000 machines (i.e. all X680x0 except X68030) have MC68000,
  so 030 accelerators are required for the X68000 models, i.e.
  XVI, SUPER, EXPERT, PRO, and ACE.
 
  (BTW the normal X68030 has MC68EC030 so users also have to replace
   its CPU to with MC68030 to use NetBSD/x68k)
 
 - On the other hand, probably early x68k developers considered
  that some stupid users could try to boot NetBSD/x68k on X68000
  without 030 and bootloaders should have some sanity checks.

I'm pretty sure NetBSD could never run on a 68000 since the 68000
had no memory management unit.  The 68010 and 68020 didn't have memory
management units either, but Sun did proprietary MMUs for both (that's
sun2 and sun3, respectively) and I think other companies may have done
MMUs for the 68020.  The 68030 was the first CPU in the series to come
with an MMU built in.

That generic x68x requires a 68030 makes sense since that's the first
CPU where the code can count on knowing how the MMU works.  A 68020
would have a manufacturer-specific MMU, while for the 68010 there is
only sun2.  There is no reason to restrict the instruction set to
that of the 68000 in any case since NetBSD won't run on that.

I once had a 68000 board that ran a 4.3 BSD kernel, but it was a
4.3 BSD kernel with all the process scheduling hacked out so that
it ran exactly 1 compiled-in user space process, without memory
protection.  I used it as an ntp server.

Dennis Ferguson