summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2010-04-02 12:11:56 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2010-04-02 12:11:56 +0000
commit701c2b078845c51c09de96300f02ae04dfe98d90 (patch)
tree6f91f3444e28deede75cc99e1830210ac09afa89 /sys
parente5c29b46b0b4ce0a51ed98e9784b9946b6a605b2 (diff)
Remove parent/slave mode of rbus as nothing uses it.
ok kettenis, sgi usage of rbus_new_body() pointed out by miod
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sgi/xbow/xbridge.c4
-rw-r--r--sys/dev/cardbus/rbus.c89
-rw-r--r--sys/dev/cardbus/rbus.h28
3 files changed, 14 insertions, 107 deletions
diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c
index c67a90d8aa0..a6f6dc56474 100644
--- a/sys/arch/sgi/xbow/xbridge.c
+++ b/sys/arch/sgi/xbow/xbridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbridge.c,v 1.68 2010/03/28 17:12:41 miod Exp $ */
+/* $OpenBSD: xbridge.c,v 1.69 2010/04/02 12:11:55 jsg Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -3511,7 +3511,7 @@ xbridge_rbus_parent_io(struct pci_attach_args *pa)
* resources, return a valid body which will fail requests.
*/
if (rb == NULL)
- rb = rbus_new_body(pa->pa_iot, NULL, NULL, 0, 0, 0,
+ rb = rbus_new_body(pa->pa_iot, NULL, 0, 0, 0,
RBUS_SPACE_INVALID);
return rb;
diff --git a/sys/dev/cardbus/rbus.c b/sys/dev/cardbus/rbus.c
index 5adeac91afb..ee46b145f99 100644
--- a/sys/dev/cardbus/rbus.c
+++ b/sys/dev/cardbus/rbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rbus.c,v 1.14 2010/01/13 09:10:33 jsg Exp $ */
+/* $OpenBSD: rbus.c,v 1.15 2010/04/02 12:11:55 jsg Exp $ */
/* $NetBSD: rbus.c,v 1.3 1999/11/06 06:20:53 soren Exp $ */
/*
* Copyright (c) 1999
@@ -81,10 +81,7 @@ rbus_space_alloc_subregion(rbus_tag_t rbt, bus_addr_t substart,
decodesize = 0;
}
- if (rbt->rb_flags == RBUS_SPACE_ASK_PARENT) {
- return (rbus_space_alloc(rbt->rb_parent, addr, size, mask,
- align, flags, addrp, bshp));
- } else if (rbt->rb_flags == RBUS_SPACE_SHARE ||
+ if (rbt->rb_flags == RBUS_SPACE_SHARE ||
rbt->rb_flags == RBUS_SPACE_DEDICATE) {
/* rbt has its own sh_extent */
@@ -160,9 +157,7 @@ rbus_space_free(rbus_tag_t rbt, bus_space_handle_t bsh, bus_size_t size,
bus_addr_t addr;
int status = 1;
- if (rbt->rb_flags == RBUS_SPACE_ASK_PARENT) {
- status = rbus_space_free(rbt->rb_parent, bsh, size, &addr);
- } else if (rbt->rb_flags == RBUS_SPACE_SHARE ||
+ if (rbt->rb_flags == RBUS_SPACE_SHARE ||
rbt->rb_flags == RBUS_SPACE_DEDICATE) {
md_space_unmap(rbt, bsh, size, &addr);
@@ -182,35 +177,23 @@ rbus_space_free(rbus_tag_t rbt, bus_space_handle_t bsh, bus_size_t size,
/*
* rbus_tag_t
- * rbus_new_body(bus_space_tag_t bt, rbus_tag_t parent,
+ * rbus_new_body(bus_space_tag_t bt,
* struct extent *ex, bus_addr_t start, bus_size_t end,
* bus_addr_t offset, int flags)
*
*/
rbus_tag_t
-rbus_new_body(bus_space_tag_t bt, rbus_tag_t parent, struct extent *ex,
+rbus_new_body(bus_space_tag_t bt, struct extent *ex,
bus_addr_t start, bus_addr_t end, bus_addr_t offset, int flags)
{
rbus_tag_t rb;
- /* sanity check */
- if (parent != NULL) {
- if (start < parent->rb_start || end > parent->rb_end) {
- /* out of range: [start, size] should be contained
- * in parent space
- */
- return (0);
- /* Should I invoke panic? */
- }
- }
-
if ((rb = (rbus_tag_t)malloc(sizeof(struct rbustag), M_DEVBUF,
M_NOWAIT)) == NULL) {
panic("no memory for rbus instance");
}
rb->rb_bt = bt;
- rb->rb_parent = parent;
rb->rb_start = start;
rb->rb_end = end;
rb->rb_offset = offset;
@@ -220,50 +203,13 @@ rbus_new_body(bus_space_tag_t bt, rbus_tag_t parent, struct extent *ex,
DPRINTF(("rbus_new_body: [%lx, %lx] type %s name [%s]\n",
(u_long)start, (u_long)end,
flags == RBUS_SPACE_SHARE ? "share" :
- flags == RBUS_SPACE_DEDICATE ? "dedicated" :
- flags == RBUS_SPACE_ASK_PARENT ? "parent" : "invalid",
+ flags == RBUS_SPACE_DEDICATE ? "dedicated" : "invalid",
ex != NULL ? ex->ex_name : "noname"));
return (rb);
}
/*
- * rbus_tag_t rbus_new(rbus_tag_t parent, bus_addr_t start, bus_size_t
- * size, bus_addr_t offset, int flags)
- *
- * This function makes a new child rbus instance.
- */
-rbus_tag_t
-rbus_new(rbus_tag_t parent, bus_addr_t start, bus_size_t size,
- bus_addr_t offset, int flags)
-{
- rbus_tag_t rb;
- struct extent *ex = NULL;
- bus_addr_t end = start + size;
-
- if (flags == RBUS_SPACE_SHARE) {
- ex = parent->rb_ext;
- } else if (flags == RBUS_SPACE_DEDICATE) {
- if ((ex = extent_create("rbus", start, end, M_DEVBUF, NULL, 0,
- EX_NOCOALESCE|EX_NOWAIT)) == NULL)
- return (NULL);
- } else if (flags == RBUS_SPACE_ASK_PARENT) {
- ex = NULL;
- } else {
- /* Invalid flag */
- return (0);
- }
-
- rb = rbus_new_body(parent->rb_bt, parent, ex, start, start + size,
- offset, flags);
-
- if ((rb == NULL) && (flags == RBUS_SPACE_DEDICATE))
- extent_destroy(ex);
-
- return (rb);
-}
-
-/*
* rbus_tag_t rbus_new_root_delegate(bus_space_tag, bus_addr_t,
* bus_size_t, bus_addr_t offset)
*
@@ -280,7 +226,7 @@ rbus_new_root_delegate(bus_space_tag_t bt, bus_addr_t start, bus_size_t size,
NULL, 0, EX_NOCOALESCE|EX_NOWAIT)) == NULL)
return (NULL);
- rb = rbus_new_body(bt, NULL, ex, start, start + size, offset,
+ rb = rbus_new_body(bt, ex, start, start + size, offset,
RBUS_SPACE_DEDICATE);
if (rb == NULL)
@@ -308,25 +254,6 @@ rbus_new_root_share(bus_space_tag_t bt, struct extent *ex, bus_addr_t start,
/* Should I invoke panic? */
}
- return (rbus_new_body(bt, NULL, ex, start, start + size, offset,
+ return (rbus_new_body(bt, ex, start, start + size, offset,
RBUS_SPACE_SHARE));
}
-
-/*
- * int rbus_delete (rbus_tag_t rb)
- *
- * This function deletes the rbus structure pointed in the argument.
- */
-int
-rbus_delete(rbus_tag_t rb)
-{
- DPRINTF(("rbus_delete called [%s]\n", rb->rb_ext != NULL ?
- rb->rb_ext->ex_name : "noname"));
-
- if (rb->rb_flags == RBUS_SPACE_DEDICATE)
- extent_destroy(rb->rb_ext);
-
- free(rb, M_DEVBUF);
-
- return (0);
-}
diff --git a/sys/dev/cardbus/rbus.h b/sys/dev/cardbus/rbus.h
index 6ae5cb9950c..5ee159fcc09 100644
--- a/sys/dev/cardbus/rbus.h
+++ b/sys/dev/cardbus/rbus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rbus.h,v 1.8 2010/01/13 09:10:33 jsg Exp $ */
+/* $OpenBSD: rbus.h,v 1.9 2010/04/02 12:11:55 jsg Exp $ */
/* $NetBSD: rbus.h,v 1.3 1999/12/15 12:28:55 kleink Exp $ */
/*
* Copyright (c) 1999
@@ -51,14 +51,10 @@
*
* Abstraction
*
- * rbus can model a bus-to-bus bridge in three ways: dedicated, shared
- * and slave.
+ * rbus can model a bus-to-bus bridge in two ways: dedicated or shared
* Dedicated: the bridge has its own bus space.
* Shared: the bridge has bus space, but this bus space is
* shared with other bus bridges.
- * Slave: the bus bridge does not have its own bus space and has to ask
- * a parent bus bridge for bus space once a client is requesting bus space
- * to the bridge.
*/
@@ -71,15 +67,11 @@ struct extent;
/*
* General rule
*
- * 1) When a rbustag has no space for child (meaning: rb_extent is
- * NULL), ask bus-space for parent through rb_parent.
- *
- * 2) When a rbustag has its own space (whether shared or dedicated),
+ * 1) When a rbustag has its own space (whether shared or dedicated),
* allocate from rb_ext.
*/
struct rbustag {
bus_space_tag_t rb_bt;
- struct rbustag *rb_parent;
struct extent *rb_ext;
bus_addr_t rb_start;
bus_addr_t rb_end;
@@ -96,7 +88,6 @@ struct rbustag {
#define RBUS_SPACE_SHARE 0x01
#define RBUS_SPACE_DEDICATE 0x02
#define RBUS_SPACE_MASK 0x03
-#define RBUS_SPACE_ASK_PARENT 0x04
/* your own data below */
void *rb_md;
};
@@ -124,28 +115,17 @@ int rbus_space_free(rbus_tag_t, bus_space_handle_t, bus_size_t,
* These functions create rbus instance. These functions are
* so-called-as a constructor of rbus.
*
- * rbus_new is a constructor which make an rbus instance from a parent
- * rbus.
*/
-rbus_tag_t rbus_new_body(bus_space_tag_t, rbus_tag_t, struct extent *,
+rbus_tag_t rbus_new_body(bus_space_tag_t, struct extent *,
bus_addr_t, bus_addr_t, bus_addr_t, int);
-rbus_tag_t rbus_new(rbus_tag_t, bus_addr_t, bus_size_t, bus_addr_t, int);
-
rbus_tag_t rbus_new_root_delegate(bus_space_tag_t, bus_addr_t, bus_size_t,
bus_addr_t);
rbus_tag_t rbus_new_root_share(bus_space_tag_t, struct extent *,
bus_addr_t, bus_size_t, bus_addr_t);
/*
- * This function release bus-space used by the argument. This
- * function is so-called-as a destructor.
- */
-int rbus_delete(rbus_tag_t);
-
-
-/*
* Machine-dependent definitions.
*/
#include <machine/rbus_machdep.h>