Lines Matching defs:xa
233 struct ata_xfer *xa;
375 xa = scsi_io_get(&ahp->ahp_iopool, SCSI_NOSLEEP);
376 if (xa->tag < link->openings) {
377 xa->state = ATA_S_COMPLETE;
378 scsi_io_put(&ahp->ahp_iopool, xa);
410 xa = scsi_io_get(&ahp->ahp_iopool, SCSI_NOSLEEP);
411 if (xa == NULL)
413 xa->fis->command = ATA_C_SEC_FREEZE_LOCK;
414 xa->fis->flags = ATA_H2D_FLAGS_CMD | ap->ap_pmp_port;
415 xa->flags = ATA_F_POLL;
416 xa->timeout = 1000;
417 xa->complete = ata_polled_complete;
418 xa->pmp_port = ap->ap_pmp_port;
419 xa->atascsi_private = &ahp->ahp_iopool;
420 ata_exec(as, xa);
421 ata_polled(xa); /* we don't care if it doesn't work */
503 struct ata_xfer *xa = xs->io;
570 xa->flags = flags;
577 fis = xa->fis;
585 (xa->tag < ap->ap_ncqdepth) &&
588 xa->flags |= ATA_F_NCQ;
589 fis->command = (xa->flags & ATA_F_WRITE) ?
595 fis->sector_count = xa->tag << 3;
600 fis->command = (xa->flags & ATA_F_WRITE) ?
610 fis->command = (xa->flags & ATA_F_WRITE) ?
616 xa->data = xs->data;
617 xa->datalen = xs->datalen;
618 xa->complete = atascsi_disk_cmd_done;
619 xa->timeout = xs->timeout;
620 xa->pmp_port = ap->ap_pmp_port;
621 xa->atascsi_private = xs;
623 xa->flags |= ATA_F_POLL;
625 ata_exec(as, xa);
629 atascsi_disk_cmd_done(struct ata_xfer *xa)
631 struct scsi_xfer *xs = xa->atascsi_private;
633 switch (xa->state) {
646 xa->state);
649 xs->resid = xa->resid;
952 struct ata_xfer *xa = xs->io;
988 xa->data = xs->data;
989 xa->datalen = 512;
990 xa->flags = ATA_F_WRITE;
991 xa->pmp_port = ap->ap_pmp_port;
993 xa->flags |= ATA_F_POLL;
994 xa->complete = atascsi_disk_write_same_16_done;
995 xa->atascsi_private = xs;
996 xa->timeout = (xs->timeout < 45000) ? 45000 : xs->timeout;
999 memset(xa->data, 0, xa->datalen);
1001 memcpy(xa->data, &desc, sizeof(desc));
1003 fis = xa->fis;
1009 ata_exec(as, xa);
1013 atascsi_disk_write_same_16_done(struct ata_xfer *xa)
1015 struct scsi_xfer *xs = xa->atascsi_private;
1017 switch (xa->state) {
1030 "unexpected ata_xfer state (%d)", xa->state);
1039 struct ata_xfer *xa = xs->io;
1079 task_set(&xa->task, atascsi_disk_unmap_task, xs);
1080 task_add(systq, &xa->task);
1094 struct ata_xfer *xa = xs->io;
1117 xa->data = trims;
1118 xa->datalen = 512;
1119 xa->flags = ATA_F_WRITE;
1120 xa->pmp_port = ap->ap_pmp_port;
1121 xa->complete = atascsi_disk_unmap_done;
1122 xa->atascsi_private = xs;
1123 xa->timeout = (xs->timeout < 45000) ? 45000 : xs->timeout;
1125 fis = xa->fis;
1131 ata_exec(as, xa);
1135 dma_free(xa->data, 512);
1140 atascsi_disk_unmap_done(struct ata_xfer *xa)
1142 struct scsi_xfer *xs = xa->atascsi_private;
1144 dma_free(xa->data, 512);
1146 switch (xa->state) {
1159 "unexpected ata_xfer state (%d)", xa->state);
1171 struct ata_xfer *xa = xs->io;
1179 xa->datalen = 0;
1180 xa->flags = ATA_F_READ;
1181 xa->complete = atascsi_disk_sync_done;
1183 xa->timeout = (xs->timeout < 45000) ? 45000 : xs->timeout;
1184 xa->atascsi_private = xs;
1185 xa->pmp_port = ap->ap_pmp_port;
1187 xa->flags |= ATA_F_POLL;
1189 xa->fis->flags = ATA_H2D_FLAGS_CMD | ap->ap_pmp_port;
1190 xa->fis->command = ATA_C_FLUSH_CACHE;
1191 xa->fis->device = 0;
1193 ata_exec(as, xa);
1197 atascsi_disk_sync_done(struct ata_xfer *xa)
1199 struct scsi_xfer *xs = xa->atascsi_private;
1201 switch (xa->state) {
1209 xa->state == ATA_S_TIMEOUT ? "timeout" : "error");
1210 xs->error = (xa->state == ATA_S_TIMEOUT ? XS_TIMEOUT :
1216 xa->state);
1357 struct ata_xfer *xa = xs->io;
1359 xa->data = xs->data;
1360 xa->datalen = xs->datalen;
1361 xa->timeout = xs->timeout;
1362 xa->flags = 0;
1364 xa->flags |= ATA_F_READ;
1366 xa->flags |= ATA_F_WRITE;
1368 xa->flags |= ATA_F_POLL;
1374 xa->flags |= ATA_F_PIO;
1381 xa->atascsi_private = xs;
1382 xa->complete = atascsi_passthru_done;
1393 struct ata_xfer *xa = xs->io;
1411 fis = xa->fis;
1420 xa->pmp_port = ap->ap_pmp_port;
1422 ata_exec(as, xa);
1431 struct ata_xfer *xa = xs->io;
1449 fis = xa->fis;
1463 xa->pmp_port = ap->ap_pmp_port;
1465 ata_exec(as, xa);
1469 atascsi_passthru_done(struct ata_xfer *xa)
1471 struct scsi_xfer *xs = xa->atascsi_private;
1477 switch (xa->state) {
1490 xa->state);
1493 xs->resid = xa->resid;
1517 struct ata_xfer *xa = xs->io;
1536 xa->datalen = 0;
1537 xa->flags = ATA_F_READ;
1538 xa->complete = atascsi_disk_start_stop_done;
1540 xa->timeout = (xs->timeout < 45000) ? 45000 : xs->timeout;
1541 xa->pmp_port = ap->ap_pmp_port;
1542 xa->atascsi_private = xs;
1544 xa->flags |= ATA_F_POLL;
1546 xa->fis->flags = ATA_H2D_FLAGS_CMD | ap->ap_pmp_port;
1547 xa->fis->command = ATA_C_FLUSH_CACHE;
1548 xa->fis->device = 0;
1550 ata_exec(as, xa);
1554 atascsi_disk_start_stop_done(struct ata_xfer *xa)
1556 struct scsi_xfer *xs = xa->atascsi_private;
1561 switch (xa->state) {
1567 xs->error = (xa->state == ATA_S_TIMEOUT ? XS_TIMEOUT :
1569 xs->resid = xa->resid;
1575 xa->state);
1583 xa->datalen = 0;
1584 xa->flags = ATA_F_READ;
1585 xa->state = ATA_S_SETUP;
1586 xa->complete = atascsi_disk_cmd_done;
1588 xa->timeout = (xs->timeout < 45000) ? 45000 : xs->timeout;
1589 xa->pmp_port = ap->ap_pmp_port;
1590 xa->atascsi_private = xs;
1592 xa->flags |= ATA_F_POLL;
1594 xa->fis->flags = ATA_H2D_FLAGS_CMD | ap->ap_pmp_port;
1595 xa->fis->command = ATA_C_STANDBY_IMMED;
1596 xa->fis->device = 0;
1598 ata_exec(as, xa);
1607 struct ata_xfer *xa = xs->io;
1612 xa->flags = ATA_F_PACKET | ATA_F_READ;
1615 xa->flags = ATA_F_PACKET | ATA_F_WRITE;
1618 xa->flags = ATA_F_PACKET;
1620 xa->flags |= ATA_F_GET_RFIS;
1623 xa->data = xs->data;
1624 xa->datalen = xs->datalen;
1625 xa->complete = atascsi_atapi_cmd_done;
1626 xa->timeout = xs->timeout;
1627 xa->pmp_port = ap->ap_pmp_port;
1628 xa->atascsi_private = xs;
1630 xa->flags |= ATA_F_POLL;
1632 fis = xa->fis;
1636 fis->sector_count = xa->tag << 3;
1637 fis->features = ATA_H2D_FEATURES_DMA | ((xa->flags & ATA_F_WRITE) ?
1643 memcpy(xa->packetcmd, &xs->cmd, xs->cmdlen);
1645 ata_exec(as, xa);
1649 atascsi_atapi_cmd_done(struct ata_xfer *xa)
1651 struct scsi_xfer *xs = xa->atascsi_private;
1654 switch (xa->state) {
1661 sd->flags = (xa->rfis.error & 0xf0) >> 4;
1662 if (xa->rfis.error & 0x04)
1664 if (xa->rfis.error & 0x02)
1666 if (xa->rfis.error & 0x01)
1676 xa->state);
1679 xs->resid = xa->resid;
1758 ata_exec(struct atascsi *as, struct ata_xfer *xa)
1760 as->as_methods->ata_cmd(xa);
1768 struct ata_xfer *xa;
1770 xa = as->as_methods->ata_get_xfer(as->as_cookie, ahp->ahp_port);
1771 if (xa != NULL)
1772 xa->fis->type = ATA_FIS_TYPE_H2D;
1774 return (xa);
1782 struct ata_xfer *xa = io;
1784 xa->state = ATA_S_COMPLETE; /* XXX this state machine is dumb */
1785 as->as_methods->ata_put_xfer(xa);
1789 ata_polled_complete(struct ata_xfer *xa)
1795 ata_polled(struct ata_xfer *xa)
1799 if (!ISSET(xa->flags, ATA_F_DONE))
1800 panic("ata_polled: xa isn't complete");
1802 switch (xa->state) {
1811 panic("ata_polled: xa state (%d)",
1812 xa->state);
1815 scsi_io_put(xa->atascsi_private, xa);
1821 ata_complete(struct ata_xfer *xa)
1823 SET(xa->flags, ATA_F_DONE);
1824 xa->complete(xa);
1844 struct ata_xfer *xa;
1846 xa = scsi_io_get(&ahp->ahp_iopool, SCSI_NOSLEEP);
1847 if (xa == NULL)
1849 xa->pmp_port = ap->ap_pmp_port;
1850 xa->data = identify;
1851 xa->datalen = sizeof(*identify);
1852 xa->fis->flags = ATA_H2D_FLAGS_CMD | ap->ap_pmp_port;
1853 xa->fis->command = (ap->ap_type == ATA_PORT_T_DISK) ?
1855 xa->fis->device = 0;
1856 xa->flags = ATA_F_READ | ATA_F_PIO | ATA_F_POLL;
1857 xa->timeout = 1000;
1858 xa->complete = ata_polled_complete;
1859 xa->atascsi_private = &ahp->ahp_iopool;
1860 ata_exec(as, xa);
1861 return (ata_polled(xa));
1869 struct ata_xfer *xa;
1871 xa = scsi_io_get(&ahp->ahp_iopool, SCSI_NOSLEEP);
1872 if (xa == NULL)
1874 xa->fis->command = ATA_C_SET_FEATURES;
1875 xa->fis->features = subcommand;
1876 xa->fis->sector_count = arg;
1877 xa->fis->flags = ATA_H2D_FLAGS_CMD | ap->ap_pmp_port;
1878 xa->flags = ATA_F_POLL;
1879 xa->timeout = 1000;
1880 xa->complete = ata_polled_complete;
1881 xa->pmp_port = ap->ap_pmp_port;
1882 xa->atascsi_private = &ahp->ahp_iopool;
1883 ata_exec(as, xa);
1884 return (ata_polled(xa));