Lines Matching refs:ctlr

139 	struct siis_controller *ctlr = device_get_softc(dev);  in siis_attach()  local
144 ctlr->dev = dev; in siis_attach()
149 ctlr->quirks = siis_ids[i].quirks; in siis_attach()
151 ctlr->r_grid = PCIR_BAR(0); in siis_attach()
152 if (!(ctlr->r_gmem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in siis_attach()
153 &ctlr->r_grid, RF_ACTIVE))) in siis_attach()
155 ctlr->gctl = ATA_INL(ctlr->r_gmem, SIIS_GCTL); in siis_attach()
157 ctlr->r_rid = PCIR_BAR(2); in siis_attach()
158 if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in siis_attach()
159 &ctlr->r_rid, RF_ACTIVE))) in siis_attach()
162 ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem); in siis_attach()
163 ctlr->sc_iomem.rm_end = rman_get_end(ctlr->r_mem); in siis_attach()
164 ctlr->sc_iomem.rm_type = RMAN_ARRAY; in siis_attach()
165 ctlr->sc_iomem.rm_descr = "I/O memory addresses"; in siis_attach()
166 if ((error = rman_init(&ctlr->sc_iomem)) != 0) { in siis_attach()
167 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); in siis_attach()
168 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_grid, ctlr->r_gmem); in siis_attach()
171 if ((error = rman_manage_region(&ctlr->sc_iomem, in siis_attach()
172 rman_get_start(ctlr->r_mem), rman_get_end(ctlr->r_mem))) != 0) { in siis_attach()
173 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); in siis_attach()
174 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_grid, ctlr->r_gmem); in siis_attach()
175 rman_fini(&ctlr->sc_iomem); in siis_attach()
182 ctlr->channels = siis_ids[i].ports; in siis_attach()
185 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); in siis_attach()
186 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_grid, ctlr->r_gmem); in siis_attach()
187 rman_fini(&ctlr->sc_iomem); in siis_attach()
191 for (unit = 0; unit < ctlr->channels; unit++) { in siis_attach()
205 struct siis_controller *ctlr = device_get_softc(dev); in siis_detach() local
214 if (ctlr->irq.r_irq) { in siis_detach()
215 bus_teardown_intr(dev, ctlr->irq.r_irq, in siis_detach()
216 ctlr->irq.handle); in siis_detach()
218 ctlr->irq.r_irq_rid, ctlr->irq.r_irq); in siis_detach()
222 rman_fini(&ctlr->sc_iomem); in siis_detach()
223 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); in siis_detach()
224 bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_grid, ctlr->r_gmem); in siis_detach()
231 struct siis_controller *ctlr = device_get_softc(dev); in siis_suspend() local
235 ctlr->gctl |= SIIS_GCTL_GRESET; in siis_suspend()
236 ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl); in siis_suspend()
243 struct siis_controller *ctlr = device_get_softc(dev); in siis_resume() local
249 ctlr->gctl |= SIIS_GCTL_GRESET; in siis_resume()
250 ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl); in siis_resume()
253 ctlr->gctl &= ~(SIIS_GCTL_GRESET | SIIS_GCTL_I2C_IE); in siis_resume()
254 ctlr->gctl |= 0x0000000f; in siis_resume()
255 ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, ctlr->gctl); in siis_resume()
262 struct siis_controller *ctlr = device_get_softc(dev); in siis_setup_interrupt() local
263 int msi = ctlr->quirks & SIIS_Q_NOMSI ? 0 : 1; in siis_setup_interrupt()
276 ctlr->irq.r_irq_rid = msi ? 1 : 0; in siis_setup_interrupt()
277 if (!(ctlr->irq.r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, in siis_setup_interrupt()
278 &ctlr->irq.r_irq_rid, RF_SHAREABLE | RF_ACTIVE))) { in siis_setup_interrupt()
282 if ((bus_setup_intr(dev, ctlr->irq.r_irq, ATA_INTR_FLAGS, NULL, in siis_setup_interrupt()
283 siis_intr, ctlr, &ctlr->irq.handle))) { in siis_setup_interrupt()
297 struct siis_controller *ctlr = (struct siis_controller *)data; in siis_intr() local
302 is = ATA_INL(ctlr->r_gmem, SIIS_IS); in siis_intr()
303 for (unit = 0; unit < ctlr->channels; unit++) { in siis_intr()
305 (arg = ctlr->interrupt[unit].argument)) { in siis_intr()
306 ctlr->interrupt[unit].function(arg); in siis_intr()
310 if (ctlr->irq.r_irq_rid) { in siis_intr()
311 ATA_OUTL(ctlr->r_gmem, SIIS_GCTL, in siis_intr()
312 ctlr->gctl | SIIS_GCTL_MSIACK); in siis_intr()
320 struct siis_controller *ctlr = device_get_softc(dev); in siis_alloc_resource() local
328 st = rman_get_start(ctlr->r_mem); in siis_alloc_resource()
329 res = rman_reserve_resource(&ctlr->sc_iomem, st + offset, in siis_alloc_resource()
334 bsh = rman_get_bushandle(ctlr->r_mem); in siis_alloc_resource()
335 bst = rman_get_bustag(ctlr->r_mem); in siis_alloc_resource()
343 res = ctlr->irq.r_irq; in siis_alloc_resource()
370 struct siis_controller *ctlr = device_get_softc(dev); in siis_setup_intr() local
377 ctlr->interrupt[unit].function = function; in siis_setup_intr()
378 ctlr->interrupt[unit].argument = argument; in siis_setup_intr()
386 struct siis_controller *ctlr = device_get_softc(dev); in siis_teardown_intr() local
389 ctlr->interrupt[unit].function = NULL; in siis_teardown_intr()
390 ctlr->interrupt[unit].argument = NULL; in siis_teardown_intr()
460 struct siis_controller *ctlr = device_get_softc(device_get_parent(dev)); in siis_ch_attach() local
467 ch->quirks = ctlr->quirks; in siis_ch_attach()