ata dma problems with recent -CURRENT

Dag-ErlingSmørgrav des at des.no
Wed Oct 1 06:13:27 PDT 2003


I recently installed 5.1-RELEASE on an Ultra 5, and proceeded to
upgrade it to -CURRENT (sources from about two days ago).  The IDE
controller doesn't seem to support DMA; in 5.1-RELEASE, the ata driver
would time out a couple of times, then decide to fall back to PIO3.
However, with -CURRENT, the ata driver panics trying to dereference
0xdeadc0de:

ad0: FAILURE - READ_DMA status=1<ERROR> error=0 dma=0xff
panic: trap: memory address not aligned
Debugger("panic")
Stopped at      Debugger+0x1c:  ta              %xcc, 1
db> where
panic() at panic+0xf0
trap() at trap+0x394
-- memory address not aligned sfar=0xdedeadc0de sfsr=0x40029 %o7=0xc0040d54 --
ata_timeout() at ata_timeout+0x20
softclock() at softclock+0x1a0
ithread_loop() at ithread_loop+0x1a8
fork_exit() at fork_exit+0x9c
fork_trampoline() at fork_trampoline+0x8

I've attached an excerpt from the serial console log, showing both the
panic and a successful boot of the same kernel (with hw.ata.ata_dma
disabled in loader.conf).  I've also attached a disassembly of
ata_timeout(); unfortunately, I couldn't get objdump to show source
code line numbers.  However, I *think* the trap occurred on the
following line:

    if (request->device->channel->running == NULL) {

and if I read the assembler code correctly, it is request->device
which is 0xdeadc0de.

DES
-- 
Dag-Erling Smørgrav - des at des.no

-------------- next part --------------
Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 270MHz), Keyboard Present
OpenBoot 3.11, 128 MB memory installed, Serial #10251117.
Ethernet address 8:0:20:9c:6b:6d, Host ID: 809c6b6d.



Rebooting with command: boot /pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a
Boot device: /pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a  File and args: 
 
>> FreeBSD/sparc64 boot block
   Boot path:   /pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a
   Boot loader: /boot/loader
Console: OpenFirmware console

FreeBSD/sparc64 bootstrap loader, Revision 1.0
(des at ultra.des.no, Tue Sep 30 19:26:54 CEST 2003)
bootpath="/pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a"
Loading /boot/defaults/loader.conf 
/boot/ultra/kernel data=0x217c08+0x47568 syms=[0x8+0x3edd8+0x8+0x32803]

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/ultra/kernel] in 9 seconds... 

Type '?' for a list of commands, 'help' for more detailed help.
OK set hw.ata.ata_dma="1"
OK boot -s
nothing to autoload yet.
jumping to kernel entry at 0xc0038000.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD 5.1-CURRENT #3: Wed Oct  1 12:58:34 CEST 2003
    des at ultra.des.no:/usr/src/sys/sparc64/compile/ultra
Preloaded elf kernel "/boot/ultra/kernel" at 0xc02d4000.
Timecounter "tick" frequency 269840937 Hz quality 0
real memory  = 134217728 (128 MB)
avail memory = 117710848 (112 MB)
cpu0: Sun Microsystems UltraSparc-IIi Processor (269.84 MHz CPU)
nexus0: <OpenFirmware Nexus device>
pcib0: <U2P UPA-PCI bridge> on nexus0
pcib0: Sabre, impl 0, version 0, ign 0x7c0, bus A
pcib0: [FAST]
pcib0: [FAST]
DVMA map: 0xc0000000 to 0xc3ffffff
pci0: <OFW PCI bus> on pcib0
pcib1: <APB PCI-PCI bridge> at device 1.1 on pci0
pci1: <OFW PCI bus> on pcib1
ebus0: revision 0x01
ebus0: <PCI-EBus2 bridge> mem 0xf1000000-0xf17fffff,0xf0000000-0xf0ffffff at dev
ice 1.0 on pci1
ebus0: <auxio> addr 0x140072f000-0x140072f003,0x140072c000-0x140072c003,0x140072
a000-0x140072a003,0x1400728000-0x1400728003,0x1400726000-0x1400726003 (no driver
 attached)
