2 * Copyright (c) 1998 - 2006 Søren Schmidt <sos@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * $FreeBSD: src/sys/dev/ata/atapi-tape.c,v 1.101 2006/01/05 21:27:19 sos Exp $
31 #include <sys/param.h>
36 #include <sys/device.h>
37 #include <sys/devicestat.h>
39 #include <sys/kernel.h>
40 #include <sys/libkern.h>
41 #include <sys/malloc.h>
42 #include <sys/module.h>
45 #include <sys/systm.h>
48 #include "atapi-tape.h"
51 /* device structure */
52 static d_open_t ast_open
;
53 static d_close_t ast_close
;
54 static d_ioctl_t ast_ioctl
;
55 static d_strategy_t ast_strategy
;
56 static struct dev_ops ast_ops
= {
57 { "ast", 119, D_TAPE
| D_TRACKCLOSE
},
63 .d_strategy
= ast_strategy
67 static int ast_sense(device_t
);
68 static void ast_describe(device_t
);
69 static void ast_done(struct ata_request
*);
70 static int ast_mode_sense(device_t
, int, void *, int);
71 static int ast_mode_select(device_t
, void *, int);
72 static int ast_write_filemark(device_t
, u_int8_t
);
73 static int ast_read_position(device_t
, int, struct ast_readposition
*);
74 static int ast_space(device_t
, u_int8_t
, int32_t);
75 static int ast_locate(device_t
, int, u_int32_t
);
76 static int ast_prevent_allow(device_t
, int);
77 static int ast_load_unload(device_t
, u_int8_t
);
78 static int ast_rewind(device_t
);
79 static int ast_erase(device_t
);
80 static int ast_test_ready(device_t
);
81 static int ast_wait_dsc(device_t
, int);
84 static u_int64_t ast_total
= 0;
85 static MALLOC_DEFINE(M_AST
, "ast_driver", "ATAPI tape driver buffers");
88 ast_probe(device_t dev
)
90 struct ata_device
*atadev
= device_get_softc(dev
);
92 if ((atadev
->param
.config
& ATA_PROTO_ATAPI
) &&
93 (atadev
->param
.config
& ATA_ATAPI_TYPE_MASK
) == ATA_ATAPI_TYPE_TAPE
)
100 ast_attach(device_t dev
)
102 struct ata_channel
*ch
= device_get_softc(device_get_parent(dev
));
103 struct ata_device
*atadev
= device_get_softc(dev
);
104 struct ast_softc
*stp
;
105 struct ast_readposition position
;
108 stp
= kmalloc(sizeof(struct ast_softc
), M_AST
, M_WAITOK
| M_ZERO
);
109 device_set_ivars(dev
, stp
);
110 ATA_SETMODE(device_get_parent(dev
), dev
);
112 if (ast_sense(dev
)) {
113 device_set_ivars(dev
, NULL
);
117 if (!strcmp(atadev
->param
.model
, "OnStream DI-30")) {
118 struct ast_transferpage transfer
;
119 struct ast_identifypage identify
;
121 stp
->flags
|= F_ONSTREAM
;
122 bzero(&transfer
, sizeof(struct ast_transferpage
));
123 ast_mode_sense(dev
, ATAPI_TAPE_TRANSFER_PAGE
,
124 &transfer
, sizeof(transfer
));
125 bzero(&identify
, sizeof(struct ast_identifypage
));
126 ast_mode_sense(dev
, ATAPI_TAPE_IDENTIFY_PAGE
,
127 &identify
, sizeof(identify
));
128 strncpy(identify
.ident
, "FBSD", 4);
129 ast_mode_select(dev
, &identify
, sizeof(identify
));
130 ast_read_position(dev
, 0, &position
);
133 devstat_add_entry(&stp
->stats
, "ast", device_get_unit(dev
), DEV_BSIZE
,
134 DEVSTAT_NO_ORDERED_TAGS
,
135 DEVSTAT_TYPE_SEQUENTIAL
| DEVSTAT_TYPE_IF_IDE
,
136 DEVSTAT_PRIORITY_TAPE
);
137 cdev
= make_dev(&ast_ops
, 2 * device_get_unit(dev
), UID_ROOT
, GID_OPERATOR
,
138 0640, "ast%d", device_get_unit(dev
));
142 cdev
->si_iosize_max
= ch
->dma
->max_iosize
;
144 cdev
->si_iosize_max
= min(MAXPHYS
,64*1024);
146 cdev
= make_dev(&ast_ops
, 2 * device_get_unit(dev
) + 1, UID_ROOT
,
147 GID_OPERATOR
, 0640, "nast%d", device_get_unit(dev
));
151 cdev
->si_iosize_max
= ch
->dma
->max_iosize
;
153 cdev
->si_iosize_max
= min(MAXPHYS
,64*1024);
156 /* announce we are here and ready */
162 ast_detach(device_t dev
)
164 struct ast_softc
*stp
= device_get_ivars(dev
);
166 /* detroy devices from the system so we dont get any further requests */
167 destroy_dev(stp
->cdev1
);
168 destroy_dev(stp
->cdev2
);
170 /* fail requests on the queue and any thats "in flight" for this device */
171 ata_fail_requests(dev
);
173 /* dont leave anything behind */
174 dev_ops_remove_minor(&ast_ops
, /*dkunitmask(), */dkmakeunit(device_get_unit(dev
)));
175 devstat_remove_entry(&stp
->stats
);
176 device_set_ivars(dev
, NULL
);
182 ast_shutdown(device_t dev
)
184 struct ata_device
*atadev
= device_get_softc(dev
);
186 if (atadev
->param
.support
.command2
& ATA_SUPPORT_FLUSHCACHE
)
187 ata_controlcmd(dev
, ATA_FLUSHCACHE
, 0, 0, 0);
191 ast_reinit(device_t dev
)
193 struct ata_channel
*ch
= device_get_softc(device_get_parent(dev
));
194 struct ata_device
*atadev
= device_get_softc(dev
);
195 struct ast_softc
*stp
= device_get_ivars(dev
);
197 if (((atadev
->unit
== ATA_MASTER
) && !(ch
->devices
& ATA_ATAPI_MASTER
)) ||
198 ((atadev
->unit
== ATA_SLAVE
) && !(ch
->devices
& ATA_ATAPI_SLAVE
))) {
199 device_set_ivars(dev
, NULL
);
203 ATA_SETMODE(device_get_parent(dev
), dev
);
208 ast_open(struct dev_open_args
*ap
)
210 device_t dev
= ap
->a_head
.a_dev
->si_drv1
;
211 struct ata_device
*atadev
= device_get_softc(dev
);
212 struct ast_softc
*stp
= device_get_ivars(dev
);
216 if (!device_is_attached(dev
))
221 ast_prevent_allow(dev
, 1);
223 device_printf(dev
, "sense media type failed\n");
225 atadev
->flags
&= ~ATA_D_MEDIA_CHANGED
;
226 stp
->flags
&= ~(F_DATA_WRITTEN
| F_FM_WRITTEN
);
232 ast_close(struct dev_close_args
*ap
)
234 device_t dev
= ap
->a_head
.a_dev
->si_drv1
;
235 struct ast_softc
*stp
= device_get_ivars(dev
);
236 cdev_t cdev
= ap
->a_head
.a_dev
;
238 /* flush buffers, some drives fail here, they should report ctl = 0 */
239 if (stp
->cap
.ctl
&& (stp
->flags
& F_DATA_WRITTEN
))
240 ast_write_filemark(dev
, 0);
242 /* write filemark if data written to tape */
243 if (!(stp
->flags
& F_ONSTREAM
) &&
244 (stp
->flags
& (F_DATA_WRITTEN
| F_FM_WRITTEN
)) == F_DATA_WRITTEN
)
245 ast_write_filemark(dev
, ATAPI_WF_WRITE
);
247 /* if minor is even rewind on close */
248 if (!(minor(cdev
) & 0x01))
251 if (stp
->cap
.lock
&& count_dev(cdev
) == 1)
252 ast_prevent_allow(dev
, 0);
254 stp
->flags
&= ~F_CTL_WARN
;
256 device_printf(dev
, "%llu total bytes transferred\n",
257 (unsigned long long)ast_total
);
263 ast_ioctl(struct dev_ioctl_args
*ap
)
265 device_t dev
= ap
->a_head
.a_dev
->si_drv1
;
266 struct ast_softc
*stp
= device_get_ivars(dev
);
272 struct mtget
*g
= (struct mtget
*)ap
->a_data
;
274 bzero(g
, sizeof(struct mtget
));
277 g
->mt_blksiz
= stp
->blksize
;
278 g
->mt_comp
= stp
->cap
.compress
;
279 g
->mt_density0
= 0; g
->mt_density1
= 0;
280 g
->mt_density2
= 0; g
->mt_density3
= 0;
281 g
->mt_blksiz0
= 0; g
->mt_blksiz1
= 0;
282 g
->mt_blksiz2
= 0; g
->mt_blksiz3
= 0;
283 g
->mt_comp0
= 0; g
->mt_comp1
= 0;
284 g
->mt_comp2
= 0; g
->mt_comp3
= 0;
291 struct mtop
*mt
= (struct mtop
*)ap
->a_data
;
293 switch ((int16_t) (mt
->mt_op
)) {
296 for (i
=0; i
< mt
->mt_count
&& !error
; i
++)
297 error
= ast_write_filemark(dev
, ATAPI_WF_WRITE
);
302 error
= ast_space(dev
, ATAPI_SP_FM
, mt
->mt_count
);
307 error
= ast_space(dev
, ATAPI_SP_FM
, -(mt
->mt_count
));
311 error
= ast_rewind(dev
);
315 error
= ast_load_unload(dev
, ATAPI_SS_EJECT
);
319 error
= ast_write_filemark(dev
, 0);
323 error
= ast_erase(dev
);
327 error
= ast_space(dev
, ATAPI_SP_EOD
, 0);
331 error
= ast_load_unload(dev
, ATAPI_SS_RETENSION
|ATAPI_SS_LOAD
);
349 struct ast_readposition position
;
351 if ((error
= ast_read_position(dev
, 0, &position
)))
353 *(u_int32_t
*)ap
->a_data
= position
.tape
;
359 struct ast_readposition position
;
361 if ((error
= ast_read_position(dev
, 1, &position
)))
363 *(u_int32_t
*)ap
->a_data
= position
.tape
;
368 error
= ast_locate(dev
, 0, *(u_int32_t
*)ap
->a_data
);
372 error
= ast_locate(dev
, 1, *(u_int32_t
*)ap
->a_data
);
376 error
= ata_device_ioctl(dev
, ap
->a_cmd
, ap
->a_data
);
382 ast_strategy(struct dev_strategy_args
*ap
)
384 device_t dev
= ap
->a_head
.a_dev
->si_drv1
;
385 struct bio
*bp
= ap
->a_bio
;
386 struct buf
*bbp
= bp
->bio_buf
;
387 struct ata_device
*atadev
= device_get_softc(dev
);
388 struct ast_softc
*stp
= device_get_ivars(dev
);
389 struct ata_request
*request
;
393 /* if it's a null transfer, return immediatly. */
394 if (bbp
->b_bcount
== 0) {
399 if (!(bbp
->b_cmd
== BUF_CMD_READ
) && (stp
->flags
& F_WRITEPROTECT
)) {
400 bbp
->b_flags
|= B_ERROR
;
401 bbp
->b_error
= EPERM
;
405 if (bbp
->b_cmd
!= BUF_CMD_READ
&& bbp
->b_cmd
!= BUF_CMD_WRITE
) {
406 bbp
->b_flags
|= B_ERROR
;
412 /* check for != blocksize requests */
413 if (bbp
->b_bcount
% stp
->blksize
) {
414 device_printf(dev
, "transfers must be multiple of %d\n", stp
->blksize
);
415 bbp
->b_flags
|= B_ERROR
;
421 /* warn about transfers bigger than the device suggests */
422 if (bbp
->b_bcount
> stp
->blksize
* stp
->cap
.ctl
) {
423 if ((stp
->flags
& F_CTL_WARN
) == 0) {
424 device_printf(dev
, "WARNING: CTL exceeded %d>%d\n",
425 bbp
->b_bcount
, stp
->blksize
* stp
->cap
.ctl
);
426 stp
->flags
|= F_CTL_WARN
;
430 bzero(ccb
, sizeof(ccb
));
432 if (bbp
->b_cmd
== BUF_CMD_READ
)
435 ccb
[0] = ATAPI_WRITE
;
437 blkcount
= bbp
->b_bcount
/ stp
->blksize
;
440 ccb
[2] = blkcount
>> 16;
441 ccb
[3] = blkcount
>> 8;
444 if (!(request
= ata_alloc_request())) {
445 bbp
->b_flags
|= B_ERROR
;
446 bbp
->b_error
= ENOMEM
;
452 bcopy(ccb
, request
->u
.atapi
.ccb
,
453 (atadev
->param
.config
& ATA_PROTO_MASK
) ==
454 ATA_PROTO_ATAPI_12
? 16 : 12);
455 request
->data
= bbp
->b_data
;
456 request
->bytecount
= blkcount
* stp
->blksize
;
457 request
->transfersize
= min(request
->bytecount
, 65534);
458 request
->timeout
= (ccb
[0] == ATAPI_WRITE_BIG
) ? 180 : 120;
459 request
->retries
= 2;
460 request
->callback
= ast_done
;
462 switch (bbp
->b_cmd
) {
464 request
->flags
|= (ATA_R_ATAPI
| ATA_R_READ
);
467 request
->flags
|= (ATA_R_ATAPI
| ATA_R_WRITE
);
472 devstat_start_transaction(&stp
->stats
);
473 ata_queue_request(request
);
478 ast_done(struct ata_request
*request
)
480 struct ast_softc
*stp
= device_get_ivars(request
->dev
);
481 struct bio
*bp
= request
->bio
;
482 struct buf
*bbp
= bp
->bio_buf
;
484 /* finish up transfer */
485 if ((bbp
->b_error
= request
->result
))
486 bbp
->b_flags
|= B_ERROR
;
487 if (bbp
->b_cmd
== BUF_CMD_WRITE
)
488 stp
->flags
|= F_DATA_WRITTEN
;
489 bbp
->b_resid
= bbp
->b_bcount
- request
->donecount
;
490 ast_total
+= (bbp
->b_bcount
- bbp
->b_resid
);
491 devstat_end_transaction_buf(&stp
->stats
, bbp
);
493 ata_free_request(request
);
497 ast_sense(device_t dev
)
499 struct ast_softc
*stp
= device_get_ivars(dev
);
502 /* get drive capabilities, some bugridden drives needs this repeated */
503 for (count
= 0 ; count
< 5 ; count
++) {
504 if (!ast_mode_sense(dev
, ATAPI_TAPE_CAP_PAGE
,
505 &stp
->cap
, sizeof(stp
->cap
)) &&
506 stp
->cap
.page_code
== ATAPI_TAPE_CAP_PAGE
) {
508 stp
->blksize
= 32768;
509 if (stp
->cap
.blk1024
)
515 stp
->cap
.max_speed
= ntohs(stp
->cap
.max_speed
);
516 stp
->cap
.max_defects
= ntohs(stp
->cap
.max_defects
);
517 stp
->cap
.ctl
= ntohs(stp
->cap
.ctl
);
518 stp
->cap
.speed
= ntohs(stp
->cap
.speed
);
519 stp
->cap
.buffer_size
= ntohs(stp
->cap
.buffer_size
);
527 ast_mode_sense(device_t dev
, int page
, void *pagebuf
, int pagesize
)
529 int8_t ccb
[16] = { ATAPI_MODE_SENSE
, 0x08, page
, pagesize
>>8, pagesize
,
530 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
533 error
= ata_atapicmd(dev
, ccb
, pagebuf
, pagesize
, ATA_R_READ
, 10);
538 ast_mode_select(device_t dev
, void *pagebuf
, int pagesize
)
540 int8_t ccb
[16] = { ATAPI_MODE_SELECT
, 0x10, 0, pagesize
>>8, pagesize
,
541 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
543 return ata_atapicmd(dev
, ccb
, pagebuf
, pagesize
, 0, 10);
547 ast_write_filemark(device_t dev
, u_int8_t function
)
549 struct ast_softc
*stp
= device_get_ivars(dev
);
550 int8_t ccb
[16] = { ATAPI_WEOF
, 0x01, 0, 0, function
, 0, 0, 0,
551 0, 0, 0, 0, 0, 0, 0, 0 };
554 if (stp
->flags
& F_ONSTREAM
)
555 ccb
[4] = 0x00; /* only flush buffers supported */
558 if (stp
->flags
& F_FM_WRITTEN
)
559 stp
->flags
&= ~F_DATA_WRITTEN
;
561 stp
->flags
|= F_FM_WRITTEN
;
564 error
= ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 10);
567 return ast_wait_dsc(dev
, 10*60);
571 ast_read_position(device_t dev
, int hard
, struct ast_readposition
*position
)
573 int8_t ccb
[16] = { ATAPI_READ_POSITION
, (hard
? 0x01 : 0), 0, 0, 0, 0, 0, 0,
574 0, 0, 0, 0, 0, 0, 0, 0 };
577 error
= ata_atapicmd(dev
, ccb
, (caddr_t
)position
,
578 sizeof(struct ast_readposition
), ATA_R_READ
, 10);
579 position
->tape
= ntohl(position
->tape
);
580 position
->host
= ntohl(position
->host
);
585 ast_space(device_t dev
, u_int8_t function
, int32_t count
)
587 int8_t ccb
[16] = { ATAPI_SPACE
, function
, count
>>16, count
>>8, count
,
588 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
590 return ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 60*60);
594 ast_locate(device_t dev
, int hard
, u_int32_t pos
)
596 int8_t ccb
[16] = { ATAPI_LOCATE
, 0x01 | (hard
? 0x4 : 0), 0,
597 pos
>>24, pos
>>16, pos
>>8, pos
,
598 0, 0, 0, 0, 0, 0, 0, 0, 0 };
601 error
= ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 10);
604 return ast_wait_dsc(dev
, 60*60);
608 ast_prevent_allow(device_t dev
, int lock
)
610 int8_t ccb
[16] = { ATAPI_PREVENT_ALLOW
, 0, 0, 0, lock
,
611 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
613 return ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 30);
617 ast_load_unload(device_t dev
, u_int8_t function
)
619 struct ast_softc
*stp
= device_get_ivars(dev
);
620 int8_t ccb
[16] = { ATAPI_START_STOP
, 0x01, 0, 0, function
, 0, 0, 0,
621 0, 0, 0, 0, 0, 0, 0, 0 };
624 if ((function
& ATAPI_SS_EJECT
) && !stp
->cap
.eject
)
626 error
= ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 10);
629 tsleep((caddr_t
)&error
, 0, "astlu", 1 * hz
);
630 if (function
== ATAPI_SS_EJECT
)
632 return ast_wait_dsc(dev
, 60*60);
636 ast_rewind(device_t dev
)
638 int8_t ccb
[16] = { ATAPI_REZERO
, 0x01, 0, 0, 0, 0, 0, 0,
639 0, 0, 0, 0, 0, 0, 0, 0 };
642 error
= ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 10);
645 return ast_wait_dsc(dev
, 60*60);
649 ast_erase(device_t dev
)
651 int8_t ccb
[16] = { ATAPI_ERASE
, 3, 0, 0, 0, 0, 0, 0,
652 0, 0, 0, 0, 0, 0, 0, 0 };
655 if ((error
= ast_rewind(dev
)))
658 return ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 60*60);
662 ast_test_ready(device_t dev
)
664 int8_t ccb
[16] = { ATAPI_TEST_UNIT_READY
, 0, 0, 0, 0,
665 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
667 return ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 30);
671 ast_wait_dsc(device_t dev
, int timeout
)
674 int8_t ccb
[16] = { ATAPI_POLL_DSC
, 0, 0, 0, 0,
675 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
678 while (timeout
> 0) {
679 error
= ata_atapicmd(dev
, ccb
, NULL
, 0, 0, 0);
682 tsleep(&error
, 0, "atpwt", hz
/ 2);
689 ast_describe(device_t dev
)
691 struct ata_channel
*ch
= device_get_softc(device_get_parent(dev
));
692 struct ata_device
*atadev
= device_get_softc(dev
);
693 struct ast_softc
*stp
= device_get_ivars(dev
);
696 device_printf(dev
, "<%.40s/%.8s> tape drive at ata%d as %s\n",
697 atadev
->param
.model
, atadev
->param
.revision
,
698 device_get_unit(ch
->dev
),
699 (atadev
->unit
== ATA_MASTER
) ? "master" : "slave");
700 device_printf(dev
, "%dKB/s, ", stp
->cap
.max_speed
);
701 kprintf("transfer limit %d blk%s, ",
702 stp
->cap
.ctl
, (stp
->cap
.ctl
> 1) ? "s" : "");
703 kprintf("%dKB buffer, ", (stp
->cap
.buffer_size
* DEV_BSIZE
) / 1024);
704 kprintf("%s\n", ata_mode2str(atadev
->mode
));
705 device_printf(dev
, "Medium: ");
706 switch (stp
->cap
.medium_type
) {
708 kprintf("none"); break;
710 kprintf("Travan 1 (400 Mbyte)"); break;
712 kprintf("Travan 4 (4 Gbyte)"); break;
714 kprintf("OnStream ADR (15Gyte)"); break;
716 kprintf("unknown (0x%x)", stp
->cap
.medium_type
);
718 if (stp
->cap
.readonly
) kprintf(", readonly");
719 if (stp
->cap
.reverse
) kprintf(", reverse");
720 if (stp
->cap
.eformat
) kprintf(", eformat");
721 if (stp
->cap
.qfa
) kprintf(", qfa");
722 if (stp
->cap
.lock
) kprintf(", lock");
723 if (stp
->cap
.locked
) kprintf(", locked");
724 if (stp
->cap
.prevent
) kprintf(", prevent");
725 if (stp
->cap
.eject
) kprintf(", eject");
726 if (stp
->cap
.disconnect
) kprintf(", disconnect");
727 if (stp
->cap
.ecc
) kprintf(", ecc");
728 if (stp
->cap
.compress
) kprintf(", compress");
729 if (stp
->cap
.blk512
) kprintf(", 512b");
730 if (stp
->cap
.blk1024
) kprintf(", 1024b");
731 if (stp
->cap
.blk32k
) kprintf(", 32kb");
735 device_printf(dev
, "TAPE <%.40s/%.8s> at ata%d-%s %s\n",
736 atadev
->param
.model
, atadev
->param
.revision
,
737 device_get_unit(ch
->dev
),
738 (atadev
->unit
== ATA_MASTER
) ? "master" : "slave",
739 ata_mode2str(atadev
->mode
));
743 static device_method_t ast_methods
[] = {
744 /* device interface */
745 DEVMETHOD(device_probe
, ast_probe
),
746 DEVMETHOD(device_attach
, ast_attach
),
747 DEVMETHOD(device_detach
, ast_detach
),
748 DEVMETHOD(device_shutdown
, ast_shutdown
),
751 DEVMETHOD(ata_reinit
, ast_reinit
),
756 static driver_t ast_driver
= {
762 static devclass_t ast_devclass
;
764 DRIVER_MODULE(ast
, ata
, ast_driver
, ast_devclass
, NULL
, NULL
);
765 MODULE_VERSION(ast
, 1);
766 MODULE_DEPEND(ast
, ata
, 1, 1, 1);