]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/ide.h
[ARM] fix fls() for 64-bit arguments
[linux-2.6-omap-h63xx.git] / include / linux / ide.h
index a41ae57fafc57a19c68cad9a11e224d0d01617d1..b846bc44a27ed62a62c6c30cf69ed2897579e7f1 100644 (file)
@@ -211,7 +211,21 @@ static inline int __ide_default_irq(unsigned long base)
        return 0;
 }
 
+#if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \
+    defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \
+    || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
 #include <asm/ide.h>
+#else
+#include <asm-generic/ide_iops.h>
+#endif
+
+#ifndef MAX_HWIFS
+#if defined(CONFIG_BLACKFIN) || defined(CONFIG_H8300) || defined(CONFIG_XTENSA)
+# define MAX_HWIFS     1
+#else
+# define MAX_HWIFS     10
+#endif
+#endif
 
 #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
 #undef MAX_HWIFS
@@ -308,7 +322,65 @@ struct ide_acpi_drive_link;
 struct ide_acpi_hwif_link;
 #endif
 
-typedef struct ide_drive_s {
+/* ATAPI device flags */
+enum {
+       IDE_AFLAG_DRQ_INTERRUPT         = (1 << 0),
+       IDE_AFLAG_MEDIA_CHANGED         = (1 << 1),
+
+       /* ide-cd */
+       /* Drive cannot lock the door. */
+       IDE_AFLAG_NO_DOORLOCK           = (1 << 2),
+       /* Drive cannot eject the disc. */
+       IDE_AFLAG_NO_EJECT              = (1 << 3),
+       /* Drive is a pre ATAPI 1.2 drive. */
+       IDE_AFLAG_PRE_ATAPI12           = (1 << 4),
+       /* TOC addresses are in BCD. */
+       IDE_AFLAG_TOCADDR_AS_BCD        = (1 << 5),
+       /* TOC track numbers are in BCD. */
+       IDE_AFLAG_TOCTRACKS_AS_BCD      = (1 << 6),
+       /*
+        * Drive does not provide data in multiples of SECTOR_SIZE
+        * when more than one interrupt is needed.
+        */
+       IDE_AFLAG_LIMIT_NFRAMES         = (1 << 7),
+       /* Seeking in progress. */
+       IDE_AFLAG_SEEKING               = (1 << 8),
+       /* Saved TOC information is current. */
+       IDE_AFLAG_TOC_VALID             = (1 << 9),
+       /* We think that the drive door is locked. */
+       IDE_AFLAG_DOOR_LOCKED           = (1 << 10),
+       /* SET_CD_SPEED command is unsupported. */
+       IDE_AFLAG_NO_SPEED_SELECT       = (1 << 11),
+       IDE_AFLAG_VERTOS_300_SSD        = (1 << 12),
+       IDE_AFLAG_VERTOS_600_ESD        = (1 << 13),
+       IDE_AFLAG_SANYO_3CD             = (1 << 14),
+       IDE_AFLAG_FULL_CAPS_PAGE        = (1 << 15),
+       IDE_AFLAG_PLAY_AUDIO_OK         = (1 << 16),
+       IDE_AFLAG_LE_SPEED_FIELDS       = (1 << 17),
+
+       /* ide-floppy */
+       /* Format in progress */
+       IDE_AFLAG_FORMAT_IN_PROGRESS    = (1 << 18),
+       /* Avoid commands not supported in Clik drive */
+       IDE_AFLAG_CLIK_DRIVE            = (1 << 19),
+       /* Requires BH algorithm for packets */
+       IDE_AFLAG_ZIP_DRIVE             = (1 << 20),
+
+       /* ide-tape */
+       IDE_AFLAG_IGNORE_DSC            = (1 << 21),
+       /* 0 When the tape position is unknown */
+       IDE_AFLAG_ADDRESS_VALID         = (1 << 22),
+       /* Device already opened */
+       IDE_AFLAG_BUSY                  = (1 << 23),
+       /* Attempt to auto-detect the current user block size */
+       IDE_AFLAG_DETECT_BS             = (1 << 24),
+       /* Currently on a filemark */
+       IDE_AFLAG_FILEMARK              = (1 << 25),
+       /* 0 = no tape is loaded, so we don't rewind after ejecting */
+       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26)
+};
+
+struct ide_drive_s {
        char            name[4];        /* drive name, such as "hda" */
         char            driver_req[10];        /* requests specific driver */
 
@@ -400,7 +472,14 @@ typedef struct ide_drive_s {
        struct list_head list;
        struct device   gendev;
        struct completion gendev_rel_comp;      /* to deal with device release() */
-} ide_drive_t;
+
+       /* callback for packet commands */
+       void (*pc_callback)(struct ide_drive_s *);
+
+       unsigned long atapi_flags;
+};
+
+typedef struct ide_drive_s ide_drive_t;
 
 #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
 
