Lines Matching refs:dcp

310 	struct devctl_iocdata *dcp;  in ndi_dc_allochdl()  local
315 dcp = kmem_zalloc(sizeof (*dcp), KM_SLEEP); in ndi_dc_allochdl()
318 if (copyin(iocarg, dcp, sizeof (*dcp)) != 0) { in ndi_dc_allochdl()
319 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
328 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
331 dcp->cmd = (uint_t)dcp32.cmd; in ndi_dc_allochdl()
332 dcp->flags = (uint_t)dcp32.flags; in ndi_dc_allochdl()
333 dcp->cpyout_buf = (uint_t *)(uintptr_t)dcp32.cpyout_buf; in ndi_dc_allochdl()
334 dcp->nvl_user = (nvlist_t *)(uintptr_t)dcp32.nvl_user; in ndi_dc_allochdl()
335 dcp->nvl_usersz = (size_t)dcp32.nvl_usersz; in ndi_dc_allochdl()
336 dcp->c_nodename = (char *)(uintptr_t)dcp32.c_nodename; in ndi_dc_allochdl()
337 dcp->c_unitaddr = (char *)(uintptr_t)dcp32.c_unitaddr; in ndi_dc_allochdl()
340 if (dcp->c_nodename != NULL) { in ndi_dc_allochdl()
342 if (copyinstr(dcp->c_nodename, cpybuf, MAXNAMELEN, 0) != 0) { in ndi_dc_allochdl()
344 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
348 dcp->c_nodename = cpybuf; in ndi_dc_allochdl()
351 if (dcp->c_unitaddr != NULL) { in ndi_dc_allochdl()
353 if (copyinstr(dcp->c_unitaddr, cpybuf, MAXNAMELEN, 0) != 0) { in ndi_dc_allochdl()
355 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
356 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
357 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
361 dcp->c_unitaddr = cpybuf; in ndi_dc_allochdl()
367 if (dcp->nvl_user != NULL) { in ndi_dc_allochdl()
368 if ((dcp->nvl_usersz == 0) || in ndi_dc_allochdl()
369 (dcp->nvl_usersz > DEVCTL_MAX_NVL_USERSZ)) { in ndi_dc_allochdl()
370 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
371 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
372 if (dcp->c_unitaddr != NULL) in ndi_dc_allochdl()
373 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_allochdl()
374 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
377 cpybuf = kmem_alloc(dcp->nvl_usersz, KM_SLEEP); in ndi_dc_allochdl()
378 if (copyin(dcp->nvl_user, cpybuf, dcp->nvl_usersz) != 0) { in ndi_dc_allochdl()
379 kmem_free(cpybuf, dcp->nvl_usersz); in ndi_dc_allochdl()
380 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
381 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
382 if (dcp->c_unitaddr != NULL) in ndi_dc_allochdl()
383 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_allochdl()
384 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
388 if (nvlist_unpack(cpybuf, dcp->nvl_usersz, &dcp->nvl_user, in ndi_dc_allochdl()
390 kmem_free(cpybuf, dcp->nvl_usersz); in ndi_dc_allochdl()
391 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
392 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
393 if (dcp->c_unitaddr != NULL) in ndi_dc_allochdl()
394 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_allochdl()
395 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
401 kmem_free(cpybuf, dcp->nvl_usersz); in ndi_dc_allochdl()
405 *rdcp = dcp; in ndi_dc_allochdl()
413 ndi_dc_freehdl(struct devctl_iocdata *dcp) in ndi_dc_freehdl() argument
415 ASSERT(dcp != NULL); in ndi_dc_freehdl()
417 if (dcp->c_nodename != NULL) in ndi_dc_freehdl()
418 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_freehdl()
420 if (dcp->c_unitaddr != NULL) in ndi_dc_freehdl()
421 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_freehdl()
423 nvlist_free(dcp->nvl_user); in ndi_dc_freehdl()
425 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_freehdl()
429 ndi_dc_getname(struct devctl_iocdata *dcp) in ndi_dc_getname() argument
431 ASSERT(dcp != NULL); in ndi_dc_getname()
432 return (dcp->c_nodename); in ndi_dc_getname()
437 ndi_dc_getaddr(struct devctl_iocdata *dcp) in ndi_dc_getaddr() argument
439 ASSERT(dcp != NULL); in ndi_dc_getaddr()
440 return (dcp->c_unitaddr); in ndi_dc_getaddr()
444 ndi_dc_get_ap_data(struct devctl_iocdata *dcp) in ndi_dc_get_ap_data() argument
446 ASSERT(dcp != NULL); in ndi_dc_get_ap_data()
448 return (dcp->nvl_user); in ndi_dc_get_ap_data()
456 ndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_online() argument
463 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_online()
468 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_online()
501 ndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_offline() argument
507 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_offline()
512 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_offline()
538 ndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_remove() argument
544 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_remove()
549 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_remove()
575 ndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp, in ndi_devctl_device_getstate() argument
585 ((name = ndi_dc_getname(dcp)) == NULL) || in ndi_devctl_device_getstate()
586 ((addr = ndi_dc_getaddr(dcp)) == NULL)) in ndi_devctl_device_getstate()
631 ndi_dc_return_dev_state(dev_info_t *dip, struct devctl_iocdata *dcp) in ndi_dc_return_dev_state() argument
637 if ((dip == NULL) || (dcp == NULL)) in ndi_dc_return_dev_state()
657 if (copyout(&devstate, dcp->cpyout_buf, sizeof (uint_t)) != 0) in ndi_dc_return_dev_state()
668 ndi_devctl_bus_getstate(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_bus_getstate() argument
671 if ((dip == NULL) || (dcp == NULL)) in ndi_devctl_bus_getstate()
684 struct devctl_iocdata *dcp; in ndi_devctl_ioctl() local
691 if (ndi_dc_allochdl((void *)arg, &dcp) != NDI_SUCCESS) in ndi_devctl_ioctl()
697 rval = ndi_devctl_bus_getstate(dip, dcp, &state); in ndi_devctl_ioctl()
699 if (copyout(&state, dcp->cpyout_buf, in ndi_devctl_ioctl()
706 rval = ndi_devctl_device_online(dip, dcp, flags); in ndi_devctl_ioctl()
710 rval = ndi_devctl_device_offline(dip, dcp, flags); in ndi_devctl_ioctl()
714 rval = ndi_devctl_device_getstate(dip, dcp, &state); in ndi_devctl_ioctl()
716 if (copyout(&state, dcp->cpyout_buf, in ndi_devctl_ioctl()
723 rval = ndi_devctl_device_remove(dip, dcp, flags); in ndi_devctl_ioctl()
727 rval = ndi_dc_devi_create(dcp, dip, 0, NULL); in ndi_devctl_ioctl()
750 ndi_dc_freehdl(dcp); in ndi_devctl_ioctl()
759 ndi_dc_return_ap_state(devctl_ap_state_t *ap, struct devctl_iocdata *dcp) in ndi_dc_return_ap_state() argument
761 if ((ap == NULL) || (dcp == NULL)) in ndi_dc_return_ap_state()
766 if (copyout(ap, dcp->cpyout_buf, in ndi_dc_return_ap_state()
780 if (copyout(&ap_state32, dcp->cpyout_buf, in ndi_dc_return_ap_state()
794 ndi_dc_return_bus_state(dev_info_t *dip, struct devctl_iocdata *dcp) in ndi_dc_return_bus_state() argument
798 if ((dip == NULL) || (dcp == NULL)) in ndi_dc_return_bus_state()
804 if (copyout(&devstate, dcp->cpyout_buf, sizeof (uint_t)) != 0) in ndi_dc_return_bus_state()
818 ndi_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, int flags, in ndi_dc_devi_create() argument
832 if ((rv = i_dc_devi_create(dcp, pdip, &cdip)) != 0) in ndi_dc_devi_create()
854 if (dcp->flags & DEVCTL_OFFLINE) { in ndi_dc_devi_create()
934 if (dcp->cpyout_buf == NULL) in ndi_dc_devi_create()
943 if (copyout(&devnm, dcp->cpyout_buf, nmlen) != 0) { in ndi_dc_devi_create()
951 i_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, in i_dc_devi_create() argument
957 nvlist_t *nvlp = dcp->nvl_user; in i_dc_devi_create()