NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-sparc/42192: cannot access floppy on SPARCstation 1+



>Synopsis:       cannot access floppy on SPARCstation 1+
>Fix:
> One possibility is around MI softint(9) changes after 4.0?

It looks sys/arch/sparc/sparc/bsd_fdintr.s still has
old MD softintr stuff so it should be updated to
newer MI softint(9) API.

sys/arch/sparc/sparc/amd7930intr.s has the same problem.

I've tried the following dumb patch but it causes a weird panic,
so maybe I hope someone[tm] who knows sparc asm take a look at this..

---
Index: dev/fd.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/dev/fd.c,v
retrieving revision 1.146
diff -u -r1.146 fd.c
--- dev/fd.c    25 May 2009 19:22:53 -0000      1.146
+++ dev/fd.c    18 Oct 2009 06:29:10 -0000
@@ -210,6 +210,7 @@
 };
 
 extern struct fdcio    *fdciop;        /* I/O descriptor used in fdintr.s */
+extern void            *fdc_sicookie;  /* si cookie used in fdintr.s */
 
 /* controller driver configuration */
 int    fdcmatch_mainbus(struct device *, struct cfdata *, void *);
@@ -651,6 +652,7 @@
                        fdc->sc_dev.dv_xname);
                return (-1);
        }
+       fdc_sicookie = fdc->sc_sicookie;
        printf(" softpri %d: chip 8207%c\n", IPL_SOFTFDC, code);
 
        evcnt_attach_dynamic(&fdc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
Index: sparc/bsd_fdintr.s
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/sparc/bsd_fdintr.s,v
retrieving revision 1.27
diff -u -r1.27 bsd_fdintr.s
--- sparc/bsd_fdintr.s  17 Oct 2007 19:57:14 -0000      1.27
+++ sparc/bsd_fdintr.s  18 Oct 2009 06:29:10 -0000
@@ -43,6 +43,7 @@
 #include <sparc/dev/fdreg.h>
 #include <sparc/dev/fdvar.h>
 
+#if 0
 #define FD_SET_SWINTR_4C                               \
        sethi   %hi(INTRREG_VA), %l5;                   \
        ldub    [%l5 + %lo(INTRREG_VA)], %l6;           \
@@ -72,6 +73,12 @@
        FD_SET_SWINTR_4M;                               \
 9:
 #endif
+#else
+#define FD_SET_SWINTR                                  \
+       sethi   %hi(_C_LABEL(fdc_sicookie)), %l5;       \
+       call    _C_LABEL(softint_schedule);             \
+        ld     [%l5 + %lo(_C_LABEL(fdc_sicookie))], %o0;
+#endif
 
 ! flip TC bit in auxreg
 ! assumes %l6 remains unchanged between ASSERT and DEASSERT
@@ -158,6 +165,9 @@
        .global _C_LABEL(fdciop)
 _C_LABEL(fdciop):
        .word   0
+       .global _C_LABEL(fdc_sicookie)
+_C_LABEL(fdc_sicookie):
+       .word   0
 
        .seg    "text"
        .align  4

---
NetBSD 5.99.20 (GENERIC) #97: Sun Oct 18 15:29:36 JST 2009
        tsutsui@mirage:/usr/src/sys/arch/sparc/compile/GENERIC
total memory = 65484 KB
avail memory = 59544 KB

 :

# dd if=/dev/rfd0a | tar ztvf -
drwxr-xr-x  2 root     wheel          0 Dec 16  2007 .
drwxr-xr-x  2 root     wheel          0 Dec 16  2007 ./bin
-r-xr-xr-x  1 root     wheel    2045616 Dec 16  2007 ./bin/cat
trap type 0x7: pc=0xf01472c0 npc=0xf01472c4 psr=0x4000c4<S,PS>
kernel: alignment fault trap
Stopped in pid 0.2 (system) at  netbsd:kpreempt_enable+0x8:     ld              
[
%g1 + 0x1bc], %g2
db> tr
kpreempt_enable(0xf36aad20, 0xf36aad20, 0x0, 0xba5e187d, 0x3e06748c, 0xb781dc6d)
 at netbsd:sched_curcpu_runnable_p+0x3c
sched_curcpu_runnable_p(0x0, 0x0, 0xc, 0x0, 0xffff, 0x400fe0) at netbsd:idle_loo
p+0x120
idle_loop(0xf36aad20, 0xf36aad20, 0xf03dd800, 0xf02ad400, 0x0, 0x897) at netbsd:
lwp_setfunc_trampoline
db> examine/i f01472bc
netbsd:kpreempt_enable+0x4:     sethi           %hi(0xf0002000), %g1
db> examine/i f01472c0
netbsd:kpreempt_enable+0x8:     ld              [%g1 + 0x1bc], %g2
db> examine/i f01472c4
netbsd:kpreempt_enable+0xc:     ld              [%g2 + 0x1f8], %g1
db> show reg
psr         0x4000c4
pc          0xf01472c0  kpreempt_enable+0x8
npc         0xf01472c4  kpreempt_enable+0xc
y           0
wim         0x10c6
g0          0
g1          0x4000c3
g2          0xf36aad20
g3          0xf0002000
g4          0xf36aad20
g5          0xffffffff
g6          0xf3a47000
g7          0
o0          0x1
o1          0xf02875b4  statintr_4
o2          0xf0002000
o3          0
o4          0
o5          0xb00
o6          0xf3a48e18
o7          0xf0008b4c  sparc_interrupt44c+0x130
l0          0xc5
l1          0xf013e560  sched_curcpu_runnable_p+0x44
l2          0xf013e564  sched_curcpu_runnable_p+0x48
l3          0xf4071600
l4          0
l5          0x1
l6          0xfe00e000
l7          0xf0398630  ppp_bsd_compress+0x44
i0          0xf36aad20
i1          0xf36aad20
i2          0
i3          0xba5e187d
i4          0x3e06748c
i5          0xb781dc6d
i6          0xf3a48e80
i7          0xf013e558  sched_curcpu_runnable_p+0x3c
netbsd:kpreempt_enable+0x8:     ld              [%g1 + 0x1bc], %g2
db> 

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index