Implement bus_space_{read,write}_raw_mult_[248] correctly, it needs
authormiod <miod@openbsd.org>
Wed, 30 Jul 2008 17:37:44 +0000 (17:37 +0000)
committermiod <miod@openbsd.org>
Wed, 30 Jul 2008 17:37:44 +0000 (17:37 +0000)
endianness conversion on pci bridges.
ok deraadt@ jsing@

sys/arch/sgi/include/bus.h
sys/arch/sgi/localbus/macebus.c
sys/arch/sgi/pci/macepcibridge.c
sys/arch/sgi/pci/macepcibrvar.h
sys/arch/sgi/xbow/xbow.c
sys/arch/sgi/xbow/xbridge.c

index cc6b1ab..8b01655 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: bus.h,v 1.9 2008/03/30 20:14:38 miod Exp $    */
+/*     $OpenBSD: bus.h,v 1.10 2008/07/30 17:37:44 miod Exp $   */
 
 /*
  * Copyright (c) 2003-2004 Opsycon AB Sweden.  All rights reserved.
@@ -66,6 +66,18 @@ struct mips_bus_space {
                          bus_size_t);
        void            (*_space_write_8)(bus_space_tag_t , bus_space_handle_t,
                          bus_size_t, u_int64_t);
+       void            (*_space_read_raw_2)(bus_space_tag_t, bus_space_handle_t,
+                         bus_addr_t, u_int8_t *, bus_size_t);
+       void            (*_space_write_raw_2)(bus_space_tag_t, bus_space_handle_t,
+                         bus_addr_t, const u_int8_t *, bus_size_t);
+       void            (*_space_read_raw_4)(bus_space_tag_t, bus_space_handle_t,
+                         bus_addr_t, u_int8_t *, bus_size_t);
+       void            (*_space_write_raw_4)(bus_space_tag_t, bus_space_handle_t,
+                         bus_addr_t, const u_int8_t *, bus_size_t);
+       void            (*_space_read_raw_8)(bus_space_tag_t, bus_space_handle_t,
+                         bus_addr_t, u_int8_t *, bus_size_t);
+       void            (*_space_write_raw_8)(bus_space_tag_t, bus_space_handle_t,
+                         bus_addr_t, const u_int8_t *, bus_size_t);
        int             (*_space_map)(bus_space_tag_t , bus_addr_t,
                          bus_size_t, int, bus_space_handle_t *);
        void            (*_space_unmap)(bus_space_tag_t, bus_space_handle_t,
@@ -85,6 +97,20 @@ struct mips_bus_space {
 #define        bus_space_write_4(t, h, o, v) (*(t)->_space_write_4)((t), (h), (o), (v))
 #define        bus_space_write_8(t, h, o, v) (*(t)->_space_write_8)((t), (h), (o), (v))
 
+#define        bus_space_read_raw_multi_2(t, h, a, b, l) \
+       (*(t)->_space_read_raw_2)((t), (h), (a), (b), (l))
+#define        bus_space_read_raw_multi_4(t, h, a, b, l) \
+       (*(t)->_space_read_raw_4)((t), (h), (a), (b), (l))
+#define        bus_space_read_raw_multi_8(t, h, a, b, l) \
+       (*(t)->_space_read_raw_8)((t), (h), (a), (b), (l))
+
+#define        bus_space_write_raw_multi_2(t, h, a, b, l) \
+       (*(t)->_space_write_raw_2)((t), (h), (a), (b), (l))
+#define        bus_space_write_raw_multi_4(t, h, a, b, l) \
+       (*(t)->_space_write_raw_4)((t), (h), (a), (b), (l))
+#define        bus_space_write_raw_multi_8(t, h, a, b, l) \
+       (*(t)->_space_write_raw_8)((t), (h), (a), (b), (l))
+
 #define        bus_space_map(t, o, s, c, p) (*(t)->_space_map)((t), (o), (s), (c), (p))
 #define        bus_space_unmap(t, h, s) (*(t)->_space_unmap)((t), (h), (s))
 #define        bus_space_subregion(t, h, o, s, p) \
@@ -176,34 +202,6 @@ bus_space_set_region(2,16)
 bus_space_set_region(4,32)
 bus_space_set_region(8,64)
 
-/*----------------------------------------------------------------------------*/
-#define        bus_space_read_raw_multi(n,m,l)                                       \
-static __inline void                                                         \
-CAT(bus_space_read_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
-    bus_addr_t ba, u_int8_t *buf, bus_size_t cnt)                            \
-{                                                                            \
-       CAT(bus_space_read_multi_,n)(bst, bsh, ba, (CAT3(u_int,m,_t) *)buf,   \
-           cnt >> l);                                                        \
-}
-
-bus_space_read_raw_multi(2,16,1)
-bus_space_read_raw_multi(4,32,2)
-bus_space_read_raw_multi(8,64,3)
-
-/*----------------------------------------------------------------------------*/
-#define        bus_space_write_raw_multi(n,m,l)                                      \
-static __inline void                                                         \
-CAT(bus_space_write_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh,\
-    bus_addr_t ba, const u_int8_t *buf, bus_size_t cnt)                              \
-{                                                                            \
-       CAT(bus_space_write_multi_,n)(bst, bsh, ba,                           \
-           (const CAT3(u_int,m,_t) *)buf, cnt >> l);                         \
-}
-
-bus_space_write_raw_multi(2,16,1)
-bus_space_write_raw_multi(4,32,2)
-bus_space_write_raw_multi(8,64,3)
-
 /*----------------------------------------------------------------------------*/
 static __inline void
 bus_space_copy_1(void *v, bus_space_handle_t h1, bus_size_t o1,
index d7420ae..7888749 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: macebus.c,v 1.36 2008/04/07 22:34:23 miod Exp $ */
+/*     $OpenBSD: macebus.c,v 1.37 2008/07/30 17:37:46 miod Exp $ */
 
 /*
  * Copyright (c) 2000-2004 Opsycon AB  (www.opsycon.se)
@@ -76,6 +76,19 @@ void mace_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int16_t);
 void mace_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int32_t);
 void mace_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t);
 
+void mace_read_raw_2(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, u_int8_t *, bus_size_t);
+void mace_write_raw_2(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, const u_int8_t *, bus_size_t);
+void mace_read_raw_4(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, u_int8_t *, bus_size_t);
+void mace_write_raw_4(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, const u_int8_t *, bus_size_t);
+void mace_read_raw_8(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, u_int8_t *, bus_size_t);
+void mace_write_raw_8(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, const u_int8_t *, bus_size_t);
+
 int mace_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *);
 void mace_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
 int mace_space_region(bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, bus_space_handle_t *);
@@ -104,6 +117,9 @@ bus_space_t macebus_tag = {
        mace_read_2, mace_write_2,
        mace_read_4, mace_write_4,
        mace_read_8, mace_write_8,
+       mace_read_raw_2, mace_write_raw_2,
+       mace_read_raw_4, mace_write_raw_4,
+       mace_read_raw_8, mace_write_raw_8,
        mace_space_map, mace_space_unmap, mace_space_region,
        mace_space_vaddr
 };
@@ -117,6 +133,9 @@ bus_space_t crimebus_tag = {
        mace_read_2, mace_write_2,
        mace_read_4, mace_write_4,
        mace_read_8, mace_write_8,
+       mace_read_raw_2, mace_write_raw_2,
+       mace_read_raw_4, mace_write_raw_4,
+       mace_read_raw_8, mace_write_raw_8,
        mace_space_map, mace_space_unmap, mace_space_region,
        mace_space_vaddr
 };
@@ -315,6 +334,68 @@ mace_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t v)
        *(volatile u_int64_t *)(h + o) = v;
 }
 
+void
+mace_read_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    u_int8_t *buf, bus_size_t len)
+{
+       panic(__func__);
+}
+
+void
+mace_write_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const u_int8_t *buf, bus_size_t len)
+{
+       panic(__func__);
+}
+
+void
+mace_read_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int32_t *addr = (volatile u_int32_t *)(h + o);
+       len >>= 2;
+       while (len-- != 0) {
+               *(u_int32_t *)buf = *addr;
+               buf += 4;
+       }
+}
+
+void
+mace_write_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int32_t *addr = (volatile u_int32_t *)(h + o);
+       len >>= 2;
+       while (len-- != 0) {
+               *addr = *(u_int32_t *)buf;
+               buf += 4;
+       }
+}
+
+void
+mace_read_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int64_t *addr = (volatile u_int64_t *)(h + o);
+       len >>= 3;
+       while (len-- != 0) {
+               *(u_int64_t *)buf = *addr;
+               buf += 8;
+       }
+}
+
+void
+mace_write_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int64_t *addr = (volatile u_int64_t *)(h + o);
+       len >>= 3;
+       while (len-- != 0) {
+               *addr = *(u_int64_t *)buf;
+               buf += 8;
+       }
+}
+
 extern int extent_malloc_flags;
 
 int
index 3a8fc5d..e1a63bf 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: macepcibridge.c,v 1.16 2008/07/30 17:32:30 miod Exp $ */
+/*     $OpenBSD: macepcibridge.c,v 1.17 2008/07/30 17:37:46 miod Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se)
@@ -100,6 +100,9 @@ bus_space_t mace_pcibbus_mem_tag = {
        mace_pcib_read_2, mace_pcib_write_2,
        mace_pcib_read_4, mace_pcib_write_4,
        mace_pcib_read_8, mace_pcib_write_8,
+       mace_pcib_read_raw_2, mace_pcib_write_raw_2,
+       mace_pcib_read_raw_4, mace_pcib_write_raw_4,
+       mace_pcib_read_raw_8, mace_pcib_write_raw_8,
        mace_pcib_space_map, mace_pcib_space_unmap, mace_pcib_space_region,
 };
 
@@ -112,6 +115,9 @@ bus_space_t mace_pcibbus_io_tag = {
        mace_pcib_read_2, mace_pcib_write_2,
        mace_pcib_read_4, mace_pcib_write_4,
        mace_pcib_read_8, mace_pcib_write_8,
+       mace_pcib_read_raw_2, mace_pcib_write_raw_2,
+       mace_pcib_read_raw_4, mace_pcib_write_raw_4,
+       mace_pcib_read_raw_8, mace_pcib_write_raw_8,
        mace_pcib_space_map, mace_pcib_space_unmap, mace_pcib_space_region,
 };
 
@@ -507,6 +513,78 @@ mace_pcib_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64
        *(volatile u_int64_t *)(h + o) = v;
 }
 
+void
+mace_pcib_read_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int16_t *addr = (volatile u_int16_t *)(h + (o | 2) - (o & 3));
+       len >>= 1;
+       while (len-- != 0) {
+               *(u_int16_t *)buf = letoh16(*addr);
+               buf += 2;
+       }
+}
+
+void
+mace_pcib_write_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int16_t *addr = (volatile u_int16_t *)(h + (o | 2) - (o & 3));
+       len >>= 1;
+       while (len-- != 0) {
+               *addr = htole16(*(u_int16_t *)buf);
+               buf += 2;
+       }
+}
+
+void
+mace_pcib_read_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int32_t *addr = (volatile u_int32_t *)(h + o);
+       len >>= 2;
+       while (len-- != 0) {
+               *(u_int32_t *)buf = letoh32(*addr);
+               buf += 4;
+       }
+}
+
+void
+mace_pcib_write_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int32_t *addr = (volatile u_int32_t *)(h + o);
+       len >>= 2;
+       while (len-- != 0) {
+               *addr = htole32(*(u_int32_t *)buf);
+               buf += 4;
+       }
+}
+
+void
+mace_pcib_read_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int64_t *addr = (volatile u_int64_t *)(h + o);
+       len >>= 3;
+       while (len-- != 0) {
+               *(u_int64_t *)buf = letoh64(*addr);
+               buf += 8;
+       }
+}
+
+void
+mace_pcib_write_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const u_int8_t *buf, bus_size_t len)
+{
+       volatile u_int64_t *addr = (volatile u_int64_t *)(h + o);
+       len >>= 3;
+       while (len-- != 0) {
+               *addr = htole64(*(u_int64_t *)buf);
+               buf += 8;
+       }
+}
+
 extern int extent_malloc_flags;
 
 int
index 53f482c..b36ecf7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: macepcibrvar.h,v 1.3 2004/10/20 12:49:15 pefo Exp $ */
+/*     $OpenBSD: macepcibrvar.h,v 1.4 2008/07/30 17:37:46 miod Exp $ */
 
 /*
  * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se)
@@ -57,6 +57,19 @@ void mace_pcib_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t,
 void mace_pcib_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t,
        u_int64_t);
 
+void mace_pcib_read_raw_2(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, u_int8_t *, bus_size_t);
+void mace_pcib_write_raw_2(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, const u_int8_t *, bus_size_t);
+void mace_pcib_read_raw_4(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, u_int8_t *, bus_size_t);
+void mace_pcib_write_raw_4(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, const u_int8_t *, bus_size_t);
+void mace_pcib_read_raw_8(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, u_int8_t *, bus_size_t);
+void mace_pcib_write_raw_8(bus_space_tag_t, bus_space_handle_t,
+           bus_addr_t, const u_int8_t *, bus_size_t);
+
 int mace_pcib_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
        bus_space_handle_t *);
 void mace_pcib_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
index c9dc0d1..88cc0d7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: xbow.c,v 1.1 2008/04/07 22:47:40 miod Exp $   */
+/*     $OpenBSD: xbow.c,v 1.2 2008/07/30 17:37:46 miod Exp $   */
 
 /*
  * Copyright (c) 2008 Miodrag Vallat.
@@ -82,10 +82,21 @@ void        xbow_enumerate(struct device *, int,
 
 uint32_t xbow_read_4(bus_space_tag_t, bus_space_handle_t, bus_size_t);
 uint64_t xbow_read_8(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-void   xbow_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t,
-           uint32_t);
-void   xbow_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t,
-           uint64_t);
+void   xbow_write_4(bus_space_tag_t, bus_space_handle_t, bus_size_t, uint32_t);
+void   xbow_write_8(bus_space_tag_t, bus_space_handle_t, bus_size_t, uint64_t);
+void   xbow_read_raw_2(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           uint8_t *, bus_size_t);
+void   xbow_write_raw_2(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           const uint8_t *, bus_size_t);
+void   xbow_read_raw_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           uint8_t *, bus_size_t);
+void   xbow_write_raw_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           const uint8_t *, bus_size_t);
+void   xbow_read_raw_8(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           uint8_t *, bus_size_t);
+void   xbow_write_raw_8(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           const uint8_t *, bus_size_t);
+
 int    xbow_space_map_short(bus_space_tag_t, bus_addr_t, bus_size_t, int,
            bus_space_handle_t *);
 int    xbow_space_map_long(bus_space_tag_t, bus_addr_t, bus_size_t, int,
@@ -120,6 +131,12 @@ static const bus_space_t xbowbus_short_tag = {
        xbow_write_4,
        xbow_read_8,
        xbow_write_8,
+       xbow_read_raw_2,
+       xbow_write_raw_2,
+       xbow_read_raw_4,
+       xbow_write_raw_4,
+       xbow_read_raw_8,
+       xbow_write_raw_8,
        xbow_space_map_short,
        xbow_space_unmap,
        xbow_space_region_short
@@ -139,6 +156,12 @@ static const bus_space_t xbowbus_long_tag = {
        xbow_write_4,
        xbow_read_8,
        xbow_write_8,
+       xbow_read_raw_2,
+       xbow_write_raw_2,
+       xbow_read_raw_4,
+       xbow_write_raw_4,
+       xbow_read_raw_8,
+       xbow_write_raw_8,
        xbow_space_map_long,
        xbow_space_unmap,
        xbow_space_region_long
@@ -402,6 +425,72 @@ xbow_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint64_t v)
        *(volatile uint64_t *)(h + o) = v;
 }
 
+void
+xbow_read_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    uint8_t *buf, bus_size_t len)
+{
+       len >>= 1;
+       while (len-- != 0) {
+               *(uint16_t *)buf = *(volatile uint16_t *)(h + o);
+               buf += 2;
+       }
+}
+
+void
+xbow_write_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const uint8_t *buf, bus_size_t len)
+{
+       len >>= 1;
+       while (len-- != 0) {
+               *(volatile uint16_t *)(h + o) = *(uint16_t *)buf;
+               buf += 2;
+       }
+}
+
+void
+xbow_read_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    uint8_t *buf, bus_size_t len)
+{
+       len >>= 2;
+       while (len-- != 0) {
+               *(uint32_t *)buf = *(volatile uint32_t *)(h + o);
+               buf += 4;
+       }
+}
+
+void
+xbow_write_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const uint8_t *buf, bus_size_t len)
+{
+       len >>= 2;
+       while (len-- != 0) {
+               *(volatile uint32_t *)(h + o) = *(uint32_t *)buf;
+               buf += 4;
+       }
+}
+
+void
+xbow_read_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    uint8_t *buf, bus_size_t len)
+{
+       len >>= 3;
+       while (len-- != 0) {
+               *(uint64_t *)buf = *(volatile uint64_t *)(h + o);
+               buf += 8;
+       }
+}
+
+void
+xbow_write_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const uint8_t *buf, bus_size_t len)
+{
+       len >>= 3;
+       while (len-- != 0) {
+               *(volatile uint64_t *)(h + o) = *(uint64_t *)buf;
+               buf += 8;
+       }
+}
+
 int
 xbow_space_map_short(bus_space_tag_t t, bus_addr_t offs, bus_size_t size,
     int cacheable, bus_space_handle_t *bshp)
index e10a6f4..7bc7f6a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: xbridge.c,v 1.2 2008/07/28 18:50:59 miod Exp $        */
+/*     $OpenBSD: xbridge.c,v 1.3 2008/07/30 17:37:46 miod Exp $        */
 
 /*
  * Copyright (c) 2008 Miodrag Vallat.
@@ -96,6 +96,18 @@ void xbridge_write_1(bus_space_tag_t, bus_space_handle_t, bus_size_t,
            uint8_t);
 void   xbridge_write_2(bus_space_tag_t, bus_space_handle_t, bus_size_t,
            uint16_t);
+void   xbow_read_raw_2(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           uint8_t *, bus_size_t);
+void   xbow_write_raw_2(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           const uint8_t *, bus_size_t);
+void   xbow_read_raw_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           uint8_t *, bus_size_t);
+void   xbow_write_raw_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           const uint8_t *, bus_size_t);
+void   xbow_read_raw_8(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           uint8_t *, bus_size_t);
+void   xbow_write_raw_8(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+           const uint8_t *, bus_size_t);
 
 bus_addr_t xbridge_pa_to_device(paddr_t);
 paddr_t        xbridge_device_to_pa(bus_addr_t);
@@ -192,11 +204,23 @@ xbridge_attach(struct device *parent, struct device *self, void *aux)
        sc->sc_io_bus_space->_space_read_2 = xbridge_read_2;
        sc->sc_io_bus_space->_space_write_1 = xbridge_write_1;
        sc->sc_io_bus_space->_space_write_2 = xbridge_write_2;
+       sc->sc_io_bus_space->_space_read_raw_2 = xbridge_read_raw_2;
+       sc->sc_io_bus_space->_space_write_raw_2 = xbridge_write_raw_2;
+       sc->sc_io_bus_space->_space_read_raw_4 = xbridge_read_raw_4;
+       sc->sc_io_bus_space->_space_write_raw_4 = xbridge_write_raw_4;
+       sc->sc_io_bus_space->_space_read_raw_8 = xbridge_read_raw_8;
+       sc->sc_io_bus_space->_space_write_raw_8 = xbridge_write_raw_8;
 
        sc->sc_mem_bus_space->_space_read_1 = xbridge_read_1;
        sc->sc_mem_bus_space->_space_read_2 = xbridge_read_2;
        sc->sc_mem_bus_space->_space_write_1 = xbridge_write_1;
        sc->sc_mem_bus_space->_space_write_2 = xbridge_write_2;
+       sc->sc_mem_bus_space->_space_read_raw_2 = xbridge_read_raw_2;
+       sc->sc_mem_bus_space->_space_write_raw_2 = xbridge_write_raw_2;
+       sc->sc_mem_bus_space->_space_read_raw_4 = xbridge_read_raw_4;
+       sc->sc_mem_bus_space->_space_write_raw_4 = xbridge_write_raw_4;
+       sc->sc_mem_bus_space->_space_read_raw_8 = xbridge_read_raw_8;
+       sc->sc_mem_bus_space->_space_write_raw_8 = xbridge_write_raw_8;
 
        /*
         * Initialize PCI methods.
@@ -588,6 +612,78 @@ xbridge_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
        *(volatile uint16_t *)((h + o) ^ 2) = v;
 }
 
+void
+xbridge_read_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    uint8_t *buf, bus_size_t len)
+{
+       volatile uint16_t *addr = (volatile uint16_t *)((h + o) ^ 2);
+       len >>= 1;
+       while (len-- != 0) {
+               *(uint16_t *)buf = *addr;
+               buf += 2;
+       }
+}
+
+void
+xbridge_write_raw_2(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const uint8_t *buf, bus_size_t len)
+{
+       volatile uint16_t *addr = (volatile uint16_t *)((h + o) ^ 2);
+       len >>= 1;
+       while (len-- != 0) {
+               *addr = *(uint16_t *)buf;
+               buf += 2;
+       }
+}
+
+void
+xbridge_read_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    uint8_t *buf, bus_size_t len)
+{
+       volatile uint32_t *addr = (volatile uint32_t *)(h + o);
+       len >>= 2;
+       while (len-- != 0) {
+               *(uint32_t *)buf = *addr;
+               buf += 4;
+       }
+}
+
+void
+xbridge_write_raw_4(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const uint8_t *buf, bus_size_t len)
+{
+       volatile uint32_t *addr = (volatile uint32_t *)(h + o);
+       len >>= 2;
+       while (len-- != 0) {
+               *addr = *(uint32_t *)buf;
+               buf += 4;
+       }
+}
+
+void
+xbridge_read_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    uint8_t *buf, bus_size_t len)
+{
+       volatile uint64_t *addr = (volatile uint64_t *)(h + o);
+       len >>= 3;
+       while (len-- != 0) {
+               *(uint64_t *)buf = *addr;
+               buf += 8;
+       }
+}
+
+void
+xbridge_write_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o,
+    const uint8_t *buf, bus_size_t len)
+{
+       volatile uint64_t *addr = (volatile uint64_t *)(h + o);
+       len >>= 3;
+       while (len-- != 0) {
+               *addr = *(uint64_t *)buf;
+               buf += 8;
+       }
+}
+
 /*
  * bus_dma helpers
  */