IMMR memory access on 8260

Hi
In a driver I am trying to make, I need to access registers in the IMMR
memory area.

I have tried two methods, none seem to work.
First, I tried the macro
PPC8260_IMMR(PDATA, 32) |= (_ONEBIT32B(0) | _ONEBIT32B(1));

but that exits with:
Process 7 (test_i2c) terminated SIGSEGV code=1 fltno=11 ip=480405b4
ref=30010d10
test_i2c terminated with signal 11

I also tried to do a mmap_device_memory:
ptr = mmap_device_memory(0, 0x20000, PROT_READ|PROT_WRITE, 0,
0x30000000 );
but that crashes the reminal, and i have to reboot:
Map IMMR memory
IMMR mapped at 0x80100000

Shutdown[0,0] S/C/F=10/3/33 C/D=00022f88/0006f57c
[0]PID-TID=7-1 P/T FL=00000000/00000000 “test_i2c”
ppcbe context[0000f748]:
0000: 48000bdd 4803fee0 48049a70 00000000 00000000 00000000 00000000
00000000
0020: ee6b2800 80110d10 80110000 c8000bdd 24000000 4804ab40 00000000
00000000
0040: 00000000 00000000 00000000 00000000 4803ff00 00000001 4803ff14
4803ff1c
0060: 4803ff2c 00000000 00000000 00000000 0029686c 00000000 00000000
4803fee0
0080: 00000000 480405c4 0004d930 480405ec 24000000 20000000 00000000
00000000
00a0: 00000000
instruction[480405ec]:
91 69 00 00 38 60 00 00 38 80 00 00 48 00 0b dd 38 60 00 50 48 00 0c dd 7c
60
stack[4803fee0]:
0000: 4803ff00 480405c4 80100000 4803ff2c fe3344a0 6f740000 00000000
00294000
0020: 00000000 48042bcc 00000000 00000000 00000001 4803ff86 00000000
4803ff8f
0040: 4803ff9b 4803ffa6 00000000 00000003 48040034 00000004 00000020
00000005
0060: 00000007 00000009 480404a0 00000006 00001000 00000007 fe300000
0000002d

Hello,

Rune Torgersen wrote:

Hi
In a driver I am trying to make, I need to access registers in the IMMR
memory area.

I have tried two methods, none seem to work.
First, I tried the macro
PPC8260_IMMR(PDATA, 32) |= (_ONEBIT32B(0) | _ONEBIT32B(1));


It can’t work, you must use mmap.



but that exits with:
Process 7 (test_i2c) terminated SIGSEGV code=1 fltno=11 ip=480405b4
ref=30010d10
test_i2c terminated with signal 11

I also tried to do a mmap_device_memory:
ptr = mmap_device_memory(0, 0x20000, PROT_READ|PROT_WRITE, 0,
0x30000000 );

Try

ptr = mmap_device_memory (0, 0x2000,
PROT_READ | PROT_WRITE |
PROT_NOCACHE,
MAP_SHARED | MAP_PHYS,
0x30000000);
or ptr = mmap_device_io (0x2000, 0x30000000)

You must request the IO privilege by ThreadCtl (_NTO_TCTL_IO, 0) before
the mmap and run your driver under user root.



but that crashes the reminal, and i have to reboot:
Map IMMR memory
IMMR mapped at 0x80100000

Shutdown[0,0] S/C/F=10/3/33 C/D=00022f88/0006f57c
[0]PID-TID=7-1 P/T FL=00000000/00000000 “test_i2c”
ppcbe context[0000f748]:
0000: 48000bdd 4803fee0 48049a70 00000000 00000000 00000000 00000000
00000000
0020: ee6b2800 80110d10 80110000 c8000bdd 24000000 4804ab40 00000000
00000000
0040: 00000000 00000000 00000000 00000000 4803ff00 00000001 4803ff14
4803ff1c
0060: 4803ff2c 00000000 00000000 00000000 0029686c 00000000 00000000
4803fee0
0080: 00000000 480405c4 0004d930 480405ec 24000000 20000000 00000000
00000000
00a0: 00000000
instruction[480405ec]:
91 69 00 00 38 60 00 00 38 80 00 00 48 00 0b dd 38 60 00 50 48 00 0c dd 7c
60
stack[4803fee0]:
0000: 4803ff00 480405c4 80100000 4803ff2c fe3344a0 6f740000 00000000
00294000
0020: 00000000 48042bcc 00000000 00000000 00000001 4803ff86 00000000
4803ff8f
0040: 4803ff9b 4803ffa6 00000000 00000003 48040034 00000004 00000020
00000005
0060: 00000007 00000009 480404a0 00000006 00001000 00000007 fe300000
0000002d





Best regards