⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ide.h

📁 linux 内核源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
 * io		: The device requests us to read (1) or write (0) * reserved	: Reserved */typedef union {	unsigned all			:8;	struct {#if defined(__LITTLE_ENDIAN_BITFIELD)		unsigned cod		:1;		unsigned io		:1;		unsigned reserved	:6;#elif defined(__BIG_ENDIAN_BITFIELD)		unsigned reserved	:6;		unsigned io		:1;		unsigned cod		:1;#else#error "Please fix <asm/byteorder.h>"#endif	} b;} atapi_ireason_t;/* * The ATAPI error register. * * ili		: Illegal Length Indication * eom		: End Of Media Detected * abrt		: Aborted command - As defined by ATA * mcr		: Media Change Requested - As defined by ATA * sense_key	: Sense key of the last failed packet command */typedef union {	unsigned all			:8;	struct {#if defined(__LITTLE_ENDIAN_BITFIELD)		unsigned ili		:1;		unsigned eom		:1;		unsigned abrt		:1;		unsigned mcr		:1;		unsigned sense_key	:4;#elif defined(__BIG_ENDIAN_BITFIELD)		unsigned sense_key	:4;		unsigned mcr		:1;		unsigned abrt		:1;		unsigned eom		:1;		unsigned ili		:1;#else#error "Please fix <asm/byteorder.h>"#endif	} b;} atapi_error_t;/* * Status returned from various ide_ functions */typedef enum {	ide_stopped,	/* no drive operation was started */	ide_started,	/* a drive operation was started, handler was set */} ide_startstop_t;struct ide_driver_s;struct ide_settings_s;#ifdef CONFIG_BLK_DEV_IDEACPIstruct ide_acpi_drive_link;struct ide_acpi_hwif_link;#endiftypedef struct ide_drive_s {	char		name[4];	/* drive name, such as "hda" */        char            driver_req[10];	/* requests specific driver */	struct request_queue	*queue;	/* request queue */	struct request		*rq;	/* current request */	struct ide_drive_s 	*next;	/* circular list of hwgroup drives */	void		*driver_data;	/* extra driver data */	struct hd_driveid	*id;	/* drive model identification info */#ifdef CONFIG_IDE_PROC_FS	struct proc_dir_entry *proc;	/* /proc/ide/ directory entry */	struct ide_settings_s *settings;/* /proc/ide/ drive settings */#endif	struct hwif_s		*hwif;	/* actually (ide_hwif_t *) */	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 */	select_t	select;		/* basic drive/head select reg value */	u8	keep_settings;		/* restore settings after drive reset */	u8	using_dma;		/* disk is using dma for read/write */	u8	retry_pio;		/* retrying dma capable host in pio */	u8	state;			/* retry state */	u8	waiting_for_dma;	/* dma currently in progress */	u8	unmask;			/* okay to unmask other irqs */	u8	bswap;			/* byte swap data */	u8	noflush;		/* don't attempt flushes */	u8	dsc_overlap;		/* DSC overlap */	u8	nice1;			/* give potential excess bandwidth */	unsigned present	: 1;	/* drive is physically present */	unsigned dead		: 1;	/* device ejected hint */	unsigned id_read	: 1;	/* 1=id read from disk 0 = synthetic */	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 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 */	unsigned atapi_overlap	: 1;	/* ATAPI overlap (not supported) */	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 */	unsigned vdma		: 1;	/* 1=doing PIO over DMA 0=doing normal DMA */	unsigned scsi		: 1;	/* 0=default, 1=ide-scsi emulation */	unsigned sleeping	: 1;	/* 1=sleeping & sleep field valid */	unsigned post_reset	: 1;	unsigned udma33_warned	: 1;	u8	addressing;	/* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */        u8	quirk_list;	/* considered quirky, set for a specific host */        u8	init_speed;	/* transfer rate set at boot */        u8	current_speed;	/* current transfer rate set */	u8	desired_speed;	/* desired transfer rate set */        u8	dn;		/* now wide spread use */        u8	wcache;		/* status of write cache */	u8	acoustic;	/* acoustic management */	u8	media;		/* disk, cdrom, tape, floppy, ... */	u8	ctl;		/* "normal" value for IDE_CONTROL_REG */	u8	ready_stat;	/* min status value for drive ready */	u8	mult_count;	/* current multiple sector setting */	u8	mult_req;	/* requested multiple sector setting */	u8	tune_req;	/* requested drive tuning setting */	u8	io_32bit;	/* 0=16-bit, 1=32-bit, 2/3=32bit+sync */	u8	bad_wstat;	/* used for ignoring WRERR_STAT */	u8	nowerr;		/* used for ignoring WRERR_STAT */	u8	sect0;		/* offset of first sector for DM6:DDO */	u8	head;		/* "real" number of heads */	u8	sect;		/* "real" sectors per track */	u8	bios_head;	/* BIOS/fdisk/LILO number of heads */	u8	bios_sect;	/* BIOS/fdisk/LILO sectors per track */	unsigned int	bios_cyl;	/* BIOS/fdisk/LILO number of cyls */	unsigned int	cyl;		/* "real" number of cyls */	unsigned int	drive_data;	/* used by set_pio_mode/selectproc */	unsigned int	failures;	/* current failure count */	unsigned int	max_failures;	/* maximum allowed failure count */	u64		probed_capacity;/* initial reported media capacity (ide-cd only currently) */	u64		capacity64;	/* total number of sectors */	int		lun;		/* logical unit */	int		crc_count;	/* crc counter to reduce drive speed */#ifdef CONFIG_BLK_DEV_IDEACPI	struct ide_acpi_drive_link *acpidata;#endif	struct list_head list;	struct device	gendev;	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)#define IDE_CHIPSET_PCI_MASK	\    ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))#define IDE_CHIPSET_IS_PCI(c)	((IDE_CHIPSET_PCI_MASK >> (c)) & 1)struct ide_port_info;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 */	struct hwgroup_s *hwgroup;	/* actually (ide_hwgroup_t *) */	struct proc_dir_entry *proc;	/* /proc/ide/ directory entry */	char name[6];			/* name of interface, eg. "ide0" */		/* task file registers for pata and sata */	unsigned long	io_ports[IDE_NR_PORTS];	unsigned long	sata_scr[SATA_NR_PORTS];	unsigned long	sata_misc[SATA_NR_PORTS];	ide_drive_t	drives[MAX_DRIVES];	/* drive info */	u8 major;	/* our major number */	u8 index;	/* 0 for ide0; 1 for ide1; ... */	u8 channel;	/* for dual-port chips: 0=primary, 1=secondary */	u8 straight8;	/* Alan's straight 8 check */	u8 bus_state;	/* power state of the IDE bus */	u32 host_flags;	u8 pio_mask;	u8 ultra_mask;	u8 mwdma_mask;	u8 swdma_mask;	u8 cbl;		/* cable type */	hwif_chipset_t chipset;	/* sub-module for tuning.. */	struct pci_dev  *pci_dev;	/* for pci chipsets */	const struct ide_port_info *cds;	/* chipset device struct */	ide_ack_intr_t *ack_intr;	void (*rw_disk)(ide_drive_t *, struct request *);#if 0	ide_hwif_ops_t	*hwifops;#else	/* routine to program host for PIO mode */	void	(*set_pio_mode)(ide_drive_t *, const u8);	/* routine to program host for DMA mode */	void	(*set_dma_mode)(ide_drive_t *, const u8);	/* tweaks hardware to select drive */	void	(*selectproc)(ide_drive_t *);	/* chipset polling based on hba specifics */	int	(*reset_poll)(ide_drive_t *);	/* chipset specific changes to default for device-hba resets */	void	(*pre_reset)(ide_drive_t *);	/* routine to reset controller after a disk reset */	void	(*resetproc)(ide_drive_t *);	/* special interrupt handling for shared pci interrupts */	void	(*intrproc)(ide_drive_t *);	/* special host masking for drive selection */	void	(*maskproc)(ide_drive_t *, int);	/* check host's drive quirk list */	int	(*quirkproc)(ide_drive_t *);	/* driver soft-power interface */	int	(*busproc)(ide_drive_t *, int);#endif	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);	void (*atapi_input_bytes)(ide_drive_t *, void *, u32);	void (*atapi_output_bytes)(ide_drive_t *, void *, u32);	int (*dma_setup)(ide_drive_t *);	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_on)(ide_drive_t *drive);	void (*dma_off_quietly)(ide_drive_t *drive);	int (*ide_dma_test_irq)(ide_drive_t *drive);	void (*ide_dma_clear_irq)(ide_drive_t *drive);	void (*dma_host_on)(ide_drive_t *drive);	void (*dma_host_off)(ide_drive_t *drive);	void (*dma_lost_irq)(ide_drive_t *drive);	void (*dma_timeout)(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;	/* dma physical region descriptor table (dma view) */	dma_addr_t	dmatable_dma;	/* Scatter-gather list used to build the above */	struct scatterlist *sg_table;	int sg_max_nents;		/* Maximum number of entries in it */	int sg_nents;			/* Current number of entries in it */	int sg_dma_direction;		/* dma transfer direction */	/* data phase of the active command (currently only valid for PIO/DMA) */	int		data_phase;	unsigned int nsect;	unsigned int nleft;	struct scatterlist *cursg;	unsigned int cursg_ofs;	int		rqsize;		/* max sectors per request */	int		irq;		/* our irq number */	unsigned long	dma_master;	/* reference base addr dmabase */	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 */	unsigned long	extra_base;	/* extra addr for dma ports */	unsigned	extra_ports;	/* number of extra dma ports */	unsigned	noprobe    : 1;	/* don't probe for this interface */	unsigned	present    : 1;	/* this interface exists */	unsigned	hold       : 1; /* this interface is always present */	unsigned	serialized : 1;	/* serialized all channel operation */	unsigned	sharing_irq: 1;	/* 1 = sharing irq with another hwif */	unsigned	reset      : 1;	/* reset after probe */	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	mmio       : 1; /* host uses MMIO */	struct device	gendev;	struct completion gendev_rel_comp; /* To deal with device release() */	void		*hwif_data;	/* extra hwif data */	unsigned dma;#ifdef CONFIG_BLK_DEV_IDEACPI	struct ide_acpi_hwif_link *acpidata;#endif} ____cacheline_internodealigned_in_smp ide_hwif_t;/* *  internal ide interrupt handler type */typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);typedef int (ide_expiry_t)(ide_drive_t *);typedef struct hwgroup_s {		/* irq handler, if active */	ide_startstop_t	(*handler)(ide_drive_t *);		/* irq handler, suspended if active */	ide_startstop_t	(*handler_save)(ide_drive_t *);		/* 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;	 	/* BOOL: in a polling reset situation. Must not trigger another reset yet */	unsigned int resetting  : 1;		/* current drive */	ide_drive_t *drive;		/* ptr to current hwif in linked-list */	ide_hwif_t *hwif;		/* for pci chipsets */	struct pci_dev *pci_dev;		/* current request */	struct request *rq;		/* failsafe timer */	struct timer_list timer;		/* local copy of current write rq */	struct request wrq;		/* timeout value during long polls */	unsigned long poll_timeout;		/* queried upon timeouts */	int (*expiry)(ide_drive_t *);		/* ide_system_bus_speed */	int pio_clock;	int req_gen;	int req_gen_timer;	unsigned char cmd_buf[4];} ide_hwgroup_t;typedef struct ide_driver_s ide_driver_t;extern struct mutex ide_setting_mtx;int set_io_32bit(ide_drive_t *, int);int set_pio_mode(ide_drive_t *, int);int set_using_dma(ide_drive_t *, int);#ifdef CONFIG_IDE_PROC_FS/* * configurable drive settings */#define TYPE_INT	0#define TYPE_BYTE	1#define TYPE_SHORT	2#define SETTING_READ	(1 << 0)#define SETTING_WRITE	(1 << 1)#define SETTING_RW	(SETTING_READ | SETTING_WRITE)typedef int (ide_procset_t)(ide_drive_t *, int);typedef struct ide_settings_s {	char			*name;	int			rw;	int			data_type;	int			min;	int			max;	int			mul_factor;	int			div_factor;	void			*data;	ide_procset_t		*set;	int			auto_remove;	struct ide_settings_s	*next;} ide_settings_t;int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set);/* * /proc/ide interface */typedef struct {	const char	*name;	mode_t		mode;	read_proc_t	*read_proc;	write_proc_t	*write_proc;} ide_proc_entry_t;void proc_ide_create(void);void proc_ide_destroy(void);void ide_proc_register_port(ide_hwif_t *);void ide_proc_unregister_port(ide_hwif_t *);void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);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_IDEPCIvoid ide_pci_create_host_proc(const char *, get_info_t *);#endif/* * Standard exit stuff: */#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \{					\	len -= off;			\	if (len < count) {		\		*eof = 1;		\		if (len <= 0)		\			return 0;	\	} else				\		len = count;		\	*start = page + off;		\	return len;			\}#elsestatic inline void proc_ide_create(void) { ; }static inline void proc_ide_destroy(void) { ; }static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }static inline void ide_add_generic_settings(ide_drive_t *drive) { ; }#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;#endif/* * Power Management step value (rq->pm->pm_step). * * The step value starts at 0 (ide_pm_state_start_suspend) for a * suspend operation or 1000 (ide_pm_state_start_resume) for a * resume operation.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -