Port-m68k archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: badaddr() panics when TT is enabled
isaki@ wrote:
> Thank you for your quick response!
> Would you also try a case where badaddr() fires in TT area?
> I don't know well about NEWS but how about this?
>
> --- a/sys/arch/news68k/conf/GENERIC
> +++ b/sys/arch/news68k/conf/GENERIC
> @@ -196,7 +196,8 @@ zstty1 at zsc0 channel 1
> # and disable disconnect/reselect for targets 0-3
> #
> si0 at hb0 addr 0xe0cc0000 ipl 4 flags 0x0
> -scsibus* at si0
> +si1 at hb0 addr 0xe0c40000 ipl 4 flags 0x0
> +scsibus* at si?
>
> sd* at scsibus? target ? lun ? # SCSI disks
> st* at scsibus? target ? lun ? # SCSI tapes
>
> If NEWS hardware returns a bus error where device is not present,
> the patched kernel will boot (without si1).
It boots but si1 is also attached, i.e. looks no bus error.
---
[ 1.0000000] si0 at hb0 addr 0xe0cc0000 ipl 4
[ 1.0000000] scsibus0 at si0: 8 targets, 8 luns per target
[ 1.0000000] si1 at hb0 addr 0xe0c40000 ipl 4
[ 1.0000000] scsibus1 at si1: 8 targets, 8 luns per target
[ 1.0300030] scsibus0: waiting 2 seconds for devices to settle...
[ 1.0400030] scsibus1: waiting 2 seconds for devices to settle...
[ 1.2000030] WARNING: system needs entropy for security; see entropy(7)
[ 3.0500030] sd0 at scsibus0 target 0 lun 0: <MELCO, DSC-UE8.3G, 1.05> disk fixed
[ 3.0900030] sd0: 8010 MB, 18988 cyl, 8 head, 108 sec, 512 bytes/sect x 16405632 sectors
[ 3.1200030] sd0: async, 8-bit transfers
[ 6.2700030] st0 at scsibus0 target 5 lun 0: <WANGTEK, SCSI-36, A> tape removable
[ 6.3000030] st0: drive empty
[ 6.3200030] st0: async, 8-bit transfers
[ 7.3200030] si1: reselect, BSY stuck, bus=0xff
[ 7.6400030] si1: reselect, BSY stuck, bus=0xff
[ 7.7500030] si1: select found SCSI bus busy, resetting...
:
---
According to "md" command outputs on PROM monitor, whole 0xeXXXXXXX
region doesn't cause bus error, but at least 0xf0000000 does.
---
NEWS> md e0cc0000
e0cc0000: 00 00 00 00 00 08 00 00 |........|
NEWS> md e0c40000
e0c40000: ff ff ff ff ff ff ff ff |........|
NEWS> md e0000000
e0000000: e0 d8 07 f8 e0 00 01 00 |........|
NEWS> md e1000000
e1000000: ff ff ff ff ff ff ff ff |........|
NEWS> md e2000000
e2000000: e0 d8 07 f8 e0 00 01 00 |........|
NEWS> md e3000000
e3000000: ff ff ff ff ff ff ff ff |........|
NEWS> md e3ff0000
e3ff0000: f0 fd f2 f9 f3 fd f9 f3 |........|
NEWS> md efff0000
efff0000: f0 fd f2 f9 f3 fd f9 f3 |........|
NEWS> md f0000000
f0000000: Bus error pc = e0006af4
NEWS>
---
With the following config:
---
si1 at hb0 addr 0xf0000000 ipl 4 flags 0x0
scsibus* at si1
---
si1 is not probed as excpected, so a bus error is detected properly.
---
NEWS> bo /2 hd()netbsd.buserr
NetBSD/news68k Primary Boot
NetBSD/news68k Secondary Boot, Revision 1.8 (Thu Aug 4 15:30:37 UTC 2022) (from NetBSD 9.3)
Booting hd(0,0,0)netbsd.buserr
3066668+104572 [236544+223920]=0x376e30
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[ 1.0000000] 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[ 1.0000000] 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023
[ 1.0000000] The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.
[ 1.0000000] NetBSD 10.99.3 (BUSERR) #1: Sat Apr 15 16:51:37 JST 2023
[ 1.0000000] tsutsui@mirage:/s/cvs/src/sys/arch/news68k/compile/BUSERR
[ 1.0000000] SONY NET WORK STATION, Model NWS-1750, Machine ID #10557
:
[ 1.0000000] zsc0 at hb0 addr 0xe0d40000 ipl 5 vect 64
[ 1.0000000] zstty0 at zsc0 channel 0 (console i/o)
[ 1.0000000] zstty1 at zsc0 channel 1
[ 1.0000000] si0 at hb0 addr 0xe0cc0000 ipl 4
[ 1.0000000] scsibus0 at si0: 8 targets, 8 luns per target
[ 1.0300030] scsibus0: waiting 2 seconds for devices to settle...
[ 1.1900030] WARNING: system needs entropy for security; see entropy(7)
[ 3.0500030] sd0 at scsibus0 target 0 lun 0: <MELCO, DSC-UE8.3G, 1.05> disk fixed
[ 3.0900030] sd0: 8010 MB, 18988 cyl, 8 head, 108 sec, 512 bytes/sect x 16405632 sectors
[ 3.1200030] sd0: async, 8-bit transfers
:
[ 7.1300030] boot device: sd0
[ 7.1700030] root on sd0a dumps on sd0b
[ 7.2600030] root file system type: ffs
[ 7.2800030] kern.module.path=/stand/news68k/10.99.3/modules
Enter pathname of shell or RETURN for /bin/sh:
We recommend that you create a non-root account and use su(1) for root access.
# mount -r /usr
# config -x /netbsd.buserr
### START CONFIG FILE "BUSERR"
# $NetBSD: GENERIC,v 1.141 2023/02/12 14:50:40 abs Exp $
#
# GENERIC machine description file
:
# For example: "flags 0x1000f" would disable DMA interrupts,
# and disable disconnect/reselect for targets 0-3
#
si0 at hb0 addr 0xe0cc0000 ipl 4 flags 0x0
scsibus* at si0
si1 at hb0 addr 0xf0000000 ipl 4 flags 0x0
scsibus* at si1
sd* at scsibus? target ? lun ? # SCSI disks
---
However, this means we should implememnt some proper probe routine
for nono emulator that doesn't have si(4) SCSI. Umm.
> > > Lbe10a:
> > > - ptestr %d0,%a0@,#7 | do a table search
> > > + ptestr %d0,%a0@,#0 | check without table search
> >
> > I prefer a comment like "check entire the ATC" per UM 9.7.4.
>
> Hmm, I don't see your point.
> This ptestr is not intended to check the entire ATC.
> It is intended to detect that the address %a0@ is located in TT
> area (and in that case, it's not necessary to do neither a table
> search nor an ATC check).
Just because MC68030 USER'S MANUAL 9.7.4 says:
>> The PTEST instruction searches either the ATC (PTEST with level 0) or
>> the translation tables (PTEST with levels of 1-7) to determine status
>> information about the translation of a specified logical address.
(Ah, I misread "either" as "entire")
I.e.
PTEST with level 0: searches the ATC
PTEST with levels of 1-7: searches the translation tables
..to determine status information about the translation
I guess "PTEST, level 0" is more explicit, per Table 9-3 ?
> > > + pmove %psr,%sp@
> >
> > Put "save result" comment as the existing #7 check?
>
> This pmove is not intended to save the result. It only loads
> %psr to %d1 via stack due to addressing mode restriction.
> By the way, I'm not sure whether the comment "save result" at
> ptestr #7 is still correct today... Just a quick look, I could
> not find who use this saved %psr in the stack.
Maybe it implies "pmove instruction cannot take registers as destination"?
> I will left it as is this time.
Ok for me.
> > > + movw %sp@,%d1
> > > + btst #6,%d1 | TT?
> >
> > Also prefer "transparent (TT0 or TT1)?" or so per UM Table 9-3.
>
> I will do so.
Thanks.
> > How about enabling enabling badaddr() in spc_mainbus_match()
> > and specify the second SPC on LUNA-I?
> > (I should check it myself but I'm a bit lazy)
>
> (You looks to have resolved it by yourself but just for recording.)
> Unfortunately, it's not possible to find spc0 and spc1 correctly
> by only using current spc_mainbus_match() on LUNA due to its hard-
> ware characteristics.
As you pointed out actually it doesn't cause bus error.
I'll add a machtype check and cleanup maimbus_attach_args later.
Index: sys/arch/luna68k/dev/spc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/luna68k/dev/spc.c,v
retrieving revision 1.10
diff -u -p -d -r1.10 spc.c
--- sys/arch/luna68k/dev/spc.c 22 Jan 2013 15:44:25 -0000 1.10
+++ sys/arch/luna68k/dev/spc.c 15 Apr 2023 08:11:25 -0000
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.10
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/autoconf.h>
+#include <machine/board.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
@@ -66,11 +67,17 @@ spc_mainbus_match(device_t parent, cfdat
if (strcmp(ma->ma_name, spc_cd.cd_name))
return 0;
-#if 0
- if (badaddr((void *)ma->ma_addr, 4))
+
+ /*
+ * LUNA-I doesn't have the secondary SCSI.
+ * However we cannot check it by badaddr() at the address range
+ * of the secondary SCSI on LUNA-II because the address bus lines
+ * are not fully decoded on LUNA-I and the primary SCSI registers
+ * are also accessible at the seconadary address range.
+ */
+ if (machtype == LUNA_I && ma->ma_addr != SCSI_ADDR)
return 0;
- /* Experiments proved 2nd SPC address does NOT make a buserror. */
-#endif
+
return 1;
}
Index: sys/arch/luna68k/luna68k/mainbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/luna68k/luna68k/mainbus.c,v
retrieving revision 1.20
diff -u -p -d -r1.20 mainbus.c
--- sys/arch/luna68k/luna68k/mainbus.c 13 Apr 2023 11:44:10 -0000 1.20
+++ sys/arch/luna68k/luna68k/mainbus.c 15 Apr 2023 08:11:25 -0000
@@ -39,26 +39,17 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v
#include <machine/cpu.h>
#include <machine/autoconf.h>
+#include <machine/board.h>
static const struct mainbus_attach_args luna_devs[] = {
- { "clock", 0x45000000, -1 }, /* Mostek TimeKeeper */
- { "lcd", 0x4d000000, -1 }, /* Sharp LM16X212 LCD module */
- { "le", 0xf1000000, 3 }, /* Am7990 */
- { "sio", 0x51000000, 6 }, /* uPD7201A */
- { "xpbus", 0x71000000, -1 }, /* HD647180XP */
- { "fb", 0xc1100000, -1 }, /* BrookTree RAMDAC */
- { "spc", 0xe1000000, 2 }, /* MB89352 */
-};
-
-static const struct mainbus_attach_args luna2_devs[] = {
- { "clock", 0x45000000, -1 }, /* Dallas TimeKeeper */
- { "lcd", 0x4d000000, -1 }, /* Sharp LM16X212 LCD module */
- { "le", 0xf1000000, 3 }, /* Am7990 */
- { "sio", 0x51000000, 6 }, /* uPD7201A */
- { "xpbus", 0x71000000, -1 }, /* HD647180XP */
+ { "clock", NVRAM_ADDR, -1 }, /* Mostek/Dallas TimeKeeper */
+ { "lcd", OBIO_PIO1A, -1 }, /* Sharp LM16X212 LCD module */
+ { "le", LANCE_ADDR, 3 }, /* Am7990 */
+ { "sio", OBIO_SIO, 6 }, /* uPD7201A */
+ { "xpbus", TRI_PORT_RAM, -1 }, /* HD647180XP */
{ "fb", 0xc1100000, -1 }, /* BrookTree RAMDAC */
- { "spc", 0xe1000000, 2 }, /* internal MB89352 */
- { "spc", 0xe1000040, 2 }, /* external MB89352 */
+ { "spc", SCSI_ADDR, 2 }, /* internal MB89352 */
+ { "spc", SCSI_2_ADDR, 2 }, /* external MB89352 (on LUNA-II) */
};
static void mainbus_attach(device_t, device_t, void *);
@@ -87,13 +78,9 @@ mainbus_attach(device_t parent, device_t
const struct mainbus_attach_args *devs;
struct mainbus_attach_args ma;
- if (machtype == LUNA_II) {
- devs = luna2_devs;
- ndevs = __arraycount(luna2_devs);
- } else {
- devs = luna_devs;
- ndevs = __arraycount(luna_devs);
- }
+ devs = luna_devs;
+ ndevs = __arraycount(luna_devs);
+
aprint_normal("\n");
for (i = 0; i < ndevs; i++) {
ma = devs[i];
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index