From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.deltatau.com (smtp.deltatau.com [64.60.44.211]) by ozlabs.org (Postfix) with ESMTP id 41B12DDF48 for ; Tue, 29 Jul 2008 09:57:01 +1000 (EST) Message-ID: <23b401c8f10b$54ecf9d0$0109220a@deltatau.local> From: "Henry Bausley" To: Subject: Writing to CPLD mapped to EBC Port of AMCC440EP Date: Mon, 28 Jul 2008 16:40:35 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_23B1_01C8F0D0.A88BD7E0" List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This is a multi-part message in MIME format. ------=_NextPart_000_23B1_01C8F0D0.A88BD7E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am attempting to write to a CPLD mapped to the EBC port of a AMCC = 440EP. When I attempt to write using an unsigned variable ie. unsigned *pbase =3D (unsigned char = *)ioremap64(0x8F000000,0x1000000); I get a kernel access of bad area, sig: 11 fault. However, if I change = to an unsigned char ie. unsigned char *pbase =3D (unsigned char = *)ioremap64(0x8F000000, 0x1000000); The system doesn't crash. I need to write using an = unsigned. Does any one have any ideas what I am doing wrong? I am using 2.6.24 Xenomai Denx. 4.2. I am porting a working 2.6.14 = project that was developed with FSM Labs RT Linux (now owned by = WindRiver). //-----------------------------------------------------------------------= // initialize module -- this what is called when you do insmod ./ubus.ko //-----------------------------------------------------------------------= static int __init ubus_init_module (void)=20 { int i; unsigned ofs[20] =3D {0x400000,0x400100,0x500000,0x500100,0x600000,0x600100,0x700000,0x700100,= 0x608000,0x608100,0x708000,0x708100,0x610000,0x610100,0x710000,0x710100, 0x618000,0x618100,0x718000,0x718100}; unsigned *pbase =3D (unsigned *)ioremap64(0x8F000000, 0x1000000); unsigned *p; for( i =3D 0; i < 20;i++) { p =3D pbase + ofs[i] + 0x34; *p =3D 0x25500; printk(KERN_ALERT "p =3D %X\r\n",p); } iounmap(pbase); PRINTK("initializing module ubus\n"); i =3D register_chrdev (UBUS_MAJOR, UBUS_NAME, &ubus_fops); if (i !=3D 0) return - EIO; return 0; } -bash-3.2# insmod ubus.ko = =20 Oops: kernel access of bad area, sig: 11 [#1] = =20 NIP: d1068054 LR: d1068038 CTR: 00000000 = =20 REGS: cf489d70 TRAP: 0300 Not tainted (2.6.24.2) = =20 MSR: 00029000 CR: 08004022 XER: 00000004 = =20 DEAR: d61000d0, ESR: 00800000 = =20 TASK =3D cf45c410[309] 'insmod' THREAD: cf488000 = =20 GPR00: d1068038 cf489e20 cf45c410 d5100000 d6100000 00000000 00000000 cf4467f8 =20 GPR08: 000007f8 d1060000 8ffff000 00000000 28004028 1004950c 00000000 d509c1e4 =20 GPR16: cffe1ce0 d5093a04 00000000 00000036 00000036 d5093310 c003cb00 d5081000 =20 GPR24: 00000026 00000026 d5093464 cf489e28 d1 0664c4 00025500 00000026 d1066a60 =20 NIP [d1068054] ubus_init_module+0x54/0x190 [ubus] = =20 LR [d1068038] ubus_init_module+0x38/0x190 [ubus] = =20 Call Trace: = =20 [cf489e20] [d1068038] ubus_init_module+0x38/0x190 [ubus] (unreliable) =20 [cf489e90] [c003df74] sys_init_module +0x174/0x15e0 = =20 [cf489f40] [c0001ac4] ret_from_syscall +0x0/0x3c = =20 Instruction dump: = =20 480000cd 3c808f00 3ca00100 38600000 480000cd 80810008 3fa00002 5484103a =20 7c841a14 3d20d106 63bd5500 3b8964c4 <93a400d0> 7c7e1b78 388400d0 7f83e378 =20 Segmentation fault =20 -bash-3.2# insmod ubus.ko = =20 p =3D D5500034 = =20 p =3D D5500134 = =20 p =3D D5600034 = =20 p =3D D5600134 = =20 p =3D D5700034 = =20 p =3D D5700134 = =20 p =3D D5800034 = =20 p =3D D5800134 = =20 p =3D D5708034 = =20 p =3D D5708134 = =20 p =3D D5808034 = =20 p =3D D5808134 = =20 p =3D D5710034 = =20 p =3D D5710134 = =20 p =3D D5810034 = =20 p =3D D5810134 = =20 p =3D D5718034 = =20 p =3D D5718134 = =20 p =3D D5818034 = =20 p =3D D5818134 = =20 initializing module ubus =20 ------=_NextPart_000_23B1_01C8F0D0.A88BD7E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
I am attempting to write to a CPLD = mapped to the=20 EBC port of a AMCC 440EP.  When I attempt to write using=20 an unsigned variable
ie. unsigned *pbase =3D (unsigned char=20 *)ioremap64(0x8F000000,0x1000000);
I get a=20 kernel access of bad area, sig: 11 fault.  However, if I change to = an=20 unsigned char ie. unsigned char *pbase =3D (unsigned char=20 *)ioremap64(0x8F000000,
0x1000000); The system doesn't crash.  I = need to=20 write using an unsigned.  Does any one have any ideas what I am = doing=20 wrong?
 
