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 if (dcp->nvl_user != NULL) in ndi_dc_freehdl()
424 nvlist_free(dcp->nvl_user); in ndi_dc_freehdl()
426 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_freehdl()
430 ndi_dc_getname(struct devctl_iocdata *dcp) in ndi_dc_getname() argument
432 ASSERT(dcp != NULL); in ndi_dc_getname()
433 return (dcp->c_nodename); in ndi_dc_getname()
438 ndi_dc_getaddr(struct devctl_iocdata *dcp) in ndi_dc_getaddr() argument
440 ASSERT(dcp != NULL); in ndi_dc_getaddr()
441 return (dcp->c_unitaddr); in ndi_dc_getaddr()
445 ndi_dc_get_ap_data(struct devctl_iocdata *dcp) in ndi_dc_get_ap_data() argument
447 ASSERT(dcp != NULL); in ndi_dc_get_ap_data()
449 return (dcp->nvl_user); in ndi_dc_get_ap_data()
457 ndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_online() argument
464 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_online()
469 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_online()
502 ndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_offline() argument
508 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_offline()
513 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_offline()
539 ndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_remove() argument
545 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_remove()
550 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_remove()
576 ndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp, in ndi_devctl_device_getstate() argument
586 ((name = ndi_dc_getname(dcp)) == NULL) || in ndi_devctl_device_getstate()
587 ((addr = ndi_dc_getaddr(dcp)) == NULL)) in ndi_devctl_device_getstate()
632 ndi_dc_return_dev_state(dev_info_t *dip, struct devctl_iocdata *dcp) in ndi_dc_return_dev_state() argument
638 if ((dip == NULL) || (dcp == NULL)) in ndi_dc_return_dev_state()
658 if (copyout(&devstate, dcp->cpyout_buf, sizeof (uint_t)) != 0) in ndi_dc_return_dev_state()
669 ndi_devctl_bus_getstate(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_bus_getstate() argument
672 if ((dip == NULL) || (dcp == NULL)) in ndi_devctl_bus_getstate()
685 struct devctl_iocdata *dcp; in ndi_devctl_ioctl() local
692 if (ndi_dc_allochdl((void *)arg, &dcp) != NDI_SUCCESS) in ndi_devctl_ioctl()
698 rval = ndi_devctl_bus_getstate(dip, dcp, &state); in ndi_devctl_ioctl()
700 if (copyout(&state, dcp->cpyout_buf, in ndi_devctl_ioctl()
707 rval = ndi_devctl_device_online(dip, dcp, flags); in ndi_devctl_ioctl()
711 rval = ndi_devctl_device_offline(dip, dcp, flags); in ndi_devctl_ioctl()
715 rval = ndi_devctl_device_getstate(dip, dcp, &state); in ndi_devctl_ioctl()
717 if (copyout(&state, dcp->cpyout_buf, in ndi_devctl_ioctl()
724 rval = ndi_devctl_device_remove(dip, dcp, flags); in ndi_devctl_ioctl()
728 rval = ndi_dc_devi_create(dcp, dip, 0, NULL); in ndi_devctl_ioctl()
751 ndi_dc_freehdl(dcp); in ndi_devctl_ioctl()
760 ndi_dc_return_ap_state(devctl_ap_state_t *ap, struct devctl_iocdata *dcp) in ndi_dc_return_ap_state() argument
762 if ((ap == NULL) || (dcp == NULL)) in ndi_dc_return_ap_state()
767 if (copyout(ap, dcp->cpyout_buf, in ndi_dc_return_ap_state()
781 if (copyout(&ap_state32, dcp->cpyout_buf, in ndi_dc_return_ap_state()
795 ndi_dc_return_bus_state(dev_info_t *dip, struct devctl_iocdata *dcp) in ndi_dc_return_bus_state() argument
799 if ((dip == NULL) || (dcp == NULL)) in ndi_dc_return_bus_state()
805 if (copyout(&devstate, dcp->cpyout_buf, sizeof (uint_t)) != 0) in ndi_dc_return_bus_state()
819 ndi_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, int flags, in ndi_dc_devi_create() argument
833 if ((rv = i_dc_devi_create(dcp, pdip, &cdip)) != 0) in ndi_dc_devi_create()
855 if (dcp->flags & DEVCTL_OFFLINE) { in ndi_dc_devi_create()
935 if (dcp->cpyout_buf == NULL) in ndi_dc_devi_create()
944 if (copyout(&devnm, dcp->cpyout_buf, nmlen) != 0) { in ndi_dc_devi_create()
952 i_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, in i_dc_devi_create() argument
958 nvlist_t *nvlp = dcp->nvl_user; in i_dc_devi_create()