MCPcopy Create free account
hub / github.com/F-Stack/f-stack / obio_alloc_resource

Function obio_alloc_resource

freebsd/mips/malta/obio.c:114–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114static struct resource *
115obio_alloc_resource(device_t bus, device_t child, int type, int *rid,
116 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
117{
118 struct resource *rv;
119 struct rman *rm;
120 bus_space_tag_t bt = 0;
121 bus_space_handle_t bh = 0;
122 struct obio_softc *sc = device_get_softc(bus);
123
124 switch (type) {
125 case SYS_RES_IRQ:
126 rm = &sc->oba_irq_rman;
127 break;
128 case SYS_RES_MEMORY:
129 return (NULL);
130 case SYS_RES_IOPORT:
131 rm = &sc->oba_rman;
132 bt = sc->oba_st;
133 bh = sc->oba_addr;
134 start = bh;
135 break;
136 default:
137 return (NULL);
138 }
139
140 rv = rman_reserve_resource(rm, start, end, count, flags, child);
141 if (rv == NULL)
142 return (NULL);
143 if (type == SYS_RES_IRQ)
144 return (rv);
145 rman_set_rid(rv, *rid);
146 rman_set_bustag(rv, bt);
147 rman_set_bushandle(rv, bh);
148
149 if (0) {
150 if (bus_activate_resource(child, type, *rid, rv)) {
151 rman_release_resource(rv);
152 return (NULL);
153 }
154 }
155 return (rv);
156
157}
158
159static int
160obio_activate_resource(device_t bus, device_t child, int type, int rid,

Callers

nothing calls this directly

Calls 7

device_get_softcFunction · 0.85
rman_reserve_resourceFunction · 0.85
rman_set_ridFunction · 0.85
rman_set_bustagFunction · 0.85
rman_set_bushandleFunction · 0.85
bus_activate_resourceFunction · 0.85
rman_release_resourceFunction · 0.85

Tested by

no test coverage detected