Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]

Diff markup

Differences between /linux/include/linux/ide.h (Version 2.6.25.8) and /linux/include/linux/ide.h (Version 2.6.31.13)


  1 #ifndef _IDE_H                                      1 #ifndef _IDE_H
  2 #define _IDE_H                                      2 #define _IDE_H
  3 /*                                                  3 /*
  4  *  linux/include/linux/ide.h                       4  *  linux/include/linux/ide.h
  5  *                                                  5  *
  6  *  Copyright (C) 1994-2002  Linus Torvalds &       6  *  Copyright (C) 1994-2002  Linus Torvalds & authors
  7  */                                                 7  */
  8                                                     8 
  9 #include <linux/init.h>                             9 #include <linux/init.h>
 10 #include <linux/ioport.h>                          10 #include <linux/ioport.h>
 11 #include <linux/hdreg.h>                       !!  11 #include <linux/ata.h>
 12 #include <linux/blkdev.h>                          12 #include <linux/blkdev.h>
 13 #include <linux/proc_fs.h>                         13 #include <linux/proc_fs.h>
 14 #include <linux/interrupt.h>                       14 #include <linux/interrupt.h>
 15 #include <linux/bitops.h>                          15 #include <linux/bitops.h>
 16 #include <linux/bio.h>                             16 #include <linux/bio.h>
 17 #include <linux/device.h>                          17 #include <linux/device.h>
 18 #include <linux/pci.h>                             18 #include <linux/pci.h>
 19 #include <linux/completion.h>                      19 #include <linux/completion.h>
                                                   >>  20 #include <linux/pm.h>
 20 #ifdef CONFIG_BLK_DEV_IDEACPI                      21 #ifdef CONFIG_BLK_DEV_IDEACPI
 21 #include <acpi/acpi.h>                             22 #include <acpi/acpi.h>
 22 #endif                                             23 #endif
 23 #include <asm/byteorder.h>                         24 #include <asm/byteorder.h>
 24 #include <asm/system.h>                            25 #include <asm/system.h>
 25 #include <asm/io.h>                                26 #include <asm/io.h>
 26 #include <asm/semaphore.h>                     << 
 27 #include <asm/mutex.h>                             27 #include <asm/mutex.h>
 28                                                    28 
 29 #if defined(CONFIG_CRIS) || defined(CONFIG_FRV !!  29 /* for request_sense */
                                                   >>  30 #include <linux/cdrom.h>
                                                   >>  31 
                                                   >>  32 #if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300)
 30 # define SUPPORT_VLB_SYNC 0                        33 # define SUPPORT_VLB_SYNC 0
 31 #else                                              34 #else
 32 # define SUPPORT_VLB_SYNC 1                        35 # define SUPPORT_VLB_SYNC 1
 33 #endif                                             36 #endif
 34                                                    37 
 35 /*                                                 38 /*
 36  * Used to indicate "no IRQ", should be a valu << 
 37  * number.                                     << 
 38  */                                            << 
 39                                                << 
 40 #define IDE_NO_IRQ              (-1)           << 
 41                                                << 
 42 typedef unsigned char   byte;   /* used everyw << 
 43                                                << 
 44 /*                                             << 
 45  * Probably not wise to fiddle with these          39  * Probably not wise to fiddle with these
 46  */                                                40  */
                                                   >>  41 #define IDE_DEFAULT_MAX_FAILURES        1
 47 #define ERROR_MAX       8       /* Max read/wr     42 #define ERROR_MAX       8       /* Max read/write errors per sector */
 48 #define ERROR_RESET     3       /* Reset contr     43 #define ERROR_RESET     3       /* Reset controller every 4th retry */
 49 #define ERROR_RECAL     1       /* Recalibrate     44 #define ERROR_RECAL     1       /* Recalibrate every 2nd retry */
 50                                                    45 
 51 /*                                             !!  46 /* Error codes returned in rq->errors to the higher part of the driver. */
 52  * Tune flags                                  !!  47 enum {
 53  */                                            !!  48         IDE_DRV_ERROR_GENERAL   = 101,
 54 #define IDE_TUNE_NOAUTO         2              !!  49         IDE_DRV_ERROR_FILEMARK  = 102,
 55 #define IDE_TUNE_AUTO           1              !!  50         IDE_DRV_ERROR_EOD       = 103,
 56 #define IDE_TUNE_DEFAULT        0              !!  51 };
 57                                                    52 
 58 /*                                                 53 /*
 59  * state flags                                 !!  54  * Definitions for accessing IDE controller registers
 60  */                                                55  */
                                                   >>  56 #define IDE_NR_PORTS            (10)
 61                                                    57 
 62 #define DMA_PIO_RETRY   1       /* retrying in !!  58 struct ide_io_ports {
                                                   >>  59         unsigned long   data_addr;
 63                                                    60 
 64 #define HWIF(drive)             ((ide_hwif_t * !!  61         union {
 65 #define HWGROUP(drive)          ((ide_hwgroup_ !!  62                 unsigned long error_addr;       /*   read:  error */
                                                   >>  63                 unsigned long feature_addr;     /*  write: feature */
                                                   >>  64         };
 66                                                    65 
 67 /*                                             !!  66         unsigned long   nsect_addr;
 68  * Definitions for accessing IDE controller re !!  67         unsigned long   lbal_addr;
 69  */                                            !!  68         unsigned long   lbam_addr;
 70 #define IDE_NR_PORTS            (10)           !!  69         unsigned long   lbah_addr;
 71                                                    70 
 72 #define IDE_DATA_OFFSET         (0)            !!  71         unsigned long   device_addr;
 73 #define IDE_ERROR_OFFSET        (1)            !!  72 
 74 #define IDE_NSECTOR_OFFSET      (2)            !!  73         union {
 75 #define IDE_SECTOR_OFFSET       (3)            !!  74                 unsigned long status_addr;      /*  read: status  */
 76 #define IDE_LCYL_OFFSET         (4)            !!  75                 unsigned long command_addr;     /* write: command */
 77 #define IDE_HCYL_OFFSET         (5)            !!  76         };
 78 #define IDE_SELECT_OFFSET       (6)            !!  77 
 79 #define IDE_STATUS_OFFSET       (7)            !!  78         unsigned long   ctl_addr;
 80 #define IDE_CONTROL_OFFSET      (8)            !!  79 
 81 #define IDE_IRQ_OFFSET          (9)            !!  80         unsigned long   irq_addr;
 82                                                !!  81 };
 83 #define IDE_FEATURE_OFFSET      IDE_ERROR_OFFS << 
 84 #define IDE_COMMAND_OFFSET      IDE_STATUS_OFF << 
 85                                                << 
 86 #define IDE_DATA_REG            (HWIF(drive)-> << 
 87 #define IDE_ERROR_REG           (HWIF(drive)-> << 
 88 #define IDE_NSECTOR_REG         (HWIF(drive)-> << 
 89 #define IDE_SECTOR_REG          (HWIF(drive)-> << 
 90 #define IDE_LCYL_REG            (HWIF(drive)-> << 
 91 #define IDE_HCYL_REG            (HWIF(drive)-> << 
 92 #define IDE_SELECT_REG          (HWIF(drive)-> << 
 93 #define IDE_STATUS_REG          (HWIF(drive)-> << 
 94 #define IDE_CONTROL_REG         (HWIF(drive)-> << 
 95 #define IDE_IRQ_REG             (HWIF(drive)-> << 
 96                                                << 
 97 #define IDE_FEATURE_REG         IDE_ERROR_REG  << 
 98 #define IDE_COMMAND_REG         IDE_STATUS_REG << 
 99 #define IDE_ALTSTATUS_REG       IDE_CONTROL_RE << 
100 #define IDE_IREASON_REG         IDE_NSECTOR_RE << 
101 #define IDE_BCOUNTL_REG         IDE_LCYL_REG   << 
102 #define IDE_BCOUNTH_REG         IDE_HCYL_REG   << 
103                                                    82 
104 #define OK_STAT(stat,good,bad)  (((stat)&((goo     83 #define OK_STAT(stat,good,bad)  (((stat)&((good)|(bad)))==(good))
105 #define BAD_R_STAT              (BUSY_STAT   | << 
106 #define BAD_W_STAT              (BAD_R_STAT  | << 
107 #define BAD_STAT                (BAD_R_STAT  | << 
108 #define DRIVE_READY             (READY_STAT  | << 
109                                                    84 
110 #define BAD_CRC                 (ABRT_ERR    | !!  85 #define BAD_R_STAT      (ATA_BUSY | ATA_ERR)
                                                   >>  86 #define BAD_W_STAT      (BAD_R_STAT | ATA_DF)
                                                   >>  87 #define BAD_STAT        (BAD_R_STAT | ATA_DRQ)
                                                   >>  88 #define DRIVE_READY     (ATA_DRDY | ATA_DSC)
                                                   >>  89 
                                                   >>  90 #define BAD_CRC         (ATA_ABORTED | ATA_ICRC)
111                                                    91 
112 #define SATA_NR_PORTS           (3)     /* 16      92 #define SATA_NR_PORTS           (3)     /* 16 possible ?? */
113                                                    93 
114 #define SATA_STATUS_OFFSET      (0)                94 #define SATA_STATUS_OFFSET      (0)
115 #define SATA_ERROR_OFFSET       (1)                95 #define SATA_ERROR_OFFSET       (1)
116 #define SATA_CONTROL_OFFSET     (2)                96 #define SATA_CONTROL_OFFSET     (2)
117                                                    97 
118 /*                                                 98 /*
119  * Our Physical Region Descriptor (PRD) table      99  * Our Physical Region Descriptor (PRD) table should be large enough
120  * to handle the biggest I/O request we are li    100  * to handle the biggest I/O request we are likely to see.  Since requests
121  * can have no more than 256 sectors, and sinc    101  * can have no more than 256 sectors, and since the typical blocksize is
122  * two or more sectors, we could get by with a    102  * two or more sectors, we could get by with a limit of 128 entries here for
123  * the usual worst case.  Most requests seem t    103  * the usual worst case.  Most requests seem to include some contiguous blocks,
124  * further reducing the number of table entrie    104  * further reducing the number of table entries required.
125  *                                                105  *
126  * The driver reverts to PIO mode for individu    106  * The driver reverts to PIO mode for individual requests that exceed
127  * this limit (possible with 512 byte blocksiz    107  * this limit (possible with 512 byte blocksizes, eg. MSDOS f/s), so handling
128  * 100% of all crazy scenarios here is not nec    108  * 100% of all crazy scenarios here is not necessary.
129  *                                                109  *
130  * As it turns out though, we must allocate a     110  * As it turns out though, we must allocate a full 4KB page for this,
131  * so the two PRD tables (ide0 & ide1) will ea    111  * so the two PRD tables (ide0 & ide1) will each get half of that,
132  * allowing each to have about 256 entries (8     112  * allowing each to have about 256 entries (8 bytes each) from this.
133  */                                               113  */
134 #define PRD_BYTES       8                         114 #define PRD_BYTES       8
135 #define PRD_ENTRIES     256                       115 #define PRD_ENTRIES     256
136                                                   116 
137 /*                                                117 /*
138  * Some more useful definitions                   118  * Some more useful definitions
139  */                                               119  */
140 #define PARTN_BITS      6       /* number of m    120 #define PARTN_BITS      6       /* number of minor dev bits for partitions */
141 #define MAX_DRIVES      2       /* per interfa    121 #define MAX_DRIVES      2       /* per interface; 2 assumed by lots of code */
142 #define SECTOR_SIZE     512                       122 #define SECTOR_SIZE     512
143 #define SECTOR_WORDS    (SECTOR_SIZE / 4)      << 
144 #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2)  << 
145                                                   123 
146 /*                                                124 /*
147  * Timeouts for various operations:               125  * Timeouts for various operations:
148  */                                               126  */
149 #define WAIT_DRQ        (HZ/10)         /* 100 !! 127 enum {
150 #define WAIT_READY      (5*HZ)          /* 5se !! 128         /* spec allows up to 20ms */
151 #define WAIT_PIDENTIFY  (10*HZ) /* 10sec  - sh !! 129         WAIT_DRQ        = HZ / 10,      /* 100ms */
152 #define WAIT_WORSTCASE  (30*HZ) /* 30sec  - wo !! 130         /* some laptops are very slow */
153 #define WAIT_CMD        (10*HZ) /* 10sec  - ma !! 131         WAIT_READY      = 5 * HZ,       /* 5s */
154 #define WAIT_MIN_SLEEP  (2*HZ/100)      /* 20m !! 132         /* should be less than 3ms (?), if all ATAPI CD is closed at boot */
                                                   >> 133         WAIT_PIDENTIFY  = 10 * HZ,      /* 10s */
                                                   >> 134         /* worst case when spinning up */
                                                   >> 135         WAIT_WORSTCASE  = 30 * HZ,      /* 30s */
                                                   >> 136         /* maximum wait for an IRQ to happen */
                                                   >> 137         WAIT_CMD        = 10 * HZ,      /* 10s */
                                                   >> 138         /* Some drives require a longer IRQ timeout. */
                                                   >> 139         WAIT_FLOPPY_CMD = 50 * HZ,      /* 50s */
                                                   >> 140         /*
                                                   >> 141          * Some drives (for example, Seagate STT3401A Travan) require a very
                                                   >> 142          * long timeout, because they don't return an interrupt or clear their
                                                   >> 143          * BSY bit until after the command completes (even retension commands).
                                                   >> 144          */
                                                   >> 145         WAIT_TAPE_CMD   = 900 * HZ,     /* 900s */
                                                   >> 146         /* minimum sleep time */
                                                   >> 147         WAIT_MIN_SLEEP  = HZ / 50,      /* 20ms */
                                                   >> 148 };
155                                                   149 
156 /*                                                150 /*
157  * Check for an interrupt and acknowledge the  !! 151  * Op codes for special requests to be handled by ide_special_rq().
                                                   >> 152  * Values should be in the range of 0x20 to 0x3f.
158  */                                               153  */
159 struct hwif_s;                                 !! 154 #define REQ_DRIVE_RESET         0x20
160 typedef int (ide_ack_intr_t)(struct hwif_s *); !! 155 #define REQ_DEVSET_EXEC         0x21
                                                   >> 156 #define REQ_PARK_HEADS          0x22
                                                   >> 157 #define REQ_UNPARK_HEADS        0x23
