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

📄 libata.h

📁 自己做的交叉编译工具!gcc-3.4.5,glibc-2.3.6在ubuntu8.04上做的面向kernel-2.6.28的交叉编译工具
💻 H
📖 第 1 页 / 共 2 页
字号:
	void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);	void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf);	__u8   (*check_status)(struct ata_port *ap);	__u8   (*check_altstatus)(struct ata_port *ap);	__u8   (*check_err)(struct ata_port *ap);	void (*dev_select)(struct ata_port *ap, unsigned int device);	void (*phy_reset) (struct ata_port *ap);	void (*post_set_mode) (struct ata_port *ap);	int (*check_atapi_dma) (struct ata_queued_cmd *qc);	void (*bmdma_setup) (struct ata_queued_cmd *qc);	void (*bmdma_start) (struct ata_queued_cmd *qc);	void (*qc_prep) (struct ata_queued_cmd *qc);	int (*qc_issue) (struct ata_queued_cmd *qc);	void (*eng_timeout) (struct ata_port *ap);	irqreturn_t (*irq_handler)(int, void *, struct pt_regs *);	void (*irq_clear) (struct ata_port *);	__u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);	void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,			   __u32 val);	int (*port_start) (struct ata_port *ap);	void (*port_stop) (struct ata_port *ap);	void (*host_stop) (struct ata_host_set *host_set);	void (*bmdma_stop) (struct ata_port *ap);	__u8   (*bmdma_status) (struct ata_port *ap);};struct ata_port_info {	Scsi_Host_Template	*sht;	unsigned long		host_flags;	unsigned long		pio_mask;	unsigned long		mwdma_mask;	unsigned long		udma_mask;	struct ata_port_operations	*port_ops;};extern void ata_port_probe(struct ata_port *);extern void __sata_phy_reset(struct ata_port *ap);extern void sata_phy_reset(struct ata_port *ap);extern void ata_bus_reset(struct ata_port *ap);extern void ata_port_disable(struct ata_port *);extern void ata_std_ports(struct ata_ioports *ioaddr);#ifdef CONFIG_PCIextern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,			     unsigned int n_ports);extern void ata_pci_remove_one (struct pci_dev *pdev);#endif /* CONFIG_PCI */extern int ata_device_add(struct ata_probe_ent *ent);extern int ata_scsi_detect(Scsi_Host_Template *sht);extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));extern int ata_scsi_error(struct Scsi_Host *host);extern int ata_scsi_release(struct Scsi_Host *host);extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);/* * Default driver ops implementations */extern void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf);extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);extern void ata_tf_to_fis(struct ata_taskfile *tf, __u8 *fis, __u8 pmp);extern void ata_tf_from_fis(__u8 *fis, struct ata_taskfile *tf);extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device);extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);extern __u8 ata_check_status(struct ata_port *ap);extern __u8 ata_altstatus(struct ata_port *ap);extern __u8 ata_chk_err(struct ata_port *ap);extern void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf);extern int ata_port_start (struct ata_port *ap);extern void ata_port_stop (struct ata_port *ap);extern void ata_host_stop (struct ata_host_set *host_set);extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);extern void ata_qc_prep(struct ata_queued_cmd *qc);extern int ata_qc_issue_prot(struct ata_queued_cmd *qc);extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,		unsigned int buflen);extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,		 unsigned int n_elem);extern unsigned int ata_dev_classify(struct ata_taskfile *tf);extern void ata_dev_id_string(__u16 *id, unsigned char *s,			      unsigned int ofs, unsigned int len);extern void ata_bmdma_setup (struct ata_queued_cmd *qc);extern void ata_bmdma_start (struct ata_queued_cmd *qc);extern void ata_bmdma_stop(struct ata_port *ap);extern __u8   ata_bmdma_status(struct ata_port *ap);extern void ata_bmdma_irq_clear(struct ata_port *ap);extern void ata_qc_complete(struct ata_queued_cmd *qc, __u8 drv_stat);extern void ata_eng_timeout(struct ata_port *ap);extern void ata_scsi_simulate(__u16 *id, struct scsi_cmnd *cmd,			      void (*done)(struct scsi_cmnd *));extern int ata_std_bios_param(struct scsi_device *sdev,			      struct block_device *bdev,			      sector_t capacity, int geom[]);extern int ata_scsi_slave_config(struct scsi_device *sdev);#ifdef CONFIG_PCIstruct pci_bits {	unsigned int		reg;	/* PCI config register to read */	unsigned int		width;	/* 1 (8 bit), 2 (16 bit), 4 (32 bit) */	unsigned long		mask;	unsigned long		val;};extern struct ata_probe_ent *ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port);extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);#endif /* CONFIG_PCI */static inline unsigned int ata_tag_valid(unsigned int tag){	return (tag < ATA_MAX_QUEUE) ? 1 : 0;}static inline unsigned int ata_dev_present(struct ata_device *dev){	return ((dev->class == ATA_DEV_ATA) ||		(dev->class == ATA_DEV_ATAPI));}static inline __u8 ata_chk_status(struct ata_port *ap){	return ap->ops->check_status(ap);}/** *	ata_pause - Flush writes and pause 400 nanoseconds. *	@ap: Port to wait for. * *	LOCKING: *	Inherited from caller. */static inline void ata_pause(struct ata_port *ap){	ata_altstatus(ap);	ndelay(400);}/** *	ata_busy_wait - Wait for a port status register *	@ap: Port to wait for. * *	Waits up to max*10 microseconds for the selected bits in the port's *	status register to be cleared. *	Returns final value of status register. * *	LOCKING: *	Inherited from caller. */static inline __u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,			       unsigned int max){	__u8 status;	do {		udelay(10);		status = ata_chk_status(ap);		max--;	} while ((status & bits) && (max > 0));	return status;}/** *	ata_wait_idle - Wait for a port to be idle. *	@ap: Port to wait for. * *	Waits up to 10ms for port's BUSY and DRQ signals to clear. *	Returns final value of status register. * *	LOCKING: *	Inherited from caller. */static inline __u8 ata_wait_idle(struct ata_port *ap){	__u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);	if (status & (ATA_BUSY | ATA_DRQ)) {		unsigned long l = ap->ioaddr.status_addr;		printk(KERN_WARNING		       "ATA: abnormal status 0x%X on port 0x%lX\n",		       status, l);	}	return status;}static inline void ata_qc_set_polling(struct ata_queued_cmd *qc){	qc->tf.ctl |= ATA_NIEN;}static inline struct ata_queued_cmd *ata_qc_from_tag (struct ata_port *ap,						      unsigned int tag){	if (likely(ata_tag_valid(tag)))		return &ap->qcmd[tag];	return NULL;}static inline void ata_tf_init(struct ata_port *ap, struct ata_taskfile *tf, unsigned int device){	memset(tf, 0, sizeof(*tf));	tf->ctl = ap->ctl;	if (device == 0)		tf->device = ATA_DEVICE_OBS;	else		tf->device = ATA_DEVICE_OBS | ATA_DEV1;}/** *	ata_irq_on - Enable interrupts on a port. *	@ap: Port on which interrupts are enabled. * *	Enable interrupts on a legacy IDE device using MMIO or PIO, *	wait for idle, clear any pending interrupts. * *	LOCKING: *	Inherited from caller. */static inline __u8 ata_irq_on(struct ata_port *ap){	struct ata_ioports *ioaddr = &ap->ioaddr;	__u8 tmp;	ap->ctl &= ~ATA_NIEN;	ap->last_ctl = ap->ctl;	if (ap->flags & ATA_FLAG_MMIO)		writeb(ap->ctl, (void *) ioaddr->ctl_addr);	else		outb(ap->ctl, ioaddr->ctl_addr);	tmp = ata_wait_idle(ap);	ap->ops->irq_clear(ap);	return tmp;}/** *	ata_irq_ack - Acknowledge a device interrupt. *	@ap: Port on which interrupts are enabled. * *	Wait up to 10 ms for legacy IDE device to become idle (BUSY *	or BUSY+DRQ clear).  Obtain dma status and port status from *	device.  Clear the interrupt.  Return port status. * *	LOCKING: */static inline __u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq){	unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;	__u8 host_stat, post_stat, status;	status = ata_busy_wait(ap, bits, 1000);	if (status & bits)		DPRINTK("abnormal status 0x%X\n", status);	/* get controller status; clear intr, err bits */	if (ap->flags & ATA_FLAG_MMIO) {		void *mmio = (void *) ap->ioaddr.bmdma_addr;		host_stat = readb(mmio + ATA_DMA_STATUS);		writeb(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,		       mmio + ATA_DMA_STATUS);		post_stat = readb(mmio + ATA_DMA_STATUS);	} else {		host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);		outb(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,		     ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);		post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);	}	VPRINTK("irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",		host_stat, post_stat, status);	return status;}static inline __u32 scr_read(struct ata_port *ap, unsigned int reg){	return ap->ops->scr_read(ap, reg);}static inline void scr_write(struct ata_port *ap, unsigned int reg, __u32 val){	ap->ops->scr_write(ap, reg, val);}static inline void scr_write_flush(struct ata_port *ap, unsigned int reg, 				   __u32 val){	ap->ops->scr_write(ap, reg, val);	(void) ap->ops->scr_read(ap, reg);}static inline unsigned int sata_dev_present(struct ata_port *ap){	return ((scr_read(ap, SCR_STATUS) & 0xf) == 0x3) ? 1 : 0;}static inline int ata_try_flush_cache(struct ata_device *dev){	return ata_id_wcache_enabled(dev->id) ||	       ata_id_has_flush(dev->id) ||	       ata_id_has_flush_ext(dev->id);}#endif /* __LINUX_LIBATA_H__ */

⌨️ 快捷键说明

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