Lines Matching defs:softsp
182 static int power_attach_acpi(struct power_soft_state *softsp);
183 static void power_detach_acpi(struct power_soft_state *softsp);
186 static int power_setup_regs(struct power_soft_state *softsp);
187 static void power_free_regs(struct power_soft_state *softsp);
282 struct power_soft_state *softsp;
289 if ((softsp = ddi_get_soft_state(power_state, power_inst))
292 *result = (void *)softsp->dip;
307 struct power_soft_state *softsp;
338 softsp = ddi_get_soft_state(power_state, power_inst);
339 softsp->dip = dip;
342 (void) power_attach_acpi(softsp);
344 if (power_setup_regs(softsp) != DDI_SUCCESS) {
350 &softsp->high_iblock_cookie) != DDI_SUCCESS) {
355 mutex_init(&softsp->power_intr_mutex, NULL, MUTEX_DRIVER,
356 softsp->high_iblock_cookie);
358 if (ddi_add_intr(dip, 0, &softsp->high_iblock_cookie, NULL,
359 power_high_intr, (caddr_t)softsp) != DDI_SUCCESS) {
362 mutex_destroy(&softsp->power_intr_mutex);
368 &softsp->soft_iblock_cookie) != DDI_SUCCESS) {
371 mutex_destroy(&softsp->power_intr_mutex);
376 mutex_init(&softsp->power_mutex, NULL, MUTEX_DRIVER,
377 (void *)softsp->soft_iblock_cookie);
379 if (ddi_add_softintr(dip, DDI_SOFTINT_LOW, &softsp->softintr_id,
380 NULL, NULL, power_soft_intr, (caddr_t)softsp) != DDI_SUCCESS) {
383 mutex_destroy(&softsp->power_mutex);
384 mutex_destroy(&softsp->power_intr_mutex);
398 power_detach_acpi(softsp);
400 power_free_regs(softsp);
433 struct power_soft_state *softsp = (struct power_soft_state *)arg;
434 ddi_acc_handle_t hdl = softsp->power_rhandle;
442 if (softsp->power_regs_mapped) {
443 mutex_enter(&softsp->power_intr_mutex);
448 EPIC_WR(hdl, softsp->power_btn_reg,
451 EPIC_RD(hdl, softsp->power_btn_reg, reg);
455 EPIC_WR(hdl, softsp->power_btn_reg,
458 if (!softsp->power_btn_ioctl) {
459 mutex_exit(&softsp->power_intr_mutex);
462 softsp->power_btn_ioctl = B_FALSE;
465 reg = ddi_get8(hdl, softsp->power_btn_reg);
466 if (reg & softsp->power_btn_bit) {
467 reg &= softsp->power_btn_bit;
468 ddi_put8(hdl, softsp->power_btn_reg, reg);
469 (void) ddi_get8(hdl, softsp->power_btn_reg);
471 if (!softsp->power_btn_ioctl) {
472 mutex_exit(&softsp->power_intr_mutex);
475 softsp->power_btn_ioctl = B_FALSE;
478 mutex_exit(&softsp->power_intr_mutex);
492 mutex_enter(&softsp->power_intr_mutex);
494 mutex_exit(&softsp->power_intr_mutex);
506 mutex_enter(&softsp->power_intr_mutex);
509 mutex_exit(&softsp->power_intr_mutex);
524 if (softsp->softintr_id != NULL)
525 ddi_trigger_softintr(softsp->softintr_id);
544 struct power_soft_state *softsp = (struct power_soft_state *)arg;
549 mutex_enter(&softsp->power_intr_mutex);
551 mutex_exit(&softsp->power_intr_mutex);
567 mutex_exit(&softsp->power_intr_mutex);
569 softsp, NSEC_TO_TICK(power_button_abort_interval) +
593 struct power_soft_state *softsp = (struct power_soft_state *)arg;
600 mutex_enter(&softsp->power_intr_mutex);
608 mutex_exit(&softsp->power_intr_mutex);
631 mutex_exit(&softsp->power_intr_mutex);
637 mutex_exit(&softsp->power_intr_mutex);
640 (void) power_issue_shutdown((caddr_t)softsp);
647 mutex_exit(&softsp->power_intr_mutex);
677 struct power_soft_state *softsp = (struct power_soft_state *)arg;
679 mutex_enter(&softsp->power_mutex);
680 softsp->events |= PB_BUTTON_PRESS;
681 if (softsp->monitor_on != 0) {
682 mutex_exit(&softsp->power_mutex);
683 pollwakeup(&softsp->pollhd, POLLRDNORM);
684 pollwakeup(&softsp->pollhd, POLLIN);
685 power_gen_sysevent(softsp);
689 if (!softsp->shutdown_pending) {
692 softsp->shutdown_pending = 1;
702 mutex_exit(&softsp->power_mutex);
708 power_gen_sysevent(struct power_soft_state *softsp)
725 if (softsp->gpe_attached) {
739 (void) ddi_pathname(softsp->dip, pathname);
750 err = ddi_log_sysevent(softsp->dip, DDI_VENDOR_SUNW, EC_PWRCTL,
767 struct power_soft_state *softsp;
773 if ((softsp = ddi_get_soft_state(power_state, power_inst)) ==
777 mutex_enter(&softsp->power_mutex);
779 if (!softsp->clones[clone])
785 mutex_exit(&softsp->power_mutex);
790 softsp->clones[clone] = 1;
791 mutex_exit(&softsp->power_mutex);
803 struct power_soft_state *softsp;
809 if ((softsp = ddi_get_soft_state(power_state, power_inst)) ==
814 mutex_enter(&softsp->power_mutex);
815 if (softsp->monitor_on == clone)
816 softsp->monitor_on = 0;
817 softsp->clones[clone] = 0;
818 mutex_exit(&softsp->power_mutex);
828 struct power_soft_state *softsp;
831 if ((softsp = ddi_get_soft_state(power_state, power_inst)) ==
838 mutex_enter(&softsp->power_mutex);
839 if (softsp->monitor_on) {
840 mutex_exit(&softsp->power_mutex);
843 softsp->monitor_on = clone;
844 mutex_exit(&softsp->power_mutex);
848 mutex_enter(&softsp->power_mutex);
855 if (!softsp->monitor_on) {
856 mutex_exit(&softsp->power_mutex);
863 if (softsp->monitor_on != clone) {
864 mutex_exit(&softsp->power_mutex);
867 softsp->monitor_on = 0;
868 mutex_exit(&softsp->power_mutex);
872 mutex_enter(&softsp->power_mutex);
873 if (ddi_copyout((void *)&softsp->events, (void *)arg,
875 mutex_exit(&softsp->power_mutex);
884 softsp->events = 0;
885 mutex_exit(&softsp->power_mutex);
893 (UINT32)power_acpi_fixed_event((void *)softsp);
895 if (softsp->power_regs_mapped) {
896 mutex_enter(&softsp->power_intr_mutex);
897 softsp->power_btn_ioctl = B_TRUE;
898 mutex_exit(&softsp->power_intr_mutex);
900 (void) power_high_intr((caddr_t)softsp);
914 struct power_soft_state *softsp;
916 if ((softsp = ddi_get_soft_state(power_state, power_inst)) == NULL)
919 mutex_enter(&softsp->power_mutex);
921 if (softsp->events)
925 *phpp = &softsp->pollhd;
927 mutex_exit(&softsp->power_mutex);
935 struct power_soft_state *softsp;
937 if ((softsp = ddi_get_soft_state(power_state, power_inst)) == NULL) {
942 mutex_enter(&softsp->power_mutex);
943 softsp->shutdown_pending = 0;
945 mutex_exit(&softsp->power_mutex);
1001 power_probe_method_button(struct power_soft_state *softsp)
1006 softsp->button_obj = button_obj; /* remember obj */
1009 power_acpi_notify_event, (void*)softsp) == AE_OK))
1018 power_probe_fixed_button(struct power_soft_state *softsp)
1028 power_acpi_fixed_event, (void *)softsp) == AE_OK)
1039 power_attach_acpi(struct power_soft_state *softsp)
1045 if ((softsp->gpe_attached) || (softsp->fixed_attached))
1052 softsp->fixed_attached = (power_probe_fixed_button(softsp) != 0);
1053 softsp->gpe_attached = (power_probe_method_button(softsp) != 0);
1058 if ((softsp->gpe_attached) || (softsp->fixed_attached))
1068 power_detach_acpi(struct power_soft_state *softsp)
1070 if (softsp->gpe_attached) {
1071 if (AcpiRemoveNotifyHandler(softsp->button_obj,
1077 if (softsp->fixed_attached) {
1091 power_setup_epic_regs(dev_info_t *dip, struct power_soft_state *softsp)
1101 &softsp->power_rhandle) != DDI_SUCCESS) {
1105 softsp->power_btn_reg = reg_base;
1106 softsp->power_regs_mapped = B_TRUE;
1109 EPIC_WR(softsp->power_rhandle, softsp->power_btn_reg,
1113 EPIC_WR(softsp->power_rhandle, softsp->power_btn_reg,
1131 power_setup_m1535_regs(dev_info_t *dip, struct power_soft_state *softsp)
1140 &softsp->power_rhandle) != DDI_SUCCESS) {
1143 softsp->power_btn_reg = ®_base[M1535D_PWR_BTN_REG_01];
1144 softsp->power_btn_bit = M1535D_PWR_BTN_EVENT_FLAG;
1145 softsp->power_regs_mapped = B_TRUE;
1157 power_setup_mbc_regs(dev_info_t *dip, struct power_soft_state *softsp)
1168 &softsp->power_rhandle) != DDI_SUCCESS) {
1171 softsp->power_btn_reg = ®_base[FIRE_SSI_ISR];
1172 softsp->power_btn_bit = FIRE_SSI_SHUTDOWN_REQ;
1173 hdl = softsp->power_rhandle;
1177 reg = ddi_get8(hdl, softsp->power_btn_reg);
1178 if (reg & softsp->power_btn_bit) {
1179 reg &= softsp->power_btn_bit;
1180 ddi_put8(hdl, softsp->power_btn_reg, reg);
1181 (void) ddi_get8(hdl, softsp->power_btn_reg);
1190 softsp->power_regs_mapped = B_TRUE;
1211 power_setup_regs(struct power_soft_state *softsp)
1217 softsp->power_regs_mapped = B_FALSE;
1218 softsp->power_btn_ioctl = B_FALSE;
1219 binding_name = ddi_binding_name(softsp->dip);
1220 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, softsp->dip,
1224 retval = power_setup_mbc_regs(softsp->dip, softsp);
1226 retval = power_setup_epic_regs(softsp->dip, softsp);
1234 retval = power_setup_m1535_regs(softsp->dip, softsp);
1247 power_free_regs(struct power_soft_state *softsp)
1249 if (softsp->power_regs_mapped)
1250 ddi_regs_map_free(&softsp->power_rhandle);