]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/ide.h
ide: factor out debugging code from ide_tf_load()
[linux-2.6-omap-h63xx.git] / include / linux / ide.h
index a1f290d59fb49aa95a7bd5b5b88d039bf8334bff..d7d8bb69db4b08ff9b821590b0175ac7927db409 100644 (file)
@@ -61,23 +61,30 @@ typedef unsigned char       byte;   /* used everywhere */
  */
 #define IDE_NR_PORTS           (10)
 
-#define IDE_DATA_OFFSET                (0)
-#define IDE_ERROR_OFFSET       (1)
-#define IDE_NSECTOR_OFFSET     (2)
-#define IDE_SECTOR_OFFSET      (3)
-#define IDE_LCYL_OFFSET                (4)
-#define IDE_HCYL_OFFSET                (5)
-#define IDE_SELECT_OFFSET      (6)
-#define IDE_STATUS_OFFSET      (7)
-#define IDE_CONTROL_OFFSET     (8)
-#define IDE_IRQ_OFFSET         (9)
-
-#define IDE_FEATURE_OFFSET     IDE_ERROR_OFFSET
-#define IDE_COMMAND_OFFSET     IDE_STATUS_OFFSET
-#define IDE_ALTSTATUS_OFFSET   IDE_CONTROL_OFFSET
-#define IDE_IREASON_OFFSET     IDE_NSECTOR_OFFSET
-#define IDE_BCOUNTL_OFFSET     IDE_LCYL_OFFSET
-#define IDE_BCOUNTH_OFFSET     IDE_HCYL_OFFSET
+struct ide_io_ports {
+       unsigned long   data_addr;
+
+       union {
+               unsigned long error_addr;       /*   read:  error */
+               unsigned long feature_addr;     /*  write: feature */
+       };
+
+       unsigned long   nsect_addr;
+       unsigned long   lbal_addr;
+       unsigned long   lbam_addr;
+       unsigned long   lbah_addr;
+
+       unsigned long   device_addr;
+
+       union {
+               unsigned long status_addr;      /*  read: status  */
+               unsigned long command_addr;     /* write: command */
+       };
+
+       unsigned long   ctl_addr;
+
+       unsigned long   irq_addr;
+};
 
 #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
 #define BAD_R_STAT             (BUSY_STAT   | ERR_STAT)
