Don't define __RMAN_RESOURCE_VISISBLE. They aren't needed here after

I've converted the direct accessing of struct resource members to the
preferred interface.
This commit is contained in:
Warner Losh 2004-07-03 20:11:49 +00:00
parent cfa5e80af8
commit 8b68b82381
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131534
2 changed files with 40 additions and 24 deletions

View File

@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
#include "opt_isa.h"
#define __RMAN_RESOURCE_VISIBLE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@ -303,6 +302,9 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
struct resource_list_entry *rle;
struct rman *rm;
int needactivate = flags & RF_ACTIVE;
#ifdef PC98
bus_space_handle_t bh;
#endif
/*
* If this is an allocation of the "default" range for a given RID, and
@ -352,25 +354,27 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
} else if (type == SYS_RES_IOPORT) {
rman_set_bustag(rv, I386_BUS_SPACE_IO);
#ifndef PC98
rman_set_bushandle(rv, rv->r_start);
rman_set_bushandle(rv, rman_get_start(rv));
#endif
}
#ifdef PC98
if ((type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) &&
i386_bus_space_handle_alloc(rv->r_bustag, rv->r_start, count,
&rv->r_bushandle) != 0) {
i386_bus_space_handle_alloc(rman_get_bustag(rv),
rman_get_start(rv), count, &bh) != 0) {
rman_release_resource(rv);
return 0;
}
rman_set_bushandle(rv, bh);
#endif
if (needactivate) {
if (bus_activate_resource(child, type, *rid, rv)) {
#ifdef PC98
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
i386_bus_space_handle_free(rv->r_bustag,
rv->r_bushandle, rv->r_bushandle->bsh_sz);
bh = rman_get_bushandle(rv);
i386_bus_space_handle_free(rman_get_bustag(rv),
bh, bh->bsh_sz);
}
#endif
rman_release_resource(rv);
@ -385,6 +389,9 @@ static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
#ifdef PC98
bus_space_handle_t bh;
#endif
/*
* If this is a memory resource, map it into the kernel.
*/
@ -410,7 +417,8 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid,
rman_set_virtual(r, vaddr);
#ifdef PC98
/* PC-98: the type of bus_space_handle_t is the structure. */
r->r_bushandle->bsh_base = (bus_addr_t) vaddr;
bh = rman_get_bushandle(r);
bh->bsh_base = (bus_addr_t) vaddr;
#else
/* IBM-PC: the type of bus_space_handle_t is u_int */
rman_set_bushandle(r, (bus_space_handle_t) vaddr);
@ -448,8 +456,10 @@ nexus_release_resource(device_t bus, device_t child, int type, int rid,
}
#ifdef PC98
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
i386_bus_space_handle_free(r->r_bustag, r->r_bushandle,
r->r_bushandle->bsh_sz);
bus_space_handle_t bh;
bh = rman_get_bushandle(r);
i386_bus_space_handle_free(rman_get_bustag(r), bh, bh->bsh_sz);
}
#endif
return (rman_release_resource(r));
@ -472,7 +482,7 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
panic("nexus_setup_intr: NULL irq resource!");
*cookiep = 0;
if ((irq->r_flags & RF_SHAREABLE) == 0)
if ((rman_get_flags(irq) & RF_SHAREABLE) == 0)
flags |= INTR_EXCL;
/*
@ -482,8 +492,8 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
if (error)
return (error);
error = intr_add_handler(device_get_nameunit(child), irq->r_start,
ihand, arg, flags, cookiep);
error = intr_add_handler(device_get_nameunit(child),
rman_get_start(irq), ihand, arg, flags, cookiep);
return (error);
}

View File

@ -147,6 +147,7 @@ isa_alloc_resourcev(device_t child, int type, int *rid,
device_t bus = device_get_parent(child);
bus_addr_t start;
bus_space_handle_t bh;
struct resource *re;
struct resource **bsre;
int i, j, k, linear_cnt, ressz, bsrid;
@ -193,8 +194,9 @@ isa_alloc_resourcev(device_t child, int type, int *rid,
}
}
re->r_bushandle->bsh_res = bsre;
re->r_bushandle->bsh_ressz = ressz;
bh = rman_get_bushandle(re);
bh->bsh_res = bsre;
bh->bsh_ressz = ressz;
return re;
}
@ -203,23 +205,25 @@ int
isa_load_resourcev(struct resource *re, bus_addr_t *res, bus_size_t count)
{
bus_addr_t start;
bus_space_handle_t bh;
int i;
if (count > re->r_bushandle->bsh_maxiatsz) {
bh = rman_get_bushandle(re);
if (count > bh->bsh_maxiatsz) {
printf("isa_load_resourcev: map size too large\n");
return EINVAL;
}
start = rman_get_start(re);
for (i = 0; i < re->r_bushandle->bsh_maxiatsz; i++) {
for (i = 0; i < bh->bsh_maxiatsz; i++) {
if (i < count)
re->r_bushandle->bsh_iat[i] = start + res[i];
bh->bsh_iat[i] = start + res[i];
else
re->r_bushandle->bsh_iat[i] = start;
bh->bsh_iat[i] = start;
}
re->r_bushandle->bsh_iatsz = count;
re->r_bushandle->bsh_bam = re->r_bustag->bs_ra; /* relocate access */
bh->bsh_iatsz = count;
bh->bsh_bam = rman_get_bustag(re)->bs_ra; /* relocate access */
return 0;
}
@ -237,13 +241,15 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
* defined in sys/i386/include/bus_pc98.h.
*/
int i;
bus_space_handle_t bh;
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
for (i = 1; i < r->r_bushandle->bsh_ressz; i++)
bh = rman_get_bushandle(r);
for (i = 1; i < bh->bsh_ressz; i++)
resource_list_release(rl, bus, child, type, rid + i,
r->r_bushandle->bsh_res[i]);
if (r->r_bushandle->bsh_res != NULL)
free(r->r_bushandle->bsh_res, M_DEVBUF);
bh->bsh_res[i]);
if (bh->bsh_res != NULL)
free(bh->bsh_res, M_DEVBUF);
}
#endif
return resource_list_release(rl, bus, child, type, rid, r);