[libata] ATA passthru (arbitrary ATA command execution)
[deliverable/linux.git] / drivers / scsi / libata.h
CommitLineData
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
31struct ata_scsi_args {
32 u16 *id;
33 struct scsi_cmnd *cmd;
34 void (*done)(struct scsi_cmnd *);
35};
36
37/* libata-core.c */
38extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
39 struct ata_device *dev);
40extern void ata_qc_free(struct ata_queued_cmd *qc);
41extern int ata_qc_issue(struct ata_queued_cmd *qc);
42extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
43extern void ata_dev_select(struct ata_port *ap, unsigned int device,
44 unsigned int wait, unsigned int can_sleep);
45extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf);
46extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
b095518e
JG
47extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
48extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
1da177e4
LT
49
50
51/* libata-scsi.c */
1da177e4
LT
52extern int ata_scsi_error(struct Scsi_Host *host);
53extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
54 unsigned int buflen);
55
56extern unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf,
57 unsigned int buflen);
58
59extern unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf,
60 unsigned int buflen);
61extern unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
62 unsigned int buflen);
63extern unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf,
64 unsigned int buflen);
65extern unsigned int ata_scsiop_sync_cache(struct ata_scsi_args *args, u8 *rbuf,
66 unsigned int buflen);
67extern unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf,
68 unsigned int buflen);
69extern unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf,
70 unsigned int buflen);
71extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf,
72 unsigned int buflen);
73extern void ata_scsi_badcmd(struct scsi_cmnd *cmd,
74 void (*done)(struct scsi_cmnd *),
75 u8 asc, u8 ascq);
76extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
77 unsigned int (*actor) (struct ata_scsi_args *args,
78 u8 *rbuf, unsigned int buflen));
79
80static inline void ata_bad_scsiop(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
81{
82 ata_scsi_badcmd(cmd, done, 0x20, 0x00);
83}
84
85static inline void ata_bad_cdb(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
86{
87 ata_scsi_badcmd(cmd, done, 0x24, 0x00);
88}
89
90#endif /* __LIBATA_H__ */
This page took 0.151432 seconds and 5 git commands to generate.