Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-10]: src/sys/arch/next68k/stand/boot Pull up following revision(s...
details: https://anonhg.NetBSD.org/src/rev/1cce190fa483
branches: netbsd-10
changeset: 373479:1cce190fa483
user: martin <martin%NetBSD.org@localhost>
date: Sun Feb 12 12:18:24 2023 +0000
description:
Pull up following revision(s) (requested by tsutsui in ticket #78):
sys/arch/next68k/stand/boot/scsi.c: revision 1.11
sys/arch/next68k/stand/boot/sd.c: revision 1.13
sys/arch/next68k/stand/boot/scsi.c: revision 1.12
sys/arch/next68k/stand/boot/sd.c: revision 1.14
sys/arch/next68k/stand/boot/sd.c: revision 1.15
sys/arch/next68k/stand/boot/sd.c: revision 1.16
sys/arch/next68k/stand/boot/rtc.c: revision 1.7
sys/arch/next68k/stand/boot/dmareg.h: revision 1.4
sys/arch/next68k/stand/boot/machdep.c: revision 1.8
sys/arch/next68k/stand/boot/srt0.s: revision 1.3
sys/arch/next68k/stand/boot/README: revision 1.2
sys/arch/next68k/stand/boot/devopen.c: revision 1.7
sys/arch/next68k/stand/boot/Makefile: revision 1.30
sys/arch/next68k/stand/boot/Makefile: revision 1.31
sys/arch/next68k/stand/boot/version: revision 1.5
Remove trailing spaces and TABs.
Make sure to specify volatile explicitly on DMA register accesses.
It looks booting from SCSI disks on next68k have been broken
since NetBSD 1.6 days, but now it works.
Avoid possible division by zero trap in error cases to make debug easier.
Request only 36 bytes for a response of INQUIRY command for legacy drives.
Some drives don't respond larger requested size for newer
SCSI3 devices and not all drivers can handle short xfers.
We should fix drivers to handle such short xfers properly,
but we need only SCSI device type here (and the 36 bytes are
enough even if we want vendor and product names on a bootloader).
The problem is reported from Andreas Grabher (a maintainer of NeXT
Computer Emulator) on port-next68k@:
https://mail-index.netbsd.org/port-next68k/2023/02/thread1.html
Disable DEBUG options properly.
Bump version to 1.6 to denote recent bootloader's >20 years old bug fixes.
diffstat:
sys/arch/next68k/stand/boot/Makefile | 13 ++++++---
sys/arch/next68k/stand/boot/README | 4 +-
sys/arch/next68k/stand/boot/devopen.c | 18 +++++++-------
sys/arch/next68k/stand/boot/dmareg.h | 4 +-
sys/arch/next68k/stand/boot/machdep.c | 6 ++--
sys/arch/next68k/stand/boot/rtc.c | 12 ++++----
sys/arch/next68k/stand/boot/scsi.c | 45 +++++++++++++++++-----------------
sys/arch/next68k/stand/boot/sd.c | 29 ++++++++++++----------
sys/arch/next68k/stand/boot/srt0.s | 6 ++--
sys/arch/next68k/stand/boot/version | 3 +-
10 files changed, 73 insertions(+), 67 deletions(-)
diffs (truncated from 507 to 300 lines):
diff -r ee3f65b6c381 -r 1cce190fa483 sys/arch/next68k/stand/boot/Makefile
--- a/sys/arch/next68k/stand/boot/Makefile Sun Feb 12 11:48:56 2023 +0000
+++ b/sys/arch/next68k/stand/boot/Makefile Sun Feb 12 12:18:24 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2017/04/08 19:53:22 christos Exp $
+# $NetBSD: Makefile,v 1.29.44.1 2023/02/12 12:18:24 martin Exp $
NOMAN= # defined
@@ -23,11 +23,14 @@
RELOC= 4380000
# XXX make defs arch-indep.
-INCLUDES+= -I${.OBJDIR} -I${S}/arch -I${S} -I${S}/lib/libsa
-DEFS+= -D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP -DDEBUG -DSD_DEBUG -DSCSI_DEBUG # -DEN_DEBUG -DNETIF_DEBUG
-SAMISCCPPFLAGS= -DSUPPORT_DHCP -DSUPPORT_BOOTP -DSA_EXEC_ANYOWNER # -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG # -DNETIF_DEBUG -DNFS_DEBUG -DARP_DEBUG
+INCLUDES+= -I${.OBJDIR} -I${S}/arch -I${S} -I${S}/lib/libsa
+DEFS+= -D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP
+#DEFS+= -DDEBUG -DSD_DEBUG -DSCSI_DEBUG -DEN_DEBUG -DNETIF_DEBUG
+SAMISCCPPFLAGS= -DSUPPORT_DHCP -DSUPPORT_BOOTP -DSA_EXEC_ANYOWNER
+#SAMISCCPPFLAGS+= -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG-DNETIF_DEBUG
+#SAMISCCPPFLAGS+= -DNFS_DEBUG -DARP_DEBUG
WARNS=1
-CFLAGS+= -ffreestanding -nostdinc ${INCLUDES} ${DEFS}
+CFLAGS+= -ffreestanding -nostdinc ${INCLUDES} ${DEFS}
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
AFLAGS+= ${INCLUDES}
# XXX SHOULD NOT NEED TO DEFINE THESE!
diff -r ee3f65b6c381 -r 1cce190fa483 sys/arch/next68k/stand/boot/README
--- a/sys/arch/next68k/stand/boot/README Sun Feb 12 11:48:56 2023 +0000
+++ b/sys/arch/next68k/stand/boot/README Sun Feb 12 12:18:24 2023 +0000
@@ -1,9 +1,9 @@
-$NetBSD: README,v 1.1.1.1 1998/06/09 07:53:06 dbj Exp $
+$NetBSD: README,v 1.1.1.1.268.1 2023/02/12 12:18:24 martin Exp $
NeXT standalone bootblocks.
Rolf Grossmann, Dec 1994
-Started work based on files from hp300/stand. boot.c was from post-1.0
+Started work based on files from hp300/stand. boot.c was from post-1.0
sparc/stand/boot.c, modified to work for the needs of the NeXT PROM,
i.e. it wants to call the kernel, so the bootblock has to return the
entry point.
diff -r ee3f65b6c381 -r 1cce190fa483 sys/arch/next68k/stand/boot/devopen.c
--- a/sys/arch/next68k/stand/boot/devopen.c Sun Feb 12 11:48:56 2023 +0000
+++ b/sys/arch/next68k/stand/boot/devopen.c Sun Feb 12 12:18:24 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.6 2014/08/10 07:40:49 isaki Exp $ */
+/* $NetBSD: devopen.c,v 1.6.58.1 2023/02/12 12:18:24 martin Exp $ */
/*
* Copyright (c) 1994 Rolf Grossmann
* All rights reserved.
@@ -40,7 +40,7 @@
{
struct devsw *dp = devsw;
int i;
-
+
for (i = 0; i < ndevs; i++, dp++)
if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0)
return i;
@@ -68,7 +68,7 @@
{
int i;
const char *s, *args[3];
-
+
/* get device name */
for (s = fname; *s && *s != '/' && *s != '('; s++)
;
@@ -86,7 +86,7 @@
}
if (*s != ')')
goto baddev;
-
+
switch(i) {
case 3:
*count = atoi(args[0]);
@@ -108,9 +108,9 @@
/* no device present */
else
*file = (char *)fname; /* XXX discard const */
-
+
return 0;
-
+
baddev:
return ENXIO;
}
@@ -132,15 +132,15 @@
return error;
dp = &devsw[dev];
-
+
if ((void *)dp->dv_open == (void *)nodev)
return ENXIO;
f->f_dev = dp;
-
+
if ((error = (*dp->dv_open)(f, count, lun, part)) != 0)
printf("%s(%d,%d,%d): %d = %s\n", devsw[dev].dv_name,
count, lun, part, error, strerror(error));
return error;
-}
+}
diff -r ee3f65b6c381 -r 1cce190fa483 sys/arch/next68k/stand/boot/dmareg.h
--- a/sys/arch/next68k/stand/boot/dmareg.h Sun Feb 12 11:48:56 2023 +0000
+++ b/sys/arch/next68k/stand/boot/dmareg.h Sun Feb 12 12:18:24 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dmareg.h,v 1.3 2002/09/11 01:46:36 mycroft Exp $ */
+/* $NetBSD: dmareg.h,v 1.3.228.1 2023/02/12 12:18:24 martin Exp $ */
/*
* Copyright (c) 1997 Rolf Grossmann
* All rights reserved.
@@ -55,7 +55,7 @@
&~(DMA_ENDALIGNMENT-1))|0x80000000))
struct dma_dev { /* format of dma device registers */
- int dd_csr; /* control & status register */
+ volatile uint32_t dd_csr; /* control & status register */
char dd_pad[0x3fec]; /* csr not contiguous with next */
char *dd_saved_next; /* saved pointers for HW restart */
char *dd_saved_limit;
diff -r ee3f65b6c381 -r 1cce190fa483 sys/arch/next68k/stand/boot/machdep.c
--- a/sys/arch/next68k/stand/boot/machdep.c Sun Feb 12 11:48:56 2023 +0000
+++ b/sys/arch/next68k/stand/boot/machdep.c Sun Feb 12 12:18:24 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.7 2007/12/24 15:46:45 perry Exp $ */
+/* $NetBSD: machdep.c,v 1.7.128.1 2023/02/12 12:18:24 martin Exp $ */
/*
* Copyright (c) 1998 Darrin Jewell
* Copyright (c) 1994 Rolf Grossmann
@@ -117,10 +117,10 @@
printf("Got unexpected trap: format=%x vector=%x sr=%x pc=%x\n",
fp->fmt, fp->vec, fp->sr, fp->pc);
printf("dregs: %x %x %x %x %x %x %x %x\n",
- fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3],
+ fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3],
fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]);
printf("aregs: %x %x %x %x %x %x %x %x\n",
- fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3],
+ fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3],
fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]);
intrap = 0;
#ifdef DEBUG
diff -r ee3f65b6c381 -r 1cce190fa483 sys/arch/next68k/stand/boot/rtc.c
--- a/sys/arch/next68k/stand/boot/rtc.c Sun Feb 12 11:48:56 2023 +0000
+++ b/sys/arch/next68k/stand/boot/rtc.c Sun Feb 12 12:18:24 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtc.c,v 1.6 2009/01/12 11:32:44 tsutsui Exp $ */
+/* $NetBSD: rtc.c,v 1.6.96.1 2023/02/12 12:18:24 martin Exp $ */
/*
* Copyright (c) 1997 Rolf Grossmann
* All rights reserved.
@@ -51,7 +51,7 @@
int i;
u_int tmp;
u_char val;
-
+
*scr2 = (*scr2 & ~(SCR2_RTDATA | SCR2_RTCLK)) | SCR2_RTCE;
DELAY(1);
@@ -74,7 +74,7 @@
val = 0; /* should be anyway */
for (i=0; i<8; i++) {
val <<= 1;
-
+
tmp = *scr2 & ~(SCR2_RTDATA | SCR2_RTCLK);
*scr2 = tmp | SCR2_RTCLK;
@@ -96,7 +96,7 @@
rtc_init(void)
{
u_char val;
-
+
val = rtc_read(RTC_STATUS);
new_clock = (val & RTC_NEW_CLOCK) ? 1 : 0;
}
@@ -105,7 +105,7 @@
getsecs(void)
{
u_int secs;
-
+
if (new_clock) {
secs = rtc_read(RTC_CNTR0) << 24 |
rtc_read(RTC_CNTR1) << 16 |
@@ -124,6 +124,6 @@
BCD_DECODE(m) * 60 +
BCD_DECODE(s);
}
-
+
return secs;
}
diff -r ee3f65b6c381 -r 1cce190fa483 sys/arch/next68k/stand/boot/scsi.c
--- a/sys/arch/next68k/stand/boot/scsi.c Sun Feb 12 11:48:56 2023 +0000
+++ b/sys/arch/next68k/stand/boot/scsi.c Sun Feb 12 12:18:24 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsi.c,v 1.10 2008/03/30 16:28:08 he Exp $ */
+/* $NetBSD: scsi.c,v 1.10.122.1 2023/02/12 12:18:24 martin Exp $ */
/*
* Copyright (c) 1994, 1997 Rolf Grossmann
* All rights reserved.
@@ -61,7 +61,7 @@
#define NDPRINTF(x)
#define PRINTF(x)
/* printf x; */
-#ifdef xSCSI_DEBUG
+#ifdef SCSI_DEBUG
#define DPRINTF(x) printf x;
#else
#define DPRINTF(x)
@@ -77,7 +77,7 @@
dma = (struct dma_dev *)P_SCSI_CSR;
dma_buffer = DMA_ALIGN(char *, the_dma_buffer);
-
+
P_FLOPPY[FLP_CTRL] &= ~FLC_82077_SEL; /* select SCSI chip */
/* first reset DMA */
@@ -96,7 +96,7 @@
/* now reset the SCSI bus */
sr[NCR_CMD] = NCRCMD_RSTSCSI;
DELAY(4000000); /* XXX should be about 2-3 seconds at least */
-
+
/* then reset the SCSI chip again and initialize it properly */
sr[NCR_CMD] = NCRCMD_RSTCHIP;
sr[NCR_CMD] = NCRCMD_NOP;
@@ -125,7 +125,7 @@
short
scsi_getbyte(volatile uint8_t *sr)
{
- if ((sr[NCR_FFLAG] & NCRFIFO_FF) == 0)
+ if ((sr[NCR_FFLAG] & NCRFIFO_FF) == 0)
{
printf("getbyte: no data!\n");
return -1;
@@ -187,7 +187,7 @@
sr[NCR_FIFO] = cbuf[i];
sr[NCR_CMD] = NCRCMD_SELATN;
sc->sc_state = SCSI_SELECTING;
-
+
while(sc->sc_state != SCSI_DONE) {
if (scsi_wait_for_intr()) /* maybe we'd better use real intrs ? */
return EIO;
@@ -207,12 +207,12 @@
redo:
DPRINTF(("scsiicmd: regs[intr=%x, stat=%x, step=%x]\n",
sc->sc_intrstatus, sc->sc_status, sc->sc_seqstep));
-
+
if (sc->sc_intrstatus & NCRINTR_SBR) {
scsierror("scsi bus reset");
return EIO;
}
-
+
if ((sc->sc_status & NCRSTAT_GE)
|| (sc->sc_intrstatus & NCRINTR_ILL)) {
scsierror("software error");
@@ -227,12 +227,12 @@
switch(sc->sc_state)
{
case SCSI_SELECTING:
- if (sc->sc_intrstatus & NCRINTR_DIS)
+ if (sc->sc_intrstatus & NCRINTR_DIS)
{
sc->sc_state = SCSI_IDLE;
return EUNIT; /* device not present */
}
-
+
#define NCRINTR_DONE (NCRINTR_BS | NCRINTR_FC)
if ((sc->sc_intrstatus & NCRINTR_DONE) != NCRINTR_DONE)
{
@@ -310,7 +310,7 @@
sc->sc_state = SCSI_IDLE;
return -sc->sc_result;
}
-
+
int
scsi_msgin(void)
{
@@ -340,11 +340,10 @@
{
volatile uint8_t *sr;
struct dma_dev *dma;
Home |
Main Index |
Thread Index |
Old Index