ebus0: <power> addr 0x1400724000-0x1400724003 irq 37 (no driver attached)
ebus0: <SUNW,pll> addr 0x1400504000-0x1400504002 (no driver attached)
sab0: <Siemens SAB 82532 v3.2> addr 0x1400400000-0x140040007f irq 43 on ebus0
sab0: [FAST]
sabtty0: <ttya> on sab0
sabtty1: <ttyb> on sab0
sabtty1: console 9600,8,n,1,-
ebus0: <su> addr 0x14003083f8-0x14003083ff irq 41 (no driver attached)
ebus0: <su> addr 0x14003062f8-0x14003062ff irq 42 (no driver attached)
ebus0: <ecpp> addr 0x1400700000-0x140070000f,0x140030015c-0x140030015d,0x1400304
3bc-0x14003043cb irq 34 (no driver attached)
ebus0: <fdthree> addr 0x1400720000-0x1400720003,0x1400706000-0x140070600f,0x1400
3023f0-0x14003023f7 irq 39 (no driver attached)
eeprom0: <EBus EEPROM/clock> addr 0x1400000000-0x1400001fff on ebus0
eeprom0: model mk48t59
eeprom0: hostid 809c6b6d
ebus0: <flashprom> addr 0x1000000000-0x10000fffff (no driver attached)
ebus0: <SUNW,CS4231> addr 0x1400722000-0x1400722003,0x1400704000-0x140070400f,0x
1400702000-0x140070200f,0x1400200000-0x14002000ff irq 36,35 (no driver attached)
hme0: <Sun HME 10/100 Ethernet> mem 0xe0000000-0xe0007fff at device 1.1 on pci1
hme0: Ethernet address: 08:00:20:9c:6b:6d
miibus0: <MII bus> on hme0
nsphy0: <DP83840 10/100 media interface> on miibus0
nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
pci1: <display, VGA> at device 2.0 (no driver attached)
atapci0: <CMD 646 WDMA2 controller> port 0xc00020-0xc0002f,0xc00018-0xc0001b,0xc
00010-0xc00017,0xc00008-0xc0000b,0xc00000-0xc00007 at device 3.0 on pci1
atapci0: [MPSAFE]
ata2: at 0xc00000 on atapci0
ata2: [MPSAFE]
ata3: at 0xc00010 on atapci0
ata3: [MPSAFE]
pcib2: <APB PCI-PCI bridge> at device 1.0 on pci0
pci2: <OFW PCI bus> on pcib2
Timecounters tick every 10.000 msec
GEOM: create disk ad0 dp=0xfffff8000076a8c0
ad0: 9641MB <IBM-DTTA-371010> [19590/16/63] at ata2-master WDMA2
acd0: CDROM <CD-ROM CDU311-Q> at ata3-master PIO3
ad0: FAILURE - READ_DMA status=1<ERROR> error=0 dma=0xff
panic: trap: memory address not aligned
Debugger("panic")
Stopped at      Debugger+0x1c:  ta              %xcc, 1
db> where
panic() at panic+0xf0
trap() at trap+0x394
-- memory address not aligned sfar=0xdedeadc0de sfsr=0x40029 %o7=0xc0040d54 --
ata_timeout() at ata_timeout+0x20
softclock() at softclock+0x1a0
ithread_loop() at ithread_loop+0x1a8
fork_exit() at fork_exit+0x9c
fork_trampoline() at fork_trampoline+0x8
db> call cpu_reset
Resetting ... 


Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 270MHz), Keyboard Present
OpenBoot 3.11, 128 MB memory installed, Serial #10251117.
Ethernet address 8:0:20:9c:6b:6d, Host ID: 809c6b6d.



Rebooting with command: boot /pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a
Boot device: /pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a  File and args: 
 
>> FreeBSD/sparc64 boot block
   Boot path:   /pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a
   Boot loader: /boot/loader
Console: OpenFirmware console

FreeBSD/sparc64 bootstrap loader, Revision 1.0
(des at ultra.des.no, Tue Sep 30 19:26:54 CEST 2003)
bootpath="/pci at 1f,0/pci at 1,1/ide at 3/disk at 0,0:a"
Loading /boot/defaults/loader.conf 
/boot/ultra/kernel data=0x217c08+0x47568 syms=[0x8+0x3edd8+0x8+0x32803]

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/ultra/kernel]...
nothing to autoload yet.
jumping to kernel entry at 0xc0038000.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD 5.1-CURRENT #3: Wed Oct  1 12:58:34 CEST 2003
    des at ultra.des.no:/usr/src/sys/sparc64/compile/ultra
