Lines Matching refs:mt

113 CFATTACH_DECL(mt, sizeof(struct mt_softc),
159 struct mt_softc *mt = device_private(self);
164 mt->mt_hwunit = mp->mscp_unit;
175 mt_putonline(struct mt_softc *mt)
179 (struct mscp_softc *)device_parent(&mt->mt_dev);
182 ((volatile struct mt_softc *) mt)->mt_state = MT_OFFLINE;
185 mp->mscp_unit = mt->mt_hwunit;
186 mp->mscp_cmdref = (long)&mt->mt_state;
191 if (tsleep(&mt->mt_state, PRIBIO, "mtonline", 240 * hz))
194 if ((volatile int)mt->mt_state != MT_ONLINE)
206 struct mt_softc *mt;
213 mt = device_lookup_private(&mt_cd, unit);
214 if (!mt)
217 if (mt->mt_inuse)
219 mt->mt_inuse = 1;
221 if (mt_putonline(mt) == MSCP_FAILED) {
222 mt->mt_inuse = 0;
234 struct mt_softc *mt = device_lookup_private(&mt_cd, unit);
239 if ((flags & FWRITE) && mt->mt_waswrite) {
240 mtcmd(mt, MTWEOF, 0, 0);
241 mtcmd(mt, MTWEOF, 0, 0);
242 mtcmd(mt, MTBSR, 1, 0);
245 mtcmd(mt, MTREW, 0, 1);
246 if (mt->mt_serex)
247 mtcmd(mt, -1, 0, 0);
249 mt->mt_inuse = 0; /* Release the tape */
257 struct mt_softc *mt;
263 if ((mt = device_lookup_private(&mt_cd, unit)) == NULL) {
269 mt->mt_waswrite = bp->b_flags & B_READ ? 0 : 1;
270 mscp_strategy(bp, device_parent(&mt->mt_dev));
302 struct mt_softc *mt = device_lookup_private(&mt_cd, unit);
304 mp->mscp_unit = mt->mt_hwunit;
305 if (mt->mt_serex == 2) {
307 mt->mt_serex = 0;
320 if (mscp_decodeerror(usc == NULL?"unconf mt" : device_xname(usc), mp, mi))
331 struct mt_softc *mt = (void *)usc;
333 wakeup((void *)&mt->mt_state);
335 mt->mt_state = MT_ONLINE;
376 struct mt_softc *mt = (void *)usc;
380 mt->mt_serex = 1;
382 mt->mt_serex = 2;
385 printf("%s: error %d (%s)\n", device_xname(&mt->mt_dev), st,
388 printf("%s: error %d\n", device_xname(&mt->mt_dev), st);
402 struct mt_softc *mt = device_lookup_private(&mt_cd, unit);
412 if ((error = mtcmd(mt, mtop->mt_op, 0, 0)))
415 error = mtcmd(mt, mtop->mt_op, mtop->mt_count, 0);
447 mtcmd(struct mt_softc *mt, int cmd, int count, int complete)
450 struct mscp_softc *mi = (void *)device_parent(&mt->mt_dev);
455 mt->mt_ioctlerr = 0;
456 mp->mscp_unit = mt->mt_hwunit;
485 mt->mt_serex = 0;
491 mt->mt_serex = 0;
501 mt->mt_serex = 0;
511 tsleep(&mt->mt_inuse, PRIBIO, "mtioctl", 0);
512 return mt->mt_ioctlerr;
521 struct mt_softc *mt = (void *)usc;
524 mt->mt_ioctlerr = EIO;
525 printf("%s: bad status %x\n", device_xname(&mt->mt_dev),
528 wakeup(&mt->mt_inuse);