aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:32:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:32:18 -0500
commit2640c9a90fa596871e142f42052608864335f102 (patch)
treebf0fb0e59b324963d650a7e82f83c1a4f993aa69 /include
parent80618fa83a34a26199fa99cfd06476a81ddf57df (diff)
parentb16aabc9374217fa2d28e72fd9a6e6d60905e1b9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (32 commits) ide-atapi: start dma in a drive-specific way ide-atapi: put the rest of non-ide-cd code into the else-clause of ide_transfer_pc ide-atapi: remove timeout arg to ide_issue_pc ide-cd: remove handler wrappers ide-cd: remove xferlen arg to cdrom_start_packet_command ide-atapi: split drive-specific functionality in ide_issue_pc ide-atapi: assign expiry and timeout based on device type ide-atapi: compute cmd_len based on device type in ide_transfer_pc ide: remove the last ide-scsi remnants ide-atapi: remove ide-scsi remnants from ide_pc_intr() ide-atapi: remove ide-scsi remnants from ide_transfer_pc() ide-atapi: remove ide-scsi remnants from ide_issue_pc ide-cd: move cdrom_timer_expiry to ide-atapi.c ide-atapi: teach ide atapi about drive->waiting_for_dma ide-atapi: accomodate transfer length calculation for ide-cd ide-atapi: setup dma for ide-cd ide-atapi: combine drive-specific assignments ide-atapi: add a dev_is_idecd-inline remove ide-scsi ide-floppy: allocate only toplevel packet commands ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/ide.h121
1 files changed, 65 insertions, 56 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e99c56de7f56..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
42typedef unsigned char byte; /* used everywhere */ 35typedef unsigned char byte; /* used everywhere */
43 36
44/* 37/*
@@ -403,6 +396,7 @@ enum {
403 * 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).
404 */ 397 */
405#define IDE_PC_BUFFER_SIZE 256 398#define IDE_PC_BUFFER_SIZE 256
399#define ATAPI_WAIT_PC (60 * HZ)
406 400
407struct ide_atapi_pc { 401struct ide_atapi_pc {
408 /* actual packet bytes */ 402 /* actual packet bytes */
@@ -480,53 +474,53 @@ enum {
480 474
481 /* ide-cd */ 475 /* ide-cd */
482 /* Drive cannot eject the disc. */ 476 /* Drive cannot eject the disc. */
483 IDE_AFLAG_NO_EJECT = (1 << 3), 477 IDE_AFLAG_NO_EJECT = (1 << 1),
484 /* Drive is a pre ATAPI 1.2 drive. */ 478 /* Drive is a pre ATAPI 1.2 drive. */
485 IDE_AFLAG_PRE_ATAPI12 = (1 << 4), 479 IDE_AFLAG_PRE_ATAPI12 = (1 << 2),
486 /* TOC addresses are in BCD. */ 480 /* TOC addresses are in BCD. */
487 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 5), 481 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3),
488 /* TOC track numbers are in BCD. */ 482 /* TOC track numbers are in BCD. */
489 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 6), 483 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4),
490 /* 484 /*
491 * Drive does not provide data in multiples of SECTOR_SIZE 485 * Drive does not provide data in multiples of SECTOR_SIZE
492 * when more than one interrupt is needed. 486 * when more than one interrupt is needed.
493 */ 487 */
494 IDE_AFLAG_LIMIT_NFRAMES = (1 << 7), 488 IDE_AFLAG_LIMIT_NFRAMES = (1 << 5),
495 /* Saved TOC information is current. */ 489 /* Saved TOC information is current. */
496 IDE_AFLAG_TOC_VALID = (1 << 9), 490 IDE_AFLAG_TOC_VALID = (1 << 6),
497 /* We think that the drive door is locked. */ 491 /* We think that the drive door is locked. */
498 IDE_AFLAG_DOOR_LOCKED = (1 << 10), 492 IDE_AFLAG_DOOR_LOCKED = (1 << 7),
499 /* SET_CD_SPEED command is unsupported. */ 493 /* SET_CD_SPEED command is unsupported. */
500 IDE_AFLAG_NO_SPEED_SELECT = (1 << 11), 494 IDE_AFLAG_NO_SPEED_SELECT = (1 << 8),
501 IDE_AFLAG_VERTOS_300_SSD = (1 << 12), 495 IDE_AFLAG_VERTOS_300_SSD = (1 << 9),
502 IDE_AFLAG_VERTOS_600_ESD = (1 << 13), 496 IDE_AFLAG_VERTOS_600_ESD = (1 << 10),
503 IDE_AFLAG_SANYO_3CD = (1 << 14), 497 IDE_AFLAG_SANYO_3CD = (1 << 11),
504 IDE_AFLAG_FULL_CAPS_PAGE = (1 << 15), 498 IDE_AFLAG_FULL_CAPS_PAGE = (1 << 12),
505 IDE_AFLAG_PLAY_AUDIO_OK = (1 << 16), 499 IDE_AFLAG_PLAY_AUDIO_OK = (1 << 13),
506 IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17), 500 IDE_AFLAG_LE_SPEED_FIELDS = (1 << 14),
507 501
508 /* ide-floppy */ 502 /* ide-floppy */
509 /* Avoid commands not supported in Clik drive */ 503 /* Avoid commands not supported in Clik drive */
510 IDE_AFLAG_CLIK_DRIVE = (1 << 19), 504 IDE_AFLAG_CLIK_DRIVE = (1 << 15),
511 /* Requires BH algorithm for packets */ 505 /* Requires BH algorithm for packets */
512 IDE_AFLAG_ZIP_DRIVE = (1 << 20), 506 IDE_AFLAG_ZIP_DRIVE = (1 << 16),
513 /* Supports format progress report */ 507 /* Supports format progress report */
514 IDE_AFLAG_SRFP = (1 << 22), 508 IDE_AFLAG_SRFP = (1 << 17),
515 509
516 /* ide-tape */ 510 /* ide-tape */
517 IDE_AFLAG_IGNORE_DSC = (1 << 23), 511 IDE_AFLAG_IGNORE_DSC = (1 << 18),
518 /* 0 When the tape position is unknown */ 512 /* 0 When the tape position is unknown */
519 IDE_AFLAG_ADDRESS_VALID = (1 << 24), 513 IDE_AFLAG_ADDRESS_VALID = (1 << 19),
520 /* Device already opened */ 514 /* Device already opened */
521 IDE_AFLAG_BUSY = (1 << 25), 515 IDE_AFLAG_BUSY = (1 << 20),
522 /* Attempt to auto-detect the current user block size */ 516 /* Attempt to auto-detect the current user block size */
523 IDE_AFLAG_DETECT_BS = (1 << 26), 517 IDE_AFLAG_DETECT_BS = (1 << 21),
524 /* Currently on a filemark */ 518 /* Currently on a filemark */
525 IDE_AFLAG_FILEMARK = (1 << 27), 519 IDE_AFLAG_FILEMARK = (1 << 22),
526 /* 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 */
527 IDE_AFLAG_MEDIUM_PRESENT = (1 << 28), 521 IDE_AFLAG_MEDIUM_PRESENT = (1 << 23),
528 522
529 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), 523 IDE_AFLAG_NO_AUTOCLOSE = (1 << 24),
530}; 524};
531 525
532/* device flags */ 526/* device flags */
@@ -565,28 +559,26 @@ enum {
565 IDE_DFLAG_NODMA = (1 << 16), 559 IDE_DFLAG_NODMA = (1 << 16),
566 /* powermanagment told us not to do anything, so sleep nicely */ 560 /* powermanagment told us not to do anything, so sleep nicely */
567 IDE_DFLAG_BLOCKED = (1 << 17), 561 IDE_DFLAG_BLOCKED = (1 << 17),
568 /* ide-scsi emulation */
569 IDE_DFLAG_SCSI = (1 << 18),
570 /* sleeping & sleep field valid */ 562 /* sleeping & sleep field valid */
571 IDE_DFLAG_SLEEPING = (1 << 19), 563 IDE_DFLAG_SLEEPING = (1 << 18),
572 IDE_DFLAG_POST_RESET = (1 << 20), 564 IDE_DFLAG_POST_RESET = (1 << 19),
573 IDE_DFLAG_UDMA33_WARNED = (1 << 21), 565 IDE_DFLAG_UDMA33_WARNED = (1 << 20),
574 IDE_DFLAG_LBA48 = (1 << 22), 566 IDE_DFLAG_LBA48 = (1 << 21),
575 /* status of write cache */ 567 /* status of write cache */
576 IDE_DFLAG_WCACHE = (1 << 23), 568 IDE_DFLAG_WCACHE = (1 << 22),
577 /* used for ignoring ATA_DF */ 569 /* used for ignoring ATA_DF */
578 IDE_DFLAG_NOWERR = (1 << 24), 570 IDE_DFLAG_NOWERR = (1 << 23),
579 /* retrying in PIO */ 571 /* retrying in PIO */
580 IDE_DFLAG_DMA_PIO_RETRY = (1 << 25), 572 IDE_DFLAG_DMA_PIO_RETRY = (1 << 24),
581 IDE_DFLAG_LBA = (1 << 26), 573 IDE_DFLAG_LBA = (1 << 25),
582 /* don't unload heads */ 574 /* don't unload heads */
583 IDE_DFLAG_NO_UNLOAD = (1 << 27), 575 IDE_DFLAG_NO_UNLOAD = (1 << 26),
584 /* heads unloaded, please don't reset port */ 576 /* heads unloaded, please don't reset port */
585 IDE_DFLAG_PARKED = (1 << 28), 577 IDE_DFLAG_PARKED = (1 << 27),
586 IDE_DFLAG_MEDIA_CHANGED = (1 << 29), 578 IDE_DFLAG_MEDIA_CHANGED = (1 << 28),
587 /* write protect */ 579 /* write protect */
588 IDE_DFLAG_WP = (1 << 30), 580 IDE_DFLAG_WP = (1 << 29),
589 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 31), 581 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30),
590}; 582};
591 583
592struct ide_drive_s { 584struct ide_drive_s {
@@ -610,8 +602,6 @@ struct ide_drive_s {
610 unsigned long dev_flags; 602 unsigned long dev_flags;
611 603
612 unsigned long sleep; /* sleep until this time */ 604 unsigned long sleep; /* sleep until this time */
613 unsigned long service_start; /* time we started last request */
614 unsigned long service_time; /* service time of last request */
615 unsigned long timeout; /* max time to wait for irq */ 605 unsigned long timeout; /* max time to wait for irq */
616 606
617 special_t special; /* special action flags */ 607 special_t special; /* special action flags */
@@ -879,8 +869,6 @@ typedef struct hwgroup_s {
879 869
880 /* BOOL: protects all fields below */ 870 /* BOOL: protects all fields below */
881 volatile int busy; 871 volatile int busy;
882 /* BOOL: wake us up on timer expiry */
883 unsigned int sleeping : 1;
884 /* BOOL: polling active & poll_timeout field valid */ 872 /* BOOL: polling active & poll_timeout field valid */
885 unsigned int polling : 1; 873 unsigned int polling : 1;
886 874
@@ -1258,14 +1246,11 @@ int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
1258void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); 1246void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *);
1259void ide_retry_pc(ide_drive_t *, struct gendisk *); 1247void ide_retry_pc(ide_drive_t *, struct gendisk *);
1260 1248
1261static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) 1249int ide_cd_expiry(ide_drive_t *);
1262{
1263 return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies);
1264}
1265 1250
1266int ide_scsi_expiry(ide_drive_t *); 1251int ide_cd_get_xferlen(struct request *);
1267 1252
1268ide_startstop_t ide_issue_pc(ide_drive_t *, unsigned int, ide_expiry_t *); 1253ide_startstop_t ide_issue_pc(ide_drive_t *);
1269 1254
1270ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1255ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1271 1256
@@ -1287,6 +1272,26 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1287 1272
1288extern void ide_timer_expiry(unsigned long); 1273extern void ide_timer_expiry(unsigned long);
1289extern irqreturn_t ide_intr(int irq, void *dev_id); 1274extern irqreturn_t ide_intr(int irq, void *dev_id);
1275
1276static 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
1288static inline void ide_unlock_hwgroup(ide_hwgroup_t *hwgroup)
1289{
1290 /* for atari only */
1291 ide_release_lock();
1292 hwgroup->busy = 0;
1293}
1294
1290extern void do_ide_request(struct request_queue *); 1295extern void do_ide_request(struct request_queue *);
1291 1296
1292void ide_init_disk(struct gendisk *, ide_drive_t *); 1297void ide_init_disk(struct gendisk *, ide_drive_t *);
@@ -1533,6 +1538,7 @@ void ide_unregister_region(struct gendisk *);
1533void ide_undecoded_slave(ide_drive_t *); 1538void ide_undecoded_slave(ide_drive_t *);
1534 1539
1535void ide_port_apply_params(ide_hwif_t *); 1540void ide_port_apply_params(ide_hwif_t *);
1541int ide_sysfs_register_port(ide_hwif_t *);
1536 1542
1537struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); 1543struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
1538void ide_host_free(struct ide_host *); 1544void ide_host_free(struct ide_host *);
@@ -1627,6 +1633,9 @@ extern struct mutex ide_cfg_mtx;
1627 1633
1628#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)
1629 1635
1636char *ide_media_string(ide_drive_t *);
1637
1638extern struct device_attribute ide_dev_attrs[];
1630extern struct bus_type ide_bus_type; 1639extern struct bus_type ide_bus_type;
1631extern struct class *ide_port_class; 1640extern struct class *ide_port_class;
1632 1641