summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/include
diff options
context:
space:
mode:
authorjmg <jmg@FreeBSD.org>2003-06-22 01:26:08 +0000
committerjmg <jmg@FreeBSD.org>2003-06-22 01:26:08 +0000
commite6efd8ec4391d9b20c677c9b0a816b41e4036b17 (patch)
tree3d354a8901826de77f4cef10d8ec211e9bbddb94 /sys/sparc64/include
parent752ed0a2b93a05db0bf35585d603eac4ae2bd079 (diff)
downloadFreeBSD-src-e6efd8ec4391d9b20c677c9b0a816b41e4036b17.zip
FreeBSD-src-e6efd8ec4391d9b20c677c9b0a816b41e4036b17.tar.gz
add support for peeking at pci busses on UltraSparc systems. This prevents
data access errors when trying to read/write to non-existant PCI devices. fix the psycho bridge to use peek for probing devices. This no longer fakes it if the OFW node doesn't exist (and the reg == 0). Reviewed by: jake, tmm
Diffstat (limited to 'sys/sparc64/include')
-rw-r--r--sys/sparc64/include/bus.h27
-rw-r--r--sys/sparc64/include/cpufunc.h9
2 files changed, 36 insertions, 0 deletions
diff --git a/sys/sparc64/include/bus.h b/sys/sparc64/include/bus.h
index e3ca847..2a3e5a6 100644
--- a/sys/sparc64/include/bus.h
+++ b/sys/sparc64/include/bus.h
@@ -811,6 +811,33 @@ bus_space_copy_region_stream_8(bus_space_tag_t t, bus_space_handle_t h1,
bus_space_write_stream_8(t, h1, o1, bus_space_read_8(t, h2, o2));
}
+static __inline int
+bus_space_peek_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
+ u_int8_t *a)
+{
+
+ __BUS_DEBUG_ACCESS(h, o, "peek", 1);
+ return (fasword8(bus_type_asi[t->bst_type], (caddr_t)(h + o), a));
+}
+
+static __inline int
+bus_space_peek_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
+ u_int16_t *a)
+{
+
+ __BUS_DEBUG_ACCESS(h, o, "peek", 2);
+ return (fasword16(bus_type_asi[t->bst_type], (caddr_t)(h + o), a));
+}
+
+static __inline int
+bus_space_peek_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
+ u_int32_t *a)
+{
+
+ __BUS_DEBUG_ACCESS(h, o, "peek", 4);
+ return (fasword32(bus_type_asi[t->bst_type], (caddr_t)(h + o), a));
+}
+
/* Back-compat functions for old ISA drivers */
extern bus_space_tag_t isa_io_bt;
extern bus_space_handle_t isa_io_hdl;
diff --git a/sys/sparc64/include/cpufunc.h b/sys/sparc64/include/cpufunc.h
index 86e7ae5..4c2c9f8 100644
--- a/sys/sparc64/include/cpufunc.h
+++ b/sys/sparc64/include/cpufunc.h
@@ -136,6 +136,15 @@ STNC_GEN(u_long, stxa);
#define stwa(va, asi, val) ST_GENERIC(va, asi, val, stwa)
#define stxa(va, asi, val) ST_GENERIC(va, asi, val, stxa)
+/*
+ * Attempt to read from addr, val. If a Data Access Error trap happens,
+ * they return -1 and the contents of val is undefined. A return of 0
+ * means no trap happened, and the contents of val is valid.
+ */
+int fasword8(u_long asi, void *addr, uint8_t *val);
+int fasword16(u_long asi, void *addr, uint16_t *val);
+int fasword32(u_long asi, void *addr, uint32_t *val);
+
#define membar(mask) do { \
__asm __volatile("membar %0" : : "n" (mask) : "memory"); \
} while (0)
OpenPOWER on IntegriCloud