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

📄 aic7xxx_osm.h

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * Adaptec AIC7xxx device driver for Linux. * * Copyright (c) 1994 John Aycock *   The University of Calgary Department of Computer Science. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING.  If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. *  * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_linux.h#72 $ * * Copyright (c) 2000-2001 Adaptec Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions, and the following disclaimer, *    without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer *    substantially similar to the "NO WARRANTY" disclaimer below *    ("Disclaimer") and any redistribution must be conditioned upon *    including a substantially similar Disclaimer requirement for further *    binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names *    of any contributors may be used to endorse or promote products derived *    from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_linux.h#72 $ * */#ifndef _AIC7XXX_LINUX_H_#define _AIC7XXX_LINUX_H_#include <linux/types.h>#include <linux/blk.h>#include <linux/blkdev.h>#include <linux/delay.h>#include <linux/ioport.h>#include <linux/slab.h>#include <linux/pci.h>#include <linux/version.h>#include <linux/module.h>#include <asm/byteorder.h>#ifndef KERNEL_VERSION#define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))#endif#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)#include <linux/config.h>#endif/* Core SCSI definitions */#include "../scsi.h"#include "../hosts.h"/* Name space conflict with BSD queue macros */#ifdef LIST_HEAD#undef LIST_HEAD#endif#include "cam.h"#include "queue.h"#include "scsi_message.h"/************************* Forward Declarations *******************************/struct ahc_softc;typedef struct pci_dev *ahc_dev_softc_t;typedef Scsi_Cmnd      *ahc_io_ctx_t;/******************************* Byte Order ***********************************/#define ahc_htobe16(x)	cpu_to_be16(x)#define ahc_htobe32(x)	cpu_to_be32(x)#define ahc_htobe64(x)	cpu_to_be64(x)#define ahc_htole16(x)	cpu_to_le16(x)#define ahc_htole32(x)	cpu_to_le32(x)#define ahc_htole64(x)	cpu_to_le64(x)#define ahc_be16toh(x)	be16_to_cpu(x)#define ahc_be32toh(x)	be32_to_cpu(x)#define ahc_be64toh(x)	be64_to_cpu(x)#define ahc_le16toh(x)	le16_to_cpu(x)#define ahc_le32toh(x)	le32_to_cpu(x)#define ahc_le64toh(x)	le64_to_cpu(x)#ifndef LITTLE_ENDIAN#define LITTLE_ENDIAN 1234#endif#ifndef BIG_ENDIAN#define BIG_ENDIAN 4321#endif#ifndef BYTE_ORDER#if defined(__BIG_ENDIAN)#define BYTE_ORDER BIG_ENDIAN#endif#if defined(__LITTLE_ENDIAN)#define BYTE_ORDER LITTLE_ENDIAN#endif#endif /* BYTE_ORDER *//************************* Configuration Data *********************************/extern int aic7xxx_no_probe;extern int aic7xxx_detect_complete;extern Scsi_Host_Template* aic7xxx_driver_template;/***************************** Bus Space/DMA **********************************/#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,17)typedef dma_addr_t bus_addr_t;#elsetypedef uint32_t bus_addr_t;#endiftypedef uint32_t bus_size_t;typedef enum {	BUS_SPACE_MEMIO,	BUS_SPACE_PIO} bus_space_tag_t;typedef union {	u_long		  ioport;	volatile uint8_t *maddr;} bus_space_handle_t;typedef struct bus_dma_segment{	bus_addr_t	ds_addr;	bus_size_t	ds_len;} bus_dma_segment_t;struct ahc_linux_dma_tag{	bus_size_t	alignment;	bus_size_t	boundary;	bus_size_t	maxsize;};typedef struct ahc_linux_dma_tag* bus_dma_tag_t;struct ahc_linux_dmamap{	bus_addr_t	bus_addr;};typedef struct ahc_linux_dmamap* bus_dmamap_t;typedef int bus_dma_filter_t(void*, bus_addr_t);typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);#define BUS_DMA_WAITOK		0x0#define BUS_DMA_NOWAIT		0x1#define BUS_DMA_ALLOCNOW	0x2#define BUS_DMA_LOAD_SEGS	0x4	/*					 * Argument is an S/G list not					 * a single buffer.					 */#define BUS_SPACE_MAXADDR	0xFFFFFFFF#define BUS_SPACE_MAXADDR_32BIT	0xFFFFFFFF#define BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFFint	ahc_dma_tag_create(struct ahc_softc *, bus_dma_tag_t /*parent*/,			   bus_size_t /*alignment*/, bus_size_t /*boundary*/,			   bus_addr_t /*lowaddr*/, bus_addr_t /*highaddr*/,			   bus_dma_filter_t*/*filter*/, void */*filterarg*/,			   bus_size_t /*maxsize*/, int /*nsegments*/,			   bus_size_t /*maxsegsz*/, int /*flags*/,			   bus_dma_tag_t */*dma_tagp*/);void	ahc_dma_tag_destroy(struct ahc_softc *, bus_dma_tag_t /*tag*/);int	ahc_dmamem_alloc(struct ahc_softc *, bus_dma_tag_t /*dmat*/,			 void** /*vaddr*/, int /*flags*/,			 bus_dmamap_t* /*mapp*/);void	ahc_dmamem_free(struct ahc_softc *, bus_dma_tag_t /*dmat*/,			void* /*vaddr*/, bus_dmamap_t /*map*/);void	ahc_dmamap_destroy(struct ahc_softc *, bus_dma_tag_t /*tag*/,			   bus_dmamap_t /*map*/);int	ahc_dmamap_load(struct ahc_softc *ahc, bus_dma_tag_t /*dmat*/,			bus_dmamap_t /*map*/, void * /*buf*/,			bus_size_t /*buflen*/, bus_dmamap_callback_t *,			void */*callback_arg*/, int /*flags*/);int	ahc_dmamap_unload(struct ahc_softc *, bus_dma_tag_t, bus_dmamap_t);/* * Operations performed by ahc_dmamap_sync(). */#define BUS_DMASYNC_PREREAD	0x01	/* pre-read synchronization */#define BUS_DMASYNC_POSTREAD	0x02	/* post-read synchronization */#define BUS_DMASYNC_PREWRITE	0x04	/* pre-write synchronization */#define BUS_DMASYNC_POSTWRITE	0x08	/* post-write synchronization *//* * XXX * ahc_dmamap_sync is only used on buffers allocated with * the pci_alloc_consistent() API.  Although I'm not sure how * this works on architectures with a write buffer, Linux does * not have an API to sync "coherent" memory.  Perhaps we need * to do an mb()? */#define ahc_dmamap_sync(ahc, dma_tag, dmamap, offset, len, op)/************************** SCSI Constants/Structures *************************/#define SCSI_REV_2 2#define	SCSI_STATUS_OK			0x00#define	SCSI_STATUS_CHECK_COND		0x02#define	SCSI_STATUS_COND_MET		0x04#define	SCSI_STATUS_BUSY		0x08#define SCSI_STATUS_INTERMED		0x10#define SCSI_STATUS_INTERMED_COND_MET	0x14#define SCSI_STATUS_RESERV_CONFLICT	0x18#define SCSI_STATUS_CMD_TERMINATED	0x22#define SCSI_STATUS_QUEUE_FULL		0x28/* * 6 byte request sense CDB format. */struct scsi_sense{	uint8_t opcode;	uint8_t byte2;	uint8_t unused[2];	uint8_t length;	uint8_t control;};struct scsi_sense_data{	uint8_t	error_code;	uint8_t	segment;	uint8_t	flags;	uint8_t	info[4];	uint8_t	extra_len;	uint8_t	cmd_spec_info[4];	uint8_t add_sense_code;	uint8_t add_sense_code_qual;	uint8_t	fru;	uint8_t	sense_key_spec[3];	uint8_t	extra_bytes[14];};struct scsi_inquiry{ 	u_int8_t opcode;	u_int8_t byte2;#define	SI_EVPD 0x01	u_int8_t page_code;	u_int8_t reserved;	u_int8_t length;	u_int8_t control;};struct scsi_inquiry_data{	uint8_t device;#define	SID_TYPE(inq_data) ((inq_data)->device & 0x1f)#define	SID_QUAL(inq_data) (((inq_data)->device & 0xE0) >> 5)#define	SID_QUAL_LU_CONNECTED	0x00	/*					 * The specified peripheral device					 * type is currently connected to					 * logical unit.  If the target cannot					 * determine whether or not a physical					 * device is currently connected, it					 * shall also use this peripheral					 * qualifier when returning the INQUIRY					 * data.  This peripheral qualifier					 * does not mean that the device is					 * ready for access by the initiator.					 */#define	SID_QUAL_LU_OFFLINE	0x01	/*					 * The target is capable of supporting					 * the specified peripheral device type					 * on this logical unit; however, the					 * physical device is not currently					 * connected to this logical unit.					 */#define SID_QUAL_RSVD		0x02#define	SID_QUAL_BAD_LU		0x03	/*					 * The target is not capable of					 * supporting a physical device on					 * this logical unit. For this					 * peripheral qualifier the peripheral					 * device type shall be set to 1Fh to					 * provide compatibility with previous					 * versions of SCSI. All other					 * peripheral device type values are					 * reserved for this peripheral					 * qualifier.					 */#define	SID_QUAL_IS_VENDOR_UNIQUE(inq_data) ((SID_QUAL(inq_data) & 0x08) != 0)	uint8_t dev_qual2;#define	SID_QUAL2	0x7F#define	SID_IS_REMOVABLE(inq_data) (((inq_data)->dev_qual2 & 0x80) != 0)	uint8_t version;#define SID_ANSI_REV(inq_data) ((inq_data)->version & 0x07)#define		SCSI_REV_0		0#define		SCSI_REV_CCS		1#define		SCSI_REV_2		2#define		SCSI_REV_SPC		3#define		SCSI_REV_SPC2		4#define SID_ECMA	0x38#define SID_ISO		0xC0	uint8_t response_format;#define SID_AENC	0x80#define SID_TrmIOP	0x40	uint8_t additional_length;	uint8_t reserved[2];	uint8_t flags;#define	SID_SftRe	0x01#define	SID_CmdQue	0x02#define	SID_Linked	0x08#define	SID_Sync	0x10#define	SID_WBus16	0x20#define	SID_WBus32	0x40#define	SID_RelAdr	0x80#define SID_VENDOR_SIZE   8	char	 vendor[SID_VENDOR_SIZE];#define SID_PRODUCT_SIZE  16	char	 product[SID_PRODUCT_SIZE];#define SID_REVISION_SIZE 4	char	 revision[SID_REVISION_SIZE];	/*	 * The following fields were taken from SCSI Primary Commands - 2	 * (SPC-2) Revision 14, Dated 11 November 1999	 */#define	SID_VENDOR_SPECIFIC_0_SIZE	20	u_int8_t vendor_specific0[SID_VENDOR_SPECIFIC_0_SIZE];	/*	 * An extension of SCSI Parallel Specific Values	 */#define	SID_SPI_IUS		0x01#define	SID_SPI_QAS		0x02#define	SID_SPI_CLOCK_ST	0x00#define	SID_SPI_CLOCK_DT	0x04#define	SID_SPI_CLOCK_DT_ST	0x0C#define	SID_SPI_MASK		0x0F	uint8_t spi3data;	uint8_t reserved2;	/*	 * Version Descriptors, stored 2 byte values.	 */

⌨️ 快捷键说明

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