2 libata.h - helper library for ATA
4 Copyright 2003-2004 Red Hat, Inc. All rights reserved.
5 Copyright 2003-2004 Jeff Garzik
7 The contents of this file are subject to the Open
8 Software License version 1.1 that can be found at
9 http://www.opensource.org/licenses/osl-1.1.txt and is included herein
12 Alternatively, the contents of this file may be used under the terms
13 of the GNU General Public License version 2 (the "GPL") as distributed
14 in the kernel source COPYING file, in which case the provisions of
15 the GPL are applicable instead of the above. If you wish to allow
16 the use of your version of this file only under the terms of the
17 GPL and not to allow others to use your version of this file under
18 the OSL, indicate your decision by deleting the provisions above and
19 replace them with the notice and other provisions required by the GPL.
20 If you do not delete the provisions above, a recipient may use your
21 version of this file under either the OSL or the GPL.
28 #define DRV_NAME "libata"
29 #define DRV_VERSION "1.10" /* must be exactly four chars */
31 struct ata_scsi_args
{
33 struct scsi_cmnd
*cmd
;
34 void (*done
)(struct scsi_cmnd
*);
38 extern struct ata_queued_cmd
*ata_qc_new_init(struct ata_port
*ap
,
39 struct ata_device
*dev
);
40 extern void ata_qc_free(struct ata_queued_cmd
*qc
);
41 extern int ata_qc_issue(struct ata_queued_cmd
*qc
);
42 extern int ata_check_atapi_dma(struct ata_queued_cmd
*qc
);
43 extern void ata_dev_select(struct ata_port
*ap
, unsigned int device
,
44 unsigned int wait
, unsigned int can_sleep
);
45 extern void ata_tf_to_host_nolock(struct ata_port
*ap
, struct ata_taskfile
*tf
);
46 extern void swap_buf_le16(u16
*buf
, unsigned int buf_words
);
50 extern void ata_to_sense_error(struct ata_queued_cmd
*qc
, u8 drv_stat
);
51 extern int ata_scsi_error(struct Scsi_Host
*host
);
52 extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args
*args
, u8
*rbuf
,
55 extern unsigned int ata_scsiop_inq_00(struct ata_scsi_args
*args
, u8
*rbuf
,
58 extern unsigned int ata_scsiop_inq_80(struct ata_scsi_args
*args
, u8
*rbuf
,
60 extern unsigned int ata_scsiop_inq_83(struct ata_scsi_args
*args
, u8
*rbuf
,
62 extern unsigned int ata_scsiop_noop(struct ata_scsi_args
*args
, u8
*rbuf
,
64 extern unsigned int ata_scsiop_sync_cache(struct ata_scsi_args
*args
, u8
*rbuf
,
66 extern unsigned int ata_scsiop_mode_sense(struct ata_scsi_args
*args
, u8
*rbuf
,
68 extern unsigned int ata_scsiop_read_cap(struct ata_scsi_args
*args
, u8
*rbuf
,
70 extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args
*args
, u8
*rbuf
,
72 extern void ata_scsi_badcmd(struct scsi_cmnd
*cmd
,
73 void (*done
)(struct scsi_cmnd
*),
75 extern void ata_scsi_rbuf_fill(struct ata_scsi_args
*args
,
76 unsigned int (*actor
) (struct ata_scsi_args
*args
,
77 u8
*rbuf
, unsigned int buflen
));
79 static inline void ata_bad_scsiop(struct scsi_cmnd
*cmd
, void (*done
)(struct scsi_cmnd
*))
81 ata_scsi_badcmd(cmd
, done
, 0x20, 0x00);
84 static inline void ata_bad_cdb(struct scsi_cmnd
*cmd
, void (*done
)(struct scsi_cmnd
*))
86 ata_scsi_badcmd(cmd
, done
, 0x24, 0x00);
89 #endif /* __LIBATA_H__ */