Preloaded elf kernel "/boot/ultra/kernel" at 0xc02d4000.
Timecounter "tick" frequency 269840937 Hz quality 0
real memory  = 134217728 (128 MB)
avail memory = 117710848 (112 MB)
cpu0: Sun Microsystems UltraSparc-IIi Processor (269.84 MHz CPU)
nexus0: <OpenFirmware Nexus device>
pcib0: <U2P UPA-PCI bridge> on nexus0
pcib0: Sabre, impl 0, version 0, ign 0x7c0, bus A
pcib0: [FAST]
pcib0: [FAST]
DVMA map: 0xc0000000 to 0xc3ffffff
pci0: <OFW PCI bus> on pcib0
pcib1: <APB PCI-PCI bridge> at device 1.1 on pci0
pci1: <OFW PCI bus> on pcib1
ebus0: revision 0x01
ebus0: <PCI-EBus2 bridge> mem 0xf1000000-0xf17fffff,0xf0000000-0xf0ffffff at dev
ice 1.0 on pci1
ebus0: <auxio> addr 0x140072f000-0x140072f003,0x140072c000-0x140072c003,0x140072
a000-0x140072a003,0x1400728000-0x1400728003,0x1400726000-0x1400726003 (no driver
 attached)
ebus0: <power> addr 0x1400724000-0x1400724003 irq 37 (no driver attached)
ebus0: <SUNW,pll> addr 0x1400504000-0x1400504002 (no driver attached)
sab0: <Siemens SAB 82532 v3.2> addr 0x1400400000-0x140040007f irq 43 on ebus0
sab0: [FAST]
sabtty0: <ttya> on sab0
sabtty1: <ttyb> on sab0
sabtty1: console 9600,8,n,1,-
ebus0: <su> addr 0x14003083f8-0x14003083ff irq 41 (no driver attached)
ebus0: <su> addr 0x14003062f8-0x14003062ff irq 42 (no driver attached)
ebus0: <ecpp> addr 0x1400700000-0x140070000f,0x140030015c-0x140030015d,0x1400304
3bc-0x14003043cb irq 34 (no driver attached)
ebus0: <fdthree> addr 0x1400720000-0x1400720003,0x1400706000-0x140070600f,0x1400
3023f0-0x14003023f7 irq 39 (no driver attached)
eeprom0: <EBus EEPROM/clock> addr 0x1400000000-0x1400001fff on ebus0
eeprom0: model mk48t59
eeprom0: hostid 809c6b6d
ebus0: <flashprom> addr 0x1000000000-0x10000fffff (no driver attached)
ebus0: <SUNW,CS4231> addr 0x1400722000-0x1400722003,0x1400704000-0x140070400f,0x
1400702000-0x140070200f,0x1400200000-0x14002000ff irq 36,35 (no driver attached)
hme0: <Sun HME 10/100 Ethernet> mem 0xe0000000-0xe0007fff at device 1.1 on pci1
hme0: Ethernet address: 08:00:20:9c:6b:6d
miibus0: <MII bus> on hme0
nsphy0: <DP83840 10/100 media interface> on miibus0
nsphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
pci1: <display, VGA> at device 2.0 (no driver attached)
atapci0: <CMD 646 WDMA2 controller> port 0xc00020-0xc0002f,0xc00018-0xc0001b,0xc
00010-0xc00017,0xc00008-0xc0000b,0xc00000-0xc00007 at device 3.0 on pci1
atapci0: [MPSAFE]
ata2: at 0xc00000 on atapci0
ata2: [MPSAFE]
ata3: at 0xc00010 on atapci0
ata3: [MPSAFE]
pcib2: <APB PCI-PCI bridge> at device 1.0 on pci0
pci2: <OFW PCI bus> on pcib2
Timecounters tick every 10.000 msec
GEOM: create disk ad0 dp=0xfffff8000076a8c0
ad0: 9641MB <IBM-DTTA-371010> [19590/16/63] at ata2-master PIO4
acd0: CDROM <CD-ROM CDU311-Q> at ata3-master PIO3
Mounting root from ufs:/dev/ad0a
Loading configuration files.
Entropy harvesting: interrupts ethernet point_to_point.
swapon: adding /dev/ad0b as swap device
Starting file system checks:
/dev/ad0a: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0a: clean, 68918 free (278 frags, 8580 blocks, 0.2% fragmentation)
/dev/ad0d: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0d: clean, 127056 free (24 frags, 15879 blocks, 0.0% fragmentation)
/dev/ad0f: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0f: clean, 3539005 free (7293 frags, 441464 blocks, 0.2% fragmentation)
/dev/ad0e: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ad0e: clean, 126708 free (68 frags, 15830 blocks, 0.1% fragmentation)
Setting hostname: ultra.des.no.
hme0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	inet 192.168.0.183 netmask 0xffffff00 broadcast 192.168.0.255
	inet6 fe80::a00:20ff:fe9c:6b6d%hme0 prefixlen 64 tentative scopeid 0x1 
	ether 08:00:20:9c:6b:6d
	media: Ethernet autoselect (100baseTX)
	status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	inet6 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
	inet 127.0.0.1 netmask 0xff000000 