@@ -156,7 +163,11 @@ typedef u8 hwif_chipset_t;
  * Structure to hold all information about the location of this port
  */
 typedef struct hw_regs_s {
-       unsigned long   io_ports[IDE_NR_PORTS]; /* task file registers */
+       union {
+               struct ide_io_ports     io_ports;
+               unsigned long           io_ports_array[IDE_NR_PORTS];
+       };
+
        int             irq;                    /* our irq number */
        ide_ack_intr_t  *ack_intr;              /* acknowledge interrupt */
        hwif_chipset_t  chipset;
@@ -172,10 +183,10 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
 {
        unsigned int i;
 
-       for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
-               hw->io_ports[i] = io_addr++;
+       for (i = 0; i <= 7; i++)
+               hw->io_ports_array[i] = io_addr++;
 
-       hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr;
+       hw->io_ports.ctl_addr = ctl_addr;
 }
 
 #include <asm/ide.h>
@@ -424,8 +435,8 @@ typedef struct hwif_s {
 
        char name[6];                   /* name of interface, eg. "ide0" */
 
-               /* task file registers for pata and sata */
-       unsigned long   io_ports[IDE_NR_PORTS];
+       struct ide_io_ports     io_ports;
+
        unsigned long   sata_scr[SATA_NR_PORTS];
 
        ide_drive_t     drives[MAX_DRIVES];     /* drive info */
@@ -456,24 +467,17 @@ typedef struct hwif_s {
        const struct ide_port_ops       *port_ops;
        const struct ide_dma_ops        *dma_ops;
 
-       void (*ata_input_data)(ide_drive_t *, void *, u32);
-       void (*ata_output_data)(ide_drive_t *, void *, u32);
-
-       void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
-       void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
+       void (*input_data)(ide_drive_t *, struct request *, void *, unsigned);
+       void (*output_data)(ide_drive_t *, struct request *, void *, unsigned);
 
        void (*ide_dma_clear_irq)(ide_drive_t *drive);
 
        void (*OUTB)(u8 addr, unsigned long port);
        void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port);
        void (*OUTW)(u16 addr, unsigned long port);
-       void (*OUTSW)(unsigned long port, void *addr, u32 count);
-       void (*OUTSL)(unsigned long port, void *addr, u32 count);
 
        u8  (*INB)(unsigned long port);
        u16 (*INW)(unsigned long port);
-       void (*INSW)(unsigned long port, void *addr, u32 count);
-       void (*INSL)(unsigned long port, void *addr, u32 count);
 
        /* dma physical region descriptor table (cpu view) */
        unsigned int    *dmatable_cpu;
@@ -536,7 +540,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
 typedef int (ide_expiry_t)(ide_drive_t *);
 
 /* used by ide-cd, ide-floppy, etc. */
-typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
+typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);
 
 typedef struct hwgroup_s {
                /* irq handler, if active */
@@ -694,10 +698,6 @@ void ide_add_generic_settings(ide_drive_t *);
 read_proc_t proc_ide_read_capacity;
 read_proc_t proc_ide_read_geometry;
 
-#ifdef CONFIG_BLK_DEV_IDEPCI
-void ide_pci_create_host_proc(const char *, get_info_t *);
-#endif
-
 /*
  * Standard exit stuff:
  */
@@ -822,6 +822,8 @@ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigne
 void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
                         ide_expiry_t *);
 
+void ide_execute_pkt_cmd(ide_drive_t *);
+
 ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
 
 ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
@@ -958,6 +960,8 @@ typedef struct ide_task_s {
        void                    *special;       /* valid_t generally */
 } ide_task_t;
 
+void ide_tf_dump(const char *, struct ide_taskfile *);
+
 void ide_tf_load(ide_drive_t *, ide_task_t *);
 void ide_tf_read(ide_drive_t *, ide_task_t *);
 
@@ -1065,6 +1069,8 @@ enum {
        IDE_HFLAG_NO_DMA                = (1 << 14),
        /* check if host is PCI IDE device before allowing DMA */
        IDE_HFLAG_NO_AUTODMA            = (1 << 15),
+       /* host uses MMIO */
+       IDE_HFLAG_MMIO                  = (1 << 16),
        /* host is CS5510/CS5520 */
        IDE_HFLAG_CS5520                = IDE_HFLAG_VDMA,
        /* no LBA48 */
@@ -1210,7 +1216,7 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
 #endif
 
 void ide_remove_port_from_hwgroup(ide_hwif_t *);
-void ide_unregister(unsigned int);
+void ide_unregister(ide_hwif_t *);
 
 void ide_register_region(struct gendisk *);
 void ide_unregister_region(struct gendisk *);
@@ -1330,29 +1336,28 @@ static inline void ide_set_irq(ide_drive_t *drive, int on)
 {
        ide_hwif_t *hwif = drive->hwif;
 
-       hwif->OUTB(drive->ctl | (on ? 0 : 2),
-                  hwif->io_ports[IDE_CONTROL_OFFSET]);
+       hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr);
 }
 
 static inline u8 ide_read_status(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
 
-       return hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]);
+       return hwif->INB(hwif->io_ports.status_addr);
 }
 
 static inline u8 ide_read_altstatus(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
 
-       return hwif->INB(hwif->io_ports[IDE_CONTROL_OFFSET]);
+       return hwif->INB(hwif->io_ports.ctl_addr);
 }
 
 static inline u8 ide_read_error(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
 
-       return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]);
+       return hwif->INB(hwif->io_ports.error_addr);
 }
 
 /*
@@ -1363,18 +1368,18 @@ static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount)
 {
        ide_hwif_t *hwif = drive->hwif;
 
-       /* FIXME: use ->atapi_input_bytes */
+       /* FIXME: use ->input_data */
        while (bcount--)
-               (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]);
+               (void)hwif->INB(hwif->io_ports.data_addr);
 }
 
 static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount)
 {
        ide_hwif_t *hwif = drive->hwif;
 
-       /* FIXME: use ->atapi_output_bytes */
+       /* FIXME: use ->output_data */
        while (bcount--)
-               hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]);
+               hwif->OUTB(0, hwif->io_ports.data_addr);
 }
 
 #endif /* _IDE_H */