]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/ide.h
ide: use per-device request queue locks (v2)
[karo-tx-linux.git] / include / linux / ide.h
index 010fb26a15796452b4382ad167e58cc4210e0c38..5f86ad40ee7eca179204263004254f57e9638d37 100644 (file)
 # define SUPPORT_VLB_SYNC 1
 #endif
 
-/*
- * Used to indicate "no IRQ", should be a value that cannot be an IRQ
- * number.
- */
-#define IDE_NO_IRQ             (-1)
-
 typedef unsigned char  byte;   /* used everywhere */
 
 /*
@@ -122,8 +115,6 @@ struct ide_io_ports {
 #define MAX_DRIVES     2       /* per interface; 2 assumed by lots of code */
 #define SECTOR_SIZE    512
 
-#define IDE_LARGE_SEEK(b1,b2,t)        (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
-
 /*
  * Timeouts for various operations:
  */
@@ -172,9 +163,7 @@ typedef int (ide_ack_intr_t)(struct hwif_s *);
 enum {         ide_unknown,    ide_generic,    ide_pci,
                ide_cmd640,     ide_dtc2278,    ide_ali14xx,
                ide_qd65xx,     ide_umc8672,    ide_ht6560b,
-               ide_rz1000,     ide_trm290,
-               ide_cmd646,     ide_cy82c693,   ide_4drives,
-               ide_pmac,       ide_acorn,
+               ide_4drives,    ide_pmac,       ide_acorn,
                ide_au1xxx,     ide_palm3710
 };
 
@@ -496,8 +485,6 @@ enum {
         * when more than one interrupt is needed.
         */
        IDE_AFLAG_LIMIT_NFRAMES         = (1 << 7),
-       /* Seeking in progress. */
-       IDE_AFLAG_SEEKING               = (1 << 8),
        /* Saved TOC information is current. */
        IDE_AFLAG_TOC_VALID             = (1 << 9),
        /* We think that the drive door is locked. */
@@ -616,8 +603,6 @@ struct ide_drive_s {
        unsigned long dev_flags;
 
        unsigned long sleep;            /* sleep until this time */
-       unsigned long service_start;    /* time we started last request */
-       unsigned long service_time;     /* service time of last request */
        unsigned long timeout;          /* max time to wait for irq */
 
        special_t       special;        /* special action flags */
@@ -845,8 +830,6 @@ typedef struct hwif_s {
        unsigned        extra_ports;    /* number of extra dma ports */
 
        unsigned        present    : 1; /* this interface exists */
-       unsigned        serialized : 1; /* serialized all channel operation */
-       unsigned        sharing_irq: 1; /* 1 = sharing irq with another hwif */
        unsigned        sg_mapped  : 1; /* sg_table and sg_nents are ready */
 
        struct device           gendev;
@@ -887,8 +870,6 @@ typedef struct hwgroup_s {
 
                /* BOOL: protects all fields below */
        volatile int busy;
-               /* BOOL: wake us up on timer expiry */
-       unsigned int sleeping   : 1;
                /* BOOL: polling active & poll_timeout field valid */
        unsigned int polling    : 1;
 
@@ -909,6 +890,8 @@ typedef struct hwgroup_s {
 
        int req_gen;
        int req_gen_timer;
+
+       spinlock_t lock;
 } ide_hwgroup_t;
 
 typedef struct ide_driver_s ide_driver_t;
@@ -1122,6 +1105,14 @@ enum {
        IDE_PM_COMPLETED,
 };
 
+int generic_ide_suspend(struct device *, pm_message_t);
+int generic_ide_resume(struct device *);
+
+void ide_complete_power_step(ide_drive_t *, struct request *);
+ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
+void ide_complete_pm_request(ide_drive_t *, struct request *);
+void ide_check_pm_state(ide_drive_t *, struct request *);
+
 /*
  * Subdrivers support.
  *
@@ -1285,6 +1276,26 @@ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
 
 extern void ide_timer_expiry(unsigned long);
 extern irqreturn_t ide_intr(int irq, void *dev_id);
+
+static inline int ide_lock_hwgroup(ide_hwgroup_t *hwgroup)
+{
+       if (hwgroup->busy)
+               return 1;
+
+       hwgroup->busy = 1;
+       /* for atari only */
+       ide_get_lock(ide_intr, hwgroup);
+
+       return 0;
+}
+
+static inline void ide_unlock_hwgroup(ide_hwgroup_t *hwgroup)
+{
+       /* for atari only */
+       ide_release_lock();
+       hwgroup->busy = 0;
+}
+
 extern void do_ide_request(struct request_queue *);
 
 void ide_init_disk(struct gendisk *, ide_drive_t *);
@@ -1376,8 +1387,8 @@ enum {
        IDE_HFLAG_LEGACY_IRQS           = (1 << 21),
        /* force use of legacy IRQs */
        IDE_HFLAG_FORCE_LEGACY_IRQS     = (1 << 22),
-       /* limit LBA48 requests to 256 sectors */
-       IDE_HFLAG_RQSIZE_256            = (1 << 23),
+       /* host is TRM290 */
+       IDE_HFLAG_TRM290                = (1 << 23),
        /* use 32-bit I/O ops */
        IDE_HFLAG_IO_32BIT              = (1 << 24),
        /* unmask IRQs */
@@ -1415,6 +1426,9 @@ struct ide_port_info {
 
        ide_pci_enablebit_t     enablebits[2];
        hwif_chipset_t          chipset;
+
+       u16                     max_sectors;    /* if < than the default one */
+
        u32                     host_flags;
        u8                      pio_mask;
        u8                      swdma_mask;
@@ -1528,6 +1542,7 @@ void ide_unregister_region(struct gendisk *);
 void ide_undecoded_slave(ide_drive_t *);
 
 void ide_port_apply_params(ide_hwif_t *);
+int ide_sysfs_register_port(ide_hwif_t *);
 
 struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
 void ide_host_free(struct ide_host *);
@@ -1610,18 +1625,21 @@ extern struct mutex ide_cfg_mtx;
 /*
  * Structure locking:
  *
- * ide_cfg_mtx and ide_lock together protect changes to
- * ide_hwif_t->{next,hwgroup}
+ * ide_cfg_mtx and hwgroup->lock together protect changes to
+ * ide_hwif_t->next
  * ide_drive_t->next
  *
- * ide_hwgroup_t->busy: ide_lock
- * ide_hwgroup_t->hwif: ide_lock
- * ide_hwif_t->mate: constant, no locking
+ * ide_hwgroup_t->busy: hwgroup->lock
+ * ide_hwgroup_t->hwif: hwgroup->lock
+ * ide_hwif_t->{hwgroup,mate}: constant, no locking
  * ide_drive_t->hwif: constant, no locking
  */
 
 #define local_irq_set(flags)   do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
 
+char *ide_media_string(ide_drive_t *);
+
+extern struct device_attribute ide_dev_attrs[];
 extern struct bus_type ide_bus_type;
 extern struct class *ide_port_class;