linux-bk/drivers/scsi/libata.h
<<
>>
Prefs
   1/*
   2   libata.h - helper library for ATA
   3
   4   Copyright 2003 Red Hat, Inc.  All rights reserved.
   5   Copyright 2003 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     "0.81"  /* must be exactly four chars */
  30
  31struct ata_scsi_args {
  32        struct ata_port         *ap;
  33        struct ata_device       *dev;
  34        Scsi_Cmnd               *cmd;
  35        void                    (*done)(Scsi_Cmnd *);
  36};
  37
  38
  39/* libata-core.c */
  40extern unsigned int ata_dev_id_string(struct ata_device *dev, unsigned char *s,
  41                               unsigned int ofs, unsigned int len);
  42extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
  43                                      struct ata_device *dev);
  44extern int ata_qc_issue(struct ata_queued_cmd *qc);
  45extern void ata_dev_select(struct ata_port *ap, unsigned int device,
  46                           unsigned int wait, unsigned int can_sleep);
  47extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf);
  48extern void ata_thread_wake(struct ata_port *ap, unsigned int thr_state);
  49
  50
  51/* libata-scsi.c */
  52extern void ata_to_sense_error(struct ata_queued_cmd *qc);
  53extern void ata_scsi_rw_queue(struct ata_port *ap, struct ata_device *dev,
  54                      Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *),
  55                      unsigned int cmd_size);
  56extern int ata_scsi_error(struct Scsi_Host *host);
  57extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
  58                               unsigned int buflen);
  59
  60extern unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf,
  61                              unsigned int buflen);
  62
  63extern unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf,
  64                              unsigned int buflen);
  65extern unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
  66                              unsigned int buflen);
  67extern unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf,
  68                            unsigned int buflen);
  69extern unsigned int ata_scsiop_sync_cache(struct ata_scsi_args *args, u8 *rbuf,
  70                                  unsigned int buflen);
  71extern unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf,
  72                                  unsigned int buflen);
  73extern unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf,
  74                                unsigned int buflen);
  75extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf,
  76                                   unsigned int buflen);
  77extern void ata_scsi_badcmd(Scsi_Cmnd *cmd,
  78                            void (*done)(Scsi_Cmnd *),
  79                            u8 asc, u8 ascq);
  80extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, 
  81                        unsigned int (*actor) (struct ata_scsi_args *args,
  82                                           u8 *rbuf, unsigned int buflen));
  83
  84static inline void ata_bad_scsiop(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
  85{
  86        ata_scsi_badcmd(cmd, done, 0x20, 0x00);
  87}
  88
  89static inline void ata_bad_cdb(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
  90{
  91        ata_scsi_badcmd(cmd, done, 0x24, 0x00);
  92}
  93
  94#endif /* __LIBATA_H__ */
  95
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.