I am using 2.6.24 Xenomai Denx. = 4.2. =20 I am porting a working 2.6.14 = project that=20 was developed with FSM Labs RT Linux (now owned by = WindRiver).

 
 
//--------------------------------------------------------------= ---------
//=20 initialize module -- this what is called when you do insmod=20 ./ubus.ko
//----------------------------------------------------------= -------------
static=20 int __init ubus_init_module (void)
{
  int i;
  = unsigned=20 ofs[20]=20 =3D
{0x400000,0x400100,0x500000,0x500100,0x600000,0x600100,0x700000,0x= 700100,

0x608000,0x608100,0x708000,0x708100,0x610000,0x610100,0x71= 0000,0x710100,
         &= nbsp;           &n= bsp; =20 0x618000,0x618100,0x718000,0x718100};
  unsigned *pbase =3D=20 (unsigned *)ioremap64(0x8F000000,
0x1000000);
  unsigned = *p;
  for( i =3D 0; i < 20;i++)
  = {
    p =3D=20 pbase + ofs[i] + 0x34;
    *p =3D = 0x25500;
   =20 printk(KERN_ALERT "p =3D %X\r\n",p);
  }
 =20 iounmap(pbase);
  PRINTK("initializing module = ubus\n");
  i =3D=20 register_chrdev (UBUS_MAJOR, UBUS_NAME, &ubus_fops);
  if (i = !=3D 0)=20 return - EIO;

  return 0;
}


-bash-3.2#=20 insmod
ubus.ko         &n= bsp;           &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;        =20
Oops: kernel access of bad area, sig:=20 11
[#1]          &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           =20
NIP: d1068054 LR: d1068038=20 CTR:
00000000         &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;     =20
REGS: cf489d70 TRAP: 0300   Not=20 tainted
(2.6.24.2)        &nbs= p;            = ;            =             &= nbsp;           &n= bsp;       =20
MSR: 00029000 <EE,ME>  CR: 08004022 =20 XER:
00000004         &nb= sp;           &nbs= p;            = ;            =             &= nbsp;       =20
DEAR: d61000d0,=20 ESR:
00800000         &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;           &nb= sp;    =20
TASK =3D cf45c410[309] 'insmod'=20 THREAD:
cf488000         =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;=20
GPR00: d1068038 cf489e20 cf45c410 d5100000 d6100000 00000000=20 00000000
cf4467f8         = ;            =             &= nbsp;    =20
GPR08: 000007f8 d1060000 8ffff000 00000000 28004028 1004950c=20 00000000
d509c1e4         = ;            =             &= nbsp;    =20
GPR16: cffe1ce0 d5093a04 00000000 00000036 00000036 d5093310=20 c003cb00
d5081000         = ;            =             &= nbsp;    =20
GPR24: 00000026 00000026 d5093464 cf489e28 d1


0664c4 = 00025500=20 00000026=20 d1066a60           = ;            =             &= nbsp;  =20
NIP [d1068054]=20 ubus_init_module+0x54/0x190
[ubus]      =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;=20
LR [d1068038]=20 ubus_init_module+0x38/0x190
[ubus]      =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ; =20
Call
Trace:         &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;          =20
[cf489e20] [d1068038] ubus_init_module+0x38/0x190=20 [ubus]
(unreliable)        &nb= sp;           &nbs= p;            = ;            =   =20
[cf489e90] [c003df74]=20 sys_init_module
+0x174/0x15e0       = ;            =             &= nbsp;           &n= bsp;           &nb= sp;          =20
[cf489f40] [c0001ac4]=20 ret_from_syscall
+0x0/0x3c       &n= bsp;           &nb= sp;           &nbs= p;            = ;            =             &= nbsp;=20
Instruction
dump:        &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;     =20
480000cd 3c808f00 3ca00100 38600000 480000cd 80810008=20 3fa00002
5484103a         = ;            =             &= nbsp;           =20
7c841a14 3d20d106 63bd5500 3b8964c4 <93a400d0> 7c7e1b78=20 388400d0
7f83e378         = ;            =             &= nbsp;         =20
Segmentation fault  


-bash-3.2#=20 insmod
ubus.ko         &n= bsp;           &nb= sp;           &nbs= p;            = ;            =             &= nbsp;           &n= bsp;        =20
p =3D=20 D5500034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5500134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5600034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5600134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5700034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5700134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5800034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5800134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5708034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5708134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =          =20
p =3D=20 D5808034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5808134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5710034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5710134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5810034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5810134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5718034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5718134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5818034           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
p =3D=20 D5818134           = ;            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =         =20
initializing module ubus  =

------=_NextPart_000_23B1_01C8F0D0.A88BD7E0--