summaryrefslogtreecommitdiffstats
path: root/sys/arm/xscale
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2005-09-25 21:06:50 +0000
committercognet <cognet@FreeBSD.org>2005-09-25 21:06:50 +0000
commitc29db74a1dfa1602e82f3930206670b2f97ac86a (patch)
tree5f88b1817b03154839245df7933fa4770c364c8f /sys/arm/xscale
parent8f159104044d99aba9a96d75f191aa76b33e1a02 (diff)
downloadFreeBSD-src-c29db74a1dfa1602e82f3930206670b2f97ac86a.zip
FreeBSD-src-c29db74a1dfa1602e82f3930206670b2f97ac86a.tar.gz
Fix multiple abuses of __RMAN_RESOURCE_VISIBLE in the arm code.
Spotted out by: phk
Diffstat (limited to 'sys/arm/xscale')
-rw-r--r--sys/arm/xscale/i80321/i80321_pci.c10
-rw-r--r--sys/arm/xscale/i80321/i80321var.h2
-rw-r--r--sys/arm/xscale/i80321/iq80321.c20
-rw-r--r--sys/arm/xscale/i80321/obio.c24
-rw-r--r--sys/arm/xscale/i80321/obiovar.h5
5 files changed, 31 insertions, 30 deletions
diff --git a/sys/arm/xscale/i80321/i80321_pci.c b/sys/arm/xscale/i80321/i80321_pci.c
index 50ebe49..0c21b34 100644
--- a/sys/arm/xscale/i80321/i80321_pci.c
+++ b/sys/arm/xscale/i80321/i80321_pci.c
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
-#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h>
#include <machine/bus.h>
@@ -353,16 +352,9 @@ i80321_pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
bus_space_tag_t bt = NULL;
bus_space_handle_t bh = 0;
- if (type == SYS_RES_IRQ) {
- rv = malloc(sizeof(*rv), M_DEVBUF, M_WAITOK);
- rv->r_start = start;
- rv->r_end = end;
- rv->r_rid = *rid;
- return (rv);
- }
switch (type) {
case SYS_RES_IRQ:
- rm = &sc->sc_mem_rman;
+ rm = &sc->sc_irq_rman;
break;
case SYS_RES_MEMORY:
rm = &sc->sc_mem_rman;
diff --git a/sys/arm/xscale/i80321/i80321var.h b/sys/arm/xscale/i80321/i80321var.h
index fef194b..903b18e 100644
--- a/sys/arm/xscale/i80321/i80321var.h
+++ b/sys/arm/xscale/i80321/i80321var.h
@@ -43,6 +43,7 @@
#include <sys/queue.h>
#include <dev/pci/pcivar.h>
+#include <sys/rman.h>
/*
* There are roughly 32 interrupt sources.
@@ -107,6 +108,7 @@ struct i80321_softc {
/* GPIO state */
uint8_t sc_gpio_dir; /* GPIO pin direction (1 == output) */
uint8_t sc_gpio_val; /* GPIO output pin value */
+ struct rman sc_irq_rman;
};
void i80321_sdram_bounds(bus_space_tag_t, bus_space_handle_t,
diff --git a/sys/arm/xscale/i80321/iq80321.c b/sys/arm/xscale/i80321/iq80321.c
index 3292406..32a9981 100644
--- a/sys/arm/xscale/i80321/iq80321.c
+++ b/sys/arm/xscale/i80321/iq80321.c
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/malloc.h>
-#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h>
#include <machine/bus.h>
#include <machine/intr.h>
@@ -251,6 +250,12 @@ iq80321_attach(device_t dev)
busno = PCIXSR_BUSNO(busno);
if (busno == 0xff)
busno = 0;
+ sc->sc_irq_rman.rm_type = RMAN_ARRAY;
+ sc->sc_irq_rman.rm_descr = "i80321 IRQs";
+ if (rman_init(&sc->sc_irq_rman) != 0 ||
+ rman_manage_region(&sc->sc_irq_rman, 0, 25) != 0)
+ panic("i80321_attach: failed to set up IRQ rman");
+
device_add_child(dev, "obio", 0);
device_add_child(dev, "itimer", 0);
device_add_child(dev, "iopwdog", 0);
@@ -291,12 +296,11 @@ static struct resource *
iq80321_alloc_resource(device_t dev, device_t child, int type, int *rid,
u_long start, u_long end, u_long count, u_int flags)
{
- if (type == SYS_RES_IRQ) {
- struct resource *res = malloc(sizeof(*res), M_DEVBUF, M_WAITOK);
- res->r_start = start;
- res->r_end = end;
- return (res);
- }
+ struct i80321_softc *sc = device_get_softc(dev);
+
+ if (type == SYS_RES_IRQ)
+ return (rman_reserve_resource(&sc->sc_irq_rman,
+ start, end, count, flags, child));
return (NULL);
}
@@ -307,7 +311,7 @@ iq80321_setup_intr(device_t dev, device_t child,
{
BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, intr, arg,
cookiep);
- intr_enabled |= 1 << ires->r_start;
+ intr_enabled |= 1 << rman_get_start(ires);
i80321_set_intrmask();
return (0);
diff --git a/sys/arm/xscale/i80321/obio.c b/sys/arm/xscale/i80321/obio.c
index 523f14e..a79dcf0 100644
--- a/sys/arm/xscale/i80321/obio.c
+++ b/sys/arm/xscale/i80321/obio.c
@@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
-#define __RMAN_RESOURCE_VISIBLE
#include <sys/rman.h>
#include <sys/malloc.h>
@@ -82,6 +81,11 @@ obio_attach(device_t dev)
rman_manage_region(&sc->oba_rman,
sc->oba_addr, sc->oba_addr + sc->oba_size) != 0)
panic("obio_attach: failed to set up I/O rman");
+ sc->oba_irq_rman.rm_type = RMAN_ARRAY;
+ sc->oba_irq_rman.rm_descr = "OBIO IRQ";
+ if (rman_init(&sc->oba_irq_rman) != 0 ||
+ rman_manage_region(&sc->oba_irq_rman, 28, 28) != 0)
+ panic("obio_attach: failed to set up IRQ rman");
device_add_child(dev, "uart", 0);
bus_generic_probe(dev);
bus_generic_attach(dev);
@@ -94,34 +98,32 @@ obio_alloc_resource(device_t bus, device_t child, int type, int *rid,
{
struct resource *rv;
struct rman *rm;
- bus_space_tag_t bt;
- bus_space_handle_t bh;
+ bus_space_tag_t bt = NULL;
+ bus_space_handle_t bh = 0;
struct obio_softc *sc = device_get_softc(bus);
- if (type == SYS_RES_IRQ) {
- rv = malloc(sizeof(*rv), M_DEVBUF, M_WAITOK);
- rv->r_start = 28;
- rv->r_end = 28;
- rv->r_rid = *rid;
- return (rv);
- }
switch (type) {
+ case SYS_RES_IRQ:
+ rm = &sc->oba_irq_rman;
+ break;
case SYS_RES_MEMORY:
return (NULL);
case SYS_RES_IOPORT:
rm = &sc->oba_rman;
bt = sc->oba_st;
bh = sc->oba_addr;
+ start = bh;
break;
default:
return (NULL);
}
- start = bh;
rv = rman_reserve_resource(rm, start, end, count, flags, child);
if (rv == NULL)
return (NULL);
+ if (type == SYS_RES_IRQ)
+ return (rv);
rman_set_bustag(rv, bt);
rman_set_bushandle(rv, bh);
diff --git a/sys/arm/xscale/i80321/obiovar.h b/sys/arm/xscale/i80321/obiovar.h
index 8d8c5c5..8e0c145 100644
--- a/sys/arm/xscale/i80321/obiovar.h
+++ b/sys/arm/xscale/i80321/obiovar.h
@@ -41,7 +41,8 @@
#ifndef _IQ80321_OBIOVAR_H_
#define _IQ80321_OBIOVAR_H_
-#ifdef __RMAN_RESOURCE_VISIBLE
+#include <sys/rman.h>
+
struct obio_softc {
bus_space_tag_t oba_st; /* bus space tag */
bus_addr_t oba_addr; /* address of device */
@@ -49,9 +50,9 @@ struct obio_softc {
int oba_width; /* bus width */
int oba_irq; /* XINT interrupt bit # */
struct rman oba_rman;
+ struct rman oba_irq_rman;
};
-#endif /* __RMAN_RESOURCE_VISIBLE */
extern struct bus_space obio_bs_tag;
#endif /* _IQ80321_OBIOVAR_H_ */
OpenPOWER on IntegriCloud