Subject: port-sparc64/16816: Netra X1 panics with the kernel which includes rtc@ebus
To: None <gnats-bugs@gnats.netbsd.org>
From: None <t-nkyma@tcp-ip.or.jp>
List: netbsd-bugs
Date: 05/15/2002 03:32:32
>Number:         16816
>Category:       port-sparc64
>Synopsis:       Netra X1 panics with the kernel which includes rtc@ebus
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 14 11:33:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Takeshi Nakayama
>Release:        NetBSD 1.5ZC (2002-05-14)
>Organization:
none
>Environment:
System: NetBSD nyx 1.5ZC NetBSD 1.5ZC (NYX32) #83: Tue May 14 12:07:15 JST 2002
 takeshi@nyx:/usr/src/sys/arch/sparc64/compile/NYX32 sparc64
Architecture: sparc
Machine: sparc64
>Description:
	My Netra X1 panics as follows in boot time after the
	additon of rtc@ebus.

root on wd0d dumps on wd0b
root file system type: ffs
data fault: pc=1010fe8 addr=e003a000
kernel trap 6c: +fast data access protection
Stopped in pid 8 (init) at      comopen+0x1c8:  stba            %o5, [%o0 + 0x0]
 %asi
db> t
cnopen(0, 3, 2000, 133d6ce8, 11c4760, 1f59f00) at cnopen+0x9c
spec_open(180bb9c, 1f4b300, 1107120, 18, 1f59f00, 3) at spec_open+0x1a0
vn_open(0, 3, 0, ffffffff, 13c13cf0, 13bf2428) at vn_open+0x4ec
sys_open(0, 13c13dd8, 13c13dd0, 10fcd00, 2, 184fe10) at sys_open+0xa0
syscall(13c13ed0, 5, 0, 400, 0, 1) at syscall+0x28c
syscall_setup(55500, 2, 0, 0, 0, 0) at syscall_setup+0x130
db> 

>How-To-Repeat:
	Boot with the GENERIC kernel which includes rtc@ebus.

>Fix:
	It seems that write protection code for the rtc ports (ebus@70-71)
	also protects the console com0 ports (ebus@3f8-3ff).

	Netra X1's rtc has no IDPROM, so we do not need to protect
	the ports. So, applying the following patch fixes the
	problem (per sys/arch/sparc/dev/rtc.c).

Index: clock.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc64/sparc64/clock.c,v
retrieving revision 1.49
diff -u -d -u -r1.49 clock.c
--- clock.c	2002/03/20 18:54:49	1.49
+++ clock.c	2002/05/14 02:14:36
@@ -457,16 +457,12 @@
 	handle->todr_settime = rtc_settime;
 	handle->todr_getcal = rtc_getcal;
 	handle->todr_setcal = rtc_setcal;
-	handle->todr_setwen = NULL;
+	handle->todr_setwen = NULL; /* not necessary, no idprom to protect */
 	rtc->rtc_bt = bt;
 	rtc->rtc_bh = ci.ci_bh;
 	/* Our TOD clock year 0 is 1968 */
 	rtc->rtc_year0 = 1968;	/* XXX Really? */
 
-	/* Save info for the clock wenable call. */
-	ci.ci_bt = bt;
-	handle->bus_cookie = &ci;
-	handle->todr_setwen = clock_wenable;
 	todr_handle = handle;
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted: