X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=include%2Flinux%2Fide.h;h=4ed4777bba67abcd5ecba17bb3c8c2ca19e999f9;hb=74eb94f7b84f4e631a0e020991fb16f17ce85ab7;hp=02a27e8cbad2b250becd2edeb7d3c40102ac40bd;hpb=f2e1d89f9b349b3cd914b7c6ec6368632f4ad048;p=linux-2.6-omap-h63xx.git diff --git a/include/linux/ide.h b/include/linux/ide.h index 02a27e8cbad..4ed4777bba6 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -192,22 +192,20 @@ typedef unsigned char byte; /* used everywhere */ struct hwif_s; typedef int (ide_ack_intr_t)(struct hwif_s *); -#ifndef NO_DMA -#define NO_DMA 255 -#endif - /* * hwif_chipset_t is used to keep track of the specific hardware * chipset used by each IDE interface, if known. */ -typedef enum { ide_unknown, ide_generic, ide_pci, +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_etrax100, ide_acorn, ide_au1xxx, ide_forced -} hwif_chipset_t; +}; + +typedef u8 hwif_chipset_t; /* * Structure to hold all information about the location of this port @@ -215,22 +213,16 @@ typedef enum { ide_unknown, ide_generic, ide_pci, typedef struct hw_regs_s { unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ int irq; /* our irq number */ - int dma; /* our dma entry */ ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ hwif_chipset_t chipset; struct device *dev; } hw_regs_t; -/* - * Register new hardware with ide - */ -int ide_register_hw(hw_regs_t *, int, struct hwif_s **); -int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **, - void (*)(struct hwif_s *)); +struct hwif_s * ide_find_port(unsigned long); + +int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, + struct hwif_s **); -/* - * Set up hw_regs_t structure before calling ide_register_hw (optional) - */ void ide_setup_ports( hw_regs_t *hw, unsigned long base, int *offsets, @@ -268,11 +260,7 @@ static inline void ide_std_init_ports(hw_regs_t *hw, # define ide_init_default_irq(base) (0) #endif -/* - * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series. - * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in . - */ -#ifdef IDE_ARCH_OBSOLETE_INIT +#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long io_addr, unsigned long ctl_addr, @@ -302,7 +290,7 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw, if (io_addr || ctl_addr) printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); } -#endif /* IDE_ARCH_OBSOLETE_INIT */ +#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */ /* Currently only m68k, apus and m8xx need it */ #ifndef IDE_ARCH_ACK_INTR @@ -363,7 +351,6 @@ typedef union { * ATA DATA Register Special. * ATA NSECTOR Count Register(). * ATAPI Byte Count Register. - * Channel index ordering pairs. */ typedef union { unsigned all :16; @@ -378,7 +365,7 @@ typedef union { #error "Please fix " #endif } b; -} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; +} ata_nsector_t, ata_data_t, atapi_bcount_t; /* * ATA-IDE Select Register, aka Device-Head @@ -576,7 +563,6 @@ typedef struct ide_drive_s { select_t select; /* basic drive/head select reg value */ u8 keep_settings; /* restore settings after drive reset */ - u8 autodma; /* device can safely use dma on host */ u8 using_dma; /* disk is using dma for read/write */ u8 retry_pio; /* retrying dma capable host in pio */ u8 state; /* retry state */ @@ -600,6 +586,7 @@ typedef struct ide_drive_s { unsigned nice0 : 1; /* give obvious excess bandwidth */ unsigned nice2 : 1; /* give a share in our own bandwidth */ unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ + unsigned nodma : 1; /* disallow DMA */ unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ 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 */ @@ -657,7 +644,7 @@ typedef struct ide_drive_s { ((1<> (c)) & 1) -struct ide_pci_device_s; +struct ide_port_info; typedef struct hwif_s { struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ @@ -672,7 +659,6 @@ typedef struct hwif_s { unsigned long sata_scr[SATA_NR_PORTS]; unsigned long sata_misc[SATA_NR_PORTS]; - hw_regs_t hw; /* Hardware info */ ide_drive_t drives[MAX_DRIVES]; /* drive info */ u8 major; /* our major number */ @@ -681,11 +667,10 @@ typedef struct hwif_s { u8 straight8; /* Alan's straight 8 check */ u8 bus_state; /* power state of the IDE bus */ - u16 host_flags; + u32 host_flags; u8 pio_mask; - u8 atapi_dma; /* host supports atapi_dma */ u8 ultra_mask; u8 mwdma_mask; u8 swdma_mask; @@ -695,7 +680,9 @@ typedef struct hwif_s { hwif_chipset_t chipset; /* sub-module for tuning.. */ struct pci_dev *pci_dev; /* for pci chipsets */ - struct ide_pci_device_s *cds; /* chipset device struct */ + const struct ide_port_info *cds; /* chipset device struct */ + + ide_ack_intr_t *ack_intr; void (*rw_disk)(ide_drive_t *, struct request *); @@ -726,6 +713,8 @@ typedef struct hwif_s { u8 (*mdma_filter)(ide_drive_t *); u8 (*udma_filter)(ide_drive_t *); + void (*fixup)(struct hwif_s *); + void (*ata_input_data)(ide_drive_t *, void *, u32); void (*ata_output_data)(ide_drive_t *, void *, u32); @@ -736,7 +725,6 @@ typedef struct hwif_s { void (*dma_exec_cmd)(ide_drive_t *, u8); void (*dma_start)(ide_drive_t *); int (*ide_dma_end)(ide_drive_t *drive); - int (*ide_dma_check)(ide_drive_t *drive); int (*ide_dma_on)(ide_drive_t *drive); void (*dma_off_quietly)(ide_drive_t *drive); int (*ide_dma_test_irq)(ide_drive_t *drive); @@ -772,7 +760,7 @@ typedef struct hwif_s { unsigned int nsect; unsigned int nleft; - unsigned int cursg; + struct scatterlist *cursg; unsigned int cursg_ofs; int rqsize; /* max sectors per request */ @@ -798,13 +786,9 @@ typedef struct hwif_s { unsigned serialized : 1; /* serialized all channel operation */ unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ unsigned reset : 1; /* reset after probe */ - unsigned autodma : 1; /* auto-attempt using DMA at boot */ - unsigned no_lba48 : 1; /* 1 = cannot do LBA48 */ - unsigned no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */ unsigned auto_poll : 1; /* supports nop auto-poll */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ - unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */ unsigned mmio : 1; /* host uses MMIO */ struct device gendev; @@ -847,8 +831,6 @@ typedef struct hwgroup_s { /* for pci chipsets */ struct pci_dev *pci_dev; - /* chipset device struct */ - struct ide_pci_device_s *cds; /* current request */ struct request *rq; @@ -1036,36 +1018,16 @@ extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, int uptodate, int nr_sectors); -/* - * This is used on exit from the driver to designate the next irq handler - * and also to start the safety timer. - */ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); -/* - * This is used on exit from the driver to designate the next irq handler - * and start the safety time safely and atomically from the IRQ handler - * with respect to the command issue (which it also does) - */ extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); -/* - * ide_error() takes action based on the error returned by the controller. - * The caller should return immediately after invoking this. - * - * (drive, msg, status) - */ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); ide_startstop_t __ide_abort(ide_drive_t *, struct request *); -/* - * Abort a running command on the controller triggering the abort - * from a host side, non error situation - * (drive, msg) - */ extern ide_startstop_t ide_abort(ide_drive_t *, const char *); extern void ide_fix_driveid(struct hd_driveid *); @@ -1081,22 +1043,10 @@ extern void ide_fixstring(u8 *, const int, const int); int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); -/* - * Start a reset operation for an IDE interface. - * The caller should return immediately after invoking this. - */ extern ide_startstop_t ide_do_reset (ide_drive_t *); -/* - * This function is intended to be used prior to invoking ide_do_drive_cmd(). - */ extern void ide_init_drive_cmd (struct request *rq); -/* - * this function returns error location sector offset in case of a write error - */ -extern u64 ide_get_error_location(ide_drive_t *, char *); - /* * "action" parameter type for ide_do_drive_cmd() below. */ @@ -1109,13 +1059,6 @@ typedef enum { extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); -/* - * Clean up after success/failure of an explicit drive cmd. - * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD). - * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK). - * - * (ide_drive_t *drive, u8 stat, u8 err) - */ extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); /* @@ -1188,10 +1131,6 @@ extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); -/* - * ide_stall_queue() can be used by a drive to give excess bandwidth back - * to the hwgroup by sleeping for timeout jiffies. - */ extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); extern int ide_spin_wait_hwgroup(ide_drive_t *); @@ -1211,26 +1150,13 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o #define ide_pci_register_driver(d) pci_register_driver(d) #endif -void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); -extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); +void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); +void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); extern void default_hwif_iops(ide_hwif_t *); extern void default_hwif_mmiops(ide_hwif_t *); extern void default_hwif_transport(ide_hwif_t *); -#define ON_BOARD 1 -#define NEVER_BOARD 0 - -#ifdef CONFIG_BLK_DEV_OFFBOARD -# define OFF_BOARD ON_BOARD -#else /* CONFIG_BLK_DEV_OFFBOARD */ -# define OFF_BOARD NEVER_BOARD -#endif /* CONFIG_BLK_DEV_OFFBOARD */ - -#define NODMA 0 -#define NOAUTODMA 1 -#define AUTODMA 2 - typedef struct ide_pci_enablebit_s { u8 reg; /* byte pci reg holding the enable-bit */ u8 mask; /* mask to isolate the enable-bit */ @@ -1261,29 +1187,65 @@ enum { IDE_HFLAG_POST_SET_MODE = (1 << 8), /* don't program host/device for the transfer mode ("smart" hosts) */ 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 */ + IDE_HFLAG_VDMA = (1 << 11), + /* ATAPI DMA is unsupported */ + IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), + /* set if host is a "bootable" controller */ + IDE_HFLAG_BOOTABLE = (1 << 13), + /* host doesn't support DMA */ + IDE_HFLAG_NO_DMA = (1 << 14), + /* check if host is PCI IDE device before allowing DMA */ + IDE_HFLAG_NO_AUTODMA = (1 << 15), + /* host is CS5510/CS5520 */ + IDE_HFLAG_CS5520 = (1 << 16), + /* no LBA48 */ + IDE_HFLAG_NO_LBA48 = (1 << 17), + /* no LBA48 DMA */ + IDE_HFLAG_NO_LBA48_DMA = (1 << 18), + /* data FIFO is cleared by an error */ + IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), + /* serialize ports */ + IDE_HFLAG_SERIALIZE = (1 << 20), + /* use legacy IRQs */ + 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), + /* use 32-bit I/O ops */ + IDE_HFLAG_IO_32BIT = (1 << 24), + /* unmask IRQs */ + IDE_HFLAG_UNMASK_IRQS = (1 << 25), }; -typedef struct ide_pci_device_s { +#ifdef CONFIG_BLK_DEV_OFFBOARD +# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE +#else +# define IDE_HFLAG_OFF_BOARD 0 +#endif + +struct ide_port_info { char *name; - int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *); - void (*init_setup_dma)(struct pci_dev *, struct ide_pci_device_s *, ide_hwif_t *); unsigned int (*init_chipset)(struct pci_dev *, const char *); void (*init_iops)(ide_hwif_t *); void (*init_hwif)(ide_hwif_t *); void (*init_dma)(ide_hwif_t *, unsigned long); void (*fixup)(ide_hwif_t *); - u8 autodma; ide_pci_enablebit_t enablebits[2]; - u8 bootable; + hwif_chipset_t chipset; unsigned int extra; - struct ide_pci_device_s *next; - u16 host_flags; + u32 host_flags; u8 pio_mask; + u8 swdma_mask; + u8 mwdma_mask; u8 udma_mask; -} ide_pci_device_t; +}; -extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); -extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *); +int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *); +int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *); void ide_map_sg(ide_drive_t *, struct request *); void ide_init_sg_cmd(ide_drive_t *, struct request *); @@ -1308,7 +1270,6 @@ static inline u8 ide_max_dma_mode(ide_drive_t *drive) return ide_find_dma_mode(drive, XFER_UDMA_6); } -int ide_tune_dma(ide_drive_t *); void ide_dma_off(ide_drive_t *); void ide_dma_verbose(ide_drive_t *); int ide_set_dma(ide_drive_t *); @@ -1335,7 +1296,6 @@ extern void ide_dma_timeout(ide_drive_t *); #else static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } -static inline int ide_tune_dma(ide_drive_t *drive) { return 0; } static inline void ide_dma_off(ide_drive_t *drive) { ; } static inline void ide_dma_verbose(ide_drive_t *drive) { ; } static inline int ide_set_dma(ide_drive_t *drive) { return 1; } @@ -1368,8 +1328,7 @@ void ide_unregister_region(struct gendisk *); void ide_undecoded_slave(ide_hwif_t *); -int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); -extern int probe_hwif_init(ide_hwif_t *); +int ide_device_add(u8 idx[4]); static inline void *ide_get_hwifdata (ide_hwif_t * hwif) { @@ -1385,7 +1344,6 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data) extern char *ide_xfer_verbose(u8 xfer_rate); extern void ide_toggle_bounce(ide_drive_t *drive, int on); extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); -int ide_use_fast_pio(ide_drive_t *); static inline int ide_dev_has_iordy(struct hd_driveid *id) { @@ -1460,4 +1418,11 @@ static inline int hwif_to_node(ide_hwif_t *hwif) return dev ? pcibus_to_node(dev->bus) : -1; } +static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) +{ + ide_hwif_t *hwif = HWIF(drive); + + return &hwif->drives[(drive->dn ^ 1) & 1]; +} + #endif /* _IDE_H */