summaryrefslogtreecommitdiff
path: root/src/arch/ppc/include
diff options
context:
space:
mode:
authorGreg Watson <jarrah@users.sourceforge.net>2004-03-13 03:48:44 +0000
committerGreg Watson <jarrah@users.sourceforge.net>2004-03-13 03:48:44 +0000
commit1f50e94d88fa163b5af0b2485fc24b9756800e1d (patch)
tree0c2c5e7ccd6743632e51583aba923ce9af379796 /src/arch/ppc/include
parent96ce0b4bd147af313baf05612e80b959b61290f0 (diff)
byte swapping
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1413 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch/ppc/include')
-rw-r--r--src/arch/ppc/include/arch/io.h36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/arch/ppc/include/arch/io.h b/src/arch/ppc/include/arch/io.h
index a6ef47f687..fd0d1e4654 100644
--- a/src/arch/ppc/include/arch/io.h
+++ b/src/arch/ppc/include/arch/io.h
@@ -36,12 +36,8 @@
* are arrays of bytes, and byte-swapping is not appropriate in
* that case. - paulus
*/
-#define insb(port, buf, ns) _insb((uint8_t *)((port)+_IO_BASE), (buf), (ns))
-#define outsb(port, buf, ns) _outsb((uint8_t *)((port)+_IO_BASE), (buf), (ns))
#define insw(port, buf, ns) _insw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns))
#define outsw(port, buf, ns) _outsw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns))
-#define insl(port, buf, nl) _insl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl))
-#define outsl(port, buf, nl) _outsl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl))
#define inb(port) in_8((uint8_t *)((port)+_IO_BASE))
#define outb(val, port) out_8((uint8_t *)((port)+_IO_BASE), (val))
@@ -58,14 +54,10 @@
#define outl_p(val, port) outl((val), (port))
/*
- * The *_ns versions below don't do byte-swapping.
- * Neither do the standard versions now, these are just here
- * for older code.
+ * The *_ns versions below do byte-swapping.
*/
-#define insw_ns(port, buf, ns) _insw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns))
-#define outsw_ns(port, buf, ns) _outsw_ns((uint16_t *)((port)+_IO_BASE), (buf), (ns))
-#define insl_ns(port, buf, nl) _insl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl))
-#define outsl_ns(port, buf, nl) _outsl_ns((uint32_t *)((port)+_IO_BASE), (buf), (nl))
+#define insw_ns(port, buf, ns) _insw((uint16_t *)((port)+_IO_BASE), (buf), (ns))
+#define outsw_ns(port, buf, ns) _outsw((uint16_t *)((port)+_IO_BASE), (buf), (ns))
#define IO_SPACE_LIMIT ~0
@@ -168,7 +160,7 @@ static inline void _insw_ns(volatile uint16_t *port, void *buf, int ns)
uint16_t * b = (uint16_t *)buf;
while (ns > 0) {
- *b++ = readw(port);
+ *b++ = in_le16(port);
ns--;
}
}
@@ -182,4 +174,24 @@ static inline void _outsw_ns(volatile uint16_t *port, const void *buf, int ns)
ns--;
}
}
+
+static inline void _insw(volatile uint16_t *port, void *buf, int ns)
+{
+ uint16_t * b = (uint16_t *)buf;
+
+ while (ns > 0) {
+ *b++ = in_be16(port);
+ ns--;
+ }
+}
+
+static inline void _outsw(volatile uint16_t *port, const void *buf, int ns)
+{
+ uint16_t * b = (uint16_t *)buf;
+
+ while (ns > 0) {
+ out_be16(port, *b++);
+ ns--;
+ }
+}
#endif