Error while accessing physical address

Garcia Jérémie GARCIAJ at 3il.fr
Fri Sep 2 00:20:23 EST 2005


Tks for your answer Marcin. This is a good idea but unfortunately, 
the result remains the same...
When using "ioremap", do I need need to use inb/oub... family to 
handle those remapped address??


-------- Message d'origine--------
De: Marcin Dawidowicz [mailto:marcin.dawidowicz at kontron.pl]
Date: jeu. 01/09/2005 16:11
À: Garcia Jérémie
Objet : Re: Error while accessing physical address
 
Maybe you could try to change this:
>   regHdwAddress = (unsigned short *) ioremap((unsigned short)address,0x1);
into this:
regHdwAddress = (unsigned short *) ioremap((unsigned short)address,sizeof 
(unsigned short));

Cause you are accessing unsigned short register later.... and "unsigned short" 
I assume is 2 bytes long.

Marcin


On Thursday 01 of September 2005 15:44, you wrote:
> Hi everybody.
>
> As a kernel newbie, I still encounter basic problems. I read a lot of
> things on the memory management, but obviously I didn't understand some
> things.
>
> I have some kernel source code that only write data to our card registers:
>
> void bhWriteCardRegister(unsigned short * address, unsigned short data)
> {
>   unsigned short * regHdwAddress;
>
>   printk("Writing data: %x at address:%x\n",data,address);
>
>   /* Get the virtual address for the physical one */
>   regHdwAddress = (unsigned short *) ioremap((unsigned short)address,0x1);
>
>   printk("ioremap returned : %x\n",regHdwAddress);
>
>   /* write hardware register data value */
>   *regHdwAddress = data;
>
>   iounmap((void *)regHdwAddress);
> }
> <<<<<<<<
>
> In a module init I call this function:
>
> #define CARD_PROCESSOR_CTRL_IN_SERVICE    0x8000
> #define CARD_PROCESSOR_CTRL_REG_P 0x40000400
> bhWriteCardRegister((unsigned short *)(CARD_PROCESSOR_CTRL_REG_P),
> (unsigned short)CARD_PROCESSOR_CTRL_IN_SERVICE); <<<<<<<<
>
> When I load this module on our powerPC 405EP based arch, the execution
> gives that:
>
> Writing data: 8000 at address:40000400
> ioremap returned : c2090400
> <<<<<<<<
>
> The problem is that after this write operation, every shell cmd I try give
> a "segmentation fault". What I did wrong ??
>
> Please help me cause I have to go on fast... (tks boss...)
>
>
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev




More information about the Linuxppc-dev mailing list