Lines Matching refs:ch_drive
248 chp->ch_drive[0].drive_type, chp->ch_drive[1].drive_type),
267 if (chp->ch_drive == NULL)
269 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
271 if (chp->ch_drive[i].drive_type != ATA_DRIVET_NONE)
327 chp->ch_drive[PMP_PORT_CTL].drive_type == ATA_DRIVET_PM) {
340 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
342 if (chp->ch_drive[i].drive_type == ATA_DRIVET_ATAPI) {
354 if (chp->ch_drive[i].drive_type == ATA_DRIVET_ATAPI)
355 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
365 if (chp->ch_drive[i].drive_type != ATA_DRIVET_ATA &&
366 chp->ch_drive[i].drive_type != ATA_DRIVET_OLD) {
369 if (chp->ch_drive[i].drv_softc != NULL)
374 adev.adev_drv_data = &chp->ch_drive[i];
375 chp->ch_drive[i].drv_softc = config_found(atabus_sc->sc_dev,
378 if (chp->ch_drive[i].drv_softc != NULL) {
379 ata_probe_caps(&chp->ch_drive[i]);
382 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
395 if (chp->ch_drive[i].drive_type == ATA_DRIVET_ATA) {
397 chp->ch_drive[i].drv_softc);
409 if (chp->ch_drive[i].drive_type == ATA_DRIVET_PM)
411 if (chp->ch_drive[i].drv_softc == NULL) {
412 chp->ch_drive[i].drive_flags = 0;
413 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
415 chp->ch_drive[i].state = 0;
455 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
457 chp->ch_drive[i].drive_flags = 0;
458 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
489 drvp = &chp->ch_drive[i];
652 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
658 if (chp->ch_drive[i].drive_type == ATA_DRIVET_ATAPI)
660 if (chp->ch_drive[i].drive_type == ATA_DRIVET_PM)
661 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
662 if ((dev = chp->ch_drive[i].drv_softc) != NULL) {
669 KASSERT(chp->ch_drive[i].drv_softc == NULL);
670 KASSERT(chp->ch_drive[i].drive_type == 0);
704 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
712 if (chp->ch_drive[i].drive_type != ATA_DRIVET_ATAPI)
714 KASSERT(chp->ch_drive[i].drv_softc != NULL);
715 chp->ch_drive[i].drv_softc = NULL;
716 chp->ch_drive[i].drive_flags = 0;
717 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
725 if (chp->ch_drive[i].drive_type == ATA_DRIVET_ATAPI)
727 if (child == chp->ch_drive[i].drv_softc) {
728 chp->ch_drive[i].drv_softc = NULL;
729 chp->ch_drive[i].drive_flags = 0;
730 if (chp->ch_drive[i].drive_type == ATA_DRIVET_PM)
732 chp->ch_drive[i].drive_type = ATA_DRIVET_NONE;
750 /* allocate/free the channel's ch_drive[] array */
757 if (chp->ch_drive == NULL) {
761 drv = kmem_zalloc(sizeof(*chp->ch_drive) * ndrives, KM_SLEEP);
764 if (chp->ch_drive != NULL) {
766 kmem_free(drv, sizeof(*chp->ch_drive) * ndrives);
769 chp->ch_drive = drv;
772 chp->ch_drive[i].chnl_softc = chp;
773 chp->ch_drive[i].drive = i;
785 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
787 if (chp->ch_drive[i].drive_type != ATA_DRIVET_NONE) {
788 printf("%s: ch_drive[%d] type %d != ATA_DRIVET_NONE\n",
790 chp->ch_drive[i].drive_type);
793 if (chp->ch_drive[i].drv_softc != NULL) {
794 printf("%s: ch_drive[%d] attached to %s\n",
796 device_xname(chp->ch_drive[i].drv_softc));
804 if (chp->ch_drive == NULL)
806 kmem_free(chp->ch_drive,
809 chp->ch_drive = NULL;
1158 struct ata_drive_datas * const drvp = &chp->ch_drive[xfer->c_drive];
1386 if (chp->ch_drive[drive].drive_flags & ATA_DRIVE_WAITDRAIN) {
1392 chp->ch_drive[drive].drive_flags &= ~ATA_DRIVE_WAITDRAIN;
1409 struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
1581 drvp = &chp->ch_drive[drive];
1633 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
1635 chp->ch_drive[drive].state = 0;
1643 drvp = &chp->ch_drive[drive];
1720 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
1722 drvp = &chp->ch_drive[drive];
2193 if ((chp->ch_drive[0].drive_type == ATA_DRIVET_OLD) ||
2194 (chp->ch_drive[1].drive_type == ATA_DRIVET_OLD))
2202 if ((chp->ch_drive[0].drive_type == ATA_DRIVET_OLD) ||
2203 (chp->ch_drive[1].drive_type == ATA_DRIVET_OLD))
2218 if (chp->ch_drive[drive].drv_softc != NULL) {
2220 chp->ch_drive[drive].drv_softc, 0);
2223 KASSERT(chp->ch_drive[drive].drv_softc == NULL);
2290 KASSERT(chp->ch_ndrives == 0 || chp->ch_drive != NULL);
2292 if (chp->ch_drive[i].drv_softc != NULL) {