aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:36 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:36 -0400
commit97100fc816badbbc162644cfde7ad39ae9211fb4 (patch)
tree904faf5453c2dea32fa3fde5fda230118f3effda /include/linux/ide.h
parentbe3c096ebdbe3c828aacb5473751a22840753eff (diff)
ide: add device flags
Add 'unsigned long dev_flags' to ide_drive_t and convert bitfields to IDE_DFLAG_* flags. While at it: - IDE_DFLAG_ADDRESSING -> IDE_DFLAG_LBA48 - fixup some comments - remove needless g->flags zeroing from ide*_probe() There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h100
1 files changed, 73 insertions, 27 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 90d53c99fe92..b538d2e6dcbb 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -459,6 +459,55 @@ enum {
459 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), 459 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29),
460}; 460};
461 461
462/* device flags */
463enum {
464 /* restore settings after device reset */
465 IDE_DFLAG_KEEP_SETTINGS = (1 << 0),
466 /* device is using DMA for read/write */
467 IDE_DFLAG_USING_DMA = (1 << 1),
468 /* okay to unmask other IRQs */
469 IDE_DFLAG_UNMASK = (1 << 2),
470 /* don't attempt flushes */
471 IDE_DFLAG_NOFLUSH = (1 << 3),
472 /* DSC overlap */
473 IDE_DFLAG_DSC_OVERLAP = (1 << 4),
474 /* give potential excess bandwidth */
475 IDE_DFLAG_NICE1 = (1 << 5),
476 /* device is physically present */
477 IDE_DFLAG_PRESENT = (1 << 6),
478 /* device ejected hint */
479 IDE_DFLAG_DEAD = (1 << 7),
480 /* id read from device (synthetic if not set) */
481 IDE_DFLAG_ID_READ = (1 << 8),
482 IDE_DFLAG_NOPROBE = (1 << 9),
483 /* need to do check_media_change() */
484 IDE_DFLAG_REMOVABLE = (1 << 10),
485 /* needed for removable devices */
486 IDE_DFLAG_ATTACH = (1 << 11),
487 IDE_DFLAG_FORCED_GEOM = (1 << 12),
488 /* disallow setting unmask bit */
489 IDE_DFLAG_NO_UNMASK = (1 << 13),
490 /* disallow enabling 32-bit I/O */
491 IDE_DFLAG_NO_IO_32BIT = (1 << 14),
492 /* for removable only: door lock/unlock works */
493 IDE_DFLAG_DOORLOCKING = (1 << 15),
494 /* disallow DMA */
495 IDE_DFLAG_NODMA = (1 << 16),
496 /* powermanagment told us not to do anything, so sleep nicely */
497 IDE_DFLAG_BLOCKED = (1 << 17),
498 /* ide-scsi emulation */
499 IDE_DFLAG_SCSI = (1 << 18),
500 /* sleeping & sleep field valid */
501 IDE_DFLAG_SLEEPING = (1 << 19),
502 IDE_DFLAG_POST_RESET = (1 << 20),
503 IDE_DFLAG_UDMA33_WARNED = (1 << 21),
504 IDE_DFLAG_LBA48 = (1 << 22),
505 /* status of write cache */
506 IDE_DFLAG_WCACHE = (1 << 23),
507 /* used for ignoring ATA_DF */
508 IDE_DFLAG_NOWERR = (1 << 24),
509};
510
462struct ide_drive_s { 511struct ide_drive_s {
463 char name[4]; /* drive name, such as "hda" */ 512 char name[4]; /* drive name, such as "hda" */
464 char driver_req[10]; /* requests specific driver */ 513 char driver_req[10]; /* requests specific driver */
@@ -475,6 +524,8 @@ struct ide_drive_s {
475#endif 524#endif
476 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 525 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
477 526
527 unsigned long dev_flags;
528
478 unsigned long sleep; /* sleep until this time */ 529 unsigned long sleep; /* sleep until this time */
479 unsigned long service_start; /* time we started last request */ 530 unsigned long service_start; /* time we started last request */
480 unsigned long service_time; /* service time of last request */ 531 unsigned long service_time; /* service time of last request */
@@ -487,32 +538,6 @@ struct ide_drive_s {
487 u8 state; /* retry state */ 538 u8 state; /* retry state */
488 u8 waiting_for_dma; /* dma currently in progress */ 539 u8 waiting_for_dma; /* dma currently in progress */
489 540
490 unsigned keep_settings : 1; /* restore settings after drive reset */
491 unsigned using_dma : 1; /* disk is using dma for read/write */
492 unsigned unmask : 1; /* okay to unmask other irqs */
493 unsigned noflush : 1; /* don't attempt flushes */
494 unsigned dsc_overlap : 1; /* DSC overlap */
495 unsigned nice1 : 1; /* give potential excess bandwidth */
496 unsigned present : 1; /* drive is physically present */
497 unsigned dead : 1; /* device ejected hint */
498 unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */
499 unsigned noprobe : 1; /* from: hdx=noprobe */
500 unsigned removable : 1; /* 1 if need to do check_media_change */
501 unsigned attach : 1; /* needed for removable devices */
502 unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
503 unsigned no_unmask : 1; /* disallow setting unmask bit */
504 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
505 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
506 unsigned nodma : 1; /* disallow DMA */
507 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
508 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */
509 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */
510 unsigned post_reset : 1;
511 unsigned udma33_warned : 1;
512 unsigned addressing : 1; /* 0=28-bit, 1=48-bit */
513 unsigned wcache : 1; /* status of write cache */
514 unsigned nowerr : 1; /* used for ignoring ATA_DF */
515
516 u8 quirk_list; /* considered quirky, set for a specific host */ 541 u8 quirk_list; /* considered quirky, set for a specific host */
517 u8 init_speed; /* transfer rate set at boot */ 542 u8 init_speed; /* transfer rate set at boot */
518 u8 current_speed; /* current transfer rate set */ 543 u8 current_speed; /* current transfer rate set */
@@ -826,6 +851,22 @@ static int set_##name(ide_drive_t *drive, int arg) \
826 return 0; \ 851 return 0; \
827} 852}
828 853
854#define ide_devset_get_flag(name, flag) \
855static int get_##name(ide_drive_t *drive) \
856{ \
857 return !!(drive->dev_flags & flag); \
858}
859
860#define ide_devset_set_flag(name, flag) \
861static int set_##name(ide_drive_t *drive, int arg) \
862{ \
863 if (arg) \
864 drive->dev_flags |= flag; \
865 else \
866 drive->dev_flags &= ~flag; \
867 return 0; \
868}
869
829#define __IDE_DEVSET(_name, _flags, _get, _set) \ 870#define __IDE_DEVSET(_name, _flags, _get, _set) \
830const struct ide_devset ide_devset_##_name = \ 871const struct ide_devset ide_devset_##_name = \
831 __DEVSET(_flags, _get, _set) 872 __DEVSET(_flags, _get, _set)
@@ -861,6 +902,11 @@ ide_devset_get(_name, _field); \
861ide_devset_set(_name, _field); \ 902ide_devset_set(_name, _field); \
862IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) 903IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
863 904
905#define ide_devset_rw_flag(_name, _field) \
906ide_devset_get_flag(_name, _field); \
907ide_devset_set_flag(_name, _field); \
908IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
909
864struct ide_proc_devset { 910struct ide_proc_devset {
865 const char *name; 911 const char *name;
866 const struct ide_devset *setting; 912 const struct ide_devset *setting;
@@ -1587,6 +1633,6 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1587{ 1633{
1588 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1]; 1634 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1];
1589 1635
1590 return peer->present ? peer : NULL; 1636 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1591} 1637}
1592#endif /* _IDE_H */ 1638#endif /* _IDE_H */