Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[safe/jmp/linux-2.6] / include / linux / ide.h
index 78e5fca..9918772 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)
@@ -146,7 +153,7 @@ enum {              ide_unknown,    ide_generic,    ide_pci,
                ide_qd65xx,     ide_umc8672,    ide_ht6560b,
                ide_rz1000,     ide_trm290,
                ide_cmd646,     ide_cy82c693,   ide_4drives,
-               ide_pmac,       ide_etrax100,   ide_acorn,
+               ide_pmac,       ide_acorn,
                ide_au1xxx,     ide_palm3710
 };
 
@@ -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>
@@ -321,7 +332,6 @@ typedef struct ide_drive_s {
        unsigned atapi_overlap  : 1;    /* ATAPI overlap (not supported) */
        unsigned doorlocking    : 1;    /* for removable only: door lock/unlock works */
        unsigned nodma          : 1;    /* disallow DMA */
-       unsigned autotune       : 1;    /* 0=default, 1=autotune */
        unsigned remap_0_to_1   : 1;    /* 0=noremap, 1=remap 0->1 (for EZDrive) */
        unsigned blocked        : 1;    /* 1=powermanagment told us not to do anything, so sleep nicely */
        unsigned vdma           : 1;    /* 1=doing PIO over DMA 0=doing normal DMA */
@@ -417,6 +427,8 @@ struct ide_dma_ops {
        void    (*dma_timeout)(struct ide_drive_s *);
 };
 
+struct ide_task_s;
+
 typedef struct hwif_s {
        struct hwif_s *next;            /* for linked-list in ide_hwgroup_t */
        struct hwif_s *mate;            /* other hwif from same PCI chip */
@@ -425,8 +437,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 */
@@ -457,24 +469,18 @@ 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 (*tf_load)(ide_drive_t *, struct ide_task_s *);
+       void (*tf_read)(ide_drive_t *, struct ide_task_s *);
 
-       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;
@@ -499,10 +505,7 @@ typedef struct hwif_s {
 
        unsigned long   dma_base;       /* base addr for dma ports */
        unsigned long   dma_command;    /* dma command register */
-       unsigned long   dma_vendor1;    /* dma vendor 1 register */
        unsigned long   dma_status;     /* dma status register */
-       unsigned long   dma_vendor3;    /* dma vendor 3 register */
-       unsigned long   dma_prdtable;   /* actual prd table address */
 
        unsigned long   config_data;    /* for use by chipset-specific code */
        unsigned long   select_data;    /* for use by chipset-specific code */
@@ -537,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 */
@@ -695,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:
  */
@@ -799,8 +798,14 @@ int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsig
 #ifndef _IDE_C
 extern ide_hwif_t      ide_hwifs[];            /* master data repository */
 #endif
+extern int ide_noacpi;
+extern int ide_acpigtf;
+extern int ide_acpionboot;
 extern int noautodma;
 
+extern int ide_vlb_clk;
+extern int ide_pci_clk;
+
 ide_hwif_t *ide_find_port_slot(const struct ide_port_info *);
 
 static inline ide_hwif_t *ide_find_port(void)
@@ -817,6 +822,10 @@ 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 *);
+
+void ide_pad_transfer(ide_drive_t *, int, int);
+
 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);
@@ -953,11 +962,9 @@ typedef struct ide_task_s {
        void                    *special;       /* valid_t generally */
 } ide_task_t;
 
-void ide_tf_load(ide_drive_t *, ide_task_t *);
-void ide_tf_read(ide_drive_t *, ide_task_t *);
+void ide_tf_dump(const char *, struct ide_taskfile *);
 
 extern void SELECT_DRIVE(ide_drive_t *);
-extern void SELECT_MASK(ide_drive_t *, int);
 
 extern int drive_is_ready(ide_drive_t *);
 
@@ -1050,8 +1057,8 @@ enum {
        IDE_HFLAG_NO_SET_MODE           = (1 << 9),
        /* trust BIOS for programming chipset/device for DMA */
        IDE_HFLAG_TRUST_BIOS_FOR_DMA    = (1 << 10),
-       /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */
-       IDE_HFLAG_VDMA                  = (1 << 11),
+       /* host is CS5510/CS5520 */
+       IDE_HFLAG_CS5520                = (1 << 11),
        /* ATAPI DMA is unsupported */
        IDE_HFLAG_NO_ATAPI_DMA          = (1 << 12),
        /* set if host is a "non-bootable" controller */
@@ -1060,10 +1067,8 @@ enum {
        IDE_HFLAG_NO_DMA                = (1 << 14),
        /* check if host is PCI IDE device before allowing DMA */
        IDE_HFLAG_NO_AUTODMA            = (1 << 15),
-       /* don't autotune PIO */
-       IDE_HFLAG_NO_AUTOTUNE           = (1 << 16),
-       /* host is CS5510/CS5520 */
-       IDE_HFLAG_CS5520                = IDE_HFLAG_VDMA,
+       /* host uses MMIO */
+       IDE_HFLAG_MMIO                  = (1 << 16),
        /* no LBA48 */
        IDE_HFLAG_NO_LBA48              = (1 << 17),
        /* no LBA48 DMA */
@@ -1093,6 +1098,8 @@ enum {
        IDE_HFLAG_NO_IO_32BIT           = (1 << 30),
        /* never unmask IRQs */
        IDE_HFLAG_NO_UNMASK_IRQS        = (1 << 31),
+       /* host uses VDMA (disabled for now) */
+       IDE_HFLAG_VDMA                  = 0,
 };
 
 #ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1207,7 +1214,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 *);
@@ -1327,51 +1334,27 @@ 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]);
-}
-
-/*
- * Too bad. The drive wants to send us data which we are not ready to accept.
- * Just throw it away.
- */
-static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount)
-{
-       ide_hwif_t *hwif = drive->hwif;
-
-       /* FIXME: use ->atapi_input_bytes */
-       while (bcount--)
-               (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]);
+       return hwif->INB(hwif->io_ports.error_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 */
-       while (bcount--)
-               hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]);
-}
-
 #endif /* _IDE_H */