diff options
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r-- | include/linux/ide.h | 158 |
1 files changed, 86 insertions, 72 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h index 010fb26a1579..db5ef8ae1ab9 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -32,13 +32,6 @@ | |||
32 | # define SUPPORT_VLB_SYNC 1 | 32 | # define SUPPORT_VLB_SYNC 1 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /* | ||
36 | * Used to indicate "no IRQ", should be a value that cannot be an IRQ | ||
37 | * number. | ||
38 | */ | ||
39 | |||
40 | #define IDE_NO_IRQ (-1) | ||
41 | |||
42 | typedef unsigned char byte; /* used everywhere */ | 35 | typedef unsigned char byte; /* used everywhere */ |
43 | 36 | ||
44 | /* | 37 | /* |
@@ -122,8 +115,6 @@ struct ide_io_ports { | |||
122 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ | 115 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ |
123 | #define SECTOR_SIZE 512 | 116 | #define SECTOR_SIZE 512 |
124 | 117 | ||
125 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) | ||
126 | |||
127 | /* | 118 | /* |
128 | * Timeouts for various operations: | 119 | * Timeouts for various operations: |
129 | */ | 120 | */ |
@@ -172,9 +163,7 @@ typedef int (ide_ack_intr_t)(struct hwif_s *); | |||
172 | enum { ide_unknown, ide_generic, ide_pci, | 163 | enum { ide_unknown, ide_generic, ide_pci, |
173 | ide_cmd640, ide_dtc2278, ide_ali14xx, | 164 | ide_cmd640, ide_dtc2278, ide_ali14xx, |
174 | ide_qd65xx, ide_umc8672, ide_ht6560b, | 165 | ide_qd65xx, ide_umc8672, ide_ht6560b, |
175 | ide_rz1000, ide_trm290, | 166 | ide_4drives, ide_pmac, ide_acorn, |
176 | ide_cmd646, ide_cy82c693, ide_4drives, | ||
177 | ide_pmac, ide_acorn, | ||
178 | ide_au1xxx, ide_palm3710 | 167 | ide_au1xxx, ide_palm3710 |
179 | }; | 168 | }; |
180 | 169 | ||
@@ -407,6 +396,7 @@ enum { | |||
407 | * This is used for several packet commands (not for READ/WRITE commands). | 396 | * This is used for several packet commands (not for READ/WRITE commands). |
408 | */ | 397 | */ |
409 | #define IDE_PC_BUFFER_SIZE 256 | 398 | #define IDE_PC_BUFFER_SIZE 256 |
399 | #define ATAPI_WAIT_PC (60 * HZ) | ||
410 | 400 | ||
411 | struct ide_atapi_pc { | 401 | struct ide_atapi_pc { |
412 | /* actual packet bytes */ | 402 | /* actual packet bytes */ |
@@ -484,55 +474,53 @@ enum { | |||
484 | 474 | ||
485 | /* ide-cd */ | 475 | /* ide-cd */ |
486 | /* Drive cannot eject the disc. */ | 476 | /* Drive cannot eject the disc. */ |
487 | IDE_AFLAG_NO_EJECT = (1 << 3), | 477 | IDE_AFLAG_NO_EJECT = (1 << 1), |
488 | /* Drive is a pre ATAPI 1.2 drive. */ | 478 | /* Drive is a pre ATAPI 1.2 drive. */ |
489 | IDE_AFLAG_PRE_ATAPI12 = (1 << 4), | 479 | IDE_AFLAG_PRE_ATAPI12 = (1 << 2), |
490 | /* TOC addresses are in BCD. */ | 480 | /* TOC addresses are in BCD. */ |
491 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 5), | 481 | IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), |
492 | /* TOC track numbers are in BCD. */ | 482 | /* TOC track numbers are in BCD. */ |
493 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 6), | 483 | IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), |
494 | /* | 484 | /* |
495 | * Drive does not provide data in multiples of SECTOR_SIZE | 485 | * Drive does not provide data in multiples of SECTOR_SIZE |
496 | * when more than one interrupt is needed. | 486 | * when more than one interrupt is needed. |
497 | */ | 487 | */ |
498 | IDE_AFLAG_LIMIT_NFRAMES = (1 << 7), | 488 | IDE_AFLAG_LIMIT_NFRAMES = (1 << 5), |
499 | /* Seeking in progress. */ | ||
500 | IDE_AFLAG_SEEKING = (1 << 8), | ||
501 | /* Saved TOC information is current. */ | 489 | /* Saved TOC information is current. */ |
502 | IDE_AFLAG_TOC_VALID = (1 << 9), | 490 | IDE_AFLAG_TOC_VALID = (1 << 6), |
503 | /* We think that the drive door is locked. */ | 491 | /* We think that the drive door is locked. */ |
504 | IDE_AFLAG_DOOR_LOCKED = (1 << 10), | 492 | IDE_AFLAG_DOOR_LOCKED = (1 << 7), |
505 | /* SET_CD_SPEED command is unsupported. */ | 493 | /* SET_CD_SPEED command is unsupported. */ |
506 | IDE_AFLAG_NO_SPEED_SELECT = (1 << 11), | 494 | IDE_AFLAG_NO_SPEED_SELECT = (1 << 8), |
507 | IDE_AFLAG_VERTOS_300_SSD = (1 << 12), | 495 | IDE_AFLAG_VERTOS_300_SSD = (1 << 9), |
508 | IDE_AFLAG_VERTOS_600_ESD = (1 << 13), | 496 | IDE_AFLAG_VERTOS_600_ESD = (1 << 10), |
509 | IDE_AFLAG_SANYO_3CD = (1 << 14), | 497 | IDE_AFLAG_SANYO_3CD = (1 << 11), |
510 | IDE_AFLAG_FULL_CAPS_PAGE = (1 << 15), | 498 | IDE_AFLAG_FULL_CAPS_PAGE = (1 << 12), |
511 | IDE_AFLAG_PLAY_AUDIO_OK = (1 << 16), | 499 | IDE_AFLAG_PLAY_AUDIO_OK = (1 << 13), |
512 | IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17), | 500 | IDE_AFLAG_LE_SPEED_FIELDS = (1 << 14), |
513 | 501 | ||
514 | /* ide-floppy */ | 502 | /* ide-floppy */ |
515 | /* Avoid commands not supported in Clik drive */ | 503 | /* Avoid commands not supported in Clik drive */ |
516 | IDE_AFLAG_CLIK_DRIVE = (1 << 19), | 504 | IDE_AFLAG_CLIK_DRIVE = (1 << 15), |
517 | /* Requires BH algorithm for packets */ | 505 | /* Requires BH algorithm for packets */ |
518 | IDE_AFLAG_ZIP_DRIVE = (1 << 20), | 506 | IDE_AFLAG_ZIP_DRIVE = (1 << 16), |
519 | /* Supports format progress report */ | 507 | /* Supports format progress report */ |
520 | IDE_AFLAG_SRFP = (1 << 22), | 508 | IDE_AFLAG_SRFP = (1 << 17), |
521 | 509 | ||
522 | /* ide-tape */ | 510 | /* ide-tape */ |
523 | IDE_AFLAG_IGNORE_DSC = (1 << 23), | 511 | IDE_AFLAG_IGNORE_DSC = (1 << 18), |
524 | /* 0 When the tape position is unknown */ | 512 | /* 0 When the tape position is unknown */ |
525 | IDE_AFLAG_ADDRESS_VALID = (1 << 24), | 513 | IDE_AFLAG_ADDRESS_VALID = (1 << 19), |
526 | /* Device already opened */ | 514 | /* Device already opened */ |
527 | IDE_AFLAG_BUSY = (1 << 25), | 515 | IDE_AFLAG_BUSY = (1 << 20), |
528 | /* Attempt to auto-detect the current user block size */ | 516 | /* Attempt to auto-detect the current user block size */ |
529 | IDE_AFLAG_DETECT_BS = (1 << 26), | 517 | IDE_AFLAG_DETECT_BS = (1 << 21), |
530 | /* Currently on a filemark */ | 518 | /* Currently on a filemark */ |
531 | IDE_AFLAG_FILEMARK = (1 << 27), | 519 | IDE_AFLAG_FILEMARK = (1 << 22), |
532 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | 520 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ |
533 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 28), | 521 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 23), |
534 | 522 | ||
535 | IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), | 523 | IDE_AFLAG_NO_AUTOCLOSE = (1 << 24), |
536 | }; | 524 | }; |
537 | 525 | ||
538 | /* device flags */ | 526 | /* device flags */ |
@@ -571,28 +559,26 @@ enum { | |||
571 | IDE_DFLAG_NODMA = (1 << 16), | 559 | IDE_DFLAG_NODMA = (1 << 16), |
572 | /* powermanagment told us not to do anything, so sleep nicely */ | 560 | /* powermanagment told us not to do anything, so sleep nicely */ |
573 | IDE_DFLAG_BLOCKED = (1 << 17), | 561 | IDE_DFLAG_BLOCKED = (1 << 17), |
574 | /* ide-scsi emulation */ | ||
575 | IDE_DFLAG_SCSI = (1 << 18), | ||
576 | /* sleeping & sleep field valid */ | 562 | /* sleeping & sleep field valid */ |
577 | IDE_DFLAG_SLEEPING = (1 << 19), | 563 | IDE_DFLAG_SLEEPING = (1 << 18), |
578 | IDE_DFLAG_POST_RESET = (1 << 20), | 564 | IDE_DFLAG_POST_RESET = (1 << 19), |
579 | IDE_DFLAG_UDMA33_WARNED = (1 << 21), | 565 | IDE_DFLAG_UDMA33_WARNED = (1 << 20), |
580 | IDE_DFLAG_LBA48 = (1 << 22), | 566 | IDE_DFLAG_LBA48 = (1 << 21), |
581 | /* status of write cache */ | 567 | /* status of write cache */ |
582 | IDE_DFLAG_WCACHE = (1 << 23), | 568 | IDE_DFLAG_WCACHE = (1 << 22), |
583 | /* used for ignoring ATA_DF */ | 569 | /* used for ignoring ATA_DF */ |
584 | IDE_DFLAG_NOWERR = (1 << 24), | 570 | IDE_DFLAG_NOWERR = (1 << 23), |
585 | /* retrying in PIO */ | 571 | /* retrying in PIO */ |
586 | IDE_DFLAG_DMA_PIO_RETRY = (1 << 25), | 572 | IDE_DFLAG_DMA_PIO_RETRY = (1 << 24), |
587 | IDE_DFLAG_LBA = (1 << 26), | 573 | IDE_DFLAG_LBA = (1 << 25), |
588 | /* don't unload heads */ | 574 | /* don't unload heads */ |
589 | IDE_DFLAG_NO_UNLOAD = (1 << 27), | 575 | IDE_DFLAG_NO_UNLOAD = (1 << 26), |
590 | /* heads unloaded, please don't reset port */ | 576 | /* heads unloaded, please don't reset port */ |
591 | IDE_DFLAG_PARKED = (1 << 28), | 577 | IDE_DFLAG_PARKED = (1 << 27), |
592 | IDE_DFLAG_MEDIA_CHANGED = (1 << 29), | 578 | IDE_DFLAG_MEDIA_CHANGED = (1 << 28), |
593 | /* write protect */ | 579 | /* write protect */ |
594 | IDE_DFLAG_WP = (1 << 30), | 580 | IDE_DFLAG_WP = (1 << 29), |
595 | IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 31), | 581 | IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30), |
596 | }; | 582 | }; |
597 | 583 | ||
598 | struct ide_drive_s { | 584 | struct ide_drive_s { |
@@ -616,8 +602,6 @@ struct ide_drive_s { | |||
616 | unsigned long dev_flags; | 602 | unsigned long dev_flags; |
617 | 603 | ||
618 | unsigned long sleep; /* sleep until this time */ | 604 | unsigned long sleep; /* sleep until this time */ |
619 | unsigned long service_start; /* time we started last request */ | ||
620 | unsigned long service_time; /* service time of last request */ | ||
621 | unsigned long timeout; /* max time to wait for irq */ | 605 | unsigned long timeout; /* max time to wait for irq */ |
622 | 606 | ||
623 | special_t special; /* special action flags */ | 607 | special_t special; /* special action flags */ |
@@ -845,8 +829,6 @@ typedef struct hwif_s { | |||
845 | unsigned extra_ports; /* number of extra dma ports */ | 829 | unsigned extra_ports; /* number of extra dma ports */ |
846 | 830 | ||
847 | unsigned present : 1; /* this interface exists */ | 831 | unsigned present : 1; /* this interface exists */ |
848 | unsigned serialized : 1; /* serialized all channel operation */ | ||
849 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | ||
850 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ | 832 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ |
851 | 833 | ||
852 | struct device gendev; | 834 | struct device gendev; |
@@ -887,8 +869,6 @@ typedef struct hwgroup_s { | |||
887 | 869 | ||
888 | /* BOOL: protects all fields below */ | 870 | /* BOOL: protects all fields below */ |
889 | volatile int busy; | 871 | volatile int busy; |
890 | /* BOOL: wake us up on timer expiry */ | ||
891 | unsigned int sleeping : 1; | ||
892 | /* BOOL: polling active & poll_timeout field valid */ | 872 | /* BOOL: polling active & poll_timeout field valid */ |
893 | unsigned int polling : 1; | 873 | unsigned int polling : 1; |
894 | 874 | ||
@@ -909,6 +889,8 @@ typedef struct hwgroup_s { | |||
909 | 889 | ||
910 | int req_gen; | 890 | int req_gen; |
911 | int req_gen_timer; | 891 | int req_gen_timer; |
892 | |||
893 | spinlock_t lock; | ||
912 | } ide_hwgroup_t; | 894 | } ide_hwgroup_t; |
913 | 895 | ||
914 | typedef struct ide_driver_s ide_driver_t; | 896 | typedef struct ide_driver_s ide_driver_t; |
@@ -1122,6 +1104,14 @@ enum { | |||
1122 | IDE_PM_COMPLETED, | 1104 | IDE_PM_COMPLETED, |
1123 | }; | 1105 | }; |
1124 | 1106 | ||
1107 | int generic_ide_suspend(struct device *, pm_message_t); | ||
1108 | int generic_ide_resume(struct device *); | ||
1109 | |||
1110 | void ide_complete_power_step(ide_drive_t *, struct request *); | ||
1111 | ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); | ||
1112 | void ide_complete_pm_request(ide_drive_t *, struct request *); | ||
1113 | void ide_check_pm_state(ide_drive_t *, struct request *); | ||
1114 | |||
1125 | /* | 1115 | /* |
1126 | * Subdrivers support. | 1116 | * Subdrivers support. |
1127 | * | 1117 | * |
@@ -1256,14 +1246,11 @@ int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); | |||
1256 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); | 1246 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); |
1257 | void ide_retry_pc(ide_drive_t *, struct gendisk *); | 1247 | void ide_retry_pc(ide_drive_t *, struct gendisk *); |
1258 | 1248 | ||
1259 | static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) | 1249 | int ide_cd_expiry(ide_drive_t *); |
1260 | { | ||
1261 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); | ||
1262 | } | ||
1263 | 1250 | ||
1264 | int ide_scsi_expiry(ide_drive_t *); | 1251 | int ide_cd_get_xferlen(struct request *); |
1265 | 1252 | ||
1266 | ide_startstop_t ide_issue_pc(ide_drive_t *, unsigned int, ide_expiry_t *); | 1253 | ide_startstop_t ide_issue_pc(ide_drive_t *); |
1267 | 1254 | ||
1268 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 1255 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); |
1269 | 1256 | ||
@@ -1285,6 +1272,26 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | |||
1285 | 1272 | ||
1286 | extern void ide_timer_expiry(unsigned long); | 1273 | extern void ide_timer_expiry(unsigned long); |
1287 | extern irqreturn_t ide_intr(int irq, void *dev_id); | 1274 | extern irqreturn_t ide_intr(int irq, void *dev_id); |
1275 | |||
1276 | static inline int ide_lock_hwgroup(ide_hwgroup_t *hwgroup) | ||
1277 | { | ||
1278 | if (hwgroup->busy) | ||
1279 | return 1; | ||
1280 | |||
1281 | hwgroup->busy = 1; | ||
1282 | /* for atari only */ | ||
1283 | ide_get_lock(ide_intr, hwgroup); | ||
1284 | |||
1285 | return 0; | ||
1286 | } | ||
1287 | |||
1288 | static inline void ide_unlock_hwgroup(ide_hwgroup_t *hwgroup) | ||
1289 | { | ||
1290 | /* for atari only */ | ||
1291 | ide_release_lock(); | ||
1292 | hwgroup->busy = 0; | ||
1293 | } | ||
1294 | |||
1288 | extern void do_ide_request(struct request_queue *); | 1295 | extern void do_ide_request(struct request_queue *); |
1289 | 1296 | ||
1290 | void ide_init_disk(struct gendisk *, ide_drive_t *); | 1297 | void ide_init_disk(struct gendisk *, ide_drive_t *); |
@@ -1376,8 +1383,8 @@ enum { | |||
1376 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), | 1383 | IDE_HFLAG_LEGACY_IRQS = (1 << 21), |
1377 | /* force use of legacy IRQs */ | 1384 | /* force use of legacy IRQs */ |
1378 | IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), | 1385 | IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), |
1379 | /* limit LBA48 requests to 256 sectors */ | 1386 | /* host is TRM290 */ |
1380 | IDE_HFLAG_RQSIZE_256 = (1 << 23), | 1387 | IDE_HFLAG_TRM290 = (1 << 23), |
1381 | /* use 32-bit I/O ops */ | 1388 | /* use 32-bit I/O ops */ |
1382 | IDE_HFLAG_IO_32BIT = (1 << 24), | 1389 | IDE_HFLAG_IO_32BIT = (1 << 24), |
1383 | /* unmask IRQs */ | 1390 | /* unmask IRQs */ |
@@ -1415,6 +1422,9 @@ struct ide_port_info { | |||
1415 | 1422 | ||
1416 | ide_pci_enablebit_t enablebits[2]; | 1423 | ide_pci_enablebit_t enablebits[2]; |
1417 | hwif_chipset_t chipset; | 1424 | hwif_chipset_t chipset; |
1425 | |||
1426 | u16 max_sectors; /* if < than the default one */ | ||
1427 | |||
1418 | u32 host_flags; | 1428 | u32 host_flags; |
1419 | u8 pio_mask; | 1429 | u8 pio_mask; |
1420 | u8 swdma_mask; | 1430 | u8 swdma_mask; |
@@ -1528,6 +1538,7 @@ void ide_unregister_region(struct gendisk *); | |||
1528 | void ide_undecoded_slave(ide_drive_t *); | 1538 | void ide_undecoded_slave(ide_drive_t *); |
1529 | 1539 | ||
1530 | void ide_port_apply_params(ide_hwif_t *); | 1540 | void ide_port_apply_params(ide_hwif_t *); |
1541 | int ide_sysfs_register_port(ide_hwif_t *); | ||
1531 | 1542 | ||
1532 | struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); | 1543 | struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); |
1533 | void ide_host_free(struct ide_host *); | 1544 | void ide_host_free(struct ide_host *); |
@@ -1610,18 +1621,21 @@ extern struct mutex ide_cfg_mtx; | |||
1610 | /* | 1621 | /* |
1611 | * Structure locking: | 1622 | * Structure locking: |
1612 | * | 1623 | * |
1613 | * ide_cfg_mtx and ide_lock together protect changes to | 1624 | * ide_cfg_mtx and hwgroup->lock together protect changes to |
1614 | * ide_hwif_t->{next,hwgroup} | 1625 | * ide_hwif_t->next |
1615 | * ide_drive_t->next | 1626 | * ide_drive_t->next |
1616 | * | 1627 | * |
1617 | * ide_hwgroup_t->busy: ide_lock | 1628 | * ide_hwgroup_t->busy: hwgroup->lock |
1618 | * ide_hwgroup_t->hwif: ide_lock | 1629 | * ide_hwgroup_t->hwif: hwgroup->lock |
1619 | * ide_hwif_t->mate: constant, no locking | 1630 | * ide_hwif_t->{hwgroup,mate}: constant, no locking |
1620 | * ide_drive_t->hwif: constant, no locking | 1631 | * ide_drive_t->hwif: constant, no locking |
1621 | */ | 1632 | */ |
1622 | 1633 | ||
1623 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) | 1634 | #define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) |
1624 | 1635 | ||
1636 | char *ide_media_string(ide_drive_t *); | ||
1637 | |||
1638 | extern struct device_attribute ide_dev_attrs[]; | ||
1625 | extern struct bus_type ide_bus_type; | 1639 | extern struct bus_type ide_bus_type; |
1626 | extern struct class *ide_port_class; | 1640 | extern struct class *ide_port_class; |
1627 | 1641 | ||