Lines Matching refs:pdp

240 	struct xendev_ppd *pdp;
262 pdp = kmem_zalloc(sizeof (*pdp), KM_SLEEP);
263 pdp->xd_domain = domid;
264 pdp->xd_vdevnum = vdevnum;
265 pdp->xd_devclass = devcls;
266 pdp->xd_evtchn = INVALID_EVTCHN;
267 list_create(&pdp->xd_xb_watches, sizeof (xd_xb_watches_t),
269 mutex_init(&pdp->xd_evt_lk, NULL, MUTEX_DRIVER, NULL);
270 mutex_init(&pdp->xd_ndi_lk, NULL, MUTEX_DRIVER, NULL);
271 ddi_set_parent_data(dip, pdp);
301 mutex_destroy(&pdp->xd_ndi_lk);
302 mutex_destroy(&pdp->xd_evt_lk);
303 kmem_free(pdp, sizeof (*pdp));
308 pdp->xd_xsdev.nodename = i_ddi_strdup(xsname, KM_SLEEP);
309 pdp->xd_xsdev.devicetype = xdcp->xsdev;
310 pdp->xd_xsdev.frontend = (backend ? 0 : 1);
311 pdp->xd_xsdev.data = dip;
312 pdp->xd_xsdev.otherend_id = (backend ? domid : -1);
351 if (xenbus_read(XBT_NULL, pdp->xd_xsdev.otherend, "dev",
368 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
370 if (pdp != NULL) {
378 if (pdp->xd_xsdev.otherend_id != (domid_t)-1)
382 if (pdp->xd_xsdev.nodename != NULL)
383 kmem_free((char *)(pdp->xd_xsdev.nodename),
384 strlen(pdp->xd_xsdev.nodename) + 1);
388 mutex_destroy(&pdp->xd_ndi_lk);
389 mutex_destroy(&pdp->xd_evt_lk);
390 kmem_free(pdp, sizeof (*pdp));
401 struct xendev_ppd *pdp;
405 pdp = ddi_get_parent_data(dip);
406 ASSERT(pdp != NULL);
407 ASSERT(pdp->xd_evtchn == INVALID_EVTCHN);
409 mutex_enter(&pdp->xd_evt_lk);
410 if (pdp->xd_devclass == XEN_CONSOLE) {
412 pdp->xd_evtchn = xen_info->console.domU.evtchn;
414 pdp->xd_evtchn = INVALID_EVTCHN;
415 mutex_exit(&pdp->xd_evt_lk);
419 oeid = pdp->xd_xsdev.otherend_id;
421 mutex_exit(&pdp->xd_evt_lk);
425 if ((r = xen_bind_interdomain(oeid, evtchn, &pdp->xd_evtchn))) {
427 mutex_exit(&pdp->xd_evt_lk);
432 pdp->xd_ispec.intrspec_vec = ec_bind_evtchn_to_irq(pdp->xd_evtchn);
434 mutex_exit(&pdp->xd_evt_lk);
446 struct xendev_ppd *pdp;
450 pdp = ddi_get_parent_data(dip);
451 ASSERT(pdp != NULL);
452 ASSERT(pdp->xd_evtchn == INVALID_EVTCHN);
454 mutex_enter(&pdp->xd_evt_lk);
455 if (pdp->xd_devclass == XEN_CONSOLE) {
457 pdp->xd_evtchn = xen_info->console.domU.evtchn;
459 pdp->xd_evtchn = INVALID_EVTCHN;
460 mutex_exit(&pdp->xd_evt_lk);
464 oeid = pdp->xd_xsdev.otherend_id;
466 mutex_exit(&pdp->xd_evt_lk);
470 if ((rv = xen_alloc_unbound_evtchn(oeid, &pdp->xd_evtchn))) {
472 mutex_exit(&pdp->xd_evt_lk);
477 pdp->xd_ispec.intrspec_vec = ec_bind_evtchn_to_irq(pdp->xd_evtchn);
479 mutex_exit(&pdp->xd_evt_lk);
491 struct xendev_ppd *pdp;
493 pdp = ddi_get_parent_data(dip);
494 ASSERT(pdp != NULL);
496 mutex_enter(&pdp->xd_evt_lk);
497 if (pdp->xd_evtchn != INVALID_EVTCHN) {
499 ec_unbind_irq(pdp->xd_ispec.intrspec_vec);
500 pdp->xd_ispec.intrspec_vec = 0;
502 pdp->xd_evtchn = INVALID_EVTCHN;
504 mutex_exit(&pdp->xd_evt_lk);
969 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
971 if (pdp == NULL) {
996 domid = pdp->xd_domain;
997 vdevnum = pdp->xd_vdevnum;
998 devcls = pdp->xd_devclass;
1010 struct xendev_ppd *pdp = ddi_get_parent_data(xdip);
1012 ASSERT(pdp != NULL);
1013 return (pdp->xd_evtchn);
1019 struct xendev_ppd *pdp = ddi_get_parent_data(xdip);
1021 ASSERT(pdp != NULL);
1022 return (pdp->xd_vdevnum);
1028 struct xendev_ppd *pdp = ddi_get_parent_data(xdip);
1030 ASSERT(pdp != NULL);
1031 return ((char *)(pdp->xd_xsdev.nodename));
1037 struct xendev_ppd *pdp = ddi_get_parent_data(xdip);
1039 ASSERT(pdp != NULL);
1040 if (pdp->xd_devclass == XEN_CONSOLE)
1042 return ((char *)(pdp->xd_xsdev.otherend));
1048 struct xendev_ppd *pdp = ddi_get_parent_data(xdip);
1050 ASSERT(pdp != NULL);
1051 return (&pdp->xd_xsdev);
1057 struct xendev_ppd *pdp = ddi_get_parent_data(xdip);
1059 ASSERT(pdp != NULL);
1060 if (pdp->xd_devclass == XEN_CONSOLE)
1062 return ((domid_t)(pdp->xd_xsdev.otherend_id));
1068 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1070 ASSERT(pdp != NULL);
1071 xenbus_dev_error(&pdp->xd_xsdev, errno, errstr);
1077 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1079 ASSERT(pdp != NULL);
1080 xenbus_dev_fatal(&pdp->xd_xsdev, errno, errstr);
1088 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1089 XenbusState oestate = pdp->xd_xsdev.otherend_state;
1103 mutex_enter(&pdp->xd_ndi_lk);
1105 if (pdp->xd_oe_ehid != NULL) {
1109 mutex_exit(&pdp->xd_ndi_lk);
1111 mutex_enter(&pdp->xd_ndi_lk);
1128 mutex_exit(&pdp->xd_ndi_lk);
1143 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1148 mutex_enter(&pdp->xd_ndi_lk);
1150 (xenbus_read(XBT_NULL, pdp->xd_hp_watch.node, "",
1158 mutex_exit(&pdp->xd_ndi_lk);
1164 mutex_exit(&pdp->xd_ndi_lk);
1170 struct xendev_ppd *pdp;
1172 pdp = ddi_get_parent_data(dip);
1173 ASSERT(pdp->xd_evtchn != INVALID_EVTCHN);
1174 ec_notify_via_evtchn(pdp->xd_evtchn);
1181 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1193 == 0) && (strcmp(be, pdp->xd_xsdev.otherend) != 0))
1232 struct xendev_ppd *pdp = xxwp->xxw_xppd;
1236 mutex_enter(&pdp->xd_ndi_lk);
1238 mutex_exit(&pdp->xd_ndi_lk);
1245 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1251 mutex_enter(&pdp->xd_ndi_lk);
1252 for (xxwp = list_head(&pdp->xd_xb_watches); xxwp != NULL;
1253 xxwp = list_next(&pdp->xd_xb_watches, xxwp)) {
1259 mutex_exit(&pdp->xd_ndi_lk);
1264 (void) ddi_taskq_dispatch(pdp->xd_xb_watch_taskq,
1266 mutex_exit(&pdp->xd_ndi_lk);
1279 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1299 xxw_new->xxw_xppd = pdp;
1303 mutex_enter(&pdp->xd_ndi_lk);
1309 if (pdp->xd_xb_watch_taskq == NULL) {
1312 ASSERT(list_is_empty(&pdp->xd_xb_watches));
1317 if ((pdp->xd_xb_watch_taskq = ddi_taskq_create(dip, tq_name,
1320 mutex_exit(&pdp->xd_ndi_lk);
1326 for (xxwp = list_head(&pdp->xd_xb_watches); xxwp != NULL;
1327 xxwp = list_next(&pdp->xd_xb_watches, xxwp)) {
1333 mutex_exit(&pdp->xd_ndi_lk);
1338 if (list_is_empty(&pdp->xd_xb_watches)) {
1339 ddi_taskq_destroy(pdp->xd_xb_watch_taskq);
1340 pdp->xd_xb_watch_taskq = NULL;
1343 mutex_exit(&pdp->xd_ndi_lk);
1347 list_insert_head(&pdp->xd_xb_watches, xxw_new);
1348 mutex_exit(&pdp->xd_ndi_lk);
1358 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1362 mutex_enter(&pdp->xd_ndi_lk);
1364 while ((xxwp = list_remove_head(&pdp->xd_xb_watches)) != NULL) {
1365 mutex_exit(&pdp->xd_ndi_lk);
1367 mutex_enter(&pdp->xd_ndi_lk);
1370 ASSERT(list_is_empty(&pdp->xd_xb_watches));
1379 tq = pdp->xd_xb_watch_taskq;
1380 pdp->xd_xb_watch_taskq = NULL;
1381 mutex_exit(&pdp->xd_ndi_lk);
1389 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1391 ASSERT(pdp != NULL);
1392 ASSERT(pdp->xd_xsdev.nodename != NULL);
1393 ASSERT(mutex_owned(&pdp->xd_ndi_lk));
1408 if (pdp->xd_oe_taskq == NULL)
1409 if ((pdp->xd_oe_taskq = ddi_taskq_create(dip,
1416 pdp->xd_xsdev.otherend_state = XenbusStateUnknown;
1417 pdp->xd_xsdev.otherend_changed = i_xvdi_oestate_cb;
1419 if (talk_to_otherend(&pdp->xd_xsdev) != 0) {
1430 struct xendev_ppd *pdp;
1433 pdp = ddi_get_parent_data(dip);
1434 ASSERT(pdp != NULL);
1435 ASSERT(mutex_owned(&pdp->xd_ndi_lk));
1437 dev = &pdp->xd_xsdev;
1441 mutex_exit(&pdp->xd_ndi_lk);
1443 mutex_enter(&pdp->xd_ndi_lk);
1447 if (pdp->xd_oe_taskq != NULL) {
1448 mutex_exit(&pdp->xd_ndi_lk);
1449 ddi_taskq_destroy(pdp->xd_oe_taskq);
1450 mutex_enter(&pdp->xd_ndi_lk);
1451 pdp->xd_oe_taskq = NULL;
1469 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1471 ASSERT(pdp != NULL);
1472 ASSERT(pdp->xd_xsdev.frontend == 0);
1473 ASSERT(mutex_owned(&pdp->xd_ndi_lk));
1488 if (pdp->xd_hp_taskq == NULL)
1489 if ((pdp->xd_hp_taskq = ddi_taskq_create(dip,
1493 if (pdp->xd_hp_watch.node == NULL) {
1497 ASSERT(pdp->xd_xsdev.nodename != NULL);
1499 len = strlen(pdp->xd_xsdev.nodename) +
1503 pdp->xd_xsdev.nodename);
1505 pdp->xd_hp_watch.node = path;
1506 pdp->xd_hp_watch.callback = i_xvdi_hpstate_cb;
1507 pdp->xd_hp_watch.dev = (struct xenbus_device *)dip; /* yuck! */
1508 if (register_xenbus_watch(&pdp->xd_hp_watch) != 0) {
1520 struct xendev_ppd *pdp;
1521 pdp = ddi_get_parent_data(dip);
1523 ASSERT(pdp != NULL);
1524 ASSERT(pdp->xd_xsdev.frontend == 0);
1525 ASSERT(mutex_owned(&pdp->xd_ndi_lk));
1528 if (pdp->xd_hp_watch.node != NULL) {
1529 mutex_exit(&pdp->xd_ndi_lk);
1530 unregister_xenbus_watch(&pdp->xd_hp_watch);
1531 mutex_enter(&pdp->xd_ndi_lk);
1535 if (pdp->xd_hp_taskq != NULL) {
1536 mutex_exit(&pdp->xd_ndi_lk);
1537 ddi_taskq_destroy(pdp->xd_hp_taskq);
1538 mutex_enter(&pdp->xd_ndi_lk);
1539 pdp->xd_hp_taskq = NULL;
1543 if (pdp->xd_hp_watch.node != NULL) {
1544 kmem_free((void *)pdp->xd_hp_watch.node,
1545 strlen(pdp->xd_hp_watch.node) + 1);
1546 pdp->xd_hp_watch.node = NULL;
1553 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1555 ASSERT(pdp != NULL);
1557 mutex_enter(&pdp->xd_ndi_lk);
1560 mutex_exit(&pdp->xd_ndi_lk);
1564 if (pdp->xd_xsdev.frontend == 1) {
1579 mutex_exit(&pdp->xd_ndi_lk);
1585 mutex_exit(&pdp->xd_ndi_lk);
1593 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1595 ASSERT(pdp != NULL);
1597 mutex_enter(&pdp->xd_ndi_lk);
1601 if (pdp->xd_xsdev.frontend == 1)
1606 mutex_exit(&pdp->xd_ndi_lk);
1614 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1616 ASSERT(pdp != NULL);
1617 ASSERT(pdp->xd_xsdev.frontend == 1);
1622 if (pdp->xd_bepath_watch.node == NULL) {
1626 ASSERT(pdp->xd_xsdev.nodename != NULL);
1628 len = strlen(pdp->xd_xsdev.nodename) + strlen("/backend") + 1;
1631 pdp->xd_xsdev.nodename);
1633 pdp->xd_bepath_watch.node = path;
1634 pdp->xd_bepath_watch.callback = i_xvdi_bepath_cb;
1635 pdp->xd_bepath_watch.dev = (struct xenbus_device *)dip;
1636 if (register_xenbus_watch(&pdp->xd_bepath_watch) != 0) {
1638 pdp->xd_bepath_watch.node = NULL;
1649 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1651 ASSERT(pdp != NULL);
1652 ASSERT(pdp->xd_xsdev.frontend == 1);
1653 ASSERT(mutex_owned(&pdp->xd_ndi_lk));
1655 if (pdp->xd_bepath_watch.node != NULL) {
1656 mutex_exit(&pdp->xd_ndi_lk);
1657 unregister_xenbus_watch(&pdp->xd_bepath_watch);
1658 mutex_enter(&pdp->xd_ndi_lk);
1660 kmem_free((void *)(pdp->xd_bepath_watch.node),
1661 strlen(pdp->xd_bepath_watch.node) + 1);
1662 pdp->xd_bepath_watch.node = NULL;
1671 struct xendev_ppd *pdp;
1673 pdp = ddi_get_parent_data(dip);
1674 ASSERT(pdp != NULL);
1682 rv = xenbus_switch_state(&pdp->xd_xsdev, xbt, newState);
1695 struct xendev_ppd *pdp;
1702 pdp = ddi_get_parent_data(dip);
1703 ASSERT(pdp != NULL);
1705 xdcp = i_xvdi_devclass2cfg(pdp->xd_devclass);
1715 err = nvlist_add_int32(attr_list, "domain", pdp->xd_domain);
1718 err = nvlist_add_int32(attr_list, "vdev", pdp->xd_vdevnum);
1728 ((pdp->xd_xsdev.frontend == 1) ? "frontend" : "backend"));
1909 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
1915 ASSERT(pdp != NULL);
1917 mutex_enter(&pdp->xd_ndi_lk);
1920 ASSERT(pdp->xd_xsdev.otherend != NULL);
1922 cbid = &pdp->xd_oe_ehid;
1924 if (pdp->xd_xsdev.frontend == 1) {
1925 mutex_exit(&pdp->xd_ndi_lk);
1929 ASSERT(pdp->xd_hp_watch.node != NULL);
1931 cbid = &pdp->xd_hp_ehid;
1934 mutex_exit(&pdp->xd_ndi_lk);
1943 mutex_exit(&pdp->xd_ndi_lk);
1952 mutex_exit(&pdp->xd_ndi_lk);
1960 mutex_exit(&pdp->xd_ndi_lk);
1971 (pdp->xd_xsdev.otherend_state != XenbusStateUnknown)) {
1972 oestate = pdp->xd_xsdev.otherend_state;
1976 mutex_exit(&pdp->xd_ndi_lk);
1982 (void) ddi_taskq_dispatch(pdp->xd_oe_taskq,
1996 struct xendev_ppd *pdp;
2000 pdp = ddi_get_parent_data(dip);
2001 ASSERT(pdp != NULL);
2015 mutex_enter(&pdp->xd_ndi_lk);
2017 if (rem_oe && (pdp->xd_oe_ehid != NULL)) {
2018 oeid = pdp->xd_oe_ehid;
2019 pdp->xd_oe_ehid = NULL;
2022 if (rem_hp && (pdp->xd_hp_ehid != NULL)) {
2023 hpid = pdp->xd_hp_ehid;
2024 pdp->xd_hp_ehid = NULL;
2027 mutex_exit(&pdp->xd_ndi_lk);
2272 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
2284 mutex_enter(&pdp->xd_ndi_lk);
2289 mutex_exit(&pdp->xd_ndi_lk);
2298 (void) ddi_taskq_dispatch(pdp->xd_oe_taskq,
2309 struct xendev_ppd *pdp = ddi_get_parent_data(dip);
2315 (void) xenbus_read(XBT_NULL, pdp->xd_hp_watch.node, "",
2326 (void) ddi_taskq_dispatch(pdp->xd_hp_taskq,