Lines Matching refs:dcp
314 struct devctl_iocdata *dcp; in ndi_dc_allochdl() local
319 dcp = kmem_zalloc(sizeof (*dcp), KM_SLEEP); in ndi_dc_allochdl()
322 if (copyin(iocarg, dcp, sizeof (*dcp)) != 0) { in ndi_dc_allochdl()
323 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
332 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
335 dcp->cmd = (uint_t)dcp32.cmd; in ndi_dc_allochdl()
336 dcp->flags = (uint_t)dcp32.flags; in ndi_dc_allochdl()
337 dcp->cpyout_buf = (uint_t *)(uintptr_t)dcp32.cpyout_buf; in ndi_dc_allochdl()
338 dcp->nvl_user = (nvlist_t *)(uintptr_t)dcp32.nvl_user; in ndi_dc_allochdl()
339 dcp->nvl_usersz = (size_t)dcp32.nvl_usersz; in ndi_dc_allochdl()
340 dcp->c_nodename = (char *)(uintptr_t)dcp32.c_nodename; in ndi_dc_allochdl()
341 dcp->c_unitaddr = (char *)(uintptr_t)dcp32.c_unitaddr; in ndi_dc_allochdl()
344 if (dcp->c_nodename != NULL) { in ndi_dc_allochdl()
346 if (copyinstr(dcp->c_nodename, cpybuf, MAXNAMELEN, 0) != 0) { in ndi_dc_allochdl()
348 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
352 dcp->c_nodename = cpybuf; in ndi_dc_allochdl()
355 if (dcp->c_unitaddr != NULL) { in ndi_dc_allochdl()
357 if (copyinstr(dcp->c_unitaddr, cpybuf, MAXNAMELEN, 0) != 0) { in ndi_dc_allochdl()
359 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
360 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
361 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
365 dcp->c_unitaddr = cpybuf; in ndi_dc_allochdl()
371 if (dcp->nvl_user != NULL) { in ndi_dc_allochdl()
372 if ((dcp->nvl_usersz == 0) || in ndi_dc_allochdl()
373 (dcp->nvl_usersz > DEVCTL_MAX_NVL_USERSZ)) { in ndi_dc_allochdl()
374 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
375 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
376 if (dcp->c_unitaddr != NULL) in ndi_dc_allochdl()
377 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_allochdl()
378 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
381 cpybuf = kmem_alloc(dcp->nvl_usersz, KM_SLEEP); in ndi_dc_allochdl()
382 if (copyin(dcp->nvl_user, cpybuf, dcp->nvl_usersz) != 0) { in ndi_dc_allochdl()
383 kmem_free(cpybuf, dcp->nvl_usersz); in ndi_dc_allochdl()
384 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
385 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
386 if (dcp->c_unitaddr != NULL) in ndi_dc_allochdl()
387 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_allochdl()
388 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
392 if (nvlist_unpack(cpybuf, dcp->nvl_usersz, &dcp->nvl_user, in ndi_dc_allochdl()
394 kmem_free(cpybuf, dcp->nvl_usersz); in ndi_dc_allochdl()
395 if (dcp->c_nodename != NULL) in ndi_dc_allochdl()
396 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_allochdl()
397 if (dcp->c_unitaddr != NULL) in ndi_dc_allochdl()
398 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_allochdl()
399 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_allochdl()
405 kmem_free(cpybuf, dcp->nvl_usersz); in ndi_dc_allochdl()
409 *rdcp = dcp; in ndi_dc_allochdl()
417 ndi_dc_freehdl(struct devctl_iocdata *dcp) in ndi_dc_freehdl() argument
419 ASSERT(dcp != NULL); in ndi_dc_freehdl()
421 if (dcp->c_nodename != NULL) in ndi_dc_freehdl()
422 kmem_free(dcp->c_nodename, MAXNAMELEN); in ndi_dc_freehdl()
424 if (dcp->c_unitaddr != NULL) in ndi_dc_freehdl()
425 kmem_free(dcp->c_unitaddr, MAXNAMELEN); in ndi_dc_freehdl()
427 nvlist_free(dcp->nvl_user); in ndi_dc_freehdl()
429 kmem_free(dcp, sizeof (*dcp)); in ndi_dc_freehdl()
433 ndi_dc_getname(struct devctl_iocdata *dcp) in ndi_dc_getname() argument
435 ASSERT(dcp != NULL); in ndi_dc_getname()
436 return (dcp->c_nodename); in ndi_dc_getname()
441 ndi_dc_getaddr(struct devctl_iocdata *dcp) in ndi_dc_getaddr() argument
443 ASSERT(dcp != NULL); in ndi_dc_getaddr()
444 return (dcp->c_unitaddr); in ndi_dc_getaddr()
448 ndi_dc_get_ap_data(struct devctl_iocdata *dcp) in ndi_dc_get_ap_data() argument
450 ASSERT(dcp != NULL); in ndi_dc_get_ap_data()
452 return (dcp->nvl_user); in ndi_dc_get_ap_data()
460 ndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_online() argument
467 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_online()
472 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_online()
505 ndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_offline() argument
511 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_offline()
516 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_offline()
542 ndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_device_remove() argument
548 if (ndi_dc_getname(dcp) == NULL || ndi_dc_getaddr(dcp) == NULL) in ndi_devctl_device_remove()
553 ndi_dc_getname(dcp), ndi_dc_getaddr(dcp)); in ndi_devctl_device_remove()
579 ndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp, in ndi_devctl_device_getstate() argument
588 ((name = ndi_dc_getname(dcp)) == NULL) || in ndi_devctl_device_getstate()
589 ((addr = ndi_dc_getaddr(dcp)) == NULL)) in ndi_devctl_device_getstate()
634 ndi_dc_return_dev_state(dev_info_t *dip, struct devctl_iocdata *dcp) in ndi_dc_return_dev_state() argument
639 if ((dip == NULL) || (dcp == NULL)) in ndi_dc_return_dev_state()
659 if (copyout(&devstate, dcp->cpyout_buf, sizeof (uint_t)) != 0) in ndi_dc_return_dev_state()
670 ndi_devctl_bus_getstate(dev_info_t *dip, struct devctl_iocdata *dcp, in ndi_devctl_bus_getstate() argument
673 if ((dip == NULL) || (dcp == NULL)) in ndi_devctl_bus_getstate()
686 struct devctl_iocdata *dcp; in ndi_devctl_ioctl() local
693 if (ndi_dc_allochdl((void *)arg, &dcp) != NDI_SUCCESS) in ndi_devctl_ioctl()
699 rval = ndi_devctl_bus_getstate(dip, dcp, &state); in ndi_devctl_ioctl()
701 if (copyout(&state, dcp->cpyout_buf, in ndi_devctl_ioctl()
708 rval = ndi_devctl_device_online(dip, dcp, flags); in ndi_devctl_ioctl()
712 rval = ndi_devctl_device_offline(dip, dcp, flags); in ndi_devctl_ioctl()
716 rval = ndi_devctl_device_getstate(dip, dcp, &state); in ndi_devctl_ioctl()
718 if (copyout(&state, dcp->cpyout_buf, in ndi_devctl_ioctl()
725 rval = ndi_devctl_device_remove(dip, dcp, flags); in ndi_devctl_ioctl()
729 rval = ndi_dc_devi_create(dcp, dip, 0, NULL); in ndi_devctl_ioctl()
752 ndi_dc_freehdl(dcp); in ndi_devctl_ioctl()
761 ndi_dc_return_ap_state(devctl_ap_state_t *ap, struct devctl_iocdata *dcp) in ndi_dc_return_ap_state() argument
763 if ((ap == NULL) || (dcp == NULL)) in ndi_dc_return_ap_state()
768 if (copyout(ap, dcp->cpyout_buf, in ndi_dc_return_ap_state()
782 if (copyout(&ap_state32, dcp->cpyout_buf, in ndi_dc_return_ap_state()
796 ndi_dc_return_bus_state(dev_info_t *dip, struct devctl_iocdata *dcp) in ndi_dc_return_bus_state() argument
800 if ((dip == NULL) || (dcp == NULL)) in ndi_dc_return_bus_state()
806 if (copyout(&devstate, dcp->cpyout_buf, sizeof (uint_t)) != 0) in ndi_dc_return_bus_state()
820 ndi_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, int flags, in ndi_dc_devi_create() argument
834 if ((rv = i_dc_devi_create(dcp, pdip, &cdip)) != 0) in ndi_dc_devi_create()
856 if (dcp->flags & DEVCTL_OFFLINE) { in ndi_dc_devi_create()
936 if (dcp->cpyout_buf == NULL) in ndi_dc_devi_create()
945 if (copyout(&devnm, dcp->cpyout_buf, nmlen) != 0) { in ndi_dc_devi_create()
953 i_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, in i_dc_devi_create() argument
959 nvlist_t *nvlp = dcp->nvl_user; in i_dc_devi_create()