161                                                   158 
162 /*                                                159 /*
163  * hwif_chipset_t is used to keep track of the    160  * hwif_chipset_t is used to keep track of the specific hardware
164  * chipset used by each IDE interface, if know    161  * chipset used by each IDE interface, if known.
165  */                                               162  */
166 enum {          ide_unknown,    ide_generic,      163 enum {          ide_unknown,    ide_generic,    ide_pci,
167                 ide_cmd640,     ide_dtc2278,      164                 ide_cmd640,     ide_dtc2278,    ide_ali14xx,
168                 ide_qd65xx,     ide_umc8672,      165                 ide_qd65xx,     ide_umc8672,    ide_ht6560b,
169                 ide_rz1000,     ide_trm290,    !! 166                 ide_4drives,    ide_pmac,       ide_acorn,
170                 ide_cmd646,     ide_cy82c693,  !! 167                 ide_au1xxx,     ide_palm3710
171                 ide_pmac,       ide_etrax100,  << 
172                 ide_au1xxx,     ide_palm3710,  << 
173 };                                                168 };
174                                                   169 
175 typedef u8 hwif_chipset_t;                        170 typedef u8 hwif_chipset_t;
176                                                   171 
177 /*                                                172 /*
178  * Structure to hold all information about the    173  * Structure to hold all information about the location of this port
179  */                                               174  */
180 typedef struct hw_regs_s {                     !! 175 struct ide_hw {
181         unsigned long   io_ports[IDE_NR_PORTS] !! 176         union {
182         int             irq;                   !! 177                 struct ide_io_ports     io_ports;
183         ide_ack_intr_t  *ack_intr;             !! 178                 unsigned long           io_ports_array[IDE_NR_PORTS];
184         hwif_chipset_t  chipset;               !! 179         };
185         struct device   *dev;                  << 
186 } hw_regs_t;                                   << 
187                                                << 
188 struct hwif_s * ide_find_port(unsigned long);  << 
189 struct hwif_s *ide_deprecated_find_port(unsign << 
190 void ide_init_port_data(struct hwif_s *, unsig << 
191 void ide_init_port_hw(struct hwif_s *, hw_regs << 
192                                                   180 
193 struct ide_drive_s;                            !! 181         int             irq;                    /* our irq number */
194 int ide_register_hw(hw_regs_t *, void (*)(stru !! 182         struct device   *dev, *parent;
195                     struct hwif_s **);         !! 183         unsigned long   config;
                                                   >> 184 };
196                                                   185 
197 static inline void ide_std_init_ports(hw_regs_ !! 186 static inline void ide_std_init_ports(struct ide_hw *hw,
198                                       unsigned    187                                       unsigned long io_addr,
199                                       unsigned    188                                       unsigned long ctl_addr)
200 {                                                 189 {
201         unsigned int i;                           190         unsigned int i;
202                                                   191 
203         for (i = IDE_DATA_OFFSET; i <= IDE_STA !! 192         for (i = 0; i <= 7; i++)
204                 hw->io_ports[i] = io_addr++;   !! 193                 hw->io_ports_array[i] = io_addr++;
205                                                   194 
206         hw->io_ports[IDE_CONTROL_OFFSET] = ctl !! 195         hw->io_ports.ctl_addr = ctl_addr;
207 }                                                 196 }
208                                                   197 
209 #include <asm/ide.h>                           !! 198 #define MAX_HWIFS       10
210                                                << 
211 #if !defined(MAX_HWIFS) || defined(CONFIG_EMBE << 
212 #undef MAX_HWIFS                               << 
213 #define MAX_HWIFS       CONFIG_IDE_MAX_HWIFS   << 
214 #endif                                         << 
215                                                << 
216 /* needed on alpha, x86/x86_64, ia64, mips, pp << 
217 #ifndef IDE_ARCH_OBSOLETE_DEFAULTS             << 
218 # define ide_default_io_base(index)     (0)    << 
219 # define ide_default_irq(base)          (0)    << 
220 # define ide_init_default_irq(base)     (0)    << 
221 #endif                                         << 
222                                                << 
223 #ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT           << 
224 static inline void ide_init_hwif_ports(hw_regs << 
225                                        unsigne << 
226                                        unsigne << 
227                                        int *ir << 
228 {                                              << 
229         if (!ctl_addr)                         << 
230                 ide_std_init_ports(hw, io_addr << 
231         else                                   << 
232                 ide_std_init_ports(hw, io_addr << 
233                                                << 
234         if (irq)                               << 
235                 *irq = 0;                      << 
236                                                << 
237         hw->io_ports[IDE_IRQ_OFFSET] = 0;      << 
238                                                << 
239 #ifdef CONFIG_PPC32                            << 
240         if (ppc_ide_md.ide_init_hwif)          << 
241                 ppc_ide_md.ide_init_hwif(hw, i << 
242 #endif                                         << 
243 }                                              << 
244 #else                                          << 
245 static inline void ide_init_hwif_ports(hw_regs << 
246                                        unsigne << 
247                                        unsigne << 
248                                        int *ir << 
249 {                                              << 
250         if (io_addr || ctl_addr)               << 
251                 printk(KERN_WARNING "%s: must  << 
252 }                                              << 
253 #endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */     << 
254                                                << 
255 /* Currently only m68k, apus and m8xx need it  << 
256 #ifndef IDE_ARCH_ACK_INTR                      << 
257 # define ide_ack_intr(hwif) (1)                << 
258 #endif                                         << 
259                                                << 
260 /* Currently only Atari needs it */            << 
261 #ifndef IDE_ARCH_LOCK                          << 
262 # define ide_release_lock()                    << 
263 # define ide_get_lock(hdlr, data)              << 
264 #endif /* IDE_ARCH_LOCK */                     << 
265                                                   199 
266 /*                                                200 /*
267  * Now for the data we need to maintain per-dr    201  * Now for the data we need to maintain per-drive:  ide_drive_t
268  */                                               202  */
269                                                   203 
270 #define ide_scsi        0x21                      204 #define ide_scsi        0x21
271 #define ide_disk        0x20                      205 #define ide_disk        0x20
272 #define ide_optical     0x7                       206 #define ide_optical     0x7
273 #define ide_cdrom       0x5                       207 #define ide_cdrom       0x5
274 #define ide_tape        0x1                       208 #define ide_tape        0x1
275 #define ide_floppy      0x0                       209 #define ide_floppy      0x0
276                                                   210 
277 /*                                                211 /*
278  * Special Driver Flags                           212  * Special Driver Flags
279  *                                             << 
280  * set_geometry : respecify drive geometry     << 
281  * recalibrate  : seek to cyl 0                << 
282  * set_multmode : set multmode count           << 
283  * set_tune     : tune interface for drive     << 
284  * serviced     : service command              << 
285  * reserved     : unused                       << 
286  */                                            << 
287 typedef union {                                << 
288         unsigned all                    : 8;   << 
289         struct {                               << 
290                 unsigned set_geometry   : 1;   << 
291                 unsigned recalibrate    : 1;   << 
292                 unsigned set_multmode   : 1;   << 
293                 unsigned set_tune       : 1;   << 
294                 unsigned serviced       : 1;   << 
295                 unsigned reserved       : 3;   << 
296         } b;                                   << 
297 } special_t;                                   << 
298                                                << 
299 /*                                             << 
300  * ATA-IDE Select Register, aka Device-Head    << 
301  *                                             << 
302  * head         : always zeros here            << 
303  * unit         : drive select number: 0/1     << 
304  * bit5         : always 1                     << 
305  * lba          : using LBA instead of CHS     << 
306  * bit7         : always 1                     << 
307  */                                               213  */
308 typedef union {                                !! 214 enum {
309         unsigned all                    : 8;   !! 215         IDE_SFLAG_SET_GEOMETRY          = (1 << 0),
310         struct {                               !! 216         IDE_SFLAG_RECALIBRATE           = (1 << 1),
311 #if defined(__LITTLE_ENDIAN_BITFIELD)          !! 217         IDE_SFLAG_SET_MULTMODE          = (1 << 2),
312                 unsigned head           : 4;   !! 218 };
313                 unsigned unit           : 1;   << 
314                 unsigned bit5           : 1;   << 
315                 unsigned lba            : 1;   << 
316                 unsigned bit7           : 1;   << 
317 #elif defined(__BIG_ENDIAN_BITFIELD)           << 
318                 unsigned bit7           : 1;   << 
319                 unsigned lba            : 1;   << 
320                 unsigned bit5           : 1;   << 
321                 unsigned unit           : 1;   << 
322                 unsigned head           : 4;   << 
323 #else                                          << 
324 #error "Please fix <asm/byteorder.h>"          << 
325 #endif                                         << 
326         } b;                                   << 
327 } select_t, ata_select_t;                      << 
328                                                   219 
329 /*                                                220 /*
330  * Status returned from various ide_ functions    221  * Status returned from various ide_ functions
331  */                                               222  */
332 typedef enum {                                    223 typedef enum {
333         ide_stopped,    /* no drive operation     224         ide_stopped,    /* no drive operation was started */
334         ide_started,    /* a drive operation w    225         ide_started,    /* a drive operation was started, handler was set */
335 } ide_startstop_t;                                226 } ide_startstop_t;
336                                                   227 
337 struct ide_driver_s;                           !! 228 enum {
338 struct ide_settings_s;                         !! 229         IDE_VALID_ERROR                 = (1 << 1),
                                                   >> 230         IDE_VALID_FEATURE               = IDE_VALID_ERROR,
                                                   >> 231         IDE_VALID_NSECT                 = (1 << 2),
                                                   >> 232         IDE_VALID_LBAL                  = (1 << 3),
                                                   >> 233         IDE_VALID_LBAM                  = (1 << 4),
                                                   >> 234         IDE_VALID_LBAH                  = (1 << 5),
                                                   >> 235         IDE_VALID_DEVICE                = (1 << 6),
                                                   >> 236         IDE_VALID_LBA                   = IDE_VALID_LBAL |
                                                   >> 237                                           IDE_VALID_LBAM |
                                                   >> 238                                           IDE_VALID_LBAH,
                                                   >> 239         IDE_VALID_OUT_TF                = IDE_VALID_FEATURE |
                                                   >> 240                                           IDE_VALID_NSECT |
                                                   >> 241                                           IDE_VALID_LBA,
                                                   >> 242         IDE_VALID_IN_TF                 = IDE_VALID_NSECT |
                                                   >> 243                                           IDE_VALID_LBA,
                                                   >> 244         IDE_VALID_OUT_HOB               = IDE_VALID_OUT_TF,
                                                   >> 245         IDE_VALID_IN_HOB                = IDE_VALID_ERROR |
                                                   >> 246                                           IDE_VALID_NSECT |
                                                   >> 247                                           IDE_VALID_LBA,
                                                   >> 248 };
                                                   >> 249 
                                                   >> 250 enum {
                                                   >> 251         IDE_TFLAG_LBA48                 = (1 << 0),
                                                   >> 252         IDE_TFLAG_WRITE                 = (1 << 1),
                                                   >> 253         IDE_TFLAG_CUSTOM_HANDLER        = (1 << 2),
                                                   >> 254         IDE_TFLAG_DMA_PIO_FALLBACK      = (1 << 3),
                                                   >> 255         /* force 16-bit I/O operations */
                                                   >> 256         IDE_TFLAG_IO_16BIT              = (1 << 4),
                                                   >> 257         /* struct ide_cmd was allocated using kmalloc() */
                                                   >> 258         IDE_TFLAG_DYN                   = (1 << 5),
                                                   >> 259         IDE_TFLAG_FS                    = (1 << 6),
                                                   >> 260         IDE_TFLAG_MULTI_PIO             = (1 << 7),
                                                   >> 261 };
                                                   >> 262 
                                                   >> 263 enum {
                                                   >> 264         IDE_FTFLAG_FLAGGED              = (1 << 0),
                                                   >> 265         IDE_FTFLAG_SET_IN_FLAGS         = (1 << 1),
                                                   >> 266         IDE_FTFLAG_OUT_DATA             = (1 << 2),
                                                   >> 267         IDE_FTFLAG_IN_DATA              = (1 << 3),
                                                   >> 268 };
                                                   >> 269 
                                                   >> 270 struct ide_taskfile {
                                                   >> 271         u8      data;           /* 0: data byte (for TASKFILE ioctl) */
                                                   >> 272         union {                 /* 1: */
                                                   >> 273                 u8 error;       /*  read: error */
                                                   >> 274                 u8 feature;     /* write: feature */
                                                   >> 275         };
                                                   >> 276         u8      nsect;          /* 2: number of sectors */
                                                   >> 277         u8      lbal;           /* 3: LBA low */
                                                   >> 278         u8      lbam;           /* 4: LBA mid */
                                                   >> 279         u8      lbah;           /* 5: LBA high */
                                                   >> 280         u8      device;         /* 6: device select */
                                                   >> 281         union {                 /* 7: */
                                                   >> 282                 u8 status;      /*  read: status */
                                                   >> 283                 u8 command;     /* write: command */
                                                   >> 284         };
                                                   >> 285 };
                                                   >> 286 
                                                   >> 287 struct ide_cmd {
                                                   >> 288         struct ide_taskfile     tf;
                                                   >> 289         struct ide_taskfile     hob;
                                                   >> 290         struct {
                                                   >> 291                 struct {
                                                   >> 292                         u8              tf;
                                                   >> 293                         u8              hob;
                                                   >> 294                 } out, in;
                                                   >> 295         } valid;
                                                   >> 296 
                                                   >> 297         u8                      tf_flags;
                                                   >> 298         u8                      ftf_flags;      /* for TASKFILE ioctl */
                                                   >> 299         int                     protocol;
                                                   >> 300 
                                                   >> 301         int                     sg_nents;         /* number of sg entries */
                                                   >> 302         int                     orig_sg_nents;
                                                   >> 303         int                     sg_dma_direction; /* DMA transfer direction */
                                                   >> 304 
                                                   >> 305         unsigned int            nbytes;
                                                   >> 306         unsigned int            nleft;
                                                   >> 307         unsigned int            last_xfer_len;
                                                   >> 308 
                                                   >> 309         struct scatterlist      *cursg;
                                                   >> 310         unsigned int            cursg_ofs;
                                                   >> 311 
                                                   >> 312         struct request          *rq;            /* copy of request */
                                                   >> 313 };
                                                   >> 314 
                                                   >> 315 /* ATAPI packet command flags */
                                                   >> 316 enum {
                                                   >> 317         /* set when an error is considered normal - no retry (ide-tape) */
                                                   >> 318         PC_FLAG_ABORT                   = (1 << 0),
                                                   >> 319         PC_FLAG_SUPPRESS_ERROR          = (1 << 1),
                                                   >> 320         PC_FLAG_WAIT_FOR_DSC            = (1 << 2),
                                                   >> 321         PC_FLAG_DMA_OK                  = (1 << 3),
                                                   >> 322         PC_FLAG_DMA_IN_PROGRESS         = (1 << 4),
                                                   >> 323         PC_FLAG_DMA_ERROR               = (1 << 5),
                                                   >> 324         PC_FLAG_WRITING                 = (1 << 6),
                                                   >> 325 };
                                                   >> 326 
                                                   >> 327 #define ATAPI_WAIT_PC           (60 * HZ)
                                                   >> 328 
                                                   >> 329 struct ide_atapi_pc {
                                                   >> 330         /* actual packet bytes */
                                                   >> 331         u8 c[12];
                                                   >> 332         /* incremented on each retry */
                                                   >> 333         int retries;
                                                   >> 334         int error;
                                                   >> 335 
                                                   >> 336         /* bytes to transfer */
                                                   >> 337         int req_xfer;
                                                   >> 338 
                                                   >> 339         /* the corresponding request */
                                                   >> 340         struct request *rq;
                                                   >> 341 
                                                   >> 342         unsigned long flags;
                                                   >> 343 
                                                   >> 344         /*
                                                   >> 345          * those are more or less driver-specific and some of them are subject
                                                   >> 346          * to change/removal later.
                                                   >> 347          */
                                                   >> 348         unsigned long timeout;
                                                   >> 349 };
                                                   >> 350 
                                                   >> 351 struct ide_devset;
                                                   >> 352 struct ide_driver;
339                                                   353 
340 #ifdef CONFIG_BLK_DEV_IDEACPI                     354 #ifdef CONFIG_BLK_DEV_IDEACPI
341 struct ide_acpi_drive_link;                       355 struct ide_acpi_drive_link;
342 struct ide_acpi_hwif_link;                        356 struct ide_acpi_hwif_link;
343 #endif                                            357 #endif
344                                                   358 
345 typedef struct ide_drive_s {                   !! 359 struct ide_drive_s;
                                                   >> 360 
                                                   >> 361 struct ide_disk_ops {
                                                   >> 362         int             (*check)(struct ide_drive_s *, const char *);
                                                   >> 363         int             (*get_capacity)(struct ide_drive_s *);
                                                   >> 364         u64             (*set_capacity)(struct ide_drive_s *, u64);
                                                   >> 365         void            (*setup)(struct ide_drive_s *);
                                                   >> 366         void            (*flush)(struct ide_drive_s *);
                                                   >> 367         int             (*init_media)(struct ide_drive_s *, struct gendisk *);
                                                   >> 368         int             (*set_doorlock)(struct ide_drive_s *, struct gendisk *,
                                                   >> 369                                         int);
                                                   >> 370         ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
                                                   >> 371                                       sector_t);
                                                   >> 372         int             (*ioctl)(struct ide_drive_s *, struct block_device *,
                                                   >> 373                                  fmode_t, unsigned int, unsigned long);
                                                   >> 374 };
                                                   >> 375 
                                                   >> 376 /* ATAPI device flags */
                                                   >> 377 enum {
                                                   >> 378         IDE_AFLAG_DRQ_INTERRUPT         = (1 << 0),
                                                   >> 379 
                                                   >> 380         /* ide-cd */
                                                   >> 381         /* Drive cannot eject the disc. */
                                                   >> 382         IDE_AFLAG_NO_EJECT              = (1 << 1),
                                                   >> 383         /* Drive is a pre ATAPI 1.2 drive. */
                                                   >> 384         IDE_AFLAG_PRE_ATAPI12           = (1 << 2),
                                                   >> 385         /* TOC addresses are in BCD. */
                                                   >> 386         IDE_AFLAG_TOCADDR_AS_BCD        = (1 << 3),
                                                   >> 387         /* TOC track numbers are in BCD. */
                                                   >> 388         IDE_AFLAG_TOCTRACKS_AS_BCD      = (1 << 4),
                                                   >> 389         /* Saved TOC information is current. */
                                                   >> 390         IDE_AFLAG_TOC_VALID             = (1 << 6),
                                                   >> 391         /* We think that the drive door is locked. */
                                                   >> 392         IDE_AFLAG_DOOR_LOCKED           = (1 << 7),
                                                   >> 393         /* SET_CD_SPEED command is unsupported. */
                                                   >> 394         IDE_AFLAG_NO_SPEED_SELECT       = (1 << 8),
                                                   >> 395         IDE_AFLAG_VERTOS_300_SSD        = (1 << 9),
                                                   >> 396         IDE_AFLAG_VERTOS_600_ESD        = (1 << 10),
                                                   >> 397         IDE_AFLAG_SANYO_3CD             = (1 << 11),
                                                   >> 398         IDE_AFLAG_FULL_CAPS_PAGE        = (1 << 12),
                                                   >> 399         IDE_AFLAG_PLAY_AUDIO_OK         = (1 << 13),
                                                   >> 400         IDE_AFLAG_LE_SPEED_FIELDS       = (1 << 14),
                                                   >> 401 
                                                   >> 402         /* ide-floppy */
                                                   >> 403         /* Avoid commands not supported in Clik drive */
                                                   >> 404         IDE_AFLAG_CLIK_DRIVE            = (1 << 15),
                                                   >> 405         /* Requires BH algorithm for packets */
                                                   >> 406         IDE_AFLAG_ZIP_DRIVE             = (1 << 16),
                                                   >> 407         /* Supports format progress report */
                                                   >> 408         IDE_AFLAG_SRFP                  = (1 << 17),
                                                   >> 409 
                                                   >> 410         /* ide-tape */
                                                   >> 411         IDE_AFLAG_IGNORE_DSC            = (1 << 18),
                                                   >> 412         /* 0 When the tape position is unknown */
                                                   >> 413         IDE_AFLAG_ADDRESS_VALID         = (1 << 19),
                                                   >> 414         /* Device already opened */
                                                   >> 415         IDE_AFLAG_BUSY                  = (1 << 20),
                                                   >> 416         /* Attempt to auto-detect the current user block size */
                                                   >> 417         IDE_AFLAG_DETECT_BS             = (1 << 21),
                                                   >> 418         /* Currently on a filemark */
                                                   >> 419         IDE_AFLAG_FILEMARK              = (1 << 22),
                                                   >> 420         /* 0 = no tape is loaded, so we don't rewind after ejecting */
                                                   >> 421         IDE_AFLAG_MEDIUM_PRESENT        = (1 << 23),
                                                   >> 422 
                                                   >> 423         IDE_AFLAG_NO_AUTOCLOSE          = (1 << 24),
                                                   >> 424 };
                                                   >> 425 
                                                   >> 426 /* device flags */
                                                   >> 427 enum {
                                                   >> 428         /* restore settings after device reset */
                                                   >> 429         IDE_DFLAG_KEEP_SETTINGS         = (1 << 0),
                                                   >> 430         /* device is using DMA for read/write */
                                                   >> 431         IDE_DFLAG_USING_DMA             = (1 << 1),
                                                   >> 432         /* okay to unmask other IRQs */
                                                   >> 433         IDE_DFLAG_UNMASK                = (1 << 2),
                                                   >> 434         /* don't attempt flushes */
                                                   >> 435         IDE_DFLAG_NOFLUSH               = (1 << 3),
                                                   >> 436         /* DSC overlap */
                                                   >> 437         IDE_DFLAG_DSC_OVERLAP           = (1 << 4),
                                                   >> 438         /* give potential excess bandwidth */
                                                   >> 439         IDE_DFLAG_NICE1                 = (1 << 5),
                                                   >> 440         /* device is physically present */
                                                   >> 441         IDE_DFLAG_PRESENT               = (1 << 6),
                                                   >> 442         /* disable Host Protected Area */
                                                   >> 443         IDE_DFLAG_NOHPA                 = (1 << 7),
                                                   >> 444         /* id read from device (synthetic if not set) */
                                                   >> 445         IDE_DFLAG_ID_READ               = (1 << 8),
                                                   >> 446         IDE_DFLAG_NOPROBE               = (1 << 9),
                                                   >> 447         /* need to do check_media_change() */
                                                   >> 448         IDE_DFLAG_REMOVABLE             = (1 << 10),
                                                   >> 449         /* needed for removable devices */
                                                   >> 450         IDE_DFLAG_ATTACH                = (1 << 11),
                                                   >> 451         IDE_DFLAG_FORCED_GEOM           = (1 << 12),
                                                   >> 452         /* disallow setting unmask bit */
                                                   >> 453         IDE_DFLAG_NO_UNMASK             = (1 << 13),
                                                   >> 454         /* disallow enabling 32-bit I/O */
                                                   >> 455         IDE_DFLAG_NO_IO_32BIT           = (1 << 14),
                                                   >> 456         /* for removable only: door lock/unlock works */
                                                   >> 457         IDE_DFLAG_DOORLOCKING           = (1 << 15),
                                                   >> 458         /* disallow DMA */
                                                   >> 459         IDE_DFLAG_NODMA                 = (1 << 16),
                                                   >> 460         /* powermanagment told us not to do anything, so sleep nicely */
                                                   >> 461         IDE_DFLAG_BLOCKED               = (1 << 17),
                                                   >> 462         /* sleeping & sleep field valid */
                                                   >> 463         IDE_DFLAG_SLEEPING              = (1 << 18),
                                                   >> 464         IDE_DFLAG_POST_RESET            = (1 << 19),
                                                   >> 465         IDE_DFLAG_UDMA33_WARNED         = (1 << 20),
                                                   >> 466         IDE_DFLAG_LBA48                 = (1 << 21),
                                                   >> 467         /* status of write cache */
                                                   >> 468         IDE_DFLAG_WCACHE                = (1 << 22),
                                                   >> 469         /* used for ignoring ATA_DF */
                                                   >> 470         IDE_DFLAG_NOWERR                = (1 << 23),
                                                   >> 471         /* retrying in PIO */
                                                   >> 472         IDE_DFLAG_DMA_PIO_RETRY         = (1 << 24),
                                                   >> 473         IDE_DFLAG_LBA                   = (1 << 25),
                                                   >> 474         /* don't unload heads */
                                                   >> 475         IDE_DFLAG_NO_UNLOAD             = (1 << 26),
                                                   >> 476         /* heads unloaded, please don't reset port */
                                                   >> 477         IDE_DFLAG_PARKED                = (1 << 27),
                                                   >> 478         IDE_DFLAG_MEDIA_CHANGED         = (1 << 28),
                                                   >> 479         /* write protect */
                                                   >> 480         IDE_DFLAG_WP                    = (1 << 29),
                                                   >> 481         IDE_DFLAG_FORMAT_IN_PROGRESS    = (1 << 30),
                                                   >> 482         IDE_DFLAG_NIEN_QUIRK            = (1 << 31),
                                                   >> 483 };
                                                   >> 484 
                                                   >> 485 struct ide_drive_s {
346         char            name[4];        /* dri    486         char            name[4];        /* drive name, such as "hda" */
347         char            driver_req[10]; /* req    487         char            driver_req[10]; /* requests specific driver */
348                                                   488 
349         struct request_queue    *queue; /* req    489         struct request_queue    *queue; /* request queue */
350                                                   490 
351         struct request          *rq;    /* cur    491         struct request          *rq;    /* current request */
352         struct ide_drive_s      *next;  /* cir << 
353         void            *driver_data;   /* ext    492         void            *driver_data;   /* extra driver data */
354         struct hd_driveid       *id;    /* dri !! 493         u16                     *id;    /* identification info */
355 #ifdef CONFIG_IDE_PROC_FS                         494 #ifdef CONFIG_IDE_PROC_FS
356         struct proc_dir_entry *proc;    /* /pr    495         struct proc_dir_entry *proc;    /* /proc/ide/ directory entry */
357         struct ide_settings_s *settings;/* /pr !! 496         const struct ide_proc_devset *settings; /* /proc/ide/ drive settings */
358 #endif                                            497 #endif
359         struct hwif_s           *hwif;  /* act    498         struct hwif_s           *hwif;  /* actually (ide_hwif_t *) */
360                                                   499 
                                                   >> 500         const struct ide_disk_ops *disk_ops;
                                                   >> 501 
                                                   >> 502         unsigned long dev_flags;
                                                   >> 503 
361         unsigned long sleep;            /* sle    504         unsigned long sleep;            /* sleep until this time */
362         unsigned long service_start;    /* tim << 
363         unsigned long service_time;     /* ser << 
364         unsigned long timeout;          /* max    505         unsigned long timeout;          /* max time to wait for irq */
365                                                   506 
366         special_t       special;        /* spe !! 507         u8      special_flags;          /* special action flags */
367         select_t        select;         /* bas << 
368                                                   508 
369         u8      keep_settings;          /* res !! 509         u8      select;                 /* basic drive/head select reg value */
370         u8      using_dma;              /* dis << 
371         u8      retry_pio;              /* ret    510         u8      retry_pio;              /* retrying dma capable host in pio */
372         u8      state;                  /* ret << 
373         u8      waiting_for_dma;        /* dma    511         u8      waiting_for_dma;        /* dma currently in progress */
374         u8      unmask;                 /* oka !! 512         u8      dma;                    /* atapi dma flag */
375         u8      noflush;                /* don << 
376         u8      dsc_overlap;            /* DSC << 
377         u8      nice1;                  /* giv << 
378                                                << 
379         unsigned present        : 1;    /* dri << 
380         unsigned dead           : 1;    /* dev << 
381         unsigned id_read        : 1;    /* 1=i << 
382         unsigned noprobe        : 1;    /* fro << 
383         unsigned removable      : 1;    /* 1 i << 
384         unsigned attach         : 1;    /* nee << 
385         unsigned forced_geom    : 1;    /* 1 i << 
386         unsigned no_unmask      : 1;    /* dis << 
387         unsigned no_io_32bit    : 1;    /* dis << 
388         unsigned atapi_overlap  : 1;    /* ATA << 
389         unsigned doorlocking    : 1;    /* for << 
390         unsigned nodma          : 1;    /* dis << 
391         unsigned autotune       : 2;    /* 0=d << 
392         unsigned remap_0_to_1   : 1;    /* 0=n << 
393         unsigned blocked        : 1;    /* 1=p << 
394         unsigned vdma           : 1;    /* 1=d << 
395         unsigned scsi           : 1;    /* 0=d << 
396         unsigned sleeping       : 1;    /* 1=s << 
397         unsigned post_reset     : 1;           << 
398         unsigned udma33_warned  : 1;           << 
399                                                   513 
400         u8      addressing;     /* 0=28-bit, 1 << 
401         u8      quirk_list;     /* considered  << 
402         u8      init_speed;     /* transfer ra    514         u8      init_speed;     /* transfer rate set at boot */
403         u8      current_speed;  /* current tra    515         u8      current_speed;  /* current transfer rate set */
404         u8      desired_speed;  /* desired tra    516         u8      desired_speed;  /* desired transfer rate set */
405         u8      dn;             /* now wide sp    517         u8      dn;             /* now wide spread use */
406         u8      wcache;         /* status of w << 
407         u8      acoustic;       /* acoustic ma    518         u8      acoustic;       /* acoustic management */
408         u8      media;          /* disk, cdrom    519         u8      media;          /* disk, cdrom, tape, floppy, ... */
409         u8      ctl;            /* "normal" va << 
410         u8      ready_stat;     /* min status     520         u8      ready_stat;     /* min status value for drive ready */
411         u8      mult_count;     /* current mul    521         u8      mult_count;     /* current multiple sector setting */
412         u8      mult_req;       /* requested m    522         u8      mult_req;       /* requested multiple sector setting */
413         u8      tune_req;       /* requested d << 
414         u8      io_32bit;       /* 0=16-bit, 1    523         u8      io_32bit;       /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
415         u8      bad_wstat;      /* used for ig !! 524         u8      bad_wstat;      /* used for ignoring ATA_DF */
416         u8      nowerr;         /* used for ig << 
417         u8      sect0;          /* offset of f << 
418         u8      head;           /* "real" numb    525         u8      head;           /* "real" number of heads */
419         u8      sect;           /* "real" sect    526         u8      sect;           /* "real" sectors per track */
420         u8      bios_head;      /* BIOS/fdisk/    527         u8      bios_head;      /* BIOS/fdisk/LILO number of heads */
421         u8      bios_sect;      /* BIOS/fdisk/    528         u8      bios_sect;      /* BIOS/fdisk/LILO sectors per track */
422                                                   529 
                                                   >> 530         /* delay this long before sending packet command */
                                                   >> 531         u8 pc_delay;
                                                   >> 532 
423         unsigned int    bios_cyl;       /* BIO    533         unsigned int    bios_cyl;       /* BIOS/fdisk/LILO number of cyls */
424         unsigned int    cyl;            /* "re    534         unsigned int    cyl;            /* "real" number of cyls */
425         unsigned int    drive_data;     /* use !! 535         void            *drive_data;    /* used by set_pio_mode/dev_select() */
426         unsigned int    failures;       /* cur    536         unsigned int    failures;       /* current failure count */
427         unsigned int    max_failures;   /* max    537         unsigned int    max_failures;   /* maximum allowed failure count */
428         u64             probed_capacity;/* ini !! 538         u64             probed_capacity;/* initial/native media capacity */
429                                                << 
430         u64             capacity64;     /* tot    539         u64             capacity64;     /* total number of sectors */
431                                                   540 
432         int             lun;            /* log    541         int             lun;            /* logical unit */
433         int             crc_count;      /* crc    542         int             crc_count;      /* crc counter to reduce drive speed */
                                                   >> 543 
                                                   >> 544         unsigned long   debug_mask;     /* debugging levels switch */
                                                   >> 545 
434 #ifdef CONFIG_BLK_DEV_IDEACPI                     546 #ifdef CONFIG_BLK_DEV_IDEACPI
435         struct ide_acpi_drive_link *acpidata;     547         struct ide_acpi_drive_link *acpidata;
436 #endif                                            548 #endif
437         struct list_head list;                    549         struct list_head list;
438         struct device   gendev;                   550         struct device   gendev;
439         struct completion gendev_rel_comp;        551         struct completion gendev_rel_comp;      /* to deal with device release() */
440 } ide_drive_t;                                 << 
441                                                   552 
442 #define to_ide_device(dev)container_of(dev, id !! 553         /* current packet command */
                                                   >> 554         struct ide_atapi_pc *pc;
443                                                   555 
444 #define IDE_CHIPSET_PCI_MASK    \              !! 556         /* last failed packet command */
445     ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali1 !! 557         struct ide_atapi_pc *failed_pc;
446 #define IDE_CHIPSET_IS_PCI(c)   ((IDE_CHIPSET_ !! 558 
                                                   >> 559         /* callback for packet commands */
                                                   >> 560         int  (*pc_callback)(struct ide_drive_s *, int);
                                                   >> 561 
                                                   >> 562         ide_startstop_t (*irq_handler)(struct ide_drive_s *);
                                                   >> 563 
                                                   >> 564         unsigned long atapi_flags;
                                                   >> 565 
                                                   >> 566         struct ide_atapi_pc request_sense_pc;
                                                   >> 567 
                                                   >> 568         /* current sense rq and buffer */
                                                   >> 569         bool sense_rq_armed;
                                                   >> 570         struct request sense_rq;
                                                   >> 571         struct request_sense sense_data;
                                                   >> 572 };
                                                   >> 573 
                                                   >> 574 typedef struct ide_drive_s ide_drive_t;
                                                   >> 575 
                                                   >> 576 #define to_ide_device(dev)              container_of(dev, ide_drive_t, gendev)
                                                   >> 577 
                                                   >> 578 #define to_ide_drv(obj, cont_type)      \
                                                   >> 579         container_of(obj, struct cont_type, dev)
                                                   >> 580 
                                                   >> 581 #define ide_drv_g(disk, cont_type)      \
                                                   >> 582         container_of((disk)->private_data, struct cont_type, driver)
447                                                   583 
448 struct ide_port_info;                             584 struct ide_port_info;
449                                                   585 
                                                   >> 586 struct ide_tp_ops {
                                                   >> 587         void    (*exec_command)(struct hwif_s *, u8);
                                                   >> 588         u8      (*read_status)(struct hwif_s *);
                                                   >> 589         u8      (*read_altstatus)(struct hwif_s *);
                                                   >> 590         void    (*write_devctl)(struct hwif_s *, u8);
                                                   >> 591 
                                                   >> 592         void    (*dev_select)(ide_drive_t *);
                                                   >> 593         void    (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8);
                                                   >> 594         void    (*tf_read)(ide_drive_t *, struct ide_taskfile *, u8);
                                                   >> 595 
                                                   >> 596         void    (*input_data)(ide_drive_t *, struct ide_cmd *,
                                                   >> 597                               void *, unsigned int);
                                                   >> 598         void    (*output_data)(ide_drive_t *, struct ide_cmd *,
                                                   >> 599                                void *, unsigned int);
                                                   >> 600 };
                                                   >> 601 
                                                   >> 602 extern const struct ide_tp_ops default_tp_ops;
                                                   >> 603 
                                                   >> 604 /**
                                                   >> 605  * struct ide_port_ops - IDE port operations
                                                   >> 606  *
                                                   >> 607  * @init_dev:           host specific initialization of a device
                                                   >> 608  * @set_pio_mode:       routine to program host for PIO mode
                                                   >> 609  * @set_dma_mode:       routine to program host for DMA mode
                                                   >> 610  * @reset_poll:         chipset polling based on hba specifics
                                                   >> 611  * @pre_reset:          chipset specific changes to default for device-hba resets
                                                   >> 612  * @resetproc:          routine to reset controller after a disk reset
                                                   >> 613  * @maskproc:           special host masking for drive selection
                                                   >> 614  * @quirkproc:          check host's drive quirk list
                                                   >> 615  * @clear_irq:          clear IRQ
                                                   >> 616  *
                                                   >> 617  * @mdma_filter:        filter MDMA modes
                                                   >> 618  * @udma_filter:        filter UDMA modes
                                                   >> 619  *
                                                   >> 620  * @cable_detect:       detect cable type
                                                   >> 621  */
                                                   >> 622 struct ide_port_ops {
                                                   >> 623         void    (*init_dev)(ide_drive_t *);
                                                   >> 624         void    (*set_pio_mode)(ide_drive_t *, const u8);
                                                   >> 625         void    (*set_dma_mode)(ide_drive_t *, const u8);
                                                   >> 626         int     (*reset_poll)(ide_drive_t *);
                                                   >> 627         void    (*pre_reset)(ide_drive_t *);
                                                   >> 628         void    (*resetproc)(ide_drive_t *);
                                                   >> 629         void    (*maskproc)(ide_drive_t *, int);
                                                   >> 630         void    (*quirkproc)(ide_drive_t *);
                                                   >> 631         void    (*clear_irq)(ide_drive_t *);
                                                   >> 632         int     (*test_irq)(struct hwif_s *);
                                                   >> 633 
                                                   >> 634         u8      (*mdma_filter)(ide_drive_t *);
                                                   >> 635         u8      (*udma_filter)(ide_drive_t *);
                                                   >> 636 
                                                   >> 637         u8      (*cable_detect)(struct hwif_s *);
                                                   >> 638 };
                                                   >> 639 
                                                   >> 640 struct ide_dma_ops {
                                                   >> 641         void    (*dma_host_set)(struct ide_drive_s *, int);
                                                   >> 642         int     (*dma_setup)(struct ide_drive_s *, struct ide_cmd *);
                                                   >> 643         void    (*dma_start)(struct ide_drive_s *);
                                                   >> 644         int     (*dma_end)(struct ide_drive_s *);
                                                   >> 645         int     (*dma_test_irq)(struct ide_drive_s *);
                                                   >> 646         void    (*dma_lost_irq)(struct ide_drive_s *);
                                                   >> 647         /* below ones are optional */
                                                   >> 648         int     (*dma_check)(struct ide_drive_s *, struct ide_cmd *);
                                                   >> 649         int     (*dma_timer_expiry)(struct ide_drive_s *);
                                                   >> 650         void    (*dma_clear)(struct ide_drive_s *);
                                                   >> 651         /*
                                                   >> 652          * The following method is optional and only required to be
                                                   >> 653          * implemented for the SFF-8038i compatible controllers.
                                                   >> 654          */
                                                   >> 655         u8      (*dma_sff_read_status)(struct hwif_s *);
                                                   >> 656 };
                                                   >> 657 
                                                   >> 658 enum {
                                                   >> 659         IDE_PFLAG_PROBING               = (1 << 0),
                                                   >> 660 };
                                                   >> 661 
                                                   >> 662 struct ide_host;
                                                   >> 663 
450 typedef struct hwif_s {                           664 typedef struct hwif_s {
451         struct hwif_s *next;            /* for << 
452         struct hwif_s *mate;            /* oth    665         struct hwif_s *mate;            /* other hwif from same PCI chip */
453         struct hwgroup_s *hwgroup;      /* act << 
454         struct proc_dir_entry *proc;    /* /pr    666         struct proc_dir_entry *proc;    /* /proc/ide/ directory entry */
455                                                   667 
                                                   >> 668         struct ide_host *host;
                                                   >> 669 
456         char name[6];                   /* nam    670         char name[6];                   /* name of interface, eg. "ide0" */
457                                                   671 
458                 /* task file registers for pat !! 672         struct ide_io_ports     io_ports;
459         unsigned long   io_ports[IDE_NR_PORTS] !! 673 
460         unsigned long   sata_scr[SATA_NR_PORTS    674         unsigned long   sata_scr[SATA_NR_PORTS];
461                                                   675 
462         ide_drive_t     drives[MAX_DRIVES];    !! 676         ide_drive_t     *devices[MAX_DRIVES + 1];
                                                   >> 677 
                                                   >> 678         unsigned long   port_flags;
463                                                   679 
464         u8 major;       /* our major number */    680         u8 major;       /* our major number */
465         u8 index;       /* 0 for ide0; 1 for i    681         u8 index;       /* 0 for ide0; 1 for ide1; ... */
466         u8 channel;     /* for dual-port chips    682         u8 channel;     /* for dual-port chips: 0=primary, 1=secondary */
467         u8 bus_state;   /* power state of the  << 
468                                                   683 
469         u32 host_flags;                           684         u32 host_flags;
470                                                   685 
471         u8 pio_mask;                              686         u8 pio_mask;
472                                                   687 
473         u8 ultra_mask;                            688         u8 ultra_mask;
474         u8 mwdma_mask;                            689         u8 mwdma_mask;
475         u8 swdma_mask;                            690         u8 swdma_mask;
476                                                   691 
477         u8 cbl;         /* cable type */          692         u8 cbl;         /* cable type */
478                                                   693 
479         hwif_chipset_t chipset; /* sub-module     694         hwif_chipset_t chipset; /* sub-module for tuning.. */
480                                                   695 
481         struct device *dev;                       696         struct device *dev;
482                                                   697 
483         const struct ide_port_info *cds;       << 
484                                                << 
485         ide_ack_intr_t *ack_intr;              << 
486                                                << 
487         void (*rw_disk)(ide_drive_t *, struct     698         void (*rw_disk)(ide_drive_t *, struct request *);
488                                                   699 
489 #if 0                                          !! 700         const struct ide_tp_ops         *tp_ops;
490         ide_hwif_ops_t  *hwifops;              !! 701         const struct ide_port_ops       *port_ops;
491 #else                                          !! 702         const struct ide_dma_ops        *dma_ops;
492         /* host specific initialization of dev << 
493         void    (*port_init_devs)(struct hwif_ << 
494         /* routine to program host for PIO mod << 
495         void    (*set_pio_mode)(ide_drive_t *, << 
496         /* routine to program host for DMA mod << 
497         void    (*set_dma_mode)(ide_drive_t *, << 
498         /* tweaks hardware to select drive */  << 
499         void    (*selectproc)(ide_drive_t *);  << 
500         /* chipset polling based on hba specif << 
501         int     (*reset_poll)(ide_drive_t *);  << 
502         /* chipset specific changes to default << 
503         void    (*pre_reset)(ide_drive_t *);   << 
504         /* routine to reset controller after a << 
505         void    (*resetproc)(ide_drive_t *);   << 
506         /* special host masking for drive sele << 
507         void    (*maskproc)(ide_drive_t *, int << 
508         /* check host's drive quirk list */    << 
509         void    (*quirkproc)(ide_drive_t *);   << 
510         /* driver soft-power interface */      << 
511         int     (*busproc)(ide_drive_t *, int) << 
512 #endif                                         << 
513         u8 (*mdma_filter)(ide_drive_t *);      << 
514         u8 (*udma_filter)(ide_drive_t *);      << 
515                                                << 
516         u8 (*cable_detect)(struct hwif_s *);   << 
517                                                << 
518         void (*ata_input_data)(ide_drive_t *,  << 
519         void (*ata_output_data)(ide_drive_t *, << 
520                                                << 
521         void (*atapi_input_bytes)(ide_drive_t  << 
522         void (*atapi_output_bytes)(ide_drive_t << 
523                                                << 
524         void (*dma_host_set)(ide_drive_t *, in << 
525         int (*dma_setup)(ide_drive_t *);       << 
526         void (*dma_exec_cmd)(ide_drive_t *, u8 << 
527         void (*dma_start)(ide_drive_t *);      << 
528         int (*ide_dma_end)(ide_drive_t *drive) << 
529         int (*ide_dma_test_irq)(ide_drive_t *d << 
530         void (*ide_dma_clear_irq)(ide_drive_t  << 
531         void (*dma_lost_irq)(ide_drive_t *driv << 
532         void (*dma_timeout)(ide_drive_t *drive << 
533                                                << 
534         void (*OUTB)(u8 addr, unsigned long po << 
535         void (*OUTBSYNC)(ide_drive_t *drive, u << 
536         void (*OUTW)(u16 addr, unsigned long p << 
537         void (*OUTSW)(unsigned long port, void << 
538         void (*OUTSL)(unsigned long port, void << 
539                                                << 
540         u8  (*INB)(unsigned long port);        << 
541         u16 (*INW)(unsigned long port);        << 
542         void (*INSW)(unsigned long port, void  << 
543         void (*INSL)(unsigned long port, void  << 
544                                                   703 
545         /* dma physical region descriptor tabl    704         /* dma physical region descriptor table (cpu view) */
546         unsigned int    *dmatable_cpu;            705         unsigned int    *dmatable_cpu;
547         /* dma physical region descriptor tabl    706         /* dma physical region descriptor table (dma view) */
548         dma_addr_t      dmatable_dma;             707         dma_addr_t      dmatable_dma;
                                                   >> 708 
                                                   >> 709         /* maximum number of PRD table entries */
                                                   >> 710         int prd_max_nents;
                                                   >> 711         /* PRD entry size in bytes */
                                                   >> 712         int prd_ent_size;
                                                   >> 713 
549         /* Scatter-gather list used to build t    714         /* Scatter-gather list used to build the above */
550         struct scatterlist *sg_table;             715         struct scatterlist *sg_table;
551         int sg_max_nents;               /* Max    716         int sg_max_nents;               /* Maximum number of entries in it */
552         int sg_nents;                   /* Cur << 
553         int sg_dma_direction;           /* dma << 
554                                                   717 
555         /* data phase of the active command (c !! 718         struct ide_cmd cmd;             /* current command */
556         int             data_phase;            << 
557                                                << 
558         unsigned int nsect;                    << 
559         unsigned int nleft;                    << 
560         struct scatterlist *cursg;             << 
561         unsigned int cursg_ofs;                << 
562                                                   719 
563         int             rqsize;         /* max    720         int             rqsize;         /* max sectors per request */
564         int             irq;            /* our    721         int             irq;            /* our irq number */
565                                                   722 
566         unsigned long   dma_base;       /* bas    723         unsigned long   dma_base;       /* base addr for dma ports */
567         unsigned long   dma_command;    /* dma << 
568         unsigned long   dma_vendor1;    /* dma << 
569         unsigned long   dma_status;     /* dma << 
570         unsigned long   dma_vendor3;    /* dma << 
571         unsigned long   dma_prdtable;   /* act << 
572                                                   724 
573         unsigned long   config_data;    /* for    725         unsigned long   config_data;    /* for use by chipset-specific code */
574         unsigned long   select_data;    /* for    726         unsigned long   select_data;    /* for use by chipset-specific code */
575                                                   727 
576         unsigned long   extra_base;     /* ext    728         unsigned long   extra_base;     /* extra addr for dma ports */
577         unsigned        extra_ports;    /* num    729         unsigned        extra_ports;    /* number of extra dma ports */
578                                                   730 
579         unsigned        noprobe    : 1; /* don << 
580         unsigned        present    : 1; /* thi    731         unsigned        present    : 1; /* this interface exists */
581         unsigned        hold       : 1; /* thi !! 732         unsigned        busy       : 1; /* serializes devices on a port */
582         unsigned        serialized : 1; /* ser !! 733 
583         unsigned        sharing_irq: 1; /* 1 = !! 734         struct device           gendev;
584         unsigned        reset      : 1; /* res !! 735         struct device           *portdev;
585         unsigned        sg_mapped  : 1; /* sg_ << 
586         unsigned        mmio       : 1; /* hos << 
587         unsigned        straight8  : 1; /* Ala << 
588                                                   736 
589         struct device   gendev;                << 
590         struct completion gendev_rel_comp; /*     737         struct completion gendev_rel_comp; /* To deal with device release() */
591                                                   738 
592         void            *hwif_data;     /* ext    739         void            *hwif_data;     /* extra hwif data */
593                                                   740 
594         unsigned dma;                          << 
595                                                << 
596 #ifdef CONFIG_BLK_DEV_IDEACPI                     741 #ifdef CONFIG_BLK_DEV_IDEACPI
597         struct ide_acpi_hwif_link *acpidata;      742         struct ide_acpi_hwif_link *acpidata;
598 #endif                                            743 #endif
599 } ____cacheline_internodealigned_in_smp ide_hw << 
600                                                << 
601 /*                                             << 
602  *  internal ide interrupt handler type        << 
603  */                                            << 
604 typedef ide_startstop_t (ide_handler_t)(ide_dr << 
605 typedef int (ide_expiry_t)(ide_drive_t *);     << 
606                                                << 
607 /* used by ide-cd, ide-floppy, etc. */         << 
608 typedef void (xfer_func_t)(ide_drive_t *, void << 
609                                                   744 
610 typedef struct hwgroup_s {                     !! 745         /* IRQ handler, if active */
611                 /* irq handler, if active */   << 
612         ide_startstop_t (*handler)(ide_drive_t    746         ide_startstop_t (*handler)(ide_drive_t *);
613                                                   747 
614                 /* BOOL: protects all fields b !! 748         /* BOOL: polling active & poll_timeout field valid */
615         volatile int busy;                     !! 749         unsigned int polling : 1;
616                 /* BOOL: wake us up on timer e << 
617         unsigned int sleeping   : 1;           << 
618                 /* BOOL: polling active & poll << 
619         unsigned int polling    : 1;           << 
620                 /* BOOL: in a polling reset si << 
621         unsigned int resetting  : 1;           << 
622                                                << 
623                 /* current drive */            << 
624         ide_drive_t *drive;                    << 
625                 /* ptr to current hwif in link << 
626         ide_hwif_t *hwif;                      << 
627                                                   750 
628                 /* current request */          !! 751         /* current drive */
                                                   >> 752         ide_drive_t *cur_dev;
                                                   >> 753 
                                                   >> 754         /* current request */
629         struct request *rq;                       755         struct request *rq;
630                                                   756 
631                 /* failsafe timer */           !! 757         /* failsafe timer */
632         struct timer_list timer;                  758         struct timer_list timer;
633                 /* timeout value during long p !! 759         /* timeout value during long polls */
634         unsigned long poll_timeout;               760         unsigned long poll_timeout;
635                 /* queried upon timeouts */    !! 761         /* queried upon timeouts */
636         int (*expiry)(ide_drive_t *);             762         int (*expiry)(ide_drive_t *);
637                                                   763 
638         int req_gen;                              764         int req_gen;
639         int req_gen_timer;                        765         int req_gen_timer;
640 } ide_hwgroup_t;                               << 
641                                                   766 
642 typedef struct ide_driver_s ide_driver_t;      !! 767         spinlock_t lock;
                                                   >> 768 } ____cacheline_internodealigned_in_smp ide_hwif_t;
643                                                   769 
644 extern struct mutex ide_setting_mtx;           !! 770 #define MAX_HOST_PORTS 4
645                                                   771 
646 int set_io_32bit(ide_drive_t *, int);          !! 772 struct ide_host {
647 int set_pio_mode(ide_drive_t *, int);          !! 773         ide_hwif_t      *ports[MAX_HOST_PORTS + 1];
648 int set_using_dma(ide_drive_t *, int);         !! 774         unsigned int    n_ports;
                                                   >> 775         struct device   *dev[2];
                                                   >> 776 
                                                   >> 777         int             (*init_chipset)(struct pci_dev *);
                                                   >> 778 
                                                   >> 779         void            (*get_lock)(irq_handler_t, void *);
                                                   >> 780         void            (*release_lock)(void);
                                                   >> 781 
                                                   >> 782         irq_handler_t   irq_handler;
                                                   >> 783 
                                                   >> 784         unsigned long   host_flags;
                                                   >> 785 
                                                   >> 786         int             irq_flags;
                                                   >> 787 
                                                   >> 788         void            *host_priv;
                                                   >> 789         ide_hwif_t      *cur_port;      /* for hosts requiring serialization */
                                                   >> 790 
                                                   >> 791         /* used for hosts requiring serialization */
                                                   >> 792         volatile unsigned long  host_busy;
                                                   >> 793 };
                                                   >> 794 
                                                   >> 795 #define IDE_HOST_BUSY 0
                                                   >> 796 
                                                   >> 797 /*
                                                   >> 798  *  internal ide interrupt handler type
                                                   >> 799  */
                                                   >> 800 typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
                                                   >> 801 typedef int (ide_expiry_t)(ide_drive_t *);
                                                   >> 802 
                                                   >> 803 /* used by ide-cd, ide-floppy, etc. */
                                                   >> 804 typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned);
                                                   >> 805 
                                                   >> 806 extern struct mutex ide_setting_mtx;
649                                                   807 
650 #ifdef CONFIG_IDE_PROC_FS                      << 
651 /*                                                808 /*
652  * configurable drive settings                    809  * configurable drive settings
653  */                                               810  */
654                                                   811 
655 #define TYPE_INT        0                      !! 812 #define DS_SYNC (1 << 0)
656 #define TYPE_BYTE       1                      << 
657 #define TYPE_SHORT      2                      << 
658                                                << 
659 #define SETTING_READ    (1 << 0)               << 
660 #define SETTING_WRITE   (1 << 1)               << 
661 #define SETTING_RW      (SETTING_READ | SETTIN << 
662                                                   813 
663 typedef int (ide_procset_t)(ide_drive_t *, int !! 814 struct ide_devset {
664 typedef struct ide_settings_s {                !! 815         int             (*get)(ide_drive_t *);
665         char                    *name;         !! 816         int             (*set)(ide_drive_t *, int);
666         int                     rw;            !! 817         unsigned int    flags;
667         int                     data_type;     !! 818 };
668         int                     min;           !! 819 
669         int                     max;           !! 820 #define __DEVSET(_flags, _get, _set) { \
670         int                     mul_factor;    !! 821         .flags  = _flags, \
671         int                     div_factor;    !! 822         .get    = _get, \
672         void                    *data;         !! 823         .set    = _set, \
673         ide_procset_t           *set;          !! 824 }
674         int                     auto_remove;   << 
675         struct ide_settings_s   *next;         << 
676 } ide_settings_t;                              << 
677                                                   825 
678 int ide_add_setting(ide_drive_t *, const char  !! 826 #define ide_devset_get(name, field) \
                                                   >> 827 static int get_##name(ide_drive_t *drive) \
                                                   >> 828 { \
                                                   >> 829         return drive->field; \
                                                   >> 830 }
                                                   >> 831 
                                                   >> 832 #define ide_devset_set(name, field) \
                                                   >> 833 static int set_##name(ide_drive_t *drive, int arg) \
                                                   >> 834 { \
                                                   >> 835         drive->field = arg; \
                                                   >> 836         return 0; \
                                                   >> 837 }
                                                   >> 838 
                                                   >> 839 #define ide_devset_get_flag(name, flag) \
                                                   >> 840 static int get_##name(ide_drive_t *drive) \
                                                   >> 841 { \
                                                   >> 842         return !!(drive->dev_flags & flag); \
                                                   >> 843 }
679                                                   844 
                                                   >> 845 #define ide_devset_set_flag(name, flag) \
                                                   >> 846 static int set_##name(ide_drive_t *drive, int arg) \
                                                   >> 847 { \
                                                   >> 848         if (arg) \
                                                   >> 849                 drive->dev_flags |= flag; \
                                                   >> 850         else \
                                                   >> 851                 drive->dev_flags &= ~flag; \
                                                   >> 852         return 0; \
                                                   >> 853 }
                                                   >> 854 
                                                   >> 855 #define __IDE_DEVSET(_name, _flags, _get, _set) \
                                                   >> 856 const struct ide_devset ide_devset_##_name = \
                                                   >> 857         __DEVSET(_flags, _get, _set)
                                                   >> 858 
                                                   >> 859 #define IDE_DEVSET(_name, _flags, _get, _set) \
                                                   >> 860 static __IDE_DEVSET(_name, _flags, _get, _set)
                                                   >> 861 
                                                   >> 862 #define ide_devset_rw(_name, _func) \
                                                   >> 863 IDE_DEVSET(_name, 0, get_##_func, set_##_func)
                                                   >> 864 
                                                   >> 865 #define ide_devset_w(_name, _func) \
                                                   >> 866 IDE_DEVSET(_name, 0, NULL, set_##_func)
                                                   >> 867 
                                                   >> 868 #define ide_ext_devset_rw(_name, _func) \
                                                   >> 869 __IDE_DEVSET(_name, 0, get_##_func, set_##_func)
                                                   >> 870 
                                                   >> 871 #define ide_ext_devset_rw_sync(_name, _func) \
                                                   >> 872 __IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func)
                                                   >> 873 
                                                   >> 874 #define ide_decl_devset(_name) \
                                                   >> 875 extern const struct ide_devset ide_devset_##_name
                                                   >> 876 
                                                   >> 877 ide_decl_devset(io_32bit);
                                                   >> 878 ide_decl_devset(keepsettings);
                                                   >> 879 ide_decl_devset(pio_mode);
                                                   >> 880 ide_decl_devset(unmaskirq);
                                                   >> 881 ide_decl_devset(using_dma);
                                                   >> 882 
                                                   >> 883 #ifdef CONFIG_IDE_PROC_FS
680 /*                                                884 /*
681  * /proc/ide interface                            885  * /proc/ide interface
682  */                                               886  */
                                                   >> 887 
                                                   >> 888 #define ide_devset_rw_field(_name, _field) \
                                                   >> 889 ide_devset_get(_name, _field); \
                                                   >> 890 ide_devset_set(_name, _field); \
                                                   >> 891 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
                                                   >> 892 
                                                   >> 893 #define ide_devset_rw_flag(_name, _field) \
                                                   >> 894 ide_devset_get_flag(_name, _field); \
                                                   >> 895 ide_devset_set_flag(_name, _field); \
                                                   >> 896 IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
                                                   >> 897 
                                                   >> 898 struct ide_proc_devset {
                                                   >> 899         const char              *name;
                                                   >> 900         const struct ide_devset *setting;
                                                   >> 901         int                     min, max;
                                                   >> 902         int                     (*mulf)(ide_drive_t *);
                                                   >> 903         int                     (*divf)(ide_drive_t *);
                                                   >> 904 };
                                                   >> 905 
                                                   >> 906 #define __IDE_PROC_DEVSET(_name, _min, _max, _mulf, _divf) { \
                                                   >> 907         .name = __stringify(_name), \
                                                   >> 908         .setting = &ide_devset_##_name, \
                                                   >> 909         .min = _min, \
                                                   >> 910         .max = _max, \
                                                   >> 911         .mulf = _mulf, \
                                                   >> 912         .divf = _divf, \
                                                   >> 913 }
                                                   >> 914 
                                                   >> 915 #define IDE_PROC_DEVSET(_name, _min, _max) \
                                                   >> 916 __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
                                                   >> 917 
683 typedef struct {                                  918 typedef struct {
684         const char      *name;                    919         const char      *name;
685         mode_t          mode;                     920         mode_t          mode;
686         read_proc_t     *read_proc;               921         read_proc_t     *read_proc;
687         write_proc_t    *write_proc;              922         write_proc_t    *write_proc;
688 } ide_proc_entry_t;                               923 } ide_proc_entry_t;
689                                                   924 
690 void proc_ide_create(void);                       925 void proc_ide_create(void);
691 void proc_ide_destroy(void);                      926 void proc_ide_destroy(void);
692 void ide_proc_register_port(ide_hwif_t *);        927 void ide_proc_register_port(ide_hwif_t *);
693 void ide_proc_port_register_devices(ide_hwif_t    928 void ide_proc_port_register_devices(ide_hwif_t *);
                                                   >> 929 void ide_proc_unregister_device(ide_drive_t *);
694 void ide_proc_unregister_port(ide_hwif_t *);      930 void ide_proc_unregister_port(ide_hwif_t *);
695 void ide_proc_register_driver(ide_drive_t *, i !! 931 void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
696 void ide_proc_unregister_driver(ide_drive_t *, !! 932 void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);
697                                                << 
698 void ide_add_generic_settings(ide_drive_t *);  << 
699                                                   933 
700 read_proc_t proc_ide_read_capacity;               934 read_proc_t proc_ide_read_capacity;
701 read_proc_t proc_ide_read_geometry;               935 read_proc_t proc_ide_read_geometry;
702                                                   936 
703 #ifdef CONFIG_BLK_DEV_IDEPCI                   << 
704 void ide_pci_create_host_proc(const char *, ge << 
705 #endif                                         << 
706                                                << 
707 /*                                                937 /*
708  * Standard exit stuff:                           938  * Standard exit stuff:
709  */                                               939  */
710 #define PROC_IDE_READ_RETURN(page,start,off,co    940 #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \
711 {                                       \         941 {                                       \
712         len -= off;                     \         942         len -= off;                     \
713         if (len < count) {              \         943         if (len < count) {              \
714                 *eof = 1;               \         944                 *eof = 1;               \
715                 if (len <= 0)           \         945                 if (len <= 0)           \
716                         return 0;       \         946                         return 0;       \
717         } else                          \         947         } else                          \
718                 len = count;            \         948                 len = count;            \
719         *start = page + off;            \         949         *start = page + off;            \
720         return len;                     \         950         return len;                     \
721 }                                                 951 }
722 #else                                             952 #else
723 static inline void proc_ide_create(void) { ; }    953 static inline void proc_ide_create(void) { ; }
724 static inline void proc_ide_destroy(void) { ;     954 static inline void proc_ide_destroy(void) { ; }
725 static inline void ide_proc_register_port(ide_    955 static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
726 static inline void ide_proc_port_register_devi    956 static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
                                                   >> 957 static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
727 static inline void ide_proc_unregister_port(id    958 static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
728 static inline void ide_proc_register_driver(id !! 959 static inline void ide_proc_register_driver(ide_drive_t *drive,
729 static inline void ide_proc_unregister_driver( !! 960                                             struct ide_driver *driver) { ; }
730 static inline void ide_add_generic_settings(id !! 961 static inline void ide_proc_unregister_driver(ide_drive_t *drive,
                                                   >> 962                                               struct ide_driver *driver) { ; }
731 #define PROC_IDE_READ_RETURN(page,start,off,co    963 #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
732 #endif                                            964 #endif
733                                                   965 
                                                   >> 966 enum {
                                                   >> 967         /* enter/exit functions */
                                                   >> 968         IDE_DBG_FUNC =                  (1 << 0),
                                                   >> 969         /* sense key/asc handling */
                                                   >> 970         IDE_DBG_SENSE =                 (1 << 1),
                                                   >> 971         /* packet commands handling */
                                                   >> 972         IDE_DBG_PC =                    (1 << 2),
                                                   >> 973         /* request handling */
                                                   >> 974         IDE_DBG_RQ =                    (1 << 3),
                                                   >> 975         /* driver probing/setup */
                                                   >> 976         IDE_DBG_PROBE =                 (1 << 4),
                                                   >> 977 };
                                                   >> 978 
                                                   >> 979 /* DRV_NAME has to be defined in the driver before using the macro below */
                                                   >> 980 #define __ide_debug_log(lvl, fmt, args...)                              \
                                                   >> 981 {                                                                       \
                                                   >> 982         if (unlikely(drive->debug_mask & lvl))                          \
                                                   >> 983                 printk(KERN_INFO DRV_NAME ": %s: " fmt "\n",            \
                                                   >> 984                                           __func__, ## args);           \
                                                   >> 985 }
                                                   >> 986 
734 /*                                                987 /*
735  * Power Management step value (rq->pm->pm_ste !! 988  * Power Management state machine (rq->pm->pm_step).
736  *                                             << 
737  * The step value starts at 0 (ide_pm_state_st << 
738  * suspend operation or 1000 (ide_pm_state_sta << 
739  * resume operation.                           << 
740  *                                                989  *
741  * For each step, the core calls the subdriver !! 990  * For each step, the core calls ide_start_power_step() first.
742  * This can return:                               991  * This can return:
743  *      - ide_stopped : In this case, the core    992  *      - ide_stopped : In this case, the core calls us back again unless
744  *                      step have been set to     993  *                      step have been set to ide_power_state_completed.
745  *      - ide_started : In this case, the chan    994  *      - ide_started : In this case, the channel is left busy until an
746  *                      async event (interrupt    995  *                      async event (interrupt) occurs.
747  * Typically, start_power_step() will issue a  !! 996  * Typically, ide_start_power_step() will issue a taskfile request with
748  * do_rw_taskfile().                              997  * do_rw_taskfile().
749  *                                                998  *
750  * Upon reception of the interrupt, the core w !! 999  * Upon reception of the interrupt, the core will call ide_complete_power_step()
751  * with the error code if any. This routine sh    1000  * with the error code if any. This routine should update the step value
752  * and return. It should not start a new reque    1001  * and return. It should not start a new request. The core will call
753  * start_power_step for the new step value, un !! 1002  * ide_start_power_step() for the new step value, unless step have been
754  * ide_power_state_completed.                  !! 1003  * set to IDE_PM_COMPLETED.
755  *                                             << 
756  * Subdrivers are expected to define their own << 
757  * steps from 1..999 for suspend and from 1001 << 
758  * other values are reserved for future use.   << 
759  */                                               1004  */
760                                                << 
761 enum {                                            1005 enum {
762         ide_pm_state_completed          = -1,  !! 1006         IDE_PM_START_SUSPEND,
763         ide_pm_state_start_suspend      = 0,   !! 1007         IDE_PM_FLUSH_CACHE      = IDE_PM_START_SUSPEND,
764         ide_pm_state_start_resume       = 1000 !! 1008         IDE_PM_STANDBY,
                                                   >> 1009 
                                                   >> 1010         IDE_PM_START_RESUME,
                                                   >> 1011         IDE_PM_RESTORE_PIO      = IDE_PM_START_RESUME,
                                                   >> 1012         IDE_PM_IDLE,
                                                   >> 1013         IDE_PM_RESTORE_DMA,
                                                   >> 1014 
                                                   >> 1015         IDE_PM_COMPLETED,
765 };                                                1016 };
766                                                   1017 
                                                   >> 1018 int generic_ide_suspend(struct device *, pm_message_t);
                                                   >> 1019 int generic_ide_resume(struct device *);
                                                   >> 1020 
                                                   >> 1021 void ide_complete_power_step(ide_drive_t *, struct request *);
                                                   >> 1022 ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
                                                   >> 1023 void ide_complete_pm_rq(ide_drive_t *, struct request *);
                                                   >> 1024 void ide_check_pm_state(ide_drive_t *, struct request *);
                                                   >> 1025 
767 /*                                                1026 /*
768  * Subdrivers support.                            1027  * Subdrivers support.
769  *                                                1028  *
770  * The gendriver.owner field should be set to     1029  * The gendriver.owner field should be set to the module owner of this driver.
771  * The gendriver.name field should be set to t    1030  * The gendriver.name field should be set to the name of this driver
772  */                                               1031  */
773 struct ide_driver_s {                          !! 1032 struct ide_driver {
774         const char                      *versi    1033         const char                      *version;
775         u8                              media; << 
776         unsigned supports_dsc_overlap   : 1;   << 
777         ide_startstop_t (*do_request)(ide_driv    1034         ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
778         int             (*end_request)(ide_dri << 
779         ide_startstop_t (*error)(ide_drive_t * << 
780         ide_startstop_t (*abort)(ide_drive_t * << 
781         struct device_driver    gen_driver;       1035         struct device_driver    gen_driver;
782         int             (*probe)(ide_drive_t *    1036         int             (*probe)(ide_drive_t *);
783         void            (*remove)(ide_drive_t     1037         void            (*remove)(ide_drive_t *);
784         void            (*resume)(ide_drive_t     1038         void            (*resume)(ide_drive_t *);
785         void            (*shutdown)(ide_drive_    1039         void            (*shutdown)(ide_drive_t *);
786 #ifdef CONFIG_IDE_PROC_FS                         1040 #ifdef CONFIG_IDE_PROC_FS
787         ide_proc_entry_t        *proc;         !! 1041         ide_proc_entry_t *              (*proc_entries)(ide_drive_t *);
                                                   >> 1042         const struct ide_proc_devset *  (*proc_devsets)(ide_drive_t *);
788 #endif                                            1043 #endif
789 };                                                1044 };
790                                                   1045 
791 #define to_ide_driver(drv) container_of(drv, i !! 1046 #define to_ide_driver(drv) container_of(drv, struct ide_driver, gen_driver)
792                                                   1047 
793 int generic_ide_ioctl(ide_drive_t *, struct fi !! 1048 int ide_device_get(ide_drive_t *);
                                                   >> 1049 void ide_device_put(ide_drive_t *);
794                                                   1050 
795 /*                                             !! 1051 struct ide_ioctl_devset {
796  * ide_hwifs[] is the master data structure us !! 1052         unsigned int    get_ioctl;
797  * of just about everything in ide.c.  Wheneve !! 1053         unsigned int    set_ioctl;
798  * should be using pointers to a drive (ide_dr !! 1054         const struct ide_devset *setting;
799  * pointers to a hwif (ide_hwif_t *), rather t !! 1055 };
800  * structure directly (the allocation/layout m !! 1056 
801  *                                             !! 1057 int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int,
802  */                                            !! 1058                       unsigned long, const struct ide_ioctl_devset *);
803 #ifndef _IDE_C                                 << 
804 extern  ide_hwif_t      ide_hwifs[];           << 
805 #endif                                         << 
806 extern int noautodma;                          << 
807                                                   1059 
808 extern int ide_end_request (ide_drive_t *drive !! 1060 int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned long);
809 int ide_end_dequeued_request(ide_drive_t *driv << 
810                              int uptodate, int << 
811                                                   1061 
812 extern void ide_set_handler (ide_drive_t *driv !! 1062 extern int ide_vlb_clk;
                                                   >> 1063 extern int ide_pci_clk;
813                                                   1064 
814 void ide_execute_command(ide_drive_t *, u8, id !! 1065 int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int);
815                          ide_expiry_t *);      !! 1066 void ide_kill_rq(ide_drive_t *, struct request *);
816                                                   1067 
817 ide_startstop_t __ide_error(ide_drive_t *, str !! 1068 void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
                                                   >> 1069 void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
818                                                   1070 
819 ide_startstop_t ide_error (ide_drive_t *drive, !! 1071 void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *,
                                                   >> 1072                          unsigned int);
820                                                   1073 
821 ide_startstop_t __ide_abort(ide_drive_t *, str !! 1074 void ide_pad_transfer(ide_drive_t *, int, int);
822                                                   1075 
823 extern ide_startstop_t ide_abort(ide_drive_t * !! 1076 ide_startstop_t ide_error(ide_drive_t *, const char *, u8);
824                                                   1077 
825 extern void ide_fix_driveid(struct hd_driveid  !! 1078 void ide_fix_driveid(u16 *);
826                                                   1079 
827 extern void ide_fixstring(u8 *, const int, con    1080 extern void ide_fixstring(u8 *, const int, const int);
828                                                   1081 
                                                   >> 1082 int ide_busy_sleep(ide_drive_t *, unsigned long, int);
                                                   >> 1083 
829 int ide_wait_stat(ide_startstop_t *, ide_drive    1084 int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
830                                                   1085 
                                                   >> 1086 ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *);
                                                   >> 1087 ide_startstop_t ide_do_devset(ide_drive_t *, struct request *);
                                                   >> 1088 
831 extern ide_startstop_t ide_do_reset (ide_drive    1089 extern ide_startstop_t ide_do_reset (ide_drive_t *);
832                                                   1090 
833 extern void ide_init_drive_cmd (struct request !! 1091 extern int ide_devset_execute(ide_drive_t *drive,
                                                   >> 1092                               const struct ide_devset *setting, int arg);
834                                                   1093 
835 /*                                             !! 1094 void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
836  * "action" parameter type for ide_do_drive_cm !! 1095 int ide_complete_rq(ide_drive_t *, int, unsigned int);
837  */                                            << 
838 typedef enum {                                 << 
839         ide_wait,       /* insert rq at end of << 
840         ide_preempt,    /* insert rq in front  << 
841         ide_head_wait,  /* insert rq in front  << 
842         ide_end         /* insert rq at end of << 
843 } ide_action_t;                                << 
844                                                   1096 
845 extern int ide_do_drive_cmd(ide_drive_t *, str !! 1097 void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd);
                                                   >> 1098 void ide_tf_dump(const char *, struct ide_cmd *);
846                                                   1099 
847 extern void ide_end_drive_cmd(ide_drive_t *, u !! 1100 void ide_exec_command(ide_hwif_t *, u8);
                                                   >> 1101 u8 ide_read_status(ide_hwif_t *);
                                                   >> 1102 u8 ide_read_altstatus(ide_hwif_t *);
                                                   >> 1103 void ide_write_devctl(ide_hwif_t *, u8);
848                                                   1104 
849 enum {                                         !! 1105 void ide_dev_select(ide_drive_t *);
850         IDE_TFLAG_LBA48                 = (1 < !! 1106 void ide_tf_load(ide_drive_t *, struct ide_taskfile *, u8);
851         IDE_TFLAG_NO_SELECT_MASK        = (1 < !! 1107 void ide_tf_read(ide_drive_t *, struct ide_taskfile *, u8);
852         IDE_TFLAG_FLAGGED               = (1 < << 
853         IDE_TFLAG_OUT_DATA              = (1 < << 
854         IDE_TFLAG_OUT_HOB_FEATURE       = (1 < << 
855         IDE_TFLAG_OUT_HOB_NSECT         = (1 < << 
856         IDE_TFLAG_OUT_HOB_LBAL          = (1 < << 
857         IDE_TFLAG_OUT_HOB_LBAM          = (1 < << 
858         IDE_TFLAG_OUT_HOB_LBAH          = (1 < << 
859         IDE_TFLAG_OUT_HOB               = IDE_ << 
860                                           IDE_ << 
861                                           IDE_ << 
862                                           IDE_ << 
863                                           IDE_ << 
864         IDE_TFLAG_OUT_FEATURE           = (1 < << 
865         IDE_TFLAG_OUT_NSECT             = (1 < << 
866         IDE_TFLAG_OUT_LBAL              = (1 < << 
867         IDE_TFLAG_OUT_LBAM              = (1 < << 
868         IDE_TFLAG_OUT_LBAH              = (1 < << 
869         IDE_TFLAG_OUT_TF                = IDE_ << 
870                                           IDE_ << 
871                                           IDE_ << 
872                                           IDE_ << 
873                                           IDE_ << 
874         IDE_TFLAG_OUT_DEVICE            = (1 < << 
875         IDE_TFLAG_WRITE                 = (1 < << 
876         IDE_TFLAG_FLAGGED_SET_IN_FLAGS  = (1 < << 
877         IDE_TFLAG_IN_DATA               = (1 < << 
878         IDE_TFLAG_CUSTOM_HANDLER        = (1 < << 
879         IDE_TFLAG_DMA_PIO_FALLBACK      = (1 < << 
880         IDE_TFLAG_IN_HOB_FEATURE        = (1 < << 
881         IDE_TFLAG_IN_HOB_NSECT          = (1 < << 
882         IDE_TFLAG_IN_HOB_LBAL           = (1 < << 
883         IDE_TFLAG_IN_HOB_LBAM           = (1 < << 
884         IDE_TFLAG_IN_HOB_LBAH           = (1 < << 
885         IDE_TFLAG_IN_HOB_LBA            = IDE_ << 
886                                           IDE_ << 
887                                           IDE_ << 
888         IDE_TFLAG_IN_HOB                = IDE_ << 
889                                           IDE_ << 
890                                           IDE_ << 
891         IDE_TFLAG_IN_NSECT              = (1 < << 
892         IDE_TFLAG_IN_LBAL               = (1 < << 
893         IDE_TFLAG_IN_LBAM               = (1 < << 
894         IDE_TFLAG_IN_LBAH               = (1 < << 
895         IDE_TFLAG_IN_LBA                = IDE_ << 
896                                           IDE_ << 
897                                           IDE_ << 
898         IDE_TFLAG_IN_TF                 = IDE_ << 
899                                           IDE_ << 
900         IDE_TFLAG_IN_DEVICE             = (1 < << 
901         IDE_TFLAG_HOB                   = IDE_ << 
902                                           IDE_ << 
903         IDE_TFLAG_TF                    = IDE_ << 
904                                           IDE_ << 
905         IDE_TFLAG_DEVICE                = IDE_ << 
906                                           IDE_ << 
907         /* force 16-bit I/O operations */      << 
908         IDE_TFLAG_IO_16BIT              = (1 < << 
909         /* ide_task_t was allocated using kmal << 
910         IDE_TFLAG_DYN                   = (1 < << 
911 };                                             << 
912                                                   1108 
913 struct ide_taskfile {                          !! 1109 void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
914         u8      hob_data;       /*  0: high da !! 1110 void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
915                                                   1111 
916         u8      hob_feature;    /*  1-5: addit !! 1112 void SELECT_MASK(ide_drive_t *, int);
917         u8      hob_nsect;                     << 
918         u8      hob_lbal;                      << 
919         u8      hob_lbam;                      << 
920         u8      hob_lbah;                      << 
921                                                << 
922         u8      data;           /*  6: low dat << 
923                                                << 
924         union {                 /*  7: */     << 
925                 u8 error;       /*   read:  er << 
926                 u8 feature;     /*  write: fea << 
927         };                                     << 
928                                                   1113 
929         u8      nsect;          /*  8: number  !! 1114 u8 ide_read_error(ide_drive_t *);
930         u8      lbal;           /*  9: LBA low !! 1115 void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
931         u8      lbam;           /* 10: LBA mid << 
932         u8      lbah;           /* 11: LBA hig << 
933                                                   1116 
934         u8      device;         /* 12: device  !! 1117 int ide_check_ireason(ide_drive_t *, struct request *, int, int, int);
935                                                   1118 
936         union {                 /* 13: */      !! 1119 int ide_check_atapi_device(ide_drive_t *, const char *);
937                 u8 status;      /*  read: sta !! 1120 
938                 u8 command;     /* write: comm !! 1121 void ide_init_pc(struct ide_atapi_pc *);
939         };                                     !! 1122 
                                                   >> 1123 /* Disk head parking */
                                                   >> 1124 extern wait_queue_head_t ide_park_wq;
                                                   >> 1125 ssize_t ide_park_show(struct device *dev, struct device_attribute *attr,
                                                   >> 1126                       char *buf);
                                                   >> 1127 ssize_t ide_park_store(struct device *dev, struct device_attribute *attr,
                                                   >> 1128                        const char *buf, size_t len);
                                                   >> 1129 
                                                   >> 1130 /*
                                                   >> 1131  * Special requests for ide-tape block device strategy routine.
                                                   >> 1132  *
                                                   >> 1133  * In order to service a character device command, we add special requests to
                                                   >> 1134  * the tail of our block device request queue and wait for their completion.
                                                   >> 1135  */
                                                   >> 1136 enum {
                                                   >> 1137         REQ_IDETAPE_PC1         = (1 << 0), /* packet command (first stage) */
                                                   >> 1138         REQ_IDETAPE_PC2         = (1 << 1), /* packet command (second stage) */
                                                   >> 1139         REQ_IDETAPE_READ        = (1 << 2),
                                                   >> 1140         REQ_IDETAPE_WRITE       = (1 << 3),
940 };                                                1141 };
941                                                   1142 
942 typedef struct ide_task_s {                    !! 1143 int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
943         union {                                !! 1144                       void *, unsigned int);
944                 struct ide_taskfile     tf;    !! 1145 
945                 u8                      tf_arr !! 1146 int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
946         };                                     !! 1147 int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
947         u32                     tf_flags;      !! 1148 int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
948         int                     data_phase;    !! 1149 void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *);
949         struct request          *rq;           !! 1150 void ide_retry_pc(ide_drive_t *drive);
950         void                    *special;      << 
951 } ide_task_t;                                  << 
952                                                   1151 
953 void ide_tf_load(ide_drive_t *, ide_task_t *); !! 1152 void ide_prep_sense(ide_drive_t *drive, struct request *rq);
954 void ide_tf_read(ide_drive_t *, ide_task_t *); !! 1153 int ide_queue_sense_rq(ide_drive_t *drive, void *special);
955                                                   1154 
956 extern void SELECT_DRIVE(ide_drive_t *);       !! 1155 int ide_cd_expiry(ide_drive_t *);
957 extern void SELECT_MASK(ide_drive_t *, int);   << 
958                                                   1156 
959 extern int drive_is_ready(ide_drive_t *);      !! 1157 int ide_cd_get_xferlen(struct request *);
960                                                   1158 
961 void ide_pktcmd_tf_load(ide_drive_t *, u32, u1 !! 1159 ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *);
962                                                   1160 
963 ide_startstop_t do_rw_taskfile(ide_drive_t *,  !! 1161 ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *);
964                                                   1162 
965 void task_end_request(ide_drive_t *, struct re !! 1163 void ide_pio_bytes(ide_drive_t *, struct ide_cmd *, unsigned int, unsigned int);
966                                                   1164 
967 int ide_raw_taskfile(ide_drive_t *, ide_task_t !! 1165 void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8);
968 int ide_no_data_taskfile(ide_drive_t *, ide_ta << 
969                                                   1166 
970 int ide_taskfile_ioctl(ide_drive_t *, unsigned !! 1167 int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16);
971 int ide_cmd_ioctl(ide_drive_t *, unsigned int, !! 1168 int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
972 int ide_task_ioctl(ide_drive_t *, unsigned int << 
973                                                   1169 
974 extern int system_bus_clock(void);             !! 1170 int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
                                                   >> 1171 
                                                   >> 1172 int ide_dev_read_id(ide_drive_t *, u8, u16 *);
975                                                   1173 
976 extern int ide_driveid_update(ide_drive_t *);     1174 extern int ide_driveid_update(ide_drive_t *);
977 extern int ide_config_drive_speed(ide_drive_t     1175 extern int ide_config_drive_speed(ide_drive_t *, u8);
978 extern u8 eighty_ninty_three (ide_drive_t *);     1176 extern u8 eighty_ninty_three (ide_drive_t *);
979 extern int taskfile_lib_get_identify(ide_drive    1177 extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
980                                                   1178 
981 extern int ide_wait_not_busy(ide_hwif_t *hwif,    1179 extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
982                                                   1180 
983 extern void ide_stall_queue(ide_drive_t *drive    1181 extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
984                                                   1182 
985 extern int ide_spin_wait_hwgroup(ide_drive_t * << 
986 extern void ide_timer_expiry(unsigned long);      1183 extern void ide_timer_expiry(unsigned long);
987 extern irqreturn_t ide_intr(int irq, void *dev    1184 extern irqreturn_t ide_intr(int irq, void *dev_id);
988 extern void do_ide_request(struct request_queu    1185 extern void do_ide_request(struct request_queue *);
989                                                   1186 
990 void ide_init_disk(struct gendisk *, ide_drive    1187 void ide_init_disk(struct gendisk *, ide_drive_t *);
991                                                   1188 
992 #ifdef CONFIG_IDEPCI_PCIBUS_ORDER                 1189 #ifdef CONFIG_IDEPCI_PCIBUS_ORDER
993 extern int ide_scan_direction;                 << 
994 extern int __ide_pci_register_driver(struct pc    1190 extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
995 #define ide_pci_register_driver(d) __ide_pci_r    1191 #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
996 #else                                             1192 #else
997 #define ide_pci_register_driver(d) pci_registe    1193 #define ide_pci_register_driver(d) pci_register_driver(d)
998 #endif                                            1194 #endif
999                                                   1195 
1000 void ide_pci_setup_ports(struct pci_dev *, co !! 1196 static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
                                                   >> 1197 {
                                                   >> 1198         if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 5) != 5)
                                                   >> 1199                 return 1;
                                                   >> 1200         return 0;
                                                   >> 1201 }
                                                   >> 1202 
                                                   >> 1203 void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *,
                                                   >> 1204                          struct ide_hw *, struct ide_hw **);
1001 void ide_setup_pci_noise(struct pci_dev *, co    1205 void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1002                                                  1206 
1003 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI                 1207 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1004 void ide_hwif_setup_dma(ide_hwif_t *, const s !! 1208 int ide_pci_set_master(struct pci_dev *, const char *);
                                                   >> 1209 unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *);
                                                   >> 1210 int ide_pci_check_simplex(ide_hwif_t *, const struct ide_port_info *);
                                                   >> 1211 int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1005 #else                                            1212 #else
1006 static inline void ide_hwif_setup_dma(ide_hwi !! 1213 static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
1007                                       const s !! 1214                                      const struct ide_port_info *d)
                                                   >> 1215 {
                                                   >> 1216         return -EINVAL;
                                                   >> 1217 }
1008 #endif                                           1218 #endif
1009                                                  1219 
1010 extern void default_hwif_iops(ide_hwif_t *);  !! 1220 struct ide_pci_enablebit {
1011 extern void default_hwif_mmiops(ide_hwif_t *) << 
1012 extern void default_hwif_transport(ide_hwif_t << 
1013                                               << 
1014 typedef struct ide_pci_enablebit_s {          << 
1015         u8      reg;    /* byte pci reg holdi    1221         u8      reg;    /* byte pci reg holding the enable-bit */
1016         u8      mask;   /* mask to isolate th    1222         u8      mask;   /* mask to isolate the enable-bit */
1017         u8      val;    /* value of masked re    1223         u8      val;    /* value of masked reg when "enabled" */
1018 } ide_pci_enablebit_t;                        !! 1224 };
1019                                                  1225 
1020 enum {                                           1226 enum {
1021         /* Uses ISA control ports not PCI one    1227         /* Uses ISA control ports not PCI ones. */
1022         IDE_HFLAG_ISA_PORTS             = (1     1228         IDE_HFLAG_ISA_PORTS             = (1 << 0),
1023         /* single port device */                 1229         /* single port device */
1024         IDE_HFLAG_SINGLE                = (1     1230         IDE_HFLAG_SINGLE                = (1 << 1),
1025         /* don't use legacy PIO blacklist */     1231         /* don't use legacy PIO blacklist */
1026         IDE_HFLAG_PIO_NO_BLACKLIST      = (1     1232         IDE_HFLAG_PIO_NO_BLACKLIST      = (1 << 2),
1027         /* don't use conservative PIO "downgr !! 1233         /* set for the second port of QD65xx */
1028         IDE_HFLAG_PIO_NO_DOWNGRADE      = (1  !! 1234         IDE_HFLAG_QD_2ND_PORT           = (1 << 3),
1029         /* use PIO8/9 for prefetch off/on */     1235         /* use PIO8/9 for prefetch off/on */
1030         IDE_HFLAG_ABUSE_PREFETCH        = (1     1236         IDE_HFLAG_ABUSE_PREFETCH        = (1 << 4),
1031         /* use PIO6/7 for fast-devsel off/on     1237         /* use PIO6/7 for fast-devsel off/on */
1032         IDE_HFLAG_ABUSE_FAST_DEVSEL     = (1     1238         IDE_HFLAG_ABUSE_FAST_DEVSEL     = (1 << 5),
1033         /* use 100-102 and 200-202 PIO values    1239         /* use 100-102 and 200-202 PIO values to set DMA modes */
1034         IDE_HFLAG_ABUSE_DMA_MODES       = (1     1240         IDE_HFLAG_ABUSE_DMA_MODES       = (1 << 6),
1035         /*                                       1241         /*
1036          * keep DMA setting when programming     1242          * keep DMA setting when programming PIO mode, may be used only
1037          * for hosts which have separate PIO     1243          * for hosts which have separate PIO and DMA timings (ie. PMAC)
1038          */                                      1244          */
1039         IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1     1245         IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1 << 7),
1040         /* program host for the transfer mode    1246         /* program host for the transfer mode after programming device */
1041         IDE_HFLAG_POST_SET_MODE         = (1     1247         IDE_HFLAG_POST_SET_MODE         = (1 << 8),
1042         /* don't program host/device for the     1248         /* don't program host/device for the transfer mode ("smart" hosts) */
1043         IDE_HFLAG_NO_SET_MODE           = (1     1249         IDE_HFLAG_NO_SET_MODE           = (1 << 9),
1044         /* trust BIOS for programming chipset    1250         /* trust BIOS for programming chipset/device for DMA */
1045         IDE_HFLAG_TRUST_BIOS_FOR_DMA    = (1     1251         IDE_HFLAG_TRUST_BIOS_FOR_DMA    = (1 << 10),
1046         /* host uses VDMA (tied with IDE_HFLA !! 1252         /* host is CS5510/CS5520 */
1047         IDE_HFLAG_VDMA                  = (1  !! 1253         IDE_HFLAG_CS5520                = (1 << 11),
1048         /* ATAPI DMA is unsupported */           1254         /* ATAPI DMA is unsupported */
1049         IDE_HFLAG_NO_ATAPI_DMA          = (1     1255         IDE_HFLAG_NO_ATAPI_DMA          = (1 << 12),
1050         /* set if host is a "bootable" contro !! 1256         /* set if host is a "non-bootable" controller */
1051         IDE_HFLAG_BOOTABLE              = (1  !! 1257         IDE_HFLAG_NON_BOOTABLE          = (1 << 13),
1052         /* host doesn't support DMA */           1258         /* host doesn't support DMA */
1053         IDE_HFLAG_NO_DMA                = (1     1259         IDE_HFLAG_NO_DMA                = (1 << 14),
1054         /* check if host is PCI IDE device be    1260         /* check if host is PCI IDE device before allowing DMA */
1055         IDE_HFLAG_NO_AUTODMA            = (1     1261         IDE_HFLAG_NO_AUTODMA            = (1 << 15),
1056         /* don't autotune PIO */              !! 1262         /* host uses MMIO */
1057         IDE_HFLAG_NO_AUTOTUNE           = (1  !! 1263         IDE_HFLAG_MMIO                  = (1 << 16),
1058         /* host is CS5510/CS5520 */           << 
1059         IDE_HFLAG_CS5520                = IDE << 
1060         /* no LBA48 */                           1264         /* no LBA48 */
1061         IDE_HFLAG_NO_LBA48              = (1     1265         IDE_HFLAG_NO_LBA48              = (1 << 17),
1062         /* no LBA48 DMA */                       1266         /* no LBA48 DMA */
1063         IDE_HFLAG_NO_LBA48_DMA          = (1     1267         IDE_HFLAG_NO_LBA48_DMA          = (1 << 18),
1064         /* data FIFO is cleared by an error *    1268         /* data FIFO is cleared by an error */
1065         IDE_HFLAG_ERROR_STOPS_FIFO      = (1     1269         IDE_HFLAG_ERROR_STOPS_FIFO      = (1 << 19),
1066         /* serialize ports */                    1270         /* serialize ports */
1067         IDE_HFLAG_SERIALIZE             = (1     1271         IDE_HFLAG_SERIALIZE             = (1 << 20),
1068         /* use legacy IRQs */                 !! 1272         /* host is DTC2278 */
1069         IDE_HFLAG_LEGACY_IRQS           = (1  !! 1273         IDE_HFLAG_DTC2278               = (1 << 21),
1070         /* force use of legacy IRQs */        !! 1274         /* 4 devices on a single set of I/O ports */
1071         IDE_HFLAG_FORCE_LEGACY_IRQS     = (1  !! 1275         IDE_HFLAG_4DRIVES               = (1 << 22),
1072         /* limit LBA48 requests to 256 sector !! 1276         /* host is TRM290 */
1073         IDE_HFLAG_RQSIZE_256            = (1  !! 1277         IDE_HFLAG_TRM290                = (1 << 23),
1074         /* use 32-bit I/O ops */                 1278         /* use 32-bit I/O ops */
1075         IDE_HFLAG_IO_32BIT              = (1     1279         IDE_HFLAG_IO_32BIT              = (1 << 24),
1076         /* unmask IRQs */                        1280         /* unmask IRQs */
1077         IDE_HFLAG_UNMASK_IRQS           = (1     1281         IDE_HFLAG_UNMASK_IRQS           = (1 << 25),
1078         IDE_HFLAG_ABUSE_SET_DMA_MODE    = (1  !! 1282         IDE_HFLAG_BROKEN_ALTSTATUS      = (1 << 26),
1079         /* host is CY82C693 */                !! 1283         /* serialize ports if DMA is possible (for sl82c105) */
1080         IDE_HFLAG_CY82C693              = (1  !! 1284         IDE_HFLAG_SERIALIZE_DMA         = (1 << 27),
1081         /* force host out of "simplex" mode *    1285         /* force host out of "simplex" mode */
1082         IDE_HFLAG_CLEAR_SIMPLEX         = (1     1286         IDE_HFLAG_CLEAR_SIMPLEX         = (1 << 28),
1083         /* DSC overlap is unsupported */         1287         /* DSC overlap is unsupported */
1084         IDE_HFLAG_NO_DSC                = (1     1288         IDE_HFLAG_NO_DSC                = (1 << 29),
1085         /* never use 32-bit I/O ops */           1289         /* never use 32-bit I/O ops */
1086         IDE_HFLAG_NO_IO_32BIT           = (1     1290         IDE_HFLAG_NO_IO_32BIT           = (1 << 30),
1087         /* never unmask IRQs */                  1291         /* never unmask IRQs */
1088         IDE_HFLAG_NO_UNMASK_IRQS        = (1     1292         IDE_HFLAG_NO_UNMASK_IRQS        = (1 << 31),
1089 };                                               1293 };
1090                                                  1294 
1091 #ifdef CONFIG_BLK_DEV_OFFBOARD                   1295 #ifdef CONFIG_BLK_DEV_OFFBOARD
1092 # define IDE_HFLAG_OFF_BOARD    IDE_HFLAG_BOO << 
1093 #else                                         << 
1094 # define IDE_HFLAG_OFF_BOARD    0                1296 # define IDE_HFLAG_OFF_BOARD    0
                                                   >> 1297 #else
                                                   >> 1298 # define IDE_HFLAG_OFF_BOARD    IDE_HFLAG_NON_BOOTABLE
1095 #endif                                           1299 #endif
1096                                                  1300 
1097 struct ide_port_info {                           1301 struct ide_port_info {
1098         char                    *name;           1302         char                    *name;
1099         unsigned int            (*init_chipse !! 1303 
                                                   >> 1304         int                     (*init_chipset)(struct pci_dev *);
                                                   >> 1305 
                                                   >> 1306         void                    (*get_lock)(irq_handler_t, void *);
                                                   >> 1307         void                    (*release_lock)(void);
                                                   >> 1308 
1100         void                    (*init_iops)(    1309         void                    (*init_iops)(ide_hwif_t *);
1101         void                    (*init_hwif)(    1310         void                    (*init_hwif)(ide_hwif_t *);
1102         void                    (*init_dma)(i !! 1311         int                     (*init_dma)(ide_hwif_t *,
1103         ide_pci_enablebit_t     enablebits[2] !! 1312                                             const struct ide_port_info *);
                                                   >> 1313 
                                                   >> 1314         const struct ide_tp_ops         *tp_ops;
                                                   >> 1315         const struct ide_port_ops       *port_ops;
                                                   >> 1316         const struct ide_dma_ops        *dma_ops;
                                                   >> 1317 
                                                   >> 1318         struct ide_pci_enablebit        enablebits[2];
                                                   >> 1319 
1104         hwif_chipset_t          chipset;         1320         hwif_chipset_t          chipset;
1105         u8                      extra;        !! 1321 
                                                   >> 1322         u16                     max_sectors;    /* if < than the default one */
                                                   >> 1323 
1106         u32                     host_flags;      1324         u32                     host_flags;
                                                   >> 1325 
                                                   >> 1326         int                     irq_flags;
                                                   >> 1327 
1107         u8                      pio_mask;        1328         u8                      pio_mask;
1108         u8                      swdma_mask;      1329         u8                      swdma_mask;
1109         u8                      mwdma_mask;      1330         u8                      mwdma_mask;
1110         u8                      udma_mask;       1331         u8                      udma_mask;
1111 };                                               1332 };
1112                                                  1333 
1113 int ide_setup_pci_device(struct pci_dev *, co !! 1334 int ide_pci_init_one(struct pci_dev *, const struct ide_port_info *, void *);
1114 int ide_setup_pci_devices(struct pci_dev *, s !! 1335 int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
                                                   >> 1336                      const struct ide_port_info *, void *);
                                                   >> 1337 void ide_pci_remove(struct pci_dev *);
                                                   >> 1338 
                                                   >> 1339 #ifdef CONFIG_PM
                                                   >> 1340 int ide_pci_suspend(struct pci_dev *, pm_message_t);
                                                   >> 1341 int ide_pci_resume(struct pci_dev *);
                                                   >> 1342 #else
                                                   >> 1343 #define ide_pci_suspend NULL
                                                   >> 1344 #define ide_pci_resume NULL
                                                   >> 1345 #endif
1115                                                  1346 
1116 void ide_map_sg(ide_drive_t *, struct request !! 1347 void ide_map_sg(ide_drive_t *, struct ide_cmd *);
1117 void ide_init_sg_cmd(ide_drive_t *, struct re !! 1348 void ide_init_sg_cmd(struct ide_cmd *, unsigned int);
1118                                                  1349 
1119 #define BAD_DMA_DRIVE           0                1350 #define BAD_DMA_DRIVE           0
1120 #define GOOD_DMA_DRIVE          1                1351 #define GOOD_DMA_DRIVE          1
1121                                                  1352 
1122 struct drive_list_entry {                        1353 struct drive_list_entry {
1123         const char *id_model;                    1354         const char *id_model;
1124         const char *id_firmware;                 1355         const char *id_firmware;
1125 };                                               1356 };
1126                                                  1357 
1127 int ide_in_drive_list(struct hd_driveid *, co !! 1358 int ide_in_drive_list(u16 *, const struct drive_list_entry *);
1128                                                  1359 
1129 #ifdef CONFIG_BLK_DEV_IDEDMA                     1360 #ifdef CONFIG_BLK_DEV_IDEDMA
                                                   >> 1361 int ide_dma_good_drive(ide_drive_t *);
1130 int __ide_dma_bad_drive(ide_drive_t *);          1362 int __ide_dma_bad_drive(ide_drive_t *);
1131 int ide_id_dma_bug(ide_drive_t *);            << 
1132                                                  1363 
1133 u8 ide_find_dma_mode(ide_drive_t *, u8);         1364 u8 ide_find_dma_mode(ide_drive_t *, u8);
1134                                                  1365 
1135 static inline u8 ide_max_dma_mode(ide_drive_t    1366 static inline u8 ide_max_dma_mode(ide_drive_t *drive)
1136 {                                                1367 {
1137         return ide_find_dma_mode(drive, XFER_    1368         return ide_find_dma_mode(drive, XFER_UDMA_6);
1138 }                                                1369 }
1139                                                  1370 
1140 void ide_dma_off_quietly(ide_drive_t *);         1371 void ide_dma_off_quietly(ide_drive_t *);
1141 void ide_dma_off(ide_drive_t *);                 1372 void ide_dma_off(ide_drive_t *);
1142 void ide_dma_on(ide_drive_t *);                  1373 void ide_dma_on(ide_drive_t *);
1143 int ide_set_dma(ide_drive_t *);                  1374 int ide_set_dma(ide_drive_t *);
1144 void ide_check_dma_crc(ide_drive_t *);           1375 void ide_check_dma_crc(ide_drive_t *);
1145 ide_startstop_t ide_dma_intr(ide_drive_t *);     1376 ide_startstop_t ide_dma_intr(ide_drive_t *);
1146                                                  1377 
1147 int ide_build_sglist(ide_drive_t *, struct re !! 1378 int ide_allocate_dma_engine(ide_hwif_t *);
1148 void ide_destroy_dmatable(ide_drive_t *);     !! 1379 void ide_release_dma_engine(ide_hwif_t *);
1149                                                  1380 
1150 #ifdef CONFIG_BLK_DEV_IDEDMA_SFF              !! 1381 int ide_dma_prepare(ide_drive_t *, struct ide_cmd *);
1151 extern int ide_build_dmatable(ide_drive_t *,  !! 1382 void ide_dma_unmap_sg(ide_drive_t *, struct ide_cmd *);
1152 extern int ide_release_dma(ide_hwif_t *);     << 
1153 extern void ide_setup_dma(ide_hwif_t *, unsig << 
1154                                                  1383 
                                                   >> 1384 #ifdef CONFIG_BLK_DEV_IDEDMA_SFF
                                                   >> 1385 int config_drive_for_dma(ide_drive_t *);
                                                   >> 1386 int ide_build_dmatable(ide_drive_t *, struct ide_cmd *);
1155 void ide_dma_host_set(ide_drive_t *, int);       1387 void ide_dma_host_set(ide_drive_t *, int);
1156 extern int ide_dma_setup(ide_drive_t *);      !! 1388 int ide_dma_setup(ide_drive_t *, struct ide_cmd *);
1157 extern void ide_dma_start(ide_drive_t *);        1389 extern void ide_dma_start(ide_drive_t *);
1158 extern int __ide_dma_end(ide_drive_t *);      !! 1390 int ide_dma_end(ide_drive_t *);
1159 extern void ide_dma_lost_irq(ide_drive_t *);  !! 1391 int ide_dma_test_irq(ide_drive_t *);
1160 extern void ide_dma_timeout(ide_drive_t *);   !! 1392 int ide_dma_sff_timer_expiry(ide_drive_t *);
                                                   >> 1393 u8 ide_dma_sff_read_status(ide_hwif_t *);
                                                   >> 1394 extern const struct ide_dma_ops sff_dma_ops;
                                                   >> 1395 #else
                                                   >> 1396 static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
1161 #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */           1397 #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
1162                                                  1398 
                                                   >> 1399 void ide_dma_lost_irq(ide_drive_t *);
                                                   >> 1400 ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
                                                   >> 1401 
1163 #else                                            1402 #else
1164 static inline int ide_id_dma_bug(ide_drive_t  << 
1165 static inline u8 ide_find_dma_mode(ide_drive_    1403 static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1166 static inline u8 ide_max_dma_mode(ide_drive_t    1404 static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1167 static inline void ide_dma_off_quietly(ide_dr    1405 static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
1168 static inline void ide_dma_off(ide_drive_t *d    1406 static inline void ide_dma_off(ide_drive_t *drive) { ; }
1169 static inline void ide_dma_on(ide_drive_t *dr    1407 static inline void ide_dma_on(ide_drive_t *drive) { ; }
1170 static inline void ide_dma_verbose(ide_drive_    1408 static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1171 static inline int ide_set_dma(ide_drive_t *dr    1409 static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1172 static inline void ide_check_dma_crc(ide_driv    1410 static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
                                                   >> 1411 static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; }
                                                   >> 1412 static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; }
                                                   >> 1413 static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
                                                   >> 1414 static inline int ide_dma_prepare(ide_drive_t *drive,
                                                   >> 1415                                   struct ide_cmd *cmd) { return 1; }
                                                   >> 1416 static inline void ide_dma_unmap_sg(ide_drive_t *drive,
                                                   >> 1417                                     struct ide_cmd *cmd) { ; }
1173 #endif /* CONFIG_BLK_DEV_IDEDMA */               1418 #endif /* CONFIG_BLK_DEV_IDEDMA */
1174                                                  1419 
1175 #ifndef CONFIG_BLK_DEV_IDEDMA_SFF             << 
1176 static inline void ide_release_dma(ide_hwif_t << 
1177 #endif                                        << 
1178                                               << 
1179 #ifdef CONFIG_BLK_DEV_IDEACPI                    1420 #ifdef CONFIG_BLK_DEV_IDEACPI
                                                   >> 1421 int ide_acpi_init(void);
                                                   >> 1422 bool ide_port_acpi(ide_hwif_t *hwif);
1180 extern int ide_acpi_exec_tfs(ide_drive_t *dri    1423 extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1181 extern void ide_acpi_get_timing(ide_hwif_t *h    1424 extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1182 extern void ide_acpi_push_timing(ide_hwif_t *    1425 extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1183 extern void ide_acpi_init(ide_hwif_t *hwif);  !! 1426 void ide_acpi_init_port(ide_hwif_t *);
1184 void ide_acpi_port_init_devices(ide_hwif_t *)    1427 void ide_acpi_port_init_devices(ide_hwif_t *);
1185 extern void ide_acpi_set_state(ide_hwif_t *hw    1428 extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1186 #else                                            1429 #else
                                                   >> 1430 static inline int ide_acpi_init(void) { return 0; }
                                                   >> 1431 static inline bool ide_port_acpi(ide_hwif_t *hwif) { return 0; }
1187 static inline int ide_acpi_exec_tfs(ide_drive    1432 static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1188 static inline void ide_acpi_get_timing(ide_hw    1433 static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1189 static inline void ide_acpi_push_timing(ide_h    1434 static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1190 static inline void ide_acpi_init(ide_hwif_t * !! 1435 static inline void ide_acpi_init_port(ide_hwif_t *hwif) { ; }
1191 static inline void ide_acpi_port_init_devices    1436 static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1192 static inline void ide_acpi_set_state(ide_hwi    1437 static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1193 #endif                                           1438 #endif
1194                                                  1439 
1195 void ide_remove_port_from_hwgroup(ide_hwif_t  << 
1196 extern int ide_hwif_request_regions(ide_hwif_ << 
1197 extern void ide_hwif_release_regions(ide_hwif << 
1198 void ide_unregister(unsigned int, int, int);  << 
1199                                               << 
1200 void ide_register_region(struct gendisk *);      1440 void ide_register_region(struct gendisk *);
1201 void ide_unregister_region(struct gendisk *);    1441 void ide_unregister_region(struct gendisk *);
1202                                                  1442 
                                                   >> 1443 void ide_check_nien_quirk_list(ide_drive_t *);
1203 void ide_undecoded_slave(ide_drive_t *);         1444 void ide_undecoded_slave(ide_drive_t *);
1204                                                  1445 
1205 int ide_device_add_all(u8 *idx, const struct  !! 1446 void ide_port_apply_params(ide_hwif_t *);
1206 int ide_device_add(u8 idx[4], const struct id !! 1447 int ide_sysfs_register_port(ide_hwif_t *);
                                                   >> 1448 
                                                   >> 1449 struct ide_host *ide_host_alloc(const struct ide_port_info *, struct ide_hw **,
                                                   >> 1450                                 unsigned int);
                                                   >> 1451 void ide_host_free(struct ide_host *);
                                                   >> 1452 int ide_host_register(struct ide_host *, const struct ide_port_info *,
                                                   >> 1453                       struct ide_hw **);
                                                   >> 1454 int ide_host_add(const struct ide_port_info *, struct ide_hw **, unsigned int,
                                                   >> 1455                  struct ide_host **);
                                                   >> 1456 void ide_host_remove(struct ide_host *);
                                                   >> 1457 int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
                                                   >> 1458 void ide_port_unregister_devices(ide_hwif_t *);
                                                   >> 1459 void ide_port_scan(ide_hwif_t *);
1207                                                  1460 
1208 static inline void *ide_get_hwifdata (ide_hwi    1461 static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1209 {                                                1462 {
1210         return hwif->hwif_data;                  1463         return hwif->hwif_data;
1211 }                                                1464 }
1212                                                  1465 
1213 static inline void ide_set_hwifdata (ide_hwif    1466 static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1214 {                                                1467 {
1215         hwif->hwif_data = data;                  1468         hwif->hwif_data = data;
1216 }                                                1469 }
1217                                                  1470 
1218 const char *ide_xfer_verbose(u8 mode);        << 
1219 extern void ide_toggle_bounce(ide_drive_t *dr    1471 extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1220 extern int ide_set_xfer_rate(ide_drive_t *dri << 
1221                                               << 
1222 static inline int ide_dev_has_iordy(struct hd << 
1223 {                                             << 
1224         return ((id->field_valid & 2) && (id- << 
1225 }                                             << 
1226                                               << 
1227 static inline int ide_dev_is_sata(struct hd_d << 
1228 {                                             << 
1229         /*                                    << 
1230          * See if word 93 is 0 AND drive is a << 
1231          * verifying that word 80 by casting  << 
1232          * this trick allows us to filter out << 
1233          * 0x0000 and 0xffff along with the e << 
1234          */                                   << 
1235         if (id->hw_config == 0 && (short)id-> << 
1236                 return 1;                     << 
1237         return 0;                             << 
1238 }                                             << 
1239                                                  1472 
1240 u64 ide_get_lba_addr(struct ide_taskfile *, i !! 1473 u64 ide_get_lba_addr(struct ide_cmd *, int);
1241 u8 ide_dump_status(ide_drive_t *, const char     1474 u8 ide_dump_status(ide_drive_t *, const char *, u8);
1242                                                  1475 
1243 typedef struct ide_pio_timings_s {            !! 1476 struct ide_timing {
1244         int     setup_time;     /* Address se !! 1477         u8  mode;
1245         int     active_time;    /* Active pul !! 1478         u8  setup;      /* t1 */
1246         int     cycle_time;     /* Cycle time !! 1479         u16 act8b;      /* t2 for 8-bit io */
1247                                 /* active + r !! 1480         u16 rec8b;      /* t2i for 8-bit io */
1248 } ide_pio_timings_t;                          !! 1481         u16 cyc8b;      /* t0 for 8-bit io */
                                                   >> 1482         u16 active;     /* t2 or tD */
                                                   >> 1483         u16 recover;    /* t2i or tK */
                                                   >> 1484         u16 cycle;      /* t0 */
                                                   >> 1485         u16 udma;       /* t2CYCTYP/2 */
                                                   >> 1486 };
1249                                                  1487 
1250 unsigned int ide_pio_cycle_time(ide_drive_t * !! 1488 enum {
1251 u8 ide_get_best_pio_mode(ide_drive_t *, u8, u !! 1489         IDE_TIMING_SETUP        = (1 << 0),
1252 extern const ide_pio_timings_t ide_pio_timing !! 1490         IDE_TIMING_ACT8B        = (1 << 1),
                                                   >> 1491         IDE_TIMING_REC8B        = (1 << 2),
                                                   >> 1492         IDE_TIMING_CYC8B        = (1 << 3),
                                                   >> 1493         IDE_TIMING_8BIT         = IDE_TIMING_ACT8B | IDE_TIMING_REC8B |
                                                   >> 1494                                   IDE_TIMING_CYC8B,
                                                   >> 1495         IDE_TIMING_ACTIVE       = (1 << 4),
                                                   >> 1496         IDE_TIMING_RECOVER      = (1 << 5),
                                                   >> 1497         IDE_TIMING_CYCLE        = (1 << 6),
                                                   >> 1498         IDE_TIMING_UDMA         = (1 << 7),
                                                   >> 1499         IDE_TIMING_ALL          = IDE_TIMING_SETUP | IDE_TIMING_8BIT |
                                                   >> 1500                                   IDE_TIMING_ACTIVE | IDE_TIMING_RECOVER |
                                                   >> 1501                                   IDE_TIMING_CYCLE | IDE_TIMING_UDMA,
                                                   >> 1502 };
1253                                                  1503 
                                                   >> 1504 struct ide_timing *ide_timing_find_mode(u8);
                                                   >> 1505 u16 ide_pio_cycle_time(ide_drive_t *, u8);
                                                   >> 1506 void ide_timing_merge(struct ide_timing *, struct ide_timing *,
                                                   >> 1507                       struct ide_timing *, unsigned int);
                                                   >> 1508 int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
                                                   >> 1509 
                                                   >> 1510 #ifdef CONFIG_IDE_XFER_MODE
                                                   >> 1511 int ide_scan_pio_blacklist(char *);
                                                   >> 1512 const char *ide_xfer_verbose(u8);
                                                   >> 1513 u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
                                                   >> 1514 int ide_pio_need_iordy(ide_drive_t *, const u8);
1254 int ide_set_pio_mode(ide_drive_t *, u8);         1515 int ide_set_pio_mode(ide_drive_t *, u8);
1255 int ide_set_dma_mode(ide_drive_t *, u8);         1516 int ide_set_dma_mode(ide_drive_t *, u8);
1256                                               << 
1257 void ide_set_pio(ide_drive_t *, u8);             1517 void ide_set_pio(ide_drive_t *, u8);
                                                   >> 1518 int ide_set_xfer_rate(ide_drive_t *, u8);
                                                   >> 1519 #else
                                                   >> 1520 static inline void ide_set_pio(ide_drive_t *drive, u8 pio) { ; }
                                                   >> 1521 static inline int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) { return -1; }
                                                   >> 1522 #endif
1258                                                  1523 
1259 static inline void ide_set_max_pio(ide_drive_    1524 static inline void ide_set_max_pio(ide_drive_t *drive)
1260 {                                                1525 {
1261         ide_set_pio(drive, 255);                 1526         ide_set_pio(drive, 255);
1262 }                                                1527 }
1263                                                  1528 
1264 extern spinlock_t ide_lock;                   !! 1529 char *ide_media_string(ide_drive_t *);
1265 extern struct mutex ide_cfg_mtx;              << 
1266 /*                                            << 
1267  * Structure locking:                         << 
1268  *                                            << 
1269  * ide_cfg_mtx and ide_lock together protect  << 
1270  * ide_hwif_t->{next,hwgroup}                 << 
1271  * ide_drive_t->next                          << 
1272  *                                            << 
1273  * ide_hwgroup_t->busy: ide_lock              << 
1274  * ide_hwgroup_t->hwif: ide_lock              << 
1275  * ide_hwif_t->mate: constant, no locking     << 
1276  * ide_drive_t->hwif: constant, no locking    << 
1277  */                                           << 
1278                                               << 
1279 #define local_irq_set(flags)    do { local_sa << 
1280                                                  1530 
                                                   >> 1531 extern struct device_attribute ide_dev_attrs[];
1281 extern struct bus_type ide_bus_type;             1532 extern struct bus_type ide_bus_type;
1282                                               !! 1533 extern struct class *ide_port_class;
1283 /* check if CACHE FLUSH (EXT) command is supp << 
1284 #define ide_id_has_flush_cache(id)      ((id) << 
1285                                               << 
1286 /* some Maxtor disks have bit 13 defined inco << 
1287 #define ide_id_has_flush_cache_ext(id)  \     << 
1288         (((id)->cfs_enable_2 & 0x2400) == 0x2 << 
1289                                                  1534 
1290 static inline void ide_dump_identify(u8 *id)     1535 static inline void ide_dump_identify(u8 *id)
1291 {                                                1536 {
1292         print_hex_dump(KERN_INFO, "", DUMP_PR    1537         print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0);
1293 }                                                1538 }
1294                                                  1539 
1295 static inline int hwif_to_node(ide_hwif_t *hw    1540 static inline int hwif_to_node(ide_hwif_t *hwif)
1296 {                                                1541 {
1297         struct pci_dev *dev = to_pci_dev(hwif !! 1542         return hwif->dev ? dev_to_node(hwif->dev) : -1;
1298         return hwif->dev ? pcibus_to_node(dev << 
1299 }                                                1543 }
1300                                                  1544 
1301 static inline ide_drive_t *ide_get_paired_dri !! 1545 static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1302 {                                                1546 {
1303         ide_hwif_t *hwif        = HWIF(drive) !! 1547         ide_drive_t *peer = drive->hwif->devices[(drive->dn ^ 1) & 1];
1304                                                  1548 
1305         return &hwif->drives[(drive->dn ^ 1)  !! 1549         return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1306 }                                                1550 }
1307                                                  1551 
1308 static inline void ide_set_irq(ide_drive_t *d !! 1552 static inline void *ide_get_drivedata(ide_drive_t *drive)
1309 {                                                1553 {
1310         drive->hwif->OUTB(drive->ctl | (on ?  !! 1554         return drive->drive_data;
1311 }                                                1555 }
1312                                                  1556 
1313 static inline u8 ide_read_status(ide_drive_t  !! 1557 static inline void ide_set_drivedata(ide_drive_t *drive, void *data)
1314 {                                                1558 {
1315         ide_hwif_t *hwif = drive->hwif;       !! 1559         drive->drive_data = data;
1316                                               << 
1317         return hwif->INB(hwif->io_ports[IDE_S << 
1318 }                                                1560 }
1319                                                  1561 
1320 static inline u8 ide_read_altstatus(ide_drive !! 1562 #define ide_port_for_each_dev(i, dev, port) \
1321 {                                             !! 1563         for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1322         ide_hwif_t *hwif = drive->hwif;       << 
1323                                                  1564 
1324         return hwif->INB(hwif->io_ports[IDE_C !! 1565 #define ide_port_for_each_present_dev(i, dev, port) \
1325 }                                             !! 1566         for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) \
                                                   >> 1567                 if ((dev)->dev_flags & IDE_DFLAG_PRESENT)
1326                                                  1568 
1327 static inline u8 ide_read_error(ide_drive_t * !! 1569 #define ide_host_for_each_port(i, port, host) \
1328 {                                             !! 1570         for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++)
1329         ide_hwif_t *hwif = drive->hwif;       << 
1330                                               << 
1331         return hwif->INB(hwif->io_ports[IDE_E << 
1332 }                                             << 
1333                                                  1571 
1334 #endif /* _IDE_H */                              1572 #endif /* _IDE_H */
1335                                                  1573 
  This page was automatically generated by the LXR engine.