How to write portable MMIO code?

From: Josť Fonseca (j_r_fonseca@yahoo.co.uk)
Date: Tue Apr 30 2002 - 09:22:12 EST


Dear kernel developers,

I'm currently trying to get the Mach64 DRI driver to run on PowerPC. It's
mostly working but there are some strange behaviors (DMA works, MMIO not
really unless you make long waits when submiting, etc.). This is most
likely related with the MMIO programming macros in the kernel module.

My question is: How to code MMIO to be portable across all platforms,
i.e., taking in consideration the endian format and memory caches?

I've search thorougly the answer to this question but found
incomplete/contraditory answers:

  - should one use readl/writel or dereference the address directly?
  - is the use of readl/writel macros suficient to account for endian
correctness or it's also needed to use the cpu_to_le32/le32_to_cpu macros?
  - should one in general (i.e., assuming the worst case) do wmb() on
writes, and mb() on reads?

Although I appreciate answers concerning future developments on this
matter, I need an answer to the current stable kernel release.

Regards,

Josť Fonseca

PS: Please CC me as I'm not subscribed.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 30 2002 - 22:00:19 EST