Lines Matching refs:dip
46 * devices (PM_ISBC(dip) returns true).
270 * per-dip locks:
272 * Each node has these per-dip locks, which are only used if the device is
299 * up or after a CPR operation. It is per-dip to keep from
321 #define PM_MIN_SCAN(dip) (PM_ISCPU(dip) ? pm_cpu_min_scan : \
412 * pm_divertdebug is incremented in pm_set_power() if dip == cfb_dip to avoid
503 #define PM_MAJOR(dip) ddi_driver_major(dip)
504 #define PM_IS_NEXUS(dip) ((PM_MAJOR(dip) == DDI_MAJOR_T_NONE) ? 0 : \
505 NEXUS_DRV(devopsp[PM_MAJOR(dip)]))
509 #define PM_INCR_NOTLOWEST(dip) { \
511 if (!PM_IS_NEXUS(dip) || \
512 (DEVI(dip)->devi_pm_flags & (PMC_DEV_THRESH|PMC_COMP_THRESH))) {\
514 pm_ppm_notify_all_lowest(dip, PM_NOT_ALL_LOWEST);\
517 pmf, PM_DEVICE(dip), pm_comps_notlowest)) \
521 #define PM_DECR_NOTLOWEST(dip) { \
523 if (!PM_IS_NEXUS(dip) || \
524 (DEVI(dip)->devi_pm_flags & (PMC_DEV_THRESH|PMC_COMP_THRESH))) {\
528 "%d\n", pmf, PM_DEVICE(dip), pm_comps_notlowest))\
530 pm_ppm_notify_all_lowest(dip, PM_ALL_LOWEST); \
723 pm_scan_init(dev_info_t *dip)
728 ASSERT(!PM_ISBC(dip));
730 PM_LOCK_DIP(dip);
731 scanp = PM_GET_PM_SCAN(dip);
734 pmf, PM_DEVICE(dip)))
736 DEVI(dip)->devi_pm_scan = scanp;
739 "clear PM_SCAN_STOP flag\n", pmf, PM_DEVICE(dip)))
742 PM_UNLOCK_DIP(dip);
749 pm_scan_fini(dev_info_t *dip)
754 PMD(PMD_SCAN, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
755 ASSERT(!PM_ISBC(dip));
756 PM_LOCK_DIP(dip);
757 scanp = PM_GET_PM_SCAN(dip);
759 PM_UNLOCK_DIP(dip);
767 DEVI(dip)->devi_pm_scan = NULL;
768 PM_UNLOCK_DIP(dip);
829 e_pm_valid_power(dev_info_t *dip, int cmpt, int level)
832 pm_component_t *cp = PM_CP(dip, cmpt);
855 static int pm_start(dev_info_t *dip);
860 e_pm_valid_info(dev_info_t *dip, pm_info_t **infop)
872 info = PM_GET_PM_INFO(dip);
874 if (!DEVI_IS_ATTACHING(dip)) {
877 if (pm_start(dip) != DDI_SUCCESS) {
880 info = PM_GET_PM_INFO(dip);
889 e_pm_valid_comp(dev_info_t *dip, int cmpt, pm_component_t **cpp)
891 if (cmpt >= 0 && cmpt < PM_NUMCMPTS(dip)) {
893 *cpp = PM_CP(dip, cmpt);
904 dev_is_needed(dev_info_t *dip, int cmpt, int level, int direction)
912 if (!e_pm_valid_info(dip, NULL) || !e_pm_valid_comp(dip, cmpt, &cp) ||
913 !e_pm_valid_power(dip, cmpt, level))
917 pmf, PM_DEVICE(dip), cmpt, pm_decode_direction(direction),
920 if (pm_set_power(dip, cmpt, level, direction,
924 (void) ddi_pathname(dip, pathbuf);
930 "errno %d\n", pmf, PM_DEVICE(dip), cmpt,
936 PM_DEVICE(dip)))
937 pm_rescan(dip);
953 dev_info_t *dip = (dev_info_t *)arg;
958 PMD(PMD_SCAN, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
959 PM_LOCK_DIP(dip);
960 info = PM_GET_PM_INFO(dip);
961 scanp = PM_GET_PM_SCAN(dip);
962 if (pm_scans_disabled || !PM_SCANABLE(dip) || !info || !scanp ||
964 PM_UNLOCK_DIP(dip);
969 PM_UNLOCK_DIP(dip);
975 pmf, PM_DEVICE(dip), (ulong_t)scanid))
976 PM_UNLOCK_DIP(dip);
978 PM_LOCK_DIP(dip);
983 * attach might soon fail and dip dissolved, and panic may happen while
996 if (DEVI_IS_ATTACHING(dip) ||
998 !taskq_dispatch(system_taskq, pm_scan, (void *)dip, TQ_NOSLEEP)) {
1000 "dispatched or dispatching failed\n", pmf, PM_DEVICE(dip)))
1004 PM_UNLOCK_DIP(dip);
1006 PM_LOCK_DIP(dip);
1010 pmf, PM_DEVICE(dip),
1012 PM_UNLOCK_DIP(dip);
1016 scanp->ps_scan_id = timeout(pm_rescan, (void *)dip,
1018 (PM_MIN_SCAN(dip) * hz)));
1020 "scanid %lx\n", pmf, PM_DEVICE(dip),
1024 pmf, PM_DEVICE(dip)))
1027 PM_UNLOCK_DIP(dip);
1034 dev_info_t *dip = (dev_info_t *)arg;
1038 PMD(PMD_SCAN, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
1040 PM_LOCK_DIP(dip);
1041 scanp = PM_GET_PM_SCAN(dip);
1042 ASSERT(scanp && PM_GET_PM_INFO(dip));
1044 if (pm_scans_disabled || !PM_SCANABLE(dip) ||
1047 PM_UNLOCK_DIP(dip);
1058 "(pmid %x)\n", pmf, PM_DEVICE(dip), scanp->ps_idle_down))
1065 pmf, PM_DEVICE(dip)))
1067 PM_UNLOCK_DIP(dip);
1075 PM_UNLOCK_DIP(dip);
1076 nextscan = pm_scan_dev(dip);
1077 PM_LOCK_DIP(dip);
1086 "(pmid %x)\n", pmf, PM_DEVICE(dip), scanp->ps_idle_down))
1096 PM_DEVICE(dip), (ulong_t)scanp->ps_scan_id))
1097 PM_UNLOCK_DIP(dip);
1100 scanp->ps_scan_id = timeout(pm_rescan, (void *)dip,
1103 "%lx sec, scanid(%lx) \n", pmf, PM_DEVICE(dip),
1107 PM_UNLOCK_DIP(dip);
1111 pm_get_timestamps(dev_info_t *dip, time_t *valuep)
1113 int components = PM_NUMCMPTS(dip);
1117 PM_LOCK_BUSY(dip); /* so we get a consistent view */
1119 valuep[i] = PM_CP(dip, i)->pmc_timestamp;
1121 PM_UNLOCK_BUSY(dip);
1132 pm_noinvol(dev_info_t *dip)
1139 if (PM_IS_CFB(dip)) {
1141 pmf, PM_DEVICE(dip)))
1147 if (DEVI(dip)->devi_pm_noinvolpm == 0) {
1149 if (DEVI(dip)->devi_pm_volpmd != 0) {
1150 dev_info_t *pdip = dip;
1160 ASSERT(DEVI(dip)->devi_pm_volpmd == 0);
1171 if (DEVI(dip)->devi_pm_noinvolpm != DEVI(dip)->devi_pm_volpmd)
1173 DEVI(dip)->devi_pm_noinvolpm, DEVI(dip)->devi_pm_volpmd,
1174 PM_DEVICE(dip)))
1176 return (DEVI(dip)->devi_pm_noinvolpm != DEVI(dip)->devi_pm_volpmd);
1190 pm_scan_dev(dev_info_t *dip)
1202 dev_info_t *pdip = ddi_get_parent(dip);
1209 if (DEVI_IS_ATTACHING(dip)) {
1211 pmf, PM_DEVICE(dip), min_scan))
1215 PM_LOCK_DIP(dip);
1216 scanp = PM_GET_PM_SCAN(dip);
1217 min_scan = PM_MIN_SCAN(dip);
1218 ASSERT(scanp && PM_GET_PM_INFO(dip));
1220 PMD(PMD_SCAN, ("%s: [BEGIN %s@%s(%s#%d)]\n", pmf, PM_DEVICE(dip)))
1221 PMD(PMD_SCAN, ("%s: %s@%s(%s#%d): kuc is %d\n", pmf, PM_DEVICE(dip),
1222 PM_KUC(dip)))
1225 if (pm_scans_disabled || !PM_SCANABLE(dip) ||
1227 (PM_KUC(dip) != 0) ||
1228 PM_ISDIRECT(dip) || pm_noinvol(dip)) {
1229 PM_UNLOCK_DIP(dip);
1233 pmf, PM_DEVICE(dip), pm_scans_disabled, autopm_enabled,
1234 cpupm, PM_KUC(dip),
1235 PM_ISDIRECT(dip) ? "is" : "is not",
1236 pm_noinvol(dip) ? "is" : "is not"))
1239 PM_UNLOCK_DIP(dip);
1247 size = PM_NUMCMPTS(dip) * sizeof (time_t);
1249 pm_get_timestamps(dip, timestamp);
1256 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
1260 cp = PM_CP(dip, i);
1270 "lowest\n", pmf, PM_DEVICE(dip), i))
1275 thresh = cur_threshold(dip, i); /* comp i threshold */
1288 pmf, PM_DEVICE(dip), i, idletime))
1289 if (idletime >= thresh || PM_IS_PID(dip)) {
1292 pmf, PM_DEVICE(dip), i, curpwr, nxtpwr))
1293 if (pm_set_power(dip, i, nxtpwr, PM_LEVEL_DOWNONLY,
1295 PM_CURPOWER(dip, i) != nxtpwr) {
1297 "%d->%d Failed\n", pmf, PM_DEVICE(dip),
1304 PM_DEVICE(dip), i, curpwr, nxtpwr,
1315 1, cur_threshold(dip, i));
1318 max(1, cur_threshold(dip, i)));
1320 "timeleft(%lx)\n", pmf, PM_DEVICE(dip),
1329 "%lx\n", pmf, PM_DEVICE(dip), i, timeleft))
1335 PM_DEVICE(dip), timeleft))
1349 pm_scan_stop(dev_info_t *dip)
1355 PMD(PMD_SCAN, ("%s: [BEGIN %s@%s(%s#%d)]\n", pmf, PM_DEVICE(dip)))
1356 PM_LOCK_DIP(dip);
1357 scanp = PM_GET_PM_SCAN(dip);
1360 pmf, PM_DEVICE(dip)))
1361 PM_UNLOCK_DIP(dip);
1370 PM_UNLOCK_DIP(dip);
1372 PM_LOCK_DIP(dip);
1376 PM_UNLOCK_DIP(dip);
1378 PM_LOCK_DIP(dip);
1380 PM_UNLOCK_DIP(dip);
1381 PMD(PMD_SCAN, ("%s: [END %s@%s(%s#%d)]\n", pmf, PM_DEVICE(dip)))
1385 pm_scan_stop_walk(dev_info_t *dip, void *arg)
1389 if (!PM_GET_PM_SCAN(dip))
1391 ASSERT(!PM_ISBC(dip));
1392 pm_scan_stop(dip);
1437 pm_ppm_claimed(dev_info_t *dip)
1439 return (PPM(dip) != NULL);
1447 pm_clear_volpm_dip(dev_info_t *dip)
1451 if (dip == NULL)
1454 PM_DEVICE(dip)))
1455 DEVI(dip)->devi_pm_volpmd = 0;
1456 for (dip = ddi_get_child(dip); dip; dip = ddi_get_next_sibling(dip)) {
1457 pm_clear_volpm_dip(dip);
1467 pm_clear_volpm_list(dev_info_t *dip)
1475 (void) ddi_pathname(dip, pathbuf);
1500 power_dev(dev_info_t *dip, int comp, int level, int old_level,
1510 struct pm_component *cp = PM_CP(dip, comp);
1512 int bc = PM_ISBC(dip);
1525 if (devi_detach(dip, DDI_PM_SUSPEND) != DDI_SUCCESS) {
1528 pmf, PM_DEVICE(dip)))
1531 DEVI(dip)->devi_pm_flags |= PMC_SUSPENDED;
1536 power_req.req.ppm_set_power_req.who = dip;
1543 if (pm_ppm_claimed(dip)) {
1544 ppmname = PM_NAME(PPM(dip));
1545 ppmaddr = PM_ADDR(PPM(dip));
1552 pmf, PM_DEVICE(dip), cp->pmc_comp.pmc_name, comp,
1561 if (DEVI(dip)->devi_pm_volpmd &&
1562 (!bc && pm_all_components_off(dip) && level != 0) ||
1565 if ((power_op_ret = pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER,
1575 int volpmd = DEVI(dip)->devi_pm_volpmd;
1576 pm_clear_volpm_dip(dip);
1577 pm_clear_volpm_list(dip);
1579 (void) ddi_pathname(dip, pathbuf);
1581 volpmd, 0, pathbuf, dip);
1587 PM_DEVICE(dip), level, power_val_to_string(cp, level)))
1606 ASSERT(PM_ISDIRECT(dip) || DEVI_IS_DETACHING(dip));
1613 ASSERT((DEVI(dip)->devi_pm_flags &
1615 (PM_CP(dip, comp)->pmc_flags &
1626 ASSERT((DEVI(dip)->devi_pm_flags &
1628 (PM_CP(dip, comp)->pmc_flags &
1636 ASSERT(DEVI(dip)->devi_pm_flags & PMC_SUSPENDED);
1638 if ((power_op_ret = devi_attach(dip, DDI_PM_RESUME)) ==
1640 DEVI(dip)->devi_pm_flags &= ~PMC_SUSPENDED;
1643 PM_DEVICE(dip));
1653 pm_devi_lock_held(dev_info_t *dip)
1657 if (DEVI_BUSY_OWNED(dip))
1671 return (cur != NULL && cur->pmlk_lender == DEVI(dip)->devi_busy_thread);
1692 pm_set_power(dev_info_t *dip, int comp, int level, int direction,
1701 dev_info_t *pdip = ddi_get_parent(dip);
1711 if (dip == cfb_dip) {
1721 pmf, PM_DEVICE(dip), comp, pm_decode_direction(direction), level))
1723 (void) ddi_pathname(dip, pathbuf);
1724 bpc.bpc_dip = dip;
1727 bpc.bpc_olevel = PM_CURPOWER(dip, comp);
1742 if (pm_devi_lock_held(pdip) || pm_devi_lock_held(dip))
1743 ret = pm_busop_set_power(dip, NULL, BUS_POWER_CHILD_PWRCHG,
1751 "errno=%d\n", pmf, PM_DEVICE(dip), ret, *retp))
1764 * If holddip is set, then if a dip is found we return with the node held.
1855 * Device dip is being un power managed, it keeps up count other devices.
1865 dev_info_t *dip;
1875 dip = pm_name_to_dip(keeper, 1);
1888 if ((dip != NULL) && (PM_GET_PM_INFO(dip) != NULL)) {
1890 PM_LOCK_POWER(dip, &circ);
1891 for (j = 0; j < PM_NUMCMPTS(dip); j++) {
1892 cp = &DEVI(dip)->devi_pm_components[j];
1903 PM_UNLOCK_POWER(dip, circ);
1918 if (dip)
1919 ddi_release_devi(dip);
2070 e_pm_hold_rele_power(dev_info_t *dip, int cnt)
2075 if ((dip == NULL) ||
2076 (PM_GET_PM_INFO(dip) == NULL) || PM_ISBC(dip))
2079 PM_LOCK_POWER(dip, &circ);
2080 ASSERT(cnt >= 0 && PM_KUC(dip) >= 0 || cnt < 0 && PM_KUC(dip) > 0);
2082 PM_DEVICE(dip), PM_KUC(dip), (PM_KUC(dip) + cnt)))
2084 PM_KUC(dip) += cnt;
2086 ASSERT(PM_KUC(dip) >= 0);
2087 PM_UNLOCK_POWER(dip, circ);
2089 if (cnt < 0 && PM_KUC(dip) == 0)
2090 pm_rescan(dip);
2109 pm_ppm_notify_all_lowest(dev_info_t *dip, int mode)
2119 (void) pm_ctlops((dev_info_t *)ppmcp->ppmc_dip, dip,
2144 pm_set_pm_info(dev_info_t *dip, void *value)
2146 DEVI(dip)->devi_pm_info = value;
2152 * Look up an entry in the blocked list by dip and component
2155 pm_rsvp_lookup(dev_info_t *dip, int comp)
2160 if (p->pr_dip == dip && p->pr_comp == comp) {
2173 pm_proceed(dev_info_t *dip, int cmd, int comp, int newlevel)
2186 if (dip == p->pr_dip) {
2189 pmf, PM_DEVICE(dip)))
2200 found = pm_rsvp_lookup(dip, comp);
2210 PM_DEVICE(dip)))
2214 PM_DEVICE(dip)))
2290 pm_rem_info(dev_info_t *dip)
2294 pm_info_t *info = PM_GET_PM_INFO(dip);
2295 dev_info_t *pdip = ddi_get_parent(dip);
2301 ASSERT(!PM_IAM_LOCKING_DIP(dip));
2302 if (PM_ISDIRECT(dip)) {
2306 pm_proceed(dip, PMP_RELEASE, -1, -1);
2308 ASSERT(!PM_GET_PM_SCAN(dip));
2318 PM_DEVICE(dip), PM_NUMCMPTS(dip)))
2321 if (PM_ISBC(dip)) {
2322 count = (PM_CURPOWER(dip, 0) != 0);
2324 for (i = 0; i < PM_NUMCMPTS(dip); i++)
2325 count += (PM_CURPOWER(dip, i) != 0);
2328 if (PM_NUMCMPTS(dip) && pdip && !PM_WANTS_NOTIFICATION(pdip))
2333 (void) ddi_pathname(dip, pathbuf);
2342 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
2343 pm_component_t *cp = PM_CP(dip, i);
2345 PM_DECR_NOTLOWEST(dip)
2351 pm_set_pm_info(dip, NULL);
2356 pm_get_norm_pwrs(dev_info_t *dip, int **valuep, size_t *length)
2358 int components = PM_NUMCMPTS(dip);
2365 "can't get normal power values\n", PM_DEVICE(dip));
2371 bufp[i] = pm_get_normal_power(dip, i);
2380 pm_reset_timestamps(dev_info_t *dip, void *arg)
2387 if (!PM_GET_PM_INFO(dip))
2389 components = PM_NUMCMPTS(dip);
2391 PM_LOCK_BUSY(dip);
2398 cp = PM_CP(dip, i);
2402 PM_UNLOCK_BUSY(dip);
2411 pm_level_to_index(dev_info_t *dip, pm_component_t *cp, int level)
2424 pmf, PM_DEVICE(dip),
2425 (int)(cp - DEVI(dip)->devi_pm_components), level))
2430 "%s@%s(%s#%d)", level, PM_DEVICE(dip));
2438 e_pm_set_cur_pwr(dev_info_t *dip, pm_component_t *cp, int level)
2456 PM_INCR_NOTLOWEST(dip);
2458 PM_DECR_NOTLOWEST(dip);
2461 cp->pmc_cur_pwr = pm_level_to_index(dip, cp, level);
2471 pm_power(dev_info_t *dip, int comp, int level)
2476 struct pm_component *cp = PM_CP(dip, comp);
2478 pm_info_t *info = PM_GET_PM_INFO(dip);
2481 PM_DEVICE(dip), comp, level))
2482 if (!(ops = ddi_get_driver(dip))) {
2484 PM_DEVICE(dip)))
2494 retval = (*fn)(dip, comp, level);
2497 e_pm_set_cur_pwr(dip, PM_CP(dip, comp), level);
2512 (void) pm_phc_impl(dip, comp, phc_lvl, 0);
2514 pmf, PM_DEVICE(dip), comp, phc_lvl))
2518 "level=%d (%s)\n", pmf, comp, cp->pmc_comp.pmc_name, PM_DEVICE(dip),
2524 pm_unmanage(dev_info_t *dip)
2530 ASSERT(!PM_IAM_LOCKING_DIP(dip));
2532 PM_DEVICE(dip)))
2534 power_req.req.ppm_config_req.who = dip;
2535 if (pm_ppm_claimed(dip))
2536 retval = pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER,
2540 retval = pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER,
2544 pm_rem_info(dip);
2549 pm_raise_power(dev_info_t *dip, int comp, int level)
2553 if (!e_pm_valid_info(dip, NULL) || !e_pm_valid_comp(dip, comp, NULL) ||
2554 !e_pm_valid_power(dip, comp, level))
2557 return (dev_is_needed(dip, comp, level, PM_LEVEL_UPONLY));
2561 pm_lower_power(dev_info_t *dip, int comp, int level)
2565 if (!e_pm_valid_info(dip, NULL) || !e_pm_valid_comp(dip, comp, NULL) ||
2566 !e_pm_valid_power(dip, comp, level)) {
2568 "comp=%d level=%d\n", pmf, PM_DEVICE(dip), comp, level))
2572 if (!DEVI_IS_DETACHING(dip)) {
2574 pmf, PM_DEVICE(dip)))
2582 if (!PM_SCANABLE(dip) || pm_noinvol(dip)) {
2584 pmf, PM_DEVICE(dip),
2588 pm_noinvol(dip) ? "pm_noinvol()" : ""))
2592 if (dev_is_needed(dip, comp, level, PM_LEVEL_DOWNONLY) != DDI_SUCCESS) {
2594 PM_DEVICE(dip)))
2601 * Find the entries struct for a given dip in the blocked list, return it locked
2604 pm_psc_dip_to_direct(dev_info_t *dip, pscc_t **psccp)
2611 if (p->pscc_dip == dip) {
2621 panic("sunpm: no entry for dip %p in direct list", (void *)dip);
2634 psc_entry(ushort_t event, psce_t *psce, dev_info_t *dip, int comp, int new,
2644 (void) ddi_pathname(dip, buf);
2728 pm_enqueue_notify(ushort_t cmd, dev_info_t *dip, int comp,
2741 pmf, PM_DEVICE(dip), comp, oldlevel, newlevel))
2742 psce = pm_psc_dip_to_direct(dip, &pscc);
2745 "%d\n", pmf, PM_DEVICE(dip), pscc->pscc_clone,
2747 overrun = psc_entry(cmd, psce, dip, comp, newlevel, oldlevel,
2759 pmf, PM_DEVICE(dip), comp, oldlevel, newlevel))
2760 if (PM_ISDIRECT(dip) && canblock != PM_CANBLOCK_BYPASS) {
2761 psce = pm_psc_dip_to_direct(dip, &pscc);
2763 "%d\n", pmf, PM_DEVICE(dip), pscc->pscc_clone,
2765 overrun = psc_entry(cmd, psce, dip, comp, newlevel,
2778 (void) psc_entry(cmd, psce, dip, comp, newlevel,
2816 dev_info_t *dip, int *pcircp, int *circp)
2819 if (PM_TRY_LOCK_POWER(dip, circp)) {
2840 pm_blocked_by_us(dev_info_t *dip)
2846 dev_info_t *ppm = (dev_info_t *)DEVI(dip)->devi_pm_ppm;
2849 power_req.req.ppm_power_lock_owner_req.who = dip;
2850 if (pm_ctlops(ppm, dip, DDI_CTLOPS_POWER, &power_req, &result) !=
2858 PM_DEVICE(dip));
2877 pm_notify_parent(dev_info_t *dip,
2885 bphc.bphc_dip = dip;
2886 bphc.bphc_path = ddi_pathname(dip, pathbuf);
2902 pm_check_and_resume(dev_info_t *dip, int comp, int old_level, int level)
2906 if (PM_ISBC(dip) && comp == 0 && old_level == 0 && level != 0) {
2907 ASSERT(DEVI(dip)->devi_pm_flags & PMC_SUSPENDED);
2909 if ((ret = devi_attach(dip, DDI_PM_RESUME)) != DDI_SUCCESS)
2913 PM_NAME(dip), PM_ADDR(dip));
2914 DEVI(dip)->devi_pm_flags &= ~PMC_SUSPENDED;
2940 pm_power_has_changed(dev_info_t *dip, int comp, int level)
2944 dev_info_t *pdip = ddi_get_parent(dip);
2950 PM_DEVICE(dip), level))
2955 PM_DEVICE(dip), comp, level))
2957 if (!e_pm_valid_info(dip, NULL) || !e_pm_valid_comp(dip, comp, &cp) ||
2958 !e_pm_valid_power(dip, comp, level))
2973 cp = PM_CP(dip, comp);
2974 while (!pm_try_parent_child_locks(pdip, dip, &pcirc, &circ)) {
2975 if (((blocked = pm_blocked_by_us(dip)) != 0) &&
2979 pm_enqueue_notify(PSC_HAS_CHANGED, dip, comp,
2984 pm_notify_parent(dip,
2986 (void) pm_check_and_resume(dip,
3003 pm_level_to_index(dip, cp, level);
3005 "level=%d\n", pmf, PM_DEVICE(dip), comp, level))
3013 return (pm_phc_impl(dip,
3018 (!PM_ISBC(dip) || comp == 0) &&
3021 ret = pm_phc_impl(dip, comp, level, 1);
3023 if ((!PM_ISBC(dip) ||
3039 (!PM_ISBC(dip) || comp == 0) && POWERING_ON(old_level, level))
3041 ret = pm_phc_impl(dip, comp, level, 1);
3043 if ((!PM_ISBC(dip) || comp == 0) && level == 0 &&
3047 PM_UNLOCK_POWER(dip, circ);
3062 calc_cfb_comps_incr(dev_info_t *dip, int cmpt, int old, int new)
3064 struct pm_component *cp = PM_CP(dip, cmpt);
3080 update_comps_off(int incr, dev_info_t *dip)
3084 ASSERT(pm_cfb_comps_off <= PM_NUMCMPTS(dip));
3093 pm_phc_impl(dev_info_t *dip, int comp, int level, int notify)
3098 dev_info_t *pdip = ddi_get_parent(dip);
3103 dev_info_t *ppm = (dev_info_t *)DEVI(dip)->devi_pm_ppm;
3108 cp = PM_CP(dip, comp);
3116 "level=%d\n", pmf, PM_DEVICE(dip), comp, level))
3124 power_req.req.ppm_notify_level_req.who = dip;
3128 if (pm_ctlops(ppm, dip, DDI_CTLOPS_POWER, &power_req,
3131 pmf, PM_DEVICE(dip), level))
3135 if (PM_IS_CFB(dip)) {
3136 incr = calc_cfb_comps_incr(dip, comp, old_level, level);
3139 update_comps_off(incr, dip);
3141 "cfb_comps_off->%d\n", pmf, PM_DEVICE(dip),
3145 e_pm_set_cur_pwr(dip, PM_CP(dip, comp), level);
3150 pm_notify_parent(dip, pdip, comp, old_level, level);
3151 (void) pm_check_and_resume(dip, comp, old_level, level);
3160 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
3161 cp = PM_CP(dip, i);
3178 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
3179 cp = PM_CP(dip, i);
3194 (void) ddi_pathname(dip, pathbuf);
3202 pm_enqueue_notify(PSC_HAS_CHANGED, dip, comp, level, old_level,
3207 PMD(PMD_RESCAN, ("%s: %s@%s(%s#%d): pm_rescan\n", pmf, PM_DEVICE(dip)))
3208 pm_rescan(dip);
3224 pm_register_ppm(int (*func)(dev_info_t *), dev_info_t *dip)
3239 ppmcp->ppmc_dip = dip;
3247 while ((dip = ddi_get_parent(dip)) != NULL) {
3248 if (dip != ddi_root_node() && PM_GET_PM_INFO(dip) == NULL)
3250 pm_ppm_claim(dip);
3252 if (pm_ppm_claimed(dip) && PM_GET_PM_INFO(dip)) {
3258 p->who = dip;
3259 PM_LOCK_POWER(dip, &circ);
3260 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
3261 cp = PM_CP(dip, i);
3267 if (pm_ctlops(PPM(dip), dip,
3273 PM_DEVICE(dip), pwr))
3277 PM_UNLOCK_POWER(dip, circ);
3289 pm_ppm_claim(dev_info_t *dip)
3293 if (PPM(dip)) {
3298 if ((*ppmcp->ppmc_func)(dip)) {
3299 DEVI(dip)->devi_pm_ppm =
3314 pm_detaching(dev_info_t *dip)
3317 pm_info_t *info = PM_GET_PM_INFO(dip);
3320 PMD(PMD_REMDEV, ("%s: %s@%s(%s#%d), %d comps\n", pmf, PM_DEVICE(dip),
3321 PM_NUMCMPTS(dip)))
3324 ASSERT(DEVI_IS_DETACHING(dip));
3325 PM_LOCK_DIP(dip);
3327 PM_UNLOCK_DIP(dip);
3328 if (!PM_ISBC(dip))
3329 pm_scan_stop(dip);
3334 iscons = PM_IS_CFB(dip);
3335 if (iscons || PM_ISBC(dip)) {
3336 (void) pm_all_to_normal(dip, PM_CANBLOCK_BYPASS);
3358 pm_detach_failed(dev_info_t *dip)
3361 pm_info_t *info = PM_GET_PM_INFO(dip);
3366 ASSERT(DEVI_IS_DETACHING(dip));
3371 if (!pm_all_at_normal(dip)) {
3372 if (pm_all_to_normal(dip,
3376 PM_DEVICE(dip)))
3382 if (!PM_ISBC(dip)) {
3384 if (PM_SCANABLE(dip))
3385 pm_scan_init(dip);
3387 pm_rescan(dip);
3397 e_pm_default_levels(dev_info_t *dip, pm_component_t *cp, int norm)
3404 e_pm_set_cur_pwr(dip, cp, norm);
3408 e_pm_default_components(dev_info_t *dip, int cmpts)
3411 pm_component_t *p = DEVI(dip)->devi_pm_components;
3413 p = DEVI(dip)->devi_pm_components;
3435 pm_premanage(dev_info_t *dip, int style)
3440 pm_component_t *p = DEVI(dip)->devi_pm_components;
3443 ASSERT(!PM_IAM_LOCKING_DIP(dip));
3445 * If this dip has already been processed, don't mess with it
3447 if (DEVI(dip)->devi_pm_flags & PMC_COMPONENTS_DONE)
3449 if (DEVI(dip)->devi_pm_flags & PMC_COMPONENTS_FAILED) {
3456 if ((compp = pm_autoconfig(dip, &error)) == NULL) {
3461 DEVI(dip)->devi_pm_flags |= PMC_COMPONENTS_FAILED;
3470 if ((cmpts = PM_NUMCMPTS(dip)) == 0) {
3477 DEVI(dip)->devi_pm_flags |= PMC_BC;
3478 e_pm_default_components(dip, cmpts);
3486 norm = pm_get_normal_power(dip, i);
3489 PM_DEVICE(dip), i))
3496 PM_INCR_NOTLOWEST(dip);
3497 e_pm_default_levels(dip, PM_CP(dip, i), norm);
3504 cmpts = PM_NUMCMPTS(dip);
3507 p = DEVI(dip)->devi_pm_components;
3510 ASSERT(PM_CP(dip, i)->pmc_cur_pwr == 0);
3511 e_pm_set_cur_pwr(dip, PM_CP(dip, i), PM_LEVEL_UNKNOWN);
3513 if (DEVI(dip)->devi_pm_flags & PMC_CPU_THRESH)
3514 pm_set_device_threshold(dip, pm_cpu_idle_threshold,
3517 pm_set_device_threshold(dip, pm_system_idle_threshold,
3531 * Called with dip lock held, return with dip lock unheld.
3535 e_pm_manage(dev_info_t *dip, int style)
3539 dev_info_t *pdip = ddi_get_parent(dip);
3544 if (pm_premanage(dip, style) != DDI_SUCCESS) {
3547 PMD(PMD_KIDSUP, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
3548 ASSERT(PM_GET_PM_INFO(dip) == NULL);
3557 count = (PM_ISBC(dip)) ? 1 : PM_NUMCMPTS(dip);
3561 pm_set_pm_info(dip, info);
3565 (void) pm_thresh_specd(dip);
3571 (void) ddi_pathname(dip, pathbuf);
3576 if (!PM_ISBC(dip)) {
3578 if (PM_SCANABLE(dip)) {
3579 pm_scan_init(dip);
3581 pm_rescan(dip);
3596 pm_get_normal_power(dev_info_t *dip, int comp)
3599 if (comp >= 0 && comp < PM_NUMCMPTS(dip)) {
3600 return (PM_CP(dip, comp)->pmc_norm_pwr);
3609 pm_get_current_power(dev_info_t *dip, int comp, int *levelp)
3611 if (comp >= 0 && comp < PM_NUMCMPTS(dip)) {
3612 *levelp = PM_CURPOWER(dip, comp);
3622 cur_threshold(dev_info_t *dip, int comp)
3624 pm_component_t *cp = PM_CP(dip, comp);
3627 if (PM_ISBC(dip)) {
3636 if (DEVI(dip)->devi_pm_flags & PMC_NEXDEF_THRESH)
3638 else if (DEVI(dip)->devi_pm_flags & PMC_CPU_THRESH)
3672 pm_update_maxpower(dev_info_t *dip, int comp, int level)
3678 if (!e_pm_valid_info(dip, NULL) || !e_pm_valid_comp(dip, comp, NULL) ||
3679 !e_pm_valid_power(dip, comp, level)) {
3681 "comp=%d level=%d\n", pmf, PM_DEVICE(dip), comp, level))
3684 old = e_pm_get_max_power(dip, comp);
3685 e_pm_set_max_power(dip, comp, level);
3687 if (pm_set_power(dip, comp, level, PM_LEVEL_DOWNONLY,
3689 e_pm_set_max_power(dip, comp, old);
3691 PM_DEVICE(dip)))
3701 pm_all_to_normal(dev_info_t *dip, pm_canblock_t canblock)
3709 PMD(PMD_ALLNORM, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
3710 ASSERT(PM_GET_PM_INFO(dip));
3711 if (pm_get_norm_pwrs(dip, &normal, &size) != DDI_SUCCESS) {
3713 "%s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
3716 ncomps = PM_NUMCMPTS(dip);
3718 if (pm_set_power(dip, i, normal[i],
3723 PM_DEVICE(dip), i, normal[i], result))
3729 "to full power\n", pmf, changefailed, PM_DEVICE(dip)))
3739 pm_all_at_normal(dev_info_t *dip)
3746 PMD(PMD_ALLNORM, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
3747 if (pm_get_norm_pwrs(dip, &normal, &size) != DDI_SUCCESS) {
3751 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
3752 int current = PM_CURPOWER(dip, i);
3755 "norm=%d, cur=%d\n", pmf, PM_DEVICE(dip), i,
3761 if (i != PM_NUMCMPTS(dip)) {
3896 e_pm_create_components(dev_info_t *dip, int num_components)
3901 ASSERT(!PM_IAM_LOCKING_DIP(dip));
3902 ASSERT(!DEVI(dip)->devi_pm_components);
3903 ASSERT(!(DEVI(dip)->devi_pm_flags & PMC_COMPONENTS_DONE));
3908 DEVI(dip)->devi_pm_comp_size = size;
3909 DEVI(dip)->devi_pm_num_components = num_components;
3910 PM_LOCK_BUSY(dip);
3916 PM_UNLOCK_BUSY(dip);
3917 DEVI(dip)->devi_pm_components = ocompp;
3918 DEVI(dip)->devi_pm_flags |= PMC_COMPONENTS_DONE;
3988 e_pm_set_max_power(dev_info_t *dip, int component_number, int level)
3990 PM_CP(dip, component_number)->pmc_norm_pwr = level;
3997 e_pm_get_max_power(dev_info_t *dip, int component_number)
3999 return (PM_CP(dip, component_number)->pmc_norm_pwr);
4007 e_pm_destroy_components(dev_info_t *dip)
4012 ASSERT(!PM_IAM_LOCKING_DIP(dip));
4013 if (PM_NUMCMPTS(dip) == 0)
4015 cp = DEVI(dip)->devi_pm_components;
4017 for (i = 0; i < PM_NUMCMPTS(dip); i++, cp++) {
4024 if (PM_ISBC(dip))
4031 kmem_free(DEVI(dip)->devi_pm_components, DEVI(dip)->devi_pm_comp_size);
4032 DEVI(dip)->devi_pm_components = NULL;
4033 DEVI(dip)->devi_pm_num_components = 0;
4034 DEVI(dip)->devi_pm_flags &=
4046 pm_autoconfig(dev_info_t *dip, int *errp)
4064 ASSERT(!PM_IAM_LOCKING_DIP(dip));
4066 if (ddi_prop_lookup_string_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
4078 if (PM_NUMCMPTS(dip) != 0) {
4080 pmf, PM_DEVICE(dip), PM_NUMCMPTS(dip)))
4163 (void) e_pm_create_components(dip, components);
4165 e_pm_set_max_power(dip, i, np[i]);
4177 p->comp->pmc_name, PM_DEVICE(dip),
4187 p->comp->pmc_name, PM_DEVICE(dip),
4201 PM_DEVICE(dip)))
4224 e_pm_destroy_components(dip);
4231 cmn_err(CE_CONT, "! for %s@%s(%s#%d) is ill-formed.\n", PM_DEVICE(dip));
4276 pm_set_device_threshold(dev_info_t *dip, int base, int flag)
4282 int ncomp = PM_NUMCMPTS(dip);
4288 ASSERT(!PM_IAM_LOCKING_DIP(dip));
4289 PM_LOCK_DIP(dip);
4296 if (PM_IS_NEXUS(dip)) {
4299 PM_DEVICE(dip)))
4302 pmc = &PM_CP(dip, comp)->pmc_comp;
4308 DEVI(dip)->devi_pm_dev_thresh =
4314 if (DEVI(dip)->devi_pm_flags &
4316 PM_LOCK_POWER(dip, &circ);
4317 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
4318 if (PM_CURPOWER(dip, i) == 0)
4325 PM_DEVICE(dip), pm_comps_notlowest))
4327 pm_ppm_notify_all_lowest(dip,
4331 PM_UNLOCK_POWER(dip, circ);
4333 DEVI(dip)->devi_pm_flags &= PMC_THRESH_NONE;
4334 DEVI(dip)->devi_pm_flags |= PMC_NEXDEF_THRESH;
4335 PM_UNLOCK_DIP(dip);
4337 } else if (DEVI(dip)->devi_pm_flags & PMC_NEXDEF_THRESH) {
4343 PM_LOCK_POWER(dip, &circ);
4344 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
4345 if (PM_CURPOWER(dip, i) == 0)
4349 pm_ppm_notify_all_lowest(dip,
4354 PM_DEVICE(dip), pm_comps_notlowest))
4357 PM_UNLOCK_POWER(dip, circ);
4365 pmc = &PM_CP(dip, comp)->pmc_comp;
4373 pmc = &PM_CP(dip, comp)->pmc_comp;
4381 pmc = &PM_CP(dip, comp)->pmc_comp;
4384 "comp=%d, level=%d, %d\n", pmf, PM_DEVICE(dip),
4402 pmc = &PM_CP(dip, comp)->pmc_comp;
4413 pmc = &PM_CP(dip, comp)->pmc_comp;
4416 "comp=%d level=%d, %d\n", pmf, PM_DEVICE(dip),
4421 ASSERT(PM_IAM_LOCKING_DIP(dip));
4422 DEVI(dip)->devi_pm_dev_thresh = base;
4423 DEVI(dip)->devi_pm_flags &= PMC_THRESH_NONE;
4424 DEVI(dip)->devi_pm_flags |= flag;
4425 PM_UNLOCK_DIP(dip);
4454 ddi_dev_is_needed(dev_info_t *dip, int cmpt, int level)
4456 return (pm_raise_power(dip, cmpt, level));
4464 ddi_power(dev_info_t *dip, int pm_cmpt, int pm_level)
4469 request.req.set_power_req.who = dip;
4472 return (ddi_ctlops(dip, dip, DDI_CTLOPS_POWER, &request, NULL));
4482 ddi_removing_power(dev_info_t *dip)
4484 _NOTE(ARGUNUSED(dip))
4493 e_ddi_parental_suspend_resume(dev_info_t *dip)
4495 return (DEVI(dip)->devi_pm_flags & PMC_PARENTAL_SR);
4503 e_ddi_suspend(dev_info_t *dip, ddi_detach_cmd_t cmd)
4507 request.req.suspend_req.who = dip;
4509 return (ddi_ctlops(dip, dip, DDI_CTLOPS_POWER, &request, NULL));
4517 e_ddi_resume(dev_info_t *dip, ddi_attach_cmd_t cmd)
4521 request.req.resume_req.who = dip;
4523 return (ddi_ctlops(dip, dip, DDI_CTLOPS_POWER, &request, NULL));
4531 pm_create_components(dev_info_t *dip, int num_components)
4538 if (!DEVI_IS_ATTACHING(dip)) {
4542 /* don't need to lock dip because attach is single threaded */
4543 if (DEVI(dip)->devi_pm_components) {
4545 PM_DEVICE(dip), PM_NUMCMPTS(dip)))
4548 e_pm_create_components(dip, num_components);
4549 DEVI(dip)->devi_pm_flags |= PMC_BC;
4550 e_pm_default_components(dip, num_components);
4560 pm_destroy_components(dev_info_t *dip)
4563 dev_info_t *pdip = ddi_get_parent(dip);
4566 PM_DEVICE(dip)))
4567 ASSERT(DEVI_IS_DETACHING(dip));
4569 if (!PM_ISBC(dip))
4571 "(%s@%s) calls pm_destroy_components", PM_NAME(dip),
4572 PM_ADDR(dip));
4578 if (PM_NUMCMPTS(dip) == 0 || !PM_ISBC(dip)) {
4580 PM_DEVICE(dip)))
4583 ASSERT(PM_GET_PM_INFO(dip));
4589 ASSERT(!PM_GET_PM_SCAN(dip)); /* better be gone already */
4595 if ((PM_CURPOWER(dip, 0) != 0) && pdip && !PM_WANTS_NOTIFICATION(pdip))
4600 pmf, PM_DEVICE(dip)))
4603 e_pm_destroy_components(dip);
4607 DEVI(dip)->devi_pm_flags &=
4615 pm_busy_component(dev_info_t *dip, int cmpt)
4619 ASSERT(dip != NULL);
4620 if (!e_pm_valid_info(dip, NULL) || !e_pm_valid_comp(dip, cmpt, &cp))
4622 PM_LOCK_BUSY(dip);
4625 PM_UNLOCK_BUSY(dip);
4633 pm_idle_component(dev_info_t *dip, int cmpt)
4637 pm_scan_t *scanp = PM_GET_PM_SCAN(dip);
4639 if (!e_pm_valid_info(dip, NULL) || !e_pm_valid_comp(dip, cmpt, &cp))
4642 PM_LOCK_BUSY(dip);
4650 PM_UNLOCK_BUSY(dip);
4655 if (scanp && PM_IS_PID(dip)) {
4657 PM_DEVICE(dip)))
4658 pm_rescan(dip);
4666 if (PM_IS_NEXUS(dip) && (cp->pmc_busycount == 0)) {
4667 pm_rescan(dip);
4681 pm_set_normal_power(dev_info_t *dip, int comp, int level)
4685 if (!PM_ISBC(dip))
4688 PM_NAME(dip), PM_ADDR(dip));
4690 if (PM_ISBC(dip)) {
4692 "level=%d\n", pmf, PM_DEVICE(dip), comp, level))
4693 e_pm_set_max_power(dip, comp, level);
4694 e_pm_default_levels(dip, PM_CP(dip, comp), level);
4702 pm_stop(dev_info_t *dip)
4705 dev_info_t *pdip = ddi_get_parent(dip);
4707 ASSERT(!PM_IAM_LOCKING_DIP(dip));
4709 if (!PM_ISBC(dip)) {
4710 pm_scan_stop(dip);
4711 pm_scan_fini(dip);
4714 if (PM_GET_PM_INFO(dip) != NULL) {
4715 if (pm_unmanage(dip) == DDI_SUCCESS) {
4720 e_pm_destroy_components(dip);
4723 pmf, PM_DEVICE(dip)))
4726 if (PM_NUMCMPTS(dip))
4727 e_pm_destroy_components(dip);
4729 if (DEVI(dip)->devi_pm_flags & PMC_NOPMKID) {
4730 DEVI(dip)->devi_pm_flags &= ~PMC_NOPMKID;
4734 MDI_VHCI(pdip) && MDI_CLIENT(dip)) {
4737 (void *)dip, NULL, 0);
4749 e_new_pm_props(dev_info_t *dip)
4751 if (PM_GET_PM_INFO(dip) != NULL) {
4752 pm_stop(dip);
4754 if (e_pm_manage(dip, PM_STYLE_NEW) != DDI_SUCCESS) {
4758 e_pm_props(dip);
4766 e_pm_props(dev_info_t *dip)
4778 if (ddi_getlongprop(DDI_DEV_T_ANY, dip, propflag, "pm-hardware-state",
4788 "%s property value '%s'", PM_NAME(dip),
4789 PM_ADDR(dip), "pm-hardware-state", pp);
4799 if (ddi_prop_exists(DDI_DEV_T_ANY, dip, propflag,
4800 "pm-want-child-notification?") && PM_HAS_BUS_POWER(dip))
4802 ASSERT(PM_HAS_BUS_POWER(dip) || !ddi_prop_exists(DDI_DEV_T_ANY,
4803 dip, propflag, "pm-want-child-notification?"));
4804 if (ddi_prop_exists(DDI_DEV_T_ANY, dip, propflag,
4810 if (ddi_getlongprop(DDI_DEV_T_ANY, dip, propflag, "pm-class",
4816 "%s property value '%s'", PM_NAME(dip),
4817 PM_ADDR(dip), "pm-class", pp);
4822 DEVI(dip)->devi_pm_flags |= flags;
4831 pm_default_ctlops(dev_info_t *dip, dev_info_t *rdip,
4834 _NOTE(ARGUNUSED(dip))
4853 ASSERT(dip == NULL);
5009 * Don't need to lock the dip because we're single threaded by the devfs code
5012 pm_start(dev_info_t *dip)
5016 dev_info_t *pdip = ddi_get_parent(dip);
5018 void pm_noinvol_specd(dev_info_t *dip);
5020 e_pm_props(dip);
5021 pm_noinvol_specd(dip);
5023 * If this dip has already been processed, don't mess with it
5027 if (PM_GET_PM_INFO(dip)) {
5029 pmf, PM_DEVICE(dip)))
5032 ret = e_pm_manage(dip, PM_STYLE_UNKNOWN);
5034 if (PM_GET_PM_INFO(dip) == NULL) {
5038 DEVI(dip)->devi_pm_flags |= PMC_NOPMKID;
5041 } else if (pdip && MDI_VHCI(pdip) && MDI_CLIENT(dip)) {
5043 (void *)dip, NULL, 0);
5047 "left up\n", pmf, PM_DEVICE(dip)))
5177 pm_thresh_specd(dev_info_t *dip)
5184 path = ddi_pathname(dip, pathbuf);
5190 pm_apply_recorded_thresh(dip, rp);
5263 dev_info_t *dip;
5272 dip = pm_name_to_dip(keeper, 1);
5273 if (dip == NULL)
5286 ret += pm_apply_recorded_dep(dip, dp);
5301 pmf, PM_DEVICE(dip), PM_DEVICE(kept),
5303 if (kept != dip) {
5304 ret += pm_set_keeping(dip, kept);
5311 ddi_release_devi(dip);
5360 * Add ourselves to the dip list.
5504 pm_valid_power(dev_info_t *dip, int comp, int level)
5508 if (comp >= 0 && comp < PM_NUMCMPTS(dip) && level >= 0)
5509 return (e_pm_valid_power(dip, comp, level));
5512 pmf, comp, PM_NUMCMPTS(dip), level))
5524 pm_block(dev_info_t *dip, int comp, int newpower, int oldpower)
5532 ASSERT(PM_IAM_LOCKING_DIP(dip));
5533 new->pr_dip = dip;
5540 pm_enqueue_notify(PSC_PENDING_CHANGE, dip, comp, newpower, oldpower,
5542 PM_UNLOCK_DIP(dip);
5581 * Process with clone has just done PM_DIRECT_PM on dip, or has asked to
5582 * watch all state transitions (dip == NULL). Set up data
5586 pm_register_watcher(int clone, dev_info_t *dip)
5593 * there is already an entries struct (in the dip != NULL case).
5597 pscc->pscc_dip = dip;
5599 if (dip) {
5712 * If dip is NULL, process is closing "clone" clean up all its registrations.
5713 * Otherwise only clean up those for dip because process is just giving up
5717 pm_deregister_watcher(int clone, dev_info_t *dip)
5723 if (dip == NULL) {
5745 if ((dip && p->pscc_dip == dip) ||
5746 (dip == NULL && clone == p->pscc_clone)) {
5769 ASSERT(dip == NULL || found);
5852 pm_set_dev_thr_walk(dev_info_t *dip, void *arg)
5856 if (!PM_GET_PM_INFO(dip))
5858 pm_set_device_threshold(dip, thr, PMC_DEF_THRESH);
5866 pm_current_threshold(dev_info_t *dip, int comp, int *threshp)
5868 if (comp < 0 || comp >= PM_NUMCMPTS(dip)) {
5871 *threshp = cur_threshold(dip, comp);
5884 pm_lock_power(dev_info_t *dip, int *circp)
5890 power_req.req.ppm_lock_power_req.who = dip;
5892 (void) pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER, &power_req, &result);
5900 pm_unlock_power(dev_info_t *dip, int circ)
5906 power_req.req.ppm_unlock_power_req.who = dip;
5908 (void) pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER, &power_req, &result);
5919 pm_try_locking_power(dev_info_t *dip, int *circp)
5925 power_req.req.ppm_lock_power_req.who = dip;
5927 (void) pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER, &power_req, &result);
5955 pm_lock_power_single(dev_info_t *dip, int *circp)
5960 if (ndi_devi_tryenter(dip, circp))
5972 ndi_devi_enter(dip, circp);
5975 if (cur->pmlk_lender == DEVI(dip)->devi_busy_thread) {
5976 ASSERT(cur->pmlk_dip == NULL || cur->pmlk_dip == dip);
5977 cur->pmlk_dip = dip;
5979 ndi_devi_enter(dip, circp);
5991 pm_unlock_power_single(dev_info_t *dip, int circ)
5997 ndi_devi_exit(dip, circ);
6008 if (cur == NULL || cur->pmlk_dip != dip)
6010 ndi_devi_exit(dip, circ);
6019 pm_try_locking_power_single(dev_info_t *dip, int *circp)
6021 return (ndi_devi_tryenter(dip, circp));
6069 * dip.
6072 pm_apply_recorded_thresh(dev_info_t *dip, pm_thresh_rec_t *rp)
6076 int comps = PM_NUMCMPTS(dip);
6082 PM_DEVICE(dip), (void *)rp, rp->ptr_physpath))
6083 PM_LOCK_DIP(dip);
6084 if (!PM_GET_PM_INFO(dip) || PM_ISBC(dip) || !pm_valid_thresh(dip, rp)) {
6086 pmf, PM_DEVICE(dip), (void*)PM_GET_PM_INFO(dip)))
6088 pmf, PM_DEVICE(dip), PM_ISBC(dip)))
6090 pmf, PM_DEVICE(dip), pm_valid_thresh(dip, rp)))
6091 PM_UNLOCK_DIP(dip);
6102 pmf, PM_DEVICE(dip), ep->pte_thresh[0]))
6103 PM_UNLOCK_DIP(dip);
6104 pm_set_device_threshold(dip, ep->pte_thresh[0], PMC_DEV_THRESH);
6105 if (PM_SCANABLE(dip))
6106 pm_rescan(dip);
6110 cp = PM_CP(dip, i);
6113 "to %x\n", pmf, j, PM_DEVICE(dip),
6119 DEVI(dip)->devi_pm_flags &= PMC_THRESH_NONE;
6120 DEVI(dip)->devi_pm_flags |= PMC_COMP_THRESH;
6121 PM_UNLOCK_DIP(dip);
6123 if (PM_SCANABLE(dip))
6124 pm_rescan(dip);
6128 * Returns true if the threshold specified by rp could be applied to dip
6132 pm_valid_thresh(dev_info_t *dip, pm_thresh_rec_t *rp)
6139 if (!PM_GET_PM_INFO(dip) || PM_ISBC(dip)) {
6154 if (rp->ptr_numcomps != (comps = PM_NUMCMPTS(dip))) {
6155 PMD(PMD_ERROR, ("%s: comp # mm (dip %d cmd %d) for %s\n",
6156 pmf, PM_NUMCMPTS(dip), rp->ptr_numcomps, rp->ptr_physpath))
6161 cp = PM_CP(dip, i);
6261 pm_discard_dep_walk(dev_info_t *dip, void *arg)
6266 if (PM_GET_PM_INFO(dip) == NULL)
6269 (void) ddi_pathname(dip, pathbuf);
6276 pm_kept_walk(dev_info_t *dip, void *arg)
6282 (void) ddi_pathname(dip, pathbuf);
6290 pm_keeper_walk(dev_info_t *dip, void *arg)
6296 (void) ddi_pathname(dip, pathbuf);
6554 pm_forget_power_level(dev_info_t *dip)
6556 dev_info_t *pdip = ddi_get_parent(dip);
6559 if (!PM_ISBC(dip)) {
6560 for (i = 0; i < PM_NUMCMPTS(dip); i++)
6561 count += (PM_CURPOWER(dip, i) == 0);
6569 if (DEVI(dip)->devi_pm_volpmd &&
6570 PM_CP(dip, 0)->pmc_cur_pwr == 0)
6571 DEVI(dip)->devi_pm_volpmd = 0;
6572 for (i = 0; i < PM_NUMCMPTS(dip); i++)
6573 e_pm_set_cur_pwr(dip, PM_CP(dip, i), PM_LEVEL_UNKNOWN);
6809 pm_init_child(dev_info_t *dip)
6813 ASSERT(ddi_binding_name(dip));
6814 ASSERT(ddi_get_name_addr(dip));
6815 pm_ppm_claim(dip);
6816 if (pm_ppm_claimed(dip)) { /* if ppm driver claims the node */
6818 power_req.req.ppm_config_req.who = dip;
6819 ASSERT(PPM(dip) != NULL);
6820 return (pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER, &power_req,
6826 power_req.req.ppm_config_req.who = dip;
6827 (void) pm_ctlops(NULL, dip,
6840 pm_pre_probe(dev_info_t *dip, pm_ppm_cookie_t *cp)
6846 cp->ppc_dip = dip;
6848 pm_ppm_claim(dip);
6849 if (pm_ppm_claimed(dip)) { /* if ppm driver claims the node */
6851 power_req.req.ppm_config_req.who = dip;
6852 ASSERT(PPM(dip) != NULL);
6853 (void) pm_ctlops(PPM(dip), dip,
6855 cp->ppc_ppm = PPM(dip);
6860 power_req.req.ppm_config_req.who = dip;
6861 (void) pm_ctlops(NULL, dip,
6869 pm_pre_config(dev_info_t *dip, char *devnm)
6874 if (MDI_VHCI(dip)) {
6875 PMD(PMD_SET, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
6876 ret = mdi_power(dip, MDI_PM_PRE_CONFIG, NULL, devnm, 0);
6878 } else if (!PM_GET_PM_INFO(dip))
6881 PMD(PMD_SET, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
6882 pm_hold_power(dip);
6883 ret = pm_all_to_normal(dip, PM_CANBLOCK_BLOCK);
6885 pm_rele_power(dip);
6891 * If the call is due to auto mod_unloads and the dip is not at its
6896 pm_pre_unconfig(dev_info_t *dip, int flags, int *held, char *devnm)
6901 if (MDI_VHCI(dip)) {
6903 PM_DEVICE(dip), flags))
6904 ret = mdi_power(dip, MDI_PM_PRE_UNCONFIG, held, devnm, flags);
6906 } else if (!PM_GET_PM_INFO(dip))
6909 PMD(PMD_SET, ("%s: %s@%s(%s#%d), flags=%x\n", pmf, PM_DEVICE(dip),
6914 * If the dip is a leaf node, don't power it up.
6916 if (!ddi_get_child(dip))
6922 if ((flags & NDI_AUTODETACH) && !pm_all_at_normal(dip))
6925 pm_hold_power(dip);
6927 ret = pm_all_to_normal(dip, PM_CANBLOCK_BLOCK);
6929 pm_rele_power(dip);
6940 pm_pre_attach(dev_info_t *dip, pm_ppm_cookie_t *cp, ddi_attach_cmd_t cmd)
6951 cp->ppc_ppm = PPM(dip);
6952 cp->ppc_dip = dip;
6963 power_req.req.ppm_config_req.who = dip;
6964 ASSERT(PPM(dip));
6965 (void) pm_ctlops(cp->ppc_ppm, dip, DDI_CTLOPS_POWER,
6971 power_req.req.ppm_config_req.who = dip;
6972 (void) pm_ctlops(NULL, dip,
6978 pm_forget_power_level(dip);
7015 pm_uninit_child(dev_info_t *dip)
7019 ASSERT(ddi_binding_name(dip));
7020 ASSERT(ddi_get_name_addr(dip));
7021 pm_ppm_claim(dip);
7022 if (pm_ppm_claimed(dip)) { /* if ppm driver claims the node */
7024 power_req.req.ppm_config_req.who = dip;
7025 ASSERT(PPM(dip));
7026 return (pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER, &power_req,
7032 power_req.req.ppm_config_req.who = dip;
7033 (void) pm_ctlops(NULL, dip, DDI_CTLOPS_POWER, &power_req, NULL);
7069 pm_post_config(dev_info_t *dip, char *devnm)
7073 if (MDI_VHCI(dip)) {
7074 PMD(PMD_SET, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
7075 (void) mdi_power(dip, MDI_PM_POST_CONFIG, NULL, devnm, 0);
7077 } else if (!PM_GET_PM_INFO(dip))
7080 PMD(PMD_SET, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
7081 pm_rele_power(dip);
7085 pm_post_unconfig(dev_info_t *dip, int held, char *devnm)
7089 if (MDI_VHCI(dip)) {
7091 PM_DEVICE(dip), held))
7092 (void) mdi_power(dip, MDI_PM_POST_UNCONFIG, &held, devnm, 0);
7094 } else if (!PM_GET_PM_INFO(dip))
7097 PMD(PMD_SET, ("%s: %s@%s(%s#%d), held = %d\n", pmf, PM_DEVICE(dip),
7104 pm_rele_power(dip);
7115 dev_info_t *dip;
7120 dip = cp->ppc_dip;
7126 if (PM_GET_PM_INFO(dip) == NULL)
7127 (void) pm_start(dip);
7132 pm_stop(dip);
7159 pm_pre_detach(dev_info_t *dip, ddi_detach_cmd_t cmd, pm_ppm_cookie_t *cp)
7165 cp->ppc_dip = dip;
7170 pm_detaching(dip); /* suspend pm while detaching */
7171 if (pm_ppm_claimed(dip)) { /* if ppm driver claims node */
7173 power_req.req.ppm_config_req.who = dip;
7174 ASSERT(PPM(dip));
7175 (void) pm_ctlops(PPM(dip), dip, DDI_CTLOPS_POWER,
7177 cp->ppc_ppm = PPM(dip);
7182 power_req.req.ppm_config_req.who = dip;
7183 (void) pm_ctlops(NULL, dip,
7274 pm_record_invol(dev_info_t *dip)
7278 int volpmd = (PM_NUMCMPTS(dip) > 0) && pm_all_components_off(dip);
7281 (void) ddi_pathname(dip, pathbuf);
7283 pm_record_invol_path(pathbuf, (DEVI(dip)->devi_pm_flags &
7284 (PMC_NO_INVOL | PMC_CONSOLE_FB)), DEVI(dip)->devi_pm_noinvolpm,
7285 DEVI(dip)->devi_pm_volpmd, volpmd, PM_MAJOR(dip));
7294 dip);
7301 dev_info_t *dip = cp->ppc_dip;
7329 ((DEVI(dip)->devi_pm_flags &
7331 DEVI(dip)->devi_pm_noinvolpm))
7332 pm_record_invol(dip);
7333 DEVI(dip)->devi_pm_flags &=
7341 if (PM_IS_CFB(dip)) {
7349 pm_stop(dip); /* make it permanent */
7351 if (PM_IS_CFB(dip)) {
7360 pm_detach_failed(dip); /* resume power management */
7384 pm_adjust_timestamps(dev_info_t *dip, void *arg)
7388 pm_info_t *info = PM_GET_PM_INFO(dip);
7394 PM_LOCK_BUSY(dip);
7395 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
7396 cp = PM_CP(dip, i);
7400 PM_UNLOCK_BUSY(dip);
7407 * parents and set a flag in the dip
7410 pm_noinvol_specd(dev_info_t *dip)
7418 if (DEVI(dip)->devi_pm_flags & PMC_NOINVOL_DONE)
7420 DEVI(dip)->devi_pm_flags |= PMC_NOINVOL_DONE;
7422 (void) ddi_pathname(dip, pathbuf);
7424 PM_LOCK_DIP(dip);
7425 DEVI(dip)->devi_pm_volpmd = 0;
7426 DEVI(dip)->devi_pm_noinvolpm = 0;
7438 PM_UNLOCK_DIP(dip);
7449 DEVI(dip)->devi_pm_flags |= ip->ni_flags;
7453 if (PM_IS_CFB(dip)) {
7455 cfb_dip = dip;
7457 "cfb_dip\n", pmf, PM_DEVICE(dip)))
7460 DEVI(dip)->devi_pm_noinvolpm = ip->ni_noinvolpm;
7461 ASSERT((DEVI(dip)->devi_pm_flags &
7463 DEVI(dip)->devi_pm_noinvolpm);
7464 DEVI(dip)->devi_pm_volpmd = ip->ni_volpmd;
7484 PM_UNLOCK_DIP(dip);
7494 wasvolpmd, pathbuf, dip);
7505 PM_UNLOCK_DIP(dip);
7509 pm_all_components_off(dev_info_t *dip)
7514 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
7515 cp = PM_CP(dip, i);
7534 dev_info_t *dip;
7575 dip = e_ddi_hold_devi_by_path(path, 0);
7576 if (dip == NULL) {
7590 ddi_release_devi(dip);
7624 dev_info_t *dip;
7667 if ((dip = fbdip) != NULL) {
7669 PM_DEVICE(dip)))
7675 cfb_dip = dip;
7676 DEVI(dip)->devi_pm_flags |= (PMC_CONSOLE_FB | PMC_NO_INVOL);
7678 PM_DEVICE(dip)))
7680 if (!(PM_GET_PM_INFO(dip) != NULL && PM_NUMCMPTS(dip))) {
7682 pmf, PM_DEVICE(dip)))
7695 dip = pm_name_to_dip(devname, 0);
7696 if (dip != NULL) {
7702 0, 0, devname, dip);
8000 pm_save_direct_lvl_walk(dev_info_t *dip, void *arg)
8005 pm_info_t *info = PM_GET_PM_INFO(dip);
8010 if (PM_ISDIRECT(dip) && !PM_ISBC(dip)) {
8011 if (PM_NUMCMPTS(dip) > 2) {
8012 info->pmi_lp = kmem_alloc(PM_NUMCMPTS(dip) *
8019 for (i = 0; i < PM_NUMCMPTS(dip); i++)
8020 *ip++ = PM_CURPOWER(dip, i);
8027 pm_proceed(dip, PMP_RELEASE, -1, -1);
8048 pm_restore_direct_lvl_walk(dev_info_t *dip, void *arg)
8055 pm_info_t *info = PM_GET_PM_INFO(dip);
8059 if (PM_ISDIRECT(dip) && !PM_ISBC(dip)) {
8060 if ((nc = PM_NUMCMPTS(dip)) > 2) {
8075 if (PM_CURPOWER(dip, i) == *ip)
8077 if (pm_set_power(dip, i, *ip, PM_LEVEL_EXACT,
8084 i, PM_NAME(dip),
8085 PM_ADDR(dip), *ip);
8088 "errno %d\n", pmf, PM_DEVICE(dip), i,
8089 PM_CURPOWER(dip, i), *ip, result))
8234 dev_info_t *dip;
8239 * First we look up the ancestor's dip. If we find it, then we
8252 dip = pm_name_to_dip(pathbuf, 1);
8253 if (dip != NULL) {
8254 locked = PM_MAJOR(dip);
8257 path, dip);
8260 ddi_release_devi(dip);
8386 pm_is_cfb(dev_info_t *dip)
8388 return (dip == cfb_dip);
8409 pm_hold_power(dev_info_t *dip)
8411 e_pm_hold_rele_power(dip, 1);
8419 pm_rele_power(dev_info_t *dip)
8421 e_pm_hold_rele_power(dip, -1);
8425 * A wrapper of pm_all_to_normal() to power up a dip
8429 pm_powerup(dev_info_t *dip)
8433 PMD(PMD_ALLNORM, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
8439 if (!PM_GET_PM_INFO(dip)) {
8440 if (!DEVI_IS_ATTACHING(dip))
8442 if (pm_start(dip) != DDI_SUCCESS)
8444 if (!PM_GET_PM_INFO(dip))
8448 return (pm_all_to_normal(dip, PM_CANBLOCK_BLOCK));
8452 pm_rescan_walk(dev_info_t *dip, void *arg)
8456 if (!PM_GET_PM_INFO(dip) || PM_ISBC(dip))
8465 pm_scan_init(dip);
8467 (void) pm_rescan(dip);
8472 pm_get_next_descendent(dev_info_t *dip, dev_info_t *tdip)
8476 for (wdip = tdip; wdip != dip; wdip = pdip) {
8478 if (pdip == dip)
8485 pm_busop_bus_power(dev_info_t *dip, void *impl_arg, pm_bus_power_op_t op,
8502 PMD(PMD_SET, ("%s: %s@%s(%s#%d) %s\n", pmf, PM_DEVICE(dip),
8509 cdip = pm_get_next_descendent(dip, tdip);
8558 if (!e_pm_valid_info(dip, NULL) ||
8559 !e_pm_valid_comp(dip, bpn->bpn_comp, &cp) ||
8560 !e_pm_valid_power(dip, bpn->bpn_comp, bpn->bpn_level)) {
8562 pmf, PM_DEVICE(dip)))
8568 ASSERT(bpn->bpn_dip == dip);
8570 PM_DEVICE(dip)))
8571 new_bpc.bpc_dip = dip;
8573 new_bpc.bpc_path = ddi_pathname(dip, pathbuf);
8575 new_bpc.bpc_olevel = PM_CURPOWER(dip, bpn->bpn_comp);
8582 ret = pm_busop_set_power(dip, impl_arg, BUS_POWER_CHILD_PWRCHG,
8590 cdip = pm_get_next_descendent(dip, tdip);
8628 * path and the target dip passed in is up to and incl.
8646 pm_busop_set_power(dev_info_t *dip, void *impl_arg, pm_bus_power_op_t op,
8666 dev_info_t *pdip = ddi_get_parent(dip);
8675 pm_component_t *cp = PM_CP(dip, comp);
8681 PMD(PMD_SET, ("%s: %s@%s(%s#%d) %s\n", pmf, PM_DEVICE(dip),
8694 * PM_ISDIRECT(dip)
8704 PM_LOCK_DIP(dip);
8705 while (PM_ISDIRECT(dip) && !pm_processes_stopped) {
8706 /* releases dip lock */
8707 ret = pm_busop_match_request(dip, bpc);
8709 PM_LOCK_DIP(dip);
8714 PM_UNLOCK_DIP(dip);
8717 if (PM_ISBC(dip) && comp != 0 && nlevel != 0 &&
8719 int nrmpwr0 = pm_get_normal_power(dip, 0);
8720 if (pm_set_power(dip, 0, nrmpwr0, direction,
8728 "%s@%s(%s#%d)\n", pmf, PM_DEVICE(pdip), PM_DEVICE(dip)))
8744 PM_LOCK_POWER(dip, &circ);
8745 clevel = PM_CURPOWER(dip, comp);
8752 if (nlevel > pm_get_normal_power(dip, comp)) {
8760 "dir=%s\n", pmf, PM_DEVICE(dip), comp, bpc->bpc_olevel, nlevel,
8775 if (clevel == nlevel && !PM_ISBC(dip)) {
8781 } else if (PM_IS_CFB(dip) && (nlevel < clevel)) {
8807 thresh = cur_threshold(dip, comp);
8809 if (scan && ((PM_KUC(dip) != 0) ||
8811 ((idletime < thresh) && !PM_IS_PID(dip)))) {
8813 if (DEVI(dip)->devi_pm_kidsupcnt != 0)
8837 if (PM_IS_CFB(dip) && (comps_off_incr =
8838 calc_cfb_comps_incr(dip, comp, clevel, nlevel)) > 0) {
8845 update_comps_off(comps_off_incr, dip);
8847 pmf, PM_DEVICE(dip), comp, clevel, nlevel,
8851 if ((*iresp = power_dev(dip,
8857 if (PM_CURPOWER(dip, comp) == 0) {
8859 pdpchk.pdpc_dip = dip;
8860 pdpchk.pdpc_par_involved = PM_WANTS_NOTIFICATION(dip);
8861 ndi_devi_enter(dip, &circ_db);
8862 for (cdip = ddi_get_child(dip); cdip != NULL;
8869 ndi_devi_exit(dip, circ_db);
8876 if (PM_IS_CFB(dip) && comps_off_incr < 0) {
8877 update_comps_off(comps_off_incr, dip);
8879 "cfb_comps_off->%d\n", pmf, PM_DEVICE(dip),
8884 if (PM_ISBC(dip)) {
8889 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
8891 if (PM_CURPOWER(dip, i)) {
8900 if (PM_ISBC(dip)) {
8905 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
8908 if (PM_CURPOWER(dip, i) > 0) {
8921 (void) ddi_pathname(dip, pathbuf);
8926 if ((PM_CURPOWER(dip, comp) == nlevel) && pm_watchers()) {
8933 pm_enqueue_notify(PSC_HAS_CHANGED, dip, comp, nlevel,
8952 pm_rescan(dip);
8956 update_comps_off(-comps_off_incr, dip);
8958 "cfb_comps_off->%d\n", pmf, PM_DEVICE(dip),
8984 PM_UNLOCK_POWER(dip, circ);
8987 PM_DEVICE(dip), ret))
8990 PM_UNLOCK_POWER(dip, circ);
8997 (!PM_ISBC(dip) || comp == 0)))
9004 nlevel == 0 && (!PM_ISBC(dip) || comp == 0))
9020 pm_busop_match_request(dev_info_t *dip, void *arg)
9031 ASSERT(PM_IAM_LOCKING_DIP(dip));
9032 PM_LOCK_POWER(dip, &circ);
9033 clevel = PM_CURPOWER(dip, comp);
9035 pmf, PM_DEVICE(dip), comp, nlevel, clevel))
9038 PM_UNLOCK_POWER(dip, circ);
9039 PM_UNLOCK_DIP(dip);
9043 PM_UNLOCK_POWER(dip, circ);
9044 PM_UNLOCK_DIP(dip);
9048 PM_UNLOCK_POWER(dip, circ);
9049 PM_UNLOCK_DIP(dip);
9057 PM_UNLOCK_POWER(dip, circ);
9059 /* pm_block releases dip lock */
9060 switch (pm_block(dip, comp, nlevel, clevel)) {
9076 pm_all_to_normal_nexus(dev_info_t *dip, pm_canblock_t canblock)
9087 ASSERT(PM_GET_PM_INFO(dip));
9088 PMD(PMD_ALLNORM, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
9089 if (pm_get_norm_pwrs(dip, &normal, &size) != DDI_SUCCESS) {
9093 ncomps = PM_NUMCMPTS(dip);
9095 bpn.bpn_dip = dip;
9101 ret = pm_busop_bus_power(dip, NULL, BUS_POWER_NEXUS_PWRUP,
9105 "->%d failure result %d\n", pmf, PM_DEVICE(dip),
9113 "full power\n", pmf, changefailed, PM_DEVICE(dip)))
9142 pm_noinvol_update_node(dev_info_t *dip, pm_bp_noinvol_t *req)
9146 PMD(PMD_NOINVOL, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
9150 "noinvol %d->%d\n", pmf, PM_DEVICE(dip),
9151 DEVI(dip)->devi_pm_noinvolpm,
9152 DEVI(dip)->devi_pm_noinvolpm - 1))
9153 ASSERT(DEVI(dip)->devi_pm_noinvolpm);
9154 PM_LOCK_DIP(dip);
9155 DEVI(dip)->devi_pm_noinvolpm--;
9159 PM_DEVICE(dip), DEVI(dip)->devi_pm_volpmd,
9160 DEVI(dip)->devi_pm_volpmd - 1))
9161 if (DEVI(dip)->devi_pm_volpmd)
9162 DEVI(dip)->devi_pm_volpmd--;
9164 PM_UNLOCK_DIP(dip);
9169 "noinvolpm %d->%d\n", pmf, PM_DEVICE(dip),
9170 DEVI(dip)->devi_pm_noinvolpm,
9171 DEVI(dip)->devi_pm_noinvolpm + 1))
9172 PM_LOCK_DIP(dip);
9173 DEVI(dip)->devi_pm_noinvolpm++;
9177 PM_DEVICE(dip), DEVI(dip)->devi_pm_volpmd,
9178 DEVI(dip)->devi_pm_volpmd + 1))
9179 DEVI(dip)->devi_pm_volpmd++;
9181 PM_UNLOCK_DIP(dip);
9186 "noinvol %d->%d\n", pmf, PM_DEVICE(dip),
9187 DEVI(dip)->devi_pm_noinvolpm,
9188 DEVI(dip)->devi_pm_noinvolpm - 1))
9189 ASSERT(DEVI(dip)->devi_pm_noinvolpm);
9190 PM_LOCK_DIP(dip);
9191 DEVI(dip)->devi_pm_noinvolpm--;
9195 "volpmd %d->%d\n", pmf, PM_DEVICE(dip),
9196 DEVI(dip)->devi_pm_volpmd,
9197 DEVI(dip)->devi_pm_volpmd - 1))
9203 if (DEVI(dip)->devi_pm_volpmd)
9204 DEVI(dip)->devi_pm_volpmd--;
9206 PM_UNLOCK_DIP(dip);
9212 pmf, PM_DEVICE(dip), DEVI(dip)->devi_pm_noinvolpm,
9213 DEVI(dip)->devi_pm_noinvolpm + 1))
9214 PM_LOCK_DIP(dip);
9215 DEVI(dip)->devi_pm_noinvolpm++;
9216 PM_UNLOCK_DIP(dip);
9222 pmf, PM_DEVICE(dip),
9223 DEVI(dip)->devi_pm_volpmd, DEVI(dip)->devi_pm_volpmd -
9225 PM_LOCK_DIP(dip);
9226 DEVI(dip)->devi_pm_volpmd -= req->bpni_volpmd;
9227 PM_UNLOCK_DIP(dip);
9238 pm_desc_pwrchk_walk(dev_info_t *dip, void *arg)
9242 pm_info_t *info = PM_GET_PM_INFO(dip);
9250 PMD(PMD_SET, ("%s: %s@%s(%s#%d)\n", pmf, PM_DEVICE(dip)))
9251 for (i = 0; i < PM_NUMCMPTS(dip); i++) {
9253 if ((curpwr = PM_CURPOWER(dip, i)) == 0)
9260 PM_DEVICE(pdpchk->pdpc_dip), PM_DEVICE(dip), i, curpwr))
9263 PM_DEVICE(dip), PM_DEVICE(pdpchk->pdpc_dip));