Re: [POWERPC] convert string i/o operations to C
From: Linas Vepstas <hidden>
Date: 2006-09-19 18:29:57
On Tue, Sep 19, 2006 at 10:23:51PM +1000, Stephen Rothwell wrote: Perhaps this:
+void _insb(volatile u8 __iomem *port, void *buf, int ns)
+{
+ asm volatile("sync");
+ if (ns <= 0)
+ return;
+ asm volatile(should be this:
+void _insb(volatile u8 __iomem *port, void *buf, int ns)
+{
+ if (ns <= 0)
+ return;
+ asm volatile("sync");
+ asm volatile(to assuage David Howell's concern. Not that ns should be negative in the first place ... but what the hey. Re Davids other comment: "ns" stands for "no byte-swap", and "s" stands for "string" so "insl_ns" is input string of longs, no byte swap. Here's a question:
+ asm volatile( + "mtctr %2\n" + "subi %1,%1,1\n" + "0: lbz %2,0(%0)\n" + "eieio\n" + "stbu %2,1(%1)\n" + "bdnz 0b\n" + "twi 0,%2,0\n"
What does this twi do? According to my powerpc docs, this would be a no-op. Does this have some magic synchronizing powers on certain implementations? If so, there should be at least a comment card added about why the twi is there. (This special ability of twi might be well-known to some, but still, this is not immediately obvious, and not immedately documented in e.g. the PEM.) --linas