Lines Matching refs:softc
177 struct pmp_softc *softc = (struct pmp_softc *)periph->softc; in pmpfreeze() local
181 mask &= ~softc->frozen; in pmpfreeze()
188 softc->frozen |= (1 << i); in pmpfreeze()
199 struct pmp_softc *softc = (struct pmp_softc *)periph->softc; in pmprelease() local
203 mask &= softc->frozen; in pmprelease()
210 softc->frozen &= ~(1 << i); in pmprelease()
243 struct pmp_softc *softc; in pmpcleanup() local
245 softc = (struct pmp_softc *)periph->softc; in pmpcleanup()
252 if ((softc->flags & PMP_FLAG_SCTX_INIT) != 0 in pmpcleanup()
253 && sysctl_ctx_free(&softc->sysctl_ctx) != 0) { in pmpcleanup()
257 free(softc, M_DEVBUF); in pmpcleanup()
266 struct pmp_softc *softc; in pmpasync() local
302 softc = (struct pmp_softc *)periph->softc; in pmpasync()
305 softc->events |= PMP_EV_RESCAN; in pmpasync()
307 softc->events |= PMP_EV_RESET; in pmpasync()
308 if (code == AC_SCSI_AEN && softc->state != PMP_STATE_NORMAL) in pmpasync()
311 pmpfreeze(periph, softc->found); in pmpasync()
313 softc->found = 0; /* We have to reset everything. */ in pmpasync()
314 if (softc->state == PMP_STATE_NORMAL) { in pmpasync()
316 if (softc->pm_pid == 0x37261095 || in pmpasync()
317 softc->pm_pid == 0x38261095) in pmpasync()
318 softc->state = PMP_STATE_PM_QUIRKS_1; in pmpasync()
320 softc->state = PMP_STATE_PRECONFIG; in pmpasync()
323 pmprelease(periph, softc->found); in pmpasync()
327 softc->restart = 1; in pmpasync()
339 struct pmp_softc *softc; in pmpsysctlinit() local
346 softc = (struct pmp_softc *)periph->softc; in pmpsysctlinit()
350 sysctl_ctx_init(&softc->sysctl_ctx); in pmpsysctlinit()
351 softc->flags |= PMP_FLAG_SCTX_INIT; in pmpsysctlinit()
352 softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx, in pmpsysctlinit()
355 if (softc->sysctl_tree == NULL) { in pmpsysctlinit()
367 struct pmp_softc *softc; in pmpregister() local
376 softc = (struct pmp_softc *)malloc(sizeof(*softc), M_DEVBUF, in pmpregister()
379 if (softc == NULL) { in pmpregister()
384 periph->softc = softc; in pmpregister()
386 softc->pm_pid = ((uint32_t *)&cgd->ident_data)[0]; in pmpregister()
387 softc->pm_prv = ((uint32_t *)&cgd->ident_data)[1]; in pmpregister()
388 TASK_INIT(&softc->sysctl_task, 0, pmpsysctlinit, periph); in pmpregister()
410 softc->state = PMP_STATE_PORTS; in pmpregister()
411 softc->events = PMP_EV_RESCAN; in pmpregister()
422 struct pmp_softc *softc; in pmpstart() local
426 softc = (struct pmp_softc *)periph->softc; in pmpstart()
431 if (softc->restart) { in pmpstart()
432 softc->restart = 0; in pmpstart()
433 if (softc->pm_pid == 0x37261095 || softc->pm_pid == 0x38261095) in pmpstart()
434 softc->state = min(softc->state, PMP_STATE_PM_QUIRKS_1); in pmpstart()
436 softc->state = min(softc->state, PMP_STATE_PRECONFIG); in pmpstart()
439 if (softc->state == PMP_STATE_RESET || in pmpstart()
440 softc->state == PMP_STATE_CONNECT) { in pmpstart()
443 softc->pm_step, 0) == CAM_REQ_CMP) { in pmpstart()
454 switch (softc->state) { in pmpstart()
489 ata_pm_write_cmd(ataio, 129, 15, softc->caps & ~0x1); in pmpstart()
500 softc->caps = cts.xport_specific.sata.caps; in pmpstart()
502 softc->caps = 0; in pmpstart()
522 ata_pm_write_cmd(ataio, 2, softc->pm_step, in pmpstart()
524 ((softc->found & (1 << softc->pm_step)) ? 0 : 1)); in pmpstart()
535 ata_pm_write_cmd(ataio, 2, softc->pm_step, in pmpstart()
547 ata_pm_read_cmd(ataio, 0, softc->pm_step); in pmpstart()
550 softc->reset = 0; in pmpstart()
559 ata_pm_write_cmd(ataio, 1, softc->pm_step, 0xFFFFFFFF); in pmpstart()
571 ((softc->caps & CTS_SATA_CAPS_H_AN) ? 0x08 : 0)); in pmpstart()
583 struct pmp_softc *softc; in pmpdone() local
589 softc = (struct pmp_softc *)periph->softc; in pmpdone()
609 if (softc->restart) { in pmpdone()
610 softc->restart = 0; in pmpdone()
612 if (softc->pm_pid == 0x37261095 || softc->pm_pid == 0x38261095) in pmpdone()
613 softc->state = min(softc->state, PMP_STATE_PM_QUIRKS_1); in pmpdone()
615 softc->state = min(softc->state, PMP_STATE_PRECONFIG); in pmpdone()
620 switch (softc->state) { in pmpdone()
622 softc->pm_ports = (ataio->res.lba_high << 24) + in pmpdone()
633 if ((softc->pm_pid == 0x37261095 || in pmpdone()
634 softc->pm_pid == 0x38261095) && in pmpdone()
635 softc->pm_ports == 6) in pmpdone()
636 softc->pm_ports = 5; in pmpdone()
643 if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7) in pmpdone()
644 softc->pm_ports = 5; in pmpdone()
649 if (softc->pm_pid == 0x57231095 || in pmpdone()
650 softc->pm_pid == 0x57331095 || in pmpdone()
651 softc->pm_pid == 0x57341095 || in pmpdone()
652 softc->pm_pid == 0x57441095) in pmpdone()
653 softc->pm_ports--; in pmpdone()
657 softc->pm_ports); in pmpdone()
658 if (softc->pm_pid == 0x37261095 || softc->pm_pid == 0x38261095) in pmpdone()
659 softc->state = PMP_STATE_PM_QUIRKS_1; in pmpdone()
661 softc->state = PMP_STATE_PRECONFIG; in pmpdone()
667 softc->caps = (ataio->res.lba_high << 24) + in pmpdone()
671 if (softc->caps & 0x1) in pmpdone()
672 softc->state = PMP_STATE_PM_QUIRKS_2; in pmpdone()
674 softc->state = PMP_STATE_PRECONFIG; in pmpdone()
681 softc->state = PMP_STATE_PM_QUIRKS_3; in pmpdone()
683 softc->state = PMP_STATE_PRECONFIG; in pmpdone()
694 periph->periph_name, periph->unit_number, softc->caps, res); in pmpdone()
695 softc->state = PMP_STATE_PRECONFIG; in pmpdone()
701 softc->pm_step = 0; in pmpdone()
702 softc->state = PMP_STATE_RESET; in pmpdone()
703 softc->reset |= ~softc->found; in pmpdone()
708 softc->pm_step++; in pmpdone()
709 if (softc->pm_step >= softc->pm_ports) { in pmpdone()
710 softc->pm_step = 0; in pmpdone()
717 softc->state = PMP_STATE_CONNECT; in pmpdone()
723 softc->pm_step++; in pmpdone()
724 if (softc->pm_step >= softc->pm_ports) { in pmpdone()
725 softc->pm_step = 0; in pmpdone()
726 softc->pm_try = 0; in pmpdone()
733 softc->state = PMP_STATE_CHECK; in pmpdone()
748 softc->pm_step, res); in pmpdone()
754 softc->pm_step, 0) == CAM_REQ_CMP) { in pmpdone()
761 cts.xport_specific.sata.caps = softc->caps & in pmpdone()
769 softc->found |= (1 << softc->pm_step); in pmpdone()
770 softc->pm_step++; in pmpdone()
772 if (softc->pm_try < 10) { in pmpdone()
779 softc->pm_try++; in pmpdone()
784 softc->pm_step, res); in pmpdone()
786 softc->found &= ~(1 << softc->pm_step); in pmpdone()
789 softc->pm_step, 0) == CAM_REQ_CMP) { in pmpdone()
793 softc->pm_step++; in pmpdone()
796 if (softc->pm_step >= softc->pm_ports) { in pmpdone()
797 if (softc->reset & softc->found) { in pmpdone()
805 softc->state = PMP_STATE_CLEAR; in pmpdone()
806 softc->pm_step = 0; in pmpdone()
812 softc->pm_step++; in pmpdone()
813 if (softc->pm_step >= softc->pm_ports) { in pmpdone()
814 softc->state = PMP_STATE_CONFIG; in pmpdone()
815 softc->pm_step = 0; in pmpdone()
821 for (i = 0; i < softc->pm_ports; i++) { in pmpdone()
824 if ((softc->found & (1 << i)) == 0) in pmpdone()
833 if ((softc->reset & softc->found & (1 << i)) != 0) in pmpdone()
836 if (softc->events & PMP_EV_RESCAN) { in pmpdone()
853 softc->state = PMP_STATE_NORMAL; in pmpdone()
854 softc->events = 0; in pmpdone()