diff options
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r-- | include/linux/ide.h | 361 |
1 files changed, 225 insertions, 136 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index b846bc44a27e..a9d82d6e6bdd 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -8,7 +8,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> |
@@ -17,6 +17,7 @@ | |||
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 |
@@ -87,12 +88,13 @@ struct ide_io_ports { | |||
87 | }; | 88 | }; |
88 | 89 | ||
89 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) | 90 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) |
90 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) | ||
91 | #define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) | ||
92 | #define BAD_STAT (BAD_R_STAT | DRQ_STAT) | ||
93 | #define DRIVE_READY (READY_STAT | SEEK_STAT) | ||
94 | 91 | ||
95 | #define BAD_CRC (ABRT_ERR | ICRC_ERR) | 92 | #define BAD_R_STAT (ATA_BUSY | ATA_ERR) |
93 | #define BAD_W_STAT (BAD_R_STAT | ATA_DF) | ||
94 | #define BAD_STAT (BAD_R_STAT | ATA_DRQ) | ||
95 | #define DRIVE_READY (ATA_DRDY | ATA_DSC) | ||
96 | |||
97 | #define BAD_CRC (ATA_ABORTED | ATA_ICRC) | ||
96 | 98 | ||
97 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ | 99 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ |
98 | 100 | ||
@@ -125,24 +127,41 @@ struct ide_io_ports { | |||
125 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ | 127 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ |
126 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ | 128 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ |
127 | #define SECTOR_SIZE 512 | 129 | #define SECTOR_SIZE 512 |
128 | #define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */ | 130 | |
129 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) | 131 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) |
130 | 132 | ||
131 | /* | 133 | /* |
132 | * Timeouts for various operations: | 134 | * Timeouts for various operations: |
133 | */ | 135 | */ |
134 | #define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ | 136 | enum { |
135 | #define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ | 137 | /* spec allows up to 20ms */ |
136 | #define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ | 138 | WAIT_DRQ = HZ / 10, /* 100ms */ |
137 | #define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ | 139 | /* some laptops are very slow */ |
138 | #define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ | 140 | WAIT_READY = 5 * HZ, /* 5s */ |
139 | #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ | 141 | /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ |
142 | WAIT_PIDENTIFY = 10 * HZ, /* 10s */ | ||
143 | /* worst case when spinning up */ | ||
144 | WAIT_WORSTCASE = 30 * HZ, /* 30s */ | ||
145 | /* maximum wait for an IRQ to happen */ | ||
146 | WAIT_CMD = 10 * HZ, /* 10s */ | ||
147 | /* Some drives require a longer IRQ timeout. */ | ||
148 | WAIT_FLOPPY_CMD = 50 * HZ, /* 50s */ | ||
149 | /* | ||
150 | * Some drives (for example, Seagate STT3401A Travan) require a very | ||
151 | * long timeout, because they don't return an interrupt or clear their | ||
152 | * BSY bit until after the command completes (even retension commands). | ||
153 | */ | ||
154 | WAIT_TAPE_CMD = 900 * HZ, /* 900s */ | ||
155 | /* minimum sleep time */ | ||
156 | WAIT_MIN_SLEEP = HZ / 50, /* 20ms */ | ||
157 | }; | ||
140 | 158 | ||
141 | /* | 159 | /* |
142 | * Op codes for special requests to be handled by ide_special_rq(). | 160 | * Op codes for special requests to be handled by ide_special_rq(). |
143 | * Values should be in the range of 0x20 to 0x3f. | 161 | * Values should be in the range of 0x20 to 0x3f. |
144 | */ | 162 | */ |
145 | #define REQ_DRIVE_RESET 0x20 | 163 | #define REQ_DRIVE_RESET 0x20 |
164 | #define REQ_DEVSET_EXEC 0x21 | ||
146 | 165 | ||
147 | /* | 166 | /* |
148 | * Check for an interrupt and acknowledge the interrupt status | 167 | * Check for an interrupt and acknowledge the interrupt status |
@@ -219,18 +238,7 @@ static inline int __ide_default_irq(unsigned long base) | |||
219 | #include <asm-generic/ide_iops.h> | 238 | #include <asm-generic/ide_iops.h> |
220 | #endif | 239 | #endif |
221 | 240 | ||
222 | #ifndef MAX_HWIFS | 241 | #define MAX_HWIFS 10 |
223 | #if defined(CONFIG_BLACKFIN) || defined(CONFIG_H8300) || defined(CONFIG_XTENSA) | ||
224 | # define MAX_HWIFS 1 | ||
225 | #else | ||
226 | # define MAX_HWIFS 10 | ||
227 | #endif | ||
228 | #endif | ||
229 | |||
230 | #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) | ||
231 | #undef MAX_HWIFS | ||
232 | #define MAX_HWIFS CONFIG_IDE_MAX_HWIFS | ||
233 | #endif | ||
234 | 242 | ||
235 | /* Currently only m68k, apus and m8xx need it */ | 243 | /* Currently only m68k, apus and m8xx need it */ |
236 | #ifndef IDE_ARCH_ACK_INTR | 244 | #ifndef IDE_ARCH_ACK_INTR |
@@ -314,8 +322,8 @@ typedef enum { | |||
314 | ide_started, /* a drive operation was started, handler was set */ | 322 | ide_started, /* a drive operation was started, handler was set */ |
315 | } ide_startstop_t; | 323 | } ide_startstop_t; |
316 | 324 | ||
325 | struct ide_devset; | ||
317 | struct ide_driver_s; | 326 | struct ide_driver_s; |
318 | struct ide_settings_s; | ||
319 | 327 | ||
320 | #ifdef CONFIG_BLK_DEV_IDEACPI | 328 | #ifdef CONFIG_BLK_DEV_IDEACPI |
321 | struct ide_acpi_drive_link; | 329 | struct ide_acpi_drive_link; |
@@ -326,10 +334,10 @@ struct ide_acpi_hwif_link; | |||
326 | enum { | 334 | enum { |
327 | IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), | 335 | IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), |
328 | IDE_AFLAG_MEDIA_CHANGED = (1 << 1), | 336 | IDE_AFLAG_MEDIA_CHANGED = (1 << 1), |
329 | |||
330 | /* ide-cd */ | ||
331 | /* Drive cannot lock the door. */ | 337 | /* Drive cannot lock the door. */ |
332 | IDE_AFLAG_NO_DOORLOCK = (1 << 2), | 338 | IDE_AFLAG_NO_DOORLOCK = (1 << 2), |
339 | |||
340 | /* ide-cd */ | ||
333 | /* Drive cannot eject the disc. */ | 341 | /* Drive cannot eject the disc. */ |
334 | IDE_AFLAG_NO_EJECT = (1 << 3), | 342 | IDE_AFLAG_NO_EJECT = (1 << 3), |
335 | /* Drive is a pre ATAPI 1.2 drive. */ | 343 | /* Drive is a pre ATAPI 1.2 drive. */ |
@@ -365,19 +373,25 @@ enum { | |||
365 | IDE_AFLAG_CLIK_DRIVE = (1 << 19), | 373 | IDE_AFLAG_CLIK_DRIVE = (1 << 19), |
366 | /* Requires BH algorithm for packets */ | 374 | /* Requires BH algorithm for packets */ |
367 | IDE_AFLAG_ZIP_DRIVE = (1 << 20), | 375 | IDE_AFLAG_ZIP_DRIVE = (1 << 20), |
376 | /* Write protect */ | ||
377 | IDE_AFLAG_WP = (1 << 21), | ||
378 | /* Supports format progress report */ | ||
379 | IDE_AFLAG_SRFP = (1 << 22), | ||
368 | 380 | ||
369 | /* ide-tape */ | 381 | /* ide-tape */ |
370 | IDE_AFLAG_IGNORE_DSC = (1 << 21), | 382 | IDE_AFLAG_IGNORE_DSC = (1 << 23), |
371 | /* 0 When the tape position is unknown */ | 383 | /* 0 When the tape position is unknown */ |
372 | IDE_AFLAG_ADDRESS_VALID = (1 << 22), | 384 | IDE_AFLAG_ADDRESS_VALID = (1 << 24), |
373 | /* Device already opened */ | 385 | /* Device already opened */ |
374 | IDE_AFLAG_BUSY = (1 << 23), | 386 | IDE_AFLAG_BUSY = (1 << 25), |
375 | /* Attempt to auto-detect the current user block size */ | 387 | /* Attempt to auto-detect the current user block size */ |
376 | IDE_AFLAG_DETECT_BS = (1 << 24), | 388 | IDE_AFLAG_DETECT_BS = (1 << 26), |
377 | /* Currently on a filemark */ | 389 | /* Currently on a filemark */ |
378 | IDE_AFLAG_FILEMARK = (1 << 25), | 390 | IDE_AFLAG_FILEMARK = (1 << 27), |
379 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | 391 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ |
380 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 26) | 392 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 28), |
393 | |||
394 | IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), | ||
381 | }; | 395 | }; |
382 | 396 | ||
383 | struct ide_drive_s { | 397 | struct ide_drive_s { |
@@ -389,10 +403,10 @@ struct ide_drive_s { | |||
389 | struct request *rq; /* current request */ | 403 | struct request *rq; /* current request */ |
390 | struct ide_drive_s *next; /* circular list of hwgroup drives */ | 404 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
391 | void *driver_data; /* extra driver data */ | 405 | void *driver_data; /* extra driver data */ |
392 | struct hd_driveid *id; /* drive model identification info */ | 406 | u16 *id; /* identification info */ |
393 | #ifdef CONFIG_IDE_PROC_FS | 407 | #ifdef CONFIG_IDE_PROC_FS |
394 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 408 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
395 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ | 409 | const struct ide_proc_devset *settings; /* /proc/ide/ drive settings */ |
396 | #endif | 410 | #endif |
397 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ | 411 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ |
398 | 412 | ||
@@ -404,16 +418,16 @@ struct ide_drive_s { | |||
404 | special_t special; /* special action flags */ | 418 | special_t special; /* special action flags */ |
405 | select_t select; /* basic drive/head select reg value */ | 419 | select_t select; /* basic drive/head select reg value */ |
406 | 420 | ||
407 | u8 keep_settings; /* restore settings after drive reset */ | ||
408 | u8 using_dma; /* disk is using dma for read/write */ | ||
409 | u8 retry_pio; /* retrying dma capable host in pio */ | 421 | u8 retry_pio; /* retrying dma capable host in pio */ |
410 | u8 state; /* retry state */ | 422 | u8 state; /* retry state */ |
411 | u8 waiting_for_dma; /* dma currently in progress */ | 423 | u8 waiting_for_dma; /* dma currently in progress */ |
412 | u8 unmask; /* okay to unmask other irqs */ | ||
413 | u8 noflush; /* don't attempt flushes */ | ||
414 | u8 dsc_overlap; /* DSC overlap */ | ||
415 | u8 nice1; /* give potential excess bandwidth */ | ||
416 | 424 | ||
425 | unsigned keep_settings : 1; /* restore settings after drive reset */ | ||
426 | unsigned using_dma : 1; /* disk is using dma for read/write */ | ||
427 | unsigned unmask : 1; /* okay to unmask other irqs */ | ||
428 | unsigned noflush : 1; /* don't attempt flushes */ | ||
429 | unsigned dsc_overlap : 1; /* DSC overlap */ | ||
430 | unsigned nice1 : 1; /* give potential excess bandwidth */ | ||
417 | unsigned present : 1; /* drive is physically present */ | 431 | unsigned present : 1; /* drive is physically present */ |
418 | unsigned dead : 1; /* device ejected hint */ | 432 | unsigned dead : 1; /* device ejected hint */ |
419 | unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */ | 433 | unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */ |
@@ -423,23 +437,22 @@ struct ide_drive_s { | |||
423 | unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ | 437 | unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ |
424 | unsigned no_unmask : 1; /* disallow setting unmask bit */ | 438 | unsigned no_unmask : 1; /* disallow setting unmask bit */ |
425 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ | 439 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ |
426 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ | ||
427 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ | 440 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ |
428 | unsigned nodma : 1; /* disallow DMA */ | 441 | unsigned nodma : 1; /* disallow DMA */ |
429 | unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ | ||
430 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ | 442 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ |
431 | unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ | 443 | unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ |
432 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ | 444 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ |
433 | unsigned post_reset : 1; | 445 | unsigned post_reset : 1; |
434 | unsigned udma33_warned : 1; | 446 | unsigned udma33_warned : 1; |
447 | unsigned addressing : 2; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */ | ||
448 | unsigned wcache : 1; /* status of write cache */ | ||
449 | unsigned nowerr : 1; /* used for ignoring ATA_DF */ | ||
435 | 450 | ||
436 | u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */ | ||
437 | u8 quirk_list; /* considered quirky, set for a specific host */ | 451 | u8 quirk_list; /* considered quirky, set for a specific host */ |
438 | u8 init_speed; /* transfer rate set at boot */ | 452 | u8 init_speed; /* transfer rate set at boot */ |
439 | u8 current_speed; /* current transfer rate set */ | 453 | u8 current_speed; /* current transfer rate set */ |
440 | u8 desired_speed; /* desired transfer rate set */ | 454 | u8 desired_speed; /* desired transfer rate set */ |
441 | u8 dn; /* now wide spread use */ | 455 | u8 dn; /* now wide spread use */ |
442 | u8 wcache; /* status of write cache */ | ||
443 | u8 acoustic; /* acoustic management */ | 456 | u8 acoustic; /* acoustic management */ |
444 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 457 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
445 | u8 ready_stat; /* min status value for drive ready */ | 458 | u8 ready_stat; /* min status value for drive ready */ |
@@ -447,9 +460,7 @@ struct ide_drive_s { | |||
447 | u8 mult_req; /* requested multiple sector setting */ | 460 | u8 mult_req; /* requested multiple sector setting */ |
448 | u8 tune_req; /* requested drive tuning setting */ | 461 | u8 tune_req; /* requested drive tuning setting */ |
449 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ | 462 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ |
450 | u8 bad_wstat; /* used for ignoring WRERR_STAT */ | 463 | u8 bad_wstat; /* used for ignoring ATA_DF */ |
451 | u8 nowerr; /* used for ignoring WRERR_STAT */ | ||
452 | u8 sect0; /* offset of first sector for DM6:DDO */ | ||
453 | u8 head; /* "real" number of heads */ | 464 | u8 head; /* "real" number of heads */ |
454 | u8 sect; /* "real" sectors per track */ | 465 | u8 sect; /* "real" sectors per track */ |
455 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ | 466 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ |
@@ -483,10 +494,6 @@ typedef struct ide_drive_s ide_drive_t; | |||
483 | 494 | ||
484 | #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) | 495 | #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) |
485 | 496 | ||
486 | #define IDE_CHIPSET_PCI_MASK \ | ||
487 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) | ||
488 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) | ||
489 | |||
490 | struct ide_task_s; | 497 | struct ide_task_s; |
491 | struct ide_port_info; | 498 | struct ide_port_info; |
492 | 499 | ||
@@ -509,24 +516,33 @@ struct ide_tp_ops { | |||
509 | 516 | ||
510 | extern const struct ide_tp_ops default_tp_ops; | 517 | extern const struct ide_tp_ops default_tp_ops; |
511 | 518 | ||
519 | /** | ||
520 | * struct ide_port_ops - IDE port operations | ||
521 | * | ||
522 | * @init_dev: host specific initialization of a device | ||
523 | * @set_pio_mode: routine to program host for PIO mode | ||
524 | * @set_dma_mode: routine to program host for DMA mode | ||
525 | * @selectproc: tweaks hardware to select drive | ||
526 | * @reset_poll: chipset polling based on hba specifics | ||
527 | * @pre_reset: chipset specific changes to default for device-hba resets | ||
528 | * @resetproc: routine to reset controller after a disk reset | ||
529 | * @maskproc: special host masking for drive selection | ||
530 | * @quirkproc: check host's drive quirk list | ||
531 | * | ||
532 | * @mdma_filter: filter MDMA modes | ||
533 | * @udma_filter: filter UDMA modes | ||
534 | * | ||
535 | * @cable_detect: detect cable type | ||
536 | */ | ||
512 | struct ide_port_ops { | 537 | struct ide_port_ops { |
513 | /* host specific initialization of a device */ | ||
514 | void (*init_dev)(ide_drive_t *); | 538 | void (*init_dev)(ide_drive_t *); |
515 | /* routine to program host for PIO mode */ | ||
516 | void (*set_pio_mode)(ide_drive_t *, const u8); | 539 | void (*set_pio_mode)(ide_drive_t *, const u8); |
517 | /* routine to program host for DMA mode */ | ||
518 | void (*set_dma_mode)(ide_drive_t *, const u8); | 540 | void (*set_dma_mode)(ide_drive_t *, const u8); |
519 | /* tweaks hardware to select drive */ | ||
520 | void (*selectproc)(ide_drive_t *); | 541 | void (*selectproc)(ide_drive_t *); |
521 | /* chipset polling based on hba specifics */ | ||
522 | int (*reset_poll)(ide_drive_t *); | 542 | int (*reset_poll)(ide_drive_t *); |
523 | /* chipset specific changes to default for device-hba resets */ | ||
524 | void (*pre_reset)(ide_drive_t *); | 543 | void (*pre_reset)(ide_drive_t *); |
525 | /* routine to reset controller after a disk reset */ | ||
526 | void (*resetproc)(ide_drive_t *); | 544 | void (*resetproc)(ide_drive_t *); |
527 | /* special host masking for drive selection */ | ||
528 | void (*maskproc)(ide_drive_t *, int); | 545 | void (*maskproc)(ide_drive_t *, int); |
529 | /* check host's drive quirk list */ | ||
530 | void (*quirkproc)(ide_drive_t *); | 546 | void (*quirkproc)(ide_drive_t *); |
531 | 547 | ||
532 | u8 (*mdma_filter)(ide_drive_t *); | 548 | u8 (*mdma_filter)(ide_drive_t *); |
@@ -567,7 +583,6 @@ typedef struct hwif_s { | |||
567 | u8 major; /* our major number */ | 583 | u8 major; /* our major number */ |
568 | u8 index; /* 0 for ide0; 1 for ide1; ... */ | 584 | u8 index; /* 0 for ide0; 1 for ide1; ... */ |
569 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ | 585 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ |
570 | u8 bus_state; /* power state of the IDE bus */ | ||
571 | 586 | ||
572 | u32 host_flags; | 587 | u32 host_flags; |
573 | 588 | ||
@@ -645,6 +660,7 @@ struct ide_host { | |||
645 | ide_hwif_t *ports[MAX_HWIFS]; | 660 | ide_hwif_t *ports[MAX_HWIFS]; |
646 | unsigned int n_ports; | 661 | unsigned int n_ports; |
647 | struct device *dev[2]; | 662 | struct device *dev[2]; |
663 | unsigned int (*init_chipset)(struct pci_dev *); | ||
648 | unsigned long host_flags; | 664 | unsigned long host_flags; |
649 | void *host_priv; | 665 | void *host_priv; |
650 | }; | 666 | }; |
@@ -692,9 +708,61 @@ typedef struct ide_driver_s ide_driver_t; | |||
692 | 708 | ||
693 | extern struct mutex ide_setting_mtx; | 709 | extern struct mutex ide_setting_mtx; |
694 | 710 | ||
695 | int set_io_32bit(ide_drive_t *, int); | 711 | /* |
696 | int set_pio_mode(ide_drive_t *, int); | 712 | * configurable drive settings |
697 | int set_using_dma(ide_drive_t *, int); | 713 | */ |
714 | |||
715 | #define DS_SYNC (1 << 0) | ||
716 | |||
717 | struct ide_devset { | ||
718 | int (*get)(ide_drive_t *); | ||
719 | int (*set)(ide_drive_t *, int); | ||
720 | unsigned int flags; | ||
721 | }; | ||
722 | |||
723 | #define __DEVSET(_flags, _get, _set) { \ | ||
724 | .flags = _flags, \ | ||
725 | .get = _get, \ | ||
726 | .set = _set, \ | ||
727 | } | ||
728 | |||
729 | #define ide_devset_get(name, field) \ | ||
730 | static int get_##name(ide_drive_t *drive) \ | ||
731 | { \ | ||
732 | return drive->field; \ | ||
733 | } | ||
734 | |||
735 | #define ide_devset_set(name, field) \ | ||
736 | static int set_##name(ide_drive_t *drive, int arg) \ | ||
737 | { \ | ||
738 | drive->field = arg; \ | ||
739 | return 0; \ | ||
740 | } | ||
741 | |||
742 | #define __IDE_DEVSET(_name, _flags, _get, _set) \ | ||
743 | const struct ide_devset ide_devset_##_name = \ | ||
744 | __DEVSET(_flags, _get, _set) | ||
745 | |||
746 | #define IDE_DEVSET(_name, _flags, _get, _set) \ | ||
747 | static __IDE_DEVSET(_name, _flags, _get, _set) | ||
748 | |||
749 | #define ide_devset_rw(_name, _func) \ | ||
750 | IDE_DEVSET(_name, 0, get_##_func, set_##_func) | ||
751 | |||
752 | #define ide_devset_w(_name, _func) \ | ||
753 | IDE_DEVSET(_name, 0, NULL, set_##_func) | ||
754 | |||
755 | #define ide_devset_rw_sync(_name, _func) \ | ||
756 | IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func) | ||
757 | |||
758 | #define ide_decl_devset(_name) \ | ||
759 | extern const struct ide_devset ide_devset_##_name | ||
760 | |||
761 | ide_decl_devset(io_32bit); | ||
762 | ide_decl_devset(keepsettings); | ||
763 | ide_decl_devset(pio_mode); | ||
764 | ide_decl_devset(unmaskirq); | ||
765 | ide_decl_devset(using_dma); | ||
698 | 766 | ||
699 | /* ATAPI packet command flags */ | 767 | /* ATAPI packet command flags */ |
700 | enum { | 768 | enum { |
@@ -710,6 +778,12 @@ enum { | |||
710 | PC_FLAG_TIMEDOUT = (1 << 7), | 778 | PC_FLAG_TIMEDOUT = (1 << 7), |
711 | }; | 779 | }; |
712 | 780 | ||
781 | /* | ||
782 | * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. | ||
783 | * This is used for several packet commands (not for READ/WRITE commands). | ||
784 | */ | ||
785 | #define IDE_PC_BUFFER_SIZE 256 | ||
786 | |||
713 | struct ide_atapi_pc { | 787 | struct ide_atapi_pc { |
714 | /* actual packet bytes */ | 788 | /* actual packet bytes */ |
715 | u8 c[12]; | 789 | u8 c[12]; |
@@ -739,7 +813,7 @@ struct ide_atapi_pc { | |||
739 | * those are more or less driver-specific and some of them are subject | 813 | * those are more or less driver-specific and some of them are subject |
740 | * to change/removal later. | 814 | * to change/removal later. |
741 | */ | 815 | */ |
742 | u8 pc_buf[256]; | 816 | u8 pc_buf[IDE_PC_BUFFER_SIZE]; |
743 | 817 | ||
744 | /* idetape only */ | 818 | /* idetape only */ |
745 | struct idetape_bh *bh; | 819 | struct idetape_bh *bh; |
@@ -757,37 +831,34 @@ struct ide_atapi_pc { | |||
757 | 831 | ||
758 | #ifdef CONFIG_IDE_PROC_FS | 832 | #ifdef CONFIG_IDE_PROC_FS |
759 | /* | 833 | /* |
760 | * configurable drive settings | 834 | * /proc/ide interface |
761 | */ | 835 | */ |
762 | 836 | ||
763 | #define TYPE_INT 0 | 837 | #define ide_devset_rw_field(_name, _field) \ |
764 | #define TYPE_BYTE 1 | 838 | ide_devset_get(_name, _field); \ |
765 | #define TYPE_SHORT 2 | 839 | ide_devset_set(_name, _field); \ |
840 | IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) | ||
841 | |||
842 | struct ide_proc_devset { | ||
843 | const char *name; | ||
844 | const struct ide_devset *setting; | ||
845 | int min, max; | ||
846 | int (*mulf)(ide_drive_t *); | ||
847 | int (*divf)(ide_drive_t *); | ||
848 | }; | ||
766 | 849 | ||
767 | #define SETTING_READ (1 << 0) | 850 | #define __IDE_PROC_DEVSET(_name, _min, _max, _mulf, _divf) { \ |
768 | #define SETTING_WRITE (1 << 1) | 851 | .name = __stringify(_name), \ |
769 | #define SETTING_RW (SETTING_READ | SETTING_WRITE) | 852 | .setting = &ide_devset_##_name, \ |
853 | .min = _min, \ | ||
854 | .max = _max, \ | ||
855 | .mulf = _mulf, \ | ||
856 | .divf = _divf, \ | ||
857 | } | ||
770 | 858 | ||
771 | typedef int (ide_procset_t)(ide_drive_t *, int); | 859 | #define IDE_PROC_DEVSET(_name, _min, _max) \ |
772 | typedef struct ide_settings_s { | 860 | __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL) |
773 | char *name; | ||
774 | int rw; | ||
775 | int data_type; | ||
776 | int min; | ||
777 | int max; | ||
778 | int mul_factor; | ||
779 | int div_factor; | ||
780 | void *data; | ||
781 | ide_procset_t *set; | ||
782 | int auto_remove; | ||
783 | struct ide_settings_s *next; | ||
784 | } ide_settings_t; | ||
785 | |||
786 | int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set); | ||
787 | 861 | ||
788 | /* | ||
789 | * /proc/ide interface | ||
790 | */ | ||
791 | typedef struct { | 862 | typedef struct { |
792 | const char *name; | 863 | const char *name; |
793 | mode_t mode; | 864 | mode_t mode; |
@@ -804,8 +875,6 @@ void ide_proc_unregister_port(ide_hwif_t *); | |||
804 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); | 875 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); |
805 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); | 876 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); |
806 | 877 | ||
807 | void ide_add_generic_settings(ide_drive_t *); | ||
808 | |||
809 | read_proc_t proc_ide_read_capacity; | 878 | read_proc_t proc_ide_read_capacity; |
810 | read_proc_t proc_ide_read_geometry; | 879 | read_proc_t proc_ide_read_geometry; |
811 | 880 | ||
@@ -833,7 +902,6 @@ static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; } | |||
833 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } | 902 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } |
834 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 903 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
835 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 904 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
836 | static inline void ide_add_generic_settings(ide_drive_t *drive) { ; } | ||
837 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; | 905 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; |
838 | #endif | 906 | #endif |
839 | 907 | ||
@@ -879,7 +947,6 @@ enum { | |||
879 | struct ide_driver_s { | 947 | struct ide_driver_s { |
880 | const char *version; | 948 | const char *version; |
881 | u8 media; | 949 | u8 media; |
882 | unsigned supports_dsc_overlap : 1; | ||
883 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 950 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
884 | int (*end_request)(ide_drive_t *, int, int); | 951 | int (*end_request)(ide_drive_t *, int, int); |
885 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); | 952 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); |
@@ -889,7 +956,8 @@ struct ide_driver_s { | |||
889 | void (*resume)(ide_drive_t *); | 956 | void (*resume)(ide_drive_t *); |
890 | void (*shutdown)(ide_drive_t *); | 957 | void (*shutdown)(ide_drive_t *); |
891 | #ifdef CONFIG_IDE_PROC_FS | 958 | #ifdef CONFIG_IDE_PROC_FS |
892 | ide_proc_entry_t *proc; | 959 | ide_proc_entry_t *proc; |
960 | const struct ide_proc_devset *settings; | ||
893 | #endif | 961 | #endif |
894 | }; | 962 | }; |
895 | 963 | ||
@@ -898,7 +966,17 @@ struct ide_driver_s { | |||
898 | int ide_device_get(ide_drive_t *); | 966 | int ide_device_get(ide_drive_t *); |
899 | void ide_device_put(ide_drive_t *); | 967 | void ide_device_put(ide_drive_t *); |
900 | 968 | ||
901 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); | 969 | struct ide_ioctl_devset { |
970 | unsigned int get_ioctl; | ||
971 | unsigned int set_ioctl; | ||
972 | const struct ide_devset *setting; | ||
973 | }; | ||
974 | |||
975 | int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, | ||
976 | unsigned long, const struct ide_ioctl_devset *); | ||
977 | |||
978 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, | ||
979 | unsigned, unsigned long); | ||
902 | 980 | ||
903 | extern int ide_vlb_clk; | 981 | extern int ide_vlb_clk; |
904 | extern int ide_pci_clk; | 982 | extern int ide_pci_clk; |
@@ -920,14 +998,19 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | |||
920 | 998 | ||
921 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 999 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
922 | 1000 | ||
923 | extern void ide_fix_driveid(struct hd_driveid *); | 1001 | void ide_fix_driveid(u16 *); |
924 | 1002 | ||
925 | extern void ide_fixstring(u8 *, const int, const int); | 1003 | extern void ide_fixstring(u8 *, const int, const int); |
926 | 1004 | ||
1005 | int ide_busy_sleep(ide_hwif_t *, unsigned long, int); | ||
1006 | |||
927 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | 1007 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); |
928 | 1008 | ||
929 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 1009 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
930 | 1010 | ||
1011 | extern int ide_devset_execute(ide_drive_t *drive, | ||
1012 | const struct ide_devset *setting, int arg); | ||
1013 | |||
931 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); | 1014 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); |
932 | 1015 | ||
933 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 1016 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
@@ -1051,6 +1134,8 @@ void ide_tf_read(ide_drive_t *, ide_task_t *); | |||
1051 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); | 1134 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); |
1052 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); | 1135 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); |
1053 | 1136 | ||
1137 | int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); | ||
1138 | |||
1054 | extern void SELECT_DRIVE(ide_drive_t *); | 1139 | extern void SELECT_DRIVE(ide_drive_t *); |
1055 | void SELECT_MASK(ide_drive_t *, int); | 1140 | void SELECT_MASK(ide_drive_t *, int); |
1056 | 1141 | ||
@@ -1061,11 +1146,36 @@ extern int drive_is_ready(ide_drive_t *); | |||
1061 | 1146 | ||
1062 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | 1147 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); |
1063 | 1148 | ||
1149 | int ide_check_atapi_device(ide_drive_t *, const char *); | ||
1150 | |||
1151 | void ide_init_pc(struct ide_atapi_pc *); | ||
1152 | |||
1153 | /* | ||
1154 | * Special requests for ide-tape block device strategy routine. | ||
1155 | * | ||
1156 | * In order to service a character device command, we add special requests to | ||
1157 | * the tail of our block device request queue and wait for their completion. | ||
1158 | */ | ||
1159 | enum { | ||
1160 | REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ | ||
1161 | REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ | ||
1162 | REQ_IDETAPE_READ = (1 << 2), | ||
1163 | REQ_IDETAPE_WRITE = (1 << 3), | ||
1164 | }; | ||
1165 | |||
1166 | void ide_queue_pc_head(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *, | ||
1167 | struct request *); | ||
1168 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); | ||
1169 | |||
1170 | int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); | ||
1171 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); | ||
1172 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); | ||
1173 | |||
1064 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, | 1174 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, |
1065 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, | 1175 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, |
1066 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), | 1176 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), |
1067 | void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *), | 1177 | void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *), |
1068 | void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int, | 1178 | int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int, |
1069 | int)); | 1179 | int)); |
1070 | ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *, | 1180 | ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *, |
1071 | ide_handler_t *, unsigned int, ide_expiry_t *); | 1181 | ide_handler_t *, unsigned int, ide_expiry_t *); |
@@ -1080,8 +1190,6 @@ int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | |||
1080 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 1190 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); |
1081 | 1191 | ||
1082 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | 1192 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); |
1083 | int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); | ||
1084 | int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); | ||
1085 | 1193 | ||
1086 | extern int ide_driveid_update(ide_drive_t *); | 1194 | extern int ide_driveid_update(ide_drive_t *); |
1087 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 1195 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
@@ -1092,7 +1200,6 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); | |||
1092 | 1200 | ||
1093 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | 1201 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); |
1094 | 1202 | ||
1095 | extern int ide_spin_wait_hwgroup(ide_drive_t *); | ||
1096 | extern void ide_timer_expiry(unsigned long); | 1203 | extern void ide_timer_expiry(unsigned long); |
1097 | extern irqreturn_t ide_intr(int irq, void *dev_id); | 1204 | extern irqreturn_t ide_intr(int irq, void *dev_id); |
1098 | extern void do_ide_request(struct request_queue *); | 1205 | extern void do_ide_request(struct request_queue *); |
@@ -1113,7 +1220,6 @@ void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | |||
1113 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 1220 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
1114 | int ide_pci_set_master(struct pci_dev *, const char *); | 1221 | int ide_pci_set_master(struct pci_dev *, const char *); |
1115 | unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); | 1222 | unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); |
1116 | extern const struct ide_dma_ops sff_dma_ops; | ||
1117 | int ide_pci_check_simplex(ide_hwif_t *, const struct ide_port_info *); | 1223 | int ide_pci_check_simplex(ide_hwif_t *, const struct ide_port_info *); |
1118 | int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | 1224 | int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); |
1119 | #else | 1225 | #else |
@@ -1230,6 +1336,14 @@ int ide_pci_init_two(struct pci_dev *, struct pci_dev *, | |||
1230 | const struct ide_port_info *, void *); | 1336 | const struct ide_port_info *, void *); |
1231 | void ide_pci_remove(struct pci_dev *); | 1337 | void ide_pci_remove(struct pci_dev *); |
1232 | 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 | ||
1346 | |||
1233 | void ide_map_sg(ide_drive_t *, struct request *); | 1347 | void ide_map_sg(ide_drive_t *, struct request *); |
1234 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1348 | void ide_init_sg_cmd(ide_drive_t *, struct request *); |
1235 | 1349 | ||
@@ -1241,7 +1355,7 @@ struct drive_list_entry { | |||
1241 | const char *id_firmware; | 1355 | const char *id_firmware; |
1242 | }; | 1356 | }; |
1243 | 1357 | ||
1244 | int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); | 1358 | int ide_in_drive_list(u16 *, const struct drive_list_entry *); |
1245 | 1359 | ||
1246 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1360 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1247 | int __ide_dma_bad_drive(ide_drive_t *); | 1361 | int __ide_dma_bad_drive(ide_drive_t *); |
@@ -1277,6 +1391,7 @@ extern int __ide_dma_end(ide_drive_t *); | |||
1277 | int ide_dma_test_irq(ide_drive_t *); | 1391 | int ide_dma_test_irq(ide_drive_t *); |
1278 | extern void ide_dma_lost_irq(ide_drive_t *); | 1392 | extern void ide_dma_lost_irq(ide_drive_t *); |
1279 | extern void ide_dma_timeout(ide_drive_t *); | 1393 | extern void ide_dma_timeout(ide_drive_t *); |
1394 | extern const struct ide_dma_ops sff_dma_ops; | ||
1280 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ | 1395 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ |
1281 | 1396 | ||
1282 | #else | 1397 | #else |
@@ -1347,24 +1462,6 @@ const char *ide_xfer_verbose(u8 mode); | |||
1347 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1462 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1348 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | 1463 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); |
1349 | 1464 | ||
1350 | static inline int ide_dev_has_iordy(struct hd_driveid *id) | ||
1351 | { | ||
1352 | return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; | ||
1353 | } | ||
1354 | |||
1355 | static inline int ide_dev_is_sata(struct hd_driveid *id) | ||
1356 | { | ||
1357 | /* | ||
1358 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | ||
1359 | * verifying that word 80 by casting it to a signed type -- | ||
1360 | * this trick allows us to filter out the reserved values of | ||
1361 | * 0x0000 and 0xffff along with the earlier ATA revisions... | ||
1362 | */ | ||
1363 | if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020) | ||
1364 | return 1; | ||
1365 | return 0; | ||
1366 | } | ||
1367 | |||
1368 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1465 | u64 ide_get_lba_addr(struct ide_taskfile *, int); |
1369 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1466 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1370 | 1467 | ||
@@ -1436,13 +1533,6 @@ extern struct mutex ide_cfg_mtx; | |||
1436 | extern struct bus_type ide_bus_type; | 1533 | extern struct bus_type ide_bus_type; |
1437 | extern struct class *ide_port_class; | 1534 | extern struct class *ide_port_class; |
1438 | 1535 | ||
1439 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ | ||
1440 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | ||
1441 | |||
1442 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ | ||
1443 | #define ide_id_has_flush_cache_ext(id) \ | ||
1444 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) | ||
1445 | |||
1446 | static inline void ide_dump_identify(u8 *id) | 1536 | static inline void ide_dump_identify(u8 *id) |
1447 | { | 1537 | { |
1448 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); | 1538 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); |
@@ -1450,14 +1540,13 @@ static inline void ide_dump_identify(u8 *id) | |||
1450 | 1540 | ||
1451 | static inline int hwif_to_node(ide_hwif_t *hwif) | 1541 | static inline int hwif_to_node(ide_hwif_t *hwif) |
1452 | { | 1542 | { |
1453 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1543 | return hwif->dev ? dev_to_node(hwif->dev) : -1; |
1454 | return hwif->dev ? pcibus_to_node(dev->bus) : -1; | ||
1455 | } | 1544 | } |
1456 | 1545 | ||
1457 | static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | 1546 | static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive) |
1458 | { | 1547 | { |
1459 | ide_hwif_t *hwif = HWIF(drive); | 1548 | ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1]; |
1460 | 1549 | ||
1461 | return &hwif->drives[(drive->dn ^ 1) & 1]; | 1550 | return peer->present ? peer : NULL; |
1462 | } | 1551 | } |
1463 | #endif /* _IDE_H */ | 1552 | #endif /* _IDE_H */ |