ACPI: maintain a single list of _HID and _CID IDs
[safe/jmp/linux-2.6] / include / linux / ide.h
index 745a393..e4135d6 100644 (file)
@@ -157,12 +157,6 @@ enum {
 #define REQ_UNPARK_HEADS       0x23
 
 /*
- * Check for an interrupt and acknowledge the interrupt status
- */
-struct hwif_s;
-typedef int (ide_ack_intr_t)(struct hwif_s *);
-
-/*
  * hwif_chipset_t is used to keep track of the specific hardware
  * chipset used by each IDE interface, if known.
  */
@@ -178,20 +172,18 @@ typedef u8 hwif_chipset_t;
 /*
  * Structure to hold all information about the location of this port
  */
-typedef struct hw_regs_s {
+struct ide_hw {
        union {
                struct ide_io_ports     io_ports;
                unsigned long           io_ports_array[IDE_NR_PORTS];
        };
 
        int             irq;                    /* our irq number */
-       ide_ack_intr_t  *ack_intr;              /* acknowledge interrupt */
-       hwif_chipset_t  chipset;
        struct device   *dev, *parent;
        unsigned long   config;
-} hw_regs_t;
+};
 
-static inline void ide_std_init_ports(hw_regs_t *hw,
+static inline void ide_std_init_ports(struct ide_hw *hw,
                                      unsigned long io_addr,
                                      unsigned long ctl_addr)
 {
@@ -218,21 +210,12 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
 
 /*
  * Special Driver Flags
- *
- * set_geometry        : respecify drive geometry
- * recalibrate : seek to cyl 0
- * set_multmode        : set multmode count
- * reserved    : unused
  */
-typedef union {
-       unsigned all                    : 8;
-       struct {
-               unsigned set_geometry   : 1;
-               unsigned recalibrate    : 1;
-               unsigned set_multmode   : 1;
-               unsigned reserved       : 5;
-       } b;
-} special_t;
+enum {
+       IDE_SFLAG_SET_GEOMETRY          = (1 << 0),
+       IDE_SFLAG_RECALIBRATE           = (1 << 1),
+       IDE_SFLAG_SET_MULTMODE          = (1 << 2),
+};
 
 /*
  * Status returned from various ide_ functions
@@ -275,6 +258,7 @@ enum {
        IDE_TFLAG_DYN                   = (1 << 5),
        IDE_TFLAG_FS                    = (1 << 6),
        IDE_TFLAG_MULTI_PIO             = (1 << 7),
+       IDE_TFLAG_SET_XFER              = (1 << 8),
 };
 
 enum {
@@ -311,7 +295,7 @@ struct ide_cmd {
                } out, in;
        } valid;
 
-       u                     tf_flags;
+       u16                     tf_flags;
        u8                      ftf_flags;      /* for TASKFILE ioctl */
        int                     protocol;
 
@@ -341,11 +325,6 @@ enum {
        PC_FLAG_WRITING                 = (1 << 6),
 };
 
-/*
- * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
- * This is used for several packet commands (not for READ/WRITE commands).
- */
-#define IDE_PC_BUFFER_SIZE     64
 #define ATAPI_WAIT_PC          (60 * HZ)
 
 struct ide_atapi_pc {
@@ -358,10 +337,6 @@ struct ide_atapi_pc {
        /* bytes to transfer */
        int req_xfer;
 
-       /* data buffer */
-       u8 *buf;
-       int buf_size;
-
        /* the corresponding request */
        struct request *rq;
 
@@ -371,8 +346,6 @@ struct ide_atapi_pc {
         * those are more or less driver-specific and some of them are subject
         * to change/removal later.
         */
-       u8 pc_buf[IDE_PC_BUFFER_SIZE];
-
        unsigned long timeout;
 };
 
@@ -389,6 +362,7 @@ struct ide_drive_s;
 struct ide_disk_ops {
        int             (*check)(struct ide_drive_s *, const char *);
        int             (*get_capacity)(struct ide_drive_s *);
+       u64             (*set_capacity)(struct ide_drive_s *, u64);
        void            (*setup)(struct ide_drive_s *);
        void            (*flush)(struct ide_drive_s *);
        int             (*init_media)(struct ide_drive_s *, struct gendisk *);
@@ -466,6 +440,8 @@ enum {
        IDE_DFLAG_NICE1                 = (1 << 5),
        /* device is physically present */
        IDE_DFLAG_PRESENT               = (1 << 6),
+       /* disable Host Protected Area */
+       IDE_DFLAG_NOHPA                 = (1 << 7),
        /* id read from device (synthetic if not set) */
        IDE_DFLAG_ID_READ               = (1 << 8),
        IDE_DFLAG_NOPROBE               = (1 << 9),
@@ -504,6 +480,7 @@ enum {
        /* write protect */
        IDE_DFLAG_WP                    = (1 << 29),
        IDE_DFLAG_FORMAT_IN_PROGRESS    = (1 << 30),
+       IDE_DFLAG_NIEN_QUIRK            = (1 << 31),
 };
 
 struct ide_drive_s {
@@ -528,14 +505,13 @@ struct ide_drive_s {
        unsigned long sleep;            /* sleep until this time */
        unsigned long timeout;          /* max time to wait for irq */
 
-       special_t       special;        /* special action flags */
+       u8      special_flags;          /* special action flags */
 
        u8      select;                 /* basic drive/head select reg value */
        u8      retry_pio;              /* retrying dma capable host in pio */
        u8      waiting_for_dma;        /* dma currently in progress */
        u8      dma;                    /* atapi dma flag */
 
-        u8     quirk_list;     /* considered quirky, set for a specific host */
         u8     init_speed;     /* transfer rate set at boot */
         u8     current_speed;  /* current transfer rate set */
        u8      desired_speed;  /* desired transfer rate set */
@@ -557,11 +533,10 @@ struct ide_drive_s {
 
        unsigned int    bios_cyl;       /* BIOS/fdisk/LILO number of cyls */
        unsigned int    cyl;            /* "real" number of cyls */
-       unsigned int    drive_data;     /* used by set_pio_mode/dev_select() */
+       void            *drive_data;    /* used by set_pio_mode/dev_select() */
        unsigned int    failures;       /* current failure count */
        unsigned int    max_failures;   /* maximum allowed failure count */
-       u64             probed_capacity;/* initial reported media capacity (ide-cd only currently) */
-
+       u64             probed_capacity;/* initial/native media capacity */
        u64             capacity64;     /* total number of sectors */
 
        int             lun;            /* logical unit */
@@ -655,6 +630,7 @@ struct ide_port_ops {
        void    (*maskproc)(ide_drive_t *, int);
        void    (*quirkproc)(ide_drive_t *);
        void    (*clear_irq)(ide_drive_t *);
+       int     (*test_irq)(struct hwif_s *);
 
        u8      (*mdma_filter)(ide_drive_t *);
        u8      (*udma_filter)(ide_drive_t *);
@@ -680,6 +656,10 @@ struct ide_dma_ops {
        u8      (*dma_sff_read_status)(struct hwif_s *);
 };
 
+enum {
+       IDE_PFLAG_PROBING               = (1 << 0),
+};
+
 struct ide_host;
 
 typedef struct hwif_s {
@@ -696,6 +676,8 @@ typedef struct hwif_s {
 
        ide_drive_t     *devices[MAX_DRIVES + 1];
 
+       unsigned long   port_flags;
+
        u8 major;       /* our major number */
        u8 index;       /* 0 for ide0; 1 for ide1; ... */
        u8 channel;     /* for dual-port chips: 0=primary, 1=secondary */
@@ -714,8 +696,6 @@ typedef struct hwif_s {
 
        struct device *dev;
 
-       ide_ack_intr_t *ack_intr;
-
        void (*rw_disk)(ide_drive_t *, struct request *);
 
        const struct ide_tp_ops         *tp_ops;
@@ -939,8 +919,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
 typedef struct {
        const char      *name;
        mode_t          mode;
-       read_proc_t     *read_proc;
-       write_proc_t    *write_proc;
+       const struct file_operations *proc_fops;
 } ide_proc_entry_t;
 
 void proc_ide_create(void);
@@ -952,24 +931,8 @@ void ide_proc_unregister_port(ide_hwif_t *);
 void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
 void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);
 
-read_proc_t proc_ide_read_capacity;
-read_proc_t proc_ide_read_geometry;
-
-/*
- * Standard exit stuff:
- */
-#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \
-{                                      \
-       len -= off;                     \
-       if (len < count) {              \
-               *eof = 1;               \
-               if (len <= 0)           \
-                       return 0;       \
-       } else                          \
-               len = count;            \
-       *start = page + off;            \
-       return len;                     \
-}
+extern const struct file_operations ide_capacity_proc_fops;
+extern const struct file_operations ide_geometry_proc_fops;
 #else
 static inline void proc_ide_create(void) { ; }
 static inline void proc_ide_destroy(void) { ; }
@@ -981,7 +944,6 @@ static inline void ide_proc_register_driver(ide_drive_t *drive,
                                            struct ide_driver *driver) { ; }
 static inline void ide_proc_unregister_driver(ide_drive_t *drive,
                                              struct ide_driver *driver) { ; }
-#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
 #endif
 
 enum {
@@ -1083,7 +1045,6 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l
 extern int ide_vlb_clk;
 extern int ide_pci_clk;
 
-unsigned int ide_rq_bytes(struct request *);
 int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int);
 void ide_kill_rq(ide_drive_t *, struct request *);
 
@@ -1101,8 +1062,9 @@ void ide_fix_driveid(u16 *);
 
 extern void ide_fixstring(u8 *, const int, const int);
 
-int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
+int ide_busy_sleep(ide_drive_t *, unsigned long, int);
 
+int __ide_wait_stat(ide_drive_t *, u8, u8, unsigned long, u8 *);
 int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
 
 ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *);
@@ -1136,6 +1098,8 @@ void SELECT_MASK(ide_drive_t *, int);
 u8 ide_read_error(ide_drive_t *);
 void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
 
+int ide_check_ireason(ide_drive_t *, struct request *, int, int, int);
+
 int ide_check_atapi_device(ide_drive_t *, const char *);
 
 void ide_init_pc(struct ide_atapi_pc *);
@@ -1160,7 +1124,8 @@ enum {
        REQ_IDETAPE_WRITE       = (1 << 3),
 };
 
-int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *);
+int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
+                     void *, unsigned int);
 
 int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
 int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
@@ -1188,7 +1153,7 @@ int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
 
 int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
 
-int ide_dev_read_id(ide_drive_t *, u8, u16 *);
+int ide_dev_read_id(ide_drive_t *, u8, u16 *, int);
 
 extern int ide_driveid_update(ide_drive_t *);
 extern int ide_config_drive_speed(ide_drive_t *, u8);
@@ -1220,7 +1185,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
 }
 
 void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *,
-                        hw_regs_t *, hw_regs_t **);
+                        struct ide_hw *, struct ide_hw **);
 void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1379,7 +1344,6 @@ int ide_in_drive_list(u16 *, const struct drive_list_entry *);
 #ifdef CONFIG_BLK_DEV_IDEDMA
 int ide_dma_good_drive(ide_drive_t *);
 int __ide_dma_bad_drive(ide_drive_t *);
-int ide_id_dma_bug(ide_drive_t *);
 
 u8 ide_find_dma_mode(ide_drive_t *, u8);
 
@@ -1420,7 +1384,6 @@ void ide_dma_lost_irq(ide_drive_t *);
 ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
 
 #else
-static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
 static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
 static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
 static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
@@ -1440,6 +1403,7 @@ static inline void ide_dma_unmap_sg(ide_drive_t *drive,
 
 #ifdef CONFIG_BLK_DEV_IDEACPI
 int ide_acpi_init(void);
+bool ide_port_acpi(ide_hwif_t *hwif);
 extern int ide_acpi_exec_tfs(ide_drive_t *drive);
 extern void ide_acpi_get_timing(ide_hwif_t *hwif);
 extern void ide_acpi_push_timing(ide_hwif_t *hwif);
@@ -1448,6 +1412,7 @@ void ide_acpi_port_init_devices(ide_hwif_t *);
 extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
 #else
 static inline int ide_acpi_init(void) { return 0; }
+static inline bool ide_port_acpi(ide_hwif_t *hwif) { return 0; }
 static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
 static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
 static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
@@ -1459,16 +1424,18 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
 void ide_register_region(struct gendisk *);
 void ide_unregister_region(struct gendisk *);
 
+void ide_check_nien_quirk_list(ide_drive_t *);
 void ide_undecoded_slave(ide_drive_t *);
 
 void ide_port_apply_params(ide_hwif_t *);
 int ide_sysfs_register_port(ide_hwif_t *);
 
-struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
+struct ide_host *ide_host_alloc(const struct ide_port_info *, struct ide_hw **,
+                               unsigned int);
 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_hw **);
+int ide_host_add(const struct ide_port_info *, struct ide_hw **, unsigned int,
                 struct ide_host **);
 void ide_host_remove(struct ide_host *);
 int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
@@ -1528,6 +1495,7 @@ int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
 int ide_scan_pio_blacklist(char *);
 const char *ide_xfer_verbose(u8);
 u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
+int ide_pio_need_iordy(ide_drive_t *, const u8);
 int ide_set_pio_mode(ide_drive_t *, u8);
 int ide_set_dma_mode(ide_drive_t *, u8);
 void ide_set_pio(ide_drive_t *, u8);
@@ -1565,6 +1533,16 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
        return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
 }
 
+static inline void *ide_get_drivedata(ide_drive_t *drive)
+{
+       return drive->drive_data;
+}
+
+static inline void ide_set_drivedata(ide_drive_t *drive, void *data)
+{
+       drive->drive_data = data;
+}
+
 #define ide_port_for_each_dev(i, dev, port) \
        for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)