puc(4) does strange things to resources in order to fool the
subdrivers to hook up. It should probably be rewritten to implement a simple bus to which the sub drivers attach using some kind of hint. Until then, provide a couple of crutch functions with big warning signs so it can survive the recent changes to struct resource.
This commit is contained in:
parent
29442a30e2
commit
64fd97df54
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150698
@ -316,8 +316,7 @@ puc_attach(device_t dev, const struct puc_device_description *desc)
|
||||
if (sc->barmuxed == 0) {
|
||||
rle->res = sc->sc_bar_mappings[bidx].res;
|
||||
} else {
|
||||
rle->res = malloc(sizeof(struct resource), M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
rle->res = rman_secret_puc_alloc_resource(M_WAITOK);
|
||||
if (rle->res == NULL) {
|
||||
free(pdev, M_DEVBUF);
|
||||
return (ENOMEM);
|
||||
@ -352,7 +351,7 @@ puc_attach(device_t dev, const struct puc_device_description *desc)
|
||||
if (sc->barmuxed) {
|
||||
bus_space_unmap(rman_get_bustag(rle->res),
|
||||
rman_get_bushandle(rle->res), ressz);
|
||||
free(rle->res, M_DEVBUF);
|
||||
rman_secret_puc_free_resource(rle->res);
|
||||
free(pdev, M_DEVBUF);
|
||||
}
|
||||
continue;
|
||||
@ -372,7 +371,7 @@ puc_attach(device_t dev, const struct puc_device_description *desc)
|
||||
if (sc->barmuxed) {
|
||||
bus_space_unmap(rman_get_bustag(rle->res),
|
||||
rman_get_bushandle(rle->res), ressz);
|
||||
free(rle->res, M_DEVBUF);
|
||||
rman_secret_puc_free_resource(rle->res);
|
||||
free(pdev, M_DEVBUF);
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +98,31 @@ int_alloc_resource(int malloc_flag)
|
||||
return (r);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX: puc.c is a big hack.
|
||||
* XXX: it should be rewritten to act like a bridge and offer
|
||||
* XXX: its own resource manager.
|
||||
* XXX: until somebody has time, help it out with these two functions
|
||||
*/
|
||||
|
||||
struct resource *
|
||||
rman_secret_puc_alloc_resource(int malloc_flag)
|
||||
{
|
||||
struct resource_i *r;
|
||||
|
||||
r = int_alloc_resource(malloc_flag);
|
||||
if (r)
|
||||
return (&r->r_r);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
rman_secret_puc_free_resource(struct resource *r)
|
||||
{
|
||||
|
||||
free(r->__r_i, M_RMAN);
|
||||
}
|
||||
|
||||
int
|
||||
rman_init(struct rman *rm)
|
||||
{
|
||||
|
@ -174,6 +174,15 @@ void rman_set_start(struct resource *_r, u_long _start);
|
||||
void rman_set_virtual(struct resource *_r, void *_v);
|
||||
|
||||
extern struct rman_head rman_head;
|
||||
|
||||
/*
|
||||
* XXX: puc.c is a big hack.
|
||||
* XXX: it should be rewritten to act like a bridge and offer
|
||||
* XXX: its own resource manager.
|
||||
* XXX: until somebody has time, help it out with these two functions
|
||||
*/
|
||||
struct resource *rman_secret_puc_alloc_resource(int malloc_flag);
|
||||
void rman_secret_puc_free_resource(struct resource *r);
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_SYS_RMAN_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user