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

Function obio_alloc_resource

freebsd/mips/cavium/obio.c:122–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122static struct resource *
123obio_alloc_resource(device_t bus, device_t child, int type, int *rid,
124 rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
125{
126 struct resource *rv;
127 struct rman *rm;
128 bus_space_tag_t bt = 0;
129 bus_space_handle_t bh = 0;
130 struct obio_softc *sc = device_get_softc(bus);
131
132 switch (type) {
133 case SYS_RES_IRQ:
134 switch (device_get_unit(child)) {
135 case 0:
136 start = end = OCTEON_IRQ_UART0;
137 break;
138 case 1:
139 start = end = OCTEON_IRQ_UART1;
140 break;
141 default:
142 return (NULL);
143 }
144 rm = &sc->oba_irq_rman;
145 break;
146 case SYS_RES_MEMORY:
147 return (NULL);
148 case SYS_RES_IOPORT:
149 rm = &sc->oba_rman;
150 bt = &octeon_uart_tag;
151 bh = CVMX_MIO_UARTX_RBR(device_get_unit(child));
152 start = bh;
153 break;
154 default:
155 return (NULL);
156 }
157
158 rv = rman_reserve_resource(rm, start, end, count, flags, child);
159 if (rv == NULL) {
160 return (NULL);
161 }
162 if (type == SYS_RES_IRQ) {
163 return (rv);
164 }
165 rman_set_rid(rv, *rid);
166 rman_set_bustag(rv, bt);
167 rman_set_bushandle(rv, bh);
168
169 if (0) {
170 if (bus_activate_resource(child, type, *rid, rv)) {
171 rman_release_resource(rv);
172 return (NULL);
173 }
174 }
175 return (rv);
176
177}
178
179static int

Callers

nothing calls this directly

Calls 9

device_get_softcFunction · 0.85
device_get_unitFunction · 0.85
CVMX_MIO_UARTX_RBRFunction · 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