]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | libata.h - helper library for ATA | |
3 | ||
4 | Copyright 2003-2004 Red Hat, Inc. All rights reserved. | |
5 | Copyright 2003-2004 Jeff Garzik | |
6 | ||
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 | |
10 | by reference. | |
11 | ||
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. | |
22 | ||
23 | */ | |
24 | ||
25 | #ifndef __LIBATA_H__ | |
26 | #define __LIBATA_H__ | |
27 | ||
28 | #define DRV_NAME "libata" | |
29 | #define DRV_VERSION "1.10" /* must be exactly four chars */ | |
30 | ||
31 | struct ata_scsi_args { | |
32 | u16 *id; | |
33 | struct scsi_cmnd *cmd; | |
34 | void (*done)(struct scsi_cmnd *); | |
35 | }; | |
36 | ||
37 | /* libata-core.c */ | |
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); | |
47 | ||
48 | ||
49 | /* libata-scsi.c */ | |
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, | |
53 | unsigned int buflen); | |
54 | ||
55 | extern unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, | |
56 | unsigned int buflen); | |
57 | ||
58 | extern unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | |
59 | unsigned int buflen); | |
60 | extern unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, | |
61 | unsigned int buflen); | |
62 | extern unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf, | |
63 | unsigned int buflen); | |
64 | extern unsigned int ata_scsiop_sync_cache(struct ata_scsi_args *args, u8 *rbuf, | |
65 | unsigned int buflen); | |
66 | extern unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |
67 | unsigned int buflen); | |
68 | extern unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, | |
69 | unsigned int buflen); | |
70 | extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, | |
71 | unsigned int buflen); | |
72 | extern void ata_scsi_badcmd(struct scsi_cmnd *cmd, | |
73 | void (*done)(struct scsi_cmnd *), | |
74 | u8 asc, u8 ascq); | |
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)); | |
78 | ||
79 | static inline void ata_bad_scsiop(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |
80 | { | |
81 | ata_scsi_badcmd(cmd, done, 0x20, 0x00); | |
82 | } | |
83 | ||
84 | static inline void ata_bad_cdb(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |
85 | { | |
86 | ata_scsi_badcmd(cmd, done, 0x24, 0x00); | |
87 | } | |
88 | ||
89 | #endif /* __LIBATA_H__ */ |