X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Flinux%2Fide.h;h=a8bef1d1371cc999ce6882d355c7554ca7738173;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=336d6e509f59df38c9588f8597f72232e8837693;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/include/linux/ide.h b/include/linux/ide.h index 336d6e509..a8bef1d13 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -18,22 +18,12 @@ #include #include #include +#include #include #include #include #include -/* - * This is the multiple IDE interface driver, as evolved from hd.c. - * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15). - * There can be up to two drives per interface, as per the ATA-2 spec. - * - * Primary i/f: ide0: major=3; (hda) minor=0; (hdb) minor=64 - * Secondary i/f: ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64 - * Tertiary i/f: ide2: major=33; (hde) minor=0; (hdf) minor=64 - * Quaternary i/f: ide3: major=34; (hdg) minor=0; (hdh) minor=64 - */ - /****************************************************************************** * IDE driver configuration options (play with these as desired): * @@ -193,11 +183,6 @@ typedef unsigned char byte; /* used everywhere */ #define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ -#define HOST(hwif,chipset) \ -{ \ - return ((hwif)->chipset == chipset) ? 1 : 0; \ -} - /* * Check for an interrupt and acknowledge the interrupt status */ @@ -218,7 +203,7 @@ typedef enum { ide_unknown, ide_generic, ide_pci, ide_rz1000, ide_trm290, ide_cmd646, ide_cy82c693, ide_4drives, ide_pmac, ide_etrax100, ide_acorn, - ide_forced + ide_au1xxx, ide_forced } hwif_chipset_t; /* @@ -230,6 +215,7 @@ typedef struct hw_regs_s { int dma; /* our dma entry */ ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ hwif_chipset_t chipset; + struct device *dev; } hw_regs_t; /* @@ -266,6 +252,10 @@ static inline void ide_std_init_ports(hw_regs_t *hw, #include +#ifndef MAX_HWIFS +#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS +#endif + /* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */ #ifndef IDE_ARCH_OBSOLETE_DEFAULTS # define ide_default_io_base(index) (0) @@ -385,45 +375,6 @@ typedef union { } b; } ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; -/* - * ATA-IDE Error Register - * - * mark : Bad address mark - * tzero : Couldn't find track 0 - * abrt : Aborted Command - * mcr : Media Change Request - * id : ID field not found - * mce : Media Change Event - * ecc : Uncorrectable ECC error - * bdd : dual meaing - */ -typedef union { - unsigned all :8; - struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned mark :1; - unsigned tzero :1; - unsigned abrt :1; - unsigned mcr :1; - unsigned id :1; - unsigned mce :1; - unsigned ecc :1; - unsigned bdd :1; -#elif defined(__BIG_ENDIAN_BITFIELD) - unsigned bdd :1; - unsigned ecc :1; - unsigned mce :1; - unsigned id :1; - unsigned mcr :1; - unsigned abrt :1; - unsigned tzero :1; - unsigned mark :1; -#else -#error "Please fix " -#endif - } b; -} ata_error_t; - /* * ATA-IDE Select Register, aka Device-Head * @@ -498,39 +449,6 @@ typedef union { } b; } ata_status_t, atapi_status_t; -/* - * ATA-IDE Control Register - * - * bit0 : Should be set to zero - * nIEN : device INTRQ to host - * SRST : host soft reset bit - * bit3 : ATA-2 thingy, Should be set to 1 - * reserved456 : Reserved - * HOB : 48-bit address ordering, High Ordered Bit - */ -typedef union { - unsigned all : 8; - struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned bit0 : 1; - unsigned nIEN : 1; - unsigned SRST : 1; - unsigned bit3 : 1; - unsigned reserved456 : 3; - unsigned HOB : 1; -#elif defined(__BIG_ENDIAN_BITFIELD) - unsigned HOB : 1; - unsigned reserved456 : 3; - unsigned bit3 : 1; - unsigned SRST : 1; - unsigned nIEN : 1; - unsigned bit0 : 1; -#else -#error "Please fix " -#endif - } b; -} ata_control_t; - /* * ATAPI Feature Register * @@ -612,39 +530,6 @@ typedef union { } b; } atapi_error_t; -/* - * ATAPI floppy Drive Select Register - * - * sam_lun : Logical unit number - * reserved3 : Reserved - * drv : The responding drive will be drive 0 (0) or drive 1 (1) - * one5 : Should be set to 1 - * reserved6 : Reserved - * one7 : Should be set to 1 - */ -typedef union { - unsigned all :8; - struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned sam_lun :3; - unsigned reserved3 :1; - unsigned drv :1; - unsigned one5 :1; - unsigned reserved6 :1; - unsigned one7 :1; -#elif defined(__BIG_ENDIAN_BITFIELD) - unsigned one7 :1; - unsigned reserved6 :1; - unsigned one5 :1; - unsigned drv :1; - unsigned reserved3 :1; - unsigned sam_lun :3; -#else -#error "Please fix " -#endif - } b; -} atapi_select_t; - /* * Status returned from various ide_ functions */ @@ -697,7 +582,6 @@ typedef struct ide_drive_s { unsigned noprobe : 1; /* from: hdx=noprobe */ unsigned removable : 1; /* 1 if need to do check_media_change */ unsigned attach : 1; /* needed for removable devices */ - unsigned is_flash : 1; /* 1 if probed as flash */ unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ unsigned no_unmask : 1; /* disallow setting unmask bit */ unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ @@ -754,7 +638,7 @@ typedef struct ide_drive_s { int crc_count; /* crc counter to reduce drive speed */ struct list_head list; struct device gendev; - struct semaphore gendev_rel_sem; /* to deal with device release() */ + struct completion gendev_rel_comp; /* to deal with device release() */ } ide_drive_t; #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) @@ -908,16 +792,17 @@ typedef struct hwif_s { unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */ 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 */ struct device gendev; - struct semaphore gendev_rel_sem; /* To deal with device release() */ + struct completion gendev_rel_comp; /* To deal with device release() */ void *hwif_data; /* extra hwif data */ unsigned dma; void (*led_act)(void *data, int rw); -} ide_hwif_t; +} ____cacheline_internodealigned_in_smp ide_hwif_t; /* * internal ide interrupt handler type @@ -1084,9 +969,11 @@ enum { /* * Subdrivers support. + * + * The gendriver.owner field should be set to the module owner of this driver. + * The gendriver.name field should be set to the name of this driver */ typedef struct ide_driver_s { - struct module *owner; const char *version; u8 media; unsigned supports_dsc_overlap : 1; @@ -1094,13 +981,15 @@ typedef struct ide_driver_s { int (*end_request)(ide_drive_t *, int, int); ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); - int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); ide_proc_entry_t *proc; - void (*ata_prebuilder)(ide_drive_t *); - void (*atapi_prebuilder)(ide_drive_t *); struct device_driver gen_driver; + int (*probe)(ide_drive_t *); + void (*remove)(ide_drive_t *); + void (*shutdown)(ide_drive_t *); } ide_driver_t; +#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) + int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); /* @@ -1117,7 +1006,6 @@ extern ide_hwif_t ide_hwifs[]; /* master data repository */ extern int noautodma; extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); -extern int __ide_end_request (ide_drive_t *drive, struct request *rq, int uptodate, int nrsecs); /* * This is used on exit from the driver to designate the next irq handler @@ -1194,37 +1082,11 @@ extern u64 ide_get_error_location(ide_drive_t *, char *); */ typedef enum { ide_wait, /* insert rq at end of list, and wait for it */ - ide_next, /* insert rq immediately after current request */ ide_preempt, /* insert rq in front of current request */ ide_head_wait, /* insert rq in front of current request and wait for it */ ide_end /* insert rq at end of list, but don't wait for it */ } ide_action_t; -/* - * This function issues a special IDE device request - * onto the request queue. - * - * If action is ide_wait, then the rq is queued at the end of the - * request queue, and the function sleeps until it has been processed. - * This is for use when invoked from an ioctl handler. - * - * If action is ide_preempt, then the rq is queued at the head of - * the request queue, displacing the currently-being-processed - * request and this function returns immediately without waiting - * for the new rq to be completed. This is VERY DANGEROUS, and is - * intended for careful use by the ATAPI tape/cdrom driver code. - * - * If action is ide_next, then the rq is queued immediately after - * the currently-being-processed-request (if any), and the function - * returns without waiting for the new rq to be completed. As above, - * This is VERY DANGEROUS, and is intended for careful use by the - * ATAPI tape/cdrom driver code. - * - * If action is ide_end, then the rq is queued at the end of the - * request queue, and the function returns immediately without waiting - * for the new rq to be completed. This is again intended for careful - * use by the ATAPI tape/cdrom driver code. - */ extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); /* @@ -1317,14 +1179,14 @@ extern int ide_spin_wait_hwgroup(ide_drive_t *); extern void ide_timer_expiry(unsigned long); extern irqreturn_t ide_intr(int irq, void *dev_id, struct pt_regs *regs); extern void do_ide_request(request_queue_t *); -extern void ide_init_subdrivers(void); void ide_init_disk(struct gendisk *, ide_drive_t *); extern int ideprobe_init(void); extern void ide_scan_pcibus(int scan_direction) __init; -extern int ide_pci_register_driver(struct pci_driver *driver); +extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner); +#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE) extern void ide_pci_unregister_driver(struct pci_driver *driver); 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); @@ -1358,7 +1220,6 @@ typedef struct ide_pci_enablebit_s { enum { /* Uses ISA control ports not PCI ones. */ IDEPCI_FLAG_ISA_PORTS = (1 << 0), - IDEPCI_FLAG_FORCE_PDC = (1 << 1), }; typedef struct ide_pci_device_s { @@ -1389,6 +1250,12 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *); #define GOOD_DMA_DRIVE 1 #ifdef CONFIG_BLK_DEV_IDEDMA +struct drive_list_entry { + const char *id_model; + const char *id_firmware; +}; + +int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); int __ide_dma_bad_drive(ide_drive_t *); int __ide_dma_good_drive(ide_drive_t *); int ide_use_dma(ide_drive_t *); @@ -1501,4 +1368,10 @@ extern struct bus_type ide_bus_type; #define ide_id_has_flush_cache_ext(id) \ (((id)->cfs_enable_2 & 0x2400) == 0x2400) +static inline int hwif_to_node(ide_hwif_t *hwif) +{ + struct pci_dev *dev = hwif->pci_dev; + return dev ? pcibus_to_node(dev->bus) : -1; +} + #endif /* _IDE_H */