+
+/*
+ * (XXX) The following routine is needed for the SCSI tape driver
+ * to read odd-size records.
+ */
+
+#include "st.h"
+#if NST > 0
+int
+scsi_tt_oddio(ctlr, slave, unit, buf, len, b_flags, freedma)
+ int ctlr, slave, unit, b_flags;
+ u_char *buf;
+ u_int len;
+{
+ register struct scsi_softc *hs = &scsi_softc[ctlr];
+ struct scsi_cdb6 cdb;
+ u_char iphase;
+ int stat;
+
+ /*
+ * First free any DMA channel that was allocated.
+ * We can't use DMA to do this transfer.
+ */
+ if (freedma)
+ dmafree(hs->sc_dq);
+ /*
+ * Initialize command block
+ */
+ bzero(&cdb, sizeof(cdb));
+ cdb.lun = unit;
+ cdb.lbam = (len >> 16) & 0xff;
+ cdb.lbal = (len >> 8) & 0xff;
+ cdb.len = len & 0xff;
+ if (buf == 0) {
+ cdb.cmd = CMD_SPACE;
+ cdb.lun |= 0x00;
+ len = 0;
+ iphase = MESG_IN_PHASE;
+ } else if (b_flags & B_READ) {
+ cdb.cmd = CMD_READ;
+ iphase = DATA_IN_PHASE;
+ } else {
+ cdb.cmd = CMD_WRITE;
+ iphase = DATA_OUT_PHASE;
+ }
+ /*
+ * Perform command (with very long delays)
+ */
+ scsi_delay(30000000);
+ stat = scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len, iphase);
+ scsi_delay(0);
+ return (stat);
+}
+#endif