| 112 | } |
| 113 | |
| 114 | static struct resource * |
| 115 | obio_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 | |
| 159 | static int |
| 160 | obio_activate_resource(device_t bus, device_t child, int type, int rid, |
nothing calls this directly
no test coverage detected