32bit pointer in 64bit kernel code

Todd Inglett tinglett at vnet.ibm.com
Sat Aug 3 05:22:29 EST 2002


On Fri, 2002-08-02 at 11:46, Armin Schindler wrote:
>
> Hi Todd,
>
> thanx for your hint, but I know dma_addr_t. I think I didn't explain
> my problem very good. The PCI card runs with its own CPU and software
> on board. The PCI memory space is some kind of dual-ported memory.
> The card now stores the data my driver wants to read in a defined structure,
> which need to be aligned like my structure definition. One member of
> this structure is an internal 32bit pointer which I like to define
> as 32bit pointer and not u32.
> I think I will change it to u32, it seems better...

If the pointer truly is just an opaque value to the hardware then you
can put any value you want in there.  But of course if you cast a
pointer into that u32 you are going to lose the upper bits and you won't
be able to cast it back to become a pointer again.  I'm not sure how
useful that would be.

If you really want to preserve a pointer you'll have to stuff it
somewhere (perhaps an array) and use some 32-bit token value (perhaps an
index to the array) to retrieve it.  This token value would work well in
your hardware's struct.

-todd

-todd


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list