Lines Matching refs:port

133 	struct puc_port *port;  in puc_intr()  local
177 port = &sc->sc_port[idx]; in puc_intr()
178 port->p_ipend = SERDEV_IPEND(port->p_dev); in puc_intr()
179 ipend |= port->p_ipend; in puc_intr()
196 port = &sc->sc_port[idx]; in puc_intr()
197 if (!(port->p_ipend & isrc)) in puc_intr()
199 if (port->p_ihsrc[i] != NULL) in puc_intr()
200 (*port->p_ihsrc[i])(port->p_iharg); in puc_intr()
214 struct puc_port *port; in puc_bfe_attach() local
272 port = &sc->sc_port[idx]; in puc_bfe_attach()
273 port->p_nr = idx + 1; in puc_bfe_attach()
277 port->p_type = res; in puc_bfe_attach()
286 port->p_bar = bar; in puc_bfe_attach()
298 port->p_rres = rman_reserve_resource(rm, start + ofs, in puc_bfe_attach()
300 if (port->p_rres != NULL) { in puc_bfe_attach()
304 rman_set_bushandle(port->p_rres, bsh); in puc_bfe_attach()
305 rman_set_bustag(port->p_rres, bst); in puc_bfe_attach()
307 port->p_ires = rman_reserve_resource(&sc->sc_irq, port->p_nr, in puc_bfe_attach()
308 port->p_nr, 1, 0, NULL); in puc_bfe_attach()
309 if (port->p_ires == NULL) { in puc_bfe_attach()
316 port->p_rclk = res; in puc_bfe_attach()
318 port->p_dev = device_add_child(dev, NULL, DEVICE_UNIT_ANY); in puc_bfe_attach()
319 if (port->p_dev != NULL) in puc_bfe_attach()
320 device_set_ivars(port->p_dev, (void *)port); in puc_bfe_attach()
356 port = &sc->sc_port[idx]; in puc_bfe_attach()
357 if (port->p_dev == NULL) in puc_bfe_attach()
359 error = device_probe_and_attach(port->p_dev); in puc_bfe_attach()
361 device_delete_child(dev, port->p_dev); in puc_bfe_attach()
362 port->p_dev = NULL; in puc_bfe_attach()
378 port = &sc->sc_port[idx]; in puc_bfe_attach()
379 if (port->p_rres != NULL) in puc_bfe_attach()
380 rman_release_resource(port->p_rres); in puc_bfe_attach()
381 if (port->p_ires != NULL) in puc_bfe_attach()
382 rman_release_resource(port->p_ires); in puc_bfe_attach()
404 struct puc_port *port; in puc_bfe_detach() local
416 port = &sc->sc_port[idx]; in puc_bfe_detach()
417 if (port->p_dev == NULL) in puc_bfe_detach()
419 if (port->p_rres != NULL) in puc_bfe_detach()
420 rman_release_resource(port->p_rres); in puc_bfe_detach()
421 if (port->p_ires != NULL) in puc_bfe_detach()
422 rman_release_resource(port->p_ires); in puc_bfe_detach()
475 struct puc_port *port; in puc_bus_alloc_resource() local
487 port = device_get_ivars(child); in puc_bus_alloc_resource()
488 KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); in puc_bus_alloc_resource()
497 if (type == port->p_bar->b_type) in puc_bus_alloc_resource()
498 res = port->p_rres; in puc_bus_alloc_resource()
500 res = port->p_ires; in puc_bus_alloc_resource()
528 struct puc_port *port; in puc_bus_release_resource() local
538 port = device_get_ivars(child); in puc_bus_release_resource()
539 KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); in puc_bus_release_resource()
544 if (res == port->p_ires) { in puc_bus_release_resource()
545 if (port->p_hasintr) in puc_bus_release_resource()
547 } else if (res != port->p_rres) in puc_bus_release_resource()
562 struct puc_port *port; in puc_bus_get_resource() local
572 port = device_get_ivars(child); in puc_bus_get_resource()
573 KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); in puc_bus_get_resource()
575 if (type == port->p_bar->b_type) in puc_bus_get_resource()
576 res = port->p_rres; in puc_bus_get_resource()
578 res = port->p_ires; in puc_bus_get_resource()
597 struct puc_port *port; in puc_bus_setup_intr() local
611 port = device_get_ivars(child); in puc_bus_setup_intr()
612 KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); in puc_bus_setup_intr()
614 if (cookiep == NULL || res != port->p_ires) in puc_bus_setup_intr()
617 if (port->p_type == PUC_TYPE_SERIAL && ihand != NULL) in puc_bus_setup_intr()
619 if (rman_get_device(port->p_ires) != originator) in puc_bus_setup_intr()
628 if (port->p_type == PUC_TYPE_SERIAL) { in puc_bus_setup_intr()
631 port->p_ihsrc[i] = SERDEV_IHAND(originator, isrc); in puc_bus_setup_intr()
632 if (port->p_ihsrc[i] != NULL) in puc_bus_setup_intr()
641 sc->sc_serdevs |= 1UL << (port->p_nr - 1); in puc_bus_setup_intr()
643 port->p_hasintr = 1; in puc_bus_setup_intr()
644 port->p_iharg = arg; in puc_bus_setup_intr()
646 *cookiep = port; in puc_bus_setup_intr()
654 struct puc_port *port; in puc_bus_teardown_intr() local
668 port = device_get_ivars(child); in puc_bus_teardown_intr()
669 KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); in puc_bus_teardown_intr()
671 if (res != port->p_ires) in puc_bus_teardown_intr()
673 if (rman_get_device(port->p_ires) != originator) in puc_bus_teardown_intr()
676 if (!port->p_hasintr) in puc_bus_teardown_intr()
680 if (cookie != port) in puc_bus_teardown_intr()
683 port->p_hasintr = 0; in puc_bus_teardown_intr()
684 port->p_iharg = NULL; in puc_bus_teardown_intr()
687 port->p_ihsrc[i] = NULL; in puc_bus_teardown_intr()
695 struct puc_port *port; in puc_bus_read_ivar() local
703 port = device_get_ivars(child); in puc_bus_read_ivar()
704 KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); in puc_bus_read_ivar()
711 *result = port->p_rclk; in puc_bus_read_ivar()
714 *result = port->p_type; in puc_bus_read_ivar()
725 struct puc_port *port; in puc_bus_print_child() local
728 port = device_get_ivars(child); in puc_bus_print_child()
732 retval += printf(" at port %d", port->p_nr); in puc_bus_print_child()
741 struct puc_port *port; in puc_bus_child_location() local
743 port = device_get_ivars(child); in puc_bus_child_location()
744 sbuf_printf(sb, "port=%d", port->p_nr); in puc_bus_child_location()
751 struct puc_port *port; in puc_bus_child_pnpinfo() local
753 port = device_get_ivars(child); in puc_bus_child_pnpinfo()
754 sbuf_printf(sb, "type=%d", port->p_type); in puc_bus_child_pnpinfo()