@@ -467,12 +546,16 @@ struct ide_dma_ops {
        void    (*dma_timeout)(struct ide_drive_s *);
 };
 
+struct ide_host;
+
 typedef struct hwif_s {
        struct hwif_s *next;            /* for linked-list in ide_hwgroup_t */
        struct hwif_s *mate;            /* other hwif from same PCI chip */
        struct hwgroup_s *hwgroup;      /* actually (ide_hwgroup_t *) */
        struct proc_dir_entry *proc;    /* /proc/ide/ directory entry */
 
+       struct ide_host *host;
+
        char name[6];                   /* name of interface, eg. "ide0" */
 
        struct ide_io_ports     io_ports;
@@ -561,6 +644,9 @@ typedef struct hwif_s {
 struct ide_host {
        ide_hwif_t      *ports[MAX_HWIFS];
        unsigned int    n_ports;
+       struct device   *dev[2];
+       unsigned long   host_flags;
+       void            *host_priv;
 };
 
 /*
@@ -622,8 +708,6 @@ enum {
        PC_FLAG_WRITING                 = (1 << 6),
        /* command timed out */
        PC_FLAG_TIMEDOUT                = (1 << 7),
-       PC_FLAG_ZIP_DRIVE               = (1 << 8),
-       PC_FLAG_DRQ_INTERRUPT           = (1 << 9),
 };
 
 struct ide_atapi_pc {
@@ -657,8 +741,6 @@ struct ide_atapi_pc {
         */
        u8 pc_buf[256];
 
-       void (*callback)(ide_drive_t *);
-
        /* idetape only */
        struct idetape_bh *bh;
        char *b_data;
@@ -813,6 +895,9 @@ struct ide_driver_s {
 
 #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
 
+int ide_device_get(ide_drive_t *);
+void ide_device_put(ide_drive_t *);
+
 int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
 
 extern int ide_vlb_clk;
@@ -1121,7 +1206,7 @@ enum {
 
 struct ide_port_info {
        char                    *name;
-       unsigned int            (*init_chipset)(struct pci_dev *, const char *);
+       unsigned int            (*init_chipset)(struct pci_dev *);
        void                    (*init_iops)(ide_hwif_t *);
        void                    (*init_hwif)(ide_hwif_t *);
        int                     (*init_dma)(ide_hwif_t *,
@@ -1140,8 +1225,10 @@ struct ide_port_info {
        u8                      udma_mask;
 };
 
-int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *);
-int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *);
+int ide_pci_init_one(struct pci_dev *, const struct ide_port_info *, void *);
+int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
+                    const struct ide_port_info *, void *);
+void ide_pci_remove(struct pci_dev *);
 
 void ide_map_sg(ide_drive_t *, struct request *);
 void ide_init_sg_cmd(ide_drive_t *, struct request *);
@@ -1236,8 +1323,11 @@ void ide_port_apply_params(ide_hwif_t *);
 
 struct ide_host *ide_host_alloc_all(const struct ide_port_info *, hw_regs_t **);
 struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
+void ide_host_free(struct ide_host *);
 int ide_host_register(struct ide_host *, const struct ide_port_info *,
                      hw_regs_t **);
+int ide_host_add(const struct ide_port_info *, hw_regs_t **,
+                struct ide_host **);
 void ide_host_remove(struct ide_host *);
 int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
 void ide_port_unregister_devices(ide_hwif_t *);