From: Adrian M. <ad...@ne...> - 2007-07-16 22:28:30
|
More on this... Code seemed to be failing on this: if (atomic_xchg(&channel->busy, 1)) atomic_xchg expands out to this: #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) and in sh xchg expands out to this: #define xchg(ptr,x) \ ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)))) But this has a slightly different format in other archs - eg i386: #define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr)))) arm - #define xchg(ptr,x) \ ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) MIPS #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) So I wondered if it was the reversal of the params that was the issue and did this quick and very dirty hack --- #define xchg(ptr,x) \ ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)))) #define xchg_dma(ptr, x) \ ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) and changing atomic_chg to this: #define atomic_xchg(v, new) (xchg_dma(&((v)->counter), new)) But, as with most quick and dirty hacks, it didn't work... Linux version 2.6.22-gc2dc1ad5-dirty (adrian@bossclass) (gcc version 3.4.6) #12 PREEMPT Mon Jul 16 23:16:34 BST 2007 console [sercon0] enabled Booting machvec: Sega Dreamcast Node 0: start_pfn = 0xc000, low = 0xd000 Zone PFN ranges: Normal 49152 -> 53248 early_node_map[1] active PFN ranges 0: 49152 -> 53248 Built 1 zonelists in Zone order. Total pages: 4064 Kernel command line: console=ttySC1,115200 panic=3 root=/dev/nfs rw nfsaddrs=192.168.61.55:192.168.61.50:192.168.61.50: earlyprintk=serial PID hash table entries: 64 (order: 6, 256 bytes) Using tmu for system timer Using 12.469 MHz high precision timer. Console: colour dummy device 80x25 Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) Memory: 14104k/16384k available (1499k kernel code, 444k data, 72k init) PVR=040205c1 CVR=00000000 PRR=00000000 I-cache : n_ways=1 n_sets=256 way_incr=8192 I-cache : entry_mask=0x00001fe0 alias_mask=0x00001000 n_aliases=2 D-cache : n_ways=1 n_sets=512 way_incr=16384 D-cache : entry_mask=0x00003fe0 alias_mask=0x00003000 n_aliases=4 Mount-cache hash table entries: 512 CPU: SH7750 NET: Registered protocol family 16 DMA: Registering DMA API. DMA: Registering sh_dmac handler (4 channels). Fault in unaligned fixup: 0000 [#1] Modules linked in: Pid : 1, Comm: swapper PC is at request_dma+0x2e/0x88 PC : 8c10d66a SP : 8c255f30 SR : 400000f1 TEA : 00000001 Not tainted R0 : 00000000 R1 : 00000001 R2 : 8c24c538 R3 : 40000001 R4 : 00000084 R5 : 00000084 R6 : 00000004 R7 : 8c24c400 R8 : 8c24c508 R9 : 00000000 R10 : 8c1e22f0 R11 : 8c1b2fec R12 : 00000000 R13 : 8c1fb370 R14 : 00000000 MACH: 00000000 MACL: 00000108 GBR : 00000000 PR : 8c10d656 Call trace: [<8c1f403a>] pvr2_dma_init+0x12/0x34 [<8c1ea848>] kernel_init+0x90/0x244 [<8c0035e4>] kernel_thread_helper+0x4/0x10 [<8c1ea7b8>] kernel_init+0x0/0x244 [<8c0035e0>] kernel_thread_helper+0x0/0x10 Process: swapper (pid: 1, stack limit = 8c254001) Stack: (0x8c255f30 to 0x8c256000) 5f20: 8c1f403a 00000000 00000000 00000000 5f40: 00000000 8c1ea848 00000000 00000000 00000000 00000000 00000000 00000000 5f60: 00000000 00000000 00000000 00000000 00000001 00000000 00000000 00000000 5f80: 8c0035e4 00000000 00000000 00000000 00000000 00000000 00000000 00000000 5fa0: 00000000 00000000 00000000 00000000 00000000 8c1ea7b8 00000000 00000000 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 8c255fa0 5fe0: 8c0035e0 00000000 40000000 00000000 00000000 00000000 00000000 00000000 Kernel panic - not syncing: Attempted to kill init! Rebooting in 3 seconds.. |