add net default: gateway 192.168.0.1
Additional routing options:.
hw.bus.devctl_disable: 0 -> 1
Mounting NFS file systems:.
Starting syslogd.
Oct  1 14:43:57 ultra syslogd: kernel boot file is /boot/ultra/kernel
Starting ntpdate.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib
Starting local daemons:.
Updating motd.
Starting ntpd.
Starting sshd.
Initial sparc64 initialization:.
Additional ABI support:.
Starting cron.
Local package initialization:.
Local package initialization:.
Additional TCP options:.
Additional TCP options:.
route: writing to routing socket: File exists
add net default: gateway 192.168.0.1: File exists
Additional routing options:.
Starting background file system checks in 60 seconds.

Wed Oct  1 14:44:07 CEST 2003

FreeBSD/sparc64 (ultra.des.no) (ttyb)

login: 
-------------- next part --------------
0000000000001060 <ata_timeout>:
ata_timeout():
    1060:       9d e3 bf 40     save  %sp, -192, %sp
    1064:       c0 76 20 58     clrx  [ %i0 + 0x58 ]
    1068:       c2 5e 00 00     ldx  [ %i0 ], %g1
    106c:       d0 58 40 00     ldx  [ %g1 ], %o0
    1070:       c2 5a 21 30     ldx  [ %o0 + 0x130 ], %g1
    1074:       9f c0 40 00     call  %g1
    1078:       01 00 00 00     nop
    107c:       c2 5e 00 00     ldx  [ %i0 ], %g1
    1080:       c2 58 40 00     ldx  [ %g1 ], %g1
    1084:       c2 58 62 80     ldx  [ %g1 + 0x280 ], %g1
    1088:       0a c8 40 0f     brnz  %g1, 10c4 <ata_timeout+0x64>
    108c:       c2 06 20 40     ld  [ %i0 + 0x40 ], %g1
    1090:       82 08 60 20     and  %g1, 0x20, %g1
    1094:       80 a0 60 00     cmp  %g1, 0
    1098:       12 48 00 46     bne  %icc, 11b0 <ata_timeout+0x150>
    109c:       01 00 00 00     nop
    10a0:       40 00 00 00     call  10a0 <ata_timeout+0x40>
                        10a0: R_SPARC_WDISP30   ata_cmd2str
    10a4:       90 10 00 18     mov  %i0, %o0
    10a8:       94 10 00 08     mov  %o0, %o2
    10ac:       d0 5e 00 00     ldx  [ %i0 ], %o0
    10b0:       13 00 00 00     sethi  %hi(0), %o1
                        10b0: R_SPARC_HI22      .rodata.str1.8+0x278
    10b4:       40 00 00 00     call  10b4 <ata_timeout+0x54>
                        10b4: R_SPARC_WDISP30   ata_prtdev
    10b8:       92 12 60 00     mov  %o1, %o1   ! 0 <ata_alloc_request-0x800>
                        10b8: R_SPARC_LO10      .rodata.str1.8+0x278
    10bc:       10 68 00 3d     b  %xcc, 11b0 <ata_timeout+0x150>
    10c0:       01 00 00 00     nop
    10c4:       82 08 60 40     and  %g1, 0x40, %g1
    10c8:       80 a0 60 00     cmp  %g1, 0
    10cc:       02 48 00 09     be  %icc, 10f0 <ata_timeout+0x90>
    10d0:       c2 5e 00 00     ldx  [ %i0 ], %g1
    10d4:       d0 58 40 00     ldx  [ %g1 ], %o0
    10d8:       c2 5a 21 38     ldx  [ %o0 + 0x138 ], %g1
    10dc:       c2 58 60 68     ldx  [ %g1 + 0x68 ], %g1
    10e0:       9f c0 40 00     call  %g1
    10e4:       01 00 00 00     nop
    10e8:       d0 2e 20 2a     stb  %o0, [ %i0 + 0x2a ]
    10ec:       c2 5e 00 00     ldx  [ %i0 ], %g1
    10f0:       40 00 00 00     call  10f0 <ata_timeout+0x90>
                        10f0: R_SPARC_WDISP30   ata_reinit
    10f4:       d0 58 40 00     ldx  [ %g1 ], %o0
    10f8:       c2 06 20 50     ld  [ %i0 + 0x50 ], %g1
    10fc:       84 10 00 01     mov  %g1, %g2
    1100:       82 00 7f ff     add  %g1, -1, %g1
    1104:       80 a0 a0 00     cmp  %g2, 0
    1108:       04 40 00 1e     ble,pn   %icc, 1180 <ata_timeout+0x120>
    110c:       c2 26 20 50     st  %g1, [ %i0 + 0x50 ]
    1110:       c2 06 20 40     ld  [ %i0 + 0x40 ], %g1
    1114:       82 08 60 20     and  %g1, 0x20, %g1
    1118:       80 a0 60 00     cmp  %g1, 0
    111c:       32 48 00 12     bne,a   %icc, 1164 <ata_timeout+0x104>
    1120:       c2 06 20 40     ld  [ %i0 + 0x40 ], %g1
    1124:       40 00 00 00     call  1124 <ata_timeout+0xc4>
                        1124: R_SPARC_WDISP30   ata_cmd2str
    1128:       90 10 00 18     mov  %i0, %o0
    112c:       94 10 00 08     mov  %o0, %o2
    1130:       c4 06 20 50     ld  [ %i0 + 0x50 ], %g2
    1134:       97 38 a0 00     sra  %g2, 0, %o3
    1138:       03 00 00 00     sethi  %hi(0), %g1
                        1138: R_SPARC_HI22      .rodata.str1.8+0x2a8
    113c:       80 a0 a0 01     cmp  %g2, 1
    1140:       02 40 00 04     be,pn   %icc, 1150 <ata_timeout+0xf0>
    1144:       98 10 60 00     mov  %g1, %o4
                        1144: R_SPARC_LO10      .rodata.str1.8+0x2a8
    1148:       03 00 00 00     sethi  %hi(0), %g1
                        1148: R_SPARC_HI22      .rodata.str1.8+0x2b0
    114c:       98 10 60 00     mov  %g1, %o4   ! 0 <ata_alloc_request-0x800>
                        114c: R_SPARC_LO10      .rodata.str1.8+0x2b0
    1150:       d0 5e 00 00     ldx  [ %i0 ], %o0
    1154:       13 00 00 00     sethi  %hi(0), %o1
                        1154: R_SPARC_HI22      .rodata.str1.8+0x2b8
    1158:       40 00 00 00     call  1158 <ata_timeout+0xf8>
                        1158: R_SPARC_WDISP30   ata_prtdev
    115c:       92 12 60 00     mov  %o1, %o1   ! 0 <ata_alloc_request-0x800>
                        115c: R_SPARC_LO10      .rodata.str1.8+0x2b8
    1160:       c2 06 20 40     ld  [ %i0 + 0x40 ], %g1
    1164:       82 10 66 00     or  %g1, 0x600, %g1
    1168:       82 08 77 ff     and  %g1, -2049, %g1
    116c:       c2 26 20 40     st  %g1, [ %i0 + 0x40 ]
    1170:       40 00 00 00     call  1170 <ata_timeout+0x110>
                        1170: R_SPARC_WDISP30   ata_queue_request
    1174:       90 10 00 18     mov  %i0, %o0
    1178:       10 68 00 0e     b  %xcc, 11b0 <ata_timeout+0x150>
    117c:       01 00 00 00     nop
    1180:       82 10 20 01     mov  1, %g1     ! 1 <ata_alloc_request-0x7ff>
    1184:       c2 2e 20 28     stb  %g1, [ %i0 + 0x28 ]
    1188:       c0 26 20 70     clr  [ %i0 + 0x70 ]
    118c:       c0 26 20 74     clr  [ %i0 + 0x74 ]
    1190:       03 00 00 00     sethi  %hi(0), %g1
                        1190: R_SPARC_HI22      .text+0xd60
    1194:       82 10 60 00     mov  %g1, %g1   ! 0 <ata_alloc_request-0x800>
                        1194: R_SPARC_LO10      .text+0xd60
    1198:       c2 76 20 78     stx  %g1, [ %i0 + 0x78 ]
    119c:       f0 76 20 80     stx  %i0, [ %i0 + 0x80 ]
    11a0:       92 06 20 68     add  %i0, 0x68, %o1
    11a4:       03 00 00 00     sethi  %hi(0), %g1
                        11a4: R_SPARC_HI22      taskqueue_swi
    11a8:       40 00 00 00     call  11a8 <ata_timeout+0x148>
                        11a8: R_SPARC_WDISP30   taskqueue_enqueue
    11ac:       d0 58 60 00     ldx  [ %g1 ], %o0
                        11ac: R_SPARC_LO10      taskqueue_swi
    11b0:       01 00 00 00     nop
    11b4:       81 cf e0 08     rett  %i7 + 8
    11b8:       01 00 00 00     nop
    11bc:       01 00 00 00     nop


More information about the freebsd-sparc